@inneranimalmedia/agentsam-sdk 2.6.9 → 2.6.11
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/README.md +21 -0
- package/TRADEMARKS.md +22 -0
- package/apps/README.md +3 -0
- package/apps/cad-creator/LICENSE +21 -0
- package/apps/cad-creator/README.md +4 -1
- package/apps/cad-creator/shared/cad/package.json +1 -1
- package/apps/client-cms-editor/LICENSE +21 -0
- package/apps/client-cms-editor/README.md +3 -0
- package/apps/client-cms-editor/backend/package.json +3 -3
- package/apps/client-cms-editor/frontend/package.json +4 -4
- package/apps/client-cms-editor/package-lock.json +43 -43
- package/apps/client-cms-editor/package.json +3 -3
- package/apps/client-cms-editor/reference/harvest/HARVEST_RECEIPT.json +1 -1
- package/apps/client-cms-editor/reference/harvest/README.md +1 -1
- package/apps/client-cms-editor/reference/harvest/plans/ARCHIVE-INTAKE.md +1 -1
- package/apps/client-cms-editor/reference/harvest/plans/HARVEST-INDEX.md +1 -1
- package/apps/client-cms-editor/reference/harvest/plans/TOOLING-LAB.md +1 -1
- package/apps/client-cms-editor/shared/cms/package.json +2 -2
- package/docs/MINI.md +4 -2
- package/docs/REPO_FILE_MAP.txt +0 -1
- package/docs/SOURCE_ARCHITECTURE.md +1 -1
- package/docs/architecture/DUAL_ANALYTICS_PRODUCT.md +140 -0
- package/docs/architecture/HOOKS-MODELS-SELF-HOSTING-PLAN.md +199 -0
- package/docs/content-studio/REVISION_GATE_2026-09-27.md +1 -1
- package/docs/engineering/go-portability/01-product-project-deployment-authority.md +69 -0
- package/docs/engineering/provider-internal-renames/01-lane-initialization.md +20 -0
- package/docs/engineering/provider-internal-renames/01a-runtime-environment-contract.md +115 -0
- package/docs/engineering/provider-internal-renames/02-cfoa.md +57 -0
- package/docs/engineering/provider-internal-renames/03-gclioa.md +32 -0
- package/docs/engineering/provider-internal-renames/04-goaude.md +50 -0
- package/docs/engineering/provider-internal-renames/05-gdrv.md +33 -0
- package/docs/engineering/provider-internal-renames/06-verification.md +103 -0
- package/docs/engineering/provider-internal-renames/README.md +77 -0
- package/docs/engineering/provider-internal-renames/runtime-environment-contract.json +220 -0
- package/docs/engineering/test-diagnostics/go-cli-test-hang-20261003.md +49 -0
- package/docs/engineering/test-diagnostics/go-skip-deploy-docker-fix.md +90 -0
- package/docs/knowledge-service-verification.md +3 -3
- package/docs/plans/AGENTSAM-SUSPEND-QUEUE-KNOWLEDGE-RDP-2026-10-03.md +870 -0
- package/docs/plans/LOCAL-STUDIO-GRADUATION-2026-09-26.md +9 -9
- package/docs/plans/MACHINE-FIRST-APPS-TUI-2026-09-24.md +11 -11
- package/docs/plans/RECONCILIATION-2026-09-19.md +6 -6
- package/docs/plans/SAM_WORK_PROTOCOL.md +667 -0
- package/docs/plans/TOMORROW-EXTENSIVE-TODO-2026-09-26.md +2 -2
- package/docs/plans/UNIVERSAL-INGEST-MACHINE-FIRST-2026-09-24.md +3 -3
- package/examples/hyperspace-demo/index.html +16 -0
- package/examples/hyperspace-demo/package.json +21 -0
- package/examples/hyperspace-demo/src/main.tsx +277 -0
- package/examples/hyperspace-demo/tsconfig.json +9 -0
- package/examples/hyperspace-demo/vite.config.ts +24 -0
- package/migrations/d1/0020_agentsam_receipt_catalog.sql +35 -0
- package/migrations/runtime/0005_agentsam_hooks.sql +87 -0
- package/migrations/runtime/0006_agent_run_suspend_activity.sql +53 -0
- package/migrations/runtime/0007_queue_control.sql +40 -0
- package/migrations/runtime/0008_agent_run_dependencies.sql +24 -0
- package/migrations/runtime/0008_analytics_legacy_bootstrap.sql +43 -0
- package/migrations/runtime/0009_analytics_authority.sql +108 -0
- package/package.json +45 -14
- package/packages/agentsam-brand/README.md +3 -0
- package/packages/agentsam-brand/package.json +2 -2
- package/packages/agentsam-brand/src/core/v2/compile.js +1 -1
- package/packages/agentsam-brand/src/core/v2/schema.js +1 -1
- package/packages/agentsam-contracts/dist/adapter.d.ts +22 -0
- package/packages/agentsam-contracts/dist/adapter.js +0 -0
- package/packages/agentsam-contracts/dist/agent.d.ts +66 -0
- package/packages/agentsam-contracts/dist/agent.js +15 -0
- package/packages/agentsam-contracts/dist/artifacts.d.ts +70 -0
- package/packages/agentsam-contracts/dist/artifacts.js +0 -0
- package/packages/agentsam-contracts/dist/authority.d.ts +21 -0
- package/packages/agentsam-contracts/dist/authority.js +0 -0
- package/packages/agentsam-contracts/dist/context.d.ts +14 -0
- package/packages/agentsam-contracts/dist/context.js +0 -0
- package/packages/agentsam-contracts/dist/errors.d.ts +121 -0
- package/packages/agentsam-contracts/dist/errors.js +5 -0
- package/packages/agentsam-contracts/dist/events.d.ts +53 -0
- package/packages/agentsam-contracts/dist/events.js +0 -0
- package/packages/agentsam-contracts/dist/execution.d.ts +38 -0
- package/packages/agentsam-contracts/dist/execution.js +0 -0
- package/packages/agentsam-contracts/dist/hooks.d.ts +31 -0
- package/packages/agentsam-contracts/dist/hooks.js +0 -0
- package/packages/agentsam-contracts/dist/identity.d.ts +15 -0
- package/packages/agentsam-contracts/dist/identity.js +0 -0
- package/packages/agentsam-contracts/dist/index.d.ts +16 -0
- package/packages/agentsam-contracts/dist/index.js +164 -0
- package/packages/agentsam-contracts/dist/models.d.ts +9 -0
- package/packages/agentsam-contracts/dist/models.js +0 -0
- package/packages/agentsam-contracts/dist/providers.d.ts +27 -0
- package/packages/agentsam-contracts/dist/providers.js +0 -0
- package/packages/agentsam-contracts/dist/repository.d.ts +56 -0
- package/packages/agentsam-contracts/dist/repository.js +15 -0
- package/packages/agentsam-contracts/dist/run.d.ts +113 -0
- package/packages/agentsam-contracts/dist/run.js +132 -0
- package/packages/agentsam-contracts/dist/tools.d.ts +82 -0
- package/packages/agentsam-contracts/dist/tools.js +0 -0
- package/packages/agentsam-contracts/dist/widgets.d.ts +38 -0
- package/packages/agentsam-contracts/dist/widgets.js +0 -0
- package/packages/agentsam-contracts/package.json +9 -1
- package/packages/agentsam-contracts/scripts/build.mjs +1 -1
- package/packages/agentsam-contracts/src/agent.ts +78 -3
- package/packages/agentsam-contracts/src/errors.ts +19 -10
- package/packages/agentsam-contracts/src/index.ts +2 -0
- package/packages/agentsam-contracts/src/run.ts +320 -0
- package/packages/agentsam-contracts/src/widgets.ts +58 -0
- package/packages/agentsam-contracts/test/contracts.test.mjs +1 -1
- package/packages/agentsam-contracts/test/run-contract.test.mjs +94 -0
- package/packages/agentsam-errors/package.json +11 -3
- package/packages/agentsam-errors/protocol/agentsam.error.v2.schema.json +821 -0
- package/packages/agentsam-errors/protocol/error-catalog.json +3512 -0
- package/packages/agentsam-errors/src/envelope.js +63 -11
- package/packages/agentsam-errors/src/error.js +6 -0
- package/packages/agentsam-errors/src/fingerprint.js +9 -1
- package/packages/agentsam-errors/src/normalize.js +51 -6
- package/packages/agentsam-errors/src/recovery.js +9 -35
- package/packages/agentsam-errors/src/transport.js +6 -1
- package/packages/agentsam-errors/src/vocabulary.js +515 -126
- package/packages/agentsam-errors/test/catalog-v2.test.mjs +106 -0
- package/packages/agentsam-errors/types/index.d.ts +157 -0
- package/packages/agentsam-goap/README.md +3 -0
- package/packages/agentsam-goap/package.json +2 -2
- package/packages/agentsam-hooks/README.md +206 -0
- package/packages/agentsam-hooks/bin/agentsam-hooks.mjs +64 -0
- package/packages/agentsam-hooks/bindings/go/command.go +55 -0
- package/packages/agentsam-hooks/bindings/go/errors_generated.go +402 -0
- package/packages/agentsam-hooks/bindings/go/go.mod +3 -0
- package/packages/agentsam-hooks/bindings/go/hooks.go +285 -0
- package/packages/agentsam-hooks/bindings/go/hooks_test.go +48 -0
- package/packages/agentsam-hooks/bindings/rust/Cargo.toml +11 -0
- package/packages/agentsam-hooks/bindings/rust/src/errors_generated.rs +396 -0
- package/packages/agentsam-hooks/bindings/rust/src/lib.rs +397 -0
- package/packages/agentsam-hooks/package.json +69 -0
- package/packages/agentsam-hooks/schema/manifest.json +54 -0
- package/packages/agentsam-hooks/scripts/clean-protocol.mjs +17 -0
- package/packages/agentsam-hooks/scripts/sync-protocol.mjs +27 -0
- package/packages/agentsam-hooks/src/adapters/agents.js +108 -0
- package/packages/agentsam-hooks/src/adapters/callback.js +4 -0
- package/packages/agentsam-hooks/src/adapters/capability.js +122 -0
- package/packages/agentsam-hooks/src/adapters/command.js +104 -0
- package/packages/agentsam-hooks/src/adapters/composite.js +31 -0
- package/packages/agentsam-hooks/src/adapters/http.js +58 -0
- package/packages/agentsam-hooks/src/adapters/lsp.js +116 -0
- package/packages/agentsam-hooks/src/adapters/mcp.js +76 -0
- package/packages/agentsam-hooks/src/adapters/provider.js +129 -0
- package/packages/agentsam-hooks/src/config.js +143 -0
- package/packages/agentsam-hooks/src/contracts.js +284 -0
- package/packages/agentsam-hooks/src/errors-generated.js +2732 -0
- package/packages/agentsam-hooks/src/index.d.ts +209 -0
- package/packages/agentsam-hooks/src/index.js +14 -0
- package/packages/agentsam-hooks/src/policy.js +34 -0
- package/packages/agentsam-hooks/src/runtime.js +312 -0
- package/packages/agentsam-hooks/src/store.js +264 -0
- package/packages/agentsam-hooks/test/adapters.test.mjs +216 -0
- package/packages/agentsam-hooks/test/runtime.test.mjs +258 -0
- package/packages/agentsam-knowledge/package.json +1 -1
- package/packages/agentsam-knowledge/src/backends/index.js +1 -1
- package/packages/agentsam-merch/README.md +62 -0
- package/packages/agentsam-merch/bin/agentsam-merch.mjs +16 -0
- package/packages/agentsam-merch/package.json +65 -0
- package/packages/agentsam-merch/profiles/completeful/dtg-back-large.json +42 -0
- package/packages/agentsam-merch/profiles/completeful/laser-engraving.json +39 -0
- package/packages/agentsam-merch/profiles/generic/embroidery-digitization.json +22 -0
- package/packages/agentsam-merch/schemas/collection-candidate.schema.json +66 -0
- package/packages/agentsam-merch/schemas/manufacturing-profile.schema.json +221 -0
- package/packages/agentsam-merch/src/adapters-completeful.js +50 -0
- package/packages/agentsam-merch/src/cli.js +93 -0
- package/packages/agentsam-merch/src/collection-lab.js +60 -0
- package/packages/agentsam-merch/src/compatibility.js +501 -0
- package/packages/agentsam-merch/src/derivatives.js +112 -0
- package/packages/agentsam-merch/src/index.d.ts +316 -0
- package/packages/agentsam-merch/src/index.js +46 -0
- package/packages/agentsam-merch/src/node/index.d.ts +58 -0
- package/packages/agentsam-merch/src/node/index.js +6 -0
- package/packages/agentsam-merch/src/node/raster.js +142 -0
- package/packages/agentsam-merch/src/node/vector.js +239 -0
- package/packages/agentsam-merch/src/product-concepts.js +118 -0
- package/packages/agentsam-merch/src/profile-registry.js +104 -0
- package/packages/agentsam-merch/src/profile.js +158 -0
- package/packages/agentsam-merch/src/transforms.js +215 -0
- package/packages/agentsam-merch/test/merch.test.mjs +332 -0
- package/packages/agentsam-merch/test/node-transforms.test.mjs +149 -0
- package/packages/agentsam-nav/dist/Nav.d.ts +43 -0
- package/packages/agentsam-nav/dist/NavCollapsible.d.ts +10 -0
- package/packages/agentsam-nav/dist/NavContent.d.ts +2 -0
- package/packages/agentsam-nav/dist/NavFooter.d.ts +2 -0
- package/packages/agentsam-nav/dist/NavGroup.d.ts +3 -0
- package/packages/agentsam-nav/dist/NavHeader.d.ts +2 -0
- package/packages/agentsam-nav/dist/NavMenu.d.ts +22 -0
- package/packages/agentsam-nav/dist/NavProvider.d.ts +35 -0
- package/packages/agentsam-nav/dist/NavTrigger.d.ts +2 -0
- package/packages/agentsam-nav/dist/Surfaces.d.ts +41 -0
- package/packages/agentsam-nav/dist/browser.d.ts +11 -0
- package/packages/agentsam-nav/dist/browser.global.js +172 -0
- package/packages/agentsam-nav/dist/browser.js +9688 -0
- package/packages/agentsam-nav/dist/contracts.d.ts +76 -0
- package/packages/agentsam-nav/dist/index.d.ts +11 -0
- package/packages/agentsam-nav/dist/index.js +9689 -0
- package/packages/agentsam-nav/dist/legacy.css +83 -0
- package/packages/agentsam-nav/dist/shell.css +113 -0
- package/packages/agentsam-nav/dist/theme.css +113 -0
- package/packages/agentsam-nav/dist/utils.d.ts +1 -0
- package/packages/agentsam-nav/package.json +1 -1
- package/packages/agentsam-queue-control/README.md +4 -1
- package/packages/agentsam-queue-control/package.json +4 -3
- package/packages/agentsam-queue-control/schemas/job-envelope.schema.json +111 -11
- package/packages/agentsam-queue-control/src/adapters/cloudflare.js +34 -6
- package/packages/agentsam-queue-control/src/adapters/memory.js +11 -2
- package/packages/agentsam-queue-control/src/adapters/sqlite.js +259 -0
- package/packages/agentsam-queue-control/src/contracts.js +207 -3
- package/packages/agentsam-queue-control/src/control-plane.js +62 -2
- package/packages/agentsam-queue-control/src/index.js +1 -0
- package/packages/agentsam-queue-control/test/queue-control.test.mjs +310 -0
- package/packages/agentsam-queue-control/test/sqlite-adapter.test.mjs +91 -0
- package/packages/agentsam-rapid-rust/README.md +3 -0
- package/packages/agentsam-repository/README.md +3 -0
- package/packages/agentsam-repository/package.json +1 -1
- package/packages/agentsam-vault/package.json +1 -1
- package/packages/agentsam-workbench/README.md +43 -0
- package/packages/agentsam-workbench/package.json +14 -4
- package/packages/agentsam-workbench/src/agent/AgentConversationSurface.tsx +108 -0
- package/packages/agentsam-workbench/src/agent/AgentPanel.tsx +25 -8
- package/packages/agentsam-workbench/src/agent/AgentRuntimeField.tsx +152 -0
- package/packages/agentsam-workbench/src/agent/Composer.tsx +10 -1
- package/packages/agentsam-workbench/src/agent/RunMode.ts +26 -0
- package/packages/agentsam-workbench/src/agent/Thread.tsx +18 -3
- package/packages/agentsam-workbench/src/agent/index.ts +3 -0
- package/packages/agentsam-workbench/src/index.ts +4 -0
- package/packages/agentsam-workbench/src/manufacturing/PreflightIndicator.tsx +203 -0
- package/packages/agentsam-workbench/src/manufacturing/index.ts +2 -0
- package/packages/agentsam-workbench/src/manufacturing/loading.ts +147 -0
- package/packages/agentsam-workbench/src/widgets/BuiltinWidget.tsx +22 -0
- package/packages/agentsam-workbench/src/widgets/CountdownWidget.tsx +68 -0
- package/packages/agentsam-workbench/src/widgets/WidgetFrame.tsx +56 -0
- package/packages/agentsam-workbench/src/widgets/countdown.ts +25 -0
- package/packages/agentsam-workbench/src/widgets/index.ts +6 -0
- package/packages/agentsam-workbench/src/widgets/registry.ts +13 -0
- package/packages/agentsam-workbench/src/widgets/useCountdown.ts +128 -0
- package/packages/agentsam-workbench/src/widgets/widgets.css +102 -0
- package/packages/connectors/{cloudflare → cfoa}/package.json +3 -3
- package/packages/heuristic-theme/package.json +1 -1
- package/packages/identity/README.md +3 -0
- package/packages/identity/backend/README.md +3 -0
- package/packages/identity/package.json +2 -2
- package/packages/identity/src/frontend/auth-portal/README.md +3 -0
- package/packages/identity/src/index.js +1 -1
- package/packages/identity/src/oauth/README.md +4 -1
- package/packages/identity/src/oauth/credentials.js +1 -1
- package/packages/identity/src/server/worker-router.js +1 -1
- package/packages/identity/tests/google-desktop-identity-login.test.mjs +1 -1
- package/packages/identity/tests/lane1-packed-consumer.test.mjs +1 -1
- package/packages/identity/tests/oauth-presets-accounts-ssot.test.mjs +1 -1
- package/packages/providers/completeful/package.json +1 -1
- package/packages/theme-church-site/package.json +2 -2
- package/packages/theme-companions-site/package.json +2 -2
- package/packages/theme-floors-site/package.json +2 -2
- package/packages/theme-fuelnfree-site/package.json +2 -2
- package/packages/theme-handyman-site/package.json +2 -2
- package/packages/theme-insurance-site/package.json +2 -2
- package/packages/theme-scenes/package.json +1 -1
- package/packages/theme-shinshu-site/package.json +2 -2
- package/packages/work-graph/package.json +1 -1
- package/protocol/apps/agentsam.app.v1.schema.json +1 -1
- 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/capabilities/capability-manifest.schema.json +1 -1
- package/protocol/capabilities/knowledge-search-input.schema.json +1 -0
- package/protocol/credentials/issue.v1.schema.json +1 -1
- 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/README.md +36 -0
- package/protocol/errors/agentsam.error.v2.schema.json +821 -0
- package/protocol/errors/error-catalog.json +3506 -158
- package/protocol/errors/error-envelope.schema.json +195 -52
- package/protocol/errors/recovery.v1.schema.json +1 -1
- package/protocol/features/agentsam.feature.v1.schema.json +1 -1
- package/protocol/hooks/README.md +18 -0
- package/protocol/hooks/agentsam.hook.output.v1.schema.json +27 -0
- package/protocol/hooks/agentsam.hook.receipt.v1.schema.json +61 -0
- package/protocol/hooks/agentsam.hook.v1.schema.json +35 -0
- package/protocol/hooks/agentsam.hooks.config.v1.schema.json +78 -0
- package/protocol/local-engine/benchmark.v1.schema.json +1 -1
- package/protocol/local-engine/engine.v1.schema.json +1 -1
- package/protocol/models/README.md +3 -0
- package/protocol/models/model-inventory-v2.schema.json +1 -1
- package/protocol/models/provider-model-snapshot.v1.schema.json +22 -0
- package/protocol/receipts/agentsam.receipt.v1.json +95 -0
- package/protocol/rpc/v1/errors.proto +1 -0
- package/protocol/runtime/agentsam.runtime.v1.schema.json +1 -1
- package/protocol/runtime/workspace-fs.v1.schema.json +1 -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 +1 -1
- package/protocol/sam/outcome.v1.schema.json +1 -1
- package/protocol/sam/question.v1.schema.json +1 -1
- package/protocol/sam/result.schema.json +1 -1
- 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/receipts/products-registry-batch-20260924.json +6 -6
- package/protocol/theme-refinery/receipts/theme-harvest-20260924.json +6 -6
- package/protocol/theme-refinery/reconciliation-receipt.schema.json +1 -1
- package/protocol/ui/icon.v1.schema.json +1 -1
- package/python/README.md +20 -0
- package/python/agentsam_sdk/errors/__init__.py +4 -0
- package/python/agentsam_sdk/errors/vocabulary.py +2730 -0
- package/python/agentsam_sdk/hooks/__init__.py +32 -0
- package/python/agentsam_sdk/hooks/adapters.py +132 -0
- package/python/agentsam_sdk/hooks/contracts.py +121 -0
- package/python/agentsam_sdk/hooks/runtime.py +253 -0
- package/python/tests/test_hooks.py +115 -0
- package/skills/README.md +3 -0
- package/src/acp/agent-executor.js +106 -0
- package/src/acp/client.js +316 -0
- package/src/acp/dependencies.js +426 -0
- package/src/acp/http.js +207 -0
- package/src/acp/index.js +22 -0
- package/src/acp/runs.js +125 -0
- package/src/acp/runtime-selection.js +180 -0
- package/src/agent/responses-runner.js +145 -1
- package/src/cli/command-catalog.js +4 -0
- package/src/cli.js +33 -0
- package/src/commands/cheat-sheet.js +1 -0
- package/src/commands/cloudflare-login.js +1 -1
- package/src/commands/cloudflare.js +2 -2
- package/src/commands/connections.js +1 -1
- package/src/commands/go.js +76 -6
- package/src/commands/hooks.js +260 -0
- package/src/commands/merch.js +5 -0
- package/src/commands/mini.js +1 -1
- package/src/commands/models.js +1 -1
- package/src/commands/receipts.js +140 -0
- package/src/commands/run.js +253 -0
- package/src/commands/shell.js +114 -9
- package/src/errors/diagnostic.js +9 -9
- package/src/go/container.js +1 -1
- package/src/go/contract.js +61 -18
- package/src/go/discover.js +0 -4
- package/src/go/index.js +13 -1
- package/src/go/probe.js +109 -0
- package/src/go/{cloudflare.js → providers/cloudflare.js} +36 -136
- package/src/go/verify.js +1 -1
- package/src/index.js +32 -0
- package/src/indexing/ingest/inventory.js +1 -1
- package/src/knowledge/service/grpc-codec.js +2 -0
- package/src/lib/deploy/local-studio.js +2 -2
- package/src/lib/mini/scaffold.js +1 -1
- package/src/lib/slash-commands.js +1 -0
- package/src/lib/whoami-capabilities.js +1 -1
- package/src/local/runtime-store.js +54 -0
- package/src/mcp/cloudflare-bundles.js +1 -1
- package/src/models/catalog.js +0 -49
- package/src/models/inventory-core.js +69 -0
- package/src/plugins/index.js +9 -1
- package/src/plugins/registry.js +115 -6
- package/src/receipts/contract.js +68 -0
- package/src/receipts/index.js +20 -0
- package/src/receipts/prune.js +64 -0
- package/src/receipts/sinks.js +285 -0
- package/src/rpc/generated/errors_pb.js +49 -1
- package/src/tools/runtime.js +13 -5
- package/templates/mini/gadget/app.js +15 -40
- package/templates/mini/gadget/index.html +7 -7
- package/templates/mini/shared/style.css +1 -1
- /package/packages/connectors/{cloudflare → cfoa}/OAUTH_STORAGE_AUDIT.md +0 -0
- /package/packages/connectors/{cloudflare → cfoa}/src/api-client.js +0 -0
- /package/packages/connectors/{cloudflare → cfoa}/src/capabilities.js +0 -0
- /package/packages/connectors/{cloudflare → cfoa}/src/credential.js +0 -0
- /package/packages/connectors/{cloudflare → cfoa}/src/families/brand-protection.js +0 -0
- /package/packages/connectors/{cloudflare → cfoa}/src/families/keyless.js +0 -0
- /package/packages/connectors/{cloudflare → cfoa}/src/families/pages.js +0 -0
- /package/packages/connectors/{cloudflare → cfoa}/src/families/scanner.js +0 -0
- /package/packages/connectors/{cloudflare → cfoa}/src/families/snippets.js +0 -0
- /package/packages/connectors/{cloudflare → cfoa}/src/families/tag-gateway.js +0 -0
- /package/packages/connectors/{cloudflare → cfoa}/src/families/tags.js +0 -0
- /package/packages/connectors/{cloudflare → cfoa}/src/families/token-validation.js +0 -0
- /package/packages/connectors/{cloudflare → cfoa}/src/families/vectorize.js +0 -0
- /package/packages/connectors/{cloudflare → cfoa}/src/families/workflows.js +0 -0
- /package/packages/connectors/{cloudflare → cfoa}/src/index.js +0 -0
- /package/packages/connectors/{cloudflare → cfoa}/src/oauth-persist.js +0 -0
- /package/packages/connectors/{cloudflare → cfoa}/src/owner.js +0 -0
- /package/packages/connectors/{cloudflare → cfoa}/src/permission-options.js +0 -0
- /package/packages/connectors/{cloudflare → cfoa}/src/routes.js +0 -0
- /package/packages/connectors/{cloudflare → cfoa}/src/scope-catalog.js +0 -0
- /package/packages/connectors/{cloudflare → cfoa}/src/vault.js +0 -0
- /package/packages/connectors/{cloudflare → cfoa}/tests/capabilities.test.mjs +0 -0
- /package/packages/connectors/{cloudflare → cfoa}/tests/connector.test.mjs +0 -0
- /package/packages/connectors/{cloudflare → cfoa}/tests/oauth-persist.test.mjs +0 -0
- /package/packages/identity/src/oauth/{google-desktop-exchange.js → goaude.js} +0 -0
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
import { mkdir, rm, writeFile } from "node:fs/promises";
|
|
3
|
+
import { dirname, join } from "node:path";
|
|
4
|
+
import {
|
|
5
|
+
RECEIPT_SCHEMA_URL,
|
|
6
|
+
RECEIPT_R2_PREFIX,
|
|
7
|
+
SCHEMA_BASE_URL,
|
|
8
|
+
SCHEMAS_BUCKET_NAME,
|
|
9
|
+
receiptR2Key,
|
|
10
|
+
retentionExpiresAt,
|
|
11
|
+
validateReceiptEnvelope,
|
|
12
|
+
} from "./contract.js";
|
|
13
|
+
|
|
14
|
+
function stablePayload(receipt) {
|
|
15
|
+
return JSON.stringify(
|
|
16
|
+
{
|
|
17
|
+
$schema: RECEIPT_SCHEMA_URL,
|
|
18
|
+
...receipt,
|
|
19
|
+
},
|
|
20
|
+
null,
|
|
21
|
+
2,
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function sha256(value) {
|
|
26
|
+
return createHash("sha256").update(value).digest("hex");
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export class LocalReceiptSink {
|
|
30
|
+
constructor({ baseDir = join(process.cwd(), ".agentsam", "receipts") } = {}) {
|
|
31
|
+
this.baseDir = baseDir;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
async write(receipt) {
|
|
35
|
+
const validation = validateReceiptEnvelope(receipt);
|
|
36
|
+
if (!validation.ok) {
|
|
37
|
+
throw new TypeError(`Invalid AgentSam receipt: ${validation.errors.join("; ")}`);
|
|
38
|
+
}
|
|
39
|
+
const payload = stablePayload(receipt);
|
|
40
|
+
const localPath = join(this.baseDir, `${receipt.receipt_id}.json`);
|
|
41
|
+
await mkdir(dirname(localPath), { recursive: true });
|
|
42
|
+
await writeFile(localPath, payload, "utf8");
|
|
43
|
+
return {
|
|
44
|
+
local_path: localPath,
|
|
45
|
+
content_hash: sha256(payload),
|
|
46
|
+
byte_size: Buffer.byteLength(payload),
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export class R2ReceiptSink {
|
|
52
|
+
constructor(env = {}) {
|
|
53
|
+
this.env = env;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
async write(receipt) {
|
|
57
|
+
const validation = validateReceiptEnvelope(receipt);
|
|
58
|
+
if (!validation.ok) {
|
|
59
|
+
throw new TypeError(`Invalid AgentSam receipt: ${validation.errors.join("; ")}`);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
const r2Key = receiptR2Key(receipt);
|
|
63
|
+
if (!r2Key.startsWith(`${RECEIPT_R2_PREFIX}/`)) {
|
|
64
|
+
throw new Error("receipt_key_prefix_violation");
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
const payload = stablePayload(receipt);
|
|
68
|
+
const bucket = this.env.SCHEMAS_BUCKET;
|
|
69
|
+
if (bucket) {
|
|
70
|
+
await bucket.put(r2Key, payload, {
|
|
71
|
+
httpMetadata: {
|
|
72
|
+
contentType: "application/json",
|
|
73
|
+
cacheControl: "public, max-age=31536000, immutable",
|
|
74
|
+
},
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
return {
|
|
79
|
+
r2_key: r2Key,
|
|
80
|
+
url: `${SCHEMA_BASE_URL}/${r2Key}`,
|
|
81
|
+
bucket: SCHEMAS_BUCKET_NAME,
|
|
82
|
+
content_hash: sha256(payload),
|
|
83
|
+
byte_size: Buffer.byteLength(payload),
|
|
84
|
+
persisted: Boolean(bucket),
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export class D1ReceiptCatalog {
|
|
90
|
+
constructor(db) {
|
|
91
|
+
if (!db?.prepare) throw new TypeError("D1ReceiptCatalog requires a D1-compatible DB");
|
|
92
|
+
this.db = db;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
async insertReceipt(receipt, sinkResult, { expiresAtUnix = null } = {}) {
|
|
96
|
+
const r2Key = sinkResult?.r2_key;
|
|
97
|
+
if (!r2Key?.startsWith(`${RECEIPT_R2_PREFIX}/`)) {
|
|
98
|
+
throw new Error("receipt_catalog_r2_key_prefix_violation");
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
const payload = stablePayload(receipt);
|
|
102
|
+
const contentHash = sinkResult.content_hash || sha256(payload);
|
|
103
|
+
const byteSize = Number(sinkResult.byte_size || Buffer.byteLength(payload));
|
|
104
|
+
|
|
105
|
+
await this.db
|
|
106
|
+
.prepare(
|
|
107
|
+
`INSERT INTO agentsam_receipt_catalog
|
|
108
|
+
(id, account_id, receipt_kind, schema_name, status, retention_class,
|
|
109
|
+
repository_id, git_sha, run_id, r2_key, content_hash, byte_size,
|
|
110
|
+
created_at_unix, expires_at_unix, meta_json)
|
|
111
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
112
|
+
ON CONFLICT(id) DO UPDATE SET
|
|
113
|
+
status=excluded.status,
|
|
114
|
+
r2_key=excluded.r2_key,
|
|
115
|
+
content_hash=excluded.content_hash,
|
|
116
|
+
byte_size=excluded.byte_size,
|
|
117
|
+
expires_at_unix=excluded.expires_at_unix,
|
|
118
|
+
meta_json=excluded.meta_json`,
|
|
119
|
+
)
|
|
120
|
+
.bind(
|
|
121
|
+
receipt.receipt_id,
|
|
122
|
+
receipt.identity.account_id,
|
|
123
|
+
receipt.kind,
|
|
124
|
+
receipt.schema,
|
|
125
|
+
receipt.status,
|
|
126
|
+
receipt.retention_class,
|
|
127
|
+
receipt.identity.repository_id || null,
|
|
128
|
+
receipt.identity.git_sha || null,
|
|
129
|
+
receipt.identity.run_id || null,
|
|
130
|
+
r2Key,
|
|
131
|
+
contentHash,
|
|
132
|
+
byteSize,
|
|
133
|
+
Number(receipt.metrics.created_at_unix),
|
|
134
|
+
expiresAtUnix,
|
|
135
|
+
JSON.stringify({
|
|
136
|
+
pty_session_id: receipt.identity.pty_session_id || null,
|
|
137
|
+
schema_url: RECEIPT_SCHEMA_URL,
|
|
138
|
+
}),
|
|
139
|
+
)
|
|
140
|
+
.run();
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
async list({ limit = 20, repositoryId = null, status = null } = {}) {
|
|
144
|
+
const where = [];
|
|
145
|
+
const binds = [];
|
|
146
|
+
if (repositoryId) {
|
|
147
|
+
where.push("repository_id = ?");
|
|
148
|
+
binds.push(String(repositoryId));
|
|
149
|
+
}
|
|
150
|
+
if (status) {
|
|
151
|
+
where.push("status = ?");
|
|
152
|
+
binds.push(String(status));
|
|
153
|
+
}
|
|
154
|
+
const boundedLimit = Math.max(1, Math.min(200, Number(limit) || 20));
|
|
155
|
+
const sql =
|
|
156
|
+
"SELECT id, account_id, receipt_kind, schema_name, status, retention_class, " +
|
|
157
|
+
"repository_id, git_sha, run_id, r2_key, content_hash, byte_size, " +
|
|
158
|
+
"created_at_unix, expires_at_unix, meta_json " +
|
|
159
|
+
"FROM agentsam_receipt_catalog " +
|
|
160
|
+
(where.length ? "WHERE " + where.join(" AND ") + " " : "") +
|
|
161
|
+
"ORDER BY created_at_unix DESC LIMIT ?";
|
|
162
|
+
binds.push(boundedLimit);
|
|
163
|
+
const result = await this.db.prepare(sql).bind(...binds).all();
|
|
164
|
+
return (result?.results || []).map((row) => ({
|
|
165
|
+
receipt_id: row.id,
|
|
166
|
+
kind: row.receipt_kind,
|
|
167
|
+
schema: row.schema_name,
|
|
168
|
+
status: row.status,
|
|
169
|
+
retention_class: row.retention_class,
|
|
170
|
+
identity: {
|
|
171
|
+
account_id: row.account_id,
|
|
172
|
+
repository_id: row.repository_id,
|
|
173
|
+
git_sha: row.git_sha,
|
|
174
|
+
run_id: row.run_id,
|
|
175
|
+
},
|
|
176
|
+
metrics: {
|
|
177
|
+
created_at_unix: row.created_at_unix,
|
|
178
|
+
receipt_byte_size: row.byte_size,
|
|
179
|
+
},
|
|
180
|
+
r2_key: row.r2_key,
|
|
181
|
+
content_hash: row.content_hash,
|
|
182
|
+
expires_at_unix: row.expires_at_unix,
|
|
183
|
+
meta: row.meta_json ? JSON.parse(row.meta_json) : null,
|
|
184
|
+
}));
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
async getIndex(receiptId) {
|
|
188
|
+
const result = await this.db
|
|
189
|
+
.prepare(
|
|
190
|
+
"SELECT id, account_id, receipt_kind, schema_name, status, retention_class, " +
|
|
191
|
+
"repository_id, git_sha, run_id, r2_key, content_hash, byte_size, " +
|
|
192
|
+
"created_at_unix, expires_at_unix, meta_json " +
|
|
193
|
+
"FROM agentsam_receipt_catalog WHERE id = ? LIMIT 1",
|
|
194
|
+
)
|
|
195
|
+
.bind(String(receiptId))
|
|
196
|
+
.first();
|
|
197
|
+
return result || null;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
export class ReceiptCatalogReader {
|
|
202
|
+
constructor({ catalog, bucket }) {
|
|
203
|
+
if (!catalog?.list || !catalog?.getIndex) {
|
|
204
|
+
throw new TypeError("ReceiptCatalogReader requires a D1ReceiptCatalog-compatible catalog");
|
|
205
|
+
}
|
|
206
|
+
if (!bucket?.get) {
|
|
207
|
+
throw new TypeError("ReceiptCatalogReader requires an R2-compatible bucket");
|
|
208
|
+
}
|
|
209
|
+
this.catalog = catalog;
|
|
210
|
+
this.bucket = bucket;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
async list(options = {}) {
|
|
214
|
+
return this.catalog.list(options);
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
async get(receiptId) {
|
|
218
|
+
const row = await this.catalog.getIndex(receiptId);
|
|
219
|
+
if (!row) return null;
|
|
220
|
+
if (!String(row.r2_key || "").startsWith(RECEIPT_R2_PREFIX + "/")) {
|
|
221
|
+
throw new Error("receipt_catalog_r2_key_prefix_violation");
|
|
222
|
+
}
|
|
223
|
+
const object = await this.bucket.get(row.r2_key);
|
|
224
|
+
if (!object) return null;
|
|
225
|
+
const text =
|
|
226
|
+
typeof object.text === "function"
|
|
227
|
+
? await object.text()
|
|
228
|
+
: new TextDecoder().decode(await object.arrayBuffer());
|
|
229
|
+
const receipt = JSON.parse(text);
|
|
230
|
+
const validation = validateReceiptEnvelope(receipt);
|
|
231
|
+
if (!validation.ok) {
|
|
232
|
+
throw new Error("stored_receipt_envelope_invalid: " + validation.errors.join("; "));
|
|
233
|
+
}
|
|
234
|
+
return receipt;
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
export class CompositeReceiptSink {
|
|
239
|
+
constructor({ localSink, r2Sink = null, dbCatalog = null } = {}) {
|
|
240
|
+
if (!localSink?.write) {
|
|
241
|
+
throw new TypeError("CompositeReceiptSink requires localSink");
|
|
242
|
+
}
|
|
243
|
+
this.localSink = localSink;
|
|
244
|
+
this.r2Sink = r2Sink;
|
|
245
|
+
this.dbCatalog = dbCatalog;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
async write(receipt, options = {}) {
|
|
249
|
+
const validation = validateReceiptEnvelope(receipt);
|
|
250
|
+
if (!validation.ok) {
|
|
251
|
+
throw new TypeError(`Invalid AgentSam receipt: ${validation.errors.join("; ")}`);
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
const localRes = await this.localSink.write(receipt);
|
|
255
|
+
let r2Res = {};
|
|
256
|
+
const expiresAtUnix = retentionExpiresAt(receipt);
|
|
257
|
+
|
|
258
|
+
if (this.r2Sink) {
|
|
259
|
+
r2Res = await this.r2Sink.write(receipt);
|
|
260
|
+
if (this.dbCatalog && r2Res.r2_key) {
|
|
261
|
+
await this.dbCatalog.insertReceipt(receipt, r2Res, { expiresAtUnix });
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
if (options.localWorkdir) {
|
|
266
|
+
await this.cleanupLocalWorkspace(options.localWorkdir, receipt.status);
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
return {
|
|
270
|
+
local_path: localRes.local_path,
|
|
271
|
+
r2_key: r2Res.r2_key,
|
|
272
|
+
url: r2Res.url,
|
|
273
|
+
content_hash: r2Res.content_hash || localRes.content_hash,
|
|
274
|
+
expires_at_unix: expiresAtUnix,
|
|
275
|
+
};
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
async cleanupLocalWorkspace(workdir, status) {
|
|
279
|
+
if (status !== "passed") return false;
|
|
280
|
+
const value = String(workdir || "");
|
|
281
|
+
if (!value || !value.includes("agentsam-")) return false;
|
|
282
|
+
await rm(value, { recursive: true, force: true });
|
|
283
|
+
return true;
|
|
284
|
+
}
|
|
285
|
+
}
|
|
@@ -103,7 +103,8 @@ proto.agentsam.knowledge.v1.ErrorDetail.toObject = function(includeInstance, msg
|
|
|
103
103
|
detailsJson: jspb.Message.getFieldWithDefault(msg, 25, ""),
|
|
104
104
|
occurrenceCount: jspb.Message.getFieldWithDefault(msg, 26, 0),
|
|
105
105
|
requestId: jspb.Message.getFieldWithDefault(msg, 27, ""),
|
|
106
|
-
schemaVersion: jspb.Message.getFieldWithDefault(msg, 28, 0)
|
|
106
|
+
schemaVersion: jspb.Message.getFieldWithDefault(msg, 28, 0),
|
|
107
|
+
nativeStage: jspb.Message.getFieldWithDefault(msg, 29, "")
|
|
107
108
|
};
|
|
108
109
|
|
|
109
110
|
if (includeInstance) {
|
|
@@ -252,6 +253,10 @@ proto.agentsam.knowledge.v1.ErrorDetail.deserializeBinaryFromReader = function(m
|
|
|
252
253
|
var value = /** @type {number} */ (reader.readUint32());
|
|
253
254
|
msg.setSchemaVersion(value);
|
|
254
255
|
break;
|
|
256
|
+
case 29:
|
|
257
|
+
var value = /** @type {string} */ (reader.readString());
|
|
258
|
+
msg.setNativeStage(value);
|
|
259
|
+
break;
|
|
255
260
|
default:
|
|
256
261
|
reader.skipField();
|
|
257
262
|
break;
|
|
@@ -477,6 +482,13 @@ proto.agentsam.knowledge.v1.ErrorDetail.serializeBinaryToWriter = function(messa
|
|
|
477
482
|
f
|
|
478
483
|
);
|
|
479
484
|
}
|
|
485
|
+
f = /** @type {string} */ (jspb.Message.getField(message, 29));
|
|
486
|
+
if (f != null) {
|
|
487
|
+
writer.writeString(
|
|
488
|
+
29,
|
|
489
|
+
f
|
|
490
|
+
);
|
|
491
|
+
}
|
|
480
492
|
};
|
|
481
493
|
|
|
482
494
|
|
|
@@ -1416,6 +1428,42 @@ proto.agentsam.knowledge.v1.ErrorDetail.prototype.hasSchemaVersion = function()
|
|
|
1416
1428
|
};
|
|
1417
1429
|
|
|
1418
1430
|
|
|
1431
|
+
/**
|
|
1432
|
+
* optional string native_stage = 29;
|
|
1433
|
+
* @return {string}
|
|
1434
|
+
*/
|
|
1435
|
+
proto.agentsam.knowledge.v1.ErrorDetail.prototype.getNativeStage = function() {
|
|
1436
|
+
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 29, ""));
|
|
1437
|
+
};
|
|
1438
|
+
|
|
1439
|
+
|
|
1440
|
+
/**
|
|
1441
|
+
* @param {string} value
|
|
1442
|
+
* @return {!proto.agentsam.knowledge.v1.ErrorDetail} returns this
|
|
1443
|
+
*/
|
|
1444
|
+
proto.agentsam.knowledge.v1.ErrorDetail.prototype.setNativeStage = function(value) {
|
|
1445
|
+
return jspb.Message.setField(this, 29, value);
|
|
1446
|
+
};
|
|
1447
|
+
|
|
1448
|
+
|
|
1449
|
+
/**
|
|
1450
|
+
* Clears the field making it undefined.
|
|
1451
|
+
* @return {!proto.agentsam.knowledge.v1.ErrorDetail} returns this
|
|
1452
|
+
*/
|
|
1453
|
+
proto.agentsam.knowledge.v1.ErrorDetail.prototype.clearNativeStage = function() {
|
|
1454
|
+
return jspb.Message.setField(this, 29, undefined);
|
|
1455
|
+
};
|
|
1456
|
+
|
|
1457
|
+
|
|
1458
|
+
/**
|
|
1459
|
+
* Returns whether this field is set.
|
|
1460
|
+
* @return {boolean}
|
|
1461
|
+
*/
|
|
1462
|
+
proto.agentsam.knowledge.v1.ErrorDetail.prototype.hasNativeStage = function() {
|
|
1463
|
+
return jspb.Message.getField(this, 29) != null;
|
|
1464
|
+
};
|
|
1465
|
+
|
|
1466
|
+
|
|
1419
1467
|
/**
|
|
1420
1468
|
* @enum {number}
|
|
1421
1469
|
*/
|
package/src/tools/runtime.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ERROR_REASON_POLICY, normalizeError } from '../errors/index.js';
|
|
1
|
+
import { ERROR_REASON_POLICY, canonicalizeErrorReason, normalizeError } from '../errors/index.js';
|
|
2
2
|
import { receiptPayload, redactToolValue } from './redact.js';
|
|
3
3
|
|
|
4
4
|
function defaultId(prefix) {
|
|
@@ -6,6 +6,11 @@ function defaultId(prefix) {
|
|
|
6
6
|
}
|
|
7
7
|
|
|
8
8
|
function reasonForError(error) {
|
|
9
|
+
const nativeReason = canonicalizeErrorReason(error);
|
|
10
|
+
if (/^(hook|mcp|lsp|tool|provider)_/.test(nativeReason || '')) return nativeReason;
|
|
11
|
+
const message = String(error?.message || error || '').toLowerCase();
|
|
12
|
+
if (message.includes('provider adapter not registered') || message.includes('no registered execution target')) return 'tool_handler_unavailable';
|
|
13
|
+
if (/timeout|timed out|deadline/.test(message)) return 'tool_timeout';
|
|
9
14
|
const status = Number(error?.status || error?.http_status || 0);
|
|
10
15
|
if (status === 401) return 'provider_credential_invalid';
|
|
11
16
|
if (status === 403) return 'provider_scope_insufficient';
|
|
@@ -16,12 +21,12 @@ function reasonForError(error) {
|
|
|
16
21
|
if (status === 400 || status === 422) return 'provider_request_invalid';
|
|
17
22
|
if (error?.code === 'completeful_idempotency_required') return 'input_invalid';
|
|
18
23
|
if (error instanceof TypeError) return 'input_invalid';
|
|
19
|
-
return '
|
|
24
|
+
return nativeReason || 'tool_execution_failed';
|
|
20
25
|
}
|
|
21
26
|
|
|
22
|
-
function normalizeToolError(error, definition) {
|
|
27
|
+
function normalizeToolError(error, definition, sideEffectState = 'unknown') {
|
|
23
28
|
const reason = reasonForError(error);
|
|
24
|
-
const policy = ERROR_REASON_POLICY[reason] || ERROR_REASON_POLICY.
|
|
29
|
+
const policy = ERROR_REASON_POLICY[reason] || ERROR_REASON_POLICY.tool_execution_failed;
|
|
25
30
|
return normalizeError(error, {
|
|
26
31
|
code: policy.code,
|
|
27
32
|
reason,
|
|
@@ -29,6 +34,9 @@ function normalizeToolError(error, definition) {
|
|
|
29
34
|
? { kind: 'provider', name: definition.provider, service: definition.provider }
|
|
30
35
|
: { kind: 'runtime', name: 'agentsam-tool-runtime' },
|
|
31
36
|
domain: 'tool',
|
|
37
|
+
stage: 'execute',
|
|
38
|
+
feature: 'tool.execute',
|
|
39
|
+
side_effect_state: sideEffectState,
|
|
32
40
|
tool: definition.toolKey,
|
|
33
41
|
provider: definition.provider || null,
|
|
34
42
|
provider_code: error?.code || null,
|
|
@@ -132,7 +140,7 @@ export function createToolExecutor({
|
|
|
132
140
|
try {
|
|
133
141
|
invoke = await resolveExecutionTarget(registry, definition);
|
|
134
142
|
} catch (error) {
|
|
135
|
-
const normalized = normalizeToolError(error, definition);
|
|
143
|
+
const normalized = normalizeToolError(error, definition, 'not_started');
|
|
136
144
|
const completedAt = now();
|
|
137
145
|
const receipt = {
|
|
138
146
|
invocationId: invocation.id,
|
|
@@ -1,45 +1,20 @@
|
|
|
1
|
-
const
|
|
2
|
-
const
|
|
3
|
-
const toggle = document.querySelector('#toggle');
|
|
1
|
+
const action = document.querySelector('#action');
|
|
2
|
+
const reset = document.querySelector('#reset');
|
|
4
3
|
const status = document.querySelector('#status');
|
|
5
|
-
let
|
|
6
|
-
|
|
7
|
-
let interval;
|
|
4
|
+
let interactions = 0;
|
|
5
|
+
|
|
8
6
|
function draw() {
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
status.textContent = interactions === 0
|
|
8
|
+
? 'Ready.'
|
|
9
|
+
: `Interaction ${interactions} recorded. Replace this behavior with your own.`;
|
|
11
10
|
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
const value = Math.min(180, Math.max(1, Math.round(Number(minutes.value) || 5)));
|
|
21
|
-
minutes.value = value;
|
|
22
|
-
remaining = value * 60000;
|
|
23
|
-
toggle.textContent = 'Start focus';
|
|
24
|
-
status.textContent = 'Ready when you are.';
|
|
11
|
+
|
|
12
|
+
action.addEventListener('click', () => {
|
|
13
|
+
interactions += 1;
|
|
14
|
+
draw();
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
reset.addEventListener('click', () => {
|
|
18
|
+
interactions = 0;
|
|
25
19
|
draw();
|
|
26
|
-
}
|
|
27
|
-
toggle.addEventListener('click', () => {
|
|
28
|
-
if (interval) {
|
|
29
|
-
remaining = Math.max(0, deadline - Date.now());
|
|
30
|
-
pause(); draw(); status.textContent = 'Paused. Take your time.';
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
if (remaining <= 0) reset();
|
|
34
|
-
deadline = Date.now() + remaining;
|
|
35
|
-
minutes.disabled = true;
|
|
36
|
-
toggle.textContent = 'Pause';
|
|
37
|
-
status.textContent = 'Focus on your next small step.';
|
|
38
|
-
interval = setInterval(() => {
|
|
39
|
-
remaining = Math.max(0, deadline - Date.now());
|
|
40
|
-
draw();
|
|
41
|
-
if (!remaining) { pause(); toggle.textContent = 'Start again'; status.textContent = 'Session complete. Nice work.'; }
|
|
42
|
-
}, 200);
|
|
43
20
|
});
|
|
44
|
-
minutes.addEventListener('change', reset);
|
|
45
|
-
document.querySelector('#reset').addEventListener('click', reset);
|
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
<head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>{{NAME}} · AgentSam Mini</title><link rel="stylesheet" href="/style.css"><script src="/app.js" defer></script></head>
|
|
4
4
|
<body><main>
|
|
5
5
|
<div class="brand"><span class="dot"></span>AGENTSAM MINI</div>
|
|
6
|
-
<h1>A
|
|
7
|
-
<section class="card" aria-label="
|
|
8
|
-
<
|
|
9
|
-
<
|
|
10
|
-
<div class="row"><button id="
|
|
11
|
-
<p id="status" class="status" role="status">Ready
|
|
12
|
-
</section><footer>{{NAME}} ·
|
|
6
|
+
<h1>A small surface to shape.</h1><p>Start with one interaction, then replace it with the utility you actually need.</p>
|
|
7
|
+
<section class="card" aria-label="Interactive starter">
|
|
8
|
+
<h2>Interactive canvas</h2>
|
|
9
|
+
<p>This starter proves local state and events without pretending to be a finished product.</p>
|
|
10
|
+
<div class="row"><button id="action" class="primary">Try interaction</button><button id="reset">Reset</button></div>
|
|
11
|
+
<p id="status" class="status" role="status">Ready.</p>
|
|
12
|
+
</section><footer>{{NAME}} · Plain HTML, CSS, and JavaScript.</footer>
|
|
13
13
|
</main></body></html>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
:root{color-scheme:light;font:16px/1.5 -apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;color:#20242d;background:#f5f6f8;font-synthesis:none}*{box-sizing:border-box}body{margin:0;padding:24px}main{max-width:720px;margin:8vh auto}.brand{display:flex;align-items:center;gap:8px;font-size:.8rem;letter-spacing:.04em;color:#616979}.dot{width:8px;height:8px;border-radius:50%;background:#5a7df7}h1{font-size:clamp(2rem,7vw,3.2rem);line-height:1.1;letter-spacing:-.055em;margin:22px 0 12px}h2{font-size:1.1rem}p{color:#616979}.card{padding:clamp(20px,5vw,36px);border:1px solid #e4e7ed;border-radius:24px;background:white;margin-top:28px;box-shadow:0 8px 32px #25305606}.row{display:flex;gap:12px;flex-wrap:wrap;align-items:center}button,.button{font:inherit;cursor:pointer;border-radius:12px;border:1px solid #d8dee9;background:white;color:#20242d;padding:12px 20px;min-height:48px;text-decoration:none;display:inline-flex;justify-content:center;align-items:center}.primary{background:#365cdb;color:#fff;border-color:#365cdb}button:hover,.button:hover{filter:brightness(.95)}:focus-visible{outline:3px solid #5a7df7;outline-offset:4px}label{display:block;font-size:.875rem;color:#485165;margin-bottom:8px}input,textarea{font:inherit;width:100%;padding:12px;border:1px solid #c5ccd9;border-radius:10px;background:#fff;color:#20242d}input[type=number]{max-width:100px}textarea{font:13px/1.6 ui-monospace,SFMono-Regular,monospace;resize:vertical;min-height:180px}.
|
|
1
|
+
:root{color-scheme:light;font:16px/1.5 -apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;color:#20242d;background:#f5f6f8;font-synthesis:none}*{box-sizing:border-box}body{margin:0;padding:24px}main{max-width:720px;margin:8vh auto}.brand{display:flex;align-items:center;gap:8px;font-size:.8rem;letter-spacing:.04em;color:#616979}.dot{width:8px;height:8px;border-radius:50%;background:#5a7df7}h1{font-size:clamp(2rem,7vw,3.2rem);line-height:1.1;letter-spacing:-.055em;margin:22px 0 12px}h2{font-size:1.1rem}p{color:#616979}.card{padding:clamp(20px,5vw,36px);border:1px solid #e4e7ed;border-radius:24px;background:white;margin-top:28px;box-shadow:0 8px 32px #25305606}.row{display:flex;gap:12px;flex-wrap:wrap;align-items:center}button,.button{font:inherit;cursor:pointer;border-radius:12px;border:1px solid #d8dee9;background:white;color:#20242d;padding:12px 20px;min-height:48px;text-decoration:none;display:inline-flex;justify-content:center;align-items:center}.primary{background:#365cdb;color:#fff;border-color:#365cdb}button:hover,.button:hover{filter:brightness(.95)}:focus-visible{outline:3px solid #5a7df7;outline-offset:4px}label{display:block;font-size:.875rem;color:#485165;margin-bottom:8px}input,textarea{font:inherit;width:100%;padding:12px;border:1px solid #c5ccd9;border-radius:10px;background:#fff;color:#20242d}input[type=number]{max-width:100px}textarea{font:13px/1.6 ui-monospace,SFMono-Regular,monospace;resize:vertical;min-height:180px}.muted,footer{font-size:.85rem;color:#616979}footer{margin:24px 0}.status{min-height:24px;font-size:.875rem}pre{white-space:pre-wrap;overflow-wrap:anywhere;font:13px/1.6 ui-monospace,SFMono-Regular,monospace;background:#f5f6f8;padding:16px;border-radius:12px;max-height:340px;overflow:auto}.space{margin-top:20px}.error{color:#aa2331}@media(max-width:480px){body{padding:18px}main{margin:6vh auto}.row>button{flex:1}}@media(prefers-reduced-motion:no-preference){button,.button{transition:filter .15s}}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|