Skip to content

feat(runtime): createInProcessAuthoringRegistry, the light authoring door in process as the signed-in user - #37968

Merged
objectstack-fleet[bot] merged 6 commits into
mainfrom
claude/project-thread-klwij0
Nov 27, 2026
Merged

objectstack-fleet[bot] merged 6 commits into
mainfrom
claude/project-thread-klwij0

Conversation

@objectstack-fleet

@objectstack-fleet objectstack-fleet Bot commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

Requested by Tesla · project thread

Fixes #37944

Clause-②: no
Metadata-protocol: none

维护者速读

  • 用户能看到什么变化:用户无感;云端问 AI 的管理员技能今后可以在服务器进程内、以当前登录用户身份调用框架的五个搭建工具(读元数据、存草稿、删草稿),不需要 OAuth 授权。
  • 为什么做:云端问 AI 管理员技能(云端 M2 第一项)要用框架这套工具,否则云端得再抄一份约七百行、会和框架走样的副本。
  • 出错会怎样:只影响管理员在应用内让 AI 存草稿;准入仍是本人的元数据管理权限,草稿照旧要人在 Studio 审阅后发布,合入后可直接回退。
  • 要你做什么:无。

What changes

  • Docs: packages/runtime/README.md gains an In-process authoring tools section under API Reference (the package's published record of its API). content/docs/permissions/system-context.mdx gains row 61c (the entry admits a system context nothing) with its regenerated register line, because the entry's fail-closed guard reads isSystem.
  • New public entry createInProcessAuthoringRegistry(kernel, { executionContext, environmentId }) from @objectstack/runtime (packages/runtime/src/in-process-authoring.ts, beside action-dispatch.ts). It returns { admitted, getAll(), execute(toolCall) }: the five tools of the MCP draft door (list_metadata_items, get_metadata_item, list_drafts, save_metadata_draft, delete_metadata_draft), bound to one signed-in person for one turn. Exported types: InProcessAuthoringRequest, InProcessAuthoringRegistry, OpenAuthoringToolCall, OpenAuthoringToolResult.
  • One implementation. The MCP door's assembly is factored out as buildOpenAuthoringRegistry(deps, context, principal) in mcp-authoring.ts; resolveOpenAuthoringInjection (the MCP door) and the new entry both call it. The private builders (resolveHumanReader, openWriter, openReadGateSources) are unchanged in body and still take DomainHandlerDeps + HttpProtocolContext; no second copy exists.
  • Placement, as dispatchAction. The entry takes the host kernel and runs on the same shared per-kernel HttpDispatcher as dispatchAction (hostDispatcherFor(kernel), extracted in action-dispatch.ts; dispatchAction and dispatchActionResume bodies untouched). HttpDispatcher.hostAuthoringRegistry(request) places the request with the same placeHostActionRequest step a host action call uses, so the tools read the environment's services exactly as the MCP door reads them, including the classified tenancy and knowledge lookups. A resolver that refuses to place the request rejects the call.
  • Admission is the human half only: the person's own manage_metadata, decided by resolveHumanReader exactly as for the MCP door. A person without it is listed no tool and every call is refused 403 PERMISSION_DENIED (the MCP door's shape; the sentence drops the metadata:write half, which does not exist here). Fail closed: an envelope with no userId, an isSystem envelope, or a grant read that throws admits nothing.
  • Provenance: saves through the entry state surface: 'copilot' and no client. The MCP door keeps surface: 'mcp' with the token's client.
  • No publish tool. The MCP door's behaviour is unchanged (its whole test file is green unmodified above the new group).

Why copilot, not the card's example in_app (seat ruling, claim amendment 7219051191)

The card asks for a value "other than 'mcp'" so Studio and the host's caps can tell the in-app path from MCP. MetadataAuthoringSurfaceSchema already has that value: copilot, whose published meaning is "an AI assistant's tool writing on a person's behalf", which only an in-process caller may state (every HTTP door refuses ?surface=copilot). Studio already renders it as an AI draft mark. Adding in_app would widen a published accept set (Clause-② yes) and touch packages/spec and Studio's rendering for no new distinction, so this PR adds no enum member and does not touch packages/spec.

Tests

New top-level group in the door's shared harness packages/runtime/src/domains/mcp-authoring.test.ts, through the real entry on a host kernel (the dispatchAction pins' kernel shape):

  • the entry is the package's public export;
  • an admitted person is listed exactly the MCP door's five tool definitions (deep-equal to the MCP door's getAll()), with no publish tool, and a read is served;
  • a person without manage_metadata is listed nothing, and every one of the five tools is refused with the MCP door's code/status, before any protocol read;
  • a draft save stamps surface: 'copilot', no client, actor = the person, and answers the publish verdict and Studio routes; the MCP door's save in the same test still stamps mcp + client;
  • the writer is the MCP door's: a walled tenancy posture refuses the save 403 before any write;
  • fail closed: no user, isSystem, a throwing grant read;
  • placement: a named environment scopes every service lookup; a refusing kernel-resolver rejects with no grant read.

