@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,140 @@
|
|
|
1
|
+
"""Upload crawl optimized images + page JSON to R2 via wrangler (threaded)."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import concurrent.futures
|
|
6
|
+
import json
|
|
7
|
+
import subprocess
|
|
8
|
+
import time
|
|
9
|
+
from pathlib import Path
|
|
10
|
+
|
|
11
|
+
from .config import IMMUTABLE_CACHE, MUTABLE_CACHE
|
|
12
|
+
from .crawl import CrawlResult
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def wrangler_put(
|
|
16
|
+
repo_root: Path,
|
|
17
|
+
bucket: str,
|
|
18
|
+
key: str,
|
|
19
|
+
file_path: Path,
|
|
20
|
+
content_type: str,
|
|
21
|
+
cache_control: str,
|
|
22
|
+
*,
|
|
23
|
+
wrangler_config: str | None = None,
|
|
24
|
+
) -> None:
|
|
25
|
+
cmd = [
|
|
26
|
+
"npx", "wrangler", "r2", "object", "put", f"{bucket}/{key}",
|
|
27
|
+
"--file", str(file_path),
|
|
28
|
+
"--content-type", content_type,
|
|
29
|
+
"--cache-control", cache_control,
|
|
30
|
+
"--remote",
|
|
31
|
+
]
|
|
32
|
+
if wrangler_config:
|
|
33
|
+
cmd += ["-c", wrangler_config]
|
|
34
|
+
result = subprocess.run(cmd, cwd=str(repo_root), capture_output=True, text=True, timeout=120)
|
|
35
|
+
if result.returncode != 0:
|
|
36
|
+
raise RuntimeError(f"wrangler put failed for {key}: {result.stderr.strip()[:500]}")
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
def upload_crawl_result(
|
|
40
|
+
result: CrawlResult,
|
|
41
|
+
repo_root: Path,
|
|
42
|
+
bucket: str,
|
|
43
|
+
*,
|
|
44
|
+
key_prefix: str | None = None,
|
|
45
|
+
wrangler_config: str | None = None,
|
|
46
|
+
upload_workers: int = 6,
|
|
47
|
+
) -> dict:
|
|
48
|
+
"""Upload images + page JSON. Per-item failures are collected, not fatal alone."""
|
|
49
|
+
prefix = f"{key_prefix.strip('/')}/" if key_prefix else ""
|
|
50
|
+
summary: dict = {"uploaded": 0, "failed": []}
|
|
51
|
+
asset_manifest = {
|
|
52
|
+
"bucket": bucket,
|
|
53
|
+
"generated_at_unix": int(time.time()),
|
|
54
|
+
"images": [],
|
|
55
|
+
"pages": [],
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
jobs: list[tuple[str, Path, str, str, dict | None, dict | None]] = []
|
|
59
|
+
|
|
60
|
+
for image in result.images:
|
|
61
|
+
if not image.ok or not image.optimized_path:
|
|
62
|
+
continue
|
|
63
|
+
key = f"{prefix}images/{image.asset_name}"
|
|
64
|
+
meta = {
|
|
65
|
+
"original_url": image.url,
|
|
66
|
+
"r2_key": key,
|
|
67
|
+
"asset_url": f"/assets/{key}",
|
|
68
|
+
"section": image.section,
|
|
69
|
+
"aspect": image.aspect,
|
|
70
|
+
"bytes": image.bytes,
|
|
71
|
+
"sha256": image.sha256,
|
|
72
|
+
}
|
|
73
|
+
jobs.append((
|
|
74
|
+
key,
|
|
75
|
+
Path(image.optimized_path),
|
|
76
|
+
image.content_type or "application/octet-stream",
|
|
77
|
+
IMMUTABLE_CACHE,
|
|
78
|
+
meta,
|
|
79
|
+
None,
|
|
80
|
+
))
|
|
81
|
+
|
|
82
|
+
for page in result.pages:
|
|
83
|
+
json_path = Path(page.json_path)
|
|
84
|
+
key = f"{prefix}pages/{json_path.stem}.json"
|
|
85
|
+
meta = {
|
|
86
|
+
"url": page.url,
|
|
87
|
+
"title": page.title,
|
|
88
|
+
"r2_key": key,
|
|
89
|
+
"asset_url": f"/assets/{key}",
|
|
90
|
+
}
|
|
91
|
+
jobs.append((
|
|
92
|
+
key,
|
|
93
|
+
json_path,
|
|
94
|
+
"application/json; charset=utf-8",
|
|
95
|
+
MUTABLE_CACHE,
|
|
96
|
+
None,
|
|
97
|
+
meta,
|
|
98
|
+
))
|
|
99
|
+
|
|
100
|
+
def _one(job):
|
|
101
|
+
key, path, ctype, cache, img_meta, page_meta = job
|
|
102
|
+
wrangler_put(
|
|
103
|
+
repo_root, bucket, key, path, ctype, cache,
|
|
104
|
+
wrangler_config=wrangler_config,
|
|
105
|
+
)
|
|
106
|
+
return key, img_meta, page_meta
|
|
107
|
+
|
|
108
|
+
with concurrent.futures.ThreadPoolExecutor(max_workers=upload_workers) as pool:
|
|
109
|
+
futures = [pool.submit(_one, job) for job in jobs]
|
|
110
|
+
for future in concurrent.futures.as_completed(futures):
|
|
111
|
+
try:
|
|
112
|
+
key, img_meta, page_meta = future.result()
|
|
113
|
+
summary["uploaded"] += 1
|
|
114
|
+
if img_meta:
|
|
115
|
+
asset_manifest["images"].append(img_meta)
|
|
116
|
+
if page_meta:
|
|
117
|
+
asset_manifest["pages"].append(page_meta)
|
|
118
|
+
except Exception as exc: # noqa: BLE001
|
|
119
|
+
summary["failed"].append({"error": str(exc)})
|
|
120
|
+
|
|
121
|
+
if result.pages:
|
|
122
|
+
manifest_path = Path(result.pages[0].json_path).parent.parent / "asset-manifest.json"
|
|
123
|
+
else:
|
|
124
|
+
manifest_path = repo_root / "asset-manifest.json"
|
|
125
|
+
manifest_path.write_text(json.dumps(asset_manifest, indent=2), encoding="utf-8")
|
|
126
|
+
try:
|
|
127
|
+
wrangler_put(
|
|
128
|
+
repo_root,
|
|
129
|
+
bucket,
|
|
130
|
+
f"{prefix}_meta/asset-manifest.json",
|
|
131
|
+
manifest_path,
|
|
132
|
+
"application/json; charset=utf-8",
|
|
133
|
+
MUTABLE_CACHE,
|
|
134
|
+
wrangler_config=wrangler_config,
|
|
135
|
+
)
|
|
136
|
+
except Exception as exc: # noqa: BLE001
|
|
137
|
+
summary["failed"].append({"key": "_meta/asset-manifest.json", "error": str(exc)})
|
|
138
|
+
|
|
139
|
+
summary["manifest_path"] = str(manifest_path)
|
|
140
|
+
return summary
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"""SSRF deny-list for seed URLs and post-redirect final URLs.
|
|
2
|
+
|
|
3
|
+
Interactive typing is low risk; `--yes` and any future API trigger are not.
|
|
4
|
+
Block loopback, RFC1918, link-local, and cloud metadata endpoints.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from __future__ import annotations
|
|
8
|
+
|
|
9
|
+
import ipaddress
|
|
10
|
+
from urllib.parse import urlparse
|
|
11
|
+
|
|
12
|
+
from .config import SSRF_BLOCKED_HOSTS, SSRF_BLOCKED_PREFIXES
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def _is_blocked_ip(host: str) -> bool:
|
|
16
|
+
try:
|
|
17
|
+
ip = ipaddress.ip_address(host.strip("[]"))
|
|
18
|
+
except ValueError:
|
|
19
|
+
return False
|
|
20
|
+
return bool(
|
|
21
|
+
ip.is_private
|
|
22
|
+
or ip.is_loopback
|
|
23
|
+
or ip.is_link_local
|
|
24
|
+
or ip.is_reserved
|
|
25
|
+
or ip.is_multicast
|
|
26
|
+
or ip.is_unspecified
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def assert_public_http_url(url: str, *, context: str = "url") -> str:
|
|
31
|
+
"""Raise ValueError if `url` is not a public http(s) target."""
|
|
32
|
+
raw = (url or "").strip()
|
|
33
|
+
if not raw:
|
|
34
|
+
raise ValueError(f"{context}: empty")
|
|
35
|
+
p = urlparse(raw)
|
|
36
|
+
if p.scheme not in ("http", "https"):
|
|
37
|
+
raise ValueError(f"{context}: scheme must be http or https")
|
|
38
|
+
host = (p.hostname or "").lower()
|
|
39
|
+
if not host:
|
|
40
|
+
raise ValueError(f"{context}: missing host")
|
|
41
|
+
if host in SSRF_BLOCKED_HOSTS or host.endswith((".localhost", ".local", ".internal")):
|
|
42
|
+
raise ValueError(f"{context}: blocked host {host}")
|
|
43
|
+
if _is_blocked_ip(host):
|
|
44
|
+
raise ValueError(f"{context}: blocked address {host}")
|
|
45
|
+
for prefix in SSRF_BLOCKED_PREFIXES:
|
|
46
|
+
if host.startswith(prefix):
|
|
47
|
+
raise ValueError(f"{context}: blocked address prefix {host}")
|
|
48
|
+
# 172.16.0.0/12 as dotted host string (when not parsed as IP above)
|
|
49
|
+
if host.startswith("172."):
|
|
50
|
+
try:
|
|
51
|
+
second = int(host.split(".")[1])
|
|
52
|
+
if 16 <= second <= 31:
|
|
53
|
+
raise ValueError(f"{context}: blocked address {host}")
|
|
54
|
+
except (IndexError, ValueError) as exc:
|
|
55
|
+
if "blocked address" in str(exc):
|
|
56
|
+
raise
|
|
57
|
+
return raw
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"""Resolve project-owned crawl storage; never default to the SDK publisher's R2.
|
|
2
|
+
|
|
3
|
+
Selection belongs to the current project/user. R2 uses the caller's actual
|
|
4
|
+
Wrangler profile; this module neither provisions buckets nor grants permission.
|
|
5
|
+
"""
|
|
6
|
+
from __future__ import annotations
|
|
7
|
+
|
|
8
|
+
import json
|
|
9
|
+
import re
|
|
10
|
+
from pathlib import Path
|
|
11
|
+
|
|
12
|
+
from .wrangler_bucket import _candidate_configs, _bucket_from_json, _bucket_from_toml
|
|
13
|
+
|
|
14
|
+
BUCKET = re.compile(r"[a-z0-9][a-z0-9-]{1,62}[a-z0-9]\Z")
|
|
15
|
+
BINDING = "CRAWL_EVIDENCE"
|
|
16
|
+
CONFIG = ".agentsam/site-scrape.json"
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def resolve_evidence_bucket(project_root: Path, *, selected_bucket: str | None = None,
|
|
20
|
+
wrangler_config: str | None = None) -> dict:
|
|
21
|
+
"""Explicit selection > project config > its Wrangler binding; otherwise fail closed."""
|
|
22
|
+
root = Path(project_root).resolve()
|
|
23
|
+
if not root.is_dir():
|
|
24
|
+
raise ValueError("project_root must be an existing project directory")
|
|
25
|
+
source = None
|
|
26
|
+
bucket = None
|
|
27
|
+
if selected_bucket:
|
|
28
|
+
bucket, source = selected_bucket, "explicit-user-selection"
|
|
29
|
+
else:
|
|
30
|
+
project_config = root / CONFIG
|
|
31
|
+
if project_config.is_file():
|
|
32
|
+
config = json.loads(project_config.read_text(encoding="utf-8"))
|
|
33
|
+
selection = config.get("storage", {}).get("evidence", {})
|
|
34
|
+
if selection.get("provider") == "local":
|
|
35
|
+
raise ValueError("project selected local evidence storage; remote upload is not enabled")
|
|
36
|
+
if selection.get("provider") not in (None, "r2"):
|
|
37
|
+
raise ValueError("unsupported project evidence storage provider")
|
|
38
|
+
bucket = selection.get("bucket")
|
|
39
|
+
if bucket:
|
|
40
|
+
source = f"project:{CONFIG}"
|
|
41
|
+
if not bucket:
|
|
42
|
+
for path in _candidate_configs(root, wrangler_config):
|
|
43
|
+
if not path.is_file():
|
|
44
|
+
continue
|
|
45
|
+
body = path.read_text(encoding="utf-8")
|
|
46
|
+
candidate = (_bucket_from_json(body, BINDING) if path.suffix in (".json", ".jsonc")
|
|
47
|
+
else _bucket_from_toml(body, BINDING))
|
|
48
|
+
if candidate:
|
|
49
|
+
bucket, source = candidate, f"wrangler:{path.name}:{BINDING}"
|
|
50
|
+
break
|
|
51
|
+
if not isinstance(bucket, str) or not BUCKET.fullmatch(bucket):
|
|
52
|
+
raise ValueError(
|
|
53
|
+
"No project-owned R2 crawl evidence destination. Select --archive-bucket, "
|
|
54
|
+
f"configure {CONFIG} storage.evidence.bucket, or bind {BINDING} in the PROJECT's Wrangler config. "
|
|
55
|
+
"No account-wide/default publisher bucket is used."
|
|
56
|
+
)
|
|
57
|
+
return {"provider": "r2", "bucket": bucket, "source": source, "project_root": str(root)}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
"""Resolve WEBSITE_ASSETS bucket_name from a client worker wrangler config."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import json
|
|
6
|
+
import re
|
|
7
|
+
from pathlib import Path
|
|
8
|
+
|
|
9
|
+
from .config import WEBSITE_ASSETS_BINDING
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def _candidate_configs(repo_root: Path, explicit: str | None) -> list[Path]:
|
|
13
|
+
if explicit:
|
|
14
|
+
p = Path(explicit)
|
|
15
|
+
return [p if p.is_absolute() else repo_root / p]
|
|
16
|
+
names = (
|
|
17
|
+
"wrangler.jsonc",
|
|
18
|
+
"wrangler.json",
|
|
19
|
+
"wrangler.toml",
|
|
20
|
+
"wrangler.production.toml",
|
|
21
|
+
"wrangler.production.jsonc",
|
|
22
|
+
)
|
|
23
|
+
return [repo_root / n for n in names]
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def _strip_jsonc(text: str) -> str:
|
|
27
|
+
# Drop // line comments and /* */ blocks — good enough for wrangler.jsonc.
|
|
28
|
+
no_block = re.sub(r"/\*.*?\*/", "", text, flags=re.S)
|
|
29
|
+
lines = []
|
|
30
|
+
for line in no_block.splitlines():
|
|
31
|
+
if "//" in line:
|
|
32
|
+
in_str = False
|
|
33
|
+
out = []
|
|
34
|
+
i = 0
|
|
35
|
+
while i < len(line):
|
|
36
|
+
ch = line[i]
|
|
37
|
+
if ch == '"' and (i == 0 or line[i - 1] != "\\"):
|
|
38
|
+
in_str = not in_str
|
|
39
|
+
if not in_str and line[i:i + 2] == "//":
|
|
40
|
+
break
|
|
41
|
+
out.append(ch)
|
|
42
|
+
i += 1
|
|
43
|
+
lines.append("".join(out))
|
|
44
|
+
else:
|
|
45
|
+
lines.append(line)
|
|
46
|
+
return "\n".join(lines)
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
def _bucket_from_json(text: str, binding: str) -> str | None:
|
|
50
|
+
data = json.loads(_strip_jsonc(text))
|
|
51
|
+
for row in data.get("r2_buckets") or []:
|
|
52
|
+
if row.get("binding") == binding and row.get("bucket_name"):
|
|
53
|
+
return str(row["bucket_name"]).strip()
|
|
54
|
+
return None
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
def _bucket_from_toml(text: str, binding: str) -> str | None:
|
|
58
|
+
# Minimal TOML scan for [[r2_buckets]] blocks — avoids adding tomllib-only edge cases
|
|
59
|
+
# on older Python; 3.11+ has tomllib but keep this simple and deterministic.
|
|
60
|
+
blocks = re.split(r"\[\[r2_buckets\]\]", text)
|
|
61
|
+
for block in blocks[1:]:
|
|
62
|
+
bind_m = re.search(r'binding\s*=\s*"([^"]+)"', block)
|
|
63
|
+
buck_m = re.search(r'bucket_name\s*=\s*"([^"]+)"', block)
|
|
64
|
+
if bind_m and buck_m and bind_m.group(1) == binding:
|
|
65
|
+
return buck_m.group(1).strip()
|
|
66
|
+
return None
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
def resolve_website_assets_bucket(
|
|
70
|
+
repo_root: Path,
|
|
71
|
+
*,
|
|
72
|
+
wrangler_config: str | None = None,
|
|
73
|
+
binding: str = WEBSITE_ASSETS_BINDING,
|
|
74
|
+
) -> str:
|
|
75
|
+
"""Return bucket_name for WEBSITE_ASSETS or raise with a loud message."""
|
|
76
|
+
root = repo_root.resolve()
|
|
77
|
+
if not root.is_dir():
|
|
78
|
+
raise FileNotFoundError(f"--repo-root is not a directory: {root}")
|
|
79
|
+
|
|
80
|
+
tried: list[str] = []
|
|
81
|
+
for path in _candidate_configs(root, wrangler_config):
|
|
82
|
+
tried.append(str(path))
|
|
83
|
+
if not path.is_file():
|
|
84
|
+
continue
|
|
85
|
+
text = path.read_text(encoding="utf-8")
|
|
86
|
+
if path.suffix in {".json", ".jsonc"}:
|
|
87
|
+
bucket = _bucket_from_json(text, binding)
|
|
88
|
+
else:
|
|
89
|
+
bucket = _bucket_from_toml(text, binding)
|
|
90
|
+
if bucket:
|
|
91
|
+
return bucket
|
|
92
|
+
|
|
93
|
+
raise RuntimeError(
|
|
94
|
+
f"No R2 binding '{binding}' with bucket_name found under {root}. "
|
|
95
|
+
f"Tried: {', '.join(tried)}. "
|
|
96
|
+
"Pass --bucket explicitly, or add the binding to the client worker wrangler config. "
|
|
97
|
+
"Do not use the IAM platform monorepo as --repo-root."
|
|
98
|
+
)
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=68"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "agentsam-site-scrape"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "Public-site crawler → image classifier/optimizer → R2 asset organizer (AgentSam CMS ingest)."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.10"
|
|
11
|
+
authors = [{ name = "Inner Animal Media" }]
|
|
12
|
+
dependencies = [
|
|
13
|
+
"requests>=2.32.0,<3.0.0",
|
|
14
|
+
]
|
|
15
|
+
|
|
16
|
+
[project.scripts]
|
|
17
|
+
agentsam-site-scrape = "agentsam_site_scrape.__main__:main"
|
|
18
|
+
|
|
19
|
+
[tool.setuptools.packages.find]
|
|
20
|
+
where = ["."]
|
|
21
|
+
include = ["agentsam_site_scrape*"]
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/** Project-owned host client for the site.scrape Worker service binding.
|
|
2
|
+
* No platform URLs, tokens, buckets, or account IDs in this SDK module.
|
|
3
|
+
* The calling host supplies an authorized session header and its own transport.
|
|
4
|
+
*/
|
|
5
|
+
const PATH = '/v1/crawls';
|
|
6
|
+
const RUN = /^scrp_[0-9a-f]{24}$/;
|
|
7
|
+
export function createSiteScrapeClient({baseUrl,fetchImpl=fetch,authorize}={}) {
|
|
8
|
+
if(typeof baseUrl!=='string'||!/^https?:\/\//.test(baseUrl))throw Error('site.scrape project endpoint URL is required');
|
|
9
|
+
if(typeof fetchImpl!=='function')throw TypeError('site.scrape fetch transport required');
|
|
10
|
+
if(typeof authorize!=='function')throw TypeError('site.scrape host must provide request authorization');
|
|
11
|
+
const base = new URL(baseUrl);
|
|
12
|
+
async function request(method,relative,body) {
|
|
13
|
+
const token=await authorize();
|
|
14
|
+
if(typeof token!=='string'||!token.startsWith('Bearer ')||token.length<=7)throw Error('missing authorized project session');
|
|
15
|
+
const target=new URL(relative,base);
|
|
16
|
+
if(target.origin!==base.origin)throw Error('service origin mismatch');
|
|
17
|
+
const response=await fetchImpl(new Request(target,{method,headers:{authorization:token,'content-type':'application/json'},
|
|
18
|
+
...(body?{body:JSON.stringify(body)}:{})}));
|
|
19
|
+
const content=await response.json().catch(()=>({error:'invalid_service_response'}));
|
|
20
|
+
if(!response.ok){const error=new Error(content.error||`site.scrape HTTP ${response.status}`);error.status=response.status;throw error;}
|
|
21
|
+
return content;
|
|
22
|
+
}
|
|
23
|
+
const identifier=id=>{if(!RUN.test(id||''))throw Error('invalid site.scrape run ID');return id;};
|
|
24
|
+
return Object.freeze({
|
|
25
|
+
submit({url,maxPages=20,captureAssets=false}){
|
|
26
|
+
return request('POST',PATH,{url,max_pages:maxPages,capture_assets:captureAssets});
|
|
27
|
+
},
|
|
28
|
+
status(runId){return request('GET',`${PATH}/${identifier(runId)}`);},
|
|
29
|
+
index(runId){return request('GET',`${PATH}/${identifier(runId)}/index`);},
|
|
30
|
+
submitForReview(runId,assetKeys){return request('POST',`${PATH}/${identifier(runId)}/promote`,{asset_keys:assetKeys});},
|
|
31
|
+
});
|
|
32
|
+
}
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
/** site.scrape: Node-native bounded traversal of the canonical capability, not a second product/scanner.
|
|
2
|
+
* The runtime adapter supplies a security-constrained fetch function and sink.
|
|
3
|
+
* Rust Machine/Repository own downstream deterministic file evidence/indexing.
|
|
4
|
+
*/
|
|
5
|
+
import { createHash } from 'node:crypto';
|
|
6
|
+
import { parse } from 'parse5';
|
|
7
|
+
import {XMLParser} from 'fast-xml-parser';
|
|
8
|
+
|
|
9
|
+
export const SITE_SCRAPE_CAPABILITY = 'site.scrape';
|
|
10
|
+
export const SITE_SCRAPE_SCHEMA = 1;
|
|
11
|
+
export const UNAVAILABLE_INPUTS = Object.freeze(['scope.maxDepth', 'policy.timeoutMs', 'capture.html', 'capture.text', 'scope.allowedOrigins']);
|
|
12
|
+
const sha = bytes => createHash('sha256').update(bytes).digest('hex');
|
|
13
|
+
const cleaned = text => String(text || '').replace(/\s+/g,' ').trim();
|
|
14
|
+
|
|
15
|
+
export function normalizeUrl(value, base) {
|
|
16
|
+
if(String(value||'').length>4096) throw Error('url_too_long');
|
|
17
|
+
const u = new URL(String(value || ''), base);
|
|
18
|
+
if (!['https:', 'http:'].includes(u.protocol) || !u.hostname || u.username || u.password) throw Error('unsupported_url');
|
|
19
|
+
u.hash = '';
|
|
20
|
+
for(const k of [...u.searchParams.keys()]) if(/^(utm_.*|fbclid|gclid|msclkid)$/i.test(k)) u.searchParams.delete(k);
|
|
21
|
+
return u.href;
|
|
22
|
+
}
|
|
23
|
+
export function isSameSite(one, two) {
|
|
24
|
+
return new URL(one).hostname.replace(/^www\./,'').toLowerCase() === new URL(two).hostname.replace(/^www\./,'').toLowerCase();
|
|
25
|
+
}
|
|
26
|
+
function attrs(node) { return Object.fromEntries((node.attrs || []).map(a=>[a.name, a.value])); }
|
|
27
|
+
function textOf(node) { return node.nodeName === '#text' ? node.value : (node.childNodes||[]).map(textOf).join(''); }
|
|
28
|
+
export function extractHtml(html, sourceUrl) {
|
|
29
|
+
const document = parse(String(html));
|
|
30
|
+
const result = {title:'',meta:{}, links:[], images:[],content:[]};
|
|
31
|
+
const links = new Set(), images = new Set();
|
|
32
|
+
function visit(node) {
|
|
33
|
+
const tag = node.tagName || '', a = attrs(node);
|
|
34
|
+
if(tag === 'title') result.title = cleaned(textOf(node)).slice(0,500);
|
|
35
|
+
if(tag === 'meta' && (a.name || a.property) && a.content) result.meta[a.name || a.property] = a.content.slice(0,2000);
|
|
36
|
+
if(tag === 'a' && a.href) {
|
|
37
|
+
try { const url=normalizeUrl(a.href,sourceUrl); if(!links.has(url)){links.add(url);result.links.push({url,text:cleaned(textOf(node)).slice(0,220)});} }catch{}
|
|
38
|
+
}
|
|
39
|
+
if(['img','source'].includes(tag)) {
|
|
40
|
+
const sources=[a.src,a['data-src'],a['data-original'],...(a.srcset || '').split(',').map(s=>s.trim().split(/\s+/)[0])];
|
|
41
|
+
for(const source of sources) if(source) {
|
|
42
|
+
try {const url=normalizeUrl(source,sourceUrl);if(!images.has(url)){images.add(url);result.images.push({url,alt:cleaned(a.alt||''),title:cleaned(a.title||'')});}}catch{}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
if(['h1','h2','h3','p'].includes(tag)) {
|
|
46
|
+
const text=cleaned(textOf(node)); if(text) result.content.push({kind:tag,text:text.slice(0,12000)});
|
|
47
|
+
}
|
|
48
|
+
if(!['script','style','noscript','template'].includes(tag)) for(const child of node.childNodes || []) visit(child);
|
|
49
|
+
}
|
|
50
|
+
visit(document);
|
|
51
|
+
return result;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function robotsRule(text, agent = 'AgentSam') {
|
|
55
|
+
// Scoped groups: wildcard or our agent, default-deny only where Disallow matches.
|
|
56
|
+
const groups=[];let current=null;
|
|
57
|
+
for(const line of text.split(/\r?\n/)) {
|
|
58
|
+
const stripped=line.replace(/#.*$/,'').trim(); const i=stripped.indexOf(':');if(i<0) continue;
|
|
59
|
+
const key=stripped.slice(0,i).trim().toLowerCase(), val=stripped.slice(i+1).trim();
|
|
60
|
+
if(key==='user-agent') {if(!current||current.rules.length){current={agents:[],rules:[]};groups.push(current);} current.agents.push(val.toLowerCase());}
|
|
61
|
+
else if(['allow','disallow'].includes(key) && current) current.rules.push({allow:key==='allow',pattern:val});
|
|
62
|
+
}
|
|
63
|
+
const agentName=agent.toLowerCase();
|
|
64
|
+
const selected=groups.filter(g=>g.agents.some(a=>a!=='*'&&(agentName.includes(a)||a.includes(agentName))));
|
|
65
|
+
return (selected.length ? selected: groups.filter(g=>g.agents.includes('*'))).flatMap(g=>g.rules);
|
|
66
|
+
}
|
|
67
|
+
export function robotsAllowed(robotsBody,url,agent='AgentSam') {
|
|
68
|
+
const path = new URL(url).pathname + new URL(url).search;
|
|
69
|
+
let best=-1,allow=true;
|
|
70
|
+
for(const rule of robotsRule(robotsBody,agent)) {
|
|
71
|
+
if(!rule.pattern) continue;
|
|
72
|
+
const ending=rule.pattern.endsWith('$');
|
|
73
|
+
const raw=ending?rule.pattern.slice(0,-1):rule.pattern;
|
|
74
|
+
const escape=(value)=>[...value].map(ch=>'\\.[]{}()+?^$|'.includes(ch)?'\\'+ch:ch).join('');
|
|
75
|
+
const expression='^'+raw.split('*').map(escape).join('.*')+(ending?'$':'');
|
|
76
|
+
// Parse wildcard and end anchors conservatively; longest matching rule wins.
|
|
77
|
+
if(new RegExp(expression).test(path)) {
|
|
78
|
+
const length=raw.replaceAll('*','').length;
|
|
79
|
+
if(length>best || length===best && rule.allow){allow=rule.allow;best=length;}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
return allow;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/** Invoke with fetchPage(url,{maxBytes,contentTypes}) that validates every DNS
|
|
86
|
+
* target and manual redirect, and never calls an untrusted host on its own. */
|
|
87
|
+
export async function crawlSite({url,maxPages=20,concurrency=3,maxBytes=1024*1024,maxAssets=1000,captureAssets=false,
|
|
88
|
+
respectRobots=true,runId,runtime='node-local',fetchPage,onPage=async()=>{},onAsset=async()=>{},onProgress=()=>{},clock=()=>Date.now()}) {
|
|
89
|
+
if(typeof fetchPage!=='function') throw TypeError('a secure fetchPage adapter is required');
|
|
90
|
+
if(!Number.isSafeInteger(maxPages)||maxPages<1||maxPages>5000) throw RangeError('maxPages must be 1..5000');
|
|
91
|
+
if(!Number.isSafeInteger(concurrency)||concurrency<1||concurrency>16) throw RangeError('concurrency must be 1..16');
|
|
92
|
+
if(!Number.isSafeInteger(maxAssets)||maxAssets<0||maxAssets>10000) throw RangeError('maxAssets must be 0..10000');
|
|
93
|
+
const seed=normalizeUrl(url), started=clock(), candidates=[seed],seen=new Set(), queued=new Set([seed]);
|
|
94
|
+
const pages=[],errors=[],assets=[],robotsCache=new Map();let cursor=0;
|
|
95
|
+
async function allowed(pageUrl) {
|
|
96
|
+
if(!respectRobots) return true;
|
|
97
|
+
const origin=new URL(pageUrl).origin;
|
|
98
|
+
if(!robotsCache.has(origin)) {
|
|
99
|
+
robotsCache.set(origin,(async()=>{
|
|
100
|
+
try {
|
|
101
|
+
const response=await fetchPage(origin+'/robots.txt',{maxBytes:256*1024,contentTypes:['text/plain','text/html']});
|
|
102
|
+
if(response.status===404) return '';
|
|
103
|
+
if(response.status>=500) throw Error('robots_service_unavailable');
|
|
104
|
+
if(response.status>=400) return '';
|
|
105
|
+
return response.body.toString('utf8');
|
|
106
|
+
} catch(e) {throw Error('robots_unavailable:'+e.message);}
|
|
107
|
+
})());
|
|
108
|
+
}
|
|
109
|
+
return robotsAllowed(await robotsCache.get(origin),pageUrl);
|
|
110
|
+
}
|
|
111
|
+
// Respect a site's published sitemap. JS-hydrated storefronts commonly
|
|
112
|
+
// expose SEO metadata in HTML but their navigation links only after JS runs.
|
|
113
|
+
// Bounded XML sitemap discovery provides real URLs without browser rendering,
|
|
114
|
+
// a second site scanner, or any cross-site access.
|
|
115
|
+
async function discoverSitemaps() {
|
|
116
|
+
const origin=new URL(seed).origin;
|
|
117
|
+
const roots=[origin+'/sitemap.xml'];
|
|
118
|
+
if(respectRobots) {
|
|
119
|
+
try {
|
|
120
|
+
await allowed(seed);
|
|
121
|
+
const robots=await robotsCache.get(origin);
|
|
122
|
+
for(const line of robots.split(/\r?\n/)) {
|
|
123
|
+
const value=line.replace(/#.*$/,'').match(/^\s*sitemap\s*:\s*(\S+)/i)?.[1];
|
|
124
|
+
if(value)roots.push(value);
|
|
125
|
+
}
|
|
126
|
+
}catch{return; /* crawler will independently report robots failure */}
|
|
127
|
+
}
|
|
128
|
+
const seenMaps=new Set();
|
|
129
|
+
const parser=new XMLParser({ignoreAttributes:true,trimValues:true});
|
|
130
|
+
while(roots.length && seenMaps.size<8 && candidates.length<maxPages*20) {
|
|
131
|
+
let sitemap;
|
|
132
|
+
try {
|
|
133
|
+
sitemap=normalizeUrl(roots.shift());
|
|
134
|
+
if(!isSameSite(seed,sitemap)||new URL(sitemap).origin!==origin||seenMaps.has(sitemap))continue;
|
|
135
|
+
seenMaps.add(sitemap);
|
|
136
|
+
if(respectRobots && !(await allowed(sitemap)))continue;
|
|
137
|
+
const response=await fetchPage(sitemap,{maxBytes:1024*1024,
|
|
138
|
+
contentTypes:['application/xml','text/xml','text/plain','application/rss+xml']});
|
|
139
|
+
if(response.status>=400)continue;
|
|
140
|
+
const parsed=parser.parse(response.body.toString('utf8'));
|
|
141
|
+
const urls=parsed?.urlset?.url, maps=parsed?.sitemapindex?.sitemap;
|
|
142
|
+
const entries=urls==null?[]:Array.isArray(urls)?urls:[urls];
|
|
143
|
+
for(const entry of entries) {
|
|
144
|
+
if(candidates.length>=maxPages*20)break;
|
|
145
|
+
try {
|
|
146
|
+
const discovered=normalizeUrl(entry?.loc);
|
|
147
|
+
if(!isSameSite(seed,discovered)||queued.has(discovered))continue;
|
|
148
|
+
queued.add(discovered);candidates.push(discovered);
|
|
149
|
+
}catch{/* invalid sitemap URL is not a crawl target */}
|
|
150
|
+
}
|
|
151
|
+
for(const entry of maps==null?[]:Array.isArray(maps)?maps:[maps]) {
|
|
152
|
+
if(roots.length+seenMaps.size>=8)break;
|
|
153
|
+
if(typeof entry?.loc==='string')roots.push(entry.loc);
|
|
154
|
+
}
|
|
155
|
+
}catch{/* a missing/malformed sitemap is not a fatal crawl error */}
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
await discoverSitemaps();
|
|
159
|
+
async function visit(next) {
|
|
160
|
+
try {
|
|
161
|
+
if(!isSameSite(seed,next)) return;
|
|
162
|
+
if(!(await allowed(next))){errors.push({url:next,kind:'blocked',error:'blocked_by_robots'});return;}
|
|
163
|
+
const response=await fetchPage(next,{maxBytes,contentTypes:['text/html','application/xhtml+xml']});
|
|
164
|
+
if(!isSameSite(seed,response.url||next)) throw Error('redirect_left_site');
|
|
165
|
+
if(response.status>=400) throw Error('http_'+response.status);
|
|
166
|
+
const html=response.body.toString('utf8'), parsed=extractHtml(html,response.url||next);
|
|
167
|
+
const page={url:response.url||next,title:parsed.title,meta:parsed.meta,content:parsed.content,
|
|
168
|
+
links:parsed.links,images:parsed.images,sha256:'sha256:'+sha(response.body)};
|
|
169
|
+
await onPage(page);pages.push({url:page.url,title:page.title,image_count:parsed.images.length});
|
|
170
|
+
if(captureAssets) for(const img of parsed.images) if(isSameSite(seed,img.url)&&assets.length<maxAssets) assets.push(img);
|
|
171
|
+
for(const link of parsed.links) if(candidates.length < maxPages*20 && isSameSite(seed,link.url)&&!queued.has(link.url)&&!seen.has(link.url)) {
|
|
172
|
+
queued.add(link.url);candidates.push(link.url);
|
|
173
|
+
}
|
|
174
|
+
onProgress({type:'page',url:page.url});
|
|
175
|
+
}catch(e){errors.push({url:next,kind:/blocked|private|robots/i.test(e.message)?'blocked':'failed',error:e.message});onProgress({type:'error',url:next,error:e.message});}
|
|
176
|
+
}
|
|
177
|
+
// Bounded work queue with deterministic start order; no unlimited Promise fan-out.
|
|
178
|
+
async function worker(){
|
|
179
|
+
while(cursor<candidates.length && seen.size<maxPages) {
|
|
180
|
+
const next=candidates[cursor++];if(!next||seen.has(next)) continue;
|
|
181
|
+
// Cross-worker race is avoided because JS yields only within visit().
|
|
182
|
+
seen.add(next);await visit(next);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
await Promise.all(Array.from({length:concurrency},()=>worker()));
|
|
186
|
+
let assetFetched=0;
|
|
187
|
+
if(captureAssets) {
|
|
188
|
+
const unique=[...new Map(assets.map(a=>[a.url,a])).values()];
|
|
189
|
+
let ai=0;await Promise.all(Array.from({length:concurrency},async()=>{
|
|
190
|
+
while(ai<unique.length) {
|
|
191
|
+
const img=unique[ai++];try{
|
|
192
|
+
if(!(await allowed(img.url))){errors.push({url:img.url,kind:'blocked',error:'asset:blocked_by_robots'});continue;}
|
|
193
|
+
const r=await fetchPage(img.url,{maxBytes:10*1024*1024,contentTypes:['image/']});
|
|
194
|
+
await onAsset({url:img.url,body:r.body,contentType:r.contentType,sha256:'sha256:'+sha(r.body)});
|
|
195
|
+
assetFetched++;
|
|
196
|
+
}catch(e){errors.push({url:img.url,kind:'failed',error:'asset:'+e.message});}
|
|
197
|
+
}
|
|
198
|
+
}));
|
|
199
|
+
}
|
|
200
|
+
const finished=clock(), counts={pages_visited:seen.size,pages_fetched:pages.length,pages_blocked:errors.filter(x=>x.kind==='blocked'&&!x.error.startsWith('asset:')).length,
|
|
201
|
+
pages_skipped:0,pages_failed:errors.filter(x=>x.kind==='failed'&&!x.error.startsWith('asset:')).length,
|
|
202
|
+
...(captureAssets?{images_fetched:assetFetched,images_failed:errors.filter(x=>x.error.startsWith('asset:')).length}:{})};
|
|
203
|
+
if(runId && !/^scrp_[0-9a-f]{24}$/.test(runId)) throw Error('invalid site.scrape runId');
|
|
204
|
+
const run_id=runId||'scrp_'+sha(Buffer.from(JSON.stringify([seed,started]))).slice(0,24);
|
|
205
|
+
const status=!pages.length?'failed':errors.length?'partial':'completed';
|
|
206
|
+
return {schema_version:SITE_SCRAPE_SCHEMA,capability:SITE_SCRAPE_CAPABILITY,run_id,status,runtime,
|
|
207
|
+
started_at:new Date(started).toISOString(),completed_at:new Date(finished).toISOString(),
|
|
208
|
+
content_hash:'sha256:'+sha(Buffer.from(JSON.stringify(pages.map(p=>[p.url,p.title]).sort((a,b)=>a[0].localeCompare(b[0]))))),
|
|
209
|
+
seed_urls:[seed],counts,applied:{scope:{sameSite:true,maxPages},policy:{respectRobots},
|
|
210
|
+
capture:{metadata:true,text:false,html:false,assets:captureAssets},ignored:UNAVAILABLE_INPUTS},pages,errors};
|
|
211
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/** Deterministic derived web resource graph from existing crawl evidence.
|
|
2
|
+
* Never crawls a website or rescans a repository; Machine/Repository still own
|
|
3
|
+
* filesystem perception, and Knowledge owns embeddings/retrieval.
|
|
4
|
+
*/
|
|
5
|
+
import {createHash} from 'node:crypto';
|
|
6
|
+
const sha=v=>createHash('sha256').update(v).digest('hex');
|
|
7
|
+
export const SITE_INDEX_SCHEMA='agentsam.site.index.v1';
|
|
8
|
+
|
|
9
|
+
export function createSiteIndex(pages=[]) {
|
|
10
|
+
const sorted=[...pages].sort((a,b)=>a.url.localeCompare(b.url));
|
|
11
|
+
const pageIds=new Map(sorted.map(p=>[p.url,`page:${sha(p.url).slice(0,24)}`]));
|
|
12
|
+
const resources=[],edges=[],media=new Map();
|
|
13
|
+
for(const page of sorted) {
|
|
14
|
+
const id=pageIds.get(page.url);
|
|
15
|
+
const content=page.content||[];
|
|
16
|
+
resources.push({id,url:page.url,title:page.title||'',meta:page.meta||{},
|
|
17
|
+
content_hash:'sha256:'+sha(JSON.stringify(content)),blocks:content,
|
|
18
|
+
image_count:(page.images||[]).length});
|
|
19
|
+
for(const link of page.links||[])if(pageIds.has(link.url))
|
|
20
|
+
edges.push({from:id,to:pageIds.get(link.url),kind:'internal_link',text:link.text||''});
|
|
21
|
+
for(const image of page.images||[]) {
|
|
22
|
+
const assetId=`asset:${sha(image.url).slice(0,24)}`;
|
|
23
|
+
if(!media.has(image.url))media.set(image.url,{id:assetId,url:image.url,alt:image.alt||''});
|
|
24
|
+
edges.push({from:id,to:assetId,kind:'image_reference'});
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
const assets=[...media.values()].sort((a,b)=>a.url.localeCompare(b.url));
|
|
28
|
+
edges.sort((a,b)=>JSON.stringify(a).localeCompare(JSON.stringify(b)));
|
|
29
|
+
return {schema:SITE_INDEX_SCHEMA,resources,assets,edges,counts:{pages:resources.length,assets:assets.length,edges:edges.length},
|
|
30
|
+
content_hash:'sha256:'+sha(JSON.stringify({resources,assets,edges}))};
|
|
31
|
+
}
|