diff --git a/docs/qa/blog-comment-recovery/baseline-ui-tests.txt b/docs/qa/blog-comment-recovery/baseline-ui-tests.txt new file mode 100644 index 00000000..b298a320 --- /dev/null +++ b/docs/qa/blog-comment-recovery/baseline-ui-tests.txt @@ -0,0 +1,45 @@ + + RUN v4.1.8 /Users/nubs/Git/AgentNet-session-feed-20260916/surfaces/webview + + ❯ src/market/BlogPostView.spec.tsx (3 tests | 2 failed) 198ms + × preserves a Korean draft on failure, permits retry, clears only on success 116ms + × late comment refresh does not close a reply or acknowledge its submission 39ms + + Test Files 1 failed (1) + Tests 2 failed | 1 passed (3) + Start at 02:21:16 + Duration 2.12s (transform 614ms, setup 0ms, import 739ms, tests 198ms, environment 945ms) + + +⎯⎯⎯⎯⎯⎯⎯ Failed Tests 2 ⎯⎯⎯⎯⎯⎯⎯ + + FAIL src/market/BlogPostView.spec.tsx > preserves a Korean draft on failure, permits retry, clears only on success +AssertionError: expected '' to contain '안녕하세요' + +- Expected ++ Received + +- 안녕하세요 + + ❯ src/market/BlogPostView.spec.tsx:22:25 + 20| it('preserves a Korean draft on failure, permits retry, clears only on… + 21| await type('안녕하세요, 다시 시도할 댓글입니다'); await click('Comment'); + 22| expect(field().value).toContain('안녕하세요'); expect(field().disabled).t… + | ^ + 23| store.state.blogCommentResults['local-post'] = { ok: false, error: '… + 24| expect(field().disabled).toBe(false); expect(field().value).toContai… + +⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[1/2]⎯ + + FAIL src/market/BlogPostView.spec.tsx > late comment refresh does not close a reply or acknowledge its submission +TypeError: Cannot read properties of null (reading 'value') + ❯ src/market/BlogPostView.spec.tsx:30:94 + 28| it('late comment refresh does not close a reply or acknowledge its sub… + 29| await click('[Reply]'); await type('reply draft', true); + 30| store.state.blogComments['local-post'] = [{ ...thread }]; await rend… + | ^ + 31| store.state.blogComments['local-post'] = [{ ...thread }]; await rend… + 32| store.state.blogCommentResults['other-post'] = { ok: true }; await r… + +⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[2/2]⎯ + diff --git a/docs/qa/blog-comment-recovery/comment-failure-draft.png b/docs/qa/blog-comment-recovery/comment-failure-draft.png new file mode 100644 index 00000000..b547ec30 Binary files /dev/null and b/docs/qa/blog-comment-recovery/comment-failure-draft.png differ diff --git a/docs/qa/blog-comment-recovery/fixed-ui-tests.txt b/docs/qa/blog-comment-recovery/fixed-ui-tests.txt new file mode 100644 index 00000000..91551061 --- /dev/null +++ b/docs/qa/blog-comment-recovery/fixed-ui-tests.txt @@ -0,0 +1,9 @@ + + RUN v4.1.8 /Users/nubs/Git/AgentNet-session-feed-20260916/surfaces/webview + + + Test Files 1 passed (1) + Tests 4 passed (4) + Start at 02:25:32 + Duration 935ms (transform 146ms, setup 0ms, import 195ms, tests 123ms, environment 500ms) + diff --git a/docs/qa/blog-comment-recovery/mobile-reply-preserved.png b/docs/qa/blog-comment-recovery/mobile-reply-preserved.png new file mode 100644 index 00000000..1ff26f10 Binary files /dev/null and b/docs/qa/blog-comment-recovery/mobile-reply-preserved.png differ diff --git a/docs/qa/blog-read-recovery/README.md b/docs/qa/blog-read-recovery/README.md new file mode 100644 index 00000000..e05e0d47 --- /dev/null +++ b/docs/qa/blog-read-recovery/README.md @@ -0,0 +1,14 @@ +# Blog read recovery + +Local verification, 2026-09-16. Production BlogFeed/BlogPostView components; screenshots use explicitly simulated gateway responses. No wallet, inscription or public post was submitted. + +- Shared reader tests cover out-of-order feed sorts, obsolete errors, independent post reads, failed-read retry, and invalidation of old comments after a successful write. +- React tests cover unavailable author-table bodies (never substitute the feed preview), failed-feed retry, and preserving Korean drafts/cached comments during read failure. +- Browser: the failure state has Retry; clicking it restores the Korean preview; opening a missing author-table post shows an unavailable state with Back/Retry. +- Confirmed comment writes remain successful when only their follow-up read fails. The error belongs to the comments read, so users are not prompted to submit duplicate comments. + +Validation: all 480 core tests passed on rerun, all 7 webview tests passed, production build passed. Initial full-core run hit the existing session-settings test's fixed-delay timing race and cleanup rejection; both logs are retained. Typecheck reports the same ten baseline unused-symbol errors. This patch does not fix the independent session-history race or all issue #208 media-cluster paths. + +![Read failed with Retry](feed-error-mobile.png) +![Retry restored the feed](feed-recovered-mobile.png) +![Missing author body is not substituted](feed-unavailable-mobile.png) diff --git a/docs/qa/blog-read-recovery/feed-build-final.txt b/docs/qa/blog-read-recovery/feed-build-final.txt new file mode 100644 index 00000000..30dfc27e --- /dev/null +++ b/docs/qa/blog-read-recovery/feed-build-final.txt @@ -0,0 +1,20 @@ +vite v7.3.5 building client environment for production... +transforming... +✓ 169 modules transformed. +rendering chunks... +computing gzip size... +dist/index.html 1.20 kB │ gzip: 0.61 kB +dist/assets/chakra-petch-700-BVfRasCZ.woff2 9.87 kB +dist/assets/chakra-petch-600-BA8AzLCM.woff2 10.04 kB +dist/assets/welcome-coder-B7yxpkv-.webp 22.07 kB +dist/assets/welcome-sync-Dp_rQclu.webp 24.43 kB +dist/assets/welcome-earn-DFIke8Ig.webp 32.88 kB +dist/assets/agentnet-Cmd8Cg_U.png 74.74 kB +dist/assets/index-D_HgssP2.css 100.77 kB │ gzip: 19.56 kB +dist/assets/index-DF7wl3Bp.js 899.65 kB │ gzip: 278.19 kB + +(!) Some chunks are larger than 500 kB after minification. Consider: +- Using dynamic import() to code-split the application +- Use build.rollupOptions.output.manualChunks to improve chunking: https://rollupjs.org/configuration-options/#output-manualchunks +- Adjust chunk size limit for this warning via build.chunkSizeWarningLimit. +✓ built in 1.56s diff --git a/docs/qa/blog-read-recovery/feed-core-final.txt b/docs/qa/blog-read-recovery/feed-core-final.txt new file mode 100644 index 00000000..ead2785d --- /dev/null +++ b/docs/qa/blog-read-recovery/feed-core-final.txt @@ -0,0 +1,59 @@ + + RUN v4.1.8 /Users/nubs/Git/AgentNet-feed-read-20260916/packages/core + +stderr | src/runtime/session-settings.spec.ts +bigint: Failed to load bindings, pure JS will be used (try npm run rebuild?) + + ❯ src/runtime/session-settings.spec.ts (4 tests | 1 failed) 559ms + × resuming under different settings refreshes the stored meta mid-page 286ms + +⎯⎯⎯⎯⎯⎯⎯ Failed Tests 1 ⎯⎯⎯⎯⎯⎯⎯ + + FAIL src/runtime/session-settings.spec.ts > runtime/session-settings: model/effort persist and survive resume > resuming under different settings refreshes the stored meta mid-page +AssertionError: expected 'haiku' to be 'sonnet' // Object.is equality + +Expected: "sonnet" +Received: "haiku" + + ❯ src/runtime/session-settings.spec.ts:101:28 + 99| const metas = await new SessionStore(wallet, storage).listMine(); + 100| expect(metas).toHaveLength(1); + 101| expect(metas[0].model).toBe("sonnet"); + | ^ + 102| expect(metas[0].effort).toBe("high"); + 103| }); + +⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[1/1]⎯ + +⎯⎯⎯⎯⎯⎯ Unhandled Errors ⎯⎯⎯⎯⎯⎯ + +Vitest caught 1 unhandled error during the test run. +This might cause false positive tests. Resolve unhandled errors to make sure your tests are not affected. + +⎯⎯⎯⎯ Unhandled Rejection ⎯⎯⎯⎯⎯ +Error: ENOENT: no such file or directory, mkdir '/var/folders/kw/kjchvtvj0_d0wk1485qsjmfm0000gn/T/agentnet-settings-DpxQJa/sessions' + ❯ mkdir node:internal/fs/promises:859:10 + ❯ Object.append src/account/storage/manual.ts:27:7 + 25| // real append — adds the chunk to the file end, no rewrite. + 26| async append(sessionId, chunk) { + 27| await mkdir(dir(), { recursive: true }); + | ^ + 28| await appendFile(file(sessionId), chunk); + 29| }, + ❯ SessionStore.write src/account/store.ts:111:7 + ❯ SessionStore.appendMessage src/account/store.ts:189:5 + +⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ +Serialized Error: { errno: -2, code: 'ENOENT', syscall: 'mkdir', path: '/var/folders/kw/kjchvtvj0_d0wk1485qsjmfm0000gn/T/agentnet-settings-DpxQJa/sessions' } +This error originated in "src/runtime/session-settings.spec.ts" test file. It doesn't mean the error was thrown inside the file itself, but while it was running. +The latest test that might've caused the error is "sessions saved before the fields existed list with no model/effort". It might mean one of the following: +- The error was thrown, while Vitest was running this test. +- If the error occurred after the test had been completed, this was the last documented test before it was thrown. +⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ + + + Test Files 1 failed | 65 passed (66) + Tests 1 failed | 479 passed (480) + Errors 1 error + Start at 02:45:08 + Duration 13.50s (transform 4.19s, setup 0ms, import 12.88s, tests 35.04s, environment 4ms) diff --git a/docs/qa/blog-read-recovery/feed-core-rerun.txt b/docs/qa/blog-read-recovery/feed-core-rerun.txt new file mode 100644 index 00000000..86773a70 --- /dev/null +++ b/docs/qa/blog-read-recovery/feed-core-rerun.txt @@ -0,0 +1,8 @@ + + RUN v4.1.8 /Users/nubs/Git/AgentNet-feed-read-20260916/packages/core + + + Test Files 66 passed (66) + Tests 480 passed (480) + Start at 02:45:56 + Duration 13.67s (transform 5.36s, setup 0ms, import 18.93s, tests 36.48s, environment 8ms) diff --git a/docs/qa/blog-read-recovery/feed-error-mobile.png b/docs/qa/blog-read-recovery/feed-error-mobile.png new file mode 100644 index 00000000..9c0cc909 Binary files /dev/null and b/docs/qa/blog-read-recovery/feed-error-mobile.png differ diff --git a/docs/qa/blog-read-recovery/feed-recovered-mobile.png b/docs/qa/blog-read-recovery/feed-recovered-mobile.png new file mode 100644 index 00000000..ff4696cf Binary files /dev/null and b/docs/qa/blog-read-recovery/feed-recovered-mobile.png differ diff --git a/docs/qa/blog-read-recovery/feed-types.txt b/docs/qa/blog-read-recovery/feed-types.txt new file mode 100644 index 00000000..d544d528 --- /dev/null +++ b/docs/qa/blog-read-recovery/feed-types.txt @@ -0,0 +1,10 @@ +../../packages/core/src/chat/ui/webview.ts(20,35): error TS6133: 'LAYERS_SVG' is declared but its value is never read. +../../packages/core/src/notes/notes.ts(112,3): error TS6133: 'conn' is declared but its value is never read. +../../packages/core/src/notes/notes.ts(193,3): error TS6133: 'conn' is declared but its value is never read. +../../packages/core/src/notes/notes.ts(334,3): error TS6133: 'conn' is declared but its value is never read. +../../packages/core/src/notes/notes.ts(335,3): error TS6133: 'signer' is declared but its value is never read. +../../packages/core/src/notes/notes.ts(336,3): error TS6133: 'noteId' is declared but its value is never read. +../../packages/core/src/notes/notes.ts(479,3): error TS6133: 'conn' is declared but its value is never read. +../../packages/core/src/runtime/spawn.ts(1139,18): error TS6133: 'mode' is declared but its value is never read. +../../packages/core/src/skill-market/index.ts(318,3): error TS6133: 'defaultCreatorWallet' is declared but its value is never read. +src/market/skillSigil.ts(70,45): error TS6133: 'category' is declared but its value is never read. diff --git a/docs/qa/blog-read-recovery/feed-ui-final.txt b/docs/qa/blog-read-recovery/feed-ui-final.txt new file mode 100644 index 00000000..dcd3eb44 --- /dev/null +++ b/docs/qa/blog-read-recovery/feed-ui-final.txt @@ -0,0 +1,8 @@ + + RUN v4.1.8 /Users/nubs/Git/AgentNet-feed-read-20260916/surfaces/webview + + + Test Files 2 passed (2) + Tests 7 passed (7) + Start at 02:45:06 + Duration 982ms (transform 231ms, setup 0ms, import 355ms, tests 186ms, environment 1.03s) diff --git a/docs/qa/blog-read-recovery/feed-unavailable-mobile.png b/docs/qa/blog-read-recovery/feed-unavailable-mobile.png new file mode 100644 index 00000000..0088fa00 Binary files /dev/null and b/docs/qa/blog-read-recovery/feed-unavailable-mobile.png differ diff --git a/packages/core/src/chat/blogReads.spec.ts b/packages/core/src/chat/blogReads.spec.ts new file mode 100644 index 00000000..40c6e38c --- /dev/null +++ b/packages/core/src/chat/blogReads.spec.ts @@ -0,0 +1,72 @@ +import { describe, it, expect } from 'vitest'; +import { createBlogReads } from './blogReads.js'; +import type { MarketEvent } from './marketMessages.js'; +import type { Note } from '../core/types.js'; + +function deferred() { + let resolve!: (value: T) => void; + let reject!: (error: Error) => void; + const promise = new Promise((yes, no) => { resolve = yes; reject = no; }); + return { promise, resolve, reject }; +} +const note = { id: 'post', author: 'wallet', text: '안녕하세요' } as Note; + +describe('blog response ordering and failures', () => { + it('discards an older feed sort that finishes last', async () => { + const events: MarketEvent[] = []; + const reads = createBlogReads(event => events.push(event)); + const slow = deferred(); + const old = reads.handle({ type: 'getBlogFeed', sort: 'active' }, { getBlogFeed: () => slow.promise }); + await reads.handle({ type: 'getBlogFeed', sort: 'latest' }, { getBlogFeed: async () => [note] }); + slow.resolve([]); + await old; + expect(events).toEqual([{ type: 'blogFeed', posts: [note] }]); + }); + + it('invalidates a pending thread read when a comment succeeds', async () => { + const events: MarketEvent[] = []; + const reads = createBlogReads(event => events.push(event)); + const slow = deferred<[]>(); + const pending = reads.handle({ type: 'getBlogComments', postId: 'post', agentWallet: 'wallet' }, { getBlogComments: () => slow.promise }); + reads.invalidateComments('post'); + slow.resolve([]); + await pending; + expect(events).toEqual([]); + }); + + it('distinguishes a failed read from an empty feed and permits retry', async () => { + const events: MarketEvent[] = []; + const reads = createBlogReads(event => events.push(event)); + await reads.handle({ type: 'getBlogFeed' }, { getBlogFeed: async () => { throw Error('gateway unavailable'); } }); + await reads.handle({ type: 'getBlogFeed' }, { getBlogFeed: async () => [] }); + expect(events).toEqual([ + { type: 'blogFeed', posts: [], error: 'gateway unavailable' }, + { type: 'blogFeed', posts: [] }, + ]); + }); + + it('keeps independent post reads and reports missing data separately from errors', async () => { + const events: MarketEvent[] = []; + const reads = createBlogReads(event => events.push(event)); + const slow = deferred(); + const pending = reads.handle({ type: 'getBlogPost', author: 'wallet', postId: 'a' }, { getBlogPost: () => slow.promise }); + await reads.handle({ type: 'getBlogPost', author: 'wallet', postId: 'b' }, { getBlogPost: async () => { throw Error('offline'); } }); + slow.resolve(null); + await pending; + expect(events).toEqual([ + { type: 'blogPost', postId: 'b', post: null, error: 'offline' }, + { type: 'blogPost', postId: 'a', post: null }, + ]); + }); + + it('discards errors from superseded requests too', async () => { + const events: MarketEvent[] = []; + const reads = createBlogReads(event => events.push(event)); + const slow = deferred(); + const pending = reads.handle({ type: 'getBlogFeed' }, { getBlogFeed: () => slow.promise }); + await reads.handle({ type: 'getBlogFeed' }, { getBlogFeed: async () => [note] }); + slow.reject(Error('old failure')); + await pending; + expect(events).toEqual([{ type: 'blogFeed', posts: [note] }]); + }); +}); diff --git a/packages/core/src/chat/blogReads.ts b/packages/core/src/chat/blogReads.ts new file mode 100644 index 00000000..56ad2d61 --- /dev/null +++ b/packages/core/src/chat/blogReads.ts @@ -0,0 +1,34 @@ +import type { MarketEvent, MarketRequest, ThreadNode } from './marketMessages.js'; +import type { Note } from '../core/types.js'; + +export interface BlogReads { + getBlogFeed?(limit?: number, sort?: 'active' | 'latest', fresh?: boolean): Promise; + getBlogComments?(postId: string): Promise; + getBlogPost?(author: string, postId: string): Promise; +} + +// Per UI connection. A slow response must not replace a newer sort or a posted reply. +export function createBlogReads(send: (event: MarketEvent) => void) { + const versions = new Map(); + const advance = (key: string) => { const n = (versions.get(key) ?? 0) + 1; versions.set(key, n); return n; }; + return { + invalidateComments(postId: string) { advance(`comments:${postId}`); }, + async handle(req: MarketRequest, env: BlogReads): Promise { + if (req.type !== 'getBlogFeed' && req.type !== 'getBlogComments' && req.type !== 'getBlogPost') return false; + const key = req.type === 'getBlogFeed' ? 'feed' : `${req.type === 'getBlogComments' ? 'comments' : 'post'}:${req.postId}`; + const version = advance(key); + const publish = (event: MarketEvent) => { if (versions.get(key) === version) send(event); }; + try { + if (req.type === 'getBlogFeed' && env.getBlogFeed) publish({type:'blogFeed',posts:await env.getBlogFeed(req.limit,req.sort,req.fresh)}); + else if (req.type === 'getBlogComments' && env.getBlogComments) publish({type:'blogComments',postId:req.postId,threads:await env.getBlogComments(req.postId)}); + else if (req.type === 'getBlogPost' && env.getBlogPost) publish({type:'blogPost',postId:req.postId,post:await env.getBlogPost(req.author,req.postId)}); + } catch (e) { + const error = e instanceof Error ? e.message : String(e); + if (req.type === 'getBlogFeed') publish({type:'blogFeed',posts:[],error}); + else if (req.type === 'getBlogComments') publish({type:'blogComments',postId:req.postId,threads:[],error}); + else publish({type:'blogPost',postId:req.postId,post:null,error}); + } + return true; + }, + }; +} diff --git a/packages/core/src/chat/marketMessages.ts b/packages/core/src/chat/marketMessages.ts index ab6997bf..713e7ce3 100644 --- a/packages/core/src/chat/marketMessages.ts +++ b/packages/core/src/chat/marketMessages.ts @@ -171,10 +171,10 @@ export type MarketEvent = | { type: "buyAllResult"; wallet: string; ok: boolean; bought: number; failed: number; error?: string } | { type: "agentNoteResult"; agentWallet: string; ok: boolean; error?: string } // per-post blog comments: the refreshed thread for one post, and a write result - | { type: "blogComments"; postId: string; threads: ThreadNode[] } + | { type: "blogComments"; postId: string; threads: ThreadNode[]; error?: string } // the feed serves PREVIEW entries (issue #203), not full notes; a tap fetches the body - | { type: "blogFeed"; posts: import("../core/types.js").Note[] } - | { type: "blogPost"; postId: string; post: import("../core/types.js").Note | null } + | { type: "blogFeed"; posts: import("../core/types.js").Note[]; error?: string } + | { type: "blogPost"; postId: string; post: import("../core/types.js").Note | null; error?: string } | { type: "blogCommentResult"; postId: string; ok: boolean; error?: string } // make-skill: result of a UI publish. mint = the new skill's mint address on success. | { type: "publishResult"; ok: boolean; mint?: string; error?: string } diff --git a/packages/core/src/chat/session.ts b/packages/core/src/chat/session.ts index e8012f7f..e37fe81d 100644 --- a/packages/core/src/chat/session.ts +++ b/packages/core/src/chat/session.ts @@ -1,3 +1,4 @@ +import { createBlogReads } from "./blogReads.js"; // The chat session DISPATCHER — transport-neutral, shared by every surface. // // This is the body of what used to live inside vscode's openChat(): the per-panel @@ -86,7 +87,7 @@ export interface ChatEnv { getBlogComments?(postId: string): Promise; getBlogFeed?(limit?: number, sort?: "active" | "latest", fresh?: boolean): Promise; getBlogPost?(author: string, postId: string): Promise; - postBlogComment?(postId: string, agentWallet: string, text: string, gitLink?: string, parentId?: string, opts?: { sage?: boolean; feedBump?: boolean }): Promise<{ ok: boolean; threads?: import("./marketMessages.js").ThreadNode[]; error?: string }>; + postBlogComment?(postId: string, agentWallet: string, text: string, gitLink?: string, parentId?: string, opts?: { sage?: boolean; feedBump?: boolean }): Promise<{ ok: boolean; threads?: import("./marketMessages.js").ThreadNode[]; commentsError?: string; error?: string }>; solBalance?(): Promise; // wallet's native SOL balance (lamports), for the UI funds display // devnet-only: fund the wallet from the faucet (manual "Get devnet SOL" on an insufficient- // funds buy). Returns the new balance so the UI refreshes and lets the buyer retry. @@ -292,6 +293,7 @@ export function createChatSession( // here, so a wrong field/type on a market event is a compile error, not a silent // runtime miss. Every surface's UI reads the same shape. const sendMarket = (e: import("./marketMessages.js").MarketEvent) => transport.send(e); + const blogReads = createBlogReads(sendMarket); // A handle's output is only painted when ITS cli tab is the active one (so a // background reply doesn't bleed into the other tab's log). The message already @@ -976,25 +978,10 @@ export function createChatSession( break; } // per-post blog comments: lazy-load one post's thread on tap-open - case "getBlogComments": { - const req = m as Extract; - if (!env.getBlogComments) break; - const threads = await env.getBlogComments(req.postId); - sendMarket({ type: "blogComments", postId: req.postId, threads }); - break; - } - // The global blog feed (issue #183: RANK -> FEED), one read of the feed anchor. - case "getBlogFeed": { - const req = m as Extract; - if (!env.getBlogFeed) break; - sendMarket({ type: "blogFeed", posts: await env.getBlogFeed(req.limit, req.sort, req.fresh) }); - break; - } - // open a feed post: fetch the real body from the author's own table (issue #208) + case "getBlogComments": + case "getBlogFeed": case "getBlogPost": { - const req = m as Extract; - if (!env.getBlogPost) break; - sendMarket({ type: "blogPost", postId: req.postId, post: await env.getBlogPost(req.author, req.postId) }); + await blogReads.handle(m as MarketRequest, env); break; } // post a comment onto one blog post, then re-push that post's refreshed thread @@ -1003,7 +990,10 @@ export function createChatSession( if (!env.postBlogComment) break; const res = await env.postBlogComment(req.postId, req.agentWallet, req.text, req.gitLink, req.parentId, { sage: req.sage, feedBump: req.feedBump }); sendMarket({ type: "blogCommentResult", postId: req.postId, ok: res.ok, error: res.ok ? undefined : (res as { ok: false; error?: string }).error }); - if (res.ok) sendMarket({ type: "blogComments", postId: req.postId, threads: res.threads ?? [] }); + if (res.ok) { + blogReads.invalidateComments(req.postId); + sendMarket({ type: "blogComments", postId: req.postId, threads: res.threads ?? [], error: res.commentsError }); + } // issue #210: a bumping reply must re-prime the gateway's feed anchor cache. // The anchor is not a real table, so the background row-cache refresh bails on // it; one fresh read cold-fetches the new mirror row (same as the localhost host). diff --git a/packages/core/src/skill-market/ingest/env.ts b/packages/core/src/skill-market/ingest/env.ts index 28c520e4..5f163af4 100644 --- a/packages/core/src/skill-market/ingest/env.ts +++ b/packages/core/src/skill-market/ingest/env.ts @@ -657,23 +657,28 @@ export async function marketplaceEnv(wallet: Wallet) { // lazily when the post view opens. Write = a comment on that post (gate lives in // corePostBlogComment: holds ≥1 of the post-author's skills, or is the author). async getBlogComments(postId: string) { - return readBlogCommentThreads(postId).catch(() => []); + return readBlogCommentThreads(postId); }, // The global blog feed (issue #183: RANK -> FEED): one read of the feed // anchor, grouped by post with activity signals, sorted ACTIVE or LATEST - // (issue #208). Failure degrades to an empty feed, never a throw. + // (issue #208). Hosts surface read failures separately from an empty feed. async getBlogFeed(limit?: number, sort?: "active" | "latest", fresh?: boolean) { - return readBlogFeed({ limit, sort, fresh }).catch(() => []); + return readBlogFeed({ limit, sort, fresh }); }, // Open a feed post: the real body from the author's own blog table (#208). async getBlogPost(author: string, postId: string) { - return readBlogPost(author, postId).catch(() => null); + return readBlogPost(author, postId); }, async postBlogComment(postId: string, agentWallet: string, text: string, gitLink?: string, parentId?: string, opts?: { sage?: boolean; feedBump?: boolean }) { try { await corePostBlogComment(conn, wallet, { postId, agentWallet, text, gitLink, parentId, sage: opts?.sage, feedBump: opts?.feedBump }); - const threads = await readBlogCommentThreads(postId).catch(() => []); - return { ok: true as const, threads }; + // A confirmed write remains successful even if its follow-up read fails. + // Reporting this as a write failure would invite a duplicate comment. + try { + return { ok: true as const, threads: await readBlogCommentThreads(postId) }; + } catch (e) { + return { ok: true as const, commentsError: e instanceof Error ? e.message : String(e) }; + } } catch (e) { return { ok: false as const, error: e instanceof Error ? e.message : String(e) }; } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index bf43f432..f917ff89 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -21,13 +21,13 @@ importers: version: 0.139.0 '@solana/spl-token': specifier: ^0.4.14 - version: 0.4.14(@solana/web3.js@1.99.0(bufferutil@4.1.0)(typescript@5.9.3))(bufferutil@4.1.0)(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.9.3) + version: 0.4.14(@solana/web3.js@1.99.0(bufferutil@4.1.0)(typescript@5.9.3)(utf-8-validate@6.0.6))(bufferutil@4.1.0)(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.9.3)(utf-8-validate@6.0.6) '@solana/spl-token-group': specifier: ^0.0.7 - version: 0.0.7(@solana/web3.js@1.99.0(bufferutil@4.1.0)(typescript@5.9.3))(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.9.3) + version: 0.0.7(@solana/web3.js@1.99.0(bufferutil@4.1.0)(typescript@5.9.3)(utf-8-validate@6.0.6))(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.9.3) '@solana/spl-token-metadata': specifier: ^0.1.6 - version: 0.1.6(@solana/web3.js@1.99.0(bufferutil@4.1.0)(typescript@5.9.3))(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.9.3) + version: 0.1.6(@solana/web3.js@1.99.0(bufferutil@4.1.0)(typescript@5.9.3)(utf-8-validate@6.0.6))(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.9.3) cross-spawn: specifier: ^7.0.6 version: 7.0.6 @@ -46,10 +46,10 @@ importers: devDependencies: '@iqlabs-official/solana-sdk': specifier: ^0.2.0 - version: 0.2.0(bufferutil@4.1.0)(typescript@5.9.3) + version: 0.2.0(bufferutil@4.1.0)(typescript@5.9.3)(utf-8-validate@6.0.6) '@solana/web3.js': specifier: ^1.99.0 - version: 1.99.0(bufferutil@4.1.0)(typescript@5.9.3) + version: 1.99.0(bufferutil@4.1.0)(typescript@5.9.3)(utf-8-validate@6.0.6) '@types/cross-spawn': specifier: ^6.0.6 version: 6.0.6 @@ -85,10 +85,10 @@ importers: version: link:../core '@iqlabs-official/solana-sdk': specifier: ^0.2.0 - version: 0.2.0(bufferutil@4.1.0)(typescript@5.9.3) + version: 0.2.0(bufferutil@4.1.0)(typescript@5.9.3)(utf-8-validate@6.0.6) '@solana/web3.js': specifier: ^1.99.0 - version: 1.99.0(bufferutil@4.1.0)(typescript@5.9.3) + version: 1.99.0(bufferutil@4.1.0)(typescript@5.9.3)(utf-8-validate@6.0.6) tsup: specifier: ^8.0.0 version: 8.5.1(jiti@2.7.0)(postcss@8.5.15)(supports-color@8.1.1)(tsx@4.22.4)(typescript@5.9.3) @@ -215,6 +215,9 @@ importers: '@vitejs/plugin-react': specifier: ^5.1.0 version: 5.2.0(supports-color@8.1.1)(vite@7.3.5(@types/node@20.19.42)(jiti@2.7.0)(lightningcss@1.32.0)(tsx@4.22.4)) + jsdom: + specifier: ^30.0.1 + version: 30.0.1(@noble/hashes@2.2.0) tailwindcss: specifier: ^4.1.18 version: 4.3.0 @@ -224,6 +227,9 @@ importers: vite: specifier: ^7.1.0 version: 7.3.5(@types/node@20.19.42)(jiti@2.7.0)(lightningcss@1.32.0)(tsx@4.22.4) + vitest: + specifier: ^4.1.8 + version: 4.1.8(@types/node@20.19.42)(jsdom@30.0.1(@noble/hashes@2.2.0))(vite@7.3.5(@types/node@20.19.42)(jiti@2.7.0)(lightningcss@1.32.0)(tsx@4.22.4)) packages: @@ -245,21 +251,25 @@ packages: resolution: {integrity: sha512-SRYfQcsXlOq+CD/FqkQBTSHbaD++w73GnnO+NUV9adLYrca3kfetRwWT1iguY1cNS0l34dCR3rlzCPq78vg1Jg==} cpu: [arm64] os: [linux] + libc: [musl] '@anthropic-ai/claude-agent-sdk-linux-arm64@0.3.170': resolution: {integrity: sha512-gLbaFqcGppFJQd4DLNV4IXoeahejT/p2/M8bSSvRDbla9GOsBr1AxV5XLRyBn1e7xFGozZIAIQr3+1chp7NJgQ==} cpu: [arm64] os: [linux] + libc: [glibc] '@anthropic-ai/claude-agent-sdk-linux-x64-musl@0.3.170': resolution: {integrity: sha512-m4+I0qBEk7cxRKS+pL+eoWXbXTFOAo83fQ0tQvap4z/mDMm06IWJtEPoYTaMBwsp32GJWLkHWKbZSBCHZnp2DQ==} cpu: [x64] os: [linux] + libc: [musl] '@anthropic-ai/claude-agent-sdk-linux-x64@0.3.170': resolution: {integrity: sha512-Xl/m7TaSC3T5IDBdHrZQ9fCQYyDmPELN34CL+MoyPIf7uSmuZnjE9fUOqDh2Rv26JxWssi1M6X+BBvVuKd6Cpg==} cpu: [x64] os: [linux] + libc: [glibc] '@anthropic-ai/claude-agent-sdk-win32-arm64@0.3.170': resolution: {integrity: sha512-IG+8isJNNJKbnnhO7m+PGhfVCg+XoQ/MDxGde5eigFI0WsEfitjuWSWwx82bT9ghxI1aa6qNvI+UPgPcZuo5Fg==} @@ -897,66 +907,79 @@ packages: resolution: {integrity: sha512-Q8CBCCQtDFrYtXoeUXSrnFXKOnyUhx6bz+SkL6A0E7V8kAiCJ5pamq1WtbfpVGhR5TSpXY6ak3avmDc5fHTyJA==} cpu: [arm] os: [linux] + libc: [glibc] '@rollup/rollup-linux-arm-musleabihf@4.61.1': resolution: {integrity: sha512-nwnhk1581l0FBVellGcVCAT0Oi06onEA3WB53sf01VO3I0UPBkMH9sXONYME2K0ovXcNayJfNtHfm6mpJElatQ==} cpu: [arm] os: [linux] + libc: [musl] '@rollup/rollup-linux-arm64-gnu@4.61.1': resolution: {integrity: sha512-x5Xr49hwt3hdW75UOZm3395YwwzPyauktslv29KpWL/T+vVAzoT3azLcTWv0eMciBNrx+DYjH4paehHoLpPvpg==} cpu: [arm64] os: [linux] + libc: [glibc] '@rollup/rollup-linux-arm64-musl@4.61.1': resolution: {integrity: sha512-unMS3H73DpaoPyyEVPjGKleM/s0mkmsauTENpw4INQY8y4+IuLNjkueQ5QCtC0D3N38Y38yhAU8OoZ20S2Tm6w==} cpu: [arm64] os: [linux] + libc: [musl] '@rollup/rollup-linux-loong64-gnu@4.61.1': resolution: {integrity: sha512-zNZzGRnAhwjFEYmvphJRV5XaQGjs62cCmeYYHUT//NbvEnHauw+I85nGG+SiVg5ld4GX8D1IbKIX+ozITQnhMQ==} cpu: [loong64] os: [linux] + libc: [glibc] '@rollup/rollup-linux-loong64-musl@4.61.1': resolution: {integrity: sha512-LdpWGL8X209B2SIvWjqlc8VZgM6PKfontSerGepuldQmHYrAOtnMCXeJkxXGbC+PPZVOuu5czJo7fNV6aeW8rQ==} cpu: [loong64] os: [linux] + libc: [musl] '@rollup/rollup-linux-ppc64-gnu@4.61.1': resolution: {integrity: sha512-EC5kTtNaNGOmbMGqar8dvJy6y/hg99GAwjfBz++pxZhQATXGcRjd6c5en5wcbru0vkRmiMGsQKdMJOOf6sza4g==} cpu: [ppc64] os: [linux] + libc: [glibc] '@rollup/rollup-linux-ppc64-musl@4.61.1': resolution: {integrity: sha512-8hiwp6D4acEcNK78I4rP0/XtS1sknWIAMJBPdR4l6zUtyTm5KiTDr5bXmWt4foY7nAN7AThDHgkLIEZOWKbzWw==} cpu: [ppc64] os: [linux] + libc: [musl] '@rollup/rollup-linux-riscv64-gnu@4.61.1': resolution: {integrity: sha512-10dh/h/BqA7DuMPWSxkR8uks18FRwnwOEqr5zOTEl+NOwP/OMzKX8OFR/Of9xxDA7D5qef1Nzar5WDD2kCCr1g==} cpu: [riscv64] os: [linux] + libc: [glibc] '@rollup/rollup-linux-riscv64-musl@4.61.1': resolution: {integrity: sha512-YKJ5lg35DP17gcAOggnihe+APw9HLyj1Xn7gsmGumBJAUDa6NGXNixJzmkWLhcK9TOuuyQjdamzvJefkO7qHZQ==} cpu: [riscv64] os: [linux] + libc: [musl] '@rollup/rollup-linux-s390x-gnu@4.61.1': resolution: {integrity: sha512-Mlil5G2Jj6a7B3LWGctg+XPL9vdXYuzCtNXfxOQ0nPjc2m6ueUktocPGH9bnAM0bNRKb/bAWTujUU7IJQdQA+g==} cpu: [s390x] os: [linux] + libc: [glibc] '@rollup/rollup-linux-x64-gnu@4.61.1': resolution: {integrity: sha512-bVWIOIk6pV01p4CdUbPP7CJ/434z+OooYjDuFcR+44N35YvKUC66G8MGnvcWx5mWKW3g61J+t74l3Kj15Kwn2Q==} cpu: [x64] os: [linux] + libc: [glibc] '@rollup/rollup-linux-x64-musl@4.61.1': resolution: {integrity: sha512-qy5pBvZbqNFheBz61R1rzsezjm0J7O2oNGoWtGoY89SZYLUfxAJTBAqDChqAIdB4rCiIbi9nF7yZ83GnNiLwSw==} cpu: [x64] os: [linux] + libc: [musl] '@rollup/rollup-openbsd-x64@4.61.1': resolution: {integrity: sha512-E83TXjI4zm0+5f2qO+UOudaCYIhYwpJ5jq6YCZNIZ+6CbfhKrkAGezeiASBL9ElxAxFsRS9ZhESv8mfnj6TKeg==} @@ -1151,24 +1174,28 @@ packages: engines: {node: '>= 20'} cpu: [arm64] os: [linux] + libc: [glibc] '@tailwindcss/oxide-linux-arm64-musl@4.3.0': resolution: {integrity: sha512-Z6sukiQsngnWO+l39X4pPbiWT81IC+PLKF+PHxIlyZbGNb9MODfYlXEVlFvej5BOZInWX01kVyzeLvHsXhfczQ==} engines: {node: '>= 20'} cpu: [arm64] os: [linux] + libc: [musl] '@tailwindcss/oxide-linux-x64-gnu@4.3.0': resolution: {integrity: sha512-DRNdQRpSGzRGfARVuVkxvM8Q12nh19l4BF/G7zGA1oe+9wcC6saFBHTISrpIcKzhiXtSrlSrluCfvMuledoCTQ==} engines: {node: '>= 20'} cpu: [x64] os: [linux] + libc: [glibc] '@tailwindcss/oxide-linux-x64-musl@4.3.0': resolution: {integrity: sha512-Z0IADbDo8bh6I7h2IQMx601AdXBLfFpEdUotft86evd/8ZPflZe9COPO8Q1vw+pfLWIUo9zN/JGZvwuAJqduqg==} engines: {node: '>= 20'} cpu: [x64] os: [linux] + libc: [musl] '@tailwindcss/oxide-wasm32-wasi@4.3.0': resolution: {integrity: sha512-HNZGOUxEmElksYR7S6sC5jTeNGpobAsy9u7Gu0AskJ8/20FR9GqebUyB+HBcU/ax6BHuiuJi+Oda4B+YX6H1yA==} @@ -2055,24 +2082,28 @@ packages: engines: {node: '>= 12.0.0'} cpu: [arm64] os: [linux] + libc: [glibc] lightningcss-linux-arm64-musl@1.32.0: resolution: {integrity: sha512-UpQkoenr4UJEzgVIYpI80lDFvRmPVg6oqboNHfoH4CQIfNA+HOrZ7Mo7KZP02dC6LjghPQJeBsvXhJod/wnIBg==} engines: {node: '>= 12.0.0'} cpu: [arm64] os: [linux] + libc: [musl] lightningcss-linux-x64-gnu@1.32.0: resolution: {integrity: sha512-V7Qr52IhZmdKPVr+Vtw8o+WLsQJYCTd8loIfpDaMRWGUZfBOYEJeyJIkqGIDMZPwPx24pUMfwSxxI8phr/MbOA==} engines: {node: '>= 12.0.0'} cpu: [x64] os: [linux] + libc: [glibc] lightningcss-linux-x64-musl@1.32.0: resolution: {integrity: sha512-bYcLp+Vb0awsiXg/80uCRezCYHNg1/l3mt0gzHnWV9XP1W5sKa5/TCdGWaR/zBM2PeF/HbsQv/j2URNOiVuxWg==} engines: {node: '>= 12.0.0'} cpu: [x64] os: [linux] + libc: [musl] lightningcss-win32-arm64-msvc@1.32.0: resolution: {integrity: sha512-8SbC8BR40pS6baCM8sbtYDSwEVQd4JlFTOlaD3gWGHfThTcABnNDBda6eTZeqbofalIJhFx0qKzgHJmcPTnGdw==} @@ -3054,12 +3085,12 @@ snapshots: '@coral-xyz/anchor-errors@0.31.1': {} - '@coral-xyz/anchor@0.32.1(bufferutil@4.1.0)(typescript@5.9.3)': + '@coral-xyz/anchor@0.32.1(bufferutil@4.1.0)(typescript@5.9.3)(utf-8-validate@6.0.6)': dependencies: '@coral-xyz/anchor-errors': 0.31.1 '@coral-xyz/borsh': 0.31.1(@solana/web3.js@1.98.4(bufferutil@4.1.0)(typescript@5.9.3)) '@noble/hashes': 1.8.0 - '@solana/web3.js': 1.98.4(bufferutil@4.1.0)(typescript@5.9.3) + '@solana/web3.js': 1.98.4(bufferutil@4.1.0)(typescript@5.9.3)(utf-8-validate@6.0.6) bn.js: 5.2.3 bs58: 4.0.1 buffer-layout: 1.2.2 @@ -3077,7 +3108,7 @@ snapshots: '@coral-xyz/borsh@0.31.1(@solana/web3.js@1.98.4(bufferutil@4.1.0)(typescript@5.9.3))': dependencies: - '@solana/web3.js': 1.98.4(bufferutil@4.1.0)(typescript@5.9.3) + '@solana/web3.js': 1.98.4(bufferutil@4.1.0)(typescript@5.9.3)(utf-8-validate@6.0.6) bn.js: 5.2.3 buffer-layout: 1.2.2 @@ -3277,12 +3308,12 @@ snapshots: figures: 6.1.0 ink: 5.2.1(@types/react@18.3.31)(bufferutil@4.1.0)(react@18.3.1)(utf-8-validate@6.0.6) - '@iqlabs-official/solana-sdk@0.2.0(bufferutil@4.1.0)(typescript@5.9.3)': + '@iqlabs-official/solana-sdk@0.2.0(bufferutil@4.1.0)(typescript@5.9.3)(utf-8-validate@6.0.6)': dependencies: - '@coral-xyz/anchor': 0.32.1(bufferutil@4.1.0)(typescript@5.9.3) + '@coral-xyz/anchor': 0.32.1(bufferutil@4.1.0)(typescript@5.9.3)(utf-8-validate@6.0.6) '@noble/curves': 2.2.0 '@noble/hashes': 1.8.0 - '@solana/web3.js': 1.99.0(bufferutil@4.1.0)(typescript@5.9.3) + '@solana/web3.js': 1.99.0(bufferutil@4.1.0)(typescript@5.9.3)(utf-8-validate@6.0.6) transitivePeerDependencies: - bufferutil - encoding @@ -3450,10 +3481,10 @@ snapshots: '@rollup/rollup-win32-x64-msvc@4.61.1': optional: true - '@solana/buffer-layout-utils@0.2.0(bufferutil@4.1.0)(typescript@5.9.3)': + '@solana/buffer-layout-utils@0.2.0(bufferutil@4.1.0)(typescript@5.9.3)(utf-8-validate@6.0.6)': dependencies: '@solana/buffer-layout': 4.0.1 - '@solana/web3.js': 1.99.0(bufferutil@4.1.0)(typescript@5.9.3) + '@solana/web3.js': 1.99.0(bufferutil@4.1.0)(typescript@5.9.3)(utf-8-validate@6.0.6) bigint-buffer: 1.1.5 bignumber.js: 9.3.1 transitivePeerDependencies: @@ -3557,29 +3588,29 @@ snapshots: transitivePeerDependencies: - fastestsmallesttextencoderdecoder - '@solana/spl-token-group@0.0.7(@solana/web3.js@1.99.0(bufferutil@4.1.0)(typescript@5.9.3))(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.9.3)': + '@solana/spl-token-group@0.0.7(@solana/web3.js@1.99.0(bufferutil@4.1.0)(typescript@5.9.3)(utf-8-validate@6.0.6))(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.9.3)': dependencies: '@solana/codecs': 2.0.0-rc.1(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.9.3) - '@solana/web3.js': 1.99.0(bufferutil@4.1.0)(typescript@5.9.3) + '@solana/web3.js': 1.99.0(bufferutil@4.1.0)(typescript@5.9.3)(utf-8-validate@6.0.6) transitivePeerDependencies: - fastestsmallesttextencoderdecoder - typescript - '@solana/spl-token-metadata@0.1.6(@solana/web3.js@1.99.0(bufferutil@4.1.0)(typescript@5.9.3))(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.9.3)': + '@solana/spl-token-metadata@0.1.6(@solana/web3.js@1.99.0(bufferutil@4.1.0)(typescript@5.9.3)(utf-8-validate@6.0.6))(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.9.3)': dependencies: '@solana/codecs': 2.0.0-rc.1(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.9.3) - '@solana/web3.js': 1.99.0(bufferutil@4.1.0)(typescript@5.9.3) + '@solana/web3.js': 1.99.0(bufferutil@4.1.0)(typescript@5.9.3)(utf-8-validate@6.0.6) transitivePeerDependencies: - fastestsmallesttextencoderdecoder - typescript - '@solana/spl-token@0.4.14(@solana/web3.js@1.99.0(bufferutil@4.1.0)(typescript@5.9.3))(bufferutil@4.1.0)(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.9.3)': + '@solana/spl-token@0.4.14(@solana/web3.js@1.99.0(bufferutil@4.1.0)(typescript@5.9.3)(utf-8-validate@6.0.6))(bufferutil@4.1.0)(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.9.3)(utf-8-validate@6.0.6)': dependencies: '@solana/buffer-layout': 4.0.1 - '@solana/buffer-layout-utils': 0.2.0(bufferutil@4.1.0)(typescript@5.9.3) - '@solana/spl-token-group': 0.0.7(@solana/web3.js@1.99.0(bufferutil@4.1.0)(typescript@5.9.3))(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.9.3) - '@solana/spl-token-metadata': 0.1.6(@solana/web3.js@1.99.0(bufferutil@4.1.0)(typescript@5.9.3))(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.9.3) - '@solana/web3.js': 1.99.0(bufferutil@4.1.0)(typescript@5.9.3) + '@solana/buffer-layout-utils': 0.2.0(bufferutil@4.1.0)(typescript@5.9.3)(utf-8-validate@6.0.6) + '@solana/spl-token-group': 0.0.7(@solana/web3.js@1.99.0(bufferutil@4.1.0)(typescript@5.9.3)(utf-8-validate@6.0.6))(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.9.3) + '@solana/spl-token-metadata': 0.1.6(@solana/web3.js@1.99.0(bufferutil@4.1.0)(typescript@5.9.3)(utf-8-validate@6.0.6))(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.9.3) + '@solana/web3.js': 1.99.0(bufferutil@4.1.0)(typescript@5.9.3)(utf-8-validate@6.0.6) buffer: 6.0.3 transitivePeerDependencies: - bufferutil @@ -3588,7 +3619,7 @@ snapshots: - typescript - utf-8-validate - '@solana/web3.js@1.98.4(bufferutil@4.1.0)(typescript@5.9.3)': + '@solana/web3.js@1.98.4(bufferutil@4.1.0)(typescript@5.9.3)(utf-8-validate@6.0.6)': dependencies: '@babel/runtime': 7.29.7 '@noble/curves': 1.9.7 @@ -3601,7 +3632,7 @@ snapshots: bs58: 4.0.1 buffer: 6.0.3 fast-stable-stringify: 1.0.0 - jayson: 4.3.0(bufferutil@4.1.0) + jayson: 4.3.0(bufferutil@4.1.0)(utf-8-validate@6.0.6) node-fetch: 2.7.0 rpc-websockets: 9.3.9 superstruct: 2.0.2 @@ -3611,7 +3642,7 @@ snapshots: - typescript - utf-8-validate - '@solana/web3.js@1.99.0(bufferutil@4.1.0)(typescript@5.9.3)': + '@solana/web3.js@1.99.0(bufferutil@4.1.0)(typescript@5.9.3)(utf-8-validate@6.0.6)': dependencies: '@babel/runtime': 7.29.7 '@noble/curves': 1.9.7 @@ -3624,7 +3655,7 @@ snapshots: bs58: 4.0.1 buffer: 6.0.3 fast-stable-stringify: 1.0.0 - jayson: 4.3.0(bufferutil@4.1.0) + jayson: 4.3.0(bufferutil@4.1.0)(utf-8-validate@6.0.6) node-fetch: 2.7.0 rpc-websockets: 9.3.9 superstruct: 2.0.2 @@ -4505,9 +4536,9 @@ snapshots: isomorphic-ws@4.0.1(ws@7.5.11(bufferutil@4.1.0)): dependencies: - ws: 7.5.11(bufferutil@4.1.0) + ws: 7.5.11(bufferutil@4.1.0)(utf-8-validate@6.0.6) - jayson@4.3.0(bufferutil@4.1.0): + jayson@4.3.0(bufferutil@4.1.0)(utf-8-validate@6.0.6): dependencies: '@types/connect': 3.4.38 '@types/node': 12.20.55 @@ -4520,7 +4551,7 @@ snapshots: json-stringify-safe: 5.0.1 stream-json: 1.9.1 uuid: 8.3.2 - ws: 7.5.11(bufferutil@4.1.0) + ws: 7.5.11(bufferutil@4.1.0)(utf-8-validate@6.0.6) transitivePeerDependencies: - bufferutil - utf-8-validate @@ -5286,9 +5317,10 @@ snapshots: wrappy@1.0.2: {} - ws@7.5.11(bufferutil@4.1.0): + ws@7.5.11(bufferutil@4.1.0)(utf-8-validate@6.0.6): optionalDependencies: bufferutil: 4.1.0 + utf-8-validate: 6.0.6 ws@8.21.0(bufferutil@4.1.0)(utf-8-validate@6.0.6): optionalDependencies: diff --git a/surfaces/localhost/src/index.ts b/surfaces/localhost/src/index.ts index 445eba9a..077e1a09 100644 --- a/surfaces/localhost/src/index.ts +++ b/surfaces/localhost/src/index.ts @@ -1,3 +1,4 @@ +import { createBlogReads } from "@iqlabs-official/agent-sdk/chat/blogReads"; // AgentNet localhost surface — the HTTP form of vscode's extension host. // NOT a remote server: this is a LOCAL node process on the user's own machine (and, // on Android, inside their own phone). It serves the webview to a browser / WebView @@ -683,6 +684,7 @@ function attachAuthHandlers(c: Client) { // Marketplace messages are not part of the agent runtime. They need a connected wallet, // but they should still work when the active SSE client is in onboarding/storage setup. function attachMarketHandlers(c: Client) { + const blogReads = createBlogReads((event) => c.send(event)); let mktPromise: ReturnType | null = null; let mktEpoch = -1; // One-time per market session: have we pulled the wallet's owned NFT skills from chain @@ -1011,39 +1013,20 @@ function attachMarketHandlers(c: Client) { } return; } - case "getBlogComments": { - try { - const threads = await mkt.getBlogComments(m.postId); - c.send({ type: "blogComments", postId: m.postId, threads }); - } catch { - c.send({ type: "blogComments", postId: m.postId, threads: [] }); - } - return; - } - // The global blog feed (issue #183: RANK -> FEED): every agent's posts, - // newest first, one read of the feed anchor. - case "getBlogFeed": { - try { - c.send({ type: "blogFeed", posts: await mkt.getBlogFeed(m.limit, m.sort, m.fresh) }); - } catch { - c.send({ type: "blogFeed", posts: [] }); - } - return; - } - // open a feed post: fetch the real body from the author's own table (issue #208) + case "getBlogComments": + case "getBlogFeed": case "getBlogPost": { - try { - c.send({ type: "blogPost", postId: m.postId, post: await mkt.getBlogPost(m.author, m.postId) }); - } catch { - c.send({ type: "blogPost", postId: m.postId, post: null }); - } + await blogReads.handle(m, mkt); return; } case "postBlogComment": { try { const r = await mkt.postBlogComment(m.postId, m.agentWallet, m.text, m.gitLink, m.parentId, { sage: m.sage, feedBump: m.feedBump }); c.send({ type: "blogCommentResult", postId: m.postId, ok: r.ok, error: r.ok ? undefined : r.error }); - if (r.ok) c.send({ type: "blogComments", postId: m.postId, threads: r.threads ?? [] }); + if (r.ok) { + blogReads.invalidateComments(m.postId); + c.send({ type: "blogComments", postId: m.postId, threads: r.threads ?? [], error: r.commentsError }); + } // A bumping reply mirrors a row into the feed:blog anchor, but the gateway // cannot background-refresh that anchor's row cache (it is not a real table, // so its meta read 404s and the refresh bails). One fresh read cold-fetches diff --git a/surfaces/webview/package.json b/surfaces/webview/package.json index 10b633eb..0a7ddf83 100644 --- a/surfaces/webview/package.json +++ b/surfaces/webview/package.json @@ -6,7 +6,8 @@ "scripts": { "dev": "vite", "build": "vite build", - "preview": "vite preview" + "preview": "vite preview", + "test": "vitest run" }, "dependencies": { "@iqlabs-official/agent-sdk": "workspace:*", @@ -21,6 +22,8 @@ "@vitejs/plugin-react": "^5.1.0", "tailwindcss": "^4.1.18", "typescript": "^5.7.0", - "vite": "^7.1.0" + "vite": "^7.1.0", + "vitest": "^4.1.8", + "jsdom": "^30.0.1" } } diff --git a/surfaces/webview/src/market/AgentProfileView.tsx b/surfaces/webview/src/market/AgentProfileView.tsx index 2a2a3007..be80468b 100644 --- a/surfaces/webview/src/market/AgentProfileView.tsx +++ b/surfaces/webview/src/market/AgentProfileView.tsx @@ -238,6 +238,7 @@ export function BlogPostView({ post, wallet, onClose }: { post: BlogNote; wallet const { state, send } = useStore(); const author = post.author || wallet; const threads = state.blogComments[post.id]; + const readError = state.blogReadErrors[`comments:${post.id}`]; // Post replies are OPEN (issue #183): anyone with a wallet may reply, UNLIKE the agent // reputation comment wall, which is holder-gated. So the gate here is just "has a wallet". const canReply = !!state.walletAddress; @@ -245,11 +246,29 @@ export function BlogPostView({ post, wallet, onClose }: { post: BlogNote; wallet const [replyTo, setReplyTo] = useState(null); // Lazy-load this post's own reply thread when it opens (comment:blog:). useEffect(() => { send({ type: "getBlogComments", postId: post.id, agentWallet: wallet }); }, [post.id, wallet, send]); - // A refreshed thread (a reply landed) clears the pending + reply-composer UI. - useEffect(() => { setPosting(false); setReplyTo(null); }, [threads]); + const result = state.blogCommentResults[post.id]; + const pendingResult = useRef(result); + const pendingParent = useRef(undefined); + const [commentError, setCommentError] = useState(null); + const [commentReset, setCommentReset] = useState(0); + // Read responses are not acknowledgments: a late refresh must not discard a draft. + useEffect(() => { + if (!posting || !result || result === pendingResult.current) return; + setPosting(false); + if (result.ok) { + if (pendingParent.current) setReplyTo(null); + else setCommentReset((n) => n + 1); + setCommentError(null); + } else { + setCommentError(result.error || "Comment failed. Please try again."); + } + }, [result, posting]); function submitComment(f: NoteFields, parentId?: string) { const text = f.text.trim(); - if (!text || !canReply) return; + if (!text || !canReply || posting) return; + pendingResult.current = result; + pendingParent.current = parentId; + setCommentError(null); setPosting(true); // feedBump: this reply targets a BLOG POST, so it may activity-bump the feed // (issue #208). Skill-comment threads @@ -292,16 +311,18 @@ export function BlogPostView({ post, wallet, onClose }: { post: BlogNote; wallet

>COMMENTS{threads?.length ? ({threads.length}) : ""}

- {threads === undefined ? ( + {readError &&

Could not load comments. {readError}

} + {threads === undefined && !readError ? (

Loading comments...

- ) : threads.length === 0 ? ( + ) : threads?.length === 0 && !readError ? (

No comments yet. Be the first.

) : ( - + )} + {commentError &&

{commentError}

}
{canReply ? ( - + ) : (
>CONNECT_WALLET_ Connect a wallet to comment. @@ -405,6 +426,7 @@ export function NoteComposer({ disabled, withTitle, autoFocus, + clearOnSubmit = true, onSubmit, }: { placeholder: string; @@ -413,6 +435,7 @@ export function NoteComposer({ disabled?: boolean; withTitle?: boolean; autoFocus?: boolean; + clearOnSubmit?: boolean; onSubmit: (fields: NoteFields) => void; }) { const [title, setTitle] = useState(""); @@ -426,7 +449,7 @@ export function NoteComposer({ function submit() { if (!hasContent || !imageOk || busy) return; onSubmit({ text: text.trim(), title: title.trim() || undefined, gitLink: link.trim() || undefined, image: img || undefined }); - setTitle(""); setText(""); setLink(""); setImage(""); + if (clearOnSubmit) { setTitle(""); setText(""); setLink(""); setImage(""); } } return (
@@ -564,7 +587,8 @@ type CommentReply = CommentThread["replies"][number]; // Threaded comment list (GH #101): top-level comments, each with its replies collapsed to one // indented level; Reply opens an inline composer. Shared by the agent-profile comment wall and // a blog post's own comment thread (comment:blog:), so both render identically. -export function CommentThreadList({ threads, canPost, posting, replyTo, setReplyTo, onReply }: { +export function CommentThreadList({ threads, canPost, posting, replyTo, setReplyTo, onReply, preserveDraft = false }: { + preserveDraft?: boolean; threads: CommentThread[]; canPost: boolean; posting: boolean; @@ -591,7 +615,7 @@ export function CommentThreadList({ threads, canPost, posting, replyTo, setReply {nn.text &&

{nn.text}

} {nn.gitLink && } {canPost && ( - )} @@ -607,7 +631,7 @@ export function CommentThreadList({ threads, canPost, posting, replyTo, setReply )} {replyingHere && canPost && (
- onReply(f, replyTo ?? n.id)} /> + onReply(f, replyTo ?? n.id)} />
)}
diff --git a/surfaces/webview/src/market/BlogFeed.spec.tsx b/surfaces/webview/src/market/BlogFeed.spec.tsx new file mode 100644 index 00000000..1a6abd63 --- /dev/null +++ b/surfaces/webview/src/market/BlogFeed.spec.tsx @@ -0,0 +1,32 @@ +import { act } from 'react'; +import { createRoot, type Root } from 'react-dom/client'; +import { beforeEach, afterEach, expect, it, vi } from 'vitest'; +import { BlogFeed } from './BlogFeed'; +const store = vi.hoisted(() => ({ state: { walletAddress: null, toast: null, blogFeed: null as any, blogPosts: {} as Record, blogReadErrors: {} as Record }, send: vi.fn() })); +vi.mock('../state/store', () => ({ useStore: () => store, skillCardFiring: () => false })); +vi.mock('./AgentProfileView', () => ({ BlogPostView: ({post}: any) =>
{post.text}
, GithubCard: () => null, Modal: () => null, NoteComposer: () => null, PenIcon: () => null, shortWallet: (s:string) => s, noteDate: () => '' })); +let root: Root, host: HTMLDivElement; +const preview = { id: 'post', author: 'author', title: 'Open preview', text: 'Unverified mirror text', timestamp: 1 }; +async function render() { await act(async () => root.render()); } +async function click(text: string) { await act(async () => { const b = [...host.querySelectorAll('button')].find(b => b.textContent?.includes(text)); expect(b).toBeTruthy(); b!.click(); }); } +beforeEach(() => { + (globalThis as any).IS_REACT_ACT_ENVIRONMENT = true; + store.state.blogFeed = [preview]; store.state.blogPosts = {}; store.state.blogReadErrors = {}; store.send.mockClear(); + host = document.createElement('div'); document.body.append(host); root = createRoot(host); +}); +afterEach(async () => { await act(async () => root.unmount()); host.remove(); }); +it('does not open a mirrored body when the author table has no matching post', async () => { + await render(); await click('Open preview'); + store.state.blogPosts.post = null; await render(); + expect(host.querySelector('[data-testid="post-body"]')).toBeNull(); + expect(host.querySelector('[role="alert"]')?.textContent).toContain("unavailable from the author's table"); + await click('Try again'); expect(store.send).toHaveBeenLastCalledWith({ type:'getBlogPost', author:'author', postId:'post' }); + store.state.blogPosts.post = {...preview, text:'Verified author body'}; await render(); + expect(host.querySelector('[data-testid="post-body"]')?.textContent).toBe('Verified author body'); +}); +it('shows a retry for feed errors instead of claiming the feed is empty', async () => { + store.state.blogFeed = []; store.state.blogReadErrors.feed = 'Gateway unavailable'; await render(); + expect(host.textContent).toContain('Could not load posts'); expect(host.textContent).not.toContain('No posts yet'); + await click('Try again'); expect(store.send).toHaveBeenLastCalledWith({type:'getBlogFeed',sort:'active',fresh:true}); + store.state.blogReadErrors = {}; await render(); expect(host.textContent).toContain('No posts yet'); +}); diff --git a/surfaces/webview/src/market/BlogFeed.tsx b/surfaces/webview/src/market/BlogFeed.tsx index 08939153..b1634e5c 100644 --- a/surfaces/webview/src/market/BlogFeed.tsx +++ b/surfaces/webview/src/market/BlogFeed.tsx @@ -85,6 +85,7 @@ export function BlogFeed() { // The opened post's real body: undefined = still fetching, null = not found. const openBody = openId !== null ? state.blogPosts[openId] : undefined; const openFallback = openId !== null ? posts?.find((p) => p.id === openId) : undefined; + const openError = openId !== null ? state.blogReadErrors[`post:${openId}`] : undefined; const openPost = openBody ?? undefined; return (
@@ -105,7 +106,9 @@ export function BlogFeed() { ))}
- {posts === null ? ( + {state.blogReadErrors.feed ? ( +

Could not load posts. {state.blogReadErrors.feed}

+ ) : posts === null ? ( ) : posts.length === 0 ? (

@@ -125,7 +128,7 @@ export function BlogFeed() { onClick={() => { haptics.tick(); setOpenId(p.id); - if (state.blogPosts[p.id] === undefined) send({ type: "getBlogPost", author: p.author, postId: p.id }); + if (state.blogPosts[p.id] == null || state.blogReadErrors[`post:${p.id}`]) send({ type: "getBlogPost", author: p.author, postId: p.id }); }} className="relative block w-full text-left active:opacity-80" style={{ border: "1px solid var(--an-term-line-2)", background: showBump ? BUMP_TICKS : "var(--an-bg-0)", padding: "11px 12px" }} @@ -164,12 +167,14 @@ export function BlogFeed() {

)} {openId !== null && ( - openPost ? ( + openError || openBody === null ? ( +
+ +

{openError ? `Could not load this post. ${openError}` : "This post is unavailable from the author's table."}

+ {openFallback && } +
+ ) : openPost ? ( setOpenId(null)} /> - ) : openBody === null && openFallback ? ( - // Body gone from the author's table (or never there: a forged bump): - // fall back to the mirrored row so the tap still shows something real. - setOpenId(null)} /> ) : ( setOpenId(null)} /> ) diff --git a/surfaces/webview/src/market/BlogPostView.spec.tsx b/surfaces/webview/src/market/BlogPostView.spec.tsx new file mode 100644 index 00000000..2f02a7ac --- /dev/null +++ b/surfaces/webview/src/market/BlogPostView.spec.tsx @@ -0,0 +1,61 @@ +import { act } from 'react'; +import { createRoot, type Root } from 'react-dom/client'; +import { beforeEach, afterEach, expect, it, vi } from 'vitest'; +import { BlogPostView } from './AgentProfileView'; +const store = vi.hoisted(() => ({ state: { walletAddress: 'local-wallet', blogReadErrors: {} as Record, blogComments: {} as Record, blogCommentResults: {} as Record }, send: vi.fn() })); +vi.mock('../state/store', () => ({ useStore: () => store, skillCardFiring: () => false })); +const post = { id: 'local-post', author: 'local-author', text: 'Local QA only', timestamp: 1 }; +const thread = { note: { id: 'local-comment', author: 'reader', text: 'hello', timestamp: 1 }, replies: [] }; +let root: Root, host: HTMLDivElement; +async function render() { await act(async () => root.render( {}} />)); } +const field = (reply = false) => host.querySelector(`textarea[placeholder="Write a ${reply ? 'reply' : 'comment'}..."]`)!; +async function type(text: string, reply = false) { await act(async () => { const el = field(reply); Object.getOwnPropertyDescriptor(HTMLTextAreaElement.prototype, 'value')!.set!.call(el, text); el.dispatchEvent(new Event('input', { bubbles: true })); }); } +async function click(label: string) { await act(async () => { const b = [...host.querySelectorAll('button')].find(b => b.textContent === label); expect(b).toBeTruthy(); b!.click(); }); } +beforeEach(async () => { + (globalThis as any).IS_REACT_ACT_ENVIRONMENT = true; + store.state.blogReadErrors = {}; store.state.blogComments = { 'local-post': [thread] }; store.state.blogCommentResults = {}; store.send.mockClear(); + host = document.createElement('div'); document.body.append(host); root = createRoot(host); await render(); +}); +afterEach(async () => { await act(async () => root.unmount()); host.remove(); }); +it('preserves a Korean draft on failure, permits retry, clears only on success', async () => { + await type('안녕하세요, 다시 시도할 댓글입니다'); await click('Comment'); + expect(field().value).toContain('안녕하세요'); expect(field().disabled).toBe(true); + store.state.blogCommentResults['local-post'] = { ok: false, error: 'Local simulated network failure' }; await render(); + expect(field().disabled).toBe(false); expect(field().value).toContain('안녕하세요'); expect(host.querySelector('[role="alert"]')?.textContent).toContain('network failure'); + await click('Comment'); store.state.blogCommentResults['local-post'] = { ok: true }; await render(); + expect(field().value).toBe(''); expect(host.querySelector('[role="alert"]')).toBeNull(); +}); +it('late comment refresh does not close a reply or acknowledge its submission', async () => { + await click('[Reply]'); await type('reply draft', true); + store.state.blogComments['local-post'] = [{ ...thread }]; await render(); expect(field(true).value).toBe('reply draft'); await click('Reply'); + store.state.blogComments['local-post'] = [{ ...thread }]; await render(); expect(field(true).disabled).toBe(true); + store.state.blogCommentResults['other-post'] = { ok: true }; await render(); expect(field(true).disabled).toBe(true); + store.state.blogCommentResults['local-post'] = { ok: false, error: 'Retry' }; await render(); expect(field(true).value).toBe('reply draft'); expect(field(true).disabled).toBe(false); + await click('Reply'); store.state.blogCommentResults['local-post'] = { ok: true }; await render(); expect(field(true)).toBeNull(); +}); +it('successful reply preserves a separate top-level comment draft', async () => { + await type('unsent top-level draft'); await click('[Reply]'); await type('reply', true); await click('Reply'); + store.state.blogCommentResults['local-post'] = { ok: true }; await render(); expect(field().value).toBe('unsent top-level draft'); +}); +it('repeated failures restore controls and do not consume an older result', async () => { + store.state.blogCommentResults['local-post'] = { ok: false, error: 'Same error' }; await render(); + await type('retryable'); await click('Comment'); + expect(field().disabled).toBe(true); + store.state.blogCommentResults['local-post'] = { ok: false, error: 'Same error' }; await render(); + expect(field().disabled).toBe(false); expect(field().value).toBe('retryable'); + await click('Comment'); expect(field().disabled).toBe(true); + store.state.blogCommentResults['local-post'] = { ok: false, error: 'Same error' }; await render(); + expect(field().disabled).toBe(false); expect(field().value).toBe('retryable'); +}); + +it('keeps the draft and cached comments when a thread read fails', async () => { + await type('안녕하세요 draft'); + store.state.blogReadErrors['comments:local-post'] = 'Gateway unavailable'; + await render(); + expect(field().value).toBe('안녕하세요 draft'); + expect(host.textContent).toContain('hello'); + expect(host.textContent).toContain('Could not load comments'); + expect(host.textContent).not.toContain('No comments yet'); + await click('Try again'); + expect(store.send).toHaveBeenCalledWith({ type: 'getBlogComments', postId: 'local-post', agentWallet: 'local-author' }); +}); diff --git a/surfaces/webview/src/state/store.tsx b/surfaces/webview/src/state/store.tsx index de46979b..b4d557cc 100644 --- a/surfaces/webview/src/state/store.tsx +++ b/surfaces/webview/src/state/store.tsx @@ -146,6 +146,8 @@ export interface State { agents: Reputation[]; agentProfile: AgentProfile | null; agentProfileLoading: boolean; + blogReadErrors: Record; + blogCommentResults: Record; blogComments: Record; // per-post comment threads, keyed by postId blogFeed: import("@iqlabs-official/agent-sdk").Note[] | null; // global feed, grouped + sorted (issues #183/#203/#208); null = not loaded yet blogPosts: Record; // opened post bodies by id (#208 re-fetch); null = not found @@ -221,6 +223,8 @@ export const initialState: State = { agents: [], agentProfile: null, agentProfileLoading: false, + blogReadErrors: {}, + blogCommentResults: {}, blogComments: {}, blogFeed: null, blogPosts: {}, @@ -665,13 +669,13 @@ export function reducer(state: State, ev: Action): State { ? { ...state, marketDetail: { ...state.marketDetail, notes: ev.notes as SkillDetail["notes"] } } : state; case "blogComments": - return { ...state, blogComments: { ...state.blogComments, [ev.postId]: ev.threads } }; + return { ...state, blogReadErrors: { ...state.blogReadErrors, [`comments:${ev.postId}`]: ev.error }, blogComments: ev.error ? state.blogComments : { ...state.blogComments, [ev.postId]: ev.threads } }; case "blogFeed": - return { ...state, blogFeed: ev.posts }; + return { ...state, blogReadErrors: { ...state.blogReadErrors, feed: ev.error }, blogFeed: ev.error ? state.blogFeed : ev.posts }; case "blogPost": - return { ...state, blogPosts: { ...state.blogPosts, [ev.postId]: ev.post } }; + return { ...state, blogReadErrors: { ...state.blogReadErrors, [`post:${ev.postId}`]: ev.error }, blogPosts: ev.error ? state.blogPosts : { ...state.blogPosts, [ev.postId]: ev.post } }; case "blogCommentResult": - return { ...state, toast: ev.ok ? "Comment posted." : `Comment failed: ${ev.error ?? "unknown"}` }; + return { ...state, blogCommentResults: { ...state.blogCommentResults, [ev.postId]: { ok: ev.ok, error: ev.error } }, toast: ev.ok ? "Comment posted." : `Comment failed: ${ev.error ?? "unknown"}` }; case "githubStatus": return { ...state, githubStatus: { hasToken: ev.hasToken, masked: ev.masked } }; case "__loadingAgents": diff --git a/surfaces/webview/src/transport/protocol.ts b/surfaces/webview/src/transport/protocol.ts index 031ec48e..825d3bf3 100644 --- a/surfaces/webview/src/transport/protocol.ts +++ b/surfaces/webview/src/transport/protocol.ts @@ -165,7 +165,7 @@ export type ClientMessage = | { type: "postNote"; skillId: string; skillType?: "skill" | "workflow"; text: string; gitLink?: string } | { type: "postAgentNote"; agentWallet: string; text: string; gitLink?: string; title?: string; image?: string; parentId?: string } | { type: "getBlogComments"; postId: string; agentWallet: string } - | { type: "getBlogFeed"; limit?: number; sort?: "active" | "latest" } + | { type: "getBlogFeed"; limit?: number; sort?: "active" | "latest"; fresh?: boolean } | { type: "getBlogPost"; author: string; postId: string } | { type: "postBlogComment"; postId: string; agentWallet: string; text: string; gitLink?: string; parentId?: string; sage?: boolean; feedBump?: boolean } | { @@ -270,9 +270,9 @@ export type ServerMessage = | { type: "agentProfile"; profile: import("@iqlabs-official/agent-sdk").AgentProfile } | { type: "buyAllResult"; wallet: string; ok: boolean; bought: number; failed: number; error?: string } | { type: "agentNoteResult"; agentWallet: string; ok: boolean; error?: string } - | { type: "blogComments"; postId: string; threads: import("@iqlabs-official/agent-sdk").AgentProfile["threads"] } - | { type: "blogFeed"; posts: import("@iqlabs-official/agent-sdk").Note[] } - | { type: "blogPost"; postId: string; post: import("@iqlabs-official/agent-sdk").Note | null } + | { type: "blogComments"; postId: string; threads: import("@iqlabs-official/agent-sdk").AgentProfile["threads"]; error?: string } + | { type: "blogFeed"; posts: import("@iqlabs-official/agent-sdk").Note[]; error?: string } + | { type: "blogPost"; postId: string; post: import("@iqlabs-official/agent-sdk").Note | null; error?: string } | { type: "blogCommentResult"; postId: string; ok: boolean; error?: string } | { type: "publishResult"; ok: boolean; mint?: string; error?: string } | { type: "publishProgress"; phase: "store" | "mint" | "list"; signed: number; total?: number; percent?: number; kind: "skill" | "workflow" } diff --git a/surfaces/webview/vitest.config.ts b/surfaces/webview/vitest.config.ts new file mode 100644 index 00000000..d872c067 --- /dev/null +++ b/surfaces/webview/vitest.config.ts @@ -0,0 +1,3 @@ +import { defineConfig } from 'vitest/config'; +import react from '@vitejs/plugin-react'; +export default defineConfig({ plugins: [react()], test: { environment: 'jsdom' } });