Ablations (on the committed tree, restored with git checkout HEAD --): hard-coding the save's surface to 'mcp' reds the provenance test; dropping the isSystem guard reds the fail-closed test.

Acceptance notes

  • File surface beyond the original claim (http-dispatcher.ts, action-dispatch.ts, the new in-process-authoring.ts) was confirmed by the seat before push (claim amendment 7219051191). The entry file sits in src/, not src/domains/: every file under domains/ must declare an HTTP route envelope (check:route-envelope), and this one serves no route; the seat recorded the move in claim amendment 2 (7219506629), and check-route-envelope.mjs is unchanged. content/docs/permissions/system-context.mdx (row 61c) is the census page check:system-context-census requires for the new isSystem read. overlap-check.mjs --pr=37896 (the open PR that also edits action-dispatch.ts): VERDICT clean exit 0, both merge cleanly.
  • The first commit on the branch (1c78bfc0, a WIP push) carries no trailer pair; the second carries the model-free pair.
  • Public API record: the runtime package has no generated API report (api-surface/ is packages/spec only); the export is recorded in src/index.ts with its comment and in the changeset.

Verification

Local runs and CI (head 7fea375, merge base bc17334)
  • pnpm --filter @objectstack/runtime exec vitest run --maxWorkers=2 src/domains/mcp-authoring.test.ts src/action-dispatch.test.ts src/action-confirmation-handoff-33690.test.ts (under os-verify-lock.sh, head 7fea375): Test Files 3 passed, Tests 172 passed, VERDICT command-exit 0.
  • pnpm --filter @objectstack/runtime typecheck: tsc --noEmit clean; check:test-typecheck reports 3 files that import @objectstack/driver-turso, which this container did not build (TS2307, none touched here). CI's Type Check · workspace and TypeScript Type Check are green.
  • Derived gates (dispatch-gates.mjs --commands, 73 commands): 70 exit 0. check:plugin-teardown-shape --self-test and check:dual-build-cjs-loads exit 3 (prerequisite dist not built here; CI green). check:query-options-erasure exited 1 only because the file moved mid-run (ENOENT on the old path) and exits 0 when re-run on the final tree. check:route-envelope, check:system-context-census and check:doc-anchors exit 0. check:published-readme-exports answers NOT MEASURED (exit 3) locally; CI is its verdict.
  • CI at 7fea375: 55 check runs, 40 success, 15 skipped (UI, opt-in and queue lanes), 0 failed; including Lint & Repo Gates, TypeScript Type Check, Test Core (10/10 shards), Build Core, Build Docs, Check Changeset, PR-body guards.

Two-minute check: pnpm --filter @objectstack/runtime exec vitest run src/domains/mcp-authoring.test.ts -t 37944 shows 7 passing cases.

🤖 Generated with Claude Code

https://claude.ai/code/session_01L9qibyo6pEabiVD1KUoeEJ


Generated by Claude Code

…door in process

The MCP draft door's five tools for a host's in-process AI assistant, as
the signed-in person: built by the door's own assembly over a request the
dispatcher places as dispatchAction places a host call; admission is the
person's own manage_metadata; saves state surface 'copilot'; no publish tool.

Claude-Session: https://claude.ai/code/session_01L9qibyo6pEabiVD1KUoeEJ
Co-authored-by: Claude <noreply@anthropic.com>
@github-actions github-actions Bot added size/l documentation Improvements or additions to documentation tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 27, 2026
@github-actions

github-actions Bot commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 1 package(s): @objectstack/runtime, touching 19 documentable anchor(s). ⚠️ 2 changed file(s) yielded no anchor (packages/runtime/README.md, packages/runtime/src/index.ts), so the pages documenting them are NOT COVERED by this run — this is not a clean bill of health for those files.

19 hand-written doc(s) name something this change touched — list omitted above 15 rows. Re-derive on the tree named below: node scripts/docs-audit/affected-docs.mjs --json 9a274e6725822124948fb54a3b3cebccf1c84e44.

⛔ 3 release-owned page(s) also affected — read-only, see AGENTS.md Documentation Guardrails.

