stylegallery 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +156 -0
- package/CATALOG.md +69 -0
- package/DOMAINS.md +65 -0
- package/GOVERNANCE.md +222 -0
- package/GUIDE.md +59 -0
- package/README.md +313 -0
- package/consumer-reference/adapters/style-dictionary.config.mjs +36 -0
- package/consumer-reference/agent-native/README.md +157 -0
- package/consumer-reference/agent-native/registry.json +640 -0
- package/consumer-reference/agent-native/schema/agent-native.schema.json +848 -0
- package/consumer-reference/agent-native/schema/epistemic.schema.json +14 -0
- package/consumer-reference/agent-native/schema/execution.schema.json +12 -0
- package/consumer-reference/agent-native/schema/identity.schema.json +10 -0
- package/consumer-reference/agent-native/schema/learning.schema.json +12 -0
- package/consumer-reference/agent-native/schema/manifest.schema.json +6 -0
- package/consumer-reference/agent-native/schema/operation.schema.json +12 -0
- package/consumer-reference/agent-native/schema/protocol-binding.schema.json +9 -0
- package/consumer-reference/agent-native/schema/retrieval.schema.json +10 -0
- package/consumer-reference/baselines/calibration.json +260 -0
- package/consumer-reference/baselines/manifest.json +21 -0
- package/consumer-reference/contract.md +83 -0
- package/consumer-reference/fixtures/consumer-conformance/e2e-fixture.mjs +282 -0
- package/consumer-reference/fixtures/consumer-conformance/manifest.json +102 -0
- package/consumer-reference/fixtures/consumer-conformance/runtime-proof.mjs +32 -0
- package/consumer-reference/fixtures/consumer-conformance/valid-migration-result.json +18 -0
- package/consumer-reference/fixtures/consumer-conformance/valid-migration.json +142 -0
- package/consumer-reference/fixtures/invalid-stable-ended-support.json +19 -0
- package/consumer-reference/fixtures/promotion/invalid-blocking-evidence.json +26 -0
- package/consumer-reference/fixtures/promotion/invalid-count-only.json +29 -0
- package/consumer-reference/fixtures/promotion/invalid-missing-owner-migration.json +25 -0
- package/consumer-reference/fixtures/promotion/invalid-normative-bypass-no-regression.json +25 -0
- package/consumer-reference/fixtures/promotion/invalid-related-counted-independent.json +45 -0
- package/consumer-reference/fixtures/promotion/invalid-stable-ended-support.json +26 -0
- package/consumer-reference/fixtures/promotion/manifest.json +15 -0
- package/consumer-reference/fixtures/promotion/valid-deferred-example.json +67 -0
- package/consumer-reference/fixtures/promotion/valid-normative-bypass.json +67 -0
- package/consumer-reference/fixtures/token-portability/invalid-cycle.json +7 -0
- package/consumer-reference/fixtures/token-portability/invalid-dangling-alias.json +6 -0
- package/consumer-reference/fixtures/token-portability/invalid-extends.json +4 -0
- package/consumer-reference/fixtures/token-portability/invalid-json-pointer.json +7 -0
- package/consumer-reference/fixtures/token-portability/invalid-resolver.json +9 -0
- package/consumer-reference/fixtures/token-portability/invalid-type-mismatch.json +10 -0
- package/consumer-reference/fixtures/token-portability/invalid-unknown-reserved.json +6 -0
- package/consumer-reference/fixtures/token-portability/invalid-untested-type.json +6 -0
- package/consumer-reference/fixtures/token-portability/valid-border.json +14 -0
- package/consumer-reference/fixtures/token-portability/valid-reference.json +32 -0
- package/consumer-reference/fixtures/token-portability/valid-whole-alias.json +7 -0
- package/consumer-reference/fixtures/valid-deprecated.json +21 -0
- package/consumer-reference/fixtures/valid-experimental.json +19 -0
- package/consumer-reference/generated/manifest.json +40 -0
- package/consumer-reference/generated/tokens.css +12 -0
- package/consumer-reference/index.md +32 -0
- package/consumer-reference/policies/shared-experimental.json +37 -0
- package/consumer-reference/schema/ax-evidence.schema.json +30 -0
- package/consumer-reference/schema/baseline-manifest.schema.json +55 -0
- package/consumer-reference/schema/calibration-record.schema.json +190 -0
- package/consumer-reference/schema/capture-session.schema.json +161 -0
- package/consumer-reference/schema/component-state.schema.json +150 -0
- package/consumer-reference/schema/consumer-conformance-record.schema.json +365 -0
- package/consumer-reference/schema/dom-evidence.schema.json +38 -0
- package/consumer-reference/schema/evidence-record.schema.json +81 -0
- package/consumer-reference/schema/fixture-manifest.schema.json +32 -0
- package/consumer-reference/schema/item.schema.json +188 -0
- package/consumer-reference/schema/page-evidence-manifest.schema.json +216 -0
- package/consumer-reference/schema/page-evidence-session.schema.json +119 -0
- package/consumer-reference/schema/portable-tokens.schema.json +104 -0
- package/consumer-reference/schema/promotion-rfc.schema.json +219 -0
- package/consumer-reference/schema/runtime-evidence-manifest.schema.json +33 -0
- package/consumer-reference/schema/visual-evidence.schema.json +31 -0
- package/design-engineering/consumer-migration-readiness.md +124 -0
- package/design-engineering/index.md +28 -0
- package/design-engineering/interface-craft.md +107 -0
- package/design-engineering/reference-profiles/external-adaptation/index.md +12 -0
- package/design-engineering/reference-profiles/governed-local/editorial/components/button.component.json +125 -0
- package/design-engineering/reference-profiles/governed-local/editorial/evidence/button.evidence.json +3504 -0
- package/design-engineering/reference-profiles/governed-local/editorial/fixtures/button.fixture.json +65 -0
- package/design-engineering/reference-profiles/governed-local/editorial/generated/evidence-coverage.md +23 -0
- package/design-engineering/reference-profiles/governed-local/editorial/generated/keyboard-matrix.md +19 -0
- package/design-engineering/reference-profiles/governed-local/editorial/generated/state-matrix.md +21 -0
- package/design-engineering/reference-profiles/governed-local/editorial/local-foundations.json +12 -0
- package/design-engineering/reference-profiles/governed-local/editorial/profile.json +43 -0
- package/design-engineering/reference-profiles/governed-local/editorial/states/button.states.json +195 -0
- package/design-engineering/reference-profiles/governed-local/editorial/tokens.dtcg.json +17 -0
- package/design-engineering/reference-profiles/governed-local/index.md +26 -0
- package/design-engineering/reference-profiles/governed-local/terminal/components/button.component.json +125 -0
- package/design-engineering/reference-profiles/governed-local/terminal/evidence/button.evidence.json +3504 -0
- package/design-engineering/reference-profiles/governed-local/terminal/fixtures/button.fixture.json +65 -0
- package/design-engineering/reference-profiles/governed-local/terminal/generated/evidence-coverage.md +23 -0
- package/design-engineering/reference-profiles/governed-local/terminal/generated/keyboard-matrix.md +19 -0
- package/design-engineering/reference-profiles/governed-local/terminal/generated/state-matrix.md +21 -0
- package/design-engineering/reference-profiles/governed-local/terminal/local-foundations.json +12 -0
- package/design-engineering/reference-profiles/governed-local/terminal/profile.json +43 -0
- package/design-engineering/reference-profiles/governed-local/terminal/states/button.states.json +195 -0
- package/design-engineering/reference-profiles/governed-local/terminal/tokens.dtcg.json +17 -0
- package/design-engineering/reference-profiles/index.md +19 -0
- package/game-ui/classification.md +82 -0
- package/game-ui/index.md +35 -0
- package/game-ui/reference-record.md +62 -0
- package/game-ui/screen-hierarchy.md +107 -0
- package/game-ui/unity/architecture.md +166 -0
- package/game-ui/unity/cli-loop.md +84 -0
- package/game-ui/unity/data/unity-technologies-public-repositories.json +26654 -0
- package/game-ui/unity/org-wiki.md +146 -0
- package/game-ui/unity/repository-map.md +102 -0
- package/game-ui/unity/ui-systems.md +85 -0
- package/guides/decision-tree.md +149 -0
- package/guides/documentation-mode-taxonomy.md +157 -0
- package/guides/layout-brief.md +220 -0
- package/guides/vocabulary.md +148 -0
- package/guides/webpage-generation-workflow.md +185 -0
- package/index.md +36 -0
- package/layout/index.md +26 -0
- package/motion/index.md +24 -0
- package/motion/practice-reference.md +145 -0
- package/motion/review-workflow.md +86 -0
- package/motion/vocabulary.md +82 -0
- package/package.json +78 -0
- package/patterns/centering/center.md +87 -0
- package/patterns/centering/index.md +6 -0
- package/patterns/centering/super-center.md +89 -0
- package/patterns/containment/box.md +87 -0
- package/patterns/containment/clamped-card.md +86 -0
- package/patterns/containment/content-limiter.md +87 -0
- package/patterns/containment/fluid-styles.md +86 -0
- package/patterns/containment/index.md +8 -0
- package/patterns/grid-repetition/card-grid.md +88 -0
- package/patterns/grid-repetition/columns.md +87 -0
- package/patterns/grid-repetition/dense-grid.md +88 -0
- package/patterns/grid-repetition/grid-wrapper.md +89 -0
- package/patterns/grid-repetition/index.md +12 -0
- package/patterns/grid-repetition/masonry-approx.md +87 -0
- package/patterns/grid-repetition/page-grid.md +90 -0
- package/patterns/grid-repetition/ram-grid.md +88 -0
- package/patterns/grid-repetition/twelve-span-grid.md +92 -0
- package/patterns/in-line-grouping/badge-list.md +94 -0
- package/patterns/in-line-grouping/breadcrumb.md +89 -0
- package/patterns/in-line-grouping/cluster.md +89 -0
- package/patterns/in-line-grouping/deconstructed-pancake.md +92 -0
- package/patterns/in-line-grouping/index.md +13 -0
- package/patterns/in-line-grouping/pagination.md +89 -0
- package/patterns/in-line-grouping/reel.md +90 -0
- package/patterns/in-line-grouping/split-nav.md +97 -0
- package/patterns/in-line-grouping/tab-strip.md +88 -0
- package/patterns/in-line-grouping/wrap-row.md +89 -0
- package/patterns/index.md +13 -0
- package/patterns/media-fit/frame.md +95 -0
- package/patterns/media-fit/icon-frame.md +87 -0
- package/patterns/media-fit/index.md +6 -0
- package/patterns/overlay-exception/imposter.md +95 -0
- package/patterns/overlay-exception/index.md +6 -0
- package/patterns/overlay-exception/overlay-stack.md +89 -0
- package/patterns/split-sidebar/index.md +12 -0
- package/patterns/split-sidebar/list-detail.md +95 -0
- package/patterns/split-sidebar/main-with-rail.md +95 -0
- package/patterns/split-sidebar/media-object.md +102 -0
- package/patterns/split-sidebar/sidebar.md +101 -0
- package/patterns/split-sidebar/split-screen.md +92 -0
- package/patterns/split-sidebar/sticky-aside.md +97 -0
- package/patterns/split-sidebar/supporting-pane.md +95 -0
- package/patterns/split-sidebar/switcher.md +93 -0
- package/patterns/stacking/feed.md +88 -0
- package/patterns/stacking/index.md +8 -0
- package/patterns/stacking/line-up.md +95 -0
- package/patterns/stacking/stack.md +87 -0
- package/patterns/stacking/step-nav.md +88 -0
- package/patterns/viewport-shell/cover.md +90 -0
- package/patterns/viewport-shell/fixed-sidenav-shell.md +97 -0
- package/patterns/viewport-shell/holy-grail.md +112 -0
- package/patterns/viewport-shell/index.md +11 -0
- package/patterns/viewport-shell/panel-layout.md +95 -0
- package/patterns/viewport-shell/scroll-body-shell.md +93 -0
- package/patterns/viewport-shell/sticky-footer.md +92 -0
- package/patterns/viewport-shell/sticky-header.md +86 -0
- package/platform-guides/apple-interaction.md +89 -0
- package/platform-guides/index.md +26 -0
- package/quality/claim-records/index.md +3 -0
- package/quality/claim-records/samples.md +92 -0
- package/quality/claim-records/stylegallery-multidomain-scope.md +42 -0
- package/quality/claims.md +77 -0
- package/quality/evidence/accessibility.md +58 -0
- package/quality/evidence/consumer-migration.md +42 -0
- package/quality/evidence/design-rationale.md +34 -0
- package/quality/evidence/executable-evidence.md +79 -0
- package/quality/evidence/families.md +56 -0
- package/quality/evidence/hci-evaluation.md +36 -0
- package/quality/evidence/index.md +16 -0
- package/quality/evidence/pattern-contract-audit.md +96 -0
- package/quality/evidence/search-metadata-polyhierarchy.md +86 -0
- package/quality/evidence/sources.md +43 -0
- package/quality/evidence/tokens.md +33 -0
- package/quality/evidence/visual-qa.md +41 -0
- package/quality/gates/accessibility-evidence.md +60 -0
- package/quality/gates/consumer-migration-evidence.md +53 -0
- package/quality/gates/design-claim.md +56 -0
- package/quality/gates/harmony-evaluation.md +78 -0
- package/quality/gates/index.md +13 -0
- package/quality/gates/layout.md +52 -0
- package/quality/gates/rationale.md +53 -0
- package/quality/gates/visual-evidence.md +47 -0
- package/quality/index.md +55 -0
- package/quality/principles.md +58 -0
- package/recipes/article-page.md +52 -0
- package/recipes/command-surface.md +55 -0
- package/recipes/dashboard.md +56 -0
- package/recipes/form-flow.md +55 -0
- package/recipes/homepage.md +89 -0
- package/recipes/index.md +13 -0
- package/recipes/list-detail.md +55 -0
- package/recipes/primitive-to-recipe-matrix.md +83 -0
- package/recipes/saas-settings.md +52 -0
- package/scripts/agent-native/a2a-projection.mjs +248 -0
- package/scripts/agent-native/agui-projection.mjs +178 -0
- package/scripts/agent-native/canonical-json.mjs +109 -0
- package/scripts/agent-native/cli-adapter.mjs +68 -0
- package/scripts/agent-native/events.mjs +113 -0
- package/scripts/agent-native/execution.mjs +227 -0
- package/scripts/agent-native/fixture.mjs +159 -0
- package/scripts/agent-native/identity.mjs +184 -0
- package/scripts/agent-native/immutable-store.mjs +102 -0
- package/scripts/agent-native/knowledge.mjs +168 -0
- package/scripts/agent-native/learning-records.mjs +244 -0
- package/scripts/agent-native/learning.mjs +247 -0
- package/scripts/agent-native/mcp-adapter.mjs +173 -0
- package/scripts/agent-native/queries.mjs +173 -0
- package/scripts/agent-native/registry.mjs +154 -0
- package/scripts/agent-native/retrieval.mjs +171 -0
- package/scripts/agent-native/self-description.mjs +160 -0
- package/scripts/artifact-metadata.mjs +20 -0
- package/scripts/audit-evidence-freshness.mjs +308 -0
- package/scripts/baseline-contract.mjs +189 -0
- package/scripts/baseline-schema-parity.mjs +40 -0
- package/scripts/build-reference-artifacts.mjs +127 -0
- package/scripts/calibration-raw-contract.mjs +172 -0
- package/scripts/capture-session-contract.mjs +187 -0
- package/scripts/component-state-artifact-fixture.mjs +44 -0
- package/scripts/component-state-contract.mjs +99 -0
- package/scripts/component-state-semantics.mjs +128 -0
- package/scripts/component-state-workflow-contract.mjs +67 -0
- package/scripts/component-state-workflow-negative-cases.mjs +64 -0
- package/scripts/consumer-conformance-contract.mjs +198 -0
- package/scripts/consumer-evidence-governance-contract.mjs +210 -0
- package/scripts/consumer-reference-case-runner.mjs +93 -0
- package/scripts/consumer-reference-schema.mjs +155 -0
- package/scripts/create-component-state-session.mjs +100 -0
- package/scripts/create-page-evidence-session.mjs +139 -0
- package/scripts/domain-document-boundaries.mjs +40 -0
- package/scripts/domain-validation-checks.mjs +141 -0
- package/scripts/evidence-artifact-contract.mjs +191 -0
- package/scripts/finalize-component-state-evidence.mjs +165 -0
- package/scripts/finalize-page-evidence.mjs +197 -0
- package/scripts/generate-consumer-reference-evidence.mjs +154 -0
- package/scripts/generate-patterns.mjs +218 -0
- package/scripts/governance-matrix-contract.mjs +73 -0
- package/scripts/governance-matrix-negative-cases.mjs +114 -0
- package/scripts/governance-policy-contract.mjs +49 -0
- package/scripts/governance-test-fixture.mjs +321 -0
- package/scripts/governance-workflow-negative-cases.mjs +241 -0
- package/scripts/governed-profile-registry.mjs +125 -0
- package/scripts/json-schema-formats.mjs +31 -0
- package/scripts/markdown-structure.mjs +45 -0
- package/scripts/page-artifact-metadata.mjs +124 -0
- package/scripts/page-evidence-contract.mjs +297 -0
- package/scripts/page-evidence-fixture.mjs +271 -0
- package/scripts/pattern-data.mjs +325 -0
- package/scripts/profile-record-contract.mjs +140 -0
- package/scripts/promotion-attestation-contract.mjs +91 -0
- package/scripts/promotion-boundary-test-contract.mjs +92 -0
- package/scripts/promotion-fixture-inventory.mjs +109 -0
- package/scripts/promotion-governance-contract.mjs +28 -0
- package/scripts/reference-artifact-path-contract.mjs +28 -0
- package/scripts/reference-profile-contract.mjs +114 -0
- package/scripts/reference-token-contract.mjs +156 -0
- package/scripts/run-consumer-page-evidence-ci.mjs +170 -0
- package/scripts/sg-mcp.mjs +16 -0
- package/scripts/sg.mjs +27 -0
- package/scripts/strict-json.mjs +72 -0
- package/scripts/summarize-sentinel-calibration.mjs +98 -0
- package/scripts/test-agent-adapter-conformance.mjs +250 -0
- package/scripts/test-agent-conformance-receipt.mjs +106 -0
- package/scripts/test-agent-events.mjs +81 -0
- package/scripts/test-agent-execution-effects.mjs +114 -0
- package/scripts/test-agent-execution-fixtures.mjs +140 -0
- package/scripts/test-agent-execution-kernel.mjs +39 -0
- package/scripts/test-agent-execution-learning.mjs +130 -0
- package/scripts/test-agent-execution-lifecycle.mjs +143 -0
- package/scripts/test-agent-execution-safety.mjs +158 -0
- package/scripts/test-agent-execution-views.mjs +117 -0
- package/scripts/test-agent-identity-integrity-cases.mjs +160 -0
- package/scripts/test-agent-knowledge-kernel.mjs +183 -0
- package/scripts/test-agent-learning.mjs +246 -0
- package/scripts/test-agent-mcp.mjs +246 -0
- package/scripts/test-agent-native-schemas.mjs +215 -0
- package/scripts/test-agent-projections.mjs +249 -0
- package/scripts/test-agent-registry-mcp-integrity.mjs +215 -0
- package/scripts/test-agent-registry-mutations.mjs +110 -0
- package/scripts/test-audit-evidence-freshness.mjs +177 -0
- package/scripts/test-component-state-sentinel.mjs +35 -0
- package/scripts/test-component-state-source-contract.mjs +83 -0
- package/scripts/test-consumer-conformance-sentinel.mjs +165 -0
- package/scripts/test-consumer-reference-sentinel.mjs +31 -0
- package/scripts/test-generate-consumer-reference-evidence.mjs +124 -0
- package/scripts/test-json-cli-output.mjs +151 -0
- package/scripts/test-json-schema-formats.mjs +40 -0
- package/scripts/test-reference-adapters.mjs +199 -0
- package/scripts/test-renderer-purity.mjs +34 -0
- package/scripts/test-sg-cli.mjs +129 -0
- package/scripts/test-summarize-sentinel-calibration.mjs +226 -0
- package/scripts/test-validate-baseline-manifest.mjs +234 -0
- package/scripts/test-validate-component-state-artifacts.mjs +243 -0
- package/scripts/test-validate-component-state.mjs +106 -0
- package/scripts/test-validate-consumer-conformance.mjs +427 -0
- package/scripts/test-validate-consumer-reference-cli.mjs +69 -0
- package/scripts/test-validate-consumer-reference.mjs +263 -0
- package/scripts/test-validate-domains.mjs +357 -0
- package/scripts/test-validate-governance.mjs +292 -0
- package/scripts/test-validate-ia.mjs +262 -0
- package/scripts/test-validate-okf.mjs +73 -0
- package/scripts/test-validate-page-evidence.mjs +302 -0
- package/scripts/test-validate-patterns.mjs +157 -0
- package/scripts/test-validate-promotion-rfc.mjs +250 -0
- package/scripts/test-validate-reference-profiles.mjs +170 -0
- package/scripts/test-validate-unity-org-wiki.mjs +57 -0
- package/scripts/test-validate-unity-source-contracts.mjs +67 -0
- package/scripts/test-validate-vocabulary.mjs +174 -0
- package/scripts/test-validate-webpage-workflow.mjs +293 -0
- package/scripts/validate-baseline-manifest.mjs +44 -0
- package/scripts/validate-catalog.mjs +65 -0
- package/scripts/validate-component-state.mjs +141 -0
- package/scripts/validate-consumer-conformance.mjs +477 -0
- package/scripts/validate-consumer-reference.mjs +288 -0
- package/scripts/validate-domains.mjs +237 -0
- package/scripts/validate-governance.mjs +248 -0
- package/scripts/validate-ia.mjs +136 -0
- package/scripts/validate-links.mjs +66 -0
- package/scripts/validate-okf.mjs +104 -0
- package/scripts/validate-page-evidence.mjs +191 -0
- package/scripts/validate-patterns.mjs +246 -0
- package/scripts/validate-promotion-rfc.mjs +224 -0
- package/scripts/validate-reference-artifacts.mjs +125 -0
- package/scripts/validate-renderer-purity.mjs +56 -0
- package/scripts/validate-unity-org-wiki.mjs +146 -0
- package/scripts/validate-unity-source-contracts.mjs +107 -0
- package/scripts/validate-vocabulary.mjs +115 -0
- package/scripts/validate-webpage-workflow.mjs +254 -0
- package/scripts/visual-expectation-contract.mjs +20 -0
- package/scripts/workflow-action-contract.mjs +163 -0
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
5
|
+
|
|
6
|
+
const repositoryRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
|
|
7
|
+
const moduleFiles = Object.freeze({
|
|
8
|
+
a2a: path.join(repositoryRoot, "scripts", "agent-native", "a2a-projection.mjs"),
|
|
9
|
+
agui: path.join(repositoryRoot, "scripts", "agent-native", "agui-projection.mjs"),
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
const domainTask = Object.freeze({
|
|
13
|
+
stableRef: "sg:task/projection-fixture",
|
|
14
|
+
taskId: "sg:task/projection-fixture",
|
|
15
|
+
state: "RUNNING",
|
|
16
|
+
runId: "sg:run/projection-fixture",
|
|
17
|
+
intent: { operation: "resolve", stableRef: "sg:profile/editorial-reference-profile" },
|
|
18
|
+
requiredResult: { type: "profile" },
|
|
19
|
+
});
|
|
20
|
+
const domainRun = Object.freeze({ runId: "sg:run/projection-fixture", taskId: domainTask.taskId, state: "RUNNING" });
|
|
21
|
+
const protocolBinding = Object.freeze({
|
|
22
|
+
bindingId: "sg:binding/a2a-projection-fixture",
|
|
23
|
+
protocolBindingId: "sg:binding/a2a-projection-fixture",
|
|
24
|
+
protocol: "a2a",
|
|
25
|
+
taskId: domainTask.taskId,
|
|
26
|
+
runId: domainRun.runId,
|
|
27
|
+
});
|
|
28
|
+
const message = Object.freeze({
|
|
29
|
+
messageId: "a2a-message-projection-fixture",
|
|
30
|
+
role: "user",
|
|
31
|
+
parts: [{ kind: "text", text: "Resolve the editorial profile." }],
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
function pick(value, ...keys) {
|
|
35
|
+
if (!value || typeof value !== "object") return undefined;
|
|
36
|
+
for (const key of keys) if (Object.hasOwn(value, key)) return value[key];
|
|
37
|
+
return undefined;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function unwrap(value) {
|
|
41
|
+
return value?.ok === true && Object.hasOwn(value, "result") ? value.result : value;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function object(value) {
|
|
45
|
+
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function stateOf(value) {
|
|
49
|
+
const status = pick(value, "status");
|
|
50
|
+
return String(pick(status, "state", "status") ?? pick(value, "state", "taskState", "task_state") ?? "").toLowerCase();
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function idOf(value, ...keys) {
|
|
54
|
+
return pick(value, ...keys, "id", "taskId", "task_id", "runId", "run_id", "stableRef", "stable_ref");
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
async function load(name) {
|
|
58
|
+
try {
|
|
59
|
+
return { ok: true, module: await import(pathToFileURL(moduleFiles[name]).href) };
|
|
60
|
+
} catch (error) {
|
|
61
|
+
return {
|
|
62
|
+
ok: false,
|
|
63
|
+
error: {
|
|
64
|
+
code: "kernel_module_missing",
|
|
65
|
+
module: name,
|
|
66
|
+
path: moduleFiles[name],
|
|
67
|
+
message: error instanceof Error ? error.message : String(error),
|
|
68
|
+
},
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function findExport(loaded, names, moduleName) {
|
|
74
|
+
if (!loaded.ok) throw Object.assign(new Error(loaded.error.message), loaded.error);
|
|
75
|
+
for (const name of names) if (typeof loaded.module[name] === "function") return loaded.module[name];
|
|
76
|
+
const error = new Error(`${moduleName} must export one of ${names.join(", ")}`);
|
|
77
|
+
error.code = "kernel_export_missing";
|
|
78
|
+
error.module = moduleName;
|
|
79
|
+
throw error;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
async function call(loaded, names, moduleName, input) {
|
|
83
|
+
const fn = findExport(loaded, names, moduleName);
|
|
84
|
+
return await fn(input);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
function row(name, expected, actual, ok, details) {
|
|
88
|
+
return { actual, expected, name, ok, ...(details ? { details } : {}) };
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
function failure(error) {
|
|
92
|
+
return { code: error?.code ?? "projection_case_exception", message: error?.message ?? String(error), ...(error?.path ? { path: error.path } : {}) };
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
function taskProjection(value) {
|
|
96
|
+
const result = unwrap(value);
|
|
97
|
+
return pick(result, "task", "taskProjection", "task_projection") ?? result;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
function bindingOf(value) {
|
|
101
|
+
const result = unwrap(value);
|
|
102
|
+
return pick(result, "protocolBinding", "protocol_binding", "binding") ?? {};
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
function protocolTaskId(value) {
|
|
106
|
+
const task = taskProjection(value);
|
|
107
|
+
return idOf(task, "id", "taskId", "task_id");
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
async function testA2A(loaded) {
|
|
111
|
+
const rows = [];
|
|
112
|
+
try {
|
|
113
|
+
const card = unwrap(await call(loaded, ["createAgentCard", "buildAgentCard", "projectAgentCard", "agentCard"], "a2a", { fixture: true }));
|
|
114
|
+
const capabilities = pick(card, "capabilities");
|
|
115
|
+
rows.push(row(
|
|
116
|
+
"a2a_agent_card_is_v1_shaped",
|
|
117
|
+
"Agent Card has protocolVersion, identity, URL, capabilities, input/output modes, and skills",
|
|
118
|
+
card,
|
|
119
|
+
object(card)
|
|
120
|
+
&& typeof pick(card, "protocolVersion", "protocol_version") === "string"
|
|
121
|
+
&& typeof pick(card, "name") === "string"
|
|
122
|
+
&& typeof pick(card, "url") === "string"
|
|
123
|
+
&& object(capabilities)
|
|
124
|
+
&& Array.isArray(pick(card, "defaultInputModes", "default_input_modes"))
|
|
125
|
+
&& Array.isArray(pick(card, "defaultOutputModes", "default_output_modes"))
|
|
126
|
+
&& Array.isArray(pick(card, "skills")),
|
|
127
|
+
));
|
|
128
|
+
|
|
129
|
+
const map = findExport(loaded, ["mapTaskState", "projectTaskState", "toA2ATaskState"], "a2a");
|
|
130
|
+
const mappings = {
|
|
131
|
+
PENDING: "submitted", RUNNING: "working", COMPLETED: "completed", FAILED: "failed",
|
|
132
|
+
CANCELED: "canceled", REJECTED: "rejected", AUTH_REQUIRED: "auth-required", UNKNOWN: "unknown",
|
|
133
|
+
};
|
|
134
|
+
const actualMappings = Object.fromEntries(Object.entries(mappings).map(([input]) => [input, map(input)]));
|
|
135
|
+
rows.push(row("a2a_task_state_mapping_is_total", "all domain terminal/intermediate states map to official A2A states", actualMappings, Object.entries(mappings).every(([input, expected]) => String(actualMappings[input]).toLowerCase() === expected)));
|
|
136
|
+
|
|
137
|
+
const send = unwrap(await call(loaded, ["sendMessage", "projectSendMessage", "handleSendMessage"], "a2a", {
|
|
138
|
+
message,
|
|
139
|
+
task: domainTask,
|
|
140
|
+
run: domainRun,
|
|
141
|
+
protocolBinding,
|
|
142
|
+
}));
|
|
143
|
+
const sentTaskId = protocolTaskId(send);
|
|
144
|
+
const sentBinding = bindingOf(send);
|
|
145
|
+
const bindingId = idOf(sentBinding, "protocolBindingId", "protocol_binding_id", "bindingId", "binding_id");
|
|
146
|
+
const boundTaskId = idOf(sentBinding, "taskId", "task_id", "domainTaskId", "domain_task_id");
|
|
147
|
+
const boundRunId = idOf(sentBinding, "runId", "run_id", "domainRunId", "domain_run_id");
|
|
148
|
+
rows.push(row(
|
|
149
|
+
"a2a_send_message_creates_distinct_protocol_binding",
|
|
150
|
+
"SendMessage returns a submitted A2A task and ProtocolBinding that does not replace domain Task/Run IDs",
|
|
151
|
+
{ taskId: sentTaskId, state: stateOf(send), bindingId, boundTaskId, boundRunId },
|
|
152
|
+
object(send) && typeof sentTaskId === "string" && stateOf(send) === "submitted"
|
|
153
|
+
&& typeof bindingId === "string" && bindingId !== domainTask.taskId && bindingId !== domainRun.runId
|
|
154
|
+
&& boundTaskId === domainTask.taskId && boundRunId === domainRun.runId,
|
|
155
|
+
));
|
|
156
|
+
|
|
157
|
+
const get = unwrap(await call(loaded, ["getTask", "projectGetTask", "handleGetTask"], "a2a", {
|
|
158
|
+
task: send,
|
|
159
|
+
domainTask,
|
|
160
|
+
run: domainRun,
|
|
161
|
+
protocolBinding: sentBinding,
|
|
162
|
+
taskId: sentTaskId,
|
|
163
|
+
}));
|
|
164
|
+
rows.push(row("a2a_get_task_projects_current_domain_state", "GetTask preserves protocol task identity and maps RUNNING to working", { taskId: protocolTaskId(get), state: stateOf(get) }, protocolTaskId(get) === sentTaskId && stateOf(get) === "working"));
|
|
165
|
+
|
|
166
|
+
const canceled = unwrap(await call(loaded, ["cancelTask", "projectCancelTask", "handleCancelTask"], "a2a", {
|
|
167
|
+
task: get,
|
|
168
|
+
domainTask: { ...domainTask, state: "CANCELED" },
|
|
169
|
+
run: domainRun,
|
|
170
|
+
protocolBinding: sentBinding,
|
|
171
|
+
taskId: sentTaskId,
|
|
172
|
+
}));
|
|
173
|
+
rows.push(row("a2a_cancel_task_projects_canceled", "CancelTask returns the same protocol task in canceled state", { taskId: protocolTaskId(canceled), state: stateOf(canceled) }, protocolTaskId(canceled) === sentTaskId && stateOf(canceled) === "canceled"));
|
|
174
|
+
} catch (error) {
|
|
175
|
+
rows.push(row("a2a_projection_kernel_available", "A2A projection module exports the required pure functions", failure(error), false));
|
|
176
|
+
}
|
|
177
|
+
return rows;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
function eventType(event) {
|
|
181
|
+
return String(pick(event, "type", "eventType", "event_type", "name") ?? "").toUpperCase();
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
function eventList(value) {
|
|
185
|
+
const result = unwrap(value);
|
|
186
|
+
return Array.isArray(result) ? result : pick(result, "events", "items") ?? [];
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
async function testAGUI(loaded) {
|
|
190
|
+
const rows = [];
|
|
191
|
+
try {
|
|
192
|
+
const project = findExport(loaded, ["projectAgUiEvents", "projectAGUIEvents", "projectAguiEvents", "createAgUiEvents"], "agui");
|
|
193
|
+
const projection = await project({
|
|
194
|
+
task: domainTask,
|
|
195
|
+
run: domainRun,
|
|
196
|
+
protocolBinding: { ...protocolBinding, protocol: "ag-ui", bindingId: "sg:binding/agui-projection-fixture" },
|
|
197
|
+
text: "Editorial profile resolved.",
|
|
198
|
+
toolCall: { id: "tool-call-projection-fixture", name: "resolve", args: { stableRef: "sg:profile/editorial-reference-profile" } },
|
|
199
|
+
state: { stableRef: "sg:profile/editorial-reference-profile", status: "resolved" },
|
|
200
|
+
outcome: "COMPLETED",
|
|
201
|
+
});
|
|
202
|
+
const events = eventList(projection);
|
|
203
|
+
const types = events.map(eventType);
|
|
204
|
+
const index = (names) => types.findIndex((type) => names.includes(type));
|
|
205
|
+
const terminal = types.filter((type) => ["RUN_FINISHED", "RUN_ERROR"].includes(type));
|
|
206
|
+
const ordered = index(["RUN_STARTED"]) >= 0
|
|
207
|
+
&& index(["TEXT_MESSAGE_START"]) > index(["RUN_STARTED"])
|
|
208
|
+
&& index(["TEXT_MESSAGE_CONTENT"]) > index(["TEXT_MESSAGE_START"])
|
|
209
|
+
&& index(["TEXT_MESSAGE_END"]) > index(["TEXT_MESSAGE_CONTENT"])
|
|
210
|
+
&& index(["TOOL_CALL_START"]) > index(["TEXT_MESSAGE_END"])
|
|
211
|
+
&& index(["TOOL_CALL_ARGS", "TOOL_CALL_ARGUMENTS"]) > index(["TOOL_CALL_START"])
|
|
212
|
+
&& index(["TOOL_CALL_END"]) > index(["TOOL_CALL_ARGS", "TOOL_CALL_ARGUMENTS"])
|
|
213
|
+
&& index(["STATE_SNAPSHOT", "STATE_DELTA"]) > index(["TOOL_CALL_END"])
|
|
214
|
+
&& terminal.length === 1
|
|
215
|
+
&& types.indexOf(terminal[0]) === types.length - 1;
|
|
216
|
+
rows.push(row("agui_projection_has_ordered_v057_lifecycle", "RUN, text, tool, state, then exactly one terminal event", { types }, ordered));
|
|
217
|
+
|
|
218
|
+
const validate = findExport(loaded, ["validateAgUiTransitions", "validateAGUITransitions", "assertAgUiTransitions", "validateEventSequence"], "agui");
|
|
219
|
+
let rejected = false;
|
|
220
|
+
let rejection;
|
|
221
|
+
try {
|
|
222
|
+
rejection = await validate({ events: [{ type: "RUN_FINISHED", runId: "protocol-run-fixture" }, { type: "RUN_STARTED", runId: "protocol-run-fixture" }] });
|
|
223
|
+
rejected = rejection?.ok === false || rejection?.valid === false;
|
|
224
|
+
} catch (error) {
|
|
225
|
+
rejected = true;
|
|
226
|
+
rejection = failure(error);
|
|
227
|
+
}
|
|
228
|
+
rows.push(row("agui_invalid_transition_is_rejected", "a terminal-before-start sequence is rejected before projection", rejection, rejected));
|
|
229
|
+
} catch (error) {
|
|
230
|
+
rows.push(row("agui_projection_kernel_available", "AG-UI projection module exports ordered event and transition validation functions", failure(error), false));
|
|
231
|
+
}
|
|
232
|
+
return rows;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
async function main() {
|
|
236
|
+
const unsupported = process.argv.slice(2).filter((argument) => argument !== "--json");
|
|
237
|
+
if (unsupported.length > 0) {
|
|
238
|
+
process.stdout.write(`${JSON.stringify({ ok: false, status: "RED", failures: [{ code: "argument_unknown", message: `unknown argument ${unsupported[0]}` }], results: [] }, null, 2)}\n`);
|
|
239
|
+
process.exitCode = 1;
|
|
240
|
+
return;
|
|
241
|
+
}
|
|
242
|
+
const modules = { a2a: await load("a2a"), agui: await load("agui") };
|
|
243
|
+
const results = [...await testA2A(modules.a2a), ...await testAGUI(modules.agui)];
|
|
244
|
+
const ok = results.every((result) => result.ok);
|
|
245
|
+
process.stdout.write(`${JSON.stringify({ ok, status: ok ? "GREEN" : "RED", modules: Object.fromEntries(Object.entries(modules).map(([name, loaded]) => [name, loaded.ok ? { ok: true } : { ok: false, error: loaded.error }])), results }, null, 2)}\n`);
|
|
246
|
+
process.exitCode = ok ? 0 : 1;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
await main();
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { Client } from "@modelcontextprotocol/sdk/client/index.js";
|
|
4
|
+
import { InMemoryTransport } from "@modelcontextprotocol/sdk/inMemory.js";
|
|
5
|
+
|
|
6
|
+
import { canonicalize } from "./agent-native/canonical-json.mjs";
|
|
7
|
+
import { createStyleGalleryMcpServer } from "./agent-native/mcp-adapter.mjs";
|
|
8
|
+
import { agentNativeRegistry } from "./agent-native/registry.mjs";
|
|
9
|
+
|
|
10
|
+
const MUTATIONS = [
|
|
11
|
+
"effect.record",
|
|
12
|
+
"effect.reconcile",
|
|
13
|
+
"proposal.create",
|
|
14
|
+
"proposal.decide",
|
|
15
|
+
"proposal.promote",
|
|
16
|
+
"proposal.verify",
|
|
17
|
+
"run.start",
|
|
18
|
+
"task.create",
|
|
19
|
+
];
|
|
20
|
+
const PROFILE_REF = "sg:profile/editorial-reference-profile";
|
|
21
|
+
|
|
22
|
+
function result(name, expected, actual, ok) {
|
|
23
|
+
return { actual, expected, name, ok };
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function equal(left, right) {
|
|
27
|
+
return canonicalize(left) === canonicalize(right);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function envelope(response) {
|
|
31
|
+
if (response?.structuredContent && typeof response.structuredContent === "object") return response.structuredContent;
|
|
32
|
+
const text = response?.content?.find((item) => item?.type === "text")?.text;
|
|
33
|
+
try { return JSON.parse(text); } catch { return null; }
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
async function connected(registry = agentNativeRegistry) {
|
|
37
|
+
const server = createStyleGalleryMcpServer({ registry });
|
|
38
|
+
const [clientTransport, serverTransport] = InMemoryTransport.createLinkedPair();
|
|
39
|
+
const client = new Client({ name: "stylegallery-registry-mcp-integrity", version: "1.0.0" });
|
|
40
|
+
await Promise.all([server.connect(serverTransport), client.connect(clientTransport)]);
|
|
41
|
+
return { client, server };
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
async function close(connection) {
|
|
45
|
+
await connection.client.close().catch(() => {});
|
|
46
|
+
const closed = connection.server.close?.();
|
|
47
|
+
if (closed && typeof closed.catch === "function") await closed.catch(() => {});
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
async function rejected(action) {
|
|
51
|
+
try {
|
|
52
|
+
const response = await action();
|
|
53
|
+
return { error: null, response };
|
|
54
|
+
} catch (error) {
|
|
55
|
+
return { error: error instanceof Error ? error.message : String(error), response: null };
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
async function main() {
|
|
60
|
+
const results = [];
|
|
61
|
+
const names = agentNativeRegistry.operations.map((operation) => operation.name).sort();
|
|
62
|
+
const missingMutations = MUTATIONS.filter((name) => !names.includes(name));
|
|
63
|
+
results.push(result(
|
|
64
|
+
"common_registry_contains_governed_mutations",
|
|
65
|
+
"proposal, task, run, effect recording, and effect reconciliation operations exist in the common registry",
|
|
66
|
+
{ missingMutations, names },
|
|
67
|
+
missingMutations.length === 0,
|
|
68
|
+
));
|
|
69
|
+
|
|
70
|
+
const invalidMetadata = agentNativeRegistry.operations
|
|
71
|
+
.filter((operation) => typeof operation.read_only !== "boolean"
|
|
72
|
+
|| (operation.read_only === true && operation.effect_class !== "NONE"))
|
|
73
|
+
.map((operation) => ({ effect_class: operation.effect_class, name: operation.name, read_only: operation.read_only }));
|
|
74
|
+
const registryReads = agentNativeRegistry.operations.filter((operation) => operation.read_only === true).map((operation) => operation.name).sort();
|
|
75
|
+
results.push(result(
|
|
76
|
+
"registry_read_only_metadata_is_closed",
|
|
77
|
+
"every operation declares read_only and no effectful operation is read-only",
|
|
78
|
+
{ invalidMetadata, registryReads },
|
|
79
|
+
invalidMetadata.length === 0 && registryReads.length > 0,
|
|
80
|
+
));
|
|
81
|
+
|
|
82
|
+
for (const name of MUTATIONS.filter((item) => names.includes(item))) {
|
|
83
|
+
const invoked = agentNativeRegistry.invoke(name, {});
|
|
84
|
+
const codes = (invoked.failures ?? []).map((failure) => failure.code);
|
|
85
|
+
results.push(result(
|
|
86
|
+
`registered_handler_${name}`,
|
|
87
|
+
"the registered mutation reaches its schema or handler instead of operation_unknown",
|
|
88
|
+
invoked,
|
|
89
|
+
invoked.operation === name && !codes.includes("operation_unknown"),
|
|
90
|
+
));
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
const connection = await connected();
|
|
94
|
+
try {
|
|
95
|
+
const tools = (await connection.client.listTools()).tools.map((tool) => tool.name).sort();
|
|
96
|
+
results.push(result(
|
|
97
|
+
"mcp_tools_derive_from_registry_read_only",
|
|
98
|
+
registryReads,
|
|
99
|
+
tools,
|
|
100
|
+
equal(tools, registryReads),
|
|
101
|
+
));
|
|
102
|
+
|
|
103
|
+
const mutationCalls = [];
|
|
104
|
+
for (const name of MUTATIONS) {
|
|
105
|
+
const observed = await rejected(() => connection.client.callTool({ name, arguments: {} }));
|
|
106
|
+
const body = envelope(observed.response);
|
|
107
|
+
mutationCalls.push({ error: observed.error, isError: observed.response?.isError, name, body });
|
|
108
|
+
}
|
|
109
|
+
results.push(result(
|
|
110
|
+
"existing_mutations_are_not_mcp_tools",
|
|
111
|
+
"every mutation that exists in the registry is absent from MCP and denied on direct call",
|
|
112
|
+
mutationCalls,
|
|
113
|
+
mutationCalls.every((call) => !tools.includes(call.name)
|
|
114
|
+
&& (call.error !== null || (call.isError === true && call.body?.failures?.[0]?.code === "operation_not_exposed"))),
|
|
115
|
+
));
|
|
116
|
+
|
|
117
|
+
const templates = (await connection.client.listResourceTemplates()).resourceTemplates ?? [];
|
|
118
|
+
const template = templates.find((item) => item.uriTemplate === "sg://object/{reference}");
|
|
119
|
+
results.push(result(
|
|
120
|
+
"object_resource_template_is_discoverable",
|
|
121
|
+
"sg://object/{reference} is advertised",
|
|
122
|
+
templates,
|
|
123
|
+
Boolean(template),
|
|
124
|
+
));
|
|
125
|
+
|
|
126
|
+
const objectUri = `sg://object/${encodeURIComponent(PROFILE_REF)}`;
|
|
127
|
+
const resources = (await connection.client.listResources()).resources ?? [];
|
|
128
|
+
const listed = resources.some((resource) => resource.uri === objectUri);
|
|
129
|
+
const resource = await rejected(() => connection.client.readResource({ uri: objectUri }));
|
|
130
|
+
const text = resource.response?.contents?.find((item) => item.uri === objectUri)?.text;
|
|
131
|
+
let parsed = null;
|
|
132
|
+
try { parsed = JSON.parse(text); } catch { /* asserted below */ }
|
|
133
|
+
const resolved = agentNativeRegistry.invoke("resolve", { reference: PROFILE_REF });
|
|
134
|
+
results.push(result(
|
|
135
|
+
"object_resource_uses_registry_resolver",
|
|
136
|
+
"the listed encoded object URI returns the exact registry resolve payload",
|
|
137
|
+
{ error: resource.error, listed, parsed, resolved },
|
|
138
|
+
listed && resource.error === null && resolved.ok === true && equal(parsed, resolved.result),
|
|
139
|
+
));
|
|
140
|
+
|
|
141
|
+
const unknown = await rejected(() => connection.client.readResource({
|
|
142
|
+
uri: `sg://object/${encodeURIComponent("sg:profile/does-not-exist")}`,
|
|
143
|
+
}));
|
|
144
|
+
const malformed = await rejected(() => connection.client.readResource({ uri: "sg://object/%E0%A4%A" }));
|
|
145
|
+
const versionId = resolved.ok ? resolved.result.version_id : "";
|
|
146
|
+
const versioned = await rejected(() => connection.client.readResource({
|
|
147
|
+
uri: `sg://object/${encodeURIComponent(versionId)}`,
|
|
148
|
+
}));
|
|
149
|
+
results.push(result(
|
|
150
|
+
"object_resource_accepts_only_encoded_stable_refs",
|
|
151
|
+
"unknown, malformed, and VersionID object references are rejected",
|
|
152
|
+
{ malformed, unknown, versioned },
|
|
153
|
+
unknown.error !== null && malformed.error !== null && versioned.error !== null,
|
|
154
|
+
));
|
|
155
|
+
} finally {
|
|
156
|
+
await close(connection);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
const dynamicName = "diagnostics.snapshot";
|
|
160
|
+
const dynamicOperation = Object.freeze({
|
|
161
|
+
adapters: [], description: "Dynamically registered read projection.", effect_class: "NONE",
|
|
162
|
+
idempotent: true, input_schema: { additionalProperties: false, type: "object" },
|
|
163
|
+
name: dynamicName, output_schema: { type: "object" }, read_only: true,
|
|
164
|
+
record_kind: "operation", stable_ref: "sg:operation/diagnostics-snapshot",
|
|
165
|
+
});
|
|
166
|
+
const dynamicRegistry = Object.freeze({
|
|
167
|
+
...agentNativeRegistry,
|
|
168
|
+
invoke: (name, input = {}) => name === dynamicName
|
|
169
|
+
? Object.freeze({ ok: true, operation: name, result: Object.freeze({ input, source: "dynamic-registry" }) })
|
|
170
|
+
: agentNativeRegistry.invoke(name, input),
|
|
171
|
+
operations: Object.freeze([...agentNativeRegistry.operations, dynamicOperation]),
|
|
172
|
+
});
|
|
173
|
+
const dynamic = await connected(dynamicRegistry);
|
|
174
|
+
try {
|
|
175
|
+
const namesFromMcp = (await dynamic.client.listTools()).tools.map((tool) => tool.name);
|
|
176
|
+
const called = await dynamic.client.callTool({ name: dynamicName, arguments: {} });
|
|
177
|
+
results.push(result(
|
|
178
|
+
"new_read_operation_needs_no_adapter_allowlist_change",
|
|
179
|
+
"a new read_only registry operation is automatically listed and callable",
|
|
180
|
+
{ called: envelope(called), namesFromMcp },
|
|
181
|
+
namesFromMcp.includes(dynamicName) && envelope(called)?.ok === true,
|
|
182
|
+
));
|
|
183
|
+
} finally {
|
|
184
|
+
await close(dynamic);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
const contradictoryRegistry = {
|
|
188
|
+
...agentNativeRegistry,
|
|
189
|
+
operations: [...agentNativeRegistry.operations, {
|
|
190
|
+
...dynamicOperation,
|
|
191
|
+
effect_class: "EXTERNAL",
|
|
192
|
+
name: "diagnostics.unsafe",
|
|
193
|
+
stable_ref: "sg:operation/diagnostics-unsafe",
|
|
194
|
+
}],
|
|
195
|
+
};
|
|
196
|
+
let contradiction;
|
|
197
|
+
try { createStyleGalleryMcpServer({ registry: contradictoryRegistry }); } catch (error) {
|
|
198
|
+
contradiction = error instanceof Error ? error.message : String(error);
|
|
199
|
+
}
|
|
200
|
+
results.push(result(
|
|
201
|
+
"contradictory_read_only_effect_metadata_is_rejected",
|
|
202
|
+
"read_only:true cannot disguise an EXTERNAL operation",
|
|
203
|
+
{ contradiction },
|
|
204
|
+
typeof contradiction === "string" && contradiction.includes("cannot expose EXTERNAL effects as read-only"),
|
|
205
|
+
));
|
|
206
|
+
|
|
207
|
+
const report = { ok: results.every((item) => item.ok), results };
|
|
208
|
+
process.stdout.write(`${JSON.stringify(report, null, 2)}\n`);
|
|
209
|
+
process.exitCode = report.ok ? 0 : 1;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
await main().catch((error) => {
|
|
213
|
+
process.stdout.write(`${JSON.stringify({ ok: false, results: [result("registry_mcp_integrity_runtime", "structured report", error instanceof Error ? error.message : String(error), false)] }, null, 2)}\n`);
|
|
214
|
+
process.exitCode = 1;
|
|
215
|
+
});
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { agentNativeRegistry as registry } from "./agent-native/registry.mjs";
|
|
4
|
+
|
|
5
|
+
function result(name, expected, actual, ok) {
|
|
6
|
+
return { actual, expected, name, ok };
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
function invoke(name, input) {
|
|
10
|
+
const response = registry.invoke(name, input);
|
|
11
|
+
return { name, response };
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const claim = registry.fixture.records.find((record) => record.stable_ref === "sg:claim/editorial-profile-addressable");
|
|
15
|
+
const proposal = invoke("proposal.create", {
|
|
16
|
+
changes: [{ op: "replace", path: "/rank", value: 1 }],
|
|
17
|
+
claim,
|
|
18
|
+
evidence: [{
|
|
19
|
+
independence_group: "registry-proposal-source",
|
|
20
|
+
polarity: "SUPPORT",
|
|
21
|
+
source_ref: "sg:artifact/editorial-profile-source",
|
|
22
|
+
stable_ref: "sg:evidence/registry-proposal-source",
|
|
23
|
+
}],
|
|
24
|
+
proposer: "agent:registry-proposer",
|
|
25
|
+
stable_ref: "sg:proposal/registry-invocation-fixture",
|
|
26
|
+
validation: { status: "PASS", validator: "validator:proposal", validator_version: "1" },
|
|
27
|
+
});
|
|
28
|
+
const verification = invoke("proposal.verify", {
|
|
29
|
+
evidence: [{
|
|
30
|
+
independence_group: "registry-independent-source",
|
|
31
|
+
polarity: "SUPPORT",
|
|
32
|
+
source_ref: "sg:artifact/editorial-profile-source",
|
|
33
|
+
stable_ref: "sg:evidence/registry-independent-source",
|
|
34
|
+
}],
|
|
35
|
+
proposal: proposal.response.result,
|
|
36
|
+
validation: { status: "PASS", validator: "validator:independent", validator_version: "1" },
|
|
37
|
+
verifier: "agent:registry-verifier",
|
|
38
|
+
});
|
|
39
|
+
const decision = invoke("proposal.decide", {
|
|
40
|
+
governance_decision: {
|
|
41
|
+
actor: "governor:stylegallery",
|
|
42
|
+
decided_at: "2026-07-23T00:00:00.000Z",
|
|
43
|
+
decision: "ACCEPT",
|
|
44
|
+
},
|
|
45
|
+
proposal: proposal.response.result,
|
|
46
|
+
verification: verification.response.result,
|
|
47
|
+
});
|
|
48
|
+
const promotion = invoke("proposal.promote", {
|
|
49
|
+
governance_decision: decision.response.result,
|
|
50
|
+
proposal: proposal.response.result,
|
|
51
|
+
target_stable_ref: "sg:profile/editorial-reference-profile",
|
|
52
|
+
verification: verification.response.result,
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
const task = invoke("task.create", {
|
|
56
|
+
intent: { operation: "resolve" },
|
|
57
|
+
required_result: { ok: true },
|
|
58
|
+
stable_ref: "sg:task/registry-invocation-fixture",
|
|
59
|
+
});
|
|
60
|
+
const run = invoke("run.start", {
|
|
61
|
+
input: { reference: "sg:profile/editorial-reference-profile" },
|
|
62
|
+
stable_ref: "sg:run/registry-invocation-fixture",
|
|
63
|
+
task: task.response.result,
|
|
64
|
+
});
|
|
65
|
+
const effect = invoke("effect.record", {
|
|
66
|
+
effect_class: "EXTERNAL",
|
|
67
|
+
run_id: run.response.result?.run_id,
|
|
68
|
+
stable_ref: "sg:effect/registry-invocation-fixture",
|
|
69
|
+
task_id: task.response.result?.task_id,
|
|
70
|
+
});
|
|
71
|
+
const reconciliation = invoke("effect.reconcile", {
|
|
72
|
+
effect: effect.response.result,
|
|
73
|
+
observations: [{ connector_receipt: "sg:receipt/connector-fixture", status: "COMMITTED" }],
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
const mutations = [proposal, verification, decision, promotion, task, run, effect, reconciliation];
|
|
77
|
+
const results = [
|
|
78
|
+
result(
|
|
79
|
+
"governed_learning_chain_is_invokable_from_common_registry",
|
|
80
|
+
"PROPOSED -> VERIFIED -> ACCEPT -> PROMOTED",
|
|
81
|
+
mutations.slice(0, 4).map(({ name, response }) => ({ name, ok: response.ok, status: response.result?.status })),
|
|
82
|
+
proposal.response.ok && verification.response.ok && decision.response.ok && promotion.response.ok
|
|
83
|
+
&& proposal.response.result.status === "PROPOSED"
|
|
84
|
+
&& verification.response.result.status === "VERIFIED"
|
|
85
|
+
&& decision.response.result.status === "ACCEPT"
|
|
86
|
+
&& promotion.response.result.status === "PROMOTED",
|
|
87
|
+
),
|
|
88
|
+
result(
|
|
89
|
+
"task_run_effect_reconciliation_is_invokable_from_common_registry",
|
|
90
|
+
"SUBMITTED -> RUNNING -> UNCERTAIN -> COMMITTED",
|
|
91
|
+
mutations.slice(4).map(({ name, response }) => ({ name, ok: response.ok, state: response.result?.state })),
|
|
92
|
+
task.response.ok && run.response.ok && effect.response.ok && reconciliation.response.ok
|
|
93
|
+
&& task.response.result.state === "SUBMITTED"
|
|
94
|
+
&& run.response.result.state === "RUNNING"
|
|
95
|
+
&& effect.response.result.state === "UNCERTAIN"
|
|
96
|
+
&& reconciliation.response.result.state === "COMMITTED",
|
|
97
|
+
),
|
|
98
|
+
result(
|
|
99
|
+
"invokable_mutations_remain_internal",
|
|
100
|
+
"all eight invoked operations declare read_only:false and omit MCP adapter exposure",
|
|
101
|
+
registry.operations.filter((operation) => mutations.some((item) => item.name === operation.name))
|
|
102
|
+
.map((operation) => ({ adapters: operation.adapters, name: operation.name, read_only: operation.read_only })),
|
|
103
|
+
registry.operations.filter((operation) => mutations.some((item) => item.name === operation.name))
|
|
104
|
+
.every((operation) => operation.read_only === false && !operation.adapters.includes("mcp")),
|
|
105
|
+
),
|
|
106
|
+
];
|
|
107
|
+
|
|
108
|
+
const report = { ok: results.every((item) => item.ok), results };
|
|
109
|
+
process.stdout.write(`${JSON.stringify(report, null, 2)}\n`);
|
|
110
|
+
process.exitCode = report.ok ? 0 : 1;
|