@inneranimalmedia/agentsam-sdk 2.6.12 → 2.6.13
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/AGENTSAM.md +32 -0
- package/DEVELOPMENT.md +69 -74
- package/README.md +11 -0
- package/apps/cad-creator/README.md +12 -0
- package/apps/cad-creator/shared/cad/package.json +1 -1
- package/apps/cad-creator/shared/cad/src/domain/project-contract.js +2 -75
- package/apps/cad-creator/shared/cad/src/domain/project-tools.js +2 -24
- package/apps/cad-creator/shared/cad/src/types.ts +2 -2
- package/apps/client-cms-editor/backend/package.json +2 -2
- package/apps/client-cms-editor/frontend/package.json +3 -3
- package/apps/client-cms-editor/frontend/src/adapters/http.ts +25 -13
- package/apps/client-cms-editor/frontend/src/editor/CmsEditor.tsx +7 -4
- package/apps/client-cms-editor/frontend/src/editor/canvas/PreviewCanvas.tsx +31 -3
- package/apps/client-cms-editor/frontend/src/editor/host-preview.test.tsx +104 -0
- package/apps/client-cms-editor/package-lock.json +8 -8
- package/apps/client-cms-editor/package.json +2 -1
- package/apps/client-cms-editor/shared/cms/package.json +1 -1
- package/docs/AUTORAG.md +2 -0
- package/docs/CAPABILITIES.md +28 -0
- package/docs/adr/ADR-0003-copro-clean-room-product-architecture.md +6 -0
- package/docs/architecture/AGENTSAM-CANONICAL-DISCOVERY-FIRST-SLICE.md +70 -0
- package/docs/architecture/AGENTSAM-REGISTRY-CLI-AGENT-PARITY.md +133 -0
- package/docs/architecture/AGENTSAM_APPLICATION_CONTRACT.md +6 -0
- package/docs/architecture/CAD_OPERATOR_CAPABILITIES.md +64 -0
- package/docs/architecture/CAD_ROBOTICS_RELEASE_LEDGER_20261016.md +43 -0
- package/docs/architecture/CAD_RUN_MODES.md +34 -0
- package/docs/architecture/CLI-BOOT-REMOTE-DB-READINESS-20261015.md +65 -0
- package/docs/architecture/EXISTING-MCP-D1-AGENT-BRIDGE.md +47 -0
- package/docs/architecture/PLAN-PORTABILITY-SAM-FIRST-SPRINT-20261015.md +36 -0
- package/docs/architecture/PLUGIN-PRODUCTIZATION-SPINE.md +101 -0
- package/docs/architecture/SAMOS_PRODUCT_MODEL.md +49 -0
- package/docs/architecture/SAM_KERNEL.md +40 -0
- package/docs/architecture/SAM_RESOURCE_CRUD_STANDARD.md +96 -0
- package/docs/architecture/SAM_SYSTEMATIC_AUTONOMOUS_MACHINERY.md +79 -0
- package/docs/architecture/USER_GLOBAL_AGENT_INSTRUCTIONS.md +55 -0
- package/docs/autorag-workflow.md +13 -0
- package/docs/brand/AGENT_SAM_ICON_GRAMMAR.md +4 -0
- package/docs/contracts/capability-install-planner.md +66 -38
- package/docs/contracts/environment-vocabulary.md +5 -5
- package/docs/engineering/SUPERBASH_LOCAL_RUNTIME.md +100 -0
- package/docs/generated/SDK_CAPABILITY_INVENTORY.md +313 -0
- package/docs/handoffs/AGENT_HANDOFF_SUPERBASH_AND_MODEL_PERFORMANCE_2026-10-14.md +134 -0
- package/docs/intake/product-capabilities.proposed.ts +232 -0
- package/docs/knowledge-supabase-node-api.md +51 -0
- package/docs/plans/MEDIA_TRUTH_SOURCE_RECOVERY_20261008.md +31 -0
- package/docs/plans/OFFLINE_CLI_KNOWLEDGE_AGENT_HANDOFF.md +104 -0
- package/docs/plans/OFFLINE_CLI_KNOWLEDGE_RUNBOOK.md +81 -0
- package/docs/plans/SAM_EXPERIENCE_AGENT_DISPATCH_2026-10-15.md +107 -0
- package/docs/plans/SAM_MACHINERY_TO_EXPERIENCE_2026-10-15.md +172 -0
- package/docs/plans/UI_POLISH_DESKTOP_2026-10-16.md +102 -0
- package/docs/plans/WORK-UX-REMASTER-2026-10-15.md +48 -0
- package/docs/plans/WORK-WORKSPACE-PLAN-2026-10-14.md +212 -0
- package/docs/product/AGENTSAM-UI-QUALITY-GATE.md +148 -0
- package/docs/product/AGENTSAM_PRODUCT_EXPERIENCE_STANDARD.md +2 -0
- package/docs/product/MEDIA-PRODUCTION-FAMILY.md +47 -0
- package/docs/product/OFFER-PORTFOLIO.md +14 -0
- package/docs/product/PACKAGE-TAXONOMY.md +17 -0
- package/docs/product/PLUGIN-GALLERY-DISCOVERY-AND-INSTALL.md +97 -0
- package/docs/product/README.md +2 -0
- package/docs/product/WIDGET-GALLERY-PHASE-ONE.md +43 -0
- package/docs/reference/AGENTSAM-CLI-WORKFLOWS.md +73 -0
- package/docs/reference/AGENTSAM-ERROR-REASONS.md +267 -0
- package/docs/reference/AGENTSAM-REGISTRY.generated.md +288 -0
- package/docs/reference/INNERANIMALMEDIA_EXPERIENCE_ACCEPTANCE_2026-10-15.md +99 -0
- package/docs/releases/cad-v2-sdk-2.6.13.md +25 -0
- package/docs/roadmaps/ROAD_TO_REAL_DISTRIBUTION.md +97 -0
- package/docs/robotics-chess-handoff.md +15 -0
- package/docs/standards/DELIVERY_CLOSURE.md +33 -0
- package/docs/standards/SAM_MACHINE_BUILD_AND_GAPS.md +91 -0
- package/docs/workflows/ISSUE_TO_SAMOS.md +59 -0
- package/package.json +60 -8
- package/packages/agentsam-brand/package.json +1 -1
- package/packages/agentsam-cms/README.md +56 -0
- package/packages/agentsam-cms/agentsam.package.json +46 -0
- package/packages/agentsam-cms/package.json +36 -0
- package/packages/agentsam-cms/src/aliases.js +74 -0
- package/packages/agentsam-cms/src/contracts.js +105 -0
- package/packages/agentsam-cms/src/index.d.ts +80 -0
- package/packages/agentsam-cms/src/index.js +3 -0
- package/packages/agentsam-cms/src/machine.js +221 -0
- package/packages/agentsam-cms/src/node-sqlite-repository.js +148 -0
- package/packages/agentsam-cms/src/node.d.ts +7 -0
- package/packages/agentsam-cms/src/node.js +1 -0
- package/packages/agentsam-cms/src/schema/cms-local-runtime.v1.sql +365 -0
- package/packages/agentsam-cms/test/standalone.test.mjs +28 -0
- package/packages/agentsam-contracts/agentsam.package.json +43 -0
- package/packages/agentsam-contracts/dist/errors.d.ts +1 -1
- package/packages/agentsam-contracts/dist/widgets.d.ts +7 -0
- package/packages/agentsam-contracts/package.json +1 -1
- package/packages/agentsam-contracts/src/errors.ts +1 -1
- package/packages/agentsam-contracts/src/widgets.ts +7 -0
- package/packages/agentsam-desktop-shell/README.md +38 -0
- package/packages/agentsam-desktop-shell/scripts/app-discovery.mjs +43 -0
- package/packages/agentsam-errors/README.md +14 -0
- package/packages/agentsam-errors/agentsam.package.json +43 -0
- package/packages/agentsam-errors/package.json +1 -1
- package/packages/agentsam-errors/protocol/error-catalog.json +12 -0
- package/packages/agentsam-errors/src/cli.js +56 -0
- package/packages/agentsam-errors/src/index.js +2 -0
- package/packages/agentsam-errors/src/vocabulary.js +2 -0
- package/packages/agentsam-errors/test/approval-contract.test.mjs +12 -0
- package/packages/agentsam-errors/types/index.d.ts +5 -1
- package/packages/agentsam-goap/agentsam.package.json +42 -0
- package/packages/agentsam-goap/package.json +2 -2
- package/packages/agentsam-hooks/agentsam.package.json +45 -0
- package/packages/agentsam-hooks/bindings/go/errors_generated.go +1 -0
- package/packages/agentsam-hooks/bindings/rust/src/errors_generated.rs +1 -0
- package/packages/agentsam-hooks/package.json +1 -1
- package/packages/agentsam-hooks/src/errors-generated.js +10 -0
- package/packages/agentsam-ide/README.md +59 -0
- package/packages/agentsam-ide/src/lsp/host.d.mts +13 -0
- package/packages/agentsam-ide/src/lsp/host.mjs +133 -0
- package/packages/agentsam-knowledge/agentsam.package.json +42 -0
- package/packages/agentsam-knowledge/package.json +1 -1
- package/packages/agentsam-knowledge/src/autorag/index.js +25 -4
- package/packages/agentsam-knowledge/src/backends/index.js +21 -1
- package/packages/agentsam-knowledge/src/backends/supabase-node-api.js +91 -0
- package/packages/agentsam-knowledge/test/autorag.test.mjs +13 -0
- package/packages/agentsam-knowledge/test/supabase-node-api.test.mjs +59 -0
- package/packages/agentsam-merch/agentsam.package.json +43 -0
- package/packages/agentsam-merch/package.json +1 -1
- package/packages/agentsam-nav/dist/browser.global.js +18 -21
- package/packages/agentsam-nav/dist/browser.js +4 -3
- package/packages/agentsam-nav/dist/index.js +4 -3
- package/packages/agentsam-nav/package.json +1 -1
- package/packages/agentsam-queue-control/agentsam.package.json +42 -0
- package/packages/agentsam-queue-control/package.json +1 -1
- package/packages/agentsam-rapid-rust/Cargo.toml +5 -0
- package/packages/agentsam-rapid-rust/agentsam.package.json +42 -0
- package/packages/agentsam-repository/.agentsam/machine/cache/machine-parser.v1/0b22ca9c5f8cddc15e6816df4a2467a28d41aa174361cdfed9019ee4e04dfbb8.json +1 -0
- package/packages/agentsam-repository/.agentsam/machine/cache/machine-parser.v1/0c5064875a5d7645013880f04d71f56c0dfa1bc87ac9fd59adc3e9a93a2745da.json +1 -0
- package/packages/agentsam-repository/.agentsam/machine/cache/machine-parser.v1/11ebd15702c169ee0666656be851cc549f70f84498dbca3c5b72d2ceaa91c851.json +1 -0
- package/packages/agentsam-repository/.agentsam/machine/cache/machine-parser.v1/1d7f2c8ad9588cd2077a1d07fce156e0bd47be686d8c9f26885bab14874c4ab5.json +1 -0
- package/packages/agentsam-repository/.agentsam/machine/cache/machine-parser.v1/1f21ba21e7b631b0d4893cbdd7a6bb7345d34e8b1a0ee9cf644cc30aeb3c8b8d.json +1 -0
- package/packages/agentsam-repository/.agentsam/machine/cache/machine-parser.v1/23f4d4b90def0782de32e7a57558cba24525f12ba3c009728ea4881259a74099.json +1 -0
- package/packages/agentsam-repository/.agentsam/machine/cache/machine-parser.v1/26b60985b6ef62e4f20e06c37e47c6996c1a2f457335fa9eb4a68d1288e18490.json +1 -0
- package/packages/agentsam-repository/.agentsam/machine/cache/machine-parser.v1/2b27d15a1b8c3637a56f631d583cc9ba584bed2b7018dd962a9340d5e1c50a1d.json +1 -0
- package/packages/agentsam-repository/.agentsam/machine/cache/machine-parser.v1/3110a5568a544c4c38de6585dcdabc21fa5f54a5772ecf4e1f4076ee0d49e933.json +1 -0
- package/packages/agentsam-repository/.agentsam/machine/cache/machine-parser.v1/357ce3db8299e01866bf4fc3d8ee1c784ef53c7455cf86bb17c52f3dad20d050.json +1 -0
- package/packages/agentsam-repository/.agentsam/machine/cache/machine-parser.v1/4516c6e03636538cacc7a6e4063d98a7ed2f0090c3a02c5ee817f1c512b1070e.json +1 -0
- package/packages/agentsam-repository/.agentsam/machine/cache/machine-parser.v1/649e02dbaec2edabbd40372e0c5f72f114164fe7704e7825220b1955f6a7c74e.json +1 -0
- package/packages/agentsam-repository/.agentsam/machine/cache/machine-parser.v1/81c266d4c150a4f6c5a73c9c4fef6541577fd0acd8c1f911f02781deb5f0be0f.json +1 -0
- package/packages/agentsam-repository/.agentsam/machine/cache/machine-parser.v1/86b4b8de30eed9902750b3de9fb54276d229244671a8b6035345bbe705463d82.json +1 -0
- package/packages/agentsam-repository/.agentsam/machine/cache/machine-parser.v1/8a877fdc5dbc6a66c344b4ebc4d9b746d47f95153e98872210becd85ca941ddd.json +1 -0
- package/packages/agentsam-repository/.agentsam/machine/cache/machine-parser.v1/96a11200f7b42ddd1281e4f749e88dcb8455ab0e3883f943934e0a9a7935147a.json +1 -0
- package/packages/agentsam-repository/.agentsam/machine/cache/machine-parser.v1/9e2df2335cfc73ec021bdd6b2d34af798f6ed9c52e3061ce16b6ceabae4e275f.json +1 -0
- package/packages/agentsam-repository/.agentsam/machine/cache/machine-parser.v1/a405fe3addeaab2908ed58836997be3b679d990ec9102d06bece3569e4bd4a81.json +1 -0
- package/packages/agentsam-repository/.agentsam/machine/cache/machine-parser.v1/a63915da0a45f86a5938ba9a2b2e87d469e7d07f7ea9cc531136fdc9e055557e.json +1 -0
- package/packages/agentsam-repository/.agentsam/machine/cache/machine-parser.v1/a8452c2dcaa959ced25e3597931b311999c0aa5b257ca8610fe415e8cfa598cc.json +1 -0
- package/packages/agentsam-repository/.agentsam/machine/cache/machine-parser.v1/b35fc2ae65ea07fbbfdd242a3d76489947462399e7a2db91f8545ca50d97d86f.json +1 -0
- package/packages/agentsam-repository/.agentsam/machine/cache/machine-parser.v1/b966932defe9c7b5ec9599c9276d333bd09ad1605adae80300d825d2161ad20c.json +1 -0
- package/packages/agentsam-repository/.agentsam/machine/cache/machine-parser.v1/ca9060e5ccb91f3a2663f57afd47a25099b6b3313c2a7436c4634993ff6e9afc.json +1 -0
- package/packages/agentsam-repository/.agentsam/machine/cache/machine-parser.v1/d0eba82a259be203c68c3ebf6d5b8a376f31a3b84fad418fdb9b5e2715c59869.json +1 -0
- package/packages/agentsam-repository/.agentsam/machine/cache/machine-parser.v1/d8838513009c65079aba67314ab130920484c674c5f0b8a356c8777eb6174eb2.json +1 -0
- package/packages/agentsam-repository/.agentsam/machine/cache/machine-parser.v1/dda01925b7f0a213215b983979ce23625dd0f6cfdb49c483ec1ff73e64def56f.json +1 -0
- package/packages/agentsam-repository/.agentsam/machine/cache/machine-parser.v1/e4956d8f97608f8324607b22cc93635d8183b23021d79cb4c21668c8b8a6ce87.json +1 -0
- package/packages/agentsam-repository/.agentsam/machine/cache/machine-parser.v1/e80c1e517e7173dcbde78869d2bf67a24a11b0bb9df5a87fb12934e39497abc8.json +1 -0
- package/packages/agentsam-repository/.agentsam/machine/cache/machine-parser.v1/eeeaa9394ac979eb4ffa557e97d67ed96dbd61437e09058f7c776bdc0483f050.json +1 -0
- package/packages/agentsam-repository/.agentsam/machine/cache/machine-parser.v1/f9264d8d7d1ccfb415362a28b4a1b4fa0dfbdf828ff970d1aaecfb0ebe208978.json +1 -0
- package/packages/agentsam-repository/.agentsam/machine/cache/machine-parser.v1/f957a80b89d32af4f33f9f840b4795af1b5145fc44780ad88a6a3b1b3a7ea3bc.json +1 -0
- package/packages/agentsam-repository/.agentsam/machine/runs/run_2b0d196f16961f88/asset-manifest.json +418 -0
- package/packages/agentsam-repository/.agentsam/machine/runs/run_2b0d196f16961f88/findings.json +308 -0
- package/packages/agentsam-repository/.agentsam/machine/runs/run_2b0d196f16961f88/frontend-manifest.json +70 -0
- package/packages/agentsam-repository/.agentsam/machine/runs/run_2b0d196f16961f88/graph.json +322 -0
- package/packages/agentsam-repository/.agentsam/machine/runs/run_2b0d196f16961f88/inventory.json +932 -0
- package/packages/agentsam-repository/.agentsam/machine/runs/run_2b0d196f16961f88/summary.json +21 -0
- package/packages/agentsam-repository/.agentsam/machine/runs/run_2d70e3d4fe8290fb/asset-manifest.json +418 -0
- package/packages/agentsam-repository/.agentsam/machine/runs/run_2d70e3d4fe8290fb/findings.json +308 -0
- package/packages/agentsam-repository/.agentsam/machine/runs/run_2d70e3d4fe8290fb/frontend-manifest.json +70 -0
- package/packages/agentsam-repository/.agentsam/machine/runs/run_2d70e3d4fe8290fb/graph.json +322 -0
- package/packages/agentsam-repository/.agentsam/machine/runs/run_2d70e3d4fe8290fb/inventory.json +932 -0
- package/packages/agentsam-repository/.agentsam/machine/runs/run_2d70e3d4fe8290fb/summary.json +21 -0
- package/packages/agentsam-repository/.agentsam/machine/runs/run_63fab76b2f18c2f0/asset-manifest.json +418 -0
- package/packages/agentsam-repository/.agentsam/machine/runs/run_63fab76b2f18c2f0/findings.json +308 -0
- package/packages/agentsam-repository/.agentsam/machine/runs/run_63fab76b2f18c2f0/frontend-manifest.json +70 -0
- package/packages/agentsam-repository/.agentsam/machine/runs/run_63fab76b2f18c2f0/graph.json +322 -0
- package/packages/agentsam-repository/.agentsam/machine/runs/run_63fab76b2f18c2f0/inventory.json +932 -0
- package/packages/agentsam-repository/.agentsam/machine/runs/run_63fab76b2f18c2f0/summary.json +21 -0
- package/packages/agentsam-repository/.agentsam/machine/runs/run_72fe856b80b0c46f/asset-manifest.json +418 -0
- package/packages/agentsam-repository/.agentsam/machine/runs/run_72fe856b80b0c46f/findings.json +300 -0
- package/packages/agentsam-repository/.agentsam/machine/runs/run_72fe856b80b0c46f/frontend-manifest.json +70 -0
- package/packages/agentsam-repository/.agentsam/machine/runs/run_72fe856b80b0c46f/graph.json +322 -0
- package/packages/agentsam-repository/.agentsam/machine/runs/run_72fe856b80b0c46f/inventory.json +932 -0
- package/packages/agentsam-repository/.agentsam/machine/runs/run_72fe856b80b0c46f/summary.json +21 -0
- package/packages/agentsam-repository/.agentsam/machine/runs/run_a5834156504f3050/asset-manifest.json +418 -0
- package/packages/agentsam-repository/.agentsam/machine/runs/run_a5834156504f3050/findings.json +308 -0
- package/packages/agentsam-repository/.agentsam/machine/runs/run_a5834156504f3050/frontend-manifest.json +70 -0
- package/packages/agentsam-repository/.agentsam/machine/runs/run_a5834156504f3050/graph.json +322 -0
- package/packages/agentsam-repository/.agentsam/machine/runs/run_a5834156504f3050/inventory.json +932 -0
- package/packages/agentsam-repository/.agentsam/machine/runs/run_a5834156504f3050/summary.json +21 -0
- package/packages/agentsam-repository/README.md +25 -0
- package/packages/agentsam-repository/agentsam.package.json +42 -0
- package/packages/agentsam-repository/package.json +6 -3
- package/packages/agentsam-repository/src/crawl.js +220 -0
- package/packages/agentsam-repository/src/index.js +3 -0
- package/packages/agentsam-repository/src/merkle/semantic.js +20 -0
- package/packages/agentsam-repository/src/refinery.js +96 -0
- package/packages/agentsam-repository/test/crawl-refinery.test.mjs +113 -0
- package/packages/agentsam-site-scrape/README.md +357 -0
- package/packages/agentsam-site-scrape/agentsam_site_scrape/__init__.py +4 -0
- package/packages/agentsam-site-scrape/agentsam_site_scrape/__main__.py +349 -0
- package/packages/agentsam-site-scrape/agentsam_site_scrape/classify.py +80 -0
- package/packages/agentsam-site-scrape/agentsam_site_scrape/config.py +83 -0
- package/packages/agentsam-site-scrape/agentsam_site_scrape/contract.py +108 -0
- package/packages/agentsam-site-scrape/agentsam_site_scrape/crawl.py +395 -0
- package/packages/agentsam-site-scrape/agentsam_site_scrape/evidence.py +226 -0
- package/packages/agentsam-site-scrape/agentsam_site_scrape/htmlparse.py +109 -0
- package/packages/agentsam-site-scrape/agentsam_site_scrape/imageops.py +121 -0
- package/packages/agentsam-site-scrape/agentsam_site_scrape/jsonrun.py +127 -0
- package/packages/agentsam-site-scrape/agentsam_site_scrape/net.py +121 -0
- package/packages/agentsam-site-scrape/agentsam_site_scrape/pageextract.py +202 -0
- package/packages/agentsam-site-scrape/agentsam_site_scrape/r2_upload.py +140 -0
- package/packages/agentsam-site-scrape/agentsam_site_scrape/ssrf.py +57 -0
- package/packages/agentsam-site-scrape/agentsam_site_scrape/storage.py +57 -0
- package/packages/agentsam-site-scrape/agentsam_site_scrape/wrangler_bucket.py +98 -0
- package/packages/agentsam-site-scrape/pyproject.toml +21 -0
- package/packages/agentsam-site-scrape/runtime/client.mjs +32 -0
- package/packages/agentsam-site-scrape/runtime/core.mjs +211 -0
- package/packages/agentsam-site-scrape/runtime/index.mjs +31 -0
- package/packages/agentsam-site-scrape/runtime/knowledge.mjs +38 -0
- package/packages/agentsam-site-scrape/runtime/node-runner.mjs +231 -0
- package/packages/agentsam-site-scrape/runtime/node-storage.mjs +146 -0
- package/packages/agentsam-site-scrape/runtime/project-site.mjs +74 -0
- package/packages/agentsam-site-scrape/runtime/secure-fetch.mjs +88 -0
- package/packages/agentsam-site-scrape/runtime/test/knowledge-handoff.test.mjs +51 -0
- package/packages/agentsam-site-scrape/runtime/test/project-index-command.test.mjs +109 -0
- package/packages/agentsam-site-scrape/runtime/test/runtime.test.mjs +145 -0
- package/packages/agentsam-site-scrape/tests/__init__.py +0 -0
- package/packages/agentsam-site-scrape/tests/test_contract.py +83 -0
- package/packages/agentsam-site-scrape/tests/test_core.py +119 -0
- package/packages/agentsam-site-scrape/tests/test_evidence.py +88 -0
- package/packages/agentsam-site-scrape/tests/test_evidence_pipeline.py +112 -0
- package/packages/agentsam-site-scrape/tests/test_jsonrun.py +63 -0
- package/packages/agentsam-site-scrape/tests/test_redirects.py +68 -0
- package/packages/agentsam-site-scrape/tests/test_storage.py +34 -0
- package/packages/agentsam-site-scrape/worker/index.mjs +259 -0
- package/packages/agentsam-site-scrape/worker/project-config.mjs +57 -0
- package/packages/agentsam-site-scrape/worker/test/worker.test.mjs +191 -0
- package/packages/agentsam-vault/package.json +1 -1
- package/packages/agentsam-workbench/README.md +18 -0
- package/packages/agentsam-workbench/package.json +13 -4
- package/packages/agentsam-workbench/src/agent/capability-catalog.ts +96 -0
- package/packages/agentsam-workbench/src/agent/index.ts +2 -0
- package/packages/agentsam-workbench/src/knowledge/AutoRagWorkflowDialog.tsx +166 -0
- package/packages/agentsam-workbench/src/knowledge/README.md +14 -0
- package/packages/agentsam-workbench/src/knowledge/autorag-workflow.css +6 -0
- package/packages/agentsam-workbench/src/knowledge/index.ts +2 -0
- package/packages/agentsam-workbench/src/widgets/registry.ts +266 -1
- package/packages/catalog/README.md +69 -0
- package/packages/catalog/assist/questions.json +205 -0
- package/packages/catalog/assist/rules.json +149 -0
- package/packages/catalog/doctor/toolchains.json +12 -0
- package/packages/catalog/evidence/agentsam-abs.json +76 -0
- package/packages/catalog/evidence/agentsam-analytics.json +59 -0
- package/packages/catalog/evidence/agentsam-assets-core.json +38 -0
- package/packages/catalog/evidence/agentsam-brand.json +73 -0
- package/packages/catalog/evidence/agentsam-browser-surface.json +42 -0
- package/packages/catalog/evidence/agentsam-campaign.json +48 -0
- package/packages/catalog/evidence/agentsam-cloudflare-images.json +38 -0
- package/packages/catalog/evidence/agentsam-content-studio.json +42 -0
- package/packages/catalog/evidence/agentsam-content.json +70 -0
- package/packages/catalog/evidence/agentsam-contracts.json +92 -0
- package/packages/catalog/evidence/agentsam-database-editor.json +82 -0
- package/packages/catalog/evidence/agentsam-desktop-shell.json +56 -0
- package/packages/catalog/evidence/agentsam-docs-theme.json +35 -0
- package/packages/catalog/evidence/agentsam-errors.json +42 -0
- package/packages/catalog/evidence/agentsam-goap.json +52 -0
- package/packages/catalog/evidence/agentsam-hooks.json +100 -0
- package/packages/catalog/evidence/agentsam-ide.json +64 -0
- package/packages/catalog/evidence/agentsam-identity.json +91 -0
- package/packages/catalog/evidence/agentsam-key-manager.json +46 -0
- package/packages/catalog/evidence/agentsam-knowledge.json +42 -0
- package/packages/catalog/evidence/agentsam-loading-scene.json +54 -0
- package/packages/catalog/evidence/agentsam-merch.json +68 -0
- package/packages/catalog/evidence/agentsam-nav.json +63 -0
- package/packages/catalog/evidence/agentsam-queue-control.json +60 -0
- package/packages/catalog/evidence/agentsam-rapid-rust.json +46 -0
- package/packages/catalog/evidence/agentsam-repository.json +56 -0
- package/packages/catalog/evidence/agentsam-scoring.json +39 -0
- package/packages/catalog/evidence/agentsam-sections.json +52 -0
- package/packages/catalog/evidence/agentsam-settings.json +58 -0
- package/packages/catalog/evidence/agentsam-shell-kit.json +56 -0
- package/packages/catalog/evidence/agentsam-vault.json +61 -0
- package/packages/catalog/evidence/agentsam-work-graph.json +51 -0
- package/packages/catalog/evidence/agentsam-work.json +64 -0
- package/packages/catalog/evidence/agentsam-workbench.json +96 -0
- package/packages/catalog/evidence/analytics-ui.json +43 -0
- package/packages/catalog/evidence/cms-runtime.json +49 -0
- package/packages/catalog/evidence/copro-editor.json +42 -0
- package/packages/catalog/evidence/copro-media.json +42 -0
- package/packages/catalog/evidence/copro-project.json +42 -0
- package/packages/catalog/evidence/copro-proof.json +48 -0
- package/packages/catalog/evidence/copro-provider-contracts.json +40 -0
- package/packages/catalog/evidence/copro-render.json +40 -0
- package/packages/catalog/evidence/copro-storage.json +44 -0
- package/packages/catalog/evidence/copro-templates.json +42 -0
- package/packages/catalog/evidence/copro-timeline.json +44 -0
- package/packages/catalog/evidence/copro-ui.json +52 -0
- package/packages/catalog/evidence/fnf-theme.json +34 -0
- package/packages/catalog/evidence/theme-contract.json +34 -0
- package/packages/catalog/evidence/theme-cypress.json +41 -0
- package/packages/catalog/evidence/theme-ember.json +41 -0
- package/packages/catalog/evidence/theme-forge.json +41 -0
- package/packages/catalog/evidence/theme-grove.json +41 -0
- package/packages/catalog/evidence/theme-harbor.json +41 -0
- package/packages/catalog/evidence/theme-heuristic.json +50 -0
- package/packages/catalog/evidence/theme-iasf.json +48 -0
- package/packages/catalog/evidence/theme-resolve.json +41 -0
- package/packages/catalog/evidence/theme-scenes.json +68 -0
- package/packages/catalog/evidence/theme-summit.json +41 -0
- package/packages/catalog/evidence/theme-violet.json +41 -0
- package/packages/catalog/generated/packages.json +2649 -0
- package/packages/catalog/topics/runtime.json +33 -0
- package/packages/connectors/cfoa/agentsam.package.json +46 -0
- package/packages/connectors/cfoa/package.json +1 -1
- package/packages/connectors/cfoa/src/capabilities.js +22 -2
- package/packages/connectors/cfoa/src/families/analytics-sql.js +44 -0
- package/packages/connectors/cfoa/src/families/basin.js +30 -0
- package/packages/connectors/cfoa/src/index.js +3 -0
- package/packages/connectors/cfoa/src/routes.js +11 -2
- package/packages/connectors/cfoa/test/analytics-sql.test.mjs +27 -0
- package/packages/connectors/cfoa/test/basin.test.mjs +30 -0
- package/packages/heuristic-theme/README.md +14 -0
- package/packages/heuristic-theme/agentsam.package.json +42 -0
- package/packages/heuristic-theme/contracts/README.md +15 -0
- package/packages/heuristic-theme/contracts/block.schema.json +33 -0
- package/packages/heuristic-theme/contracts/header-presets.json +20 -0
- package/packages/heuristic-theme/contracts/page.schema.json +18 -0
- package/packages/heuristic-theme/contracts/preset.schema.json +18 -0
- package/packages/heuristic-theme/contracts/section.schema.json +83 -0
- package/packages/heuristic-theme/package.json +13 -3
- package/packages/heuristic-theme/presets/fuel-free-time/assets.json +8 -0
- package/packages/heuristic-theme/presets/fuel-free-time/globals/shell.json +30 -0
- package/packages/heuristic-theme/presets/fuel-free-time/pages/about.json +4 -0
- package/packages/heuristic-theme/presets/fuel-free-time/pages/cart.json +4 -0
- package/packages/heuristic-theme/presets/fuel-free-time/pages/collection.json +4 -0
- package/packages/heuristic-theme/presets/fuel-free-time/pages/collections.json +4 -0
- package/packages/heuristic-theme/presets/fuel-free-time/pages/community.json +4 -0
- package/packages/heuristic-theme/presets/fuel-free-time/pages/home.json +92 -0
- package/packages/heuristic-theme/presets/fuel-free-time/pages/order-confirmation.json +39 -0
- package/packages/heuristic-theme/presets/fuel-free-time/pages/product.json +4 -0
- package/packages/heuristic-theme/presets/fuel-free-time/pages/shop.json +9 -0
- package/packages/heuristic-theme/presets/fuel-free-time/preset.json +23 -0
- package/packages/heuristic-theme/presets/fuel-free-time/tokens.json +23 -0
- package/packages/heuristic-theme/storefront/about.html +1103 -0
- package/packages/heuristic-theme/storefront/assets/presets/fuel-free-time/GENERATED-ASSETS.md +15 -0
- package/packages/heuristic-theme/storefront/assets/presets/fuel-free-time/earned-hours-hero.webp +0 -0
- package/packages/heuristic-theme/storefront/assets/presets/fuel-free-time/essentials.webp +0 -0
- package/packages/heuristic-theme/storefront/assets/presets/fuel-free-time/masters.webp +0 -0
- package/packages/heuristic-theme/storefront/cart.html +64 -0
- package/packages/heuristic-theme/storefront/collaborate.html +58 -0
- package/packages/heuristic-theme/storefront/collection.html +10 -0
- package/packages/heuristic-theme/storefront/collections.html +10 -0
- package/packages/heuristic-theme/storefront/community.html +921 -0
- package/packages/heuristic-theme/storefront/css/content-page.css +199 -0
- package/packages/heuristic-theme/storefront/css/global-footer.css +401 -0
- package/packages/heuristic-theme/storefront/css/heuristic-theme.css +81 -0
- package/packages/heuristic-theme/storefront/css/page-composer.css +76 -0
- package/packages/heuristic-theme/storefront/css/shop-hero.css +230 -0
- package/packages/heuristic-theme/storefront/css/store-cart.css +422 -0
- package/packages/heuristic-theme/storefront/css/store-collections.css +36 -0
- package/packages/heuristic-theme/storefront/css/store-pdp.css +459 -0
- package/packages/heuristic-theme/storefront/css/store-shell.css +474 -0
- package/packages/heuristic-theme/storefront/css/store-shop.css +117 -0
- package/packages/heuristic-theme/storefront/home.html +25 -0
- package/packages/heuristic-theme/storefront/js/cms-hydrate.js +395 -0
- package/packages/heuristic-theme/storefront/js/cms-structure.js +85 -0
- package/packages/heuristic-theme/storefront/js/fnf-attribution.js +98 -0
- package/packages/heuristic-theme/storefront/js/fnf-head.js +47 -0
- package/packages/heuristic-theme/storefront/js/fnf-newsletter.js +64 -0
- package/packages/heuristic-theme/storefront/js/global-footer.js +277 -0
- package/packages/heuristic-theme/storefront/js/heuristic-runtime.js +78 -0
- package/packages/heuristic-theme/storefront/js/order-confirmation.js +109 -0
- package/packages/heuristic-theme/storefront/js/page-composer.js +310 -0
- package/packages/heuristic-theme/storefront/js/shop-hero.js +85 -0
- package/packages/heuristic-theme/storefront/js/store-cart.js +276 -0
- package/packages/heuristic-theme/storefront/js/store-catalog.js +140 -0
- package/packages/heuristic-theme/storefront/js/store-collections.js +45 -0
- package/packages/heuristic-theme/storefront/js/store-product.js +287 -0
- package/packages/heuristic-theme/storefront/js/store-shell.js +449 -0
- package/packages/heuristic-theme/storefront/order-confirmation.html +30 -0
- package/packages/heuristic-theme/storefront/policies.html +43 -0
- package/packages/heuristic-theme/storefront/product.html +27 -0
- package/packages/heuristic-theme/storefront/shop.html +113 -0
- package/packages/heuristic-theme/storefront/terms.html +45 -0
- package/packages/heuristic-theme/test/commerce-portability.test.mjs +16 -0
- package/packages/heuristic-theme/theme.json +55 -0
- package/packages/heuristic-theme/theme.schema.json +32 -0
- package/packages/identity/agentsam.package.json +42 -0
- package/packages/identity/package.json +1 -1
- package/packages/identity/src/oauth/iam-platform.js +4 -2
- package/packages/identity/src/recovery/password-reset.js +8 -8
- package/packages/identity/src/server/worker-router.js +63 -1
- package/packages/identity/tests/lane1-packed-consumer.test.mjs +12 -1
- package/packages/identity/tests/password-enrollment.test.mjs +82 -0
- package/packages/identity/tests/password-reset.test.mjs +43 -0
- package/packages/providers/completeful/package.json +1 -1
- package/packages/theme-cypress/agentsam.package.json +42 -0
- package/packages/theme-cypress/package.json +1 -1
- package/packages/theme-ember/agentsam.package.json +42 -0
- package/packages/theme-ember/package.json +1 -1
- package/packages/theme-forge/agentsam.package.json +42 -0
- package/packages/theme-forge/package.json +1 -1
- package/packages/theme-grove/agentsam.package.json +42 -0
- package/packages/theme-grove/package.json +1 -1
- package/packages/theme-harbor/agentsam.package.json +42 -0
- package/packages/theme-harbor/package.json +1 -1
- package/packages/theme-resolve/agentsam.package.json +42 -0
- package/packages/theme-resolve/package.json +1 -1
- package/packages/theme-scenes/agentsam.package.json +42 -0
- package/packages/theme-scenes/package.json +1 -1
- package/packages/theme-summit/agentsam.package.json +42 -0
- package/packages/theme-summit/package.json +1 -1
- package/packages/theme-violet/agentsam.package.json +42 -0
- package/packages/theme-violet/package.json +1 -1
- package/packages/work-graph/agentsam.package.json +42 -0
- package/packages/work-graph/package.json +1 -1
- package/protocol/apps/agentsam.app.v1.schema.json +27 -1
- package/protocol/cad/README.md +77 -0
- package/protocol/cad/cad.project.v2.schema.json +451 -0
- package/protocol/cad/v2/core/artifact-receipt.schema.json +126 -0
- package/protocol/cad/v2/core/coordinate-system.schema.json +364 -0
- package/protocol/cad/v2/core/geometry-constraint.schema.json +136 -0
- package/protocol/cad/v2/core/geometry-entity.schema.json +73 -0
- package/protocol/cad/v2/core/geometry-feature.schema.json +115 -0
- package/protocol/cad/v2/core/geometry-relationship.schema.json +67 -0
- package/protocol/cad/v2/core/project-revision.schema.json +111 -0
- package/protocol/cad/v2/core/topology-reference.schema.json +80 -0
- package/protocol/cad/v2/intent/design-decision.schema.json +126 -0
- package/protocol/cad/v2/intent/design-option.schema.json +88 -0
- package/protocol/cad/v2/interchange/ifc-mapping.schema.json +145 -0
- package/protocol/cad/v2/interchange/native-document.schema.json +130 -0
- package/protocol/cad/v2/interchange/reference-model.schema.json +141 -0
- package/protocol/cad/v2/modules/architecture.v1.schema.json +278 -0
- package/protocol/cad/v2/modules/landscape.v1.schema.json +157 -0
- package/protocol/cad/v2/modules/mechanical.v1.schema.json +325 -0
- package/protocol/cad/v2/modules/parametric.v1.schema.json +89 -0
- package/protocol/cad/v2/modules/product-design.v1.schema.json +178 -0
- package/protocol/cad/v2/modules/robotics.v1.schema.json +246 -0
- package/protocol/cad/v2/presentation/camera-path.schema.json +143 -0
- package/protocol/cad/v2/presentation/drawing.schema.json +162 -0
- package/protocol/cad/v2/presentation/production.schema.json +166 -0
- package/protocol/cad/v2/presentation/scene.schema.json +198 -0
- package/protocol/cad/v2/presentation/sheet.schema.json +254 -0
- package/protocol/cad/v2/presentation/view.schema.json +190 -0
- package/protocol/cad/v2/presentation/walkthrough.schema.json +199 -0
- package/protocol/cad/v2/schema-pack.manifest.json +189 -0
- package/protocol/cad/v2/validation/deliverable-manifest.schema.json +199 -0
- package/protocol/cad/v2/validation/result.schema.json +141 -0
- package/protocol/capabilities/evidence-manifest.schema.json +404 -0
- package/protocol/capabilities/manifest.json +101 -10
- package/protocol/capabilities/repository-crawl-input.schema.json +17 -0
- package/protocol/capabilities/repository-crawl-result.schema.json +79 -0
- package/protocol/capabilities/repository-mine-input.schema.json +27 -0
- package/protocol/capabilities/repository-mine-result.schema.json +51 -0
- package/protocol/capabilities/site-index.schema.json +15 -0
- package/protocol/capabilities/site-scrape-evidence-manifest.schema.json +114 -0
- package/protocol/capabilities/site-scrape-input.schema.json +90 -0
- package/protocol/capabilities/site-scrape-project-authority.schema.json +15 -0
- package/protocol/capabilities/site-scrape-result.schema.json +198 -0
- package/protocol/capabilities/site-scrape-worker-job.schema.json +18 -0
- package/protocol/errors/error-catalog.json +12 -0
- package/protocol/governance/distribution-roadmap.v1.json +335 -0
- package/protocol/governance/github-labels.v1.json +232 -0
- package/protocol/models/workers-ai-curated.mjs +14 -0
- package/protocol/plugins/agentsam.plugin-evidence-bundle.v1.schema.json +55 -0
- package/protocol/plugins/agentsam.plugin-product.v1.schema.json +227 -0
- package/protocol/plugins/agentsam.plugin-quality-evidence.v1.schema.json +47 -0
- package/protocol/plugins/agentsam.plugin-quality-receipt.v1.schema.json +160 -0
- package/protocol/ui/agentsam.ui-quality.v1.schema.json +31 -0
- package/python/agentsam_sdk/__init__.py +4 -0
- package/python/agentsam_sdk/client.py +202 -0
- package/python/agentsam_sdk/errors/vocabulary.py +10 -0
- package/python/tests/test_public_client.py +82 -0
- package/services/cad/blender/adapter.py +0 -0
- package/services/cad/occt/CMakeLists.txt +43 -0
- package/services/cad/occt/README.md +38 -0
- package/services/cad/occt/main.cpp +95 -0
- package/services/cad/server.py +103 -21
- package/skills/README.md +6 -0
- package/skills/agentsam-cad/SKILL.md +59 -0
- package/skills/agentsam-plan-and-goap/SKILL.md +77 -0
- package/skills/agentsam-repo-recon/SKILL.md +63 -0
- package/skills/agentsam-sam-operations/SKILL.md +71 -0
- package/skills/agentsam-sdk-orientation/SKILL.md +75 -0
- package/skills/catalog.json +85 -0
- package/src/AgentSam.js +2 -0
- package/src/agent/capability-adapter.js +207 -9
- package/src/agent/index.js +1 -0
- package/src/agent/intent.js +12 -0
- package/src/agent/project-discovery.js +47 -0
- package/src/agent/project-resources.js +157 -0
- package/src/agent/responses-runner.js +64 -12
- package/src/capabilities/cloudflare-d1-provision.js +48 -0
- package/src/capabilities/knowledge-operations.js +87 -0
- package/src/capabilities/local-sqlite-resources.js +124 -0
- package/src/capabilities/machine-inspect.js +28 -0
- package/src/capabilities/mcp-d1-bridge.js +98 -0
- package/src/capabilities/plan-operation-ids.js +6 -0
- package/src/capabilities/plan-operations.js +85 -0
- package/src/capabilities/repository-awareness.js +52 -0
- package/src/capabilities/test-run.js +10 -0
- package/src/capabilities/workspace-files.js +125 -0
- package/src/cli/command-catalog.js +16 -3
- package/src/cli.js +71 -116
- package/src/commands/app.js +43 -44
- package/src/commands/autorag-node-api.js +96 -0
- package/src/commands/autorag.js +178 -17
- package/src/commands/catalog-doctor.js +52 -0
- package/src/commands/catalog.js +151 -0
- package/src/commands/cheat-sheet.js +92 -63
- package/src/commands/cloudflare.js +64 -2
- package/src/commands/codebaseindex.js +2 -2
- package/src/commands/db.js +17 -0
- package/src/commands/goap-world.js +4 -0
- package/src/commands/interactive.js +21 -1
- package/src/commands/knowledge.js +8 -3
- package/src/commands/machine-binary.js +3 -2
- package/src/commands/machine.js +66 -15
- package/src/commands/mcp.js +98 -8
- package/src/commands/plan-ledger.js +60 -22
- package/src/commands/plan.js +3 -3
- package/src/commands/plugins.js +34 -2
- package/src/commands/product.js +21 -0
- package/src/commands/rust.js +4 -1
- package/src/commands/sam-evidence.js +87 -0
- package/src/commands/sam-media.js +78 -0
- package/src/commands/sam.js +117 -0
- package/src/commands/shell.js +97 -8
- package/src/commands/site-scrape.js +9 -0
- package/src/context/resolve.js +5 -1
- package/src/index.js +13 -0
- package/src/knowledge/d1-schema.js +65 -0
- package/src/knowledge/engine.js +55 -15
- package/src/knowledge/source.js +8 -0
- package/src/knowledge/store-discovery.js +9 -3
- package/src/knowledge/stores/sqlite.js +8 -0
- package/src/knowledge/wrangler-binding-discovery.js +43 -0
- package/src/lib/agent-instructions.js +29 -5
- package/src/lib/auth.js +46 -7
- package/src/lib/cad/delivery-profiles.d.ts +7 -0
- package/src/lib/cad/delivery-profiles.js +122 -0
- package/src/lib/cad/docker-executor.js +1 -1
- package/src/lib/cad/editable-project-contract.js +75 -0
- package/src/lib/cad/index.js +6 -0
- package/src/lib/cad/occt-native-provider.mjs +138 -0
- package/src/lib/cad/openscad.js +13 -1
- package/src/lib/cad/production-operations.d.ts +8 -0
- package/src/lib/cad/production-operations.js +74 -0
- package/src/lib/cad/project-cli.d.ts +1 -1
- package/src/lib/cad/project-contract.js +1 -1
- package/src/lib/cad/project-runtime.d.ts +1 -1
- package/src/lib/cad/project-runtime.js +48 -3
- package/src/lib/cad/project-tools.js +24 -0
- package/src/lib/cad/project-v2.d.ts +48 -0
- package/src/lib/cad/project-v2.js +288 -0
- package/src/lib/cad-docker.js +48 -4
- package/src/lib/dockerize.js +3 -3
- package/src/lib/execution-approvals.js +29 -3
- package/src/local-fs/capability.js +5 -0
- package/src/local-lsp/host.js +2 -0
- package/src/local-pty/server.js +21 -0
- package/src/mcp/client.js +2 -1
- package/src/mcp/oauth-connection.js +109 -0
- package/src/models/inventory-core.js +2 -10
- package/src/plugins/index.js +13 -0
- package/src/plugins/productization.js +348 -0
- package/src/providers/gemini-generate-content.js +18 -0
- package/src/registry/generated/inventory.json +4266 -0
- package/src/registry/index.js +96 -0
- package/src/registry/turn-one.js +45 -0
- package/src/sam/adapters/local-media-store.js +71 -0
- package/src/sam/adapters/local-script-runtime.js +122 -0
- package/src/sam/adapters/local-script-store.js +103 -0
- package/src/sam/adapters/object-media-store.js +89 -0
- package/src/sam/adapters/workspace-media.js +78 -0
- package/src/sam/artifacts/render.js +94 -0
- package/src/sam/bridge/stdio.mjs +59 -0
- package/src/sam/client.js +269 -22
- package/src/sam/index.js +30 -1
- package/src/sam/local-execution.js +8 -0
- package/src/sam/media/environment.js +96 -0
- package/src/sam/model-adapter.js +45 -0
- package/src/sam/operation-packs/generated-v2/background.js +54 -0
- package/src/sam/operation-packs/generated-v2/catalog.js +1746 -0
- package/src/sam/operation-packs/generated-v2/generated-execution-policies.json +401 -0
- package/src/sam/operation-packs/generated-v2/generated-tool-descriptors.json +1352 -0
- package/src/sam/operation-packs/generated-v2/glb.js +41 -0
- package/src/sam/operation-packs/generated-v2/inneranimalmedia-provider.js +24 -0
- package/src/sam/operation-packs/generated-v2/operation-pack.js +126 -0
- package/src/sam/operation-packs/generated-v2/raster.js +140 -0
- package/src/sam/operation-packs/generated-v2/scripts.js +63 -0
- package/src/sam/operation-packs/generated-v2/sdk-adapter.js +9 -0
- package/src/sam/operation-packs/generated-v2/test/alias-runtime.test.mjs +51 -0
- package/src/sam/operation-packs/generated-v2/test/background.test.mjs +19 -0
- package/src/sam/operation-packs/generated-v2/test/glb.test.mjs +19 -0
- package/src/sam/operation-packs/generated-v2/test/raster.test.mjs +38 -0
- package/src/sam/operation-packs/generated-v2/test/real-asset-bindings.test.mjs +74 -0
- package/src/sam/operation-packs/generated-v2/test/registration.test.mjs +65 -0
- package/src/sam/operation-packs/generated-v2/test/scripts.test.mjs +32 -0
- package/src/sam/operation-packs/generated-v2/test/superbash-client-integration.test.mjs +215 -0
- package/src/sam/operation-packs/generated-v2/tool-types.d.ts +53 -0
- package/src/sam/operations/artifact-render.js +13 -0
- package/src/sam/operations/repository-inspect.js +12 -2
- package/src/sam/operations/robotics.js +45 -0
- package/src/sam/os.js +117 -0
- package/src/sam/packs/authoring/README.md +13 -0
- package/src/sam/packs/authoring/index.js +108 -0
- package/src/sam/packs/cad/http-ports.js +55 -0
- package/src/sam/packs/cad/index.js +158 -0
- package/src/sam/packs/cad/model-tools.js +22 -0
- package/src/sam/packs/cad/modes.js +87 -0
- package/src/sam/packs/cms/aliases.js +1 -0
- package/src/sam/packs/cms/contracts.js +1 -0
- package/src/sam/packs/cms/machine.js +6 -0
- package/src/sam/packs/cms/node.js +1 -0
- package/src/sam/packs/core.js +27 -0
- package/src/sam/packs/evidence/README.md +65 -0
- package/src/sam/packs/evidence/compare.js +98 -0
- package/src/sam/packs/evidence/contract.js +56 -0
- package/src/sam/packs/evidence/derive.js +59 -0
- package/src/sam/packs/evidence/driver-blender.js +96 -0
- package/src/sam/packs/evidence/driver-playwright.js +91 -0
- package/src/sam/packs/evidence/exporter-copro.js +70 -0
- package/src/sam/packs/evidence/facts.js +37 -0
- package/src/sam/packs/evidence/host-local.js +74 -0
- package/src/sam/packs/evidence/index.js +494 -0
- package/src/sam/packs/evidence/media.js +44 -0
- package/src/sam/packs/evidence/naming.js +67 -0
- package/src/sam/packs/evidence/normalize.js +117 -0
- package/src/sam/packs/evidence/review-page.js +102 -0
- package/src/sam/packs/evidence/screenplay.js +34 -0
- package/src/sam/packs/evidence/seal.js +55 -0
- package/src/sam/packs/evidence/serve.js +74 -0
- package/src/sam/packs/evidence/store.js +93 -0
- package/src/sam/packs/evidence/viewports.js +23 -0
- package/src/sam/robotics/chess-adapter.js +14 -0
- package/src/sam/robotics/franka.js +44 -0
- package/src/sam/robotics/index.js +4 -0
- package/src/sam/robotics/receipt.js +21 -0
- package/src/sam/robotics/world.js +57 -0
- package/src/sam/seed.js +10 -40
- package/src/sam/shell-host.js +120 -0
- package/src/sam/validation.js +40 -0
- package/src/security/local-vault.js +6 -1
- package/src/ui/cli/help.js +6 -0
- package/templates/clay/clay-blueprint-template.html +481 -0
- package/templates/clay/clay-case-study-blueprint.html +269 -0
- package/templates/clay/conversion-showcase-section.html +534 -0
- package/templates/clay/enhancing-conversion-section.html +141 -0
- package/templates/clay/nuant-wireframe.html +117 -0
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SAM portable CMS contracts v1.
|
|
3
|
+
*
|
|
4
|
+
* A CMS host implements persistence and rendering, not the operation semantics.
|
|
5
|
+
* Inputs never carry account, actor, role, provider secrets or workspace roots.
|
|
6
|
+
*/
|
|
7
|
+
const string = { type:'string', minLength:1 };
|
|
8
|
+
const integer = { type:'integer', minimum:0 };
|
|
9
|
+
const positive = { type:'integer', minimum:1 };
|
|
10
|
+
const object = { type:'object' };
|
|
11
|
+
const settings = { type:'object', additionalProperties:true };
|
|
12
|
+
const base = (properties, required = []) => ({
|
|
13
|
+
type:'object', properties, required, additionalProperties:false,
|
|
14
|
+
});
|
|
15
|
+
const page = { pageId:string };
|
|
16
|
+
const versioned = { ...page, expectedVersion:positive };
|
|
17
|
+
const resource = { ...page, componentId:string };
|
|
18
|
+
const component = { ...resource, expectedVersion:positive };
|
|
19
|
+
const patch = { type:'object', minProperties:1, additionalProperties:true };
|
|
20
|
+
const idempotency = { idempotencyKey: { type:'string', minLength:8, maxLength:128 } };
|
|
21
|
+
const result = properties => ({
|
|
22
|
+
...base({ ok:{type:'boolean'}, ...properties }, ['ok',...Object.keys(properties)]),
|
|
23
|
+
additionalProperties:true, // canonical result extensions include digest, receipt metadata, idempotency
|
|
24
|
+
});
|
|
25
|
+
export const CMS_OPERATION_CONTRACTS = Object.freeze([
|
|
26
|
+
{
|
|
27
|
+
name:'cms.definition.list', capability:'cms.definition.read', effect:'read',
|
|
28
|
+
description:'List installed CMS section and block definitions, versioned settings schemas and allowed composition rules.',
|
|
29
|
+
input_schema:base({ kind:{type:'string',enum:['section','block']}, key:string, status:{type:'string'} }),
|
|
30
|
+
output_schema:result({definitions:{type:'array',items:object}}),
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
name:'cms.resource.inspect', capability:'cms.resource.read', effect:'read',
|
|
34
|
+
description:'Read an authorized page, section or block, its versioned draft structure and definition references.',
|
|
35
|
+
input_schema:base({...page, componentId:string}),
|
|
36
|
+
output_schema:result({page:object,resource:object}),
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
name:'cms.page.createDraft', capability:'cms.page.write', effect:'draft_create',
|
|
40
|
+
description:'Create a new private page draft with an independent draft revision; never publish it.',
|
|
41
|
+
input_schema:base({...page,title:string,slug:string,...idempotency},['pageId','title','slug']),
|
|
42
|
+
output_schema:result({pageId:string,version:positive,published:{type:'boolean'}}),
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
name:'cms.component.create', capability:'cms.component.write', effect:'draft_create',
|
|
46
|
+
description:'Install a section or nested block from an available typed definition into a page draft.',
|
|
47
|
+
input_schema:base({...versioned,kind:{type:'string',enum:['section','block']},definitionKey:string,parentId:string,settings,position:integer,...idempotency},['pageId','expectedVersion','kind','definitionKey']),
|
|
48
|
+
output_schema:result({pageId:string,componentId:string,version:positive}),
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
name:'cms.component.update', capability:'cms.component.write', effect:'draft_update',
|
|
52
|
+
description:'Apply a settings patch to an existing draft component with optimistic concurrency and definition-schema validation.',
|
|
53
|
+
input_schema:base({...component,patch},['pageId','componentId','expectedVersion','patch']),
|
|
54
|
+
output_schema:result({pageId:string,componentId:string,version:positive}),
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
name:'cms.component.duplicate', capability:'cms.component.write', effect:'draft_create',
|
|
58
|
+
description:'Clone a placed section or block as an independent draft instance with a new component ID.',
|
|
59
|
+
input_schema:base({...component,...idempotency},['pageId','componentId','expectedVersion']),
|
|
60
|
+
output_schema:result({pageId:string,componentId:string,version:positive}),
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
name:'cms.component.remove', capability:'cms.component.write', effect:'draft_soft_remove',
|
|
64
|
+
description:'Remove a section or block from a private draft, recording a recoverable revision and preserving published content.',
|
|
65
|
+
input_schema:base({...component},['pageId','componentId','expectedVersion']),
|
|
66
|
+
output_schema:result({pageId:string,componentId:string,version:positive,removed:{type:'boolean'}}),
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
name:'cms.component.reorder', capability:'cms.component.write', effect:'draft_reorder',
|
|
70
|
+
description:'Move a component within its composition parent using a concurrency-checked draft revision.',
|
|
71
|
+
input_schema:base({...component,targetIndex:integer},['pageId','componentId','expectedVersion','targetIndex']),
|
|
72
|
+
output_schema:result({pageId:string,componentId:string,version:positive}),
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
name:'cms.component.visibility', capability:'cms.component.write', effect:'draft_visibility',
|
|
76
|
+
description:'Change only draft component visibility; live publication stays unchanged.',
|
|
77
|
+
input_schema:base({...component,visible:{type:'boolean'}},['pageId','componentId','expectedVersion','visible']),
|
|
78
|
+
output_schema:result({pageId:string,componentId:string,version:positive,visible:{type:'boolean'}}),
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
name:'cms.revision.history', capability:'cms.revision.read', effect:'read',
|
|
82
|
+
description:'Retrieve an authorized page draft revision history, authorship, content digests and publication pointers.',
|
|
83
|
+
input_schema:base({...page,limit:{type:'integer',minimum:1,maximum:100}},['pageId']),
|
|
84
|
+
output_schema:result({pageId:string,revisions:{type:'array',items:object}}),
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
name:'cms.revision.restore', capability:'cms.revision.write', effect:'draft_restore',
|
|
88
|
+
description:'Restore a historical snapshot into a NEW private draft revision, without changing the live publication.',
|
|
89
|
+
input_schema:base({...versioned,revision:positive},['pageId','expectedVersion','revision']),
|
|
90
|
+
output_schema:result({pageId:string,version:positive,restoredFrom:positive,published:{type:'boolean'}}),
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
name:'cms.page.preview', capability:'cms.page.read', effect:'read',
|
|
94
|
+
description:'Resolve a private draft preview document and hash. Never treat preview as publication or issue public access.',
|
|
95
|
+
input_schema:base({...page},['pageId']),
|
|
96
|
+
output_schema:result({pageId:string,version:positive,document:object,digest:string,published:{type:'boolean'}}),
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
name:'cms.page.publish', capability:'cms.page.publish', effect:'live_publish',
|
|
100
|
+
description:'Explicitly publish exactly the authorized draft revision as a separate immutable live snapshot.',
|
|
101
|
+
input_schema:base({...versioned,confirmation:{type:'boolean',const:true},...idempotency},['pageId','expectedVersion','confirmation']),
|
|
102
|
+
output_schema:result({pageId:string,version:positive,publishedVersion:positive,digest:string}),
|
|
103
|
+
},
|
|
104
|
+
]);
|
|
105
|
+
export const CMS_CONTRACTS_BY_NAME = new Map(CMS_OPERATION_CONTRACTS.map(x=>[x.name,x]));
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
export type CmsIdentity = { accountId:string; installationId:string; actorId:string };
|
|
2
|
+
export type CmsJsonSchema = {
|
|
3
|
+
type?: 'object'|'array'|'string'|'number'|'integer'|'boolean';
|
|
4
|
+
properties?: Record<string,CmsJsonSchema>;
|
|
5
|
+
required?: string[];
|
|
6
|
+
additionalProperties?: boolean|CmsJsonSchema;
|
|
7
|
+
items?: CmsJsonSchema;
|
|
8
|
+
enum?: unknown[];
|
|
9
|
+
const?: unknown;
|
|
10
|
+
minimum?: number;
|
|
11
|
+
maximum?: number;
|
|
12
|
+
minLength?: number;
|
|
13
|
+
maxLength?: number;
|
|
14
|
+
minItems?: number;
|
|
15
|
+
maxItems?: number;
|
|
16
|
+
minProperties?: number;
|
|
17
|
+
pattern?: string;
|
|
18
|
+
[key:string]:unknown;
|
|
19
|
+
};
|
|
20
|
+
export type CmsDefinition = {
|
|
21
|
+
kind:'section'|'block';
|
|
22
|
+
key:string;
|
|
23
|
+
version:number;
|
|
24
|
+
status?:string;
|
|
25
|
+
settings_schema:CmsJsonSchema;
|
|
26
|
+
allowedBlocks?:string[];
|
|
27
|
+
[key:string]:unknown;
|
|
28
|
+
};
|
|
29
|
+
export type CmsComponent = {
|
|
30
|
+
id:string; kind:'section'|'block'; definitionKey:string;
|
|
31
|
+
settings:Record<string,unknown>; visible:boolean; blocks?:CmsComponent[];
|
|
32
|
+
};
|
|
33
|
+
export type CmsDocument = {
|
|
34
|
+
id:string; title:string; slug:string; version:number;
|
|
35
|
+
sections:CmsComponent[];
|
|
36
|
+
publishedVersion:number|null;
|
|
37
|
+
createdAt:string; updatedAt:string;
|
|
38
|
+
[key:string]:unknown;
|
|
39
|
+
};
|
|
40
|
+
export type CmsAuthorization = {
|
|
41
|
+
operation:string;
|
|
42
|
+
requestedAlias:string|null;
|
|
43
|
+
capability:string;
|
|
44
|
+
effect:string;
|
|
45
|
+
identity:CmsIdentity;
|
|
46
|
+
resource:{pageId:string|null;componentId:string|null};
|
|
47
|
+
input:Record<string,unknown>;
|
|
48
|
+
};
|
|
49
|
+
export type CmsRepository = {
|
|
50
|
+
createPage(identity:CmsIdentity,input:{pageId:string;title:string;slug:string;idempotencyKey?:string}):Promise<unknown>|unknown;
|
|
51
|
+
readPage(identity:CmsIdentity,pageId:string):Promise<CmsDocument|null>|CmsDocument|null;
|
|
52
|
+
mutate(identity:CmsIdentity,args:{pageId:string;expectedVersion:number;effect:string;idempotencyKey:string|null;fingerprint:string|null;apply:(draft:CmsDocument)=>unknown}):Promise<{document:CmsDocument;result:any;duplicate:boolean}>|{document:CmsDocument;result:any;duplicate:boolean};
|
|
53
|
+
history(identity:CmsIdentity,pageId:string,limit?:number):Promise<any[]>|any[];
|
|
54
|
+
getRevision(identity:CmsIdentity,pageId:string,version:number):Promise<CmsDocument|null>|CmsDocument|null;
|
|
55
|
+
getPublication(identity:CmsIdentity,pageId:string,version?:number|null):Promise<unknown>|unknown;
|
|
56
|
+
};
|
|
57
|
+
export type CmsOperationContract = {
|
|
58
|
+
name:string; capability:string; effect:string; description:string;
|
|
59
|
+
input_schema:CmsJsonSchema; output_schema:CmsJsonSchema;
|
|
60
|
+
};
|
|
61
|
+
export type CmsOperation = {
|
|
62
|
+
id:string; input_schema:CmsJsonSchema; output_schema:CmsJsonSchema;
|
|
63
|
+
model_visible?:boolean; aliasFor?:string;
|
|
64
|
+
handler:(input:Record<string,unknown>,context?:unknown)=>Promise<Record<string,unknown>>;
|
|
65
|
+
[key:string]:unknown;
|
|
66
|
+
};
|
|
67
|
+
export type CmsMachineOptions = {
|
|
68
|
+
defineSamOperation:(definition:Record<string,unknown>)=>CmsOperation;
|
|
69
|
+
repository:CmsRepository;
|
|
70
|
+
definitions?:CmsDefinition[];
|
|
71
|
+
resolveTrustedContext:(context?:unknown)=>Promise<CmsIdentity|null>|CmsIdentity|null;
|
|
72
|
+
authorize:(request:CmsAuthorization)=>Promise<boolean|{allow:boolean;publicationApproved?:boolean}>|boolean|{allow:boolean;publicationApproved?:boolean};
|
|
73
|
+
createId?:()=>string;
|
|
74
|
+
includeCompatibilityAliases?:boolean;
|
|
75
|
+
};
|
|
76
|
+
export declare const CMS_OPERATION_CONTRACTS: ReadonlyArray<CmsOperationContract>;
|
|
77
|
+
export declare const CMS_CONTRACTS_BY_NAME: ReadonlyMap<string,CmsOperationContract>;
|
|
78
|
+
export declare const CMS_COMPATIBILITY_ALIASES: ReadonlyArray<{name:string;canonical:string;input_schema:CmsJsonSchema}>;
|
|
79
|
+
export declare function createCmsOperations(options:CmsMachineOptions):ReadonlyArray<CmsOperation>;
|
|
80
|
+
export declare function validateCmsSchema(value:unknown,schema:CmsJsonSchema,at?:string):void;
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Full portable SAM CMS machine. Host provides repository, definitions and IAM
|
|
3
|
+
* authorization. No ecommerce UI, global seed or D1 binding dependency.
|
|
4
|
+
*/
|
|
5
|
+
import { CMS_OPERATION_CONTRACTS } from './contracts.js';
|
|
6
|
+
import { createCmsCompatibilityOperations } from './aliases.js';
|
|
7
|
+
|
|
8
|
+
const fail = (code,details={}) => {throw Object.assign(new Error(code),{code,...details});};
|
|
9
|
+
const clone = value => structuredClone(value);
|
|
10
|
+
const sha = async value => {
|
|
11
|
+
const data = new TextEncoder().encode(JSON.stringify(value));
|
|
12
|
+
const bytes = new Uint8Array(await crypto.subtle.digest('SHA-256',data));
|
|
13
|
+
return Array.from(bytes,byte=>byte.toString(16).padStart(2,'0')).join('');
|
|
14
|
+
};
|
|
15
|
+
const identityValid = value => value && typeof value.accountId==='string' && value.accountId
|
|
16
|
+
&& typeof value.installationId==='string' && value.installationId
|
|
17
|
+
&& typeof value.actorId==='string' && value.actorId;
|
|
18
|
+
const isObject = value => value!==null && typeof value==='object' && !Array.isArray(value);
|
|
19
|
+
|
|
20
|
+
function assertSchema(value, schema, at='input') {
|
|
21
|
+
if (!schema) return;
|
|
22
|
+
const type=schema.type;
|
|
23
|
+
const ok=type==='object' ? isObject(value)
|
|
24
|
+
:type==='array' ? Array.isArray(value)
|
|
25
|
+
:type==='integer' ? Number.isInteger(value)
|
|
26
|
+
:type==='number' ? typeof value==='number' && Number.isFinite(value)
|
|
27
|
+
:type ? typeof value===type : true;
|
|
28
|
+
if(!ok) fail('cms_schema_invalid_type',{field:at});
|
|
29
|
+
if(schema.const!==undefined && value!==schema.const) fail('cms_schema_invalid_const',{field:at});
|
|
30
|
+
if(schema.enum && !schema.enum.includes(value)) fail('cms_schema_invalid_choice',{field:at});
|
|
31
|
+
if(typeof value==='string') {
|
|
32
|
+
if(schema.minLength!==undefined && value.length<schema.minLength) fail('cms_schema_string_short',{field:at});
|
|
33
|
+
if(schema.maxLength!==undefined && value.length>schema.maxLength) fail('cms_schema_string_long',{field:at});
|
|
34
|
+
if(schema.pattern && !(new RegExp(schema.pattern).test(value))) fail('cms_schema_string_pattern',{field:at});
|
|
35
|
+
}
|
|
36
|
+
if(typeof value==='number') {
|
|
37
|
+
if(schema.minimum!==undefined && value<schema.minimum) fail('cms_schema_number_low',{field:at});
|
|
38
|
+
if(schema.maximum!==undefined && value>schema.maximum) fail('cms_schema_number_high',{field:at});
|
|
39
|
+
}
|
|
40
|
+
if(isObject(value)) {
|
|
41
|
+
if(schema.minProperties!==undefined && Object.keys(value).length<schema.minProperties) fail('cms_schema_empty_patch',{field:at});
|
|
42
|
+
for(const required of schema.required||[]) if(!Object.hasOwn(value,required)) fail('cms_schema_required',{field:at+'.'+required});
|
|
43
|
+
for(const [k,v] of Object.entries(value)) {
|
|
44
|
+
if(['__proto__','constructor','prototype'].includes(k)) fail('cms_unsafe_setting_key',{field:at+'.'+k});
|
|
45
|
+
const property = schema.properties?.[k];
|
|
46
|
+
if(property) assertSchema(v,property,at+'.'+k);
|
|
47
|
+
else if(schema.additionalProperties===false) fail('cms_schema_unknown_field',{field:at+'.'+k});
|
|
48
|
+
else if(isObject(schema.additionalProperties)) assertSchema(v,schema.additionalProperties,at+'.'+k);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
if(Array.isArray(value)) {
|
|
52
|
+
if(schema.minItems!==undefined && value.length<schema.minItems) fail('cms_schema_array_short',{field:at});
|
|
53
|
+
if(schema.maxItems!==undefined && value.length>schema.maxItems) fail('cms_schema_array_long',{field:at});
|
|
54
|
+
if(schema.items) value.forEach((item,index)=>assertSchema(item,schema.items,at+'['+index+']'));
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
export {assertSchema as validateCmsSchema};
|
|
58
|
+
function findComponent(page,id) {
|
|
59
|
+
for(const [index,section] of page.sections.entries()) {
|
|
60
|
+
if(section.id===id) return {parent:page,items:page.sections,index,node:section,kind:'section'};
|
|
61
|
+
for(const [blockIndex,block] of section.blocks.entries()) {
|
|
62
|
+
if(block.id===id) return {parent:section,items:section.blocks,index:blockIndex,node:block,kind:'block'};
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
fail('cms_component_not_found',{componentId:id});
|
|
66
|
+
}
|
|
67
|
+
function defFor(definitions,kind,key) {
|
|
68
|
+
const def=definitions.find(d=>d.key===key&&d.kind===kind&&d.status!=='disabled');
|
|
69
|
+
if(!def) fail('cms_definition_not_installed',{definitionKey:key,kind});
|
|
70
|
+
return def;
|
|
71
|
+
}
|
|
72
|
+
function validateSettings(def,settings) {
|
|
73
|
+
assertSchema(settings,def.settings_schema||{type:'object',additionalProperties:false},'settings');
|
|
74
|
+
return clone(settings);
|
|
75
|
+
}
|
|
76
|
+
function visibleDocument(page) {
|
|
77
|
+
const {dedupe,createKey,...publicPage}=page;
|
|
78
|
+
return clone(publicPage);
|
|
79
|
+
}
|
|
80
|
+
function snapshotResource(page,id) {
|
|
81
|
+
return id?findComponent(page,id).node:page;
|
|
82
|
+
}
|
|
83
|
+
const updated = async (page,extra={})=>({ok:true,pageId:page.id,version:page.version,digest:await sha({...page,dedupe:{}}),...extra});
|
|
84
|
+
|
|
85
|
+
export function createCmsOperations({defineSamOperation,repository,definitions=[],resolveTrustedContext,authorize,createId=()=>crypto.randomUUID(),includeCompatibilityAliases=true}={}) {
|
|
86
|
+
if(typeof defineSamOperation!=='function') throw new TypeError('cms_defineSamOperation_required');
|
|
87
|
+
for(const key of ['createPage','readPage','mutate','history','getRevision','getPublication']) {
|
|
88
|
+
if(typeof repository?.[key]!=='function') throw new TypeError('cms_repository_missing_'+key);
|
|
89
|
+
}
|
|
90
|
+
if(typeof resolveTrustedContext!=='function'||typeof authorize!=='function') throw new TypeError('cms_trusted_host_required');
|
|
91
|
+
if(!Array.isArray(definitions)) throw new TypeError('cms_definitions_array_required');
|
|
92
|
+
const seen=new Set();
|
|
93
|
+
for(const def of definitions) {
|
|
94
|
+
if(!['section','block'].includes(def.kind)||!def.key||!def.settings_schema) fail('cms_definition_invalid');
|
|
95
|
+
if(seen.has(def.kind+':'+def.key)) fail('cms_definition_duplicate');
|
|
96
|
+
seen.add(def.kind+':'+def.key);
|
|
97
|
+
}
|
|
98
|
+
const schemaFor = name => CMS_OPERATION_CONTRACTS.find(c=>c.name===name);
|
|
99
|
+
const operations = CMS_OPERATION_CONTRACTS.map(contract => defineSamOperation({
|
|
100
|
+
id:contract.name,version:1,module:'cms',action:contract.name.slice(4),
|
|
101
|
+
summary:contract.description,description:contract.description,
|
|
102
|
+
capabilities:[contract.capability],input_schema:contract.input_schema,
|
|
103
|
+
output_schema:contract.output_schema,
|
|
104
|
+
risk:contract.effect==='read'?'read_only':contract.effect==='live_publish'?'privileged':'write',
|
|
105
|
+
execution:{lanes:['platform','local'],model:'never',network:'optional',
|
|
106
|
+
sideEffects:contract.effect==='read'?'none':'remote_write'},
|
|
107
|
+
async handler(input={},sdkContext={}) {
|
|
108
|
+
assertSchema(input,contract.input_schema);
|
|
109
|
+
const actor=await resolveTrustedContext(sdkContext);
|
|
110
|
+
if(!identityValid(actor)) fail('cms_trusted_identity_required');
|
|
111
|
+
const decision=await authorize({operation:contract.name,requestedAlias:sdkContext.requestedAlias||null,capability:contract.capability,effect:contract.effect,identity:actor,
|
|
112
|
+
resource:{pageId:input.pageId||null,componentId:input.componentId||null},input});
|
|
113
|
+
if(decision!==true && decision?.allow!==true) fail('cms_operation_not_authorized');
|
|
114
|
+
// A model-provided confirmation boolean is not permission to publish.
|
|
115
|
+
// Hosts must record explicit approval through their trusted policy layer.
|
|
116
|
+
if(contract.effect==='live_publish' && decision?.publicationApproved!==true)
|
|
117
|
+
fail('cms_publish_approval_required');
|
|
118
|
+
if(contract.name==='cms.definition.list') {
|
|
119
|
+
return {ok:true,definitions:definitions.filter(d=>(!input.kind||d.kind===input.kind)&&(!input.key||d.key===input.key)&&(!input.status||d.status===input.status)).map(clone)};
|
|
120
|
+
}
|
|
121
|
+
if(contract.name==='cms.page.createDraft') {
|
|
122
|
+
const saved=await repository.createPage(actor,input);
|
|
123
|
+
return {ok:true,pageId:saved.document.id,version:saved.document.version,published:false,idempotent:saved.duplicate};
|
|
124
|
+
}
|
|
125
|
+
const page=await repository.readPage(actor,input.pageId);
|
|
126
|
+
if(!page) fail('cms_page_not_found');
|
|
127
|
+
if(contract.name==='cms.resource.inspect') {
|
|
128
|
+
return {ok:true,page:visibleDocument(page),resource:input.componentId?clone(snapshotResource(page,input.componentId)):visibleDocument(page)};
|
|
129
|
+
}
|
|
130
|
+
if(contract.name==='cms.revision.history') return {ok:true,pageId:page.id,revisions:await repository.history(actor,page.id,input.limit||30)};
|
|
131
|
+
if(contract.name==='cms.page.preview') {
|
|
132
|
+
return {ok:true,pageId:page.id,version:page.version,document:visibleDocument(page),digest:await sha({...page,dedupe:{}}),published:false};
|
|
133
|
+
}
|
|
134
|
+
if(contract.name==='cms.component.update' && !Object.keys(input.patch).length) fail('cms_empty_settings_patch');
|
|
135
|
+
const operation=contract.name;
|
|
136
|
+
// Resolve the authorized historical version outside the synchronous CAS.
|
|
137
|
+
// The transaction still verifies the current draft version atomically.
|
|
138
|
+
const restoreSnapshot=operation==='cms.revision.restore'
|
|
139
|
+
? await repository.getRevision(actor,input.pageId,input.revision) : null;
|
|
140
|
+
if(operation==='cms.revision.restore' && !restoreSnapshot) fail('cms_revision_not_found');
|
|
141
|
+
const fingerprint=await sha({name:operation,input});
|
|
142
|
+
const publishDigest=operation==='cms.page.publish'?await sha({...page,dedupe:{}}):null;
|
|
143
|
+
const mutation = await repository.mutate(actor,{
|
|
144
|
+
pageId:input.pageId,expectedVersion:input.expectedVersion,effect:contract.effect,
|
|
145
|
+
idempotencyKey:input.idempotencyKey||null,fingerprint,
|
|
146
|
+
apply(draft) {
|
|
147
|
+
if(operation==='cms.component.create') {
|
|
148
|
+
const definition=defFor(definitions,input.kind,input.definitionKey);
|
|
149
|
+
let items=draft.sections;
|
|
150
|
+
if(input.kind==='block'){
|
|
151
|
+
if(!input.parentId) fail('cms_block_parent_required');
|
|
152
|
+
const parent=findComponent(draft,input.parentId);
|
|
153
|
+
if(parent.kind!=='section') fail('cms_block_parent_must_be_section');
|
|
154
|
+
const parentDef=defFor(definitions,'section',parent.node.definitionKey);
|
|
155
|
+
if(parentDef.allowedBlocks && !parentDef.allowedBlocks.includes(input.definitionKey)) fail('cms_block_not_allowed_by_parent');
|
|
156
|
+
items=parent.node.blocks;
|
|
157
|
+
} else if(input.parentId) fail('cms_section_cannot_have_parent');
|
|
158
|
+
const node={id:'cmp_'+createId().replaceAll('-',''),kind:input.kind,definitionKey:definition.key,
|
|
159
|
+
settings:validateSettings(definition,input.settings||{}),visible:true,
|
|
160
|
+
...(input.kind==='section'?{blocks:[]}:{})};
|
|
161
|
+
const pos=input.position??items.length;
|
|
162
|
+
if(pos>items.length) fail('cms_index_out_of_bounds');
|
|
163
|
+
items.splice(pos,0,node);
|
|
164
|
+
return {componentId:node.id};
|
|
165
|
+
}
|
|
166
|
+
if(operation==='cms.revision.restore'){
|
|
167
|
+
// Resolved before entering synchronous transaction by helper below.
|
|
168
|
+
if(!restoreSnapshot) fail('cms_revision_not_found');
|
|
169
|
+
draft.sections=clone(restoreSnapshot.sections);
|
|
170
|
+
draft.title=restoreSnapshot.title;draft.slug=restoreSnapshot.slug;
|
|
171
|
+
return {restoredFrom:input.revision,published:false};
|
|
172
|
+
}
|
|
173
|
+
if(operation==='cms.page.publish'){
|
|
174
|
+
if(input.confirmation!==true) fail('cms_publish_requires_confirmation');
|
|
175
|
+
draft.publishedVersion=input.expectedVersion;
|
|
176
|
+
return {publishedVersion:input.expectedVersion,digest:publishDigest};
|
|
177
|
+
}
|
|
178
|
+
const found=findComponent(draft,input.componentId);
|
|
179
|
+
const node=found.node;
|
|
180
|
+
if(operation==='cms.component.update'){
|
|
181
|
+
const definition=defFor(definitions,found.kind,node.definitionKey);
|
|
182
|
+
// A settings patch cannot modify code, renderer or definition provenance.
|
|
183
|
+
node.settings=validateSettings(definition,{...node.settings,...input.patch});
|
|
184
|
+
} else if(operation==='cms.component.duplicate'){
|
|
185
|
+
const duplicate=clone(node);
|
|
186
|
+
const rekey=part=>{
|
|
187
|
+
part.id='cmp_'+createId().replaceAll('-','');
|
|
188
|
+
for(const child of part.blocks||[]) rekey(child);
|
|
189
|
+
};
|
|
190
|
+
rekey(duplicate);
|
|
191
|
+
found.items.splice(found.index+1,0,duplicate);
|
|
192
|
+
return {componentId:duplicate.id};
|
|
193
|
+
} else if(operation==='cms.component.remove'){
|
|
194
|
+
found.items.splice(found.index,1);
|
|
195
|
+
return {componentId:input.componentId,removed:true};
|
|
196
|
+
} else if(operation==='cms.component.visibility'){
|
|
197
|
+
node.visible=input.visible;
|
|
198
|
+
return {componentId:input.componentId,visible:input.visible};
|
|
199
|
+
} else if(operation==='cms.component.reorder'){
|
|
200
|
+
if(input.targetIndex>=found.items.length) fail('cms_index_out_of_bounds');
|
|
201
|
+
found.items.splice(found.index,1);
|
|
202
|
+
found.items.splice(input.targetIndex,0,node);
|
|
203
|
+
} else fail('cms_operation_not_implemented');
|
|
204
|
+
return {componentId:input.componentId};
|
|
205
|
+
},
|
|
206
|
+
});
|
|
207
|
+
const doc=mutation.document;
|
|
208
|
+
return await updated(doc,{...mutation.result,idempotent:mutation.duplicate});
|
|
209
|
+
},
|
|
210
|
+
}));
|
|
211
|
+
for (const [index, op] of operations.entries()) {
|
|
212
|
+
const original=op.handler;
|
|
213
|
+
const schema=CMS_OPERATION_CONTRACTS[index].output_schema;
|
|
214
|
+
operations[index]=defineSamOperation({...op,async handler(input,context) {
|
|
215
|
+
const output=await original(input,context);
|
|
216
|
+
assertSchema(output,schema,'output');
|
|
217
|
+
return output;
|
|
218
|
+
}});
|
|
219
|
+
}
|
|
220
|
+
return Object.freeze(includeCompatibilityAliases? [...operations,...createCmsCompatibilityOperations(operations,defineSamOperation)] : operations);
|
|
221
|
+
}
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Transactional local Node adapter using the existing @inneranimalmedia/cms-runtime
|
|
3
|
+
* SQLite v1 schema. No sam_cms_* tables or alternate CMS storage authority.
|
|
4
|
+
*
|
|
5
|
+
* The schema is pinned verbatim as a distributable snapshot; SDK tests assert
|
|
6
|
+
* byte-for-byte correspondence with packages/cms-runtime.
|
|
7
|
+
*/
|
|
8
|
+
import { createHash } from 'node:crypto';
|
|
9
|
+
import { mkdir, readFile } from 'node:fs/promises';
|
|
10
|
+
import path from 'node:path';
|
|
11
|
+
|
|
12
|
+
const serialize=JSON.stringify;
|
|
13
|
+
const parse=JSON.parse;
|
|
14
|
+
const digest=x=>createHash('sha256').update(serialize(x)).digest('hex');
|
|
15
|
+
const physicalSite=ctx=>'site_'+digest([ctx.accountId,ctx.installationId]).slice(0,32);
|
|
16
|
+
const physicalPage=(ctx,id)=>'page_'+digest([ctx.accountId,ctx.installationId,id]).slice(0,32);
|
|
17
|
+
const revId=(type,phys,version)=>type+'_'+phys+'_'+String(version).padStart(12,'0');
|
|
18
|
+
const identity=ctx=>{
|
|
19
|
+
if(!ctx?.actorId||!ctx?.accountId||!ctx?.installationId) throw new Error('cms_trusted_identity_required');
|
|
20
|
+
return ctx;
|
|
21
|
+
};
|
|
22
|
+
export async function createNodeSqliteCmsRepository({filename}={}) {
|
|
23
|
+
if(!filename||!path.isAbsolute(filename)) throw new Error('cms_absolute_database_path_required');
|
|
24
|
+
await mkdir(path.dirname(filename),{recursive:true});
|
|
25
|
+
const {DatabaseSync}=await import('node:sqlite');
|
|
26
|
+
const db=new DatabaseSync(filename);
|
|
27
|
+
db.exec('PRAGMA journal_mode=WAL; PRAGMA busy_timeout=5000; PRAGMA foreign_keys=ON;');
|
|
28
|
+
const schema=await readFile(new URL('./schema/cms-local-runtime.v1.sql',import.meta.url),'utf8');
|
|
29
|
+
db.exec(schema);
|
|
30
|
+
|
|
31
|
+
const readDraft=db.prepare("SELECT snapshot_json FROM cms_revisions WHERE page_id=? AND kind='draft' ORDER BY id DESC LIMIT 1");
|
|
32
|
+
const readRevision=db.prepare("SELECT snapshot_json FROM cms_revisions WHERE id=? AND page_id=? AND kind='draft'");
|
|
33
|
+
const addRevision=db.prepare('INSERT INTO cms_revisions(id,page_id,kind,created_at,label,snapshot_json) VALUES(?,?,?,?,?,?)');
|
|
34
|
+
const getPage=(ctx,pageId)=>{
|
|
35
|
+
identity(ctx);
|
|
36
|
+
const row=readDraft.get(physicalPage(ctx,pageId));
|
|
37
|
+
return row?parse(row.snapshot_json):null;
|
|
38
|
+
};
|
|
39
|
+
const run=fn=>{
|
|
40
|
+
db.exec('BEGIN IMMEDIATE');
|
|
41
|
+
try{const output=fn();db.exec('COMMIT');return output;}
|
|
42
|
+
catch(error){db.exec('ROLLBACK');throw error;}
|
|
43
|
+
};
|
|
44
|
+
const appendRevision=(ctx,physical,doc,effect,now)=>{
|
|
45
|
+
addRevision.run(revId('drev',physical,doc.version),physical,'draft',now,
|
|
46
|
+
serialize({version:doc.version,effect,actorId:ctx.actorId,sha256:digest(doc)}),serialize(doc));
|
|
47
|
+
};
|
|
48
|
+
const project=(ctx,physical,doc,effect)=>{
|
|
49
|
+
db.prepare('UPDATE cms_pages SET title=?,slug=?,status=? WHERE id=? AND site_id=?')
|
|
50
|
+
.run(doc.title,doc.slug,effect==='live_publish'?'published':'draft',physical,physicalSite(ctx));
|
|
51
|
+
// Keep the established content tables materialized for the ordinary CMS UI.
|
|
52
|
+
db.prepare('DELETE FROM cms_sections WHERE page_id=?').run(physical);
|
|
53
|
+
const sectionInsert=db.prepare('INSERT INTO cms_sections(id,page_id,name,type,visible,fields_json,sort_order) VALUES(?,?,?,?,?,?,?)');
|
|
54
|
+
const blockInsert=db.prepare('INSERT INTO cms_blocks(id,section_id,type,visible,data_json,sort_order) VALUES(?,?,?,?,?,?)');
|
|
55
|
+
for(const [index,section] of doc.sections.entries()){
|
|
56
|
+
const sectionId='section_'+digest([physical,section.id]).slice(0,32);
|
|
57
|
+
sectionInsert.run(sectionId,physical,section.definitionKey,section.definitionKey,
|
|
58
|
+
section.visible?1:0,serialize({...section.settings,__samComponentId:section.id}),index);
|
|
59
|
+
for(const [blockIndex,block] of (section.blocks||[]).entries()){
|
|
60
|
+
const blockId='block_'+digest([physical,block.id]).slice(0,32);
|
|
61
|
+
blockInsert.run(blockId,sectionId,block.definitionKey,block.visible?1:0,
|
|
62
|
+
serialize({...block.settings,__samComponentId:block.id}),blockIndex);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
const createPage=(ctx,{pageId,title,slug,idempotencyKey})=>{
|
|
67
|
+
identity(ctx);
|
|
68
|
+
return run(()=>{
|
|
69
|
+
const prev=getPage(ctx,pageId);
|
|
70
|
+
if(prev){
|
|
71
|
+
if(idempotencyKey&&prev.createKey===idempotencyKey&&prev.slug===slug&&prev.title===title)
|
|
72
|
+
return {document:prev,duplicate:true};
|
|
73
|
+
throw Object.assign(new Error('cms_page_already_exists'),{code:'cms_page_already_exists'});
|
|
74
|
+
}
|
|
75
|
+
const site=physicalSite(ctx),phys=physicalPage(ctx,pageId),now=new Date().toISOString();
|
|
76
|
+
db.prepare("INSERT OR IGNORE INTO cms_sites(id,name,initials) VALUES(?,'CMS Installation','CMS')").run(site);
|
|
77
|
+
db.prepare("INSERT INTO cms_pages(id,site_id,title,slug,status) VALUES(?,?,?,?,'draft')").run(phys,site,title,slug);
|
|
78
|
+
const doc={id:pageId,title,slug,version:1,sections:[],publishedVersion:null,
|
|
79
|
+
createdAt:now,updatedAt:now,createKey:idempotencyKey||null,dedupe:{}};
|
|
80
|
+
appendRevision(ctx,phys,doc,'draft_create',now);
|
|
81
|
+
return {document:doc,duplicate:false};
|
|
82
|
+
});
|
|
83
|
+
};
|
|
84
|
+
const mutate=(ctx,{pageId,expectedVersion,effect,idempotencyKey=null,fingerprint=null,apply})=>{
|
|
85
|
+
identity(ctx);
|
|
86
|
+
if(!Number.isInteger(expectedVersion)||expectedVersion<1) throw Object.assign(new Error('cms_expected_version_required'),{code:'cms_expected_version_required'});
|
|
87
|
+
return run(()=>{
|
|
88
|
+
const before=getPage(ctx,pageId);
|
|
89
|
+
if(!before) throw Object.assign(new Error('cms_page_not_found'),{code:'cms_page_not_found'});
|
|
90
|
+
if(idempotencyKey&&before.dedupe?.[idempotencyKey]){
|
|
91
|
+
const record=before.dedupe[idempotencyKey];
|
|
92
|
+
if(record.fingerprint!==fingerprint) throw Object.assign(new Error('cms_idempotency_key_conflict'),{code:'cms_idempotency_key_conflict'});
|
|
93
|
+
return {document:before,result:record.result,duplicate:true};
|
|
94
|
+
}
|
|
95
|
+
if(before.version!==expectedVersion) throw Object.assign(new Error('cms_version_conflict'),{code:'cms_version_conflict',expectedVersion,currentVersion:before.version});
|
|
96
|
+
const next=structuredClone(before),result=apply(next);
|
|
97
|
+
if(result?.then) throw new Error('cms_transaction_apply_must_be_synchronous');
|
|
98
|
+
const now=new Date().toISOString(),phys=physicalPage(ctx,pageId);
|
|
99
|
+
next.version=before.version+1;next.updatedAt=now;
|
|
100
|
+
if(idempotencyKey){
|
|
101
|
+
next.dedupe ||= {};
|
|
102
|
+
next.dedupe[idempotencyKey]={fingerprint,result:{...result,version:next.version}};
|
|
103
|
+
const keys=Object.keys(next.dedupe);
|
|
104
|
+
if(keys.length>128) for(const old of keys.slice(0,keys.length-128)) delete next.dedupe[old];
|
|
105
|
+
}
|
|
106
|
+
appendRevision(ctx,phys,next,effect,now);
|
|
107
|
+
project(ctx,phys,next,effect);
|
|
108
|
+
if(effect==='live_publish'){
|
|
109
|
+
// The live projection contains only the approved prior draft revision.
|
|
110
|
+
const publishedVersion=before.version;
|
|
111
|
+
const pubDocument={...before,dedupe:{},createKey:null};
|
|
112
|
+
const publicationId=revId('prev',phys,publishedVersion);
|
|
113
|
+
addRevision.run(publicationId,phys,'publication',now,
|
|
114
|
+
serialize({version:publishedVersion,effect,actorId:ctx.actorId,sha256:digest(pubDocument)}),serialize(pubDocument));
|
|
115
|
+
db.prepare(`INSERT INTO cms_publications(page_id,publication_id,route,revision_num,theme,sections_json,published_at,metadata_json)
|
|
116
|
+
VALUES(?,?,?,?,'default',?,?,?)
|
|
117
|
+
ON CONFLICT(page_id) DO UPDATE SET publication_id=excluded.publication_id,route=excluded.route,
|
|
118
|
+
revision_num=excluded.revision_num,sections_json=excluded.sections_json,
|
|
119
|
+
published_at=excluded.published_at,metadata_json=excluded.metadata_json`)
|
|
120
|
+
.run(phys,publicationId,pubDocument.slug,publishedVersion,serialize(pubDocument.sections),now,
|
|
121
|
+
serialize({digest:digest(pubDocument),source:'sam-cms-operation-engine'}));
|
|
122
|
+
}
|
|
123
|
+
return {document:next,result,duplicate:false};
|
|
124
|
+
});
|
|
125
|
+
};
|
|
126
|
+
const history=(ctx,pageId,limit=30)=>{
|
|
127
|
+
identity(ctx);
|
|
128
|
+
return db.prepare("SELECT label,created_at AS createdAt FROM cms_revisions WHERE page_id=? AND kind='draft' ORDER BY id DESC LIMIT ?")
|
|
129
|
+
.all(physicalPage(ctx,pageId),limit).map(row=>({...parse(row.label),createdAt:row.createdAt}));
|
|
130
|
+
};
|
|
131
|
+
const getRevision=(ctx,pageId,version)=>{
|
|
132
|
+
identity(ctx);
|
|
133
|
+
const phys=physicalPage(ctx,pageId);
|
|
134
|
+
const row=readRevision.get(revId('drev',phys,version),phys);
|
|
135
|
+
return row?parse(row.snapshot_json):null;
|
|
136
|
+
};
|
|
137
|
+
const getPublication=(ctx,pageId,version=null)=>{
|
|
138
|
+
identity(ctx);
|
|
139
|
+
const phys=physicalPage(ctx,pageId);
|
|
140
|
+
const row=version==null
|
|
141
|
+
? db.prepare("SELECT snapshot_json FROM cms_revisions WHERE page_id=? AND kind='publication' ORDER BY id DESC LIMIT 1").get(phys)
|
|
142
|
+
: db.prepare("SELECT snapshot_json FROM cms_revisions WHERE id=? AND page_id=? AND kind='publication'").get(revId('prev',phys,version),phys);
|
|
143
|
+
if(!row) return null;
|
|
144
|
+
const document=parse(row.snapshot_json);
|
|
145
|
+
return {document,version:document.version,digest:digest(document)};
|
|
146
|
+
};
|
|
147
|
+
return Object.freeze({createPage,readPage:getPage,mutate,history,getRevision,getPublication,close:()=>db.close(),digest});
|
|
148
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { CmsRepository, CmsIdentity, CmsDocument } from './index.js';
|
|
2
|
+
export type NodeSqliteCmsRepository = CmsRepository & {
|
|
3
|
+
close:()=>void;
|
|
4
|
+
digest:(value:unknown)=>string;
|
|
5
|
+
getPublication:(identity:CmsIdentity,pageId:string,version?:number|null)=>{document:CmsDocument;version:number;digest:string}|null;
|
|
6
|
+
};
|
|
7
|
+
export declare function createNodeSqliteCmsRepository(options:{filename:string}):Promise<NodeSqliteCmsRepository>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { createNodeSqliteCmsRepository } from './node-sqlite-repository.js';
|