Repository navigation
feat: an app's ask skill text is capped at 8,000 characters at build, at save and in Studio - #39246
objectstack-fleet[bot] wants to merge 13 commits into
Conversation
Claude-Session: https://claude.ai/code/session_012dn2AcUDbrgRnUrYc6fcNr Co-authored-by: Claude <noreply@anthropic.com>
…text cap exports Claude-Session: https://claude.ai/code/session_012dn2AcUDbrgRnUrYc6fcNr Co-authored-by: Claude <noreply@anthropic.com>
… cap Claude-Session: https://claude.ai/code/session_012dn2AcUDbrgRnUrYc6fcNr Co-authored-by: Claude <noreply@anthropic.com>
…l text cap Claude-Session: https://claude.ai/code/session_012dn2AcUDbrgRnUrYc6fcNr Co-authored-by: Claude <noreply@anthropic.com>
… its app over the skill text cap Claude-Session: https://claude.ai/code/session_012dn2AcUDbrgRnUrYc6fcNr Co-authored-by: Claude <noreply@anthropic.com>
… the cap Claude-Session: https://claude.ai/code/session_012dn2AcUDbrgRnUrYc6fcNr Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012dn2AcUDbrgRnUrYc6fcNr Co-authored-by: Claude <noreply@anthropic.com>
… ledger Claude-Session: https://claude.ai/code/session_012dn2AcUDbrgRnUrYc6fcNr Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012dn2AcUDbrgRnUrYc6fcNr Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012dn2AcUDbrgRnUrYc6fcNr Co-authored-by: Claude <noreply@anthropic.com>
… text cap save-door test Claude-Session: https://claude.ai/code/session_012dn2AcUDbrgRnUrYc6fcNr Co-authored-by: Claude <noreply@anthropic.com>
📓 Docs Drift CheckThis PR changes 3 package(s): 44 hand-written doc(s) name something this change touched — list omitted above 15 rows. Re-derive on the tree named below: ⛔ 16 release-owned page(s) also affected — read-only, see AGENTS.md Documentation Guardrails. What this run could not see
Coarse fallback — 194 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): Which tree this was computed onThis run read A worktree cut from an older # while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 9fc3742979eb0ba22425f0458942af5f3b3f1ea8 && git checkout 9fc3742979eb0ba22425f0458942af5f3b3f1ea8
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 1fe9c6287f2f058c7d1f1972cdfa4ebcd58803b6 3420498aa3432c004abf4ec3c92927f92edb6e39 && git checkout -B drift-repro 1fe9c6287f2f058c7d1f1972cdfa4ebcd58803b6 && git merge --no-ff 3420498aa3432c004abf4ec3c92927f92edb6e39
node scripts/docs-audit/affected-docs.mjs --json 1fe9c6287f2f058c7d1f1972cdfa4ebcd58803b6
|
…its BREAKING banner Claude-Session: https://claude.ai/code/session_012dn2AcUDbrgRnUrYc6fcNr Co-authored-by: Claude <noreply@anthropic.com>
Fixes #39102
Clause-②: yes (narrowing)
Metadata-protocol: narrowed
Skills-docs: follow-up owed — skills/objectstack-ai/SKILL.md (its skill section teaches
surfaceand the ask agent's skills; it should state the 8,000-character app cap and what counts) and skills/objectstack-ai/evals/skills-tools-knowledge.json (no case exercises an app over the cap)维护者速读
What changes
The hosted
askagent caps the skill text one app (package) binds on theasksurface (cloud ADR-0118 D5; cloud'sPACKAGE_SKILL_TEXT_CAP = 8_000). This PR declares the cap and its one measure in the spec and holds it at the three open-framework doors the card names.packages/spec/src/ai/package-skill-text.ts, exported from@objectstack/spec/ai):PACKAGE_SKILL_TEXT_CAP(8,000),composeSkillSection(the section cloud'sSkillRegistry.composeSkillSectionbuilds: the heading line\n### {label} ({name}),description,instructions,Tools: {tools joined by ", "}, joined with newlines, an absent or empty line left out),countsTowardPackageSkillText(surfaceask,both, or unset — the schema default isask;buildnever counts),packageSkillTextLength,packageSkillTextTotal,formatPackageSkillTextCountandpackageSkillTextCapMessage(the one sentence every door refuses with: the app, its total, the cap,8,520 / 8,000, and the ways out). A test pins the composed string for a fixture skill, so a drift against cloud's copy shows as a diff of that literal.packages/cli/src/utils/app-skill-text-cap.ts, one stanza each invalidate.tsandcompile.tsbeside the namespace-name refusal): an app over the cap fails the command;--jsoncarries oneerrors[]row per app (packageId,total,cap,message), andos buildwrites no artifact. An artifact'spackages[]bodies are one app each; the stack's own top-levelskillsare the stack's app under itsmanifest.id.packages/metadata-protocol/src/protocol-skill-text-cap.ts, one call inprotocol-save.ts): askillsave after which the app it lands in is over the cap AND higher than before is refused422 INVALID_METADATA(an existing published code — no ledger change), its message and its oneissues[]entry naming the app's total and the cap. The app is the package the save LANDS IN — the same landing binding the permission-set name refusal judges against (the request's package, or for a draft naming none, the draft address'sinto). The set is that package's servedskilllist, with pending drafts shown for a draft save. Every writer reaches it: Studio,PUT /api/v1/meta/skill/NAME, an MCP draft save.ui/packages/app-shell/src/views/metadata-admin/SkillTextCapTotals.tsx, one line inResourceListPage.tsx, two strings each in the studioen/zhpacks): each app's total against the cap above the list, e.g.com.acme.crm — ask skill text 8,520 / 8,000(zh:问数技能合计 8,520 / 8,000 字), in the destructive (red) tone with a tooltip when over.app-skill-text-over-cap-refused(relevance: the stack declaresskills), the changeset's registered disposition for the narrowing.content/docs/ai/agents.mdxgains "An app'saskskills share an 8,000-character cap".Which
toolsare measured, and why. Cloud measures a skill after narrowing itstoolsto the ask allow-set; build and save time see the DECLAREDtools. These doors measure the declared list, so theirTools:line is never shorter than the runtime's and their total is never lower: an app these doors accept, the runtime accepts too. The bound is stated in the spec module's header.Landing points beyond the claim's file surface, with reasons.
packages/cli/src/utils/(the check's module;commands/is oclif's command directory, and every sibling refusal of this kind lives inutils/);ui/packages/i18n/src/namespaces/studio/{en,zh}.ts(Studio strings live only there);packages/spec/src/migrations/**(a declared narrowing owes a registered ADR-0087 entry —check:adr-0087-registrationrefusesno-migration-prescriptiononMetadata-protocol: narrowed);scripts/engine-double-contract.pinned.json(the new save-door test's pinned engine double, written by the gate's own--write).Why
objectstack-ai/cloud#5361 items 2 and 3, verbatim: 「
os validate或构建直接报错,写明长度和上限」; 「在界面或接口保存技能时拒绝保存,同样写明长度和上限」; 「在 Studio → AI → Skills 页,显示每个应用问数技能的合计长度和上限(例如「8,520 / 8,000 字」),超了标红」. The runtime arm (load every skill, never drop one) landed in cloud and is not in this PR.Tests
packages/spec/src/ai/package-skill-text.test.ts— the cap; the exact composed string; empty lines left out;ask/both/unset count,builddoes not; the sum; the sentence.packages/cli/src/utils/app-skill-text-cap.test.ts— one-app refusal (8,520), exactly-at-cap andbuildcontrols, per-package judgement of an artifact.packages/cli/test/validate-app-skill-text-cap.test.ts(integration) — the real CLI:os validate --jsonexits 1 with one row (8520, cap8000,(8,520 / 8,000)in the message), the text face names the total and the cap,os build --jsonexits 1 and writes no artifact, CONTROL at exactly 8,000 validates.packages/metadata-protocol/src/protocol.skill-text-cap-save-door.test.ts— through the realsaveMetaItemover a store-and-registry double: publish and draft mode refusedINVALID_METADATA/422naming 8,520 / 8,000 with nothing stored; CONTROLs at exactly the cap; an edit counts the new body; abuildskill and another app's skills do not count; abuild→bothswitch that tips the app over is refused; an app already over the cap can be lowered and cannot be raised.ui/.../SkillTextCapTotals.test.tsx— per-app sums with the spec measure,8,520 / 8,000marked over and red,4,000 / 8,000not, the zh string, nothing drawn without an app.throwdisabled, 5 of the 9 save-door cases go red (both refusal modes, the edit, the surface switch, the over-cap raise) and the 4 controls stay green; restored from the commit.Acceptance notes
duplicatePackage,importUnmanagedPackage, the move into a package andmigrateStoredMetadataall callsaveMetaItem. Not judged here: draft promotion (publishMetaItem/publishPackageDrafts) — a draft is judged at its save against the package's set with drafts shown, but the promotion does not re-judge, so an active save of a sibling between the two can leave the published set over;rollbackMetaItem/revertCommitrestore an older body without this door; a package install of an artifact (installPackage) is judged atos build, not at install. Each leaves the runtime's own arm (cloud loads every skill) as the backstop._packageId.code: stampingINVALID_METADATAfrom@objectstack/cliwould need a new provenance row in the error-code ledger, a contract edit not asked for here.composeSkillSectionfrom the description read at cloud44a7c80(this session could not attach the cloud repository); the pinned literal is the check for drift once cloud reads the spec export.Verification
Two-minute check:
pnpm --filter @objectstack/metadata-protocol exec vitest run --maxWorkers=2 src/protocol.skill-text-cap-save-door.test.ts— expectTests 9 passed (9).Read first (by risk):
packages/metadata-protocol/src/protocol-save.ts(thepermission/capabilitylanding block now also servesskill),packages/metadata-protocol/src/protocol-skill-text-cap.ts,packages/spec/src/ai/package-skill-text.ts.Local runs (union at c219001/fd66e398; scoped re-checks on the merge head 5873293)
pnpm --filter @objectstack/metadata-protocol exec vitest run --maxWorkers=2— 384 files passed, 9 skipped; 23,959 tests passed.pnpm --filter @objectstack/spec --filter @objectstack/cli --filter @objectstack/metadata-protocol typecheck— exit 0.@objectstack/specsrc/ai+src/migrations— 32 files, 853 tests passed (merge head). The full spec suite and the cliunitproject exceed the container's foreground cap: NOT MEASURED, CI.SkillTextCapTotals+ studio-namespace parity — 22 passed (merge head).pnpm --filter @objectstack/spec check:generated— all 14 artifacts up to date (merge head).dispatch-gates --ran— 135 derived families: 128 run, every one exit 0; 7 NOT MEASURED:pnpm --dir ui exec vitest run scripts/andcheck:query-options-erasure(over the foreground budget),check-plugin-teardown-shape --self-test(shallow clone),check:dual-build-cjs-loads,check:i18n,check:i18n-coverage,check:i18n-walk-parity(PREREQUISITE NOT MET: builds outside this diff). Re-run on the merge head:check:adr-0087-registration,check:engine-double-contract,check:test-source-alias.@object-ui/*dependencies are unbuilt here); the new component has no diagnostics of its own in that run.Type Check UIin CI.Human Minimum
packages/specholds no runtime logic. (The new module is a constant and a pure measure, asface-name.tsbeside it.)pnpm lintpasses. (No formatter ran;pnpm lintis the CI run's, not run locally.)main, one pull request.packages/spectouched: its generated artifacts are regenerated and committed.content/docs/references/,packages/*/CHANGELOG.mdorcontent/docs/releases/.Generated by Claude Code