@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
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { isStandaloneKnowledgeQuestion } from './intent.js';
|
|
1
2
|
import { compileToolSchema, restoreOptionalArguments } from '../providers/tool-schema.js';
|
|
2
3
|
import { createHash } from 'node:crypto';
|
|
3
4
|
import path from 'node:path';
|
|
@@ -6,6 +7,7 @@ import { getModelRecord, calculateModelCost, loadModelPolicy } from '../models/i
|
|
|
6
7
|
import { searchToolCards, hydrateToolSchemas } from '../tools/index.js';
|
|
7
8
|
import { createAgentEvent } from '../telemetry/index.js';
|
|
8
9
|
import { diagnosticFromError } from '../errors/index.js';
|
|
10
|
+
import { createToolError } from '@inneranimalmedia/agentsam-errors';
|
|
9
11
|
import { runAgentSamModelTurn } from './model-turn.js';
|
|
10
12
|
import {
|
|
11
13
|
createHookedCapabilityAdapter,
|
|
@@ -76,8 +78,8 @@ const UNKNOWN_WINDOW_CONTEXT_LIMITS = Object.freeze({
|
|
|
76
78
|
maxItemChars: 16_000,
|
|
77
79
|
});
|
|
78
80
|
|
|
79
|
-
function resolveUnknownWindowContext(cwd, card, contextItems = []) {
|
|
80
|
-
const rules = compileAgentInstructions(cwd, { maxChars: UNKNOWN_WINDOW_CONTEXT_LIMITS.maxSystemChars });
|
|
81
|
+
function resolveUnknownWindowContext(cwd, card, contextItems = [], ruleOptions = {}) {
|
|
82
|
+
const rules = compileAgentInstructions(cwd, { ...ruleOptions, maxChars: UNKNOWN_WINDOW_CONTEXT_LIMITS.maxSystemChars });
|
|
81
83
|
let remainingEvidenceChars = UNKNOWN_WINDOW_CONTEXT_LIMITS.maxEvidenceChars;
|
|
82
84
|
const included = [{
|
|
83
85
|
kind: 'repo',
|
|
@@ -133,9 +135,22 @@ function resolveUnknownWindowContext(cwd, card, contextItems = []) {
|
|
|
133
135
|
export function buildAgentToolSurface(capabilityAdapter, objective, options = {}) {
|
|
134
136
|
if (!capabilityAdapter?.toolDescriptors) throw new TypeError('capabilityAdapter.toolDescriptors is required');
|
|
135
137
|
const catalog = capabilityAdapter.toolDescriptors({ includeUnavailable: false });
|
|
136
|
-
const
|
|
137
|
-
|
|
138
|
-
|
|
138
|
+
const maxTools = options.maxTools ?? (options.headlessCoding ? 10 : 8);
|
|
139
|
+
// These are the four bootstrap calls required for progressive, typed
|
|
140
|
+
// discovery. Keyword ranking may otherwise hide describe/status/invoke.
|
|
141
|
+
// Headless coding cannot discover source boundaries without its bounded
|
|
142
|
+
// workspace file reader. Reserve one of the advertised slots rather than
|
|
143
|
+
// letting keyword matching replace reading with a write tool.
|
|
144
|
+
const bootstrapIds = ['capability.search','capability.describe','capability.status','capability.invoke',
|
|
145
|
+
...(options.headlessCoding ? ['workspace.list','workspace.search','workspace.read','workspace.write','test.run'] : [])];
|
|
146
|
+
const bootstrap = bootstrapIds.map(id=>catalog.find(row=>row.name===id)).filter(Boolean).slice(0,maxTools);
|
|
147
|
+
const remaining = catalog.filter(row=>!bootstrapIds.includes(row.name));
|
|
148
|
+
const remainingSlots = Math.max(0,maxTools-bootstrap.length);
|
|
149
|
+
const searched = remainingSlots ? searchToolCards(remaining, objective, {
|
|
150
|
+
maxItems: remainingSlots, maxChars: options.maxCardChars ?? 24_000,
|
|
151
|
+
}) : {cards:[],receipt:{returned_items:0,chars:0}};
|
|
152
|
+
const selected = [...bootstrap.map(row=>row.name),...searched.cards.map(card=>card.tool)];
|
|
153
|
+
const hydrated = hydrateToolSchemas(catalog, selected, { maxTools, maxChars: options.maxSchemaChars ?? 40_000 });
|
|
139
154
|
const aliases = new Map();
|
|
140
155
|
const tools = hydrated.tools.map((descriptor) => {
|
|
141
156
|
const alias = capabilityFunctionName(descriptor.name);
|
|
@@ -156,7 +171,7 @@ export function buildAgentToolSurface(capabilityAdapter, objective, options = {}
|
|
|
156
171
|
descriptors: Object.freeze(hydrated.tools),
|
|
157
172
|
receipt: Object.freeze({
|
|
158
173
|
catalog_tools: catalog.length,
|
|
159
|
-
cards_returned: searched.receipt.returned_items,
|
|
174
|
+
cards_returned: searched.receipt.returned_items + bootstrap.length,
|
|
160
175
|
card_chars: searched.receipt.chars,
|
|
161
176
|
hydrated_tools: hydrated.receipt.hydrated_tools,
|
|
162
177
|
hydrated_schema_chars: tools.reduce((sum, tool) => sum + JSON.stringify(tool.parameters).length, 0),
|
|
@@ -260,9 +275,14 @@ async function runAgentSamTurnCore(options = {}) {
|
|
|
260
275
|
? Object.freeze({ ...baseRecord, context_policy: Object.freeze({ ...(baseRecord.context_policy || {}), ...dynamicPolicy }) })
|
|
261
276
|
: baseRecord;
|
|
262
277
|
const budget = modelBudget(record, dynamicPolicy);
|
|
278
|
+
const generalQuestion = options.instructions == null && isStandaloneKnowledgeQuestion(objective);
|
|
279
|
+
// Hosts may supply null for strict tenant isolation, or a vetted per-user file.
|
|
280
|
+
const ruleOptions = Object.hasOwn(options, 'globalFilename') ? { globalFilename: options.globalFilename } : {};
|
|
263
281
|
let instructions;
|
|
264
282
|
let resolvedContext = null;
|
|
265
|
-
if (
|
|
283
|
+
if (generalQuestion) {
|
|
284
|
+
instructions = 'You are AgentSam. Answer this general knowledge question directly and concisely. No project context, execution tools, or persistent task are needed.';
|
|
285
|
+
} else if (options.instructions == null) {
|
|
266
286
|
const card = buildProjectCard(cwd, {
|
|
267
287
|
activeTaskId: options.activeTaskId || options.taskId,
|
|
268
288
|
lockedBy: options.lockedBy,
|
|
@@ -274,6 +294,7 @@ async function runAgentSamTurnCore(options = {}) {
|
|
|
274
294
|
cwd,
|
|
275
295
|
objective,
|
|
276
296
|
budget,
|
|
297
|
+
...ruleOptions,
|
|
277
298
|
items: [
|
|
278
299
|
{
|
|
279
300
|
kind: 'repo',
|
|
@@ -284,18 +305,31 @@ async function runAgentSamTurnCore(options = {}) {
|
|
|
284
305
|
...(options.contextItems || []),
|
|
285
306
|
],
|
|
286
307
|
})
|
|
287
|
-
: resolveUnknownWindowContext(cwd, card, options.contextItems || []);
|
|
308
|
+
: resolveUnknownWindowContext(cwd, card, options.contextItems || [], ruleOptions);
|
|
288
309
|
const cardContent = resolvedContext.items.find((i) => i.ref === 'project://card')?.content || card.content;
|
|
289
310
|
const extraContent = resolvedContext.items
|
|
290
311
|
.filter((i) => i.ref !== 'project://card')
|
|
291
312
|
.map((i) => i.content)
|
|
292
313
|
.join('\n\n');
|
|
293
314
|
const ruleContent = resolvedContext.rules?.content || '';
|
|
294
|
-
instructions = [cardContent, extraContent, ruleContent
|
|
315
|
+
instructions = [cardContent, extraContent, ruleContent, [
|
|
316
|
+
'REPOSITORY NAVIGATION: The project card and lockedBy field describe the current conversation workspace, not a prohibition on user-authorized Git operations.',
|
|
317
|
+
'When the user explicitly asks to work on another branch, worktree, or repository, inspect git status, git worktree list, and the destination before acting. Use approved terminal.exec with git -C <existing checkout> for targeted Git operations. Do not claim a workspace lock prevents inspection or modification.',
|
|
318
|
+
'A branch already checked out by another worktree must be operated on from that worktree, not switched into this checkout. Do not force a checkout, discard uncommitted changes, or remove a worktree. If no safe checkout exists, use git worktree add only with appropriate authorization.',
|
|
319
|
+
'The session cwd does not automatically change when git -C targets another checkout; describe that honestly. For edits requiring an alternate project-root capability, use an explicitly supported workspace/session selection and never imply terminal.exec changed the active project root.',
|
|
320
|
+
'Respect individual tool approval and permission checks for writes, commits, and pushes. If a tool is unavailable or denied, describe that concrete limitation rather than inventing a blanket repository boundary.'
|
|
321
|
+
].join('\n')].filter(Boolean).join('\n\n');
|
|
295
322
|
} else {
|
|
296
323
|
instructions = String(options.instructions);
|
|
297
324
|
}
|
|
298
|
-
const toolSurface =
|
|
325
|
+
const toolSurface = generalQuestion
|
|
326
|
+
? Object.freeze({
|
|
327
|
+
tools: Object.freeze([]), aliases: new Map(), descriptors: Object.freeze([]),
|
|
328
|
+
receipt: Object.freeze({ catalog_tools: 0, cards_returned: 0, card_chars: 0,
|
|
329
|
+
hydrated_tools: 0, hydrated_schema_chars: 0, deferred_tools: Object.freeze([]),
|
|
330
|
+
skipped_reason: 'general_knowledge_question' }),
|
|
331
|
+
})
|
|
332
|
+
: buildAgentToolSurface(options.capabilityAdapter, objective, { ...options, schemaProvider: record.provider });
|
|
299
333
|
const emit = options.emit;
|
|
300
334
|
const runId = options.runId;
|
|
301
335
|
event(emit, 'tool.search', toolSurface.receipt, runId);
|
|
@@ -403,6 +437,19 @@ async function runAgentSamTurnCore(options = {}) {
|
|
|
403
437
|
for (const key of Object.keys(costBreakdownUsd)) costBreakdownUsd[key] += Number(cost?.components_usd?.[key] || 0);
|
|
404
438
|
};
|
|
405
439
|
accumulateCost(compacted?.cost);
|
|
440
|
+
if (typeof options.onPreparedTurn === 'function') {
|
|
441
|
+
await options.onPreparedTurn({
|
|
442
|
+
source: 'cli-agent', provider: record.provider, model: record.provider_model_id,
|
|
443
|
+
instructions, messages: input, tools: toolSurface.tools,
|
|
444
|
+
context_receipt: resolvedContext?.receipt || null,
|
|
445
|
+
instruction_receipt: resolvedContext?.rules ? {
|
|
446
|
+
hash: resolvedContext.rules.hash,
|
|
447
|
+
chars: resolvedContext.rules.chars,
|
|
448
|
+
budget_chars: resolvedContext.rules.budget_chars,
|
|
449
|
+
sources: resolvedContext.rules.sources,
|
|
450
|
+
} : null,
|
|
451
|
+
});
|
|
452
|
+
}
|
|
406
453
|
let response = await modelTurn({
|
|
407
454
|
provider,
|
|
408
455
|
model: record.provider_model_id,
|
|
@@ -465,8 +512,13 @@ async function runAgentSamTurnCore(options = {}) {
|
|
|
465
512
|
cwd,
|
|
466
513
|
});
|
|
467
514
|
if (approved === false) {
|
|
468
|
-
const denied =
|
|
469
|
-
|
|
515
|
+
const denied = createToolError({
|
|
516
|
+
tool: capabilityId,
|
|
517
|
+
reason: 'tool_permission_denied',
|
|
518
|
+
stage: 'authorize',
|
|
519
|
+
message: `tool_execution_not_approved:${capabilityId}`,
|
|
520
|
+
});
|
|
521
|
+
denied.legacy_code = 'AGENTSAM_TOOL_NOT_APPROVED';
|
|
470
522
|
const diagnostic = diagnosticFromError(denied, { source: 'tool', kind: 'tool_execution_denied' });
|
|
471
523
|
event(emit, 'tool.failed', { call_id: call.call_id, capability_id: capabilityId, error: diagnostic }, runId);
|
|
472
524
|
event(emit, 'error.observed', { ...diagnostic, call_id: call.call_id, capability_id: capabilityId }, runId);
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Customer-installation owned Cloudflare D1 database creation.
|
|
3
|
+
* Resolve account/token from the authenticated installation's provider
|
|
4
|
+
* connection at call time. Never accept account IDs/tokens from tool input.
|
|
5
|
+
*
|
|
6
|
+
* This is a real Cloudflare REST provisioning adapter; actual live creation
|
|
7
|
+
* requires a host to connect its customer Cloudflare credential resolver.
|
|
8
|
+
*/
|
|
9
|
+
const fail = (code,message) => Object.assign(new Error(message||code),{code});
|
|
10
|
+
const ID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
11
|
+
const ACCOUNT_ID = /^[0-9a-f]{32}$/i;
|
|
12
|
+
export function createCloudflareD1Provisioner({resolveAccountForInstallation,fetchImpl=globalThis.fetch}={}) {
|
|
13
|
+
if(typeof resolveAccountForInstallation!=='function')throw new TypeError('d1_installation_account_resolver_required');
|
|
14
|
+
if(typeof fetchImpl!=='function')throw new TypeError('d1_fetch_required');
|
|
15
|
+
return async function provisionD1({name,confirm_name,jurisdiction,installation}={}) {
|
|
16
|
+
if(!installation?.installationId||!installation?.actorId)
|
|
17
|
+
throw fail('d1_authenticated_installation_required');
|
|
18
|
+
if(typeof name!=='string'|| !/^[a-z][a-z0-9-]{0,63}$/.test(name))
|
|
19
|
+
throw fail('d1_name_invalid');
|
|
20
|
+
if(confirm_name!==name)throw fail('d1_create_confirmation_required');
|
|
21
|
+
if(jurisdiction!==undefined&&!['eu','fedramp'].includes(jurisdiction))
|
|
22
|
+
throw fail('d1_jurisdiction_invalid');
|
|
23
|
+
// The host determines account and credential; arguments do not supply them.
|
|
24
|
+
const account=await resolveAccountForInstallation(installation);
|
|
25
|
+
if(!account || !ACCOUNT_ID.test(account.accountId||'') ||
|
|
26
|
+
typeof account.apiToken!=='string'||account.apiToken.length<12)
|
|
27
|
+
throw fail('d1_customer_cloudflare_connection_required');
|
|
28
|
+
if(account.installationId!==installation.installationId)
|
|
29
|
+
throw fail('d1_provider_installation_mismatch');
|
|
30
|
+
const url='https://api.cloudflare.com/client/v4/accounts/'+encodeURIComponent(account.accountId)+'/d1/database';
|
|
31
|
+
const response=await fetchImpl(url,{
|
|
32
|
+
method:'POST',
|
|
33
|
+
headers:{'Authorization':'Bearer '+account.apiToken,
|
|
34
|
+
'Content-Type':'application/json','Accept':'application/json'},
|
|
35
|
+
body:JSON.stringify({name,...(jurisdiction?{jurisdiction}: {})}),
|
|
36
|
+
signal:AbortSignal.timeout(30000),
|
|
37
|
+
});
|
|
38
|
+
if(!response || typeof response.json!=='function')throw fail('d1_provider_invalid_response');
|
|
39
|
+
const data=await response.json().catch(()=>null);
|
|
40
|
+
if(!response.ok || data?.success!==true)throw fail(
|
|
41
|
+
response.status===403?'d1_provider_forbidden':
|
|
42
|
+
response.status===409?'d1_name_conflict':'d1_provider_error');
|
|
43
|
+
const id=data?.result?.uuid||data?.result?.id;
|
|
44
|
+
if(!ID.test(id||''))throw fail('d1_provider_database_id_missing');
|
|
45
|
+
return {ok:true,database_id:id,name,receipt:data?.result?.uuid||null,
|
|
46
|
+
cloudflare_account_id:account.accountId};
|
|
47
|
+
};
|
|
48
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/** Existing knowledge engine, exposed with explicit runtime ownership and budgets. */
|
|
2
|
+
import fs from 'node:fs';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
import { CONFIG_PATH, readConfig, scopeKey } from '../knowledge/config.js';
|
|
5
|
+
import { openStore, runKnowledgeSearch } from '../commands/knowledge.js';
|
|
6
|
+
import { planIndex,runIndex } from '../knowledge/engine.js';
|
|
7
|
+
import { resolveContext, createContextBudget } from '../context/index.js';
|
|
8
|
+
|
|
9
|
+
function configFor(root){
|
|
10
|
+
const file=path.join(root,CONFIG_PATH);
|
|
11
|
+
if(!fs.existsSync(file))return null;
|
|
12
|
+
return readConfig(root);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export function knowledgeStatus(root){
|
|
16
|
+
const config=configFor(root);
|
|
17
|
+
if(!config)return {available:false,reason:'knowledge_not_configured',next:'agentsam init . --yes'};
|
|
18
|
+
if(config.storage.driver!=='sqlite') return {available:false,reason:'external_knowledge_host_adapter_required',driver:config.storage.driver,next:'Use the configured authorized host integration'};
|
|
19
|
+
if(config.storage.driver==='sqlite'){
|
|
20
|
+
const file=path.join(root,'.agentsam/knowledge/index.sqlite');
|
|
21
|
+
if(!fs.existsSync(file))return {available:false,reason:'knowledge_index_missing',next:'agentsam index run',driver:'sqlite'};
|
|
22
|
+
}
|
|
23
|
+
return {available:true,driver:config.storage.driver,lane:config.lane?.backend??null,embedding_provider:config.embedding?.provider??null};
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export async function knowledgeGenerationStatus(root){
|
|
27
|
+
const base=knowledgeStatus(root);
|
|
28
|
+
if(!base.available)return base;
|
|
29
|
+
const config=configFor(root);
|
|
30
|
+
if(config.storage.driver!=='sqlite')return {available:false,reason:'external_knowledge_host_adapter_required'};
|
|
31
|
+
let store;
|
|
32
|
+
try{
|
|
33
|
+
store=await openStore(root,config,true);
|
|
34
|
+
const state=await store?.scopeStatus(scopeKey(config));
|
|
35
|
+
if(state?.active_id)return {...base,active:true,generation_id:state.active_id,scope_key:scopeKey(config)};
|
|
36
|
+
return {...base,available:false,active:false,
|
|
37
|
+
reason:state?.existing_generations?'knowledge_generation_scope_mismatch':'knowledge_generation_missing',
|
|
38
|
+
existing_generations:state?.existing_generations||0,
|
|
39
|
+
next:'Inspect agentsam index history and configuration before rebuilding; use agentsam index plan'};
|
|
40
|
+
}catch(error){
|
|
41
|
+
return {...base,available:false,reason:'knowledge_store_unreadable',detail:String(error.message||error).slice(0,180)};
|
|
42
|
+
}finally{await store?.close();}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export async function knowledgeIndex(input={},root){
|
|
46
|
+
const config=configFor(root);
|
|
47
|
+
if(!config)return {ok:false,error:'knowledge_not_configured',next:'agentsam init . --yes'};
|
|
48
|
+
if(input.embed===true)return {ok:false,error:'paid_embedding_requires_separate_explicit_workflow',next:'agentsam index run --embed'};
|
|
49
|
+
// Existing local knowledge engine; no remote provider invocation or forced pipeline replacement.
|
|
50
|
+
if(config.storage.driver!=='sqlite')return {ok:false,error:'external_index_requires_host_adapter',driver:config.storage.driver};
|
|
51
|
+
const mode=input.mode||'plan';
|
|
52
|
+
if(!['plan','run','status'].includes(mode))throw new Error('knowledge_index_mode_invalid');
|
|
53
|
+
if(mode==='status')return knowledgeStatus(root);
|
|
54
|
+
const indexExists=fs.existsSync(path.join(root,'.agentsam/knowledge/index.sqlite'));
|
|
55
|
+
const store=(mode==='plan'&&!indexExists)?null:await openStore(root,config,mode!=='run');
|
|
56
|
+
try{
|
|
57
|
+
if(mode==='plan')return {ok:true,mode,receipt:(await planIndex({root,config,store,embed:false})).receipt};
|
|
58
|
+
const maxInputs=Number(input.max_inputs??100),maxCharacters=Number(input.max_characters??200000);
|
|
59
|
+
if(!Number.isInteger(maxInputs)||maxInputs<1||maxInputs>200||
|
|
60
|
+
!Number.isInteger(maxCharacters)||maxCharacters<1||maxCharacters>1000000)
|
|
61
|
+
throw new Error('knowledge_index_limits_invalid');
|
|
62
|
+
return {ok:true,mode,receipt:await runIndex({root,config,store,embed:false,maxInputs,maxCharacters})};
|
|
63
|
+
}finally{await store?.close();}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export function knowledgeSearch(input={},root){
|
|
67
|
+
const query=String(input.query||'').trim();
|
|
68
|
+
if(!query || query.length>2000)throw new Error('knowledge_query_invalid');
|
|
69
|
+
const topK=Number(input.top_k??8),tokenBudget=Number(input.token_budget??4000);
|
|
70
|
+
if(!Number.isInteger(topK)||topK<1||topK>30||!Number.isInteger(tokenBudget)||tokenBudget<128||tokenBudget>16000)
|
|
71
|
+
throw new Error('knowledge_search_budget_invalid');
|
|
72
|
+
return (async()=>{
|
|
73
|
+
const status=await knowledgeGenerationStatus(root);
|
|
74
|
+
if(!status.available)return {ok:false,error:status.reason,next:status.next||null,
|
|
75
|
+
existing_generations:status.existing_generations||0,query,hit_count:0};
|
|
76
|
+
return runKnowledgeSearch({cwd:root,query,topK,tokenBudget,semantic:false,generationId:input.generation_id||null});
|
|
77
|
+
})();
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export function contextResolve(input={}){
|
|
81
|
+
const objective=String(input.objective||'').trim();
|
|
82
|
+
const windowTokens=Number(input.window_tokens??32768);
|
|
83
|
+
if(!Number.isInteger(windowTokens)||windowTokens<4096||windowTokens>1000000)throw new Error('context_window_invalid');
|
|
84
|
+
const items=Array.isArray(input.items)?input.items:[];
|
|
85
|
+
if(items.length>80)throw new Error('context_item_limit_exceeded');
|
|
86
|
+
return resolveContext({objective,items,refs:input.refs||[],budget:createContextBudget({windowTokens})});
|
|
87
|
+
}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Local SQLite lifecycle belongs to the current installation workspace.
|
|
3
|
+
* Never substitutes for Cloudflare D1 and never reuses an operator's D1.
|
|
4
|
+
*/
|
|
5
|
+
import fs from 'node:fs';
|
|
6
|
+
import path from 'node:path';
|
|
7
|
+
import { randomUUID } from 'node:crypto';
|
|
8
|
+
import { createLocalSqliteDatabaseSync } from '../local/sqlite.js';
|
|
9
|
+
|
|
10
|
+
const VALID = /^[a-z][a-z0-9_-]{0,62}$/;
|
|
11
|
+
const fail = code => Object.assign(new Error(code),{code});
|
|
12
|
+
function location(workspaceRoot,name){
|
|
13
|
+
if(typeof name!=='string'||!VALID.test(name))throw fail('sqlite_name_invalid');
|
|
14
|
+
const root=fs.realpathSync(workspaceRoot);
|
|
15
|
+
const dir=path.join(root,'.agentsam','databases');
|
|
16
|
+
const archive=path.join(root,'.agentsam','archive','databases');
|
|
17
|
+
return {root,dir,archive,name,filename:path.join(dir,name+'.sqlite')};
|
|
18
|
+
}
|
|
19
|
+
function validateAncestors(root,target){
|
|
20
|
+
let p=target;
|
|
21
|
+
while(p!==root){
|
|
22
|
+
if(fs.existsSync(p)&&fs.lstatSync(p).isSymbolicLink())throw fail('sqlite_symlink_not_allowed');
|
|
23
|
+
p=path.dirname(p);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
function checkInput(input,allowed){
|
|
27
|
+
if(!input||typeof input!=='object'||Array.isArray(input))throw fail('sqlite_input_invalid');
|
|
28
|
+
if(Object.keys(input).some(x=>!allowed.includes(x)))throw fail('sqlite_unknown_input');
|
|
29
|
+
}
|
|
30
|
+
export function createLocalDatabase(workspaceRoot,input={}){
|
|
31
|
+
checkInput(input,['name']);
|
|
32
|
+
const loc=location(workspaceRoot,input.name);
|
|
33
|
+
validateAncestors(loc.root,loc.dir);
|
|
34
|
+
if(fs.existsSync(loc.filename))throw fail('sqlite_already_exists');
|
|
35
|
+
fs.mkdirSync(loc.dir,{recursive:true,mode:0o700});
|
|
36
|
+
// File is exclusively created before sqlite opens it. Never overwrite.
|
|
37
|
+
const fd=fs.openSync(loc.filename,'wx',0o600);
|
|
38
|
+
fs.closeSync(fd);
|
|
39
|
+
try {
|
|
40
|
+
const db=createLocalSqliteDatabaseSync(loc.filename);
|
|
41
|
+
try {db.exec('PRAGMA journal_mode=DELETE; PRAGMA user_version=1;');}
|
|
42
|
+
finally{db.close();}
|
|
43
|
+
return {schema:'agentsam.database.resource.v1',engine:'sqlite',scope:'current-workspace',
|
|
44
|
+
name:loc.name,path:path.relative(loc.root,loc.filename),created:true};
|
|
45
|
+
}catch(error){if(fs.existsSync(loc.filename))fs.unlinkSync(loc.filename);throw error;}
|
|
46
|
+
}
|
|
47
|
+
export function inspectLocalDatabase(workspaceRoot,input={}){
|
|
48
|
+
checkInput(input,['name']);
|
|
49
|
+
const loc=location(workspaceRoot,input.name);
|
|
50
|
+
validateAncestors(loc.root,loc.filename);
|
|
51
|
+
if(!fs.existsSync(loc.filename))throw fail('sqlite_not_found');
|
|
52
|
+
const stat=fs.lstatSync(loc.filename);
|
|
53
|
+
if(!stat.isFile()||stat.size>1024*1024*1024)throw fail('sqlite_resource_invalid');
|
|
54
|
+
const db=createLocalSqliteDatabaseSync(loc.filename);
|
|
55
|
+
try {
|
|
56
|
+
const check=db.prepare('PRAGMA quick_check').get();
|
|
57
|
+
const tables=db.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name NOT LIKE 'sqlite_%' ORDER BY name").all().map(x=>x.name);
|
|
58
|
+
return {schema:'agentsam.database.resource.v1',engine:'sqlite',scope:'current-workspace',
|
|
59
|
+
name:loc.name,path:path.relative(loc.root,loc.filename),bytes:stat.size,mtime_ms:stat.mtimeMs,tables,
|
|
60
|
+
integrity:Object.values(check||{})[0]};
|
|
61
|
+
}finally{db.close();}
|
|
62
|
+
}
|
|
63
|
+
export function listLocalDatabases(workspaceRoot) {
|
|
64
|
+
const root=fs.realpathSync(workspaceRoot);
|
|
65
|
+
const dir=path.join(root,'.agentsam','databases');
|
|
66
|
+
validateAncestors(root,dir);
|
|
67
|
+
if(!fs.existsSync(dir))return {schema:'agentsam.database.list.v1',databases:[]};
|
|
68
|
+
const names=fs.readdirSync(dir,{withFileTypes:true})
|
|
69
|
+
.filter(x=>x.isFile()&&x.name.endsWith('.sqlite')&&VALID.test(x.name.slice(0,-7)))
|
|
70
|
+
.map(x=>x.name.slice(0,-7)).sort();
|
|
71
|
+
return {schema:'agentsam.database.list.v1',databases:names.map(name=>({name,engine:'sqlite',scope:'current-workspace'}))};
|
|
72
|
+
}
|
|
73
|
+
export function editLocalDatabase(workspaceRoot,input={}){
|
|
74
|
+
checkInput(input,['name','new_name','expected_bytes','expected_mtime_ms']);
|
|
75
|
+
const source=location(workspaceRoot,input.name);
|
|
76
|
+
const target=location(workspaceRoot,input.new_name);
|
|
77
|
+
if(source.name===target.name)throw fail('sqlite_name_unchanged');
|
|
78
|
+
const state=inspectLocalDatabase(workspaceRoot,{name:source.name});
|
|
79
|
+
if(!Number.isInteger(input.expected_bytes) ||
|
|
80
|
+
input.expected_bytes!==state.bytes ||
|
|
81
|
+
typeof input.expected_mtime_ms!=='number' ||
|
|
82
|
+
input.expected_mtime_ms!==state.mtime_ms)
|
|
83
|
+
throw fail('sqlite_resource_conflict');
|
|
84
|
+
validateAncestors(source.root,target.filename);
|
|
85
|
+
if(fs.existsSync(target.filename))throw fail('sqlite_already_exists');
|
|
86
|
+
for(const suffix of ['-wal','-shm']){
|
|
87
|
+
if(fs.existsSync(source.filename+suffix))throw fail('sqlite_active_wal_update_denied');
|
|
88
|
+
}
|
|
89
|
+
fs.renameSync(source.filename,target.filename);
|
|
90
|
+
return {...inspectLocalDatabase(workspaceRoot,{name:target.name}),updated:true,previous_name:source.name};
|
|
91
|
+
}
|
|
92
|
+
export function deleteLocalDatabase(workspaceRoot,input={}) {
|
|
93
|
+
checkInput(input,['name','confirm_name']);
|
|
94
|
+
const loc=location(workspaceRoot,input.name);
|
|
95
|
+
if(input.confirm_name!==loc.name)throw fail('sqlite_delete_confirmation_required');
|
|
96
|
+
// integrity-check and ensure only the exact file is archived; do not remove WAL
|
|
97
|
+
// data out from under a live writer.
|
|
98
|
+
const state=inspectLocalDatabase(workspaceRoot,{name:loc.name});
|
|
99
|
+
for(const suffix of ['-wal','-shm']){
|
|
100
|
+
if(fs.existsSync(loc.filename+suffix))throw fail('sqlite_active_wal_archive_denied');
|
|
101
|
+
}
|
|
102
|
+
validateAncestors(loc.root,loc.archive);
|
|
103
|
+
fs.mkdirSync(loc.archive,{recursive:true,mode:0o700});
|
|
104
|
+
const archived=loc.name+'-'+randomUUID()+'.sqlite';
|
|
105
|
+
const dest=path.join(loc.archive,archived);
|
|
106
|
+
fs.renameSync(loc.filename,dest);
|
|
107
|
+
return {schema:'agentsam.database.archive.v1',engine:'sqlite',name:loc.name,archived:true,
|
|
108
|
+
restore_ref:path.relative(loc.root,dest),previous_bytes:state.bytes};
|
|
109
|
+
}
|
|
110
|
+
export function restoreLocalDatabase(workspaceRoot,input={}){
|
|
111
|
+
checkInput(input,['name','restore_ref']);
|
|
112
|
+
const loc=location(workspaceRoot,input.name);
|
|
113
|
+
if(typeof input.restore_ref!=='string' || !input.restore_ref.startsWith('.agentsam/archive/databases/'+loc.name+'-')||
|
|
114
|
+
!input.restore_ref.endsWith('.sqlite')||input.restore_ref.split('/').length!==4)
|
|
115
|
+
throw fail('sqlite_restore_ref_invalid');
|
|
116
|
+
const src=path.resolve(loc.root,input.restore_ref);
|
|
117
|
+
validateAncestors(loc.root,src);
|
|
118
|
+
if(!fs.existsSync(src))throw fail('sqlite_archive_not_found');
|
|
119
|
+
if(fs.existsSync(loc.filename))throw fail('sqlite_already_exists');
|
|
120
|
+
validateAncestors(loc.root,loc.dir);
|
|
121
|
+
fs.mkdirSync(loc.dir,{recursive:true,mode:0o700});
|
|
122
|
+
fs.renameSync(src,loc.filename);
|
|
123
|
+
return inspectLocalDatabase(workspaceRoot,{name:loc.name});
|
|
124
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { resolveMachineBinary, spawnMachine } from '../commands/machine-binary.js';
|
|
4
|
+
|
|
5
|
+
export function machineAvailable() {
|
|
6
|
+
return resolveMachineBinary().kind !== 'missing';
|
|
7
|
+
}
|
|
8
|
+
export function machineInspect(input={},projectRoot){
|
|
9
|
+
const root=fs.realpathSync(projectRoot);
|
|
10
|
+
const selected=path.resolve(root,input.path||'.');
|
|
11
|
+
if(selected!==root && !selected.startsWith(root+path.sep))throw new Error('machine_target_outside_workspace');
|
|
12
|
+
if(!fs.existsSync(selected))return {ok:false,error:'target_not_found',path:input.path};
|
|
13
|
+
const real=fs.realpathSync(selected);
|
|
14
|
+
if(real!==root && !real.startsWith(root+path.sep))throw new Error('machine_target_symlink_outside_workspace');
|
|
15
|
+
const resolved=resolveMachineBinary();
|
|
16
|
+
if(resolved.kind==='missing')return {ok:false,error:'machine_binary_missing',next:'agentsam machine install'};
|
|
17
|
+
const argv=['inspect',real,'--json'];
|
|
18
|
+
if(input.run_id){
|
|
19
|
+
if(typeof input.run_id!=='string'||!/^[A-Za-z0-9_-]{1,90}$/.test(input.run_id))
|
|
20
|
+
throw new Error('machine_run_id_invalid');
|
|
21
|
+
argv.push('--run-id',input.run_id);
|
|
22
|
+
}
|
|
23
|
+
const result=spawnMachine(resolved,argv,{stdio:['ignore','pipe','pipe'],maxBuffer:16*1024*1024,timeoutMs:90000});
|
|
24
|
+
if(result.error)return {ok:false,error:result.error.code==='ETIMEDOUT'?'process_timeout':'process_spawn_failed',message:result.error.message};
|
|
25
|
+
if(result.status!==0)return {ok:false,error:'execution_failed',exit_code:result.status,stderr:String(result.stderr||'').slice(-1200)};
|
|
26
|
+
try {return {ok:true,result:JSON.parse(String(result.stdout||'')),source:'agentsam-machine'};}
|
|
27
|
+
catch{return {ok:false,error:'upstream_invalid_response',stderr:String(result.stderr||'').slice(-500)};}
|
|
28
|
+
}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Host-backed AgentSam D1 tools.
|
|
3
|
+
*
|
|
4
|
+
* Reuse the installed MCP client's JSON-RPC transport and the IAM MCP
|
|
5
|
+
* server's existing OAuth, workspace scope, D1 SQL policies and receipts.
|
|
6
|
+
* No Cloudflare token lookup, local database, or replacement SQL engine.
|
|
7
|
+
*/
|
|
8
|
+
import { readMcpServer } from '../mcp/authority.js';
|
|
9
|
+
import { mcpConnectionStatus, resolveMcpResourceServer, mcpOAuthHasWriteScope, IAM_MCP_SERVER } from '../mcp/oauth-connection.js';
|
|
10
|
+
import { callMcpTool } from '../mcp/client.js';
|
|
11
|
+
|
|
12
|
+
export const MCP_D1_READ_TOOLS = Object.freeze(['agentsam_cf_d1_list', 'agentsam_d1_query']);
|
|
13
|
+
export const MCP_D1_WRITE_TOOLS = Object.freeze(['agentsam_d1_write', 'agentsam_d1_delete']);
|
|
14
|
+
export const MCP_D1_TOOLS = Object.freeze([...MCP_D1_READ_TOOLS, ...MCP_D1_WRITE_TOOLS]);
|
|
15
|
+
|
|
16
|
+
function validateInput(name, input) {
|
|
17
|
+
if (!MCP_D1_TOOLS.includes(name)) throw new Error('mcp_d1_tool_not_supported');
|
|
18
|
+
if (!input || typeof input !== 'object' || Array.isArray(input)) throw new Error('mcp_d1_input_invalid');
|
|
19
|
+
if (name === 'agentsam_cf_d1_list') {
|
|
20
|
+
if (Object.keys(input).length) throw new Error('mcp_d1_list_input_invalid');
|
|
21
|
+
return {};
|
|
22
|
+
}
|
|
23
|
+
if (typeof input.database_id !== 'string' ||
|
|
24
|
+
!/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/i.test(input.database_id))
|
|
25
|
+
throw new Error('mcp_d1_database_id_invalid');
|
|
26
|
+
if (typeof input.sql !== 'string' || !input.sql.trim() || input.sql.length > 12000)
|
|
27
|
+
throw new Error('mcp_d1_sql_invalid');
|
|
28
|
+
if (input.params !== undefined && (!Array.isArray(input.params) || input.params.length > 100 ||
|
|
29
|
+
input.params.some(v=>v!==null&&!['string','number','boolean'].includes(typeof v))))
|
|
30
|
+
throw new Error('mcp_d1_params_invalid');
|
|
31
|
+
const unknown = Object.keys(input).filter(key => !['database_id','sql','params'].includes(key));
|
|
32
|
+
if (unknown.length) throw new Error('mcp_d1_unknown_input');
|
|
33
|
+
return {database_id:input.database_id,sql:input.sql,...(input.params===undefined?{}:{params:input.params})};
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export function normalizeD1McpResult(raw) {
|
|
37
|
+
// callMcpTool() wraps tools/call; injected hosts may return the MCP
|
|
38
|
+
// result directly. Never send the provider auth or client config to the LLM.
|
|
39
|
+
if (raw?.ok === false) return {ok:false,error:'mcp_d1_call_failed',detail:String(raw.error || 'MCP transport failed').slice(0,300)};
|
|
40
|
+
const result = raw?.result || raw;
|
|
41
|
+
if (result?.isError) return {ok:false,error:'mcp_d1_server_error',detail:String(result.content?.[0]?.text || 'MCP execution rejected').slice(0,600)};
|
|
42
|
+
let payload = result?.structuredContent ?? result;
|
|
43
|
+
if (Array.isArray(result?.content)) {
|
|
44
|
+
const text = result.content.find(item=>item.type==='text')?.text;
|
|
45
|
+
if (text) {
|
|
46
|
+
try { payload = JSON.parse(text); }
|
|
47
|
+
catch { return {ok:false,error:'mcp_d1_invalid_response'}; }
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
if (payload?.ok === false) return {ok:false,error:String(payload.error || 'mcp_d1_server_error').slice(0,180)};
|
|
51
|
+
const bytes = Buffer.byteLength(JSON.stringify(payload ?? null));
|
|
52
|
+
if (bytes > 64000) return {ok:false,error:'mcp_d1_result_too_large',next:'Use a narrower query or more selective table filter.'};
|
|
53
|
+
return payload;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Host injects its already-authorized tool invoker. The built-in CLI uses the
|
|
58
|
+
* existing ~/.agentsam/mcp server store, without copying OAuth tokens across
|
|
59
|
+
* applications or inventing an alternate credential precedence.
|
|
60
|
+
*/
|
|
61
|
+
export function createMcpD1Bridge({
|
|
62
|
+
invokeTool = null, serverName = IAM_MCP_SERVER, home,
|
|
63
|
+
callTool = callMcpTool, resolveServer = resolveMcpResourceServer,
|
|
64
|
+
} = {}) {
|
|
65
|
+
if (typeof invokeTool === 'function') {
|
|
66
|
+
return Object.freeze({
|
|
67
|
+
available: true, source: 'host', readiness: 'available',
|
|
68
|
+
allowedTools: [...MCP_D1_TOOLS],
|
|
69
|
+
invoke: async (name, input = {}) =>
|
|
70
|
+
normalizeD1McpResult(await invokeTool(name, validateInput(name, input))),
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
// Explicit resource authority: do not fall back to a CLI account token,
|
|
74
|
+
// Wrangler credential, service key or another configured MCP server.
|
|
75
|
+
const configured = serverName === IAM_MCP_SERVER
|
|
76
|
+
? readMcpServer(IAM_MCP_SERVER, home ? { home } : {})
|
|
77
|
+
: null;
|
|
78
|
+
const status = mcpConnectionStatus(configured);
|
|
79
|
+
if (!status.available) {
|
|
80
|
+
return Object.freeze({
|
|
81
|
+
available: false, source: 'mcp', readiness: 'unavailable',
|
|
82
|
+
allowedTools: [],
|
|
83
|
+
reason: status.reason, next: status.next,
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
return Object.freeze({
|
|
87
|
+
available: true, source: 'mcp', readiness: status.readiness,
|
|
88
|
+
allowedTools: mcpOAuthHasWriteScope(configured) ? [...MCP_D1_TOOLS] : [...MCP_D1_READ_TOOLS],
|
|
89
|
+
reason: status.reason, next: status.next,
|
|
90
|
+
invoke: async (name, input = {}) => {
|
|
91
|
+
const args = validateInput(name, input);
|
|
92
|
+
// Resolve/refresh on each call. A copied startup bearer can expire while
|
|
93
|
+
// an interactive agent session is still active.
|
|
94
|
+
const server = await resolveServer({ home });
|
|
95
|
+
return normalizeD1McpResult(await callTool(server, name, args, { timeoutMs: 30000 }));
|
|
96
|
+
},
|
|
97
|
+
});
|
|
98
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/** Tiny, dependency-free Plan operation identifiers; safe during CLI bootstrap. */
|
|
2
|
+
export const PLAN_READ_OPERATIONS = Object.freeze(['plan.list', 'plan.show', 'plan.next', 'planning.goap']);
|
|
3
|
+
export const PLAN_WRITE_OPERATIONS = Object.freeze([
|
|
4
|
+
'plan.create', 'plan.step.add', 'plan.step.status', 'plan.step.evidence',
|
|
5
|
+
'plan.step.accept', 'plan.step.depends', 'plan.status',
|
|
6
|
+
]);
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Portable model-facing view of the existing local Plan ledger and SAM GOAP
|
|
3
|
+
* engine. This is not another planning store or planner.
|
|
4
|
+
*/
|
|
5
|
+
import {
|
|
6
|
+
openPlanLedger, listPlans, getPlan, getNextPlanStep, createPlan,
|
|
7
|
+
addPlanStep, addPlanStepEvidence, acceptPlanStep, addPlanDependency,
|
|
8
|
+
setPlanStepStatus, setPlanStatus,
|
|
9
|
+
} from '../commands/plan-ledger.js';
|
|
10
|
+
import { planningGoapOp } from '../sam/operations/planning-goap.js';
|
|
11
|
+
|
|
12
|
+
const nonempty = (value, key, maximum = 1000) => {
|
|
13
|
+
if (typeof value !== 'string' || !value.trim() || value.length > maximum)
|
|
14
|
+
throw new Error(key + '_invalid');
|
|
15
|
+
return value.trim();
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export function invokePlanOperation(id, input = {}, root) {
|
|
19
|
+
if (id === 'planning.goap') {
|
|
20
|
+
if (!Array.isArray(input.actions) || input.actions.length > 120)
|
|
21
|
+
throw new Error('planning_actions_invalid');
|
|
22
|
+
// Use SAM's already registered GOAP/A* planner, not a second solver.
|
|
23
|
+
return planningGoapOp.handler({ ...input, maxExpansions: Math.min(10000, input.maxExpansions ?? 1000) });
|
|
24
|
+
}
|
|
25
|
+
const readOnly = ['plan.list', 'plan.show', 'plan.next'].includes(id);
|
|
26
|
+
const ctx = openPlanLedger(root, { readOnly });
|
|
27
|
+
try {
|
|
28
|
+
switch (id) {
|
|
29
|
+
case 'plan.list': {
|
|
30
|
+
const plans = listPlans(ctx, { all: input.all === true });
|
|
31
|
+
return { initialized: Boolean(ctx.db), repository_id: ctx.repositoryId,
|
|
32
|
+
plans: plans.slice(0, 30), count: plans.length, truncated: plans.length > 30 };
|
|
33
|
+
}
|
|
34
|
+
case 'plan.show': {
|
|
35
|
+
const plan = getPlan(ctx, input.plan_id || 'current');
|
|
36
|
+
if (!plan) return { initialized: Boolean(ctx.db), repository_id: ctx.repositoryId, plan: null };
|
|
37
|
+
const limit = 80;
|
|
38
|
+
return { initialized: true, repository_id: ctx.repositoryId,
|
|
39
|
+
plan: { ...plan, tasks: plan.tasks.slice(0, limit) },
|
|
40
|
+
task_count: plan.tasks.length, truncated: plan.tasks.length > limit };
|
|
41
|
+
}
|
|
42
|
+
case 'plan.next':
|
|
43
|
+
return { repository_id: ctx.repositoryId,
|
|
44
|
+
...getNextPlanStep(ctx, { planId: input.plan_id || 'current', start: false }) };
|
|
45
|
+
case 'plan.create':
|
|
46
|
+
return createPlan(ctx, { title: nonempty(input.title, 'plan_title', 180),
|
|
47
|
+
goal: input.goal ? nonempty(input.goal, 'plan_goal', 2000) : undefined,
|
|
48
|
+
planType: input.plan_type || 'feature' });
|
|
49
|
+
case 'plan.step.add':
|
|
50
|
+
return addPlanStep(ctx, {
|
|
51
|
+
planId: input.plan_id || 'current',
|
|
52
|
+
title: nonempty(input.title, 'step_title', 180),
|
|
53
|
+
description: input.description ? nonempty(input.description, 'step_description', 3000) : null,
|
|
54
|
+
kind: input.kind || 'work',
|
|
55
|
+
priority: input.priority || 'medium',
|
|
56
|
+
acceptance: Array.isArray(input.acceptance) && input.acceptance.length <= 40 ? input.acceptance.map(criterion => ({
|
|
57
|
+
criterion: nonempty(criterion, 'acceptance_criterion', 500),
|
|
58
|
+
required: true, status: 'pending',
|
|
59
|
+
})) : (input.acceptance === undefined ? [] : (() => { throw new Error('acceptance_limit_invalid'); })()),
|
|
60
|
+
requiresApproval: input.requires_approval === true,
|
|
61
|
+
});
|
|
62
|
+
case 'plan.step.status':
|
|
63
|
+
return setPlanStepStatus(ctx, nonempty(input.step_id, 'step_id', 120),
|
|
64
|
+
nonempty(input.status, 'step_status', 30), { reason: input.reason || null });
|
|
65
|
+
case 'plan.step.evidence':
|
|
66
|
+
return addPlanStepEvidence(ctx, nonempty(input.step_id, 'step_id', 120), {
|
|
67
|
+
type: input.type || 'evidence', ref: nonempty(input.ref, 'evidence_ref', 2048),
|
|
68
|
+
note: input.note ? nonempty(input.note, 'evidence_note', 1000) : null,
|
|
69
|
+
});
|
|
70
|
+
case 'plan.step.accept':
|
|
71
|
+
return acceptPlanStep(ctx, nonempty(input.step_id, 'step_id', 120),
|
|
72
|
+
nonempty(input.criterion, 'acceptance_criterion', 500),
|
|
73
|
+
{ evidenceRef: input.evidence_ref || null });
|
|
74
|
+
case 'plan.step.depends':
|
|
75
|
+
return addPlanDependency(ctx, nonempty(input.step_id, 'step_id', 120),
|
|
76
|
+
nonempty(input.dependency_id, 'dependency_id', 120));
|
|
77
|
+
case 'plan.status':
|
|
78
|
+
return setPlanStatus(ctx, input.plan_id || 'current',
|
|
79
|
+
nonempty(input.status, 'plan_status', 30));
|
|
80
|
+
default: throw new Error('plan_operation_unknown:' + id);
|
|
81
|
+
}
|
|
82
|
+
} finally { ctx.close(); }
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export { PLAN_READ_OPERATIONS, PLAN_WRITE_OPERATIONS } from './plan-operation-ids.js';
|