What this run could not see
  • 2 changed file(s) yielded no anchor (packages/runtime/README.md, packages/runtime/src/index.ts) — pages documenting those are invisible to this run
  • 1 cross-cutting symbol(s) contributed no route anchor: environmentId (48 routes)
  • 4 name(s) were too generic to anchor anything (single lowercase words)
  • the SDK route bridge reached 69 of 252 client-bound route-ledger rows — the other 183 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 183: 0 are remediable by widening that discovery convention (an in-repo file declares the path; the convention did not scan it); 59 are structural — on a ledger where NOT ONE row is declared in-repo, so no discovery change reaches them at any price; 124 are undecided (no in-repo declaration, on a ledger that has other in-repo registrars — absence and an unreadable spelling are not distinguishable here). The rows themselves: node scripts/docs-audit/affected-docs.mjs --bridge-coverage
  • a page that states a rule by its inputs shares no identifier with the emitter that implements the rule, so an emitter-only diff cannot list it — not on this run and not on any run. Measured on fix(driver-sql): emit varchar(maxLength) for a text field a declared index keys on #11430: content/docs/protocol/objectql/types.mdx documents the text-family column mapping by the ObjectQL type names it maps FROM (text / textarea / html) while the diff changed createColumn; it went unlisted, and it was the page that diff falsified, in four places. No shared token exists to detect this on, so a rule your change carries has to be re-read by hand in the pages that restate it.
  • a key NAME is not a key, so the hand re-read the line above prescribes can land on the wrong schema. The same spelling is authorable on one governed type and a [REMOVED] tombstone on another for each of active, aria, joins, objects, template, tools and version (censused on [finding] tools is a key on BOTH AgentSchema (tombstoned, dead) and SkillSchema (live, cloud-attested), so a name-based search attributes skill examples to the agent key — it produced a false stop-the-line alarm on PR #19059 #19093 over the liveness ledger's governed types, top-level keys); nothing in a search result distinguishes the two, so a grep hit on a LIVE example reads as evidence about the DEAD key. Measured on fix(spec): the agent.tools liveness row says dead — it claimed live on a key the schema tombstoned #19059: content/docs/ai/agents.mdx was reported as contradicting the agent.tools tombstone over its tools: example at :161, which is inside the defineSkill({ block opened at :155 — the page was already correct. Settle ownership by PARSING the value against both schemas, never by the name: that literal PASSES SkillSchema, and as an AgentSchema it FAILS at tools with the tombstone prescription. ⛔ These names are not the whole class — a key retired through a .strict() guidance map leaves no tombstone in the walked shape and none of them here (tool.category, live as AIToolDefinition.category).

Coarse fallback — 30 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): node scripts/docs-audit/affected-docs.mjs --json 9a274e6725822124948fb54a3b3cebccf1c84e44 → packageMentionDocs.

Which tree this was computed on

This run read content/docs from d8e3522aa3f08bbbdf487b1c04fc30a1ce09d39f — the merge of head 9b83607ea5f6824e65cddf831e7974ba9247fa33 into base 9a274e6725822124948fb54a3b3cebccf1c84e44, which is what actions/checkout gives a pull_request run. Not the PR head.

A worktree cut from an older main holds a different content/docs, so re-deriving there can legitimately return a different list — that is a different tree, not a wrong row. To answer on the same tree:

# while this PR is open — GitHub drops the merge commit once it closes
git fetch origin d8e3522aa3f08bbbdf487b1c04fc30a1ce09d39f && git checkout d8e3522aa3f08bbbdf487b1c04fc30a1ce09d39f
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 9a274e6725822124948fb54a3b3cebccf1c84e44 9b83607ea5f6824e65cddf831e7974ba9247fa33 && git checkout -B drift-repro 9a274e6725822124948fb54a3b3cebccf1c84e44 && git merge --no-ff 9b83607ea5f6824e65cddf831e7974ba9247fa33

node scripts/docs-audit/affected-docs.mjs --json 9a274e6725822124948fb54a3b3cebccf1c84e44

⚠️ That checkout carried uncommitted changes, so the commit above does not fully identify what was read.

