@inneranimalmedia/agentsam-sdk 2.6.12 → 2.6.17
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/LICENSE +97 -8
- package/LICENSING.md +30 -0
- package/README.md +44 -7
- package/apps/README.md +1 -1
- package/apps/cad-creator/LICENSE +97 -8
- 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/index.ts +2 -0
- package/apps/cad-creator/shared/cad/src/native-plan.ts +16 -0
- package/apps/cad-creator/shared/cad/src/types.ts +52 -3
- package/contracts/source-types.v2.json +9381 -0
- package/contracts/source-types.v2.schema.json +571 -0
- package/docs/2026-11-12-chat-work-whitelabel-scaffold.md +42 -0
- package/docs/AUTORAG.md +2 -0
- package/docs/CAPABILITIES.md +28 -0
- package/docs/DATABASE_EDITOR_REMASTER_ACCEPTANCE_20261103.md +41 -0
- package/docs/DOCKERIZE.md +2 -2
- package/docs/PRODUCT_LIFECYCLE.md +2 -2
- package/docs/REPO_FILE_MAP.txt +1 -1
- package/docs/THEME_REFINERY.md +4 -117
- package/docs/acceptance/AGENTSAM_DOCS_CMS_2026-11-10.md +62 -0
- package/docs/acceptance/AGENTSAM_SDK_LOCAL_LAUNCH_2026-11-06.md +42 -0
- package/docs/acceptance/AGENTSAM_SDK_PUBLIC_CMS_2026-11-10.md +35 -0
- package/docs/acceptance/AGENTSAM_WIDGET_UTILITIES_2026-11-06.md +34 -0
- package/docs/acceptance/CREATIVE_DEPARTMENT_BATCH1_2026-11-01.md +47 -0
- package/docs/acceptance/FINANCE_SETTINGS_CMS_WIP_2026-11-07.md +42 -0
- package/docs/adr/ADR-0003-copro-clean-room-product-architecture.md +6 -0
- package/docs/adr/ADR-0009-widget-platform-authority.md +130 -0
- package/docs/adr/ADR-0010-widget-contributions-registry-persistence.md +265 -0
- package/docs/adr/README.md +5 -0
- package/docs/agent-briefs/2026-10-28-agent1-ui-product-foundation.md +132 -0
- package/docs/agent-briefs/2026-10-28-agent2-cms-audit.md +144 -0
- package/docs/agent-briefs/2026-10-28-sites-next-wave-acceptance.md +67 -0
- package/docs/architecture/AGENTSAM-CANONICAL-DISCOVERY-FIRST-SLICE.md +70 -0
- package/docs/architecture/AGENTSAM-PRODUCT-CATALOG-RELEASES-20261028.md +80 -0
- package/docs/architecture/AGENTSAM-REGISTRY-CLI-AGENT-PARITY.md +133 -0
- package/docs/architecture/AGENTSAM_ACCOUNT_FIRST_METRICS_V2_2026-10-28.md +38 -0
- package/docs/architecture/AGENTSAM_APPLICATION_CONTRACT.md +43 -0
- package/docs/architecture/AGENTSAM_WORK_IDE_LANES_2026-10-28.md +51 -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/DESIGN_WORKSPACE_BOUNDARY.md +69 -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/PLATFORM_R2_SOURCE_OF_TRUTH.md +134 -0
- package/docs/architecture/PLUGIN-PRODUCTIZATION-SPINE.md +101 -0
- package/docs/architecture/PROJECTS_DREAMHOUSE_METRICS_SPRINT_2026-10-28.md +34 -0
- package/docs/architecture/SAMOS_PRODUCT_MODEL.md +49 -0
- package/docs/architecture/SAM_KERNEL.md +48 -2
- package/docs/architecture/SAM_RESOURCE_CRUD_STANDARD.md +96 -0
- package/docs/architecture/SAM_SYSTEMATIC_AUTONOMOUS_MACHINERY.md +79 -0
- package/docs/architecture/SCHEMA_AUTHORITIES.md +87 -0
- package/docs/architecture/USER_GLOBAL_AGENT_INSTRUCTIONS.md +55 -0
- package/docs/architecture/brand-presentation-context-discovery-2026-11-01.md +41 -0
- package/docs/architecture/studio-templates-audit-2026-11-01.md +59 -0
- package/docs/audits/2026-10-28-cms-platform-seam-baseline.md +86 -0
- package/docs/audits/2026-10-28-cms-v1-v2-side-by-side.md +53 -0
- package/docs/authoring/agentsam-sdk-docs-portal.json +175 -0
- package/docs/autorag-workflow.md +13 -0
- package/docs/brand/AGENT_SAM_ICON_GRAMMAR.md +4 -0
- package/docs/brand/ICONOGRAPHY-WIP-HANDOFF-20261022.md +36 -0
- package/docs/brand/ICONOGRAPHY_INTEGRATION_AUDIT_2026-10-28.md +39 -0
- package/docs/contracts/capability-install-planner.md +66 -38
- package/docs/contracts/environment-vocabulary.md +5 -5
- package/docs/engineering/CMS_DATA_AUTHORITY_2026-11-03.md +45 -0
- package/docs/engineering/LOCAL_STUDIO_CMS_INSTALL_2026-11-02.md +23 -0
- package/docs/engineering/SUPERBASH_LOCAL_RUNTIME.md +100 -0
- package/docs/evidence/COPRO_CREATIVE_V1_20261030.md +22 -0
- package/docs/evidence/media-library-20261031/README.md +39 -0
- package/docs/generated/SDK_CAPABILITY_INVENTORY.md +312 -0
- package/docs/handoffs/AGENT_HANDOFF_SUPERBASH_AND_MODEL_PERFORMANCE_2026-10-14.md +134 -0
- package/docs/handoffs/COPRO_CREATIVE_V1_AGENT2.md +69 -0
- package/docs/intake/product-capabilities.proposed.ts +232 -0
- package/docs/knowledge-supabase-node-api.md +51 -0
- package/docs/media/local-intake-r2-backup.md +47 -0
- package/docs/operations/CLOUDFLARE-QUEUE-OBSERVABILITY.md +64 -0
- package/docs/operations/WIP_RECONCILIATION_2026-11-02.md +89 -0
- package/docs/plans/AGENTSAM_MEDIA_LIBRARY_AGENT1_MAP_20261031.md +62 -0
- package/docs/plans/AGENTSAM_SDK_RELEASE_PROGRAM.md +145 -0
- package/docs/plans/LOCAL_STUDIO_DESKTOP_RELEASE_2026-09-29.md +5 -3
- 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/TOMORROW-EXTENSIVE-TODO-2026-09-26.md +1 -1
- 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/plugins.md +54 -0
- package/docs/primetech/CREATIVE_ENGINEERING.md +125 -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 +20 -12
- 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 +289 -0
- package/docs/reference/INNERANIMALMEDIA_EXPERIENCE_ACCEPTANCE_2026-10-15.md +99 -0
- package/docs/release/NPM-TRUSTED-PUBLISHING.md +13 -0
- package/docs/releases/INDEPENDENT_PACKAGE_PUBLISHING.md +30 -0
- package/docs/releases/cad-v2-sdk-2.6.13.md +25 -0
- package/docs/roadmaps/2026-10-28-product-platform-stabilization.md +149 -0
- package/docs/roadmaps/ROAD_TO_REAL_DISTRIBUTION.md +97 -0
- package/docs/robotics-chess-handoff.md +15 -0
- package/docs/sprints/2026-11-14-companion-media-product-preview.md +42 -0
- package/docs/standards/DELIVERY_CLOSURE.md +41 -0
- package/docs/standards/SAM_MACHINE_BUILD_AND_GAPS.md +91 -0
- package/docs/studio/oauth-ddl-media-completion-2026-11-01.md +22 -0
- package/docs/studio/pwa-build-meta-agentsam-note.md +9 -0
- package/docs/workflows/ISSUE_TO_SAMOS.md +59 -0
- package/examples/widget-consumer/package.json +12 -0
- package/examples/widget-consumer/src/smoke.mjs +18 -0
- package/migrations/d1/0021_agentsam_product_releases.sql +94 -0
- package/migrations/d1/0022_agentsam_plugin_registry.sql +182 -0
- package/migrations/d1/0023_agentsam_plugin_install_health.sql +33 -0
- package/migrations/d1/0024_user_oauth_tokens_account_spine.sql +61 -0
- package/migrations/d1/0025_meta_model_api_service.sql +7 -0
- package/migrations/d1/0026_identity_github_signin_product.sql +34 -0
- package/migrations/d1/0027_unified_digital_products_collections.sql +72 -0
- package/migrations/d1/README_PORTABLE_CONTROL_PLANE.md +2 -0
- package/migrations/runtime/0010_agentsam_notifications.sql +86 -0
- package/migrations/runtime/0011_agentsam_product_releases.sql +94 -0
- package/native/agentsam-machine/cli/Cargo.toml +1 -1
- package/native/agentsam-machine/cli/LICENSE +110 -0
- package/native/agentsam-machine/core/Cargo.toml +1 -1
- package/native/agentsam-machine/core/LICENSE +110 -0
- package/native/agentsam-machine/core/src/lib.rs +3 -3
- package/package.json +123 -73
- package/packages/agentsam-3d-viewer/LICENSE +110 -0
- package/packages/agentsam-3d-viewer/README.md +58 -0
- package/packages/agentsam-3d-viewer/agentsam.package.json +63 -0
- package/packages/agentsam-3d-viewer/package.json +41 -0
- package/packages/agentsam-3d-viewer/src/format.d.ts +3 -0
- package/packages/agentsam-3d-viewer/src/format.js +24 -0
- package/packages/agentsam-3d-viewer/src/index.d.ts +104 -0
- package/packages/agentsam-3d-viewer/src/index.js +303 -0
- package/packages/agentsam-3d-viewer/src/occt.d.ts +12 -0
- package/packages/agentsam-3d-viewer/src/occt.js +54 -0
- package/packages/agentsam-3d-viewer/test/format.test.mjs +24 -0
- package/packages/agentsam-3d-viewer/test/occt.test.mjs +37 -0
- package/packages/agentsam-3d-viewer/test/viewport.test.mjs +128 -0
- package/packages/agentsam-architectural-intelligence/README.md +8 -0
- package/packages/agentsam-architectural-intelligence/data/materials.json +9 -0
- package/packages/agentsam-architectural-intelligence/data/sources.json +15 -0
- package/packages/agentsam-architectural-intelligence/mcp/server.mjs +80 -0
- package/packages/agentsam-architectural-intelligence/package.json +23 -0
- package/packages/agentsam-architectural-intelligence/test/reference.test.mjs +30 -0
- package/packages/agentsam-architectural-intelligence/test/sam-integration.test.mjs +20 -0
- package/packages/agentsam-brand/LICENSE +110 -0
- package/packages/agentsam-brand/README.md +6 -0
- package/packages/agentsam-brand/package.json +7 -4
- package/packages/agentsam-brand/src/cli/controller.js +28 -1
- package/packages/agentsam-brand/src/core/iconography/build.js +617 -0
- package/packages/agentsam-brand/src/core/iconography/render_clay.py +409 -0
- package/packages/agentsam-brand/src/core/preview.js +4 -0
- package/packages/agentsam-brand/src/core/processors/sharp.js +5 -3
- package/packages/agentsam-brand/src/index.js +2 -0
- package/packages/agentsam-cms/LICENSE +110 -0
- package/packages/agentsam-cms/README.md +71 -0
- package/packages/agentsam-cms/agentsam.package.json +61 -0
- package/packages/agentsam-cms/package.json +47 -0
- package/packages/agentsam-cms/src/account-context.js +135 -0
- package/packages/agentsam-cms/src/aliases.js +74 -0
- package/packages/agentsam-cms/src/application.js +252 -0
- package/packages/agentsam-cms/src/chat-storage.js +300 -0
- package/packages/agentsam-cms/src/contracts.js +147 -0
- package/packages/agentsam-cms/src/index.d.ts +135 -0
- package/packages/agentsam-cms/src/index.js +4 -0
- package/packages/agentsam-cms/src/machine.js +223 -0
- package/packages/agentsam-cms/src/node.d.ts +3 -0
- package/packages/agentsam-cms/src/node.js +8 -0
- package/packages/agentsam-cms/src/site-nav-defaults.js +16 -0
- package/packages/agentsam-cms/src/site-settings-contract.js +37 -0
- package/packages/agentsam-cms/test/application.test.mjs +134 -0
- package/packages/agentsam-cms/test/chat-storage.test.mjs +212 -0
- package/packages/agentsam-cms/test/standalone.test.mjs +89 -0
- package/packages/agentsam-cms/test/support/memory-repository.mjs +78 -0
- package/packages/agentsam-communications/README.md +52 -0
- package/packages/agentsam-communications/package.json +30 -0
- package/packages/agentsam-communications/src/adapters.js +78 -0
- package/packages/agentsam-communications/src/index.js +3 -0
- package/packages/agentsam-communications/src/outbox.js +56 -0
- package/packages/agentsam-communications/src/service.js +126 -0
- package/packages/agentsam-communications/test/communications.test.mjs +188 -0
- package/packages/agentsam-contracts/README.md +23 -0
- package/packages/agentsam-contracts/agentsam.package.json +43 -0
- package/packages/agentsam-contracts/dist/authority.d.ts +2 -1
- package/packages/agentsam-contracts/dist/authority.js +12 -0
- package/packages/agentsam-contracts/dist/design-workspace-bridge.d.ts +20 -0
- package/packages/agentsam-contracts/dist/design-workspace-registry.d.ts +12 -0
- package/packages/agentsam-contracts/dist/design-workspace-registry.js +133 -0
- package/packages/agentsam-contracts/dist/design-workspace.d.ts +115 -0
- package/packages/agentsam-contracts/dist/design-workspace.js +64 -0
- package/packages/agentsam-contracts/dist/errors.d.ts +1 -1
- package/packages/agentsam-contracts/dist/index.d.ts +7 -0
- package/packages/agentsam-contracts/dist/index.js +580 -0
- package/packages/agentsam-contracts/dist/operations.d.ts +138 -0
- package/packages/agentsam-contracts/dist/operations.js +117 -0
- package/packages/agentsam-contracts/dist/resource-scope.d.ts +24 -0
- package/packages/agentsam-contracts/dist/resource-scope.js +25 -0
- package/packages/agentsam-contracts/dist/source-types.d.ts +92 -0
- package/packages/agentsam-contracts/dist/source-types.js +13 -0
- package/packages/agentsam-contracts/dist/spawn-policy.d.ts +32 -0
- package/packages/agentsam-contracts/dist/spawn-policy.js +27 -0
- package/packages/agentsam-contracts/dist/tools.d.ts +12 -5
- package/packages/agentsam-contracts/dist/tools.js +164 -0
- package/packages/agentsam-contracts/dist/widgets.d.ts +7 -0
- package/packages/agentsam-contracts/package.json +34 -4
- package/packages/agentsam-contracts/schemas/agent-tool-definition.v1.schema.json +78 -0
- package/packages/agentsam-contracts/schemas/sam-operation.v1.schema.json +159 -0
- package/packages/agentsam-contracts/schemas/sam-result.v1.schema.json +76 -0
- package/packages/agentsam-contracts/schemas/source-types.v2.json +9381 -0
- package/packages/agentsam-contracts/schemas/source-types.v2.schema.json +571 -0
- package/packages/agentsam-contracts/scripts/build.mjs +21 -5
- package/packages/agentsam-contracts/src/authority.ts +9 -7
- package/packages/agentsam-contracts/src/design-workspace-bridge.ts +99 -0
- package/packages/agentsam-contracts/src/design-workspace-registry.ts +130 -0
- package/packages/agentsam-contracts/src/design-workspace.ts +256 -0
- package/packages/agentsam-contracts/src/errors.ts +1 -1
- package/packages/agentsam-contracts/src/index.ts +7 -0
- package/packages/agentsam-contracts/src/operations.ts +229 -0
- package/packages/agentsam-contracts/src/resource-scope.ts +39 -0
- package/packages/agentsam-contracts/src/source-types.ts +92 -0
- package/packages/agentsam-contracts/src/spawn-policy.ts +43 -0
- package/packages/agentsam-contracts/src/tools.ts +145 -25
- package/packages/agentsam-contracts/src/widgets.ts +7 -0
- package/packages/agentsam-contracts/test/contracts.test.mjs +112 -2
- package/packages/agentsam-contracts/test/design-workspace.test.mjs +238 -0
- package/packages/agentsam-contracts/test/resource-scope.test.mjs +22 -0
- package/packages/agentsam-contracts/test/source-types.test.mjs +31 -0
- package/packages/agentsam-contracts/test/spawn-policy.test.mjs +20 -0
- package/packages/agentsam-desktop-shell/LICENSE +110 -0
- package/packages/agentsam-desktop-shell/README.md +73 -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 +2 -2
- package/packages/agentsam-errors/protocol/agentsam.error.v2.schema.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/LICENSE +110 -0
- package/packages/agentsam-goap/agentsam.package.json +42 -0
- package/packages/agentsam-goap/package.json +4 -4
- 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 +2 -2
- package/packages/agentsam-hooks/schema/manifest.json +1 -1
- package/packages/agentsam-hooks/src/errors-generated.js +10 -0
- package/packages/agentsam-ide/LICENSE +110 -0
- package/packages/agentsam-ide/README.md +147 -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/LICENSE +110 -0
- package/packages/agentsam-knowledge/agentsam.package.json +42 -0
- package/packages/agentsam-knowledge/package.json +3 -3
- 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/LICENSE +110 -0
- package/packages/agentsam-merch/README.md +59 -39
- package/packages/agentsam-merch/agentsam.package.json +43 -0
- package/packages/agentsam-merch/package.json +18 -3
- package/packages/agentsam-merch/profiles/completeful/dtg-back-large.json +1 -1
- package/packages/agentsam-merch/profiles/completeful/laser-engraving.json +1 -1
- package/packages/agentsam-merch/profiles/generic/embroidery-digitization.json +1 -1
- package/packages/agentsam-merch/schemas/collection-candidate.schema.json +1 -1
- package/packages/agentsam-merch/schemas/manufacturing-profile.schema.json +1 -1
- package/packages/agentsam-merch/src/adapters-printify.js +66 -0
- package/packages/agentsam-merch/src/collection-planning.d.ts +46 -0
- package/packages/agentsam-merch/src/collection-planning.js +135 -0
- package/packages/agentsam-merch/src/collection-showcase.css +34 -0
- package/packages/agentsam-merch/src/collection-showcase.d.ts +2 -0
- package/packages/agentsam-merch/src/collection-showcase.js +62 -0
- package/packages/agentsam-merch/src/compatibility.js +18 -1
- package/packages/agentsam-merch/src/geometry.js +82 -0
- package/packages/agentsam-merch/src/index.d.ts +33 -0
- package/packages/agentsam-merch/src/index.js +2 -0
- package/packages/agentsam-merch/src/merch-hero.css +32 -0
- package/packages/agentsam-merch/src/merch-hero.d.ts +5 -0
- package/packages/agentsam-merch/src/merch-hero.js +123 -0
- package/packages/agentsam-merch/src/node/index.js +1 -0
- package/packages/agentsam-merch/src/node/vector.js +83 -0
- package/packages/agentsam-merch/test/collection-planning.test.mjs +17 -0
- package/packages/agentsam-merch/test/collection-showcase.test.mjs +12 -0
- package/packages/agentsam-merch/test/geometry.test.mjs +32 -0
- package/packages/agentsam-merch/test/printify-adapter.test.mjs +42 -0
- package/packages/agentsam-merch/test/svg-normalization.test.mjs +33 -0
- package/packages/agentsam-nav/LICENSE +110 -0
- package/packages/agentsam-nav/README.md +21 -1
- package/packages/agentsam-nav/dist/AdminAppsDialog.d.ts +15 -0
- package/packages/agentsam-nav/dist/Nav.d.ts +3 -1
- package/packages/agentsam-nav/dist/NavProvider.d.ts +8 -1
- package/packages/agentsam-nav/dist/NavTrigger.d.ts +1 -1
- package/packages/agentsam-nav/dist/Surfaces.d.ts +16 -1
- package/packages/agentsam-nav/dist/browser.d.ts +18 -0
- package/packages/agentsam-nav/dist/browser.global.js +63 -26
- package/packages/agentsam-nav/dist/browser.js +7589 -6094
- package/packages/agentsam-nav/dist/contracts.d.ts +71 -2
- package/packages/agentsam-nav/dist/index.d.ts +4 -0
- package/packages/agentsam-nav/dist/index.js +1356 -192
- package/packages/agentsam-nav/dist/legacy.css +7 -4
- package/packages/agentsam-nav/dist/shell.css +380 -11
- package/packages/agentsam-nav/dist/state.d.ts +25 -0
- package/packages/agentsam-nav/dist/theme.css +380 -11
- package/packages/agentsam-nav/dist/useAdminApps.d.ts +55 -0
- package/packages/agentsam-nav/dist/utils.d.ts +4 -0
- package/packages/agentsam-nav/package.json +7 -3
- package/packages/agentsam-occt/.native-build/CMakeCache.txt +433 -0
- package/packages/agentsam-occt/.native-build/CMakeFiles/4.4.4/CMakeCXXCompiler.cmake +103 -0
- package/packages/agentsam-occt/.native-build/CMakeFiles/4.4.4/CMakeDetermineCompilerABI_CXX.bin +0 -0
- package/packages/agentsam-occt/.native-build/CMakeFiles/4.4.4/CMakeSystem.cmake +15 -0
- package/packages/agentsam-occt/.native-build/CMakeFiles/4.4.4/CompilerIdCXX/CMakeCXXCompilerId.cpp +954 -0
- package/packages/agentsam-occt/.native-build/CMakeFiles/4.4.4/CompilerIdCXX/a.out +0 -0
- package/packages/agentsam-occt/.native-build/CMakeFiles/4.4.4/CompilerIdCXX/apple-sdk.cpp +1 -0
- package/packages/agentsam-occt/.native-build/CMakeFiles/CMakeConfigureLog.yaml +2968 -0
- package/packages/agentsam-occt/.native-build/CMakeFiles/CMakeDirectoryInformation.cmake +16 -0
- package/packages/agentsam-occt/.native-build/CMakeFiles/InstallScripts.json +7 -0
- package/packages/agentsam-occt/.native-build/CMakeFiles/Makefile.cmake +53 -0
- package/packages/agentsam-occt/.native-build/CMakeFiles/Makefile2 +157 -0
- package/packages/agentsam-occt/.native-build/CMakeFiles/TargetDirectories.txt +4 -0
- package/packages/agentsam-occt/.native-build/CMakeFiles/agentsam-occt.dir/DependInfo.cmake +24 -0
- package/packages/agentsam-occt/.native-build/CMakeFiles/agentsam-occt.dir/build.make +146 -0
- package/packages/agentsam-occt/.native-build/CMakeFiles/agentsam-occt.dir/cmake_clean.cmake +13 -0
- package/packages/agentsam-occt/.native-build/CMakeFiles/agentsam-occt.dir/compiler_depend.internal +3152 -0
- package/packages/agentsam-occt/.native-build/CMakeFiles/agentsam-occt.dir/compiler_depend.make +6886 -0
- package/packages/agentsam-occt/.native-build/CMakeFiles/agentsam-occt.dir/compiler_depend.ts +2 -0
- package/packages/agentsam-occt/.native-build/CMakeFiles/agentsam-occt.dir/depend.make +2 -0
- package/packages/agentsam-occt/.native-build/CMakeFiles/agentsam-occt.dir/engine.cpp.o +0 -0
- package/packages/agentsam-occt/.native-build/CMakeFiles/agentsam-occt.dir/engine.cpp.o.d +1868 -0
- package/packages/agentsam-occt/.native-build/CMakeFiles/agentsam-occt.dir/flags.make +12 -0
- package/packages/agentsam-occt/.native-build/CMakeFiles/agentsam-occt.dir/link.txt +1 -0
- package/packages/agentsam-occt/.native-build/CMakeFiles/agentsam-occt.dir/main.cpp.o +0 -0
- package/packages/agentsam-occt/.native-build/CMakeFiles/agentsam-occt.dir/main.cpp.o.d +1279 -0
- package/packages/agentsam-occt/.native-build/CMakeFiles/agentsam-occt.dir/progress.make +4 -0
- package/packages/agentsam-occt/.native-build/CMakeFiles/agentsam-sketch-solver.dir/DependInfo.cmake +23 -0
- package/packages/agentsam-occt/.native-build/CMakeFiles/agentsam-sketch-solver.dir/build.make +114 -0
- package/packages/agentsam-occt/.native-build/CMakeFiles/agentsam-sketch-solver.dir/cmake_clean.cmake +11 -0
- package/packages/agentsam-occt/.native-build/CMakeFiles/agentsam-sketch-solver.dir/cmake_clean_target.cmake +3 -0
- package/packages/agentsam-occt/.native-build/CMakeFiles/agentsam-sketch-solver.dir/compiler_depend.internal +1256 -0
- package/packages/agentsam-occt/.native-build/CMakeFiles/agentsam-sketch-solver.dir/compiler_depend.make +3757 -0
- package/packages/agentsam-occt/.native-build/CMakeFiles/agentsam-sketch-solver.dir/compiler_depend.ts +2 -0
- package/packages/agentsam-occt/.native-build/CMakeFiles/agentsam-sketch-solver.dir/depend.make +2 -0
- package/packages/agentsam-occt/.native-build/CMakeFiles/agentsam-sketch-solver.dir/flags.make +12 -0
- package/packages/agentsam-occt/.native-build/CMakeFiles/agentsam-sketch-solver.dir/link.txt +2 -0
- package/packages/agentsam-occt/.native-build/CMakeFiles/agentsam-sketch-solver.dir/progress.make +3 -0
- package/packages/agentsam-occt/.native-build/CMakeFiles/agentsam-sketch-solver.dir/sketch_solver.cpp.o +0 -0
- package/packages/agentsam-occt/.native-build/CMakeFiles/agentsam-sketch-solver.dir/sketch_solver.cpp.o.d +1252 -0
- package/packages/agentsam-occt/.native-build/CMakeFiles/cmake.check_cache +1 -0
- package/packages/agentsam-occt/.native-build/CMakeFiles/progress.marks +1 -0
- package/packages/agentsam-occt/.native-build/Makefile +249 -0
- package/packages/agentsam-occt/.native-build/agentsam-occt +0 -0
- package/packages/agentsam-occt/.native-build/cmake_install.cmake +61 -0
- package/packages/agentsam-occt/.native-build/libagentsam-sketch-solver.a +0 -0
- package/packages/agentsam-occt/LICENSE +110 -0
- package/packages/agentsam-occt/README.md +100 -0
- package/packages/agentsam-occt/agentsam.package.json +60 -0
- package/packages/agentsam-occt/dist/browser.d.ts +32 -0
- package/packages/agentsam-occt/dist/browser.js +71 -0
- package/packages/agentsam-occt/dist/browser.js.map +1 -0
- package/packages/agentsam-occt/dist/index.d.ts +8 -0
- package/packages/agentsam-occt/dist/index.js +25 -0
- package/packages/agentsam-occt/dist/index.js.map +1 -0
- package/packages/agentsam-occt/dist/native-provider.d.mts +107 -0
- package/packages/agentsam-occt/dist/native-provider.mjs +177 -0
- package/packages/agentsam-occt/dist/native-provider.mjs.map +1 -0
- package/packages/agentsam-occt/dist/native-session.d.mts +8 -0
- package/packages/agentsam-occt/dist/native-session.mjs +64 -0
- package/packages/agentsam-occt/dist/native-session.mjs.map +1 -0
- package/packages/agentsam-occt/native/CMakeLists.txt +47 -0
- package/packages/agentsam-occt/native/engine.cpp +864 -0
- package/packages/agentsam-occt/native/engine.hpp +2 -0
- package/packages/agentsam-occt/native/main.cpp +123 -0
- package/packages/agentsam-occt/native/sketch_solver.cpp +198 -0
- package/packages/agentsam-occt/native/sketch_solver.hpp +5 -0
- package/packages/agentsam-occt/package.json +46 -0
- package/packages/agentsam-occt/src/browser.ts +92 -0
- package/packages/agentsam-occt/src/index.js +24 -0
- package/packages/agentsam-occt/src/native-provider.mjs +156 -0
- package/packages/agentsam-occt/src/native-session.d.mts +5 -0
- package/packages/agentsam-occt/src/native-session.mjs +35 -0
- package/packages/agentsam-occt/test/browser-provider.test.mjs +90 -0
- package/packages/agentsam-occt/test/contracts.test.mjs +32 -0
- package/packages/agentsam-occt/test/native-engine.test.mjs +49 -0
- package/packages/agentsam-occt/tsconfig.json +18 -0
- package/packages/agentsam-queue-control/LICENSE +110 -0
- package/packages/agentsam-queue-control/agentsam.package.json +42 -0
- package/packages/agentsam-queue-control/package.json +3 -3
- package/packages/agentsam-queue-control/schemas/job-envelope.schema.json +1 -1
- package/packages/agentsam-queue-control/src/adapters/cloudflare.js +39 -3
- package/packages/agentsam-queue-control/test/cloudflare-observability.test.mjs +54 -0
- package/packages/agentsam-rapid-rust/Cargo.toml +6 -1
- package/packages/agentsam-rapid-rust/LICENSE +110 -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/LICENSE +110 -0
- package/packages/agentsam-repository/README.md +25 -0
- package/packages/agentsam-repository/agentsam.package.json +42 -0
- package/packages/agentsam-repository/package.json +8 -5
- 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/LICENSE +110 -0
- package/packages/agentsam-vault/package.json +3 -3
- package/packages/agentsam-workbench/LICENSE +110 -0
- package/packages/agentsam-workbench/README.md +18 -0
- package/packages/agentsam-workbench/package.json +29 -5
- package/packages/agentsam-workbench/src/agent/AgentRuntimeField.tsx +12 -7
- package/packages/agentsam-workbench/src/agent/Composer.tsx +10 -3
- package/packages/agentsam-workbench/src/agent/MiniAgentSam.tsx +129 -16
- package/packages/agentsam-workbench/src/agent/SelectionToolbar.tsx +161 -0
- package/packages/agentsam-workbench/src/agent/capability-catalog.ts +103 -0
- package/packages/agentsam-workbench/src/agent/index.ts +4 -0
- package/packages/agentsam-workbench/src/agent/mini-agentsam.css +18 -6
- package/packages/agentsam-workbench/src/agent/selection-toolbar.css +84 -0
- package/packages/agentsam-workbench/src/design/DesignWorkspaceFrame.tsx +209 -0
- package/packages/agentsam-workbench/src/design/canvas-handoff.ts +44 -0
- package/packages/agentsam-workbench/src/design/design-workspace.css +267 -0
- package/packages/agentsam-workbench/src/design/index.ts +7 -0
- package/packages/agentsam-workbench/src/index.ts +1 -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/resources/ResourceCard.tsx +90 -0
- package/packages/agentsam-workbench/src/resources/index.ts +6 -0
- package/packages/agentsam-workbench/src/resources/resource-card.css +174 -0
- package/packages/agentsam-workbench/src/widgets/BuiltinWidget.tsx +6 -0
- package/packages/agentsam-workbench/src/widgets/CalculatorWidget.tsx +81 -0
- package/packages/agentsam-workbench/src/widgets/ClockWidget.tsx +66 -0
- package/packages/agentsam-workbench/src/widgets/QueueDepthWidget.tsx +122 -0
- package/packages/agentsam-workbench/src/widgets/calculator.ts +57 -0
- package/packages/agentsam-workbench/src/widgets/clock.ts +54 -0
- package/packages/agentsam-workbench/src/widgets/index.ts +5 -0
- package/packages/agentsam-workbench/src/widgets/registry.ts +269 -1
- package/packages/agentsam-workbench/src/widgets/widgets.css +31 -0
- 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/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/theme-contract.json +34 -0
- package/packages/catalog/evidence/theme-scenes.json +59 -0
- package/packages/catalog/generated/packages.json +2496 -0
- package/packages/catalog/src/theme-products.mjs +64 -0
- package/packages/catalog/topics/runtime.json +33 -0
- package/packages/connectors/cfoa/LICENSE +110 -0
- package/packages/connectors/cfoa/OAUTH_STORAGE_AUDIT.md +5 -0
- package/packages/connectors/cfoa/agentsam.package.json +46 -0
- package/packages/connectors/cfoa/package.json +2 -2
- package/packages/connectors/cfoa/src/api-client.js +54 -8
- package/packages/connectors/cfoa/src/capabilities.js +63 -3
- package/packages/connectors/cfoa/src/credential.js +381 -48
- 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/families/media.js +622 -0
- package/packages/connectors/cfoa/src/index.js +39 -2
- package/packages/connectors/cfoa/src/oauth-persist.js +231 -95
- package/packages/connectors/cfoa/src/routes.js +281 -36
- package/packages/connectors/cfoa/src/scope-catalog.js +14 -1
- package/packages/connectors/cfoa/test/analytics-sql.test.mjs +27 -0
- package/packages/connectors/cfoa/test/basin.test.mjs +30 -0
- package/packages/connectors/cfoa/tests/api-client-fetch.test.mjs +71 -0
- package/packages/connectors/cfoa/tests/capabilities.test.mjs +28 -3
- package/packages/connectors/cfoa/tests/connector.test.mjs +5 -5
- package/packages/connectors/cfoa/tests/cross-host-recovery.test.mjs +125 -0
- package/packages/connectors/cfoa/tests/media-discovery.test.mjs +260 -0
- package/packages/connectors/cfoa/tests/oauth-persist.test.mjs +114 -14
- package/packages/identity/.agentsam/features/oauth-login-portal/agentsam.feature.json +1 -1
- package/packages/identity/LICENSE +110 -0
- package/packages/identity/README.md +25 -0
- package/packages/identity/agentsam.package.json +42 -0
- package/packages/identity/migrations/apply-portable.js +1 -0
- package/packages/identity/migrations/sqlite/006_identity_account_security.sql +31 -0
- package/packages/identity/package.json +4 -2
- package/packages/identity/schema/agentsam.identity/manifest.json +31 -9
- package/packages/identity/src/adapters/account-security-store.js +236 -0
- package/packages/identity/src/adapters/iam-compat/index.js +13 -0
- package/packages/identity/src/adapters/portable-store.js +15 -0
- package/packages/identity/src/contracts/sign-in-options.js +10 -0
- package/packages/identity/src/core/account-security.js +149 -0
- package/packages/identity/src/frontend/auth-portal/pages/login.html +14 -2
- package/packages/identity/src/frontend/auth-portal/pages/signup.html +10 -4
- package/packages/identity/src/frontend/merchant-onboarding/store-start.css +9 -0
- package/packages/identity/src/frontend/merchant-onboarding/store-start.html +73 -0
- package/packages/identity/src/frontend/merchant-onboarding/store-start.js +166 -0
- package/packages/identity/src/migrations/0004_account_security.sql +24 -0
- 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/merchant-onboarding.js +103 -0
- package/packages/identity/src/server/worker-router.js +255 -6
- package/packages/identity/tests/account-security.test.mjs +341 -0
- package/packages/identity/tests/chatgpt-provider.test.mjs +4 -2
- package/packages/identity/tests/lane1-packed-consumer.test.mjs +28 -3
- package/packages/identity/tests/merchant-onboarding-portability.test.mjs +77 -0
- package/packages/identity/tests/password-enrollment.test.mjs +82 -0
- package/packages/identity/tests/password-reset.test.mjs +43 -0
- package/packages/identity/tests/portable-identity-architecture.test.mjs +3 -3
- package/packages/identity/tests/preview-auth-portal.test.mjs +2 -0
- package/packages/identity/tests/stock-product-provenance.test.mjs +22 -0
- package/packages/primetech-procedures/README.md +61 -0
- package/packages/primetech-procedures/agentsam.package.json +63 -0
- package/packages/primetech-procedures/package.json +22 -0
- package/packages/primetech-procedures/procedures/cad.motor-bearing-end-plate/README.md +21 -0
- package/packages/primetech-procedures/procedures/cad.motor-bearing-end-plate/__pycache__/test_generate_toolpaths.cpython-314.pyc +0 -0
- package/packages/primetech-procedures/procedures/cad.motor-bearing-end-plate/build_freecad.py +514 -0
- package/packages/primetech-procedures/procedures/cad.motor-bearing-end-plate/finalize_bundle.py +26 -0
- package/packages/primetech-procedures/procedures/cad.motor-bearing-end-plate/generate_assets.py +284 -0
- package/packages/primetech-procedures/procedures/cad.motor-bearing-end-plate/generate_toolpaths.py +715 -0
- package/packages/primetech-procedures/procedures/cad.motor-bearing-end-plate/package_artifacts.py +154 -0
- package/packages/primetech-procedures/procedures/cad.motor-bearing-end-plate/parameters.json +51 -0
- package/packages/primetech-procedures/procedures/cad.motor-bearing-end-plate/procedure.json +101 -0
- package/packages/primetech-procedures/procedures/cad.motor-bearing-end-plate/render_preview.py +98 -0
- package/packages/primetech-procedures/procedures/cad.motor-bearing-end-plate/run.py +214 -0
- package/packages/primetech-procedures/procedures/cad.motor-bearing-end-plate/test_generate_toolpaths.py +50 -0
- package/packages/primetech-procedures/procedures/repo.asset.inventory/__pycache__/run.cpython-312.pyc +0 -0
- package/packages/primetech-procedures/procedures/repo.asset.inventory/procedure.json +65 -0
- package/packages/primetech-procedures/procedures/repo.asset.inventory/run.py +116 -0
- package/packages/primetech-procedures/procedures/repo.asset.inventory/run.sh +11 -0
- package/packages/primetech-procedures/profiles/PRIMETECH_PROCEDURE_ENGINEER.md +25 -0
- package/packages/primetech-procedures/src/index.js +547 -0
- package/packages/primetech-procedures/test/__pycache__/test_inventory.cpython-312.pyc +0 -0
- package/packages/primetech-procedures/test/procedure.test.mjs +207 -0
- package/packages/primetech-procedures/test/test_inventory.py +57 -0
- package/packages/providers/completeful/LICENSE +110 -0
- package/packages/providers/completeful/README.md +67 -27
- package/packages/providers/completeful/dist/client.d.ts +118 -0
- package/packages/providers/completeful/dist/client.js +221 -0
- package/packages/providers/completeful/dist/generated/operations.generated.d.ts +760 -0
- package/packages/providers/completeful/dist/generated/operations.generated.js +931 -0
- package/packages/providers/completeful/dist/generated/types.generated.d.ts +1173 -0
- package/packages/providers/completeful/dist/generated/types.generated.js +1 -0
- package/packages/providers/completeful/openapi/openapi.json +5320 -0
- package/packages/providers/completeful/package.json +34 -8
- package/packages/providers/completeful/scripts/generate.mjs +156 -0
- package/packages/providers/completeful/src/client.js +12 -162
- package/packages/providers/completeful/src/core/client.ts +248 -0
- package/packages/providers/completeful/src/core/generated/operations.generated.ts +931 -0
- package/packages/providers/completeful/src/core/generated/types.generated.ts +94 -0
- package/packages/providers/completeful/src/index.d.ts +24 -0
- package/packages/providers/completeful/src/index.js +3 -0
- package/packages/providers/completeful/test/openapi.test.mjs +70 -0
- package/packages/providers/completeful/test/types/consumer.ts +30 -0
- package/packages/providers/completeful/test/types/tsconfig.json +12 -0
- package/packages/providers/completeful/tsconfig.json +15 -0
- package/packages/theme-scenes/LICENSE +110 -0
- package/packages/theme-scenes/README.md +57 -2
- package/packages/theme-scenes/agentsam.package.json +65 -0
- package/packages/theme-scenes/package.json +11 -12
- package/packages/theme-scenes/src/cms/adapter.js +232 -0
- package/packages/theme-scenes/src/cms/browser.js +5 -0
- package/packages/theme-scenes/src/cms/index.js +22 -0
- package/packages/theme-scenes/src/cms/runtime.js +524 -0
- package/packages/theme-scenes/src/contracts/index.js +40 -0
- package/packages/theme-scenes/src/index.js +1 -0
- package/packages/theme-scenes/src/runtime/compile.js +24 -0
- package/packages/theme-scenes/src/scenes/index.js +3 -1
- package/packages/theme-scenes/src/visuals/index.js +7 -0
- package/packages/theme-scenes/test/cms.test.mjs +118 -0
- package/packages/theme-scenes/test/theme-scenes.test.mjs +52 -0
- package/packages/work-graph/LICENSE +110 -0
- package/packages/work-graph/agentsam.package.json +42 -0
- package/packages/work-graph/package.json +2 -2
- package/protocol/README.md +2 -2
- package/protocol/apps/agentsam.app.v1.schema.json +28 -2
- package/protocol/apps/agentsam.host-install.v1.schema.json +1 -1
- package/protocol/assets/asset-record.v1.schema.json +1 -1
- package/protocol/brand/brandpack.v1.schema.json +1 -1
- package/protocol/cad/README.md +85 -0
- package/protocol/cad/blender-recipe.schema.json +1 -1
- package/protocol/cad/cad.project.v2.schema.json +554 -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/canvas/knowledge-core.mjs +35 -0
- package/protocol/capabilities/capability-manifest.schema.json +1 -1
- package/protocol/capabilities/cloudflare-cpu-audit-input.schema.json +1 -1
- package/protocol/capabilities/cloudflare-cpu-profile-input.schema.json +1 -1
- package/protocol/capabilities/cloudflare-wrangler-native-input.schema.json +1 -1
- package/protocol/capabilities/evidence-manifest.schema.json +404 -0
- package/protocol/capabilities/knowledge-search-input.schema.json +1 -1
- package/protocol/capabilities/manifest.json +135 -9
- package/protocol/capabilities/repository-audit-input.schema.json +1 -1
- package/protocol/capabilities/repository-audit.schema.json +1 -1
- package/protocol/capabilities/repository-crawl-input.schema.json +18 -0
- package/protocol/capabilities/repository-crawl-result.schema.json +80 -0
- package/protocol/capabilities/repository-mine-input.schema.json +28 -0
- package/protocol/capabilities/repository-mine-result.schema.json +52 -0
- package/protocol/capabilities/repository-snapshot-input.schema.json +1 -1
- package/protocol/capabilities/repository-snapshot.schema.json +1 -1
- 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/capabilities/terminal-exec-input.schema.json +1 -1
- package/protocol/context/context-budget.schema.json +1 -1
- package/protocol/context/context-item.schema.json +1 -1
- package/protocol/context/resolved-context-pack.schema.json +3 -3
- package/protocol/context/result-policy.schema.json +1 -1
- package/protocol/contracts/source-types.v2.json +9381 -0
- package/protocol/contracts/source-types.v2.schema.json +571 -0
- package/protocol/credentials/issue.v1.schema.json +2 -2
- package/protocol/database/agentsam.schema-pack.v1.schema.json +1 -1
- package/protocol/database/connection.v1.schema.json +1 -1
- package/protocol/embeddings/embedding-profile.v1.schema.json +1 -1
- package/protocol/errors/agentsam.error.v2.schema.json +1 -1
- package/protocol/errors/error-catalog.json +12 -0
- package/protocol/errors/error-envelope.schema.json +1 -1
- package/protocol/errors/recovery.v1.schema.json +1 -1
- package/protocol/features/agentsam.feature.v1.schema.json +1 -1
- package/protocol/governance/distribution-roadmap.v1.json +335 -0
- package/protocol/governance/github-labels.v1.json +232 -0
- package/protocol/hooks/README.md +2 -0
- package/protocol/hooks/agentsam.hook.output.v1.schema.json +1 -1
- package/protocol/hooks/agentsam.hook.receipt.v1.schema.json +1 -1
- package/protocol/hooks/agentsam.hook.v1.schema.json +1 -1
- package/protocol/hooks/agentsam.hooks.config.v1.schema.json +1 -1
- package/protocol/knowledge/chunk.schema.json +1 -1
- package/protocol/knowledge/context-pack.schema.json +3 -3
- package/protocol/knowledge/document.schema.json +1 -1
- package/protocol/knowledge/index-config.schema.json +1 -1
- package/protocol/knowledge/ingest-receipt.schema.json +1 -1
- package/protocol/knowledge/repository.schema.json +1 -1
- package/protocol/knowledge/retrieval-hit.schema.json +1 -1
- package/protocol/knowledge/retrieval-query.schema.json +2 -2
- package/protocol/knowledge/source.schema.json +1 -1
- package/protocol/local-engine/benchmark.v1.schema.json +1 -1
- package/protocol/local-engine/engine.v1.schema.json +1 -1
- package/protocol/models/discovery.mjs +409 -0
- package/protocol/models/model-inventory-v2.schema.json +1 -1
- package/protocol/models/provider-model-snapshot.v1.schema.json +1 -1
- package/protocol/models/workers-ai-curated.mjs +14 -0
- package/protocol/notifications/README.md +45 -0
- package/protocol/packages/agentsam.package-schema-registry.v1.schema.json +108 -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/presets/catalog.json +4 -4
- package/protocol/product-releases/README.md +132 -0
- package/protocol/receipts/agentsam.receipt.v1.json +2 -2
- package/protocol/recon/finding-report.schema.json +1 -1
- package/protocol/recon/task-packet.schema.json +1 -1
- package/protocol/repository/repository-contract.schema.json +1 -1
- package/protocol/repository/repository-dependency.schema.json +1 -1
- package/protocol/repository/repository-identity.schema.json +1 -1
- package/protocol/runtime/agentsam.runtime.v1.schema.json +1 -1
- package/protocol/runtime/primetech-procedure.v1.schema.json +125 -0
- package/protocol/runtime/terminal-exec.conformance.v1.json +88 -0
- package/protocol/runtime/workspace-fs.conformance.v1.json +96 -0
- package/protocol/runtime/workspace-fs.v1.schema.json +2 -1
- package/protocol/sam/activity.v1.schema.json +1 -1
- package/protocol/sam/answer.v1.schema.json +1 -1
- package/protocol/sam/calibration.v1.schema.json +1 -1
- package/protocol/sam/decision-receipt.v1.schema.json +1 -1
- package/protocol/sam/evaluation.v1.schema.json +1 -1
- package/protocol/sam/operation.schema.json +103 -10
- package/protocol/sam/outcome.v1.schema.json +1 -1
- package/protocol/sam/question.v1.schema.json +1 -1
- package/protocol/sam/result.schema.json +33 -10
- package/protocol/sam/state.v1.schema.json +1 -1
- package/protocol/scoring/scorecard.v1.schema.json +1 -1
- package/protocol/skills/agentsam.interaction.v1.schema.json +1 -1
- package/protocol/skills/agentsam.skill.v1.schema.json +1 -1
- package/protocol/theme-refinery/product-metadata.schema.json +1 -1
- package/protocol/theme-refinery/reconciliation-receipt.schema.json +1 -1
- package/protocol/tools/agent-tool-definition.v1.schema.json +78 -0
- package/protocol/ui/agentsam.ui-quality.v1.schema.json +31 -0
- package/protocol/ui/icon.v1.schema.json +1 -1
- package/python/README.md +97 -21
- package/python/agentsam_sdk/__init__.py +9 -2
- package/python/agentsam_sdk/assets/__init__.py +4 -0
- package/python/agentsam_sdk/assets/geaux_boot.json +25 -0
- package/python/agentsam_sdk/assets/procedures.py +40 -0
- package/python/agentsam_sdk/cad/__init__.py +5 -0
- package/python/agentsam_sdk/cad/native.py +189 -0
- package/python/agentsam_sdk/cad/occt.py +96 -0
- package/python/agentsam_sdk/cli.py +57 -12
- package/python/agentsam_sdk/client.py +402 -0
- package/python/agentsam_sdk/data/d1_adapter.py +71 -2
- package/python/agentsam_sdk/diagnostics.py +44 -0
- package/python/agentsam_sdk/errors/vocabulary.py +10 -0
- package/python/agentsam_sdk/procedures/__init__.py +4 -0
- package/python/agentsam_sdk/procedures/client.py +75 -0
- package/python/agentsam_sdk/py.typed +0 -0
- package/python/agentsam_sdk/runtime/native.py +918 -0
- package/python/agentsam_sdk/terminal_art.py +85 -0
- package/python/agentsam_sdk/terminal_ui.py +187 -0
- package/python/agentsam_sdk/tui/README.md +3 -3
- package/python/agentsam_sdk/tui/__init__.py +1 -1
- package/python/agentsam_sdk/tui/bootstrap.py +2 -2
- package/python/agentsam_sdk/tui/demo.py +2 -2
- package/python/docs/gaps.md +12 -3
- package/python/docs/release.md +55 -0
- package/python/pyproject.toml +33 -6
- package/python/scripts/check-dist.py +65 -0
- package/python/tests/test_asset_procedure_api.py +66 -0
- package/python/tests/test_cad_native.py +73 -0
- package/python/tests/test_cad_occt.py +52 -0
- package/python/tests/test_cli_distribution.py +82 -0
- package/python/tests/test_d1_write_adapter.py +66 -0
- package/python/tests/test_native_runtime.py +298 -0
- package/python/tests/test_packaging.py +43 -0
- package/python/tests/test_procedure_client.py +80 -0
- package/python/tests/test_public_client.py +85 -0
- package/python/tests/test_terminal_art.py +36 -0
- package/services/cad/blender/adapter.py +0 -0
- package/services/cad/occt/CMakeLists.txt +9 -0
- package/services/cad/occt/README.md +14 -0
- package/services/cad/server.py +327 -26
- package/skills/README.md +18 -4
- package/skills/agentsam-arch-accessibility/SKILL.md +19 -0
- package/skills/agentsam-arch-accessibility/agentsam.skill.json +20 -0
- package/skills/agentsam-arch-assemblies/SKILL.md +20 -0
- package/skills/agentsam-arch-assemblies/agentsam.skill.json +20 -0
- package/skills/agentsam-arch-bim/SKILL.md +20 -0
- package/skills/agentsam-arch-bim/agentsam.skill.json +20 -0
- package/skills/agentsam-arch-cad/SKILL.md +19 -0
- package/skills/agentsam-arch-cad/agentsam.skill.json +20 -0
- package/skills/agentsam-arch-codes/SKILL.md +19 -0
- package/skills/agentsam-arch-codes/agentsam.skill.json +20 -0
- package/skills/agentsam-arch-coordination/SKILL.md +19 -0
- package/skills/agentsam-arch-coordination/agentsam.skill.json +20 -0
- package/skills/agentsam-arch-documents/SKILL.md +19 -0
- package/skills/agentsam-arch-documents/agentsam.skill.json +20 -0
- package/skills/agentsam-arch-geometry/SKILL.md +19 -0
- package/skills/agentsam-arch-geometry/agentsam.skill.json +20 -0
- package/skills/agentsam-arch-materials/SKILL.md +19 -0
- package/skills/agentsam-arch-materials/agentsam.skill.json +20 -0
- package/skills/agentsam-arch-orchestrate/SKILL.md +21 -0
- package/skills/agentsam-arch-orchestrate/agentsam.skill.json +20 -0
- package/skills/agentsam-arch-specifications/SKILL.md +19 -0
- package/skills/agentsam-arch-specifications/agentsam.skill.json +20 -0
- package/skills/agentsam-arch-verify/SKILL.md +20 -0
- package/skills/agentsam-arch-verify/agentsam.skill.json +20 -0
- package/skills/agentsam-cad/SKILL.md +59 -0
- package/skills/agentsam-canvas-creation/SKILL.md +79 -0
- package/skills/agentsam-canvas-creation/references/creation-journey.md +55 -0
- package/skills/agentsam-canvas-creation/references/fullstack-creation-checklist.md +28 -0
- package/skills/agentsam-canvas-creation/references/quality-and-consistency.md +39 -0
- package/skills/agentsam-cms-ready-creation/SKILL.md +68 -0
- package/skills/agentsam-cms-ready-creation/references/cms-handoff-map.md +50 -0
- package/skills/agentsam-cms-ready-creation/references/web-fullstack-readiness.md +38 -0
- package/skills/agentsam-plan-and-goap/SKILL.md +90 -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 +78 -0
- package/skills/catalog.json +416 -0
- package/src/AgentSam.js +2 -0
- package/src/agent/capability-adapter.js +210 -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/index.js +2 -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/terminal-exec.js +16 -4
- package/src/capabilities/test-run.js +10 -0
- package/src/capabilities/workspace-files.js +181 -0
- package/src/cli/command-catalog.js +40 -4
- package/src/cli/desktop-launch.js +107 -0
- package/src/cli.js +116 -126
- package/src/commands/app.js +45 -46
- 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/dockerize.js +11 -2
- package/src/commands/goals.js +59 -0
- package/src/commands/goap-world.js +4 -0
- package/src/commands/goap.js +48 -1
- 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 +175 -21
- package/src/commands/memory.js +102 -0
- package/src/commands/package.js +1 -1
- package/src/commands/plan-ledger.js +60 -22
- package/src/commands/plan.js +3 -3
- package/src/commands/plugins.js +81 -9
- 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 +132 -0
- package/src/commands/shell.js +114 -8
- package/src/commands/site-scrape.js +9 -0
- package/src/commands/skill.js +1 -1
- package/src/commands/start-local.js +29 -1
- package/src/context/resolve.js +5 -1
- package/src/index.js +13 -0
- package/src/indexing/ingest/style-evidence.js +10 -6
- 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/discovery.js +6 -1
- package/src/lib/cad/docker-executor.js +1 -1
- package/src/lib/cad/editable-project-contract.js +81 -0
- package/src/lib/cad/index.js +6 -0
- package/src/lib/cad/occt-native-provider.mjs +3 -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 +64 -3
- package/src/lib/cad/project-tools.js +24 -0
- package/src/lib/cad/project-v2.d.ts +76 -0
- package/src/lib/cad/project-v2.js +325 -0
- package/src/lib/cad-docker.js +96 -16
- package/src/lib/deploy/local-studio.js +9 -1
- package/src/lib/dockerize.js +5 -5
- package/src/lib/execution-approvals.js +29 -3
- package/src/lib/scaffold/wizards/cms.js +0 -79
- package/src/lib/terminal-scopes.js +5 -2
- 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/authority.js +26 -2
- package/src/mcp/browsermcp.js +28 -0
- package/src/mcp/client-adapters.js +22 -5
- package/src/mcp/client.js +35 -7
- package/src/mcp/oauth-connection.js +109 -0
- package/src/models/discovery.js +1 -373
- package/src/models/inventory-core.d.ts +21 -0
- package/src/models/inventory-core.js +46 -11
- package/src/plugins/browsermcp.js +47 -0
- package/src/plugins/contracts.js +8 -0
- package/src/plugins/creative.js +38 -0
- package/src/plugins/index.js +16 -0
- package/src/plugins/productization.js +348 -0
- package/src/plugins/registry.js +90 -75
- package/src/plugins/runtime.js +12 -3
- package/src/providers/factory.js +13 -0
- package/src/providers/gemini-generate-content.js +18 -0
- package/src/registry/generated/inventory.json +4152 -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/define.js +11 -2
- package/src/sam/index.js +31 -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/architectural-knowledge.js +30 -0
- package/src/sam/operations/artifact-render.js +13 -0
- package/src/sam/operations/brand-scan.js +1 -1
- package/src/sam/operations/codebaseindex-ingest.js +1 -1
- package/src/sam/operations/decision-evaluate.js +1 -1
- package/src/sam/operations/package-audit.js +1 -1
- package/src/sam/operations/planning-astar.js +1 -1
- package/src/sam/operations/planning-goap.js +1 -1
- package/src/sam/operations/repository-inspect.js +13 -3
- 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 +114 -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 +29 -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-hosted.js +89 -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 +20 -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/types.js +17 -98
- package/src/sam/validation.js +40 -0
- package/src/security/inventory.js +11 -9
- package/src/security/local-vault.js +6 -1
- package/src/skills/canvas-knowledge-core.js +1 -0
- package/src/skills/canvas-knowledge.js +8 -0
- package/src/skills/index.js +2 -0
- package/src/tools/registry.js +9 -11
- package/src/ui/art/geaux_boot.json +25 -0
- package/src/ui/boot.js +21 -20
- package/src/ui/cli/help.js +6 -0
- package/src/ui/companion-art.js +40 -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
- package/apps/client-cms-editor/AGENTS.md +0 -17
- package/apps/client-cms-editor/IMPORT_PROVENANCE.json +0 -8
- package/apps/client-cms-editor/README.md +0 -103
- package/apps/client-cms-editor/agentsam.app.json +0 -74
- package/apps/client-cms-editor/backend/README.md +0 -5
- package/apps/client-cms-editor/backend/package.json +0 -37
- package/apps/client-cms-editor/backend/src/api/client.ts +0 -233
- package/apps/client-cms-editor/backend/src/index.ts +0 -6
- package/apps/client-cms-editor/backend/src/model.ts +0 -11
- package/apps/client-cms-editor/backend/src/preview/bridge.ts +0 -79
- package/apps/client-cms-editor/backend/src/preview/urls.ts +0 -55
- package/apps/client-cms-editor/backend/src/routing/cms-route.js +0 -293
- package/apps/client-cms-editor/backend/src/routing/index.js +0 -10
- package/apps/client-cms-editor/backend/src/storefront.ts +0 -52
- package/apps/client-cms-editor/backend/tsconfig.json +0 -20
- package/apps/client-cms-editor/backend/worker/index.js +0 -34
- package/apps/client-cms-editor/backend/wrangler.jsonc +0 -11
- package/apps/client-cms-editor/bin/agentsam-cms.js +0 -262
- package/apps/client-cms-editor/bin/agentsam-cms.mjs +0 -3
- package/apps/client-cms-editor/frontend/index.html +0 -12
- package/apps/client-cms-editor/frontend/package.json +0 -40
- package/apps/client-cms-editor/frontend/src/AgentSamDrawer.tsx +0 -156
- package/apps/client-cms-editor/frontend/src/CmsAgentSurface.tsx +0 -36
- package/apps/client-cms-editor/frontend/src/adapters/heuristic.ts +0 -29
- package/apps/client-cms-editor/frontend/src/adapters/http-authoring.test.ts +0 -161
- package/apps/client-cms-editor/frontend/src/adapters/http.ts +0 -859
- package/apps/client-cms-editor/frontend/src/adapters/memory.ts +0 -510
- package/apps/client-cms-editor/frontend/src/editor/CmsEditor.tsx +0 -244
- package/apps/client-cms-editor/frontend/src/editor/CmsEditorProvider.tsx +0 -20
- package/apps/client-cms-editor/frontend/src/editor/canvas/PreviewCanvas.tsx +0 -53
- package/apps/client-cms-editor/frontend/src/editor/composition-groups.test.ts +0 -40
- package/apps/client-cms-editor/frontend/src/editor/legacy/CmsEditorPrototype.tsx +0 -1374
- package/apps/client-cms-editor/frontend/src/editor/useCmsEditorController.ts +0 -218
- package/apps/client-cms-editor/frontend/src/env.d.ts +0 -14
- package/apps/client-cms-editor/frontend/src/index.ts +0 -22
- package/apps/client-cms-editor/frontend/src/lib/agent-host.ts +0 -24
- package/apps/client-cms-editor/frontend/src/lib/content-safety.ts +0 -63
- package/apps/client-cms-editor/frontend/src/main.tsx +0 -91
- package/apps/client-cms-editor/frontend/src/mount.tsx +0 -113
- package/apps/client-cms-editor/frontend/src/styles/agentsam-drawer.css +0 -215
- package/apps/client-cms-editor/frontend/src/styles/cmsShell.css +0 -1739
- package/apps/client-cms-editor/frontend/src/styles/studio.css +0 -159
- package/apps/client-cms-editor/frontend/src/surfaces/CmsDashboard.tsx +0 -313
- package/apps/client-cms-editor/frontend/src/surfaces/CmsGuidedChatHero.tsx +0 -121
- package/apps/client-cms-editor/frontend/src/surfaces/CmsHubPage.tsx +0 -132
- package/apps/client-cms-editor/frontend/src/surfaces/CmsSiteSwitcher.tsx +0 -176
- package/apps/client-cms-editor/frontend/src/surfaces/index.ts +0 -5
- package/apps/client-cms-editor/frontend/src/surfaces/types.ts +0 -48
- package/apps/client-cms-editor/frontend/tsconfig.json +0 -55
- package/apps/client-cms-editor/frontend/vite.config.ts +0 -25
- package/apps/client-cms-editor/package-lock.json +0 -4671
- package/apps/client-cms-editor/package.json +0 -135
- package/apps/client-cms-editor/reference/DONOR_README.md +0 -52
- package/apps/client-cms-editor/reference/DONOR_package-lock.json +0 -1253
- package/apps/client-cms-editor/reference/DONOR_tsconfig.json +0 -15
- package/apps/client-cms-editor/reference/harvest/HARVEST_RECEIPT.json +0 -201
- package/apps/client-cms-editor/reference/harvest/PROVENANCE_HISTORY.txt +0 -10
- package/apps/client-cms-editor/reference/harvest/README.md +0 -8
- package/apps/client-cms-editor/reference/harvest/plans/ARCHIVE-INTAKE.md +0 -135
- package/apps/client-cms-editor/reference/harvest/plans/CHATGPT-IDENTITY-HARVEST.md +0 -83
- package/apps/client-cms-editor/reference/harvest/plans/CMS-EDITOR-HARVEST.md +0 -166
- package/apps/client-cms-editor/reference/harvest/plans/HARVEST-INDEX.md +0 -196
- package/apps/client-cms-editor/reference/harvest/plans/INNERANIMALS-CONTENT-001.md +0 -137
- package/apps/client-cms-editor/reference/harvest/plans/NO-IMPLICIT-SIDE-EFFECTS.md +0 -87
- package/apps/client-cms-editor/reference/harvest/plans/STOREFRONT-SURFACE-MAP.md +0 -140
- package/apps/client-cms-editor/reference/harvest/plans/THEME-INNERANIMALS-HARVEST.md +0 -137
- package/apps/client-cms-editor/reference/harvest/plans/TOOLING-LAB.md +0 -63
- package/apps/client-cms-editor/reference/harvest/plans/harvest-manifest.json +0 -97
- package/apps/client-cms-editor/reference/harvest/plans/local-cms-harvest-schema.sql +0 -328
- package/apps/client-cms-editor/shared/cms/package.json +0 -29
- package/apps/client-cms-editor/shared/cms/src/adapter.ts +0 -204
- package/apps/client-cms-editor/shared/cms/src/agent-context.ts +0 -37
- package/apps/client-cms-editor/shared/cms/src/cloudflare-bindings.ts +0 -51
- package/apps/client-cms-editor/shared/cms/src/editor-types.ts +0 -131
- package/apps/client-cms-editor/shared/cms/src/host.ts +0 -82
- package/apps/client-cms-editor/shared/cms/src/index.ts +0 -9
- package/apps/client-cms-editor/shared/cms/src/map.ts +0 -115
- package/apps/client-cms-editor/shared/cms/src/publication.ts +0 -24
- package/apps/client-cms-editor/shared/cms/src/routes.ts +0 -11
- package/apps/client-cms-editor/shared/cms/src/starter-pack.ts +0 -158
- package/apps/client-cms-editor/shared/cms/tsconfig.json +0 -12
- package/docs/client-cms-editor.md +0 -15
- package/packages/heuristic-theme/README.md +0 -11
- package/packages/heuristic-theme/package.json +0 -30
- package/packages/heuristic-theme/src/index.js +0 -2
- package/packages/heuristic-theme/src/registry.js +0 -36
- package/packages/heuristic-theme/src/theme.js +0 -41
- package/packages/heuristic-theme/test/theme.test.mjs +0 -26
- package/packages/theme-cypress/README.md +0 -11
- package/packages/theme-cypress/package.json +0 -44
- package/packages/theme-cypress/prebuild.json +0 -23
- package/packages/theme-cypress/site/assets/generated/favicon.svg +0 -7
- package/packages/theme-cypress/site/assets/generated/media-044ba16613.webp +0 -0
- package/packages/theme-cypress/site/assets/generated/media-0a1ea6f6d9.webp +0 -0
- package/packages/theme-cypress/site/assets/generated/media-0c06778307.webp +0 -0
- package/packages/theme-cypress/site/assets/generated/media-1539ed373a.webp +0 -0
- package/packages/theme-cypress/site/assets/generated/media-2df479fd2d.webp +0 -0
- package/packages/theme-cypress/site/assets/generated/media-2e8bd0d9bc.webp +0 -0
- package/packages/theme-cypress/site/assets/generated/media-41d4e2643c.webp +0 -0
- package/packages/theme-cypress/site/assets/generated/media-46205bfde8.webp +0 -0
- package/packages/theme-cypress/site/assets/generated/media-50c5f3e279.webp +0 -0
- package/packages/theme-cypress/site/assets/generated/media-5f1467778c.webp +0 -0
- package/packages/theme-cypress/site/assets/generated/media-6703642b22.webp +0 -0
- package/packages/theme-cypress/site/assets/generated/media-87a490bc8e.webp +0 -0
- package/packages/theme-cypress/site/assets/generated/media-997c10ef39.webp +0 -0
- package/packages/theme-cypress/site/assets/generated/media-a423735c21.webp +0 -0
- package/packages/theme-cypress/site/assets/generated/media-c9cea5245b.webp +0 -0
- package/packages/theme-cypress/site/assets/generated/media-cab3c84c60.webp +0 -0
- package/packages/theme-cypress/site/assets/generated/media-ce06595d59.webp +0 -0
- package/packages/theme-cypress/site/assets/generated/media-d268905e7e.webp +0 -0
- package/packages/theme-cypress/site/assets/generated/media-f6711b5053.webp +0 -0
- package/packages/theme-cypress/site/assets/generated/media-manifest.json +0 -226
- package/packages/theme-cypress/site/assets/generated/social-card.webp +0 -0
- package/packages/theme-cypress/site/assets/generated/theme-mark-192.png +0 -0
- package/packages/theme-cypress/site/assets/generated/theme-mark-512.png +0 -0
- package/packages/theme-cypress/site/assets/generated/theme-mark.svg +0 -7
- package/packages/theme-cypress/site/beliefs.html +0 -175
- package/packages/theme-cypress/site/community.html +0 -175
- package/packages/theme-cypress/site/connect.html +0 -319
- package/packages/theme-cypress/site/donate.html +0 -106
- package/packages/theme-cypress/site/groups.html +0 -1352
- package/packages/theme-cypress/site/help.html +0 -1
- package/packages/theme-cypress/site/icons/clock.svg +0 -4
- package/packages/theme-cypress/site/icons/email.svg +0 -4
- package/packages/theme-cypress/site/icons/giving.svg +0 -4
- package/packages/theme-cypress/site/icons/home.svg +0 -4
- package/packages/theme-cypress/site/icons/location.svg +0 -4
- package/packages/theme-cypress/site/icons/media.svg +0 -4
- package/packages/theme-cypress/site/icons/ministries.svg +0 -6
- package/packages/theme-cypress/site/icons/prayer.svg +0 -5
- package/packages/theme-cypress/site/icons/visit.svg +0 -6
- package/packages/theme-cypress/site/index.html +0 -1013
- package/packages/theme-cypress/site/mensgroup.html +0 -477
- package/packages/theme-cypress/site/mission.html +0 -512
- package/packages/theme-cypress/site/unified-footer.css +0 -172
- package/packages/theme-cypress/site/unified-footer.js +0 -175
- package/packages/theme-cypress/site/unified-header.css +0 -226
- package/packages/theme-cypress/site/unified-header.js +0 -111
- package/packages/theme-cypress/site/womansgroup.html +0 -452
- package/packages/theme-cypress/src/index.js +0 -76
- package/packages/theme-cypress/src/node.js +0 -69
- package/packages/theme-cypress/test/theme.test.mjs +0 -47
- package/packages/theme-ember/README.md +0 -11
- package/packages/theme-ember/package.json +0 -44
- package/packages/theme-ember/prebuild.json +0 -23
- package/packages/theme-ember/site/about.html +0 -1840
- package/packages/theme-ember/site/assets/generated/favicon.svg +0 -7
- package/packages/theme-ember/site/assets/generated/media-1e0b1e6ee6.webp +0 -0
- package/packages/theme-ember/site/assets/generated/media-2371dcb426.webp +0 -0
- package/packages/theme-ember/site/assets/generated/media-2db4f5ff9e.webp +0 -0
- package/packages/theme-ember/site/assets/generated/media-4ed07a756e.webp +0 -0
- package/packages/theme-ember/site/assets/generated/media-58182cf167.webp +0 -0
- package/packages/theme-ember/site/assets/generated/media-5b8b8472ae.webp +0 -0
- package/packages/theme-ember/site/assets/generated/media-71f4bd16a1.webp +0 -0
- package/packages/theme-ember/site/assets/generated/media-7c1c8120bc.webp +0 -0
- package/packages/theme-ember/site/assets/generated/media-832b176433.webp +0 -0
- package/packages/theme-ember/site/assets/generated/media-931439701c.webp +0 -0
- package/packages/theme-ember/site/assets/generated/media-c2860d40d1.webp +0 -0
- package/packages/theme-ember/site/assets/generated/media-c56974d198.webp +0 -0
- package/packages/theme-ember/site/assets/generated/media-cb83a44ff4.webp +0 -0
- package/packages/theme-ember/site/assets/generated/media-df02ccdfcf.webp +0 -0
- package/packages/theme-ember/site/assets/generated/media-fab72cd344.webp +0 -0
- package/packages/theme-ember/site/assets/generated/media-manifest.json +0 -190
- package/packages/theme-ember/site/assets/generated/social-card.webp +0 -0
- package/packages/theme-ember/site/assets/generated/theme-mark-192.png +0 -0
- package/packages/theme-ember/site/assets/generated/theme-mark-512.png +0 -0
- package/packages/theme-ember/site/assets/generated/theme-mark.svg +0 -7
- package/packages/theme-ember/site/community.html +0 -1664
- package/packages/theme-ember/site/index.html +0 -2044
- package/packages/theme-ember/site/shop.html +0 -2104
- package/packages/theme-ember/src/index.js +0 -76
- package/packages/theme-ember/src/node.js +0 -69
- package/packages/theme-ember/test/theme.test.mjs +0 -47
- package/packages/theme-forge/README.md +0 -11
- package/packages/theme-forge/package.json +0 -44
- package/packages/theme-forge/prebuild.json +0 -23
- package/packages/theme-forge/site/apple-touch-icon.png +0 -0
- package/packages/theme-forge/site/assets/generated/favicon.svg +0 -7
- package/packages/theme-forge/site/assets/generated/media-manifest.json +0 -17
- package/packages/theme-forge/site/assets/generated/social-card.webp +0 -0
- package/packages/theme-forge/site/assets/generated/theme-mark-192.png +0 -0
- package/packages/theme-forge/site/assets/generated/theme-mark-512.png +0 -0
- package/packages/theme-forge/site/assets/generated/theme-mark.svg +0 -7
- package/packages/theme-forge/site/assets/index-DBOqQVsA.css +0 -1
- package/packages/theme-forge/site/assets/index-pXC0o9jp.js +0 -241
- package/packages/theme-forge/site/assets/workbox-window.prod.es5-Bd17z0YL.js +0 -2
- package/packages/theme-forge/site/index.html +0 -5
- package/packages/theme-forge/site/manifest.webmanifest +0 -1
- package/packages/theme-forge/site/pwa-192x192.png +0 -0
- package/packages/theme-forge/site/pwa-512x512.png +0 -0
- package/packages/theme-forge/site/sw.js +0 -107
- package/packages/theme-forge/site/workbox-7e5eb42b.js +0 -3395
- package/packages/theme-forge/src/index.js +0 -76
- package/packages/theme-forge/src/node.js +0 -69
- package/packages/theme-forge/test/theme.test.mjs +0 -47
- package/packages/theme-grove/README.md +0 -11
- package/packages/theme-grove/package.json +0 -44
- package/packages/theme-grove/prebuild.json +0 -23
- package/packages/theme-grove/site/assets/generated/favicon.svg +0 -7
- package/packages/theme-grove/site/assets/generated/media-098b13d75a.webp +0 -0
- package/packages/theme-grove/site/assets/generated/media-0c064db1aa.webp +0 -0
- package/packages/theme-grove/site/assets/generated/media-0fbfef655e.webp +0 -0
- package/packages/theme-grove/site/assets/generated/media-14759c7460.webp +0 -0
- package/packages/theme-grove/site/assets/generated/media-19b23d2a8f.webp +0 -0
- package/packages/theme-grove/site/assets/generated/media-2012f04243.webp +0 -0
- package/packages/theme-grove/site/assets/generated/media-23b8c5e2bb.webp +0 -0
- package/packages/theme-grove/site/assets/generated/media-2bffb1a6ef.webp +0 -0
- package/packages/theme-grove/site/assets/generated/media-2e1523a5b0.webp +0 -0
- package/packages/theme-grove/site/assets/generated/media-31107c21f2.webp +0 -0
- package/packages/theme-grove/site/assets/generated/media-31373ec865.webp +0 -0
- package/packages/theme-grove/site/assets/generated/media-45e8e27542.webp +0 -0
- package/packages/theme-grove/site/assets/generated/media-4aa9846fe7.webp +0 -0
- package/packages/theme-grove/site/assets/generated/media-5476b24219.webp +0 -0
- package/packages/theme-grove/site/assets/generated/media-7a227d3e4b.webp +0 -0
- package/packages/theme-grove/site/assets/generated/media-b183eed550.webp +0 -0
- package/packages/theme-grove/site/assets/generated/media-b2c650f9ab.webp +0 -0
- package/packages/theme-grove/site/assets/generated/media-b5d7471694.webp +0 -0
- package/packages/theme-grove/site/assets/generated/media-c86498fdb4.webp +0 -0
- package/packages/theme-grove/site/assets/generated/media-ce2cfff9a1.webp +0 -0
- package/packages/theme-grove/site/assets/generated/media-cf41a5f324.webp +0 -0
- package/packages/theme-grove/site/assets/generated/media-ec6c01bf8d.webp +0 -0
- package/packages/theme-grove/site/assets/generated/media-manifest.json +0 -267
- package/packages/theme-grove/site/assets/generated/social-card.webp +0 -0
- package/packages/theme-grove/site/assets/generated/theme-mark-192.png +0 -0
- package/packages/theme-grove/site/assets/generated/theme-mark-512.png +0 -0
- package/packages/theme-grove/site/assets/generated/theme-mark.svg +0 -7
- package/packages/theme-grove/site/index.html +0 -1429
- package/packages/theme-grove/site/pages/contact.html +0 -664
- package/packages/theme-grove/site/pages/gallery.html +0 -216
- package/packages/theme-grove/site/pages/privacy.html +0 -180
- package/packages/theme-grove/site/pages/process.html +0 -592
- package/packages/theme-grove/site/pages/services.html +0 -567
- package/packages/theme-grove/site/pages/terms.html +0 -189
- package/packages/theme-grove/site/shared/footer.css +0 -140
- package/packages/theme-grove/site/shared/footer.html +0 -41
- package/packages/theme-grove/src/index.js +0 -76
- package/packages/theme-grove/src/node.js +0 -69
- package/packages/theme-grove/test/theme.test.mjs +0 -47
- package/packages/theme-harbor/README.md +0 -11
- package/packages/theme-harbor/package.json +0 -44
- package/packages/theme-harbor/prebuild.json +0 -23
- package/packages/theme-harbor/site/assets/generated/favicon.svg +0 -7
- package/packages/theme-harbor/site/assets/generated/media-manifest.json +0 -17
- package/packages/theme-harbor/site/assets/generated/social-card.webp +0 -0
- package/packages/theme-harbor/site/assets/generated/theme-mark-192.png +0 -0
- package/packages/theme-harbor/site/assets/generated/theme-mark-512.png +0 -0
- package/packages/theme-harbor/site/assets/generated/theme-mark.svg +0 -7
- package/packages/theme-harbor/site/assets/index-D58RKkr-.js +0 -239
- package/packages/theme-harbor/site/assets/index-Dd3YN9Mf.css +0 -1
- package/packages/theme-harbor/site/index.html +0 -15
- package/packages/theme-harbor/src/index.js +0 -76
- package/packages/theme-harbor/src/node.js +0 -69
- package/packages/theme-harbor/test/theme.test.mjs +0 -47
- package/packages/theme-resolve/README.md +0 -11
- package/packages/theme-resolve/package.json +0 -44
- package/packages/theme-resolve/prebuild.json +0 -23
- package/packages/theme-resolve/site/assets/generated/favicon.svg +0 -7
- package/packages/theme-resolve/site/assets/generated/media-216610d365.webp +0 -0
- package/packages/theme-resolve/site/assets/generated/media-2a9e0f623f.webp +0 -0
- package/packages/theme-resolve/site/assets/generated/media-a70660bfa9.webp +0 -0
- package/packages/theme-resolve/site/assets/generated/media-bc1322e813.webp +0 -0
- package/packages/theme-resolve/site/assets/generated/media-ced60fcecc.webp +0 -0
- package/packages/theme-resolve/site/assets/generated/media-manifest.json +0 -72
- package/packages/theme-resolve/site/assets/generated/social-card.webp +0 -0
- package/packages/theme-resolve/site/assets/generated/theme-mark-192.png +0 -0
- package/packages/theme-resolve/site/assets/generated/theme-mark-512.png +0 -0
- package/packages/theme-resolve/site/assets/generated/theme-mark.svg +0 -7
- package/packages/theme-resolve/site/assets/index-BSaLpPG1.css +0 -2
- package/packages/theme-resolve/site/assets/index-D8au46Z5.js +0 -17
- package/packages/theme-resolve/site/index.html +0 -22
- package/packages/theme-resolve/src/index.js +0 -69
- package/packages/theme-resolve/src/node.js +0 -69
- package/packages/theme-resolve/test/theme.test.mjs +0 -47
- package/packages/theme-scenes/src/registry.js +0 -170
- package/packages/theme-summit/README.md +0 -11
- package/packages/theme-summit/package.json +0 -44
- package/packages/theme-summit/prebuild.json +0 -23
- package/packages/theme-summit/site/adventures.html +0 -450
- package/packages/theme-summit/site/assets/generated/favicon.svg +0 -7
- package/packages/theme-summit/site/assets/generated/media-1e958ea679.webp +0 -0
- package/packages/theme-summit/site/assets/generated/media-9d4521abba.webp +0 -0
- package/packages/theme-summit/site/assets/generated/media-manifest.json +0 -39
- package/packages/theme-summit/site/assets/generated/social-card.webp +0 -0
- package/packages/theme-summit/site/assets/generated/theme-mark-192.png +0 -0
- package/packages/theme-summit/site/assets/generated/theme-mark-512.png +0 -0
- package/packages/theme-summit/site/assets/generated/theme-mark.svg +0 -7
- package/packages/theme-summit/site/business-card.html +0 -315
- package/packages/theme-summit/site/chatbot.js +0 -312
- package/packages/theme-summit/site/gallery.html +0 -524
- package/packages/theme-summit/site/i18n.js +0 -947
- package/packages/theme-summit/site/icons.svg +0 -87
- package/packages/theme-summit/site/index.html +0 -2415
- package/packages/theme-summit/site/pages/about.html +0 -100
- package/packages/theme-summit/site/pages/contact.html +0 -117
- package/packages/theme-summit/site/pages/dashboard.html +0 -111
- package/packages/theme-summit/site/pages/index.html +0 -129
- package/packages/theme-summit/site/pages/services.html +0 -125
- package/packages/theme-summit/site/shared/footer.html +0 -41
- package/packages/theme-summit/site/shared/layout.js +0 -315
- package/packages/theme-summit/site/shared/nav.html +0 -19
- package/packages/theme-summit/site/shared/styles.css +0 -696
- package/packages/theme-summit/site/theme-styles.css +0 -131
- package/packages/theme-summit/site/themes.js +0 -442
- package/packages/theme-summit/src/index.js +0 -76
- package/packages/theme-summit/src/node.js +0 -69
- package/packages/theme-summit/test/theme.test.mjs +0 -47
- package/packages/theme-violet/README.md +0 -11
- package/packages/theme-violet/package.json +0 -44
- package/packages/theme-violet/prebuild.json +0 -23
- package/packages/theme-violet/site/assets/generated/favicon.svg +0 -7
- package/packages/theme-violet/site/assets/generated/media-07b46d6457.webp +0 -0
- package/packages/theme-violet/site/assets/generated/media-09d38ddffc.webp +0 -0
- package/packages/theme-violet/site/assets/generated/media-254b0e2ad3.webp +0 -0
- package/packages/theme-violet/site/assets/generated/media-3a1b5c0a8d.webp +0 -0
- package/packages/theme-violet/site/assets/generated/media-3a78eb7d9d.webp +0 -0
- package/packages/theme-violet/site/assets/generated/media-49076977d8.webp +0 -0
- package/packages/theme-violet/site/assets/generated/media-6342d50dbd.webp +0 -0
- package/packages/theme-violet/site/assets/generated/media-646c65381e.webp +0 -0
- package/packages/theme-violet/site/assets/generated/media-7a5fb7c91a.webp +0 -0
- package/packages/theme-violet/site/assets/generated/media-9bbd133220.webp +0 -0
- package/packages/theme-violet/site/assets/generated/media-9e73307c2a.webp +0 -0
- package/packages/theme-violet/site/assets/generated/media-af382146a0.webp +0 -0
- package/packages/theme-violet/site/assets/generated/media-b2ae348b43.webp +0 -0
- package/packages/theme-violet/site/assets/generated/media-b8f43a3887.webp +0 -0
- package/packages/theme-violet/site/assets/generated/media-c96a3e1979.webp +0 -0
- package/packages/theme-violet/site/assets/generated/media-cd07daa54a.webp +0 -0
- package/packages/theme-violet/site/assets/generated/media-e03ab6b5fe.webp +0 -0
- package/packages/theme-violet/site/assets/generated/media-eae4917d25.webp +0 -0
- package/packages/theme-violet/site/assets/generated/media-f227ec5690.webp +0 -0
- package/packages/theme-violet/site/assets/generated/media-fb57ffd474.webp +0 -0
- package/packages/theme-violet/site/assets/generated/media-manifest.json +0 -245
- package/packages/theme-violet/site/assets/generated/social-card.webp +0 -0
- package/packages/theme-violet/site/assets/generated/theme-mark-192.png +0 -0
- package/packages/theme-violet/site/assets/generated/theme-mark-512.png +0 -0
- package/packages/theme-violet/site/assets/generated/theme-mark.svg +0 -7
- package/packages/theme-violet/site/global/cpas-contact.css +0 -405
- package/packages/theme-violet/site/global/cpas-donate-v2.css +0 -931
- package/packages/theme-violet/site/global/cpas-drawer-override.css +0 -1
- package/packages/theme-violet/site/global/cpas-footer.html +0 -38
- package/packages/theme-violet/site/global/cpas-header.html +0 -30
- package/packages/theme-violet/site/global/cpas-hero-watercolor.css +0 -275
- package/packages/theme-violet/site/global/cpas-modals.js +0 -802
- package/packages/theme-violet/site/global/cpas-public-surface.css +0 -982
- package/packages/theme-violet/site/global/cpas-shell.css +0 -3980
- package/packages/theme-violet/site/global/cpas-shell.js +0 -107
- package/packages/theme-violet/site/global/cpas-shelter-hub.css +0 -326
- package/packages/theme-violet/site/index.html +0 -141
- package/packages/theme-violet/site/pages/about/campaigns.html +0 -28
- package/packages/theme-violet/site/pages/about/cta.html +0 -25
- package/packages/theme-violet/site/pages/about/hero.html +0 -46
- package/packages/theme-violet/site/pages/about/paths.html +0 -24
- package/packages/theme-violet/site/pages/about/why_we_exist.html +0 -28
- package/packages/theme-violet/site/pages/home/campaigns.html +0 -67
- package/packages/theme-violet/site/pages/home/hero.html +0 -42
- package/packages/theme-violet/site/pages/home/how-it-helps.html +0 -32
- package/packages/theme-violet/site/pages/home/impact-stats.html +0 -31
- package/packages/theme-violet/site/pages/home/mission.html +0 -36
- package/packages/theme-violet/site/pages/home/newsletter.html +0 -29
- package/packages/theme-violet/site/pages/home/transport-win.html +0 -22
- package/packages/theme-violet/site/pages/index.html +0 -141
- package/packages/theme-violet/src/index.js +0 -76
- package/packages/theme-violet/src/node.js +0 -69
- package/packages/theme-violet/test/theme.test.mjs +0 -47
- /package/{apps/client-cms-editor → python}/LICENSE +0 -0
|
@@ -0,0 +1,918 @@
|
|
|
1
|
+
"""Native, stdlib-only implementations of the shared AgentSam local runtime.
|
|
2
|
+
|
|
3
|
+
This module is intentionally independent of the FSL-licensed Node implementation.
|
|
4
|
+
Its behavior is derived from protocol/runtime/workspace-fs.v1.schema.json and
|
|
5
|
+
protocol/runtime/workspace-fs.conformance.v1.json. Host identity, workspace
|
|
6
|
+
root, receipt destination, D1 adapter and approval callback are injected by the
|
|
7
|
+
trusted caller; operation input can never replace them.
|
|
8
|
+
"""
|
|
9
|
+
from __future__ import annotations
|
|
10
|
+
|
|
11
|
+
import asyncio
|
|
12
|
+
import hashlib
|
|
13
|
+
import inspect
|
|
14
|
+
import json
|
|
15
|
+
import logging
|
|
16
|
+
import os
|
|
17
|
+
import queue
|
|
18
|
+
import re
|
|
19
|
+
import shutil
|
|
20
|
+
import signal
|
|
21
|
+
import subprocess
|
|
22
|
+
import tempfile
|
|
23
|
+
import threading
|
|
24
|
+
import time
|
|
25
|
+
import uuid
|
|
26
|
+
from datetime import datetime, timezone
|
|
27
|
+
from pathlib import Path
|
|
28
|
+
from typing import Any, Callable, Mapping
|
|
29
|
+
|
|
30
|
+
from .contract import ToolInput, ToolResult
|
|
31
|
+
|
|
32
|
+
LOG = logging.getLogger(__name__)
|
|
33
|
+
|
|
34
|
+
MAX_FILE_BYTES = 512 * 1024
|
|
35
|
+
DEFAULT_TIMEOUT_MS = 120_000
|
|
36
|
+
MAX_TIMEOUT_MS = 900_000
|
|
37
|
+
DEFAULT_OUTPUT_BYTES = 512 * 1024
|
|
38
|
+
MAX_OUTPUT_BYTES = 2 * 1024 * 1024
|
|
39
|
+
MAX_SCRIPT_ARGS = 128
|
|
40
|
+
MAX_LIST_ENTRIES = 300
|
|
41
|
+
MAX_LIST_DEPTH = 5
|
|
42
|
+
|
|
43
|
+
SKIP_DIRS = frozenset({
|
|
44
|
+
".git", "node_modules", ".agentsam", ".next", "dist", "build",
|
|
45
|
+
"coverage", ".venv", "venv",
|
|
46
|
+
})
|
|
47
|
+
PROTECTED_PARTS = frozenset({
|
|
48
|
+
".git", "node_modules", ".env", ".npmrc", ".pypirc", ".netrc",
|
|
49
|
+
".ssh", ".aws", ".config", ".agentsam",
|
|
50
|
+
})
|
|
51
|
+
COMMAND_RE = re.compile(r"^[A-Za-z0-9][A-Za-z0-9._+-]*$")
|
|
52
|
+
SQL_WRITE_RE = re.compile(r"^\s*(INSERT|UPDATE|DELETE|REPLACE)\b", re.IGNORECASE)
|
|
53
|
+
SAFE_ENV_KEYS = frozenset({
|
|
54
|
+
"PATH", "HOME", "TMPDIR", "TEMP", "TMP", "LANG", "LC_ALL", "LC_CTYPE",
|
|
55
|
+
"TZ", "TERM", "NO_COLOR", "USER", "LOGNAME", "SYSTEMROOT", "COMSPEC",
|
|
56
|
+
})
|
|
57
|
+
SECRET_KEY_RE = re.compile(
|
|
58
|
+
r"(?:^|_)(?:TOKEN|SECRET|PASSWORD|PASSCODE|API_KEY|PRIVATE_KEY|AUTHORIZATION|COOKIE|CREDENTIAL)(?:_|$)",
|
|
59
|
+
re.IGNORECASE,
|
|
60
|
+
)
|
|
61
|
+
REDACT_PATTERNS = (
|
|
62
|
+
(re.compile(r"(?i)(bearer\s+)[A-Za-z0-9._~+/-]+=*"), r"\1[REDACTED]"),
|
|
63
|
+
(re.compile(r"(?i)((?:api[_-]?key|access[_-]?token|refresh[_-]?token|client[_-]?secret|password|authorization)\s*[:=]\s*)[^\s,;]+"), r"\1[REDACTED]"),
|
|
64
|
+
(re.compile(r"\b(?:sk-proj-|sk-live-|ghp_|github_pat_|xox[baprs]-)[A-Za-z0-9_\-]{12,}\b"), "[REDACTED]"),
|
|
65
|
+
)
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
class NativeOperationError(RuntimeError):
|
|
69
|
+
def __init__(self, code: str, message: str | None = None):
|
|
70
|
+
self.code = code
|
|
71
|
+
super().__init__(message or code)
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
def _sha_bytes(value: bytes) -> str:
|
|
75
|
+
return hashlib.sha256(value).hexdigest()
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
def _sha_text(value: str) -> str:
|
|
79
|
+
return _sha_bytes(value.encode("utf-8"))
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
def _canonical_hash(value: Any) -> str:
|
|
83
|
+
encoded = json.dumps(value, sort_keys=True, separators=(",", ":"), ensure_ascii=False)
|
|
84
|
+
return _sha_text(encoded)
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
def _iso(unix: float) -> str:
|
|
88
|
+
return datetime.fromtimestamp(unix, timezone.utc).isoformat(timespec="milliseconds").replace("+00:00", "Z")
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
def _safe_text(value: str, maximum: int = 512 * 1024) -> str:
|
|
92
|
+
result = value
|
|
93
|
+
for pattern, replacement in REDACT_PATTERNS:
|
|
94
|
+
result = pattern.sub(replacement, result)
|
|
95
|
+
return result[:maximum]
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
def _unsafe_part(part: str) -> bool:
|
|
99
|
+
lowered = part.lower()
|
|
100
|
+
return (
|
|
101
|
+
part in PROTECTED_PARTS
|
|
102
|
+
or lowered.startswith(".env.")
|
|
103
|
+
or lowered.endswith(".pem")
|
|
104
|
+
or lowered.endswith(".key")
|
|
105
|
+
)
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
def _require_object(value: Any) -> dict[str, Any]:
|
|
109
|
+
if not isinstance(value, dict):
|
|
110
|
+
raise NativeOperationError("sam_input_object_required")
|
|
111
|
+
return value
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
def _check_keys(value: dict[str, Any], allowed: set[str], required: set[str] = frozenset()) -> None:
|
|
115
|
+
extras = sorted(set(value) - allowed)
|
|
116
|
+
if extras:
|
|
117
|
+
raise NativeOperationError("sam_input_additional_properties_not_allowed")
|
|
118
|
+
if not required.issubset(value):
|
|
119
|
+
raise NativeOperationError("sam_input_required_property_missing")
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
def _workspace_root(value: str | Path | None) -> Path:
|
|
123
|
+
if value is None:
|
|
124
|
+
raise NativeOperationError("workspace_root_not_configured")
|
|
125
|
+
try:
|
|
126
|
+
root = Path(value).expanduser().resolve(strict=True)
|
|
127
|
+
except (OSError, RuntimeError, ValueError) as exc:
|
|
128
|
+
raise NativeOperationError("workspace_root_not_found") from exc
|
|
129
|
+
if not root.is_dir():
|
|
130
|
+
raise NativeOperationError("workspace_root_not_directory")
|
|
131
|
+
return root
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
def _scoped_path(root_value: str | Path | None, relative: Any, *, allow_root: bool = False) -> tuple[Path, str, Path]:
|
|
135
|
+
root = _workspace_root(root_value)
|
|
136
|
+
if not isinstance(relative, str) or not relative or len(relative) > 2048 or Path(relative).is_absolute():
|
|
137
|
+
raise NativeOperationError("workspace_relative_path_required")
|
|
138
|
+
lexical = Path(os.path.abspath(root / relative))
|
|
139
|
+
if lexical == root:
|
|
140
|
+
if allow_root:
|
|
141
|
+
return root, ".", root
|
|
142
|
+
raise NativeOperationError("workspace_path_outside_root")
|
|
143
|
+
if not lexical.is_relative_to(root):
|
|
144
|
+
raise NativeOperationError("workspace_path_outside_root")
|
|
145
|
+
rel = lexical.relative_to(root)
|
|
146
|
+
if any(_unsafe_part(part) for part in rel.parts):
|
|
147
|
+
raise NativeOperationError("workspace_protected_path")
|
|
148
|
+
parent = lexical.parent
|
|
149
|
+
try:
|
|
150
|
+
real_parent = parent.resolve(strict=True)
|
|
151
|
+
except (OSError, RuntimeError, ValueError) as exc:
|
|
152
|
+
raise NativeOperationError("workspace_parent_not_found") from exc
|
|
153
|
+
if real_parent != root and not real_parent.is_relative_to(root):
|
|
154
|
+
raise NativeOperationError("workspace_symlink_escape")
|
|
155
|
+
if lexical.is_symlink():
|
|
156
|
+
raise NativeOperationError("workspace_symlink_not_allowed")
|
|
157
|
+
return lexical, rel.as_posix(), root
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
def workspace_read(input: Mapping[str, Any], root: str | Path | None) -> dict[str, Any]:
|
|
161
|
+
data = _require_object(dict(input))
|
|
162
|
+
_check_keys(data, {"path"}, {"path"})
|
|
163
|
+
target, relative, _ = _scoped_path(root, data["path"])
|
|
164
|
+
try:
|
|
165
|
+
stat = target.stat()
|
|
166
|
+
if not target.is_file():
|
|
167
|
+
raise NativeOperationError("workspace_not_regular_file")
|
|
168
|
+
if stat.st_size > MAX_FILE_BYTES:
|
|
169
|
+
raise NativeOperationError("workspace_read_limit_exceeded")
|
|
170
|
+
content = target.read_bytes().decode("utf-8", errors="replace")
|
|
171
|
+
except NativeOperationError:
|
|
172
|
+
raise
|
|
173
|
+
except FileNotFoundError as exc:
|
|
174
|
+
raise NativeOperationError("workspace_path_not_found") from exc
|
|
175
|
+
except OSError as exc:
|
|
176
|
+
raise NativeOperationError("workspace_read_failed") from exc
|
|
177
|
+
if "\0" in content:
|
|
178
|
+
raise NativeOperationError("workspace_binary_file_unsupported")
|
|
179
|
+
return {
|
|
180
|
+
"path": relative,
|
|
181
|
+
"content": content,
|
|
182
|
+
"sha256": _sha_text(content),
|
|
183
|
+
"bytes": stat.st_size,
|
|
184
|
+
"verified": True,
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
def workspace_list(input: Mapping[str, Any], root: str | Path | None) -> dict[str, Any]:
|
|
189
|
+
data = _require_object(dict(input))
|
|
190
|
+
_check_keys(data, {"path", "depth", "max_entries"})
|
|
191
|
+
requested = data.get("path", ".")
|
|
192
|
+
if requested == ".":
|
|
193
|
+
directory, relative_root, workspace = _scoped_path(root, ".", allow_root=True)
|
|
194
|
+
else:
|
|
195
|
+
directory, relative_root, workspace = _scoped_path(root, requested)
|
|
196
|
+
try:
|
|
197
|
+
if directory.is_symlink():
|
|
198
|
+
raise NativeOperationError("workspace_symlink_not_allowed")
|
|
199
|
+
if not directory.is_dir():
|
|
200
|
+
raise NativeOperationError("workspace_not_directory")
|
|
201
|
+
except OSError as exc:
|
|
202
|
+
raise NativeOperationError("workspace_path_not_found") from exc
|
|
203
|
+
depth_value = data.get("depth", 3)
|
|
204
|
+
entries_value = data.get("max_entries", 100)
|
|
205
|
+
if not isinstance(depth_value, int) or isinstance(depth_value, bool):
|
|
206
|
+
raise NativeOperationError("workspace_list_depth_invalid")
|
|
207
|
+
if not isinstance(entries_value, int) or isinstance(entries_value, bool):
|
|
208
|
+
raise NativeOperationError("workspace_list_limit_invalid")
|
|
209
|
+
depth = max(1, min(MAX_LIST_DEPTH, depth_value))
|
|
210
|
+
limit = max(1, min(MAX_LIST_ENTRIES, entries_value))
|
|
211
|
+
entries: list[dict[str, Any]] = []
|
|
212
|
+
pending: list[tuple[Path, int]] = [(directory, 0)]
|
|
213
|
+
truncated = False
|
|
214
|
+
while pending:
|
|
215
|
+
current, level = pending.pop(0)
|
|
216
|
+
try:
|
|
217
|
+
children = sorted(current.iterdir(), key=lambda item: item.name)
|
|
218
|
+
except OSError as exc:
|
|
219
|
+
raise NativeOperationError("workspace_list_failed") from exc
|
|
220
|
+
for child in children:
|
|
221
|
+
if len(entries) >= limit:
|
|
222
|
+
truncated = True
|
|
223
|
+
break
|
|
224
|
+
name = child.name
|
|
225
|
+
if name.startswith(".") or _unsafe_part(name) or name in SKIP_DIRS:
|
|
226
|
+
continue
|
|
227
|
+
try:
|
|
228
|
+
if child.is_symlink():
|
|
229
|
+
continue
|
|
230
|
+
if not child.is_file() and not child.is_dir():
|
|
231
|
+
continue
|
|
232
|
+
rel = child.relative_to(workspace).as_posix()
|
|
233
|
+
is_directory = child.is_dir()
|
|
234
|
+
row: dict[str, Any] = {"path": rel, "type": "directory" if is_directory else "file"}
|
|
235
|
+
if not is_directory:
|
|
236
|
+
row["bytes"] = child.stat().st_size
|
|
237
|
+
entries.append(row)
|
|
238
|
+
if is_directory and level + 1 < depth:
|
|
239
|
+
pending.append((child, level + 1))
|
|
240
|
+
except (OSError, ValueError):
|
|
241
|
+
continue
|
|
242
|
+
if truncated:
|
|
243
|
+
break
|
|
244
|
+
return {
|
|
245
|
+
"schema": "sam.workspace.list.v1",
|
|
246
|
+
"root": relative_root,
|
|
247
|
+
"entries": entries,
|
|
248
|
+
"truncated": truncated,
|
|
249
|
+
"limit": limit,
|
|
250
|
+
"depth": depth,
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
|
|
254
|
+
def workspace_stat(input: Mapping[str, Any], root: str | Path | None) -> dict[str, Any]:
|
|
255
|
+
data = _require_object(dict(input))
|
|
256
|
+
_check_keys(data, {"path"}, {"path"})
|
|
257
|
+
requested = data["path"]
|
|
258
|
+
if requested == ".":
|
|
259
|
+
target, relative, _ = _scoped_path(root, ".", allow_root=True)
|
|
260
|
+
else:
|
|
261
|
+
target, relative, _ = _scoped_path(root, requested)
|
|
262
|
+
try:
|
|
263
|
+
stat = target.stat()
|
|
264
|
+
except FileNotFoundError as exc:
|
|
265
|
+
raise NativeOperationError("workspace_path_not_found") from exc
|
|
266
|
+
except OSError as exc:
|
|
267
|
+
raise NativeOperationError("workspace_stat_failed") from exc
|
|
268
|
+
if target.is_dir():
|
|
269
|
+
return {"path": relative, "type": "directory", "bytes": None, "sha256": None}
|
|
270
|
+
if not target.is_file():
|
|
271
|
+
raise NativeOperationError("workspace_not_regular_file")
|
|
272
|
+
digest = None
|
|
273
|
+
if stat.st_size <= MAX_FILE_BYTES:
|
|
274
|
+
try:
|
|
275
|
+
digest = _sha_bytes(target.read_bytes())
|
|
276
|
+
except OSError as exc:
|
|
277
|
+
raise NativeOperationError("workspace_stat_failed") from exc
|
|
278
|
+
return {"path": relative, "type": "file", "bytes": stat.st_size, "sha256": digest}
|
|
279
|
+
|
|
280
|
+
|
|
281
|
+
def _read_existing_for_write(target: Path) -> bytes | None:
|
|
282
|
+
if not target.exists():
|
|
283
|
+
return None
|
|
284
|
+
try:
|
|
285
|
+
if not target.is_file():
|
|
286
|
+
raise NativeOperationError("workspace_not_regular_file")
|
|
287
|
+
previous = target.read_bytes()
|
|
288
|
+
except NativeOperationError:
|
|
289
|
+
raise
|
|
290
|
+
except OSError as exc:
|
|
291
|
+
raise NativeOperationError("workspace_read_failed") from exc
|
|
292
|
+
if len(previous) > MAX_FILE_BYTES:
|
|
293
|
+
raise NativeOperationError("workspace_write_existing_file_too_large")
|
|
294
|
+
return previous
|
|
295
|
+
|
|
296
|
+
|
|
297
|
+
def _atomic_write(target: Path, content: str, previous: bytes | None, expected_sha256: Any) -> dict[str, Any]:
|
|
298
|
+
encoded = content.encode("utf-8")
|
|
299
|
+
if len(encoded) > MAX_FILE_BYTES or "\0" in content:
|
|
300
|
+
raise NativeOperationError("workspace_write_content_invalid")
|
|
301
|
+
if previous is not None:
|
|
302
|
+
if not isinstance(expected_sha256, str) or expected_sha256 != _sha_bytes(previous):
|
|
303
|
+
raise NativeOperationError("workspace_write_conflict_expected_sha256_required")
|
|
304
|
+
elif expected_sha256:
|
|
305
|
+
raise NativeOperationError("workspace_write_conflict_file_missing")
|
|
306
|
+
temp_name: str | None = None
|
|
307
|
+
try:
|
|
308
|
+
with tempfile.NamedTemporaryFile(
|
|
309
|
+
mode="wb", prefix=target.name + ".agentsam-", suffix=".tmp",
|
|
310
|
+
dir=str(target.parent), delete=False,
|
|
311
|
+
) as stream:
|
|
312
|
+
temp_name = stream.name
|
|
313
|
+
try:
|
|
314
|
+
os.chmod(temp_name, 0o600)
|
|
315
|
+
except OSError:
|
|
316
|
+
pass
|
|
317
|
+
stream.write(encoded)
|
|
318
|
+
stream.flush()
|
|
319
|
+
os.fsync(stream.fileno())
|
|
320
|
+
# Re-check an update after staging to narrow the optimistic-write race.
|
|
321
|
+
if previous is not None:
|
|
322
|
+
current = target.read_bytes()
|
|
323
|
+
if _sha_bytes(current) != _sha_bytes(previous):
|
|
324
|
+
raise NativeOperationError("workspace_write_conflict_expected_sha256_required")
|
|
325
|
+
os.replace(temp_name, target)
|
|
326
|
+
temp_name = None
|
|
327
|
+
else:
|
|
328
|
+
# Exclusive create prevents replacing a file created after preflight.
|
|
329
|
+
descriptor = os.open(str(target), os.O_WRONLY | os.O_CREAT | os.O_EXCL, 0o600)
|
|
330
|
+
try:
|
|
331
|
+
with os.fdopen(descriptor, "wb") as stream:
|
|
332
|
+
stream.write(encoded)
|
|
333
|
+
stream.flush()
|
|
334
|
+
os.fsync(stream.fileno())
|
|
335
|
+
except Exception:
|
|
336
|
+
try:
|
|
337
|
+
target.unlink()
|
|
338
|
+
except OSError:
|
|
339
|
+
pass
|
|
340
|
+
raise
|
|
341
|
+
return {
|
|
342
|
+
"path": target.name if not target.name else target.name,
|
|
343
|
+
"sha256": _sha_bytes(encoded),
|
|
344
|
+
"bytes": len(encoded),
|
|
345
|
+
"written": True,
|
|
346
|
+
}
|
|
347
|
+
except FileExistsError as exc:
|
|
348
|
+
raise NativeOperationError("workspace_write_conflict_file_missing") from exc
|
|
349
|
+
except NativeOperationError:
|
|
350
|
+
raise
|
|
351
|
+
except OSError as exc:
|
|
352
|
+
raise NativeOperationError("workspace_write_failed") from exc
|
|
353
|
+
finally:
|
|
354
|
+
if temp_name:
|
|
355
|
+
try:
|
|
356
|
+
Path(temp_name).unlink()
|
|
357
|
+
except OSError:
|
|
358
|
+
pass
|
|
359
|
+
|
|
360
|
+
|
|
361
|
+
def workspace_write(input: Mapping[str, Any], root: str | Path | None) -> dict[str, Any]:
|
|
362
|
+
data = _require_object(dict(input))
|
|
363
|
+
_check_keys(data, {"path", "content", "expected_sha256"}, {"path", "content"})
|
|
364
|
+
if not isinstance(data["content"], str):
|
|
365
|
+
raise NativeOperationError("workspace_write_content_invalid")
|
|
366
|
+
target, relative, _ = _scoped_path(root, data["path"])
|
|
367
|
+
previous = _read_existing_for_write(target)
|
|
368
|
+
output = _atomic_write(target, data["content"], previous, data.get("expected_sha256"))
|
|
369
|
+
output["path"] = relative
|
|
370
|
+
return output
|
|
371
|
+
|
|
372
|
+
|
|
373
|
+
def workspace_patch(input: Mapping[str, Any], root: str | Path | None) -> dict[str, Any]:
|
|
374
|
+
data = _require_object(dict(input))
|
|
375
|
+
_check_keys(data, {"path", "expected_sha256", "old_text", "new_text"},
|
|
376
|
+
{"path", "expected_sha256", "old_text", "new_text"})
|
|
377
|
+
if not isinstance(data["old_text"], str) or not data["old_text"]:
|
|
378
|
+
raise NativeOperationError("workspace_patch_old_text_required")
|
|
379
|
+
if not isinstance(data["new_text"], str):
|
|
380
|
+
raise NativeOperationError("workspace_patch_new_text_invalid")
|
|
381
|
+
target, relative, _ = _scoped_path(root, data["path"])
|
|
382
|
+
previous = _read_existing_for_write(target)
|
|
383
|
+
if previous is None:
|
|
384
|
+
raise NativeOperationError("workspace_path_not_found")
|
|
385
|
+
if not isinstance(data["expected_sha256"], str) or _sha_bytes(previous) != data["expected_sha256"]:
|
|
386
|
+
raise NativeOperationError("workspace_write_conflict_expected_sha256_required")
|
|
387
|
+
content = previous.decode("utf-8", errors="replace")
|
|
388
|
+
count = content.count(data["old_text"])
|
|
389
|
+
if count == 0:
|
|
390
|
+
raise NativeOperationError("workspace_patch_old_text_not_found")
|
|
391
|
+
if count != 1:
|
|
392
|
+
raise NativeOperationError("workspace_patch_old_text_ambiguous")
|
|
393
|
+
updated = content.replace(data["old_text"], data["new_text"], 1)
|
|
394
|
+
output = _atomic_write(target, updated, previous, data["expected_sha256"])
|
|
395
|
+
output["path"] = relative
|
|
396
|
+
output["patched"] = True
|
|
397
|
+
return output
|
|
398
|
+
|
|
399
|
+
|
|
400
|
+
def workspace_remove(input: Mapping[str, Any], root: str | Path | None) -> dict[str, Any]:
|
|
401
|
+
data = _require_object(dict(input))
|
|
402
|
+
_check_keys(data, {"path", "expected_sha256"}, {"path", "expected_sha256"})
|
|
403
|
+
target, relative, _ = _scoped_path(root, data["path"])
|
|
404
|
+
previous = _read_existing_for_write(target)
|
|
405
|
+
if previous is None:
|
|
406
|
+
raise NativeOperationError("workspace_remove_file_not_found")
|
|
407
|
+
if not isinstance(data["expected_sha256"], str) or _sha_bytes(previous) != data["expected_sha256"]:
|
|
408
|
+
raise NativeOperationError("workspace_write_conflict_expected_sha256_required")
|
|
409
|
+
try:
|
|
410
|
+
# Refuse if the file changed after the hash check.
|
|
411
|
+
if _sha_bytes(target.read_bytes()) != data["expected_sha256"]:
|
|
412
|
+
raise NativeOperationError("workspace_write_conflict_expected_sha256_required")
|
|
413
|
+
target.unlink()
|
|
414
|
+
except NativeOperationError:
|
|
415
|
+
raise
|
|
416
|
+
except OSError as exc:
|
|
417
|
+
raise NativeOperationError("workspace_remove_failed") from exc
|
|
418
|
+
return {"path": relative, "sha256": data["expected_sha256"], "bytes": len(previous), "removed": True}
|
|
419
|
+
|
|
420
|
+
|
|
421
|
+
def _expand_home(value: str) -> str:
|
|
422
|
+
if value == "~":
|
|
423
|
+
return str(Path.home())
|
|
424
|
+
if value.startswith("~/"):
|
|
425
|
+
return str(Path.home() / value[2:])
|
|
426
|
+
return value
|
|
427
|
+
|
|
428
|
+
|
|
429
|
+
def _relative_cwd(root: Path, value: Any) -> Path:
|
|
430
|
+
if not isinstance(value, str) or len(value) > 2048 or Path(value).is_absolute():
|
|
431
|
+
raise NativeOperationError("terminal_relative_cwd_invalid")
|
|
432
|
+
root = root.resolve(strict=True)
|
|
433
|
+
requested = value or "."
|
|
434
|
+
lexical = Path(os.path.abspath(root / requested))
|
|
435
|
+
if lexical != root and not lexical.is_relative_to(root):
|
|
436
|
+
raise NativeOperationError("terminal_relative_cwd_outside_project")
|
|
437
|
+
candidate = lexical.resolve(strict=True)
|
|
438
|
+
if candidate != root and not candidate.is_relative_to(root):
|
|
439
|
+
raise NativeOperationError("terminal_relative_cwd_outside_project")
|
|
440
|
+
if not candidate.is_dir():
|
|
441
|
+
raise NativeOperationError("terminal_cwd_not_directory")
|
|
442
|
+
return candidate
|
|
443
|
+
|
|
444
|
+
|
|
445
|
+
def _subprocess_env(host_env: Mapping[str, str] | None) -> dict[str, str]:
|
|
446
|
+
source = host_env if host_env is not None else os.environ
|
|
447
|
+
return {
|
|
448
|
+
key: value for key, value in source.items()
|
|
449
|
+
if key in SAFE_ENV_KEYS and isinstance(value, str) and not SECRET_KEY_RE.search(key)
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
|
|
453
|
+
def _run_bounded_process(
|
|
454
|
+
command: str, args: list[str], cwd: Path, env: dict[str, str],
|
|
455
|
+
timeout_ms: int, max_output_bytes: int,
|
|
456
|
+
) -> dict[str, Any]:
|
|
457
|
+
if not COMMAND_RE.fullmatch(command):
|
|
458
|
+
raise NativeOperationError("terminal_command_must_be_pathless_executable")
|
|
459
|
+
if len(args) > MAX_SCRIPT_ARGS or any(not isinstance(arg, str) or "\0" in arg or len(arg) > 8192 for arg in args):
|
|
460
|
+
raise NativeOperationError("terminal_argument_limit_exceeded")
|
|
461
|
+
args = [_expand_home(arg) for arg in args]
|
|
462
|
+
if shutil.which(command, path=env.get("PATH")) is None:
|
|
463
|
+
raise NativeOperationError("ENOENT", "Requested executable was not found on PATH.")
|
|
464
|
+
timeout_ms = max(1, min(MAX_TIMEOUT_MS, timeout_ms))
|
|
465
|
+
max_output_bytes = max(1024, min(MAX_OUTPUT_BYTES, max_output_bytes))
|
|
466
|
+
try:
|
|
467
|
+
proc = subprocess.Popen(
|
|
468
|
+
[command, *args], cwd=str(cwd), env=env, stdin=subprocess.DEVNULL,
|
|
469
|
+
stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=False,
|
|
470
|
+
close_fds=True, start_new_session=(os.name != "nt"),
|
|
471
|
+
)
|
|
472
|
+
except OSError as exc:
|
|
473
|
+
raise NativeOperationError("terminal_process_start_failed") from exc
|
|
474
|
+
|
|
475
|
+
events: queue.Queue[tuple[str, bytes | None]] = queue.Queue()
|
|
476
|
+
|
|
477
|
+
def pump(name: str, stream: Any) -> None:
|
|
478
|
+
try:
|
|
479
|
+
while True:
|
|
480
|
+
chunk = stream.read(4096)
|
|
481
|
+
if not chunk:
|
|
482
|
+
break
|
|
483
|
+
events.put((name, chunk))
|
|
484
|
+
finally:
|
|
485
|
+
events.put((name, None))
|
|
486
|
+
try:
|
|
487
|
+
stream.close()
|
|
488
|
+
except OSError:
|
|
489
|
+
pass
|
|
490
|
+
|
|
491
|
+
threads = [
|
|
492
|
+
threading.Thread(target=pump, args=("stdout", proc.stdout), daemon=True),
|
|
493
|
+
threading.Thread(target=pump, args=("stderr", proc.stderr), daemon=True),
|
|
494
|
+
]
|
|
495
|
+
for thread in threads:
|
|
496
|
+
thread.start()
|
|
497
|
+
def stop_process() -> None:
|
|
498
|
+
if proc.poll() is not None:
|
|
499
|
+
return
|
|
500
|
+
try:
|
|
501
|
+
if os.name == "nt":
|
|
502
|
+
proc.terminate()
|
|
503
|
+
else:
|
|
504
|
+
os.killpg(proc.pid, signal.SIGTERM)
|
|
505
|
+
except OSError:
|
|
506
|
+
try:
|
|
507
|
+
proc.terminate()
|
|
508
|
+
except OSError:
|
|
509
|
+
pass
|
|
510
|
+
try:
|
|
511
|
+
proc.wait(timeout=1)
|
|
512
|
+
except subprocess.TimeoutExpired:
|
|
513
|
+
try:
|
|
514
|
+
if os.name == "nt":
|
|
515
|
+
proc.kill()
|
|
516
|
+
else:
|
|
517
|
+
os.killpg(proc.pid, signal.SIGKILL)
|
|
518
|
+
except OSError:
|
|
519
|
+
proc.kill()
|
|
520
|
+
|
|
521
|
+
out = bytearray()
|
|
522
|
+
err = bytearray()
|
|
523
|
+
captured = 0
|
|
524
|
+
closed_streams = 0
|
|
525
|
+
deadline = time.monotonic() + timeout_ms / 1000
|
|
526
|
+
terminal_status: str | None = None
|
|
527
|
+
while closed_streams < 2:
|
|
528
|
+
remaining = deadline - time.monotonic()
|
|
529
|
+
if remaining <= 0 and proc.poll() is None:
|
|
530
|
+
terminal_status = "timed_out"
|
|
531
|
+
stop_process()
|
|
532
|
+
try:
|
|
533
|
+
name, chunk = events.get(timeout=max(0.01, min(0.1, max(0.01, remaining))))
|
|
534
|
+
except queue.Empty:
|
|
535
|
+
if proc.poll() is not None:
|
|
536
|
+
continue
|
|
537
|
+
if terminal_status:
|
|
538
|
+
continue
|
|
539
|
+
continue
|
|
540
|
+
if chunk is None:
|
|
541
|
+
closed_streams += 1
|
|
542
|
+
continue
|
|
543
|
+
if terminal_status:
|
|
544
|
+
continue
|
|
545
|
+
allowance = max_output_bytes - captured
|
|
546
|
+
if len(chunk) > allowance:
|
|
547
|
+
# Match the Node runner: a chunk that crosses the aggregate cap is
|
|
548
|
+
# rejected as a whole rather than partially appended.
|
|
549
|
+
terminal_status = "output_limit"
|
|
550
|
+
stop_process()
|
|
551
|
+
continue
|
|
552
|
+
(out if name == "stdout" else err).extend(chunk)
|
|
553
|
+
captured += len(chunk)
|
|
554
|
+
for thread in threads:
|
|
555
|
+
thread.join(timeout=1)
|
|
556
|
+
try:
|
|
557
|
+
proc.wait(timeout=2)
|
|
558
|
+
except subprocess.TimeoutExpired:
|
|
559
|
+
proc.kill()
|
|
560
|
+
proc.wait()
|
|
561
|
+
stdout = _safe_text(out.decode("utf-8", errors="replace"), max_output_bytes)
|
|
562
|
+
stderr = _safe_text(err.decode("utf-8", errors="replace"), max_output_bytes)
|
|
563
|
+
exit_code = proc.returncode if terminal_status is None else None
|
|
564
|
+
signal_name = None
|
|
565
|
+
if terminal_status is not None:
|
|
566
|
+
signal_name = "SIGKILL" if proc.returncode is not None and proc.returncode < 0 else None
|
|
567
|
+
elif proc.returncode is not None and proc.returncode < 0:
|
|
568
|
+
try:
|
|
569
|
+
signal_name = signal.Signals(-proc.returncode).name
|
|
570
|
+
except (ValueError, OSError):
|
|
571
|
+
signal_name = "SIGNAL"
|
|
572
|
+
ok = terminal_status is None and proc.returncode == 0
|
|
573
|
+
return {
|
|
574
|
+
"ok": ok,
|
|
575
|
+
"command": command,
|
|
576
|
+
"args": args,
|
|
577
|
+
"project_root": str(_workspace_root(cwd)),
|
|
578
|
+
"cwd": str(cwd),
|
|
579
|
+
"exit_code": exit_code,
|
|
580
|
+
"signal": signal_name,
|
|
581
|
+
"stdout": stdout,
|
|
582
|
+
"stderr": stderr,
|
|
583
|
+
"_status": terminal_status or ("completed" if ok else "failed"),
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
|
|
587
|
+
def terminal_exec(input: Mapping[str, Any], root: str | Path | None, env: Mapping[str, str] | None = None) -> dict[str, Any]:
|
|
588
|
+
data = _require_object(dict(input))
|
|
589
|
+
required = {"command", "args", "cwd", "relative_cwd", "timeout_ms", "max_output_bytes"}
|
|
590
|
+
_check_keys(data, required, required)
|
|
591
|
+
if not isinstance(data["command"], str) or not data["command"] or len(data["command"]) > 128:
|
|
592
|
+
raise NativeOperationError("terminal_exec_input_invalid")
|
|
593
|
+
if not isinstance(data["args"], list):
|
|
594
|
+
raise NativeOperationError("terminal_exec_input_invalid")
|
|
595
|
+
if not isinstance(data["cwd"], str) or not data["cwd"]:
|
|
596
|
+
raise NativeOperationError("terminal_exec_input_invalid")
|
|
597
|
+
if not isinstance(data["timeout_ms"], int) or isinstance(data["timeout_ms"], bool) or data["timeout_ms"] < 1:
|
|
598
|
+
raise NativeOperationError("terminal_exec_timeout_invalid")
|
|
599
|
+
if not isinstance(data["max_output_bytes"], int) or isinstance(data["max_output_bytes"], bool) or data["max_output_bytes"] < 1024:
|
|
600
|
+
raise NativeOperationError("terminal_exec_output_limit_invalid")
|
|
601
|
+
project_root = _workspace_root(root)
|
|
602
|
+
directory = _relative_cwd(project_root, data["relative_cwd"])
|
|
603
|
+
result = _run_bounded_process(
|
|
604
|
+
data["command"], data["args"], directory, _subprocess_env(env),
|
|
605
|
+
data["timeout_ms"], data["max_output_bytes"],
|
|
606
|
+
)
|
|
607
|
+
result["project_root"] = str(project_root)
|
|
608
|
+
status = result.pop("_status", "completed" if result["ok"] else "failed")
|
|
609
|
+
if not result["ok"] and status in ("timed_out", "output_limit"):
|
|
610
|
+
code = {"timed_out": "process_timeout", "output_limit": "process_output_limit"}[status]
|
|
611
|
+
result["status"] = status
|
|
612
|
+
raise NativeOperationError(code, json.dumps(result, sort_keys=True))
|
|
613
|
+
return result
|
|
614
|
+
|
|
615
|
+
|
|
616
|
+
def _sql_is_single_dml(sql: Any) -> str:
|
|
617
|
+
if not isinstance(sql, str) or not sql.strip() or len(sql.encode("utf-8")) > 64 * 1024:
|
|
618
|
+
raise NativeOperationError("d1_write_sql_invalid")
|
|
619
|
+
if not SQL_WRITE_RE.match(sql):
|
|
620
|
+
raise NativeOperationError("d1_write_statement_not_allowed")
|
|
621
|
+
# The existing Wrangler adapter accepts one --command string, not bound parameters.
|
|
622
|
+
# Reject statement separators and comments instead of guessing at SQL parsing.
|
|
623
|
+
quote: str | None = None
|
|
624
|
+
index = 0
|
|
625
|
+
while index < len(sql):
|
|
626
|
+
char = sql[index]
|
|
627
|
+
if quote:
|
|
628
|
+
if char == quote:
|
|
629
|
+
if index + 1 < len(sql) and sql[index + 1] == quote:
|
|
630
|
+
index += 2
|
|
631
|
+
continue
|
|
632
|
+
quote = None
|
|
633
|
+
elif char in ("'", '"', "`"):
|
|
634
|
+
quote = char
|
|
635
|
+
elif char == ";":
|
|
636
|
+
if sql[index + 1:].strip():
|
|
637
|
+
raise NativeOperationError("d1_write_multiple_statements_not_allowed")
|
|
638
|
+
elif sql[index:index + 2] in ("--", "/*"):
|
|
639
|
+
raise NativeOperationError("d1_write_sql_comments_not_allowed")
|
|
640
|
+
index += 1
|
|
641
|
+
return sql.strip().rstrip(";").strip()
|
|
642
|
+
|
|
643
|
+
|
|
644
|
+
def d1_write(input: Mapping[str, Any], adapter: Any, *, delete_only: bool = False) -> dict[str, Any]:
|
|
645
|
+
data = _require_object(dict(input))
|
|
646
|
+
_check_keys(data, {"database_id", "sql", "params"}, {"database_id", "sql"})
|
|
647
|
+
if not isinstance(data["database_id"], str) or not data["database_id"].strip():
|
|
648
|
+
raise NativeOperationError("d1_database_identity_required")
|
|
649
|
+
params = data.get("params", [])
|
|
650
|
+
if not isinstance(params, list) or params:
|
|
651
|
+
raise NativeOperationError("d1_write_parameters_unsupported_by_adapter")
|
|
652
|
+
sql = _sql_is_single_dml(data["sql"])
|
|
653
|
+
verb = SQL_WRITE_RE.match(sql).group(1).upper()
|
|
654
|
+
if delete_only and verb != "DELETE":
|
|
655
|
+
raise NativeOperationError("d1_delete_statement_required")
|
|
656
|
+
if not delete_only and verb == "DELETE":
|
|
657
|
+
raise NativeOperationError("d1_delete_requires_delete_operation")
|
|
658
|
+
if adapter is None or not callable(getattr(adapter, "execute_write", None)):
|
|
659
|
+
raise NativeOperationError("sam_d1_write_adapter_not_configured")
|
|
660
|
+
try:
|
|
661
|
+
return adapter.execute_write(sql, database_id=data["database_id"])
|
|
662
|
+
except NativeOperationError:
|
|
663
|
+
raise
|
|
664
|
+
except Exception as exc:
|
|
665
|
+
LOG.warning("Native D1 write failed (%s)", getattr(exc, "code", type(exc).__name__))
|
|
666
|
+
raise NativeOperationError(getattr(exc, "code", "d1_write_failed")) from exc
|
|
667
|
+
|
|
668
|
+
|
|
669
|
+
NATIVE_OPERATION_SPECS: dict[str, dict[str, Any]] = {
|
|
670
|
+
"workspace.read": {
|
|
671
|
+
"module": "workspace", "side_effects": [], "deterministic": True,
|
|
672
|
+
"description": "Read one bounded UTF-8 file from the configured workspace.",
|
|
673
|
+
"input_schema": {"type": "object", "properties": {"path": {"type": "string"}}, "required": ["path"], "additionalProperties": False},
|
|
674
|
+
},
|
|
675
|
+
"workspace.list": {
|
|
676
|
+
"module": "workspace", "side_effects": [], "deterministic": True,
|
|
677
|
+
"description": "List bounded workspace paths without traversing symlinks or credential stores.",
|
|
678
|
+
"input_schema": {"type": "object", "properties": {"path": {"type": "string"}, "depth": {"type": "integer", "minimum": 1, "maximum": 5}, "max_entries": {"type": "integer", "minimum": 1, "maximum": 300}}, "required": [], "additionalProperties": False},
|
|
679
|
+
},
|
|
680
|
+
"workspace.stat": {
|
|
681
|
+
"module": "workspace", "side_effects": [], "deterministic": True,
|
|
682
|
+
"description": "Inspect the type, size and content hash of a scoped workspace path.",
|
|
683
|
+
"input_schema": {"type": "object", "properties": {"path": {"type": "string"}}, "required": ["path"], "additionalProperties": False},
|
|
684
|
+
},
|
|
685
|
+
"workspace.write": {
|
|
686
|
+
"module": "workspace", "side_effects": ["filesystem-write"], "deterministic": True,
|
|
687
|
+
"description": "Create or optimistically update a bounded UTF-8 workspace file; requires explicit write intent and host approval.",
|
|
688
|
+
"input_schema": {"type": "object", "properties": {"path": {"type": "string"}, "content": {"type": "string"}, "expected_sha256": {"type": "string"}}, "required": ["path", "content"], "additionalProperties": False},
|
|
689
|
+
},
|
|
690
|
+
"workspace.patch": {
|
|
691
|
+
"module": "workspace", "side_effects": ["filesystem-write"], "deterministic": True,
|
|
692
|
+
"description": "Apply one exact, unique text replacement to a workspace file after a content-hash freshness check.",
|
|
693
|
+
"input_schema": {"type": "object", "properties": {"path": {"type": "string"}, "expected_sha256": {"type": "string"}, "old_text": {"type": "string"}, "new_text": {"type": "string"}}, "required": ["path", "expected_sha256", "old_text", "new_text"], "additionalProperties": False},
|
|
694
|
+
},
|
|
695
|
+
"workspace.remove": {
|
|
696
|
+
"module": "workspace", "side_effects": ["filesystem-write"], "deterministic": True,
|
|
697
|
+
"description": "Remove one regular workspace file after explicit approval and a content-hash freshness check.",
|
|
698
|
+
"input_schema": {"type": "object", "properties": {"path": {"type": "string"}, "expected_sha256": {"type": "string"}}, "required": ["path", "expected_sha256"], "additionalProperties": False},
|
|
699
|
+
},
|
|
700
|
+
"terminal.exec": {
|
|
701
|
+
"module": "terminal", "side_effects": ["local-runtime"], "deterministic": False,
|
|
702
|
+
"description": "Run one argv-safe process inside the configured workspace with explicit approval, bounded output and timeout.",
|
|
703
|
+
"input_schema": {"type": "object", "properties": {"command": {"type": "string"}, "args": {"type": "array", "items": {"type": "string"}}, "cwd": {"type": "string"}, "relative_cwd": {"type": "string"}, "timeout_ms": {"type": "integer", "minimum": 1, "maximum": MAX_TIMEOUT_MS}, "max_output_bytes": {"type": "integer", "minimum": 1024, "maximum": MAX_OUTPUT_BYTES}}, "required": ["command", "args", "cwd", "relative_cwd", "timeout_ms", "max_output_bytes"], "additionalProperties": False},
|
|
704
|
+
},
|
|
705
|
+
"agentsam_d1_write": {
|
|
706
|
+
"module": "database", "side_effects": ["external-write"], "deterministic": False,
|
|
707
|
+
"description": "Run one explicitly approved D1 INSERT, UPDATE or REPLACE through the configured D1Adapter.",
|
|
708
|
+
"input_schema": {"type": "object", "properties": {"database_id": {"type": "string"}, "sql": {"type": "string"}, "params": {"type": "array"}}, "required": ["database_id", "sql"], "additionalProperties": False},
|
|
709
|
+
},
|
|
710
|
+
"agentsam_d1_delete": {
|
|
711
|
+
"module": "database", "side_effects": ["external-write"], "deterministic": False,
|
|
712
|
+
"description": "Run one explicitly approved D1 DELETE through the configured D1Adapter.",
|
|
713
|
+
"input_schema": {"type": "object", "properties": {"database_id": {"type": "string"}, "sql": {"type": "string"}, "params": {"type": "array"}}, "required": ["database_id", "sql"], "additionalProperties": False},
|
|
714
|
+
},
|
|
715
|
+
}
|
|
716
|
+
|
|
717
|
+
WRITE_OPERATIONS = frozenset(
|
|
718
|
+
operation for operation, spec in NATIVE_OPERATION_SPECS.items() if spec["side_effects"]
|
|
719
|
+
)
|
|
720
|
+
|
|
721
|
+
|
|
722
|
+
class NativeRuntime:
|
|
723
|
+
"""Trusted context for Python-native operations; never inferred from tool input."""
|
|
724
|
+
|
|
725
|
+
def __init__(
|
|
726
|
+
self,
|
|
727
|
+
*,
|
|
728
|
+
workspace_root: str | Path,
|
|
729
|
+
receipt_dir: str | Path | None = None,
|
|
730
|
+
authorize_operation: Callable[[dict[str, Any]], Any] | None = None,
|
|
731
|
+
d1_adapter: Any = None,
|
|
732
|
+
env: Mapping[str, str] | None = None,
|
|
733
|
+
):
|
|
734
|
+
self.workspace_root = Path(workspace_root).expanduser().resolve()
|
|
735
|
+
self.receipt_dir = Path(receipt_dir).expanduser().resolve() if receipt_dir else self.workspace_root / ".agentsam" / "receipts"
|
|
736
|
+
self.authorize_operation = authorize_operation
|
|
737
|
+
self.d1_adapter = d1_adapter
|
|
738
|
+
self.env = dict(env) if env is not None else None
|
|
739
|
+
|
|
740
|
+
def _handler(self, operation: str, data: dict[str, Any]) -> dict[str, Any]:
|
|
741
|
+
if operation == "workspace.read":
|
|
742
|
+
return workspace_read(data, self.workspace_root)
|
|
743
|
+
if operation == "workspace.list":
|
|
744
|
+
return workspace_list(data, self.workspace_root)
|
|
745
|
+
if operation == "workspace.stat":
|
|
746
|
+
return workspace_stat(data, self.workspace_root)
|
|
747
|
+
if operation == "workspace.write":
|
|
748
|
+
return workspace_write(data, self.workspace_root)
|
|
749
|
+
if operation == "workspace.patch":
|
|
750
|
+
return workspace_patch(data, self.workspace_root)
|
|
751
|
+
if operation == "workspace.remove":
|
|
752
|
+
return workspace_remove(data, self.workspace_root)
|
|
753
|
+
if operation == "terminal.exec":
|
|
754
|
+
return terminal_exec(data, self.workspace_root, self.env)
|
|
755
|
+
if operation == "agentsam_d1_write":
|
|
756
|
+
return d1_write(data, self.d1_adapter)
|
|
757
|
+
if operation == "agentsam_d1_delete":
|
|
758
|
+
return d1_write(data, self.d1_adapter, delete_only=True)
|
|
759
|
+
raise NativeOperationError("sam_native_operation_not_implemented")
|
|
760
|
+
|
|
761
|
+
def _authorize(self, operation: str, data: dict[str, Any]) -> dict[str, Any]:
|
|
762
|
+
if operation not in WRITE_OPERATIONS:
|
|
763
|
+
return {"required": False, "decision": "not_required"}
|
|
764
|
+
if not self.authorize_operation:
|
|
765
|
+
return {"required": True, "decision": "missing", "reason": "sam_host_approval_required"}
|
|
766
|
+
spec = NATIVE_OPERATION_SPECS[operation]
|
|
767
|
+
request = {
|
|
768
|
+
"id": operation,
|
|
769
|
+
"input": dict(data),
|
|
770
|
+
"side_effects": spec["side_effects"][0],
|
|
771
|
+
"contract": spec,
|
|
772
|
+
}
|
|
773
|
+
try:
|
|
774
|
+
decision = self.authorize_operation(request)
|
|
775
|
+
if inspect.isawaitable(decision):
|
|
776
|
+
try:
|
|
777
|
+
asyncio.get_running_loop()
|
|
778
|
+
except RuntimeError:
|
|
779
|
+
decision = asyncio.run(decision)
|
|
780
|
+
else:
|
|
781
|
+
raise NativeOperationError("sam_async_approval_callback_not_supported")
|
|
782
|
+
except NativeOperationError:
|
|
783
|
+
raise
|
|
784
|
+
except Exception as exc:
|
|
785
|
+
LOG.warning("Native operation approval callback failed (%s)", type(exc).__name__)
|
|
786
|
+
return {"required": True, "decision": "error", "reason": "sam_host_approval_failed"}
|
|
787
|
+
if decision is not True:
|
|
788
|
+
return {"required": True, "decision": "denied", "reason": "sam_host_approval_denied"}
|
|
789
|
+
return {"required": True, "decision": "approved"}
|
|
790
|
+
|
|
791
|
+
def _write_receipt(self, result: ToolResult, metadata: dict[str, Any]) -> str | None:
|
|
792
|
+
try:
|
|
793
|
+
self.receipt_dir.mkdir(parents=True, exist_ok=True, mode=0o700)
|
|
794
|
+
filename = f"receipt-{re.sub(r'[^A-Za-z0-9_.-]', '_', result.tool)}-{result.request_id}.json"
|
|
795
|
+
target = self.receipt_dir / filename
|
|
796
|
+
payload = result.to_dict()
|
|
797
|
+
payload["written_at_unixepoch"] = int(time.time())
|
|
798
|
+
payload["execution"] = metadata
|
|
799
|
+
temp = target.with_name(target.name + "." + uuid.uuid4().hex + ".tmp")
|
|
800
|
+
try:
|
|
801
|
+
with temp.open("x", encoding="utf-8") as stream:
|
|
802
|
+
json.dump(payload, stream, ensure_ascii=False, indent=2, default=str)
|
|
803
|
+
stream.write("\n")
|
|
804
|
+
stream.flush()
|
|
805
|
+
os.fsync(stream.fileno())
|
|
806
|
+
try:
|
|
807
|
+
os.chmod(temp, 0o600)
|
|
808
|
+
except OSError:
|
|
809
|
+
pass
|
|
810
|
+
os.replace(temp, target)
|
|
811
|
+
finally:
|
|
812
|
+
try:
|
|
813
|
+
temp.unlink()
|
|
814
|
+
except OSError:
|
|
815
|
+
pass
|
|
816
|
+
return str(target)
|
|
817
|
+
except Exception as exc:
|
|
818
|
+
LOG.warning("Native operation receipt could not be written (%s)", type(exc).__name__)
|
|
819
|
+
return None
|
|
820
|
+
|
|
821
|
+
def invoke(self, operation: str, input: Mapping[str, Any] | None = None, *, write: bool = False) -> dict[str, Any]:
|
|
822
|
+
spec = NATIVE_OPERATION_SPECS.get(operation)
|
|
823
|
+
if spec is None:
|
|
824
|
+
raise NativeOperationError("sam_native_operation_not_implemented")
|
|
825
|
+
started = time.time()
|
|
826
|
+
request_id = uuid.uuid4().hex[:24]
|
|
827
|
+
tool_input = ToolInput(
|
|
828
|
+
mode="native", params=dict(input or {}), output_dir=str(self.receipt_dir),
|
|
829
|
+
write=write, request_id=request_id,
|
|
830
|
+
)
|
|
831
|
+
data = dict(tool_input.params)
|
|
832
|
+
request_id = tool_input.request_id
|
|
833
|
+
approval = {"required": operation in WRITE_OPERATIONS, "decision": "not_checked"}
|
|
834
|
+
result_data: dict[str, Any] = {}
|
|
835
|
+
error_code: str | None = None
|
|
836
|
+
summary = "Native operation completed."
|
|
837
|
+
before_hash = data.get("expected_sha256")
|
|
838
|
+
try:
|
|
839
|
+
if operation in WRITE_OPERATIONS and tool_input.write is not True:
|
|
840
|
+
approval = {"required": True, "decision": "denied", "reason": "sam_write_flag_required"}
|
|
841
|
+
raise NativeOperationError("sam_write_flag_required", "Write-capable operation requires write=True.")
|
|
842
|
+
if operation in ("agentsam_d1_write", "agentsam_d1_delete") and not callable(getattr(self.d1_adapter, "execute_write", None)):
|
|
843
|
+
raise NativeOperationError("sam_d1_write_adapter_not_configured")
|
|
844
|
+
approval = self._authorize(operation, data)
|
|
845
|
+
if approval["required"] and approval["decision"] != "approved":
|
|
846
|
+
raise NativeOperationError(approval.get("reason", "sam_host_approval_required"))
|
|
847
|
+
result_data = self._handler(operation, data)
|
|
848
|
+
if operation == "terminal.exec" and result_data.get("ok") is False:
|
|
849
|
+
error_code = "sam_operation_failed"
|
|
850
|
+
summary = "Operation reported failure"
|
|
851
|
+
else:
|
|
852
|
+
summary = "Native operation completed."
|
|
853
|
+
except NativeOperationError as exc:
|
|
854
|
+
error_code = exc.code
|
|
855
|
+
summary = str(exc)
|
|
856
|
+
# terminal.exec failures include bounded structured process diagnostics.
|
|
857
|
+
if operation == "terminal.exec" and summary.startswith("{"):
|
|
858
|
+
try:
|
|
859
|
+
result_data = json.loads(summary)
|
|
860
|
+
except ValueError:
|
|
861
|
+
result_data = {}
|
|
862
|
+
except Exception as exc:
|
|
863
|
+
error_code = "sam_native_operation_failed"
|
|
864
|
+
summary = "Native operation failed."
|
|
865
|
+
LOG.warning("Native operation failed (%s)", type(exc).__name__)
|
|
866
|
+
finished = time.time()
|
|
867
|
+
result = ToolResult(
|
|
868
|
+
ok=error_code is None,
|
|
869
|
+
tool=operation,
|
|
870
|
+
mode="native",
|
|
871
|
+
request_id=request_id,
|
|
872
|
+
started_at=started,
|
|
873
|
+
finished_at=finished,
|
|
874
|
+
summary=summary,
|
|
875
|
+
data=result_data,
|
|
876
|
+
error=error_code,
|
|
877
|
+
)
|
|
878
|
+
metadata = {
|
|
879
|
+
"operation": operation,
|
|
880
|
+
"input_sha256": _canonical_hash(data),
|
|
881
|
+
"path": data.get("path") if isinstance(data.get("path"), str) and not Path(data["path"]).is_absolute() else None,
|
|
882
|
+
"approval": approval,
|
|
883
|
+
"before_sha256": before_hash if isinstance(before_hash, str) else None,
|
|
884
|
+
"after_sha256": result_data.get("sha256") if isinstance(result_data, dict) else None,
|
|
885
|
+
"exit_code": result_data.get("exit_code") if isinstance(result_data, dict) else None,
|
|
886
|
+
}
|
|
887
|
+
receipt_path = self._write_receipt(result, metadata)
|
|
888
|
+
warnings: list[dict[str, str]] = []
|
|
889
|
+
if receipt_path is None:
|
|
890
|
+
warnings.append({"code": "sam_receipt_write_failed", "message": "Operation finished, but its local receipt could not be written."})
|
|
891
|
+
now = _iso(finished)
|
|
892
|
+
sam_receipt = {
|
|
893
|
+
"id": "samr_" + result.request_id,
|
|
894
|
+
"operation": operation,
|
|
895
|
+
"module": spec["module"],
|
|
896
|
+
"started_at": _iso(started),
|
|
897
|
+
"completed_at": now,
|
|
898
|
+
"execution": {"lane": "local", "deterministic": spec["deterministic"], "model_used": False},
|
|
899
|
+
"side_effects": spec["side_effects"],
|
|
900
|
+
"input_hash": _canonical_hash(data),
|
|
901
|
+
"output_hash": _canonical_hash(result_data) if error_code is None else None,
|
|
902
|
+
"status": "completed" if error_code is None else "failed",
|
|
903
|
+
}
|
|
904
|
+
response: dict[str, Any] = {
|
|
905
|
+
"schema": "sam.result.v1",
|
|
906
|
+
"operation": operation,
|
|
907
|
+
"ok": error_code is None,
|
|
908
|
+
"data": result_data if error_code is None or (operation == "terminal.exec" and error_code == "sam_operation_failed") else None,
|
|
909
|
+
"receipt": sam_receipt,
|
|
910
|
+
"usage": {"provider_calls": 0, "cost_usd": 0},
|
|
911
|
+
}
|
|
912
|
+
if error_code:
|
|
913
|
+
response["error"] = {"code": error_code, "message": summary}
|
|
914
|
+
if warnings:
|
|
915
|
+
response["warnings"] = warnings
|
|
916
|
+
# The local receipt ID is stable and maps to the receipt filename; no
|
|
917
|
+
# Python-only response field is added to the shared SAM result envelope.
|
|
918
|
+
return response
|