@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,288 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Portable CAD project v2: project authority and verifiable deliverable *intents*.
|
|
3
|
+
* Does not implement or impersonate a native CAD engine, professional seal,
|
|
4
|
+
* identity, asset store, queue or GOAP machinery.
|
|
5
|
+
*/
|
|
6
|
+
import { requireValidProject } from './project-contract.js';
|
|
7
|
+
|
|
8
|
+
export const CAD_PROJECT_V2 = 'cad.project.v2';
|
|
9
|
+
export const CAD_DOMAINS = Object.freeze([
|
|
10
|
+
'architecture.building', 'mechanical.part', 'mechanical.assembly',
|
|
11
|
+
'product.design', 'site.landscape', 'general.cad',
|
|
12
|
+
]);
|
|
13
|
+
export const CAD_UNITS = Object.freeze(['in', 'mm', 'cm', 'm', 'ft']);
|
|
14
|
+
const unitsPerInch = Object.freeze({in: 1, mm: 25.4, cm: 2.54, m: 0.0254, ft: 1 / 12});
|
|
15
|
+
const isRecord = value => value !== null && typeof value === 'object' && !Array.isArray(value);
|
|
16
|
+
const isId = value => typeof value === 'string' && /^[A-Za-z0-9][A-Za-z0-9_.:-]{0,159}$/.test(value);
|
|
17
|
+
const isSha = value => typeof value === 'string' && /^[a-f0-9]{64}$/.test(value);
|
|
18
|
+
const validUri = value => typeof value === 'string' && value.length > 0 && !/^javascript:/i.test(value);
|
|
19
|
+
const groupsV1 = ['walls', 'rooms', 'doors', 'windows', 'furniture', 'annotations'];
|
|
20
|
+
const states = new Set(['planned', 'queued', 'running', 'generated', 'validated', 'approved', 'stale', 'failed', 'blocked']);
|
|
21
|
+
const profiles = Object.freeze({
|
|
22
|
+
'architecture.building': 'architecture',
|
|
23
|
+
'mechanical.part': 'mechanical',
|
|
24
|
+
'mechanical.assembly': 'mechanical',
|
|
25
|
+
'site.landscape': 'landscape',
|
|
26
|
+
'product.design': 'product',
|
|
27
|
+
});
|
|
28
|
+
export const resolveCadDomainModule = domain => profiles[domain] ?? null;
|
|
29
|
+
|
|
30
|
+
/** Metadata is not an execution or authorization grant. */
|
|
31
|
+
export function validateCadProjectV2(project) {
|
|
32
|
+
const errors = [];
|
|
33
|
+
if (!isRecord(project)) return { valid: false, errors: ['project_required'] };
|
|
34
|
+
if (project.schema !== CAD_PROJECT_V2) errors.push('schema_must_be_cad.project.v2');
|
|
35
|
+
if (!isId(project.id) || !project.name || typeof project.name !== 'string') errors.push('invalid_project_identity');
|
|
36
|
+
if (!CAD_DOMAINS.includes(project.domain)) errors.push('unsupported_cad_domain');
|
|
37
|
+
if (!isRecord(project.coordinateSystem)
|
|
38
|
+
|| !CAD_UNITS.includes(project.coordinateSystem.unit)
|
|
39
|
+
|| project.coordinateSystem.upAxis !== 'Z'
|
|
40
|
+
|| project.coordinateSystem.handedness !== 'right'
|
|
41
|
+
|| !Array.isArray(project.coordinateSystem.origin)
|
|
42
|
+
|| project.coordinateSystem.origin.length !== 3
|
|
43
|
+
|| !project.coordinateSystem.origin.every(n => typeof n === 'number' && Number.isFinite(n))) {
|
|
44
|
+
errors.push('invalid_coordinate_system');
|
|
45
|
+
}
|
|
46
|
+
if (!isRecord(project.geometry) || !Array.isArray(project.geometry.entities)
|
|
47
|
+
|| !Array.isArray(project.geometry.relationships) || !Array.isArray(project.geometry.constraints)) {
|
|
48
|
+
errors.push('geometry_collections_required');
|
|
49
|
+
}
|
|
50
|
+
const elementIds = new Set();
|
|
51
|
+
for (const e of project.geometry?.entities ?? []) {
|
|
52
|
+
if (!isRecord(e) || !isId(e.id) || !e.kind || elementIds.has(e.id)) errors.push('invalid_or_duplicate_geometry_id');
|
|
53
|
+
else elementIds.add(e.id);
|
|
54
|
+
}
|
|
55
|
+
for (const relation of project.geometry?.relationships ?? []) {
|
|
56
|
+
if (!isRecord(relation) || !isId(relation.id) || !elementIds.has(relation.from) || !elementIds.has(relation.to))
|
|
57
|
+
errors.push('invalid_geometry_relationship');
|
|
58
|
+
}
|
|
59
|
+
if (!isRecord(project.modules)) errors.push('domain_modules_required');
|
|
60
|
+
const requiredModule = resolveCadDomainModule(project.domain);
|
|
61
|
+
if (requiredModule && !isRecord(project.modules?.[requiredModule])) errors.push('domain_module_required:' + requiredModule);
|
|
62
|
+
if (project.domain === 'architecture.building' && isRecord(project.modules?.architecture)) {
|
|
63
|
+
const a = project.modules.architecture;
|
|
64
|
+
if (!isRecord(a.site) || !Array.isArray(a.spaces) || !Array.isArray(a.openings)
|
|
65
|
+
|| !(Array.isArray(a.walls) || Array.isArray(a.wings)))
|
|
66
|
+
errors.push('architecture_site_spaces_openings_and_massing_required');
|
|
67
|
+
}
|
|
68
|
+
for (const key of ['assets', 'views', 'sheets', 'scenes', 'productions', 'outputs', 'packages', 'receipts', 'revisions']) {
|
|
69
|
+
if (!Array.isArray(project[key])) errors.push(key + '_array_required');
|
|
70
|
+
}
|
|
71
|
+
const assetIds = new Set();
|
|
72
|
+
for (const asset of project.assets ?? []) {
|
|
73
|
+
if (!isRecord(asset) || !isId(asset.id) || assetIds.has(asset.id)
|
|
74
|
+
|| !['reference', 'source', 'derived', 'published'].includes(asset.role))
|
|
75
|
+
errors.push('invalid_asset_record');
|
|
76
|
+
else assetIds.add(asset.id);
|
|
77
|
+
if (asset?.status === 'available' && (!validUri(asset.uri) || !isSha(asset.sha256)))
|
|
78
|
+
errors.push('available_asset_requires_uri_and_sha256:' + asset?.id);
|
|
79
|
+
}
|
|
80
|
+
const outputIds = new Set();
|
|
81
|
+
for (const output of project.outputs ?? []) {
|
|
82
|
+
if (!isRecord(output) || !isId(output.id) || outputIds.has(output.id)
|
|
83
|
+
|| !isId(output.capability) || !states.has(output.state)
|
|
84
|
+
|| !Array.isArray(output.dependencies)) errors.push('invalid_output_contract:' + output?.id);
|
|
85
|
+
else outputIds.add(output.id);
|
|
86
|
+
if (['generated', 'validated', 'approved'].includes(output?.state)
|
|
87
|
+
&& (!isRecord(output.artifact) || !validUri(output.artifact.uri)
|
|
88
|
+
|| !isSha(output.artifact.sha256) || !isId(output.receiptId)
|
|
89
|
+
|| output.sourceRevision !== project.revision
|
|
90
|
+
|| !(project.receipts ?? []).some(r => r?.id === output.receiptId
|
|
91
|
+
&& r.outputId === output.id && r.artifactSha256 === output.artifact?.sha256
|
|
92
|
+
&& r.sourceRevision === output.sourceRevision)))
|
|
93
|
+
errors.push('unverified_generated_output:' + output?.id);
|
|
94
|
+
}
|
|
95
|
+
for (const output of project.outputs ?? []) {
|
|
96
|
+
for (const id of output?.dependencies ?? []) if (!outputIds.has(id) || id === output.id)
|
|
97
|
+
errors.push('invalid_output_dependency:' + output?.id);
|
|
98
|
+
}
|
|
99
|
+
// Detect cycles; do not promise a schedulable plan from a cyclic graph.
|
|
100
|
+
const edges = new Map((project.outputs ?? []).map(o => [o.id, o.dependencies ?? []]));
|
|
101
|
+
const visiting = new Set(), visited = new Set();
|
|
102
|
+
const visit = id => {
|
|
103
|
+
if (visiting.has(id)) { errors.push('cyclic_output_dependencies:' + id); return; }
|
|
104
|
+
if (visited.has(id)) return;
|
|
105
|
+
visiting.add(id);
|
|
106
|
+
for (const dep of edges.get(id) ?? []) if (edges.has(dep)) visit(dep);
|
|
107
|
+
visiting.delete(id); visited.add(id);
|
|
108
|
+
};
|
|
109
|
+
for (const id of edges.keys()) visit(id);
|
|
110
|
+
for (const pkg of project.packages ?? []) {
|
|
111
|
+
if (!isId(pkg?.id) || !Array.isArray(pkg.outputIds) || pkg.outputIds.some(id => !outputIds.has(id)))
|
|
112
|
+
errors.push('invalid_delivery_package:' + pkg?.id);
|
|
113
|
+
if (pkg?.permitReady === true || pkg?.sealed === true)
|
|
114
|
+
errors.push('unverified_legal_assertion:' + pkg?.id);
|
|
115
|
+
}
|
|
116
|
+
if (!Number.isSafeInteger(project.revision) || project.revision < 1) errors.push('revision_must_be_positive_integer');
|
|
117
|
+
if (!isRecord(project.professionalReview) || project.professionalReview.permitReady !== false
|
|
118
|
+
|| project.professionalReview.sealed !== false) errors.push('professional_review_defaults_required');
|
|
119
|
+
return { valid: errors.length === 0, errors };
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
export function requireCadProjectV2(project) {
|
|
123
|
+
const result = validateCadProjectV2(project);
|
|
124
|
+
if (!result.valid) throw new Error(result.errors.join('; '));
|
|
125
|
+
return project;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
export function createCadProjectV2({ id, name, domain, unit = 'in', revision = 1,
|
|
129
|
+
geometry = { entities: [], relationships: [], constraints: [] }, modules = {},
|
|
130
|
+
compatibility = null } = {}) {
|
|
131
|
+
const project = {
|
|
132
|
+
schema: CAD_PROJECT_V2, id, name, domain, revision,
|
|
133
|
+
coordinateSystem: { unit, upAxis: 'Z', handedness: 'right', origin: [0, 0, 0] },
|
|
134
|
+
geometry: structuredClone(geometry), modules: structuredClone(modules),
|
|
135
|
+
intent: { references: [], decisions: [], assumptions: [] },
|
|
136
|
+
assets: [], views: [], sheets: [], scenes: [], productions: [],
|
|
137
|
+
outputs: [], packages: [], receipts: [], revisions: [],
|
|
138
|
+
execution: { jobs: [], providerPreferences: [] },
|
|
139
|
+
professionalReview: { permitReady: false, sealed: false, issues: [], reviews: [] },
|
|
140
|
+
...(compatibility ? { compatibility: structuredClone(compatibility) } : {}),
|
|
141
|
+
};
|
|
142
|
+
return requireCadProjectV2(project);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
export function convertCadCoordinate(value, fromUnit, toUnit) {
|
|
146
|
+
if (!CAD_UNITS.includes(fromUnit) || !CAD_UNITS.includes(toUnit)
|
|
147
|
+
|| typeof value !== 'number' || !Number.isFinite(value))
|
|
148
|
+
throw new Error('invalid_coordinate_conversion');
|
|
149
|
+
return value / unitsPerInch[fromUnit] * unitsPerInch[toUnit];
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/** Lossless editable-source adapter; original arrays remain reversible. */
|
|
153
|
+
export function normalizeCadV1(project) {
|
|
154
|
+
requireValidProject(project);
|
|
155
|
+
const entities = groupsV1.flatMap(group => project[group].map(item => ({
|
|
156
|
+
id: item.id, kind: group === 'furniture' ? 'fixture' : group.slice(0, -1),
|
|
157
|
+
sourceGroup: group, data: structuredClone(item),
|
|
158
|
+
})));
|
|
159
|
+
for (const item of project.parametricObjects ?? []) {
|
|
160
|
+
entities.push({ id: item.id, kind: 'parametric', sourceGroup: 'parametricObjects', data: structuredClone(item) });
|
|
161
|
+
}
|
|
162
|
+
const unit = project.units === 'in' || project.units == null ? 'in' : project.units;
|
|
163
|
+
if (unit !== 'in') throw new Error('v1_geometry_must_be_in_inches');
|
|
164
|
+
return createCadProjectV2({
|
|
165
|
+
id: project.id, name: project.name, domain: 'architecture.building', unit: 'in',
|
|
166
|
+
geometry: { entities, relationships: [], constraints: [] },
|
|
167
|
+
modules: { architecture: {
|
|
168
|
+
site: {}, spaces: structuredClone(project.rooms), walls: structuredClone(project.walls),
|
|
169
|
+
openings: structuredClone([...project.doors, ...project.windows]), roofs: [],
|
|
170
|
+
} },
|
|
171
|
+
compatibility: { sourceSchema: 'cad.project.v1', sourceDocument: structuredClone(project),
|
|
172
|
+
sourceScale: 1, migration: 'lossless_editable_source' },
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
export function restoreCadV1FromV2(project) {
|
|
177
|
+
requireCadProjectV2(project);
|
|
178
|
+
if (project.compatibility?.sourceSchema !== 'cad.project.v1'
|
|
179
|
+
|| !isRecord(project.compatibility.sourceDocument))
|
|
180
|
+
throw new Error('not_a_v1_compatibility_project');
|
|
181
|
+
const original = structuredClone(project.compatibility.sourceDocument);
|
|
182
|
+
for (const group of [...groupsV1, 'parametricObjects']) {
|
|
183
|
+
const updated = project.geometry.entities.filter(e => e.sourceGroup === group).map(e => structuredClone(e.data));
|
|
184
|
+
if (group === 'parametricObjects' && !Array.isArray(original[group]) && updated.length === 0) continue;
|
|
185
|
+
original[group] = updated;
|
|
186
|
+
}
|
|
187
|
+
requireValidProject(original);
|
|
188
|
+
return original;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
/** The locked DreamHouse source is an *architectural profile*, never the universal schema. */
|
|
192
|
+
export function normalizeArchitecturalSource(source) {
|
|
193
|
+
if (!isRecord(source) || source.schema !== CAD_PROJECT_V2 || !isId(source.id)
|
|
194
|
+
|| !Array.isArray(source.rooms) || !Array.isArray(source.openings)
|
|
195
|
+
|| !Array.isArray(source.wings) || !isRecord(source.site))
|
|
196
|
+
throw new Error('incompatible_architectural_source');
|
|
197
|
+
const spaces = source.rooms.map(room => structuredClone(room));
|
|
198
|
+
const entities = [];
|
|
199
|
+
for (const [group, collection] of [['rooms', source.rooms], ['wings', source.wings],
|
|
200
|
+
['openings', source.openings], ['roofs', source.roofs ?? []],
|
|
201
|
+
['elements', source.elements ?? []]]) {
|
|
202
|
+
for (const item of collection) if (isId(item?.id))
|
|
203
|
+
entities.push({ id: group + ':' + item.id, kind: group, sourceGroup: group, data: structuredClone(item) });
|
|
204
|
+
}
|
|
205
|
+
return createCadProjectV2({
|
|
206
|
+
id: source.id, name: source.name, domain: 'architecture.building',
|
|
207
|
+
geometry: { entities, relationships: [], constraints: [] },
|
|
208
|
+
modules: { architecture: { site: structuredClone(source.site),
|
|
209
|
+
spaces, wings: structuredClone(source.wings), openings: structuredClone(source.openings),
|
|
210
|
+
roofs: structuredClone(source.roofs ?? []), structure: structuredClone(source.structure ?? {}),
|
|
211
|
+
ifcMap: structuredClone(source.ifcMap ?? {}) } },
|
|
212
|
+
compatibility: { sourceSchema: 'cad.project.v2.architecture.sd02',
|
|
213
|
+
sourceDocument: structuredClone(source), migration: 'non_destructive_profile_adapter' },
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
/** A source revision change must never leave old media falsely marked current. */
|
|
218
|
+
export function invalidateCadOutputs(project, changedElementIds, nextRevision) {
|
|
219
|
+
requireCadProjectV2(project);
|
|
220
|
+
if (!Number.isSafeInteger(nextRevision) || nextRevision <= project.revision) throw new Error('next_revision_required');
|
|
221
|
+
const changed = new Set(changedElementIds);
|
|
222
|
+
const next = structuredClone(project);
|
|
223
|
+
const affected = new Set();
|
|
224
|
+
for (const output of next.outputs) {
|
|
225
|
+
const deps = output.elementIds ?? [];
|
|
226
|
+
if (changed.has('*') || deps.includes('*') || deps.some(id => changed.has(id)) || deps.length === 0) affected.add(output.id);
|
|
227
|
+
}
|
|
228
|
+
let previousSize;
|
|
229
|
+
do {
|
|
230
|
+
previousSize = affected.size;
|
|
231
|
+
for (const output of next.outputs) if (output.dependencies.some(id => affected.has(id)))
|
|
232
|
+
affected.add(output.id);
|
|
233
|
+
} while (affected.size !== previousSize);
|
|
234
|
+
for (const output of next.outputs) if (affected.has(output.id) && !['failed', 'blocked', 'planned'].includes(output.state))
|
|
235
|
+
output.state = 'stale';
|
|
236
|
+
next.revision = nextRevision;
|
|
237
|
+
requireCadProjectV2(next);
|
|
238
|
+
return { project: next, affectedOutputIds: [...affected] };
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
export function completeCadOutput(project, outputId, { artifact, receiptId, provider, providerVersion } = {}) {
|
|
242
|
+
requireCadProjectV2(project);
|
|
243
|
+
if (!validUri(artifact?.uri) || !isSha(artifact?.sha256)
|
|
244
|
+
|| !isId(receiptId) || !provider || !providerVersion)
|
|
245
|
+
throw new Error('verified_artifact_and_executor_receipt_required');
|
|
246
|
+
const next = structuredClone(project);
|
|
247
|
+
const output = next.outputs.find(x => x.id === outputId);
|
|
248
|
+
if (!output) throw new Error('unknown_output');
|
|
249
|
+
if (output.dependencies.some(id => !['generated', 'validated', 'approved'].includes(next.outputs.find(x => x.id === id)?.state)))
|
|
250
|
+
throw new Error('output_dependencies_not_complete');
|
|
251
|
+
output.artifact = structuredClone(artifact);
|
|
252
|
+
output.receiptId = receiptId;
|
|
253
|
+
output.executor = { provider, version: providerVersion };
|
|
254
|
+
output.sourceRevision = next.revision;
|
|
255
|
+
output.state = 'generated';
|
|
256
|
+
next.receipts.push({ id: receiptId, outputId, provider, providerVersion, sourceRevision: next.revision, artifactSha256: artifact.sha256 });
|
|
257
|
+
requireCadProjectV2(next);
|
|
258
|
+
return next;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
/** Increment a model revision and invalidate all downstream artifacts atomically. */
|
|
262
|
+
export function updateCadGeometryEntity(project, id, updatedData, nextRevision) {
|
|
263
|
+
requireCadProjectV2(project);
|
|
264
|
+
const source = project.geometry.entities.find(e => e.id === id);
|
|
265
|
+
if (!source || !isRecord(updatedData) || updatedData.id !== source.data?.id)
|
|
266
|
+
throw new Error('cad_geometry_edit_requires_matching_source_identity');
|
|
267
|
+
const next = structuredClone(project);
|
|
268
|
+
const entity = next.geometry.entities.find(e => e.id === id);
|
|
269
|
+
entity.data = structuredClone(updatedData);
|
|
270
|
+
// Preserve reversibility of the legacy adapter and avoid stale architectural projection data.
|
|
271
|
+
const restored = invalidateCadOutputs(next, [id], nextRevision);
|
|
272
|
+
if (restored.project.compatibility?.sourceSchema === 'cad.project.v1') {
|
|
273
|
+
const group = entity.sourceGroup;
|
|
274
|
+
const original = restored.project.compatibility.sourceDocument[group] ?? [];
|
|
275
|
+
const index = original.findIndex(e => e.id === updatedData.id);
|
|
276
|
+
if (index < 0) throw new Error('cad_edit_source_link_missing');
|
|
277
|
+
original[index] = structuredClone(updatedData);
|
|
278
|
+
if (group === 'rooms') restored.project.modules.architecture.spaces = structuredClone(original);
|
|
279
|
+
if (group === 'walls') restored.project.modules.architecture.walls = structuredClone(original);
|
|
280
|
+
if (group === 'doors' || group === 'windows')
|
|
281
|
+
restored.project.modules.architecture.openings = [
|
|
282
|
+
...restored.project.compatibility.sourceDocument.doors,
|
|
283
|
+
...restored.project.compatibility.sourceDocument.windows,
|
|
284
|
+
].map(x => structuredClone(x));
|
|
285
|
+
}
|
|
286
|
+
requireCadProjectV2(restored.project);
|
|
287
|
+
return restored;
|
|
288
|
+
}
|
package/src/lib/cad-docker.js
CHANGED
|
@@ -6,12 +6,20 @@ import { fileURLToPath } from 'node:url';
|
|
|
6
6
|
const sdkRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../..');
|
|
7
7
|
const CAD_SERVER_FILE = 'services/cad/server.py';
|
|
8
8
|
|
|
9
|
-
export const CAD_TOOLS = Object.freeze(['openscad', 'freecad', 'blender']);
|
|
9
|
+
export const CAD_TOOLS = Object.freeze(['openscad', 'freecad', 'blender', 'ifc', 'media', 'occt']);
|
|
10
|
+
|
|
11
|
+
// Pinned so every build, on any machine, gets the same toolchain. ifcopenshell 0.9.x wheels need a newer
|
|
12
|
+
// glibc than Debian 12 ships; 0.8.4.post1 is the newest that imports on bookworm. The distro Node is too
|
|
13
|
+
// old for current glTF tooling, so Node is installed from a checksum-verified tarball.
|
|
14
|
+
export const CAD_PINS = Object.freeze({ ifcopenshell: '0.8.4.post1', ezdxf: '1.4.5', gltfTransformCli: '4.5.1', node: 'v20.20.2' });
|
|
10
15
|
|
|
11
16
|
const APT_PACKAGES = Object.freeze({
|
|
12
17
|
openscad: ['openscad', 'xvfb', 'xauth'],
|
|
13
18
|
freecad: ['freecad'],
|
|
14
19
|
blender: ['blender'],
|
|
20
|
+
ifc: ['python3-venv'],
|
|
21
|
+
media: ['ffmpeg'],
|
|
22
|
+
occt: ['libocct-data-exchange-7.6', 'libocct-modeling-algorithms-7.6', 'libocct-modeling-data-7.6', 'libocct-foundation-7.6'],
|
|
15
23
|
});
|
|
16
24
|
|
|
17
25
|
export function normalizeCadTools(input) {
|
|
@@ -35,6 +43,11 @@ export function cadDefaultResources(tools) {
|
|
|
35
43
|
function runtimeDigest() {
|
|
36
44
|
const digest = createHash('sha256');
|
|
37
45
|
digest.update(CAD_SERVER_FILE).update('\0').update(fs.readFileSync(path.join(sdkRoot, CAD_SERVER_FILE))).update('\0');
|
|
46
|
+
for (const extra of ['services/cad/provision/install_node.py', 'services/cad/occt/main.cpp', 'services/cad/occt/CMakeLists.txt']) {
|
|
47
|
+
const file = path.join(sdkRoot, extra);
|
|
48
|
+
if (fs.existsSync(file)) digest.update(extra).update('\0').update(fs.readFileSync(file)).update('\0');
|
|
49
|
+
}
|
|
50
|
+
digest.update(JSON.stringify(CAD_PINS));
|
|
38
51
|
return digest.digest('hex');
|
|
39
52
|
}
|
|
40
53
|
|
|
@@ -51,10 +64,33 @@ export function generateCadDocker(opts = {}) {
|
|
|
51
64
|
const copyLines = ['COPY server.py /srv/server.py'];
|
|
52
65
|
if (tools.includes('freecad')) copyLines.push('COPY freecad/ /srv/freecad/');
|
|
53
66
|
if (tools.includes('blender')) copyLines.push('COPY blender/ /srv/blender/');
|
|
67
|
+
const provision = [];
|
|
68
|
+
if (tools.includes('ifc')) {
|
|
69
|
+
provision.push(`RUN python3 -m venv /opt/agentsam-venv \\\n && /opt/agentsam-venv/bin/pip install --no-cache-dir ifcopenshell==${CAD_PINS.ifcopenshell} ezdxf==${CAD_PINS.ezdxf}`);
|
|
70
|
+
}
|
|
71
|
+
if (tools.includes('media')) {
|
|
72
|
+
provision.push('COPY provision/install_node.py /tmp/install_node.py');
|
|
73
|
+
provision.push(`RUN python3 /tmp/install_node.py ${CAD_PINS.node} /opt/node \\\n && PATH=/opt/node/bin:$PATH npm install -g --no-audit --no-fund @gltf-transform/cli@${CAD_PINS.gltfTransformCli} \\\n && rm -rf /tmp/install_node.py /root/.npm`);
|
|
74
|
+
}
|
|
75
|
+
if (tools.includes('occt')) provision.push('COPY --from=occt-build /build/agentsam-occt /usr/local/bin/agentsam-occt');
|
|
76
|
+
const extraEnv = [
|
|
77
|
+
tools.includes('media') ? 'PATH=/opt/node/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin' : '',
|
|
78
|
+
tools.includes('ifc') ? 'AGENTSAM_CAD_PYTHON=/opt/agentsam-venv/bin/python' : '',
|
|
79
|
+
].filter(Boolean);
|
|
80
|
+
const occtStage = tools.includes('occt') ? `FROM debian:bookworm-slim AS occt-build
|
|
81
|
+
ENV DEBIAN_FRONTEND=noninteractive
|
|
82
|
+
RUN apt-get update \\
|
|
83
|
+
&& apt-get install -y --no-install-recommends ca-certificates g++ cmake ninja-build libocct-data-exchange-dev libocct-modeling-algorithms-dev libocct-modeling-data-dev libocct-foundation-dev \\
|
|
84
|
+
&& rm -rf /var/lib/apt/lists/*
|
|
85
|
+
COPY occt/ /src/occt/
|
|
86
|
+
RUN cmake -S /src/occt -B /build -G Ninja -DCMAKE_BUILD_TYPE=Release -DAGENTSAM_OCCT_PREFIX=/usr -DAGENTSAM_OCCT_LIBDIR=/usr/lib/$(gcc -dumpmachine) \\
|
|
87
|
+
&& cmake --build /build
|
|
88
|
+
|
|
89
|
+
` : '';
|
|
54
90
|
|
|
55
91
|
const dockerfile = `# AgentSam CAD runtime SHA-256: ${runtimeDigest()}
|
|
56
92
|
# Tools: ${tools.join(', ')}
|
|
57
|
-
FROM debian:bookworm-slim
|
|
93
|
+
${occtStage}FROM debian:bookworm-slim
|
|
58
94
|
ENV DEBIAN_FRONTEND=noninteractive
|
|
59
95
|
RUN apt-get update \\
|
|
60
96
|
&& apt-get install -y --no-install-recommends ${packages.join(' ')} \\
|
|
@@ -62,9 +98,9 @@ RUN apt-get update \\
|
|
|
62
98
|
&& useradd --system --uid 10001 --create-home --home-dir /home/cad cad \\
|
|
63
99
|
&& mkdir -p /srv /work \\
|
|
64
100
|
&& chown -R cad:cad /work
|
|
65
|
-
WORKDIR /srv
|
|
101
|
+
${provision.length ? provision.join('\n') + '\n' : ''}WORKDIR /srv
|
|
66
102
|
${copyLines.join('\n')}
|
|
67
|
-
ENV PORT=${port} AGENTSAM_CAD_TOKEN_FILE=/config/service.token AGENTSAM_CAD_WORK_ROOT=/work AGENTSAM_CAD_TOOLS=${tools.join(',')} QT_QPA_PLATFORM=offscreen PYTHONUNBUFFERED=1 HOME=/tmp/home XDG_CACHE_HOME=/tmp/cache XDG_CONFIG_HOME=/tmp/config
|
|
103
|
+
ENV${extraEnv.length ? ' ' + extraEnv.join(' ') : ''} PORT=${port} AGENTSAM_CAD_TOKEN_FILE=/config/service.token AGENTSAM_CAD_WORK_ROOT=/work AGENTSAM_CAD_TOOLS=${tools.join(',')} QT_QPA_PLATFORM=offscreen PYTHONUNBUFFERED=1 HOME=/tmp/home XDG_CACHE_HOME=/tmp/cache XDG_CONFIG_HOME=/tmp/config
|
|
68
104
|
EXPOSE ${port}
|
|
69
105
|
USER cad
|
|
70
106
|
HEALTHCHECK --interval=15s --timeout=5s --start-period=20s --retries=4 CMD python3 -c "import urllib.request; urllib.request.urlopen('http://127.0.0.1:${port}/healthz', timeout=3).read()"
|
|
@@ -144,6 +180,14 @@ export function stageCadContext(versionDir, opts = {}) {
|
|
|
144
180
|
fs.copyFileSync(freecadAdapter, path.join(context, 'freecad', 'adapter.py'));
|
|
145
181
|
}
|
|
146
182
|
}
|
|
183
|
+
if (tools.includes('media')) {
|
|
184
|
+
fs.mkdirSync(path.join(context, 'provision'), { recursive: true });
|
|
185
|
+
fs.copyFileSync(path.join(sdkRoot, 'services/cad/provision/install_node.py'), path.join(context, 'provision', 'install_node.py'));
|
|
186
|
+
}
|
|
187
|
+
if (tools.includes('occt')) {
|
|
188
|
+
fs.mkdirSync(path.join(context, 'occt'), { recursive: true });
|
|
189
|
+
for (const file of ['main.cpp', 'CMakeLists.txt']) fs.copyFileSync(path.join(sdkRoot, 'services/cad/occt', file), path.join(context, 'occt', file));
|
|
190
|
+
}
|
|
147
191
|
if (tools.includes('blender')) {
|
|
148
192
|
const blenderAdapter = path.join(sdkRoot, 'services/cad/blender/adapter.py');
|
|
149
193
|
if (fs.existsSync(blenderAdapter)) {
|
package/src/lib/dockerize.js
CHANGED
|
@@ -298,7 +298,7 @@ export async function stopDockerContainer(name) {
|
|
|
298
298
|
*/
|
|
299
299
|
export async function replaceManagedContainer(name, expectedType) {
|
|
300
300
|
const inspect = await runCommand('docker', [
|
|
301
|
-
'inspect',
|
|
301
|
+
'container', 'inspect',
|
|
302
302
|
'--format', '{{json .Config.Labels}}',
|
|
303
303
|
name,
|
|
304
304
|
]);
|
|
@@ -415,7 +415,7 @@ export async function dockerize(targetDir, appType, opts = {}) {
|
|
|
415
415
|
const plan = buildDockerDeployPlan(appType, opts);
|
|
416
416
|
const isolatedContext = knowledge || cad;
|
|
417
417
|
const written = writeDockerFileSet(targetDir, plan.files, plan.hash, { overwrite: opts.overwrite, isolatedContext });
|
|
418
|
-
const buildContext = knowledge ? stageKnowledgeContext(written.versionDir) : cad ? stageCadContext(written.versionDir) : targetDir;
|
|
418
|
+
const buildContext = knowledge ? stageKnowledgeContext(written.versionDir) : cad ? stageCadContext(written.versionDir, opts) : targetDir;
|
|
419
419
|
const manifest = writeManifestEntry(targetDir, plan.hash, {
|
|
420
420
|
appType,
|
|
421
421
|
appSlug: plan.slug,
|
|
@@ -521,7 +521,7 @@ export async function dockerize(targetDir, appType, opts = {}) {
|
|
|
521
521
|
hashtag: plan.hashtag,
|
|
522
522
|
repo: opts.repoLabel || path.basename(targetDir),
|
|
523
523
|
ref: plan.imageTag,
|
|
524
|
-
note: `agentsam dockerize --type ${appType} --port ${plan.hostPort}
|
|
524
|
+
note: `agentsam dockerize --type ${appType} --port ${plan.hostPort}`,
|
|
525
525
|
});
|
|
526
526
|
}
|
|
527
527
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { createHash } from 'node:crypto';
|
|
1
2
|
import fs from 'node:fs';
|
|
2
3
|
import os from 'node:os';
|
|
3
4
|
import path from 'node:path';
|
|
@@ -29,12 +30,37 @@ function writeStore(store, options = {}) {
|
|
|
29
30
|
fs.renameSync(temp, filename);
|
|
30
31
|
}
|
|
31
32
|
|
|
33
|
+
// A saved grant must never authorize a different file, resource, script,
|
|
34
|
+
// or command argument. Canonicalize input so JSON property order is immaterial.
|
|
35
|
+
function canonical(value) {
|
|
36
|
+
if(Array.isArray(value))return value.map(canonical);
|
|
37
|
+
if(value&&typeof value==='object'){
|
|
38
|
+
return Object.fromEntries(Object.keys(value).sort().map(k=>[k,canonical(value[k])]));
|
|
39
|
+
}
|
|
40
|
+
return value;
|
|
41
|
+
}
|
|
42
|
+
function exactKey(id,input) {
|
|
43
|
+
const payload=JSON.stringify(canonical(input??{}));
|
|
44
|
+
const digest=createHash('sha256').update(payload).digest('hex').slice(0,24);
|
|
45
|
+
return `${id}:${digest}`;
|
|
46
|
+
}
|
|
47
|
+
|
|
32
48
|
export function toolApprovalKey(capabilityId, input = {}) {
|
|
33
49
|
const id = clean(capabilityId);
|
|
34
50
|
const command = clean(input?.command);
|
|
35
|
-
if (id === 'cloudflare.wrangler.native' && /^[A-Za-z0-9._-]+$/.test(command)
|
|
36
|
-
|
|
37
|
-
|
|
51
|
+
if (id === 'cloudflare.wrangler.native' && /^[A-Za-z0-9._-]+$/.test(command) &&
|
|
52
|
+
Object.keys(input??{}).every(k=>k==='command'))return `${id}:${command}`;
|
|
53
|
+
if (id === 'terminal.exec' && /^[A-Za-z0-9._+-]+$/.test(command) &&
|
|
54
|
+
Object.keys(input??{}).every(k=>k==='command'))return `${id}:${command}`;
|
|
55
|
+
if (id === 'sam.superbash') {
|
|
56
|
+
// Always-allow applies to one script/artifact and relative cwd, not
|
|
57
|
+
// to arbitrary future shell commands.
|
|
58
|
+
const source = typeof input?.script === 'string' ? input.script : String(input?.scriptArtifactRef || '');
|
|
59
|
+
const cwd = String(input?.relativeCwd || '.');
|
|
60
|
+
const digest = createHash('sha256').update(source + '\0' + cwd).digest('hex').slice(0, 24);
|
|
61
|
+
return 'sam.superbash:' + digest;
|
|
62
|
+
}
|
|
63
|
+
return exactKey(id,input);
|
|
38
64
|
}
|
|
39
65
|
|
|
40
66
|
export function isExecutionApproved({ cwd, key }, options = {}) {
|
|
@@ -104,6 +104,11 @@ export function isAllowedStudioOrigin(origin, extra = []) {
|
|
|
104
104
|
'http://localhost:5173',
|
|
105
105
|
'http://127.0.0.1:3000',
|
|
106
106
|
'http://localhost:3000',
|
|
107
|
+
'https://agentsam.inneranimalmedia.com',
|
|
108
|
+
'tauri://localhost',
|
|
109
|
+
'http://tauri.localhost',
|
|
110
|
+
'https://tauri.localhost',
|
|
111
|
+
...(process.env.AGENTSAM_LOCAL_STUDIO_ORIGINS || '').split(',').map(value => value.trim()).filter(Boolean),
|
|
107
112
|
...extra,
|
|
108
113
|
];
|
|
109
114
|
return allow.includes(origin);
|
package/src/local-pty/server.js
CHANGED
|
@@ -16,6 +16,7 @@ import { WebSocketServer } from 'ws';
|
|
|
16
16
|
import { createLocalFilesystem } from '../local-fs/index.js';
|
|
17
17
|
import { resolveContainedPath } from '../local-fs/paths.js';
|
|
18
18
|
import { getRepositoryFreshness } from '../local-fs/freshness.js';
|
|
19
|
+
import { LspHost } from '../local-lsp/host.js';
|
|
19
20
|
import {
|
|
20
21
|
mintWorkspaceCapability,
|
|
21
22
|
writeLocalRuntimeRecord,
|
|
@@ -214,6 +215,7 @@ export async function startLocalPtyServer(opts = {}) {
|
|
|
214
215
|
}
|
|
215
216
|
const shell = opts.shell || shellForPlatform();
|
|
216
217
|
const filesystem = createLocalFilesystem(cwd);
|
|
218
|
+
const lspHost = new LspHost({ root: cwd });
|
|
217
219
|
// Capability minted after bind so port is known; provisional id first.
|
|
218
220
|
/** @type {ReturnType<typeof mintWorkspaceCapability>|null} */
|
|
219
221
|
let capability = null;
|
|
@@ -301,6 +303,24 @@ export async function startLocalPtyServer(opts = {}) {
|
|
|
301
303
|
});
|
|
302
304
|
}
|
|
303
305
|
|
|
306
|
+
// Workspace-scoped LSP process host. No command/path strings are accepted
|
|
307
|
+
// from the browser; installed server binaries are selected by language.
|
|
308
|
+
if (pathname.startsWith('/v1/lsp/')) {
|
|
309
|
+
if (!requireCapability(req, res, capability)) return;
|
|
310
|
+
if (origin && !isAllowedStudioOrigin(origin)) return sendJson(req,res,403,{ok:false,error:'origin_not_allowed'});
|
|
311
|
+
try {
|
|
312
|
+
const action=pathname.slice('/v1/lsp/'.length);
|
|
313
|
+
if(req.method==='GET' && action==='capabilities') return sendJson(req,res,200,{ok:true,adapter:'node-stdio',languages:lspHost.capabilities()});
|
|
314
|
+
if(req.method==='GET' && action==='poll') return sendJson(req,res,200,lspHost.poll(url.searchParams.get('session_id'),Number(url.searchParams.get('after')||0)));
|
|
315
|
+
if(req.method!=='POST') return sendJson(req,res,405,{ok:false,error:'method_not_allowed'});
|
|
316
|
+
const body=await readJsonBody(req);
|
|
317
|
+
if(action==='start') return sendJson(req,res,200,lspHost.start(body.language));
|
|
318
|
+
if(action==='send') return sendJson(req,res,200,lspHost.send(body.session_id,body.message));
|
|
319
|
+
if(action==='stop') return sendJson(req,res,200,lspHost.stop(body.session_id));
|
|
320
|
+
return sendJson(req,res,404,{ok:false,error:'unknown_lsp_action'});
|
|
321
|
+
} catch(error) {return sendJson(req,res,500,{ok:false,error:error.message});}
|
|
322
|
+
}
|
|
323
|
+
|
|
304
324
|
if (pathname === '/v1/freshness' && req.method === 'GET') {
|
|
305
325
|
const gate = requireCapability(req, res, capability);
|
|
306
326
|
if (!gate) return;
|
|
@@ -466,6 +486,7 @@ export async function startLocalPtyServer(opts = {}) {
|
|
|
466
486
|
bootstrapUrl: `http://${host}:${boundPort}/v1/workspace/bootstrap`,
|
|
467
487
|
close: () =>
|
|
468
488
|
new Promise((resolve, reject) => {
|
|
489
|
+
lspHost.close();
|
|
469
490
|
wss.close(() => {
|
|
470
491
|
httpServer.close((err) => (err ? reject(err) : resolve()));
|
|
471
492
|
});
|
package/src/mcp/client.js
CHANGED
|
@@ -127,7 +127,8 @@ export async function pingMcpServer(serverConfig = {}, options = {}) {
|
|
|
127
127
|
signal: AbortSignal.timeout(options.timeoutMs || 5000),
|
|
128
128
|
});
|
|
129
129
|
return {
|
|
130
|
-
|
|
130
|
+
// A 401/403 only proves HTTP reachability, never an authorized MCP session.
|
|
131
|
+
ok: res.ok,
|
|
131
132
|
status: res.status,
|
|
132
133
|
statusText: res.statusText,
|
|
133
134
|
latencyMs: Date.now() - startMs,
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP resource authority for AgentSam's existing IAM OAuth client.
|
|
3
|
+
* This does not replace the user account session, MCP transport, or server
|
|
4
|
+
* grant policy. The MCP bearer must be scoped to this resource.
|
|
5
|
+
*/
|
|
6
|
+
import { readMcpServer, writeMcpServer } from './authority.js';
|
|
7
|
+
import { refreshNativeOAuthToken } from '../lib/auth.js';
|
|
8
|
+
|
|
9
|
+
export const IAM_MCP_RESOURCE = 'https://mcp.inneranimalmedia.com/mcp';
|
|
10
|
+
export const IAM_MCP_SCOPE = 'openid profile email offline_access iam:profile iam:workspaces mcp:tools mcp:userinfo';
|
|
11
|
+
export const IAM_MCP_WRITE_SCOPE = IAM_MCP_SCOPE + ' iam:agent';
|
|
12
|
+
export const IAM_MCP_SERVER = 'inneranimalmedia';
|
|
13
|
+
|
|
14
|
+
export class McpResourceError extends Error {
|
|
15
|
+
constructor(code, next = 'agentsam mcp connect inneranimalmedia') {
|
|
16
|
+
super(code);
|
|
17
|
+
this.name = 'McpResourceError';
|
|
18
|
+
this.code = code;
|
|
19
|
+
this.next = next;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const clean = value => String(value || '').trim();
|
|
24
|
+
export const mcpOAuthHasWriteScope = server => server?.auth?.type !== 'oauth' ||
|
|
25
|
+
clean(server?.auth?.scope).split(/\s+/).includes('iam:agent');
|
|
26
|
+
|
|
27
|
+
export function mcpConnectionStatus(server, { nowMs = Date.now() } = {}) {
|
|
28
|
+
const next = 'agentsam mcp connect inneranimalmedia';
|
|
29
|
+
if (!server) return { available: false, reason: 'mcp_d1_connection_not_configured', next };
|
|
30
|
+
if (clean(server.name) !== IAM_MCP_SERVER || server.url !== IAM_MCP_RESOURCE) {
|
|
31
|
+
return { available: false, reason: 'mcp_d1_server_mismatch', next };
|
|
32
|
+
}
|
|
33
|
+
const auth = server.auth;
|
|
34
|
+
if (!clean(auth?.token)) return { available: false, reason: 'mcp_d1_oauth_not_connected', next };
|
|
35
|
+
if (auth.type === 'oauth') {
|
|
36
|
+
if (auth.resource !== IAM_MCP_RESOURCE) {
|
|
37
|
+
return { available: false, reason: 'mcp_d1_oauth_wrong_audience', next };
|
|
38
|
+
}
|
|
39
|
+
if (!clean(auth.scope).split(/\s+/).includes('mcp:tools')) {
|
|
40
|
+
return { available: false, reason: 'mcp_d1_oauth_scope_missing', next };
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
const expiry = Date.parse(auth.expires_at || '');
|
|
44
|
+
if (Number.isFinite(expiry) && expiry <= nowMs + 60_000 && !auth.refresh_token) {
|
|
45
|
+
return { available: false, reason: 'mcp_d1_oauth_session_expired', next };
|
|
46
|
+
}
|
|
47
|
+
return { available: true, readiness: 'unverified', reason: 'mcp_d1_connection_not_probed', next: 'agentsam mcp doctor inneranimalmedia --json' };
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export function describeMcpServer(server, options = {}) {
|
|
51
|
+
const state = mcpConnectionStatus(server, options);
|
|
52
|
+
return {
|
|
53
|
+
name: server?.name || IAM_MCP_SERVER,
|
|
54
|
+
url: server?.url || IAM_MCP_RESOURCE,
|
|
55
|
+
configured: Boolean(server),
|
|
56
|
+
authenticated: Boolean(server?.auth?.token),
|
|
57
|
+
refreshable: Boolean(server?.auth?.refresh_token),
|
|
58
|
+
write_scope_granted: Boolean(server?.auth?.token) && mcpOAuthHasWriteScope(server),
|
|
59
|
+
expires_at: server?.auth?.expires_at || null,
|
|
60
|
+
...state,
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/** Resolve a bearer immediately before network execution, refreshing the
|
|
65
|
+
* existing separately stored MCP grant without leaking credentials to a model.
|
|
66
|
+
*/
|
|
67
|
+
export async function resolveMcpResourceServer({
|
|
68
|
+
home, refresh = refreshNativeOAuthToken, nowMs = Date.now(),
|
|
69
|
+
} = {}) {
|
|
70
|
+
let server = readMcpServer(IAM_MCP_SERVER, home ? { home } : {});
|
|
71
|
+
const initial = mcpConnectionStatus(server, { nowMs });
|
|
72
|
+
if (!initial.available) {
|
|
73
|
+
const error = new Error(initial.reason);
|
|
74
|
+
error.code = initial.reason;
|
|
75
|
+
error.next = initial.next;
|
|
76
|
+
throw error;
|
|
77
|
+
}
|
|
78
|
+
const auth = server.auth;
|
|
79
|
+
const expiry = Date.parse(auth.expires_at || '');
|
|
80
|
+
if (auth.type === 'oauth' && Number.isFinite(expiry) && expiry <= nowMs + 60_000) {
|
|
81
|
+
let tokenSet;
|
|
82
|
+
try {
|
|
83
|
+
tokenSet = await refresh({
|
|
84
|
+
home, session: {
|
|
85
|
+
client_id: auth.client_id,
|
|
86
|
+
refresh_token: auth.refresh_token,
|
|
87
|
+
},
|
|
88
|
+
resource: IAM_MCP_RESOURCE,
|
|
89
|
+
});
|
|
90
|
+
} catch {
|
|
91
|
+
const error = new Error('mcp_d1_oauth_refresh_failed');
|
|
92
|
+
error.code = 'mcp_d1_oauth_refresh_failed';
|
|
93
|
+
error.next = 'agentsam mcp connect inneranimalmedia';
|
|
94
|
+
throw error;
|
|
95
|
+
}
|
|
96
|
+
const accessToken = clean(tokenSet?.access_token);
|
|
97
|
+
if (!accessToken) throw new Error('mcp_d1_oauth_refresh_missing_token');
|
|
98
|
+
const expiryMs = Number(tokenSet.expires_in) * 1000;
|
|
99
|
+
server = writeMcpServer(IAM_MCP_SERVER, {
|
|
100
|
+
...server,
|
|
101
|
+
auth: {
|
|
102
|
+
...auth, token: accessToken,
|
|
103
|
+
refresh_token: clean(tokenSet.refresh_token) || auth.refresh_token,
|
|
104
|
+
expires_at: Number.isFinite(expiryMs) && expiryMs > 0 ? new Date(nowMs + expiryMs).toISOString() : null,
|
|
105
|
+
},
|
|
106
|
+
}, home ? { home } : {});
|
|
107
|
+
}
|
|
108
|
+
return server;
|
|
109
|
+
}
|