feat(mcp): agent save_page_version tool — collab stateless transport + role prompts (#370)
Stage A of #370: wire the MCP client transport for the already-shipped server save-version handler (PR-1 #374). An agent can now pin an intentional named version (kind='agent', derived server-side from the signed actor) of a page's CURRENT live collaboration content. - collab-session.ts: add CollabSession.sendStatelessAndAwait(payload, predicate, timeoutMs) — sends a stateless message over the live provider and resolves on the first matching reply, with a bounded timeout; lifecycle (inflightReject, ready-guard, concurrent fail-fast, idle re-arm) mirrors mutate(). Extend CollabProviderLike with sendStateless + the stateless on/off overloads. - collaboration.ts: add savePageVersionRealtime() — under withPageLock, reuse the cached agent-authenticated CollabSession (#400), send {type:'save-version'}, await {type:'version.saved', …}; no REST read (would race the stale page row). - client/pages.ts: add savePageVersion(pageId) — resolvePageId + getCollabTokenWithReauth + writeWithCollabAuthRetry (#486 self-heal). - tool-specs.ts: add the deferred savePageVersion spec (+ DocmostClientLike Pick); auto-registered on both hosts by the shared loops. - server-instructions.ts: HISTORY family + routing-prose mention. - ai-chat-tools.service.ts: contract type-assert for the new client method. - agent-roles-catalog: tell the content-authoring roles (researcher, call-summarizer, ru+en) to save a version when the document is done; bump their catalog versions. - test: unit coverage for savePageVersionRealtime (ack + bounded-timeout paths). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -106,6 +106,7 @@ function __assertClientCallContract(client: DocmostClientLike): void {
|
||||
void client.sharePage(s, true);
|
||||
void client.unsharePage(s);
|
||||
void client.restorePageVersion(s);
|
||||
void client.savePageVersion(s);
|
||||
void client.transformPage(s, s, { dryRun: true });
|
||||
void client.stashPage(s);
|
||||
// --- write (image / footnote), in-app since #410 ---
|
||||
|
||||
Reference in New Issue
Block a user