Advisory only, and a precision-first one (#9192): a page is listed because it names a
symbol, wire route or SDK method this diff touched — not because it mentions a changed
package. Each row says which anchor put it there, so a wrong row is reportable rather than
merely annoying. To re-verify, run the docs-accuracy-audit workflow scoped to these files:
node scripts/docs-audit/affected-docs.mjs 9a274e6725822124948fb54a3b3cebccf1c84e44 → pass the list as
args.docs, on the commit named under Which tree this was computed on.

…-dispatch

It is a host door like dispatchAction, not a dispatcher domain: under
domains/ the route-envelope gate reads it as an undeclared domain.

Claude-Session: https://claude.ai/code/session_01L9qibyo6pEabiVD1KUoeEJ
Co-authored-by: Claude <noreply@anthropic.com>
…ntext refusal (#37944)

Row 61c: createInProcessAuthoringRegistry admits a system envelope
nothing, so its isSystem read has an owning row; register regenerated.

Claude-Session: https://claude.ai/code/session_01L9qibyo6pEabiVD1KUoeEJ
Co-authored-by: Claude <noreply@anthropic.com>
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#3 · os-tesla · session_01L9qibvMMgnKA797JY46H9i

L1-c, the seat's L1 thread · 2026-11-27T15:22Z

席位核对 — L1 @ 9b83607ea5f6824e65cddf831e7974ba9247fa33

Verdict: ACCEPT.

No contract review is owed:

  • the diff touches no packages/spec/src/** and no governed path;
  • the declaration is Clause-②: no, with no narrowing arm;
  • record-recognisers --paths decides no face.

So this L1 read is the whole review (contract-review.md: CI plus the seat's own read). A new export from @objectstack/runtime is not one of the four faces.

Checklist

  • Shape and relation. The PR is a draft against base main, with first line Fixes #37944. No closing keyword binds another card. Fixes is right because each of the card's five steps is in the diff:

    1. the export;
    2. admission on the person's own manage_metadata through the same resolveHumanReader, with the MCP door's 403 PERMISSION_DENIED shape;
    3. provenance other than mcp;
    4. no publish tool, and the MCP door unchanged;
    5. one assembly, buildOpenAuthoringRegistry, which both entries call.
  • Step 3 uses copilot, not the card's example in_app. The seat ruled this in claim amendment 7219051191. MetadataAuthoringSurfaceSchema (packages/spec/src/api/protocol.zod.ts:594) already holds copilot, with the published meaning "an AI assistant's tool writing on a person's behalf", stated only in process. Adding in_app would have widened a published accept set for no new distinction.

  • Each of the card's acceptance cases is a test in the new [#37944] group, run through the real entry on a host kernel:

    • the same five definitions, deep-equal to the MCP door's;
    • refusal without the capability, before any read;
    • surface: 'copilot' with no client, while the MCP save in the same case still stamps mcp plus client;
    • fail-closed for no user, isSystem, and a throwing grant read;
    • placement by the named environment, and a refusing resolver.

    The MCP door's existing cases are unmodified above the group. The report's ablations (surface hard-coded to mcp, the isSystem guard dropped) each turn a case red.

  • Fail-closed, read in the code.

    • inProcessAuthoringRegistryRequest returns an unadmitted registry for no userId or for isSystem, before it places anything or reads any grant.
    • bound() stamps every call with the person it was built for, so the registry's principal.userId check holds.
    • The isSystem guard is needed. The writer passes ec.isSystem to walledCatalogWriteVerdict (mcp-authoring.ts:667). Row 61c says so, and it is true.
  • Public surface. The new exports are createInProcessAuthoringRegistry, two request/registry types, and the two tool-call/result types that the registry's signature needs. door widens to 'mcp' | 'in_process' on OpenAuthoringCallContext, which is not exported from the package entry. The runtime package has no generated API report. The export is recorded in index.ts, in the README section and in the changeset, which is where this package records its API.

  • Scope. There are 9 files, all inside the claim's surface as amended in 7219051191 and 7219506629. The two amendments cover http-dispatcher.ts, action-dispatch.ts, the entry's move from domains/ to src/ (because of check:route-envelope), and census row 61c.

  • Changeset, read sentence by sentence (.changeset/37944-in-process-authoring-entry.md). Every sentence is true at this head:

    • the signature;
    • the five tools;
    • "no second copy";
    • admission, the 403 shape and fail-closed;
    • copilot with no client;
    • no publish tool;
    • the MCP door's unchanged tools, admission, and mcp plus client;
    • the host's remaining jobs;
    • a refusing resolver rejects.

    patch for a new runtime export follows the precedent of dispatchActionResume (c77f8ca, under Patch Changes), and the package is in the fixed group.

  • Docs.

    • system-context.mdx row 61c and its register line are true at this head: no tool listed, a 403 before any grant read or placement, and the walled-refusal reason.
    • The README section matches the code.
  • Readings and head.

    • The os-dev-report (7221433703) pins its runs to 7fea375d: 3 files, 172 tests, plus the gates.
    • This head, 9b83607e, is a merge of main with no conflict. Against 7fea375d it adds only main's own package-display-name-disabled.test.ts under packages/runtime. The PR's net diff is unchanged: 9 files, +489/−17. So those test readings carry to this head.
    • Check-runs at this head: 40 success, 15 expected skip, 0 failed, 0 pending; Lint & Repo Gates and TypeScript Type Check both green.
    • No dogfood battery is owed: there is no ! in the title and no narrowing arm.

Notes (no change asked)

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#3 · os-tesla · session_01L9qibyUSf2nKJWW6qBemSU

Landing · 2026-11-27T15:23Z · zone o3-askai (seat card thread)
Head-sha: 9b83607ea5f6824e65cddf831e7974ba9247fa33

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 27, 2026 15:24
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 27, 2026
Merged via the queue into main with commit ecd10e9 Nov 27, 2026
56 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/project-thread-klwij0 branch November 27, 2026 15:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/l tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

2 participants