@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,870 @@
|
|
|
1
|
+
# AgentSam Suspend / Queue / Knowledge Runtime RDP
|
|
2
|
+
|
|
3
|
+
**Date:** 2026-10-03
|
|
4
|
+
**Branch:** feat/agent-control-plane
|
|
5
|
+
**Status:** Proposed implementation contract
|
|
6
|
+
**Scope:** AgentSam SDK/CLI, Local Studio, hosted AgentSam, local/enrolled runtimes, Queue Control, WorkGraph, GOAP, knowledge/AutoRAG/indexing/vectorization.
|
|
7
|
+
|
|
8
|
+
## 1. Problem
|
|
9
|
+
|
|
10
|
+
AgentSam already has real pieces that should reinforce each other:
|
|
11
|
+
|
|
12
|
+
- durable agentsam_agent_run records, including parent_run_id, multitask mode, status, cancellation, model/tool usage, token/cost fields, plan/todo references;
|
|
13
|
+
- agentsam.activity.v1 for live run activity;
|
|
14
|
+
- Queue Control with logical queues, retry policy and exponential backoff;
|
|
15
|
+
- WorkGraph and GOAP;
|
|
16
|
+
- runtime protocol and local/remote/sandbox lanes;
|
|
17
|
+
- Local Studio lead/co-worker presentation and task-aware loading scenes;
|
|
18
|
+
- repository indexing, Merkle evidence, AST/lexical retrieval, optional embeddings;
|
|
19
|
+
- @inneranimalmedia/agentsam-knowledge AutoRAG discovery/configuration/providers/backends/probes;
|
|
20
|
+
- local SQLite knowledge plus optional pgvector/Supabase/Cloudflare Vectorize backends.
|
|
21
|
+
|
|
22
|
+
What is missing is one portable lifecycle for doing work, yielding while nothing useful can happen, waking cheaply, reusing accumulated knowledge, and proving what happened.
|
|
23
|
+
|
|
24
|
+
The failure mode to avoid is an LLM turn staying alive merely to poll an API, watch a queue, wait for indexing, wait for deployment, or periodically ask whether an external condition changed.
|
|
25
|
+
|
|
26
|
+
## 2. Core principle
|
|
27
|
+
|
|
28
|
+
**Models decide; deterministic machinery waits.**
|
|
29
|
+
|
|
30
|
+
A model may inspect retrieved context, choose/plan an action, request tools or child runs, decide a wake condition, and then yield.
|
|
31
|
+
|
|
32
|
+
After yield, the run is durable. A queue consumer, webhook, scheduler, runtime event, approval, filesystem event, child-run completion, or deterministic poller wakes the run.
|
|
33
|
+
|
|
34
|
+
No model tokens are spent during the wait.
|
|
35
|
+
|
|
36
|
+
## 3. System boundary
|
|
37
|
+
|
|
38
|
+
AgentSam is the portable harness. agentsam-go-worker is one hosted AgentSam implementation, not the universal authority.
|
|
39
|
+
|
|
40
|
+
~~~text
|
|
41
|
+
CLI / SDK / Local Studio
|
|
42
|
+
|
|
|
43
|
+
v
|
|
44
|
+
portable run/control contract
|
|
45
|
+
|
|
|
46
|
+
+---- local --------> agentsamd / native machine
|
|
47
|
+
+---- hosted -------> agentsam-go-worker
|
|
48
|
+
+---- remote -------> enrolled device / VM
|
|
49
|
+
+---- sandbox ------> container runtime
|
|
50
|
+
|
|
|
51
|
+
v
|
|
52
|
+
agentsam.runtime.v1
|
|
53
|
+
~~~
|
|
54
|
+
|
|
55
|
+
The same control contract must work for interactive agent work, child AgentSam runs, repository indexing, knowledge ingestion, embedding/vectorization, package verification, deploy/infra workflows, CAD, CMS/commerce, webhooks, and background maintenance.
|
|
56
|
+
|
|
57
|
+
## 4. Run lifecycle
|
|
58
|
+
|
|
59
|
+
Extend the portable run vocabulary so a run may be inactive without being terminal.
|
|
60
|
+
|
|
61
|
+
~~~text
|
|
62
|
+
queued
|
|
63
|
+
running
|
|
64
|
+
waiting_external
|
|
65
|
+
waiting_child
|
|
66
|
+
awaiting_input
|
|
67
|
+
awaiting_approval
|
|
68
|
+
sleeping
|
|
69
|
+
retry_scheduled
|
|
70
|
+
completed
|
|
71
|
+
failed
|
|
72
|
+
cancelled
|
|
73
|
+
timed_out
|
|
74
|
+
~~~
|
|
75
|
+
|
|
76
|
+
Terminal states are only completed, failed, cancelled, and timed_out.
|
|
77
|
+
|
|
78
|
+
A waiting run has zero model activity unless a wake event transitions it back to queued/running.
|
|
79
|
+
|
|
80
|
+
### 4.1 Suspension record
|
|
81
|
+
|
|
82
|
+
~~~ts
|
|
83
|
+
interface AgentRunSuspension {
|
|
84
|
+
runId: string;
|
|
85
|
+
reason:
|
|
86
|
+
| "external"
|
|
87
|
+
| "child_run"
|
|
88
|
+
| "approval"
|
|
89
|
+
| "input"
|
|
90
|
+
| "retry"
|
|
91
|
+
| "scheduled"
|
|
92
|
+
| "rate_limit";
|
|
93
|
+
wakeAt?: number;
|
|
94
|
+
wakeEvent?: string;
|
|
95
|
+
dependencyRunIds?: string[];
|
|
96
|
+
attempt?: number;
|
|
97
|
+
resumeStepId?: string;
|
|
98
|
+
checkpointRef?: string;
|
|
99
|
+
expiresAt?: number;
|
|
100
|
+
metadata?: Record<string, unknown>;
|
|
101
|
+
}
|
|
102
|
+
~~~
|
|
103
|
+
|
|
104
|
+
This is not a serialized model process. It is deterministic state describing why the run stopped and what makes it runnable again.
|
|
105
|
+
|
|
106
|
+
## 5. Wait mechanisms
|
|
107
|
+
|
|
108
|
+
Use the cheapest mechanism appropriate to the condition.
|
|
109
|
+
|
|
110
|
+
### 5.1 Event wake
|
|
111
|
+
|
|
112
|
+
Preferred whenever an external system can signal completion.
|
|
113
|
+
|
|
114
|
+
Examples: child run completed, queue job acknowledged, deployment webhook arrived, object created, approval submitted, user replied, terminal job finished, indexing generation published.
|
|
115
|
+
|
|
116
|
+
~~~text
|
|
117
|
+
run requests work
|
|
118
|
+
|
|
|
119
|
+
v
|
|
120
|
+
persist suspension + checkpoint
|
|
121
|
+
|
|
|
122
|
+
v
|
|
123
|
+
end model turn
|
|
124
|
+
|
|
|
125
|
+
external event
|
|
126
|
+
|
|
|
127
|
+
v
|
|
128
|
+
append run event
|
|
129
|
+
|
|
|
130
|
+
v
|
|
131
|
+
transition run -> queued
|
|
132
|
+
|
|
|
133
|
+
v
|
|
134
|
+
resume only when scheduler dispatches it
|
|
135
|
+
~~~
|
|
136
|
+
|
|
137
|
+
### 5.2 Delayed queue wake
|
|
138
|
+
|
|
139
|
+
Use for bounded retry/rate-limit/backoff windows.
|
|
140
|
+
|
|
141
|
+
Portable queue contract:
|
|
142
|
+
|
|
143
|
+
~~~ts
|
|
144
|
+
enqueue(job, {
|
|
145
|
+
availableAt,
|
|
146
|
+
retry: {
|
|
147
|
+
maxAttempts,
|
|
148
|
+
backoff: "exponential",
|
|
149
|
+
baseDelayMs,
|
|
150
|
+
maxDelayMs,
|
|
151
|
+
jitter: true
|
|
152
|
+
}
|
|
153
|
+
});
|
|
154
|
+
~~~
|
|
155
|
+
|
|
156
|
+
Adapters project this to Cloudflare Queues, local SQLite jobs, Postgres, etc.
|
|
157
|
+
|
|
158
|
+
### 5.3 Scheduled wake
|
|
159
|
+
|
|
160
|
+
For long waits, recurring maintenance, or time-based jobs persist:
|
|
161
|
+
|
|
162
|
+
~~~text
|
|
163
|
+
wake_at
|
|
164
|
+
run_id
|
|
165
|
+
reason
|
|
166
|
+
dedupe_key
|
|
167
|
+
~~~
|
|
168
|
+
|
|
169
|
+
A cheap scheduler scans due rows and enqueues them.
|
|
170
|
+
|
|
171
|
+
The scheduler never calls a model merely because a row exists. It only marks/enqueues runnable work.
|
|
172
|
+
|
|
173
|
+
### 5.4 Deterministic polling job
|
|
174
|
+
|
|
175
|
+
Some providers expose no webhook/event. In that case create a poller job, not an agent loop.
|
|
176
|
+
|
|
177
|
+
~~~text
|
|
178
|
+
deploy requested
|
|
179
|
+
|
|
|
180
|
+
v
|
|
181
|
+
run sleeps
|
|
182
|
+
|
|
|
183
|
+
v
|
|
184
|
+
deployment.poll job
|
|
185
|
+
|
|
|
186
|
+
provider status API
|
|
187
|
+
|
|
|
188
|
+
+-- pending -> retry(delay=backoff)
|
|
189
|
+
|
|
|
190
|
+
+-- complete -> emit deployment.completed -> wake run
|
|
191
|
+
|
|
|
192
|
+
+-- failed -> emit deployment.failed -> wake/fail run
|
|
193
|
+
~~~
|
|
194
|
+
|
|
195
|
+
Pollers must be deterministic, no-LLM, idempotent, bounded, backoff+jitter aware, circuit-breaker aware, and able to terminate into DLQ/manual intervention.
|
|
196
|
+
|
|
197
|
+
## 6. Timeout hierarchy
|
|
198
|
+
|
|
199
|
+
Do not use one global timeout.
|
|
200
|
+
|
|
201
|
+
~~~text
|
|
202
|
+
model_call_timeout
|
|
203
|
+
tool_call_timeout
|
|
204
|
+
step_timeout
|
|
205
|
+
lease_timeout
|
|
206
|
+
external_wait_timeout
|
|
207
|
+
run_deadline
|
|
208
|
+
idle_retention_ttl
|
|
209
|
+
~~~
|
|
210
|
+
|
|
211
|
+
Semantics:
|
|
212
|
+
|
|
213
|
+
- model call: fail/retry model transport only;
|
|
214
|
+
- tool call: bound one invocation;
|
|
215
|
+
- step: bound one logical WorkGraph/GOAP action;
|
|
216
|
+
- lease: detect crashed consumers without failing the logical run;
|
|
217
|
+
- external wait: cap unresolved dependencies;
|
|
218
|
+
- run deadline: user/policy budget for the whole objective;
|
|
219
|
+
- retention TTL: cleanup after terminal completion.
|
|
220
|
+
|
|
221
|
+
Timeouts produce typed events and receipts. They should never silently disappear.
|
|
222
|
+
|
|
223
|
+
## 7. Queue topology
|
|
224
|
+
|
|
225
|
+
Keep logical queues portable and extend current Queue Control rather than replacing it.
|
|
226
|
+
|
|
227
|
+
~~~text
|
|
228
|
+
interactive
|
|
229
|
+
agent_runs
|
|
230
|
+
indexing
|
|
231
|
+
knowledge
|
|
232
|
+
embeddings
|
|
233
|
+
batch_ai
|
|
234
|
+
deployments
|
|
235
|
+
cad
|
|
236
|
+
cms
|
|
237
|
+
webhooks
|
|
238
|
+
maintenance
|
|
239
|
+
dlq
|
|
240
|
+
~~~
|
|
241
|
+
|
|
242
|
+
Queue policy should own priority, max concurrency, batching, retry class, provider/rate-limit budget, dead-letter destination, dedupe/idempotency key, and cost class.
|
|
243
|
+
|
|
244
|
+
## 8. Lease and idempotency
|
|
245
|
+
|
|
246
|
+
Every background job needs an execution identity.
|
|
247
|
+
|
|
248
|
+
~~~text
|
|
249
|
+
job_id
|
|
250
|
+
run_id
|
|
251
|
+
step_id
|
|
252
|
+
attempt
|
|
253
|
+
idempotency_key
|
|
254
|
+
lease_owner
|
|
255
|
+
lease_expires_at
|
|
256
|
+
~~~
|
|
257
|
+
|
|
258
|
+
Rules:
|
|
259
|
+
|
|
260
|
+
1. Claim/lease before side effects.
|
|
261
|
+
2. Refresh lease only while deterministic work is actually running.
|
|
262
|
+
3. Lease expiry permits another worker to retry after a crash.
|
|
263
|
+
4. Side-effecting providers receive an idempotency key when supported.
|
|
264
|
+
5. Result publication is compare-and-swap / generation based.
|
|
265
|
+
6. Duplicate delivery must not duplicate artifacts, embeddings, deployments, or child runs.
|
|
266
|
+
|
|
267
|
+
## 9. Knowledge must become an execution advantage
|
|
268
|
+
|
|
269
|
+
The knowledge work already proves incremental indexing and retained generations, but its payoff is too separate from the normal AgentSam run.
|
|
270
|
+
|
|
271
|
+
Desired loop:
|
|
272
|
+
|
|
273
|
+
~~~text
|
|
274
|
+
repository changed
|
|
275
|
+
|
|
|
276
|
+
v
|
|
277
|
+
cheap Merkle diff
|
|
278
|
+
|
|
|
279
|
+
+---- no relevant change ------> reuse existing generation
|
|
280
|
+
|
|
|
281
|
+
v
|
|
282
|
+
index changed material only
|
|
283
|
+
|
|
|
284
|
+
v
|
|
285
|
+
structural + lexical knowledge
|
|
286
|
+
|
|
|
287
|
+
optional semantic lane
|
|
288
|
+
|
|
|
289
|
+
v
|
|
290
|
+
publish immutable generation
|
|
291
|
+
|
|
|
292
|
+
v
|
|
293
|
+
run retrieval
|
|
294
|
+
|
|
|
295
|
+
v
|
|
296
|
+
smaller / better model context
|
|
297
|
+
|
|
|
298
|
+
v
|
|
299
|
+
run creates new verified evidence
|
|
300
|
+
|
|
|
301
|
+
v
|
|
302
|
+
incremental knowledge update
|
|
303
|
+
~~~
|
|
304
|
+
|
|
305
|
+
### 9.1 Retrieval before model calls
|
|
306
|
+
|
|
307
|
+
Before a model receives a repository task, run a bounded deterministic retrieval stage.
|
|
308
|
+
|
|
309
|
+
Input:
|
|
310
|
+
|
|
311
|
+
~~~text
|
|
312
|
+
task text
|
|
313
|
+
repository id
|
|
314
|
+
current revision / Merkle root
|
|
315
|
+
working paths if known
|
|
316
|
+
run/plan context
|
|
317
|
+
~~~
|
|
318
|
+
|
|
319
|
+
Retrieval order:
|
|
320
|
+
|
|
321
|
+
1. exact/path/symbol evidence;
|
|
322
|
+
2. WorkGraph/repository contracts/dependency evidence;
|
|
323
|
+
3. lexical chunks;
|
|
324
|
+
4. semantic retrieval only if configured and useful;
|
|
325
|
+
5. related repository/company routing only when intent requires it.
|
|
326
|
+
|
|
327
|
+
Return a bounded evidence packet with provenance.
|
|
328
|
+
|
|
329
|
+
This packet should feed lead agent, co-worker child runs, GOAP evaluators, package/deploy workflows, and browser/build flows.
|
|
330
|
+
|
|
331
|
+
### 9.2 Retrieval receipt
|
|
332
|
+
|
|
333
|
+
~~~ts
|
|
334
|
+
interface KnowledgeRetrievalReceipt {
|
|
335
|
+
repositoryId: string;
|
|
336
|
+
generationId: string;
|
|
337
|
+
merkleRoot?: string;
|
|
338
|
+
query: string;
|
|
339
|
+
lanes: string[];
|
|
340
|
+
candidates: number;
|
|
341
|
+
selected: number;
|
|
342
|
+
bytesInjected: number;
|
|
343
|
+
providerCallsAvoided?: number;
|
|
344
|
+
embeddingCalls: number;
|
|
345
|
+
cacheHits: number;
|
|
346
|
+
evidenceRefs: string[];
|
|
347
|
+
}
|
|
348
|
+
~~~
|
|
349
|
+
|
|
350
|
+
Do not claim token/cost savings unless measured. Start by measuring bytes/chunks/cache hits and whether the model needed fallback search.
|
|
351
|
+
|
|
352
|
+
### 9.3 Write-back after useful work
|
|
353
|
+
|
|
354
|
+
Do not embed every chat response.
|
|
355
|
+
|
|
356
|
+
Write back durable evidence when it has a useful source:
|
|
357
|
+
|
|
358
|
+
- changed files;
|
|
359
|
+
- verified build/test receipt;
|
|
360
|
+
- package contract;
|
|
361
|
+
- migration;
|
|
362
|
+
- deployment receipt;
|
|
363
|
+
- approved decision;
|
|
364
|
+
- generated artifact;
|
|
365
|
+
- code symbol/AST changes;
|
|
366
|
+
- user-authored durable project note.
|
|
367
|
+
|
|
368
|
+
Then queue incremental indexing.
|
|
369
|
+
|
|
370
|
+
## 10. AutoRAG role
|
|
371
|
+
|
|
372
|
+
@inneranimalmedia/agentsam-knowledge remains the portable knowledge orchestration/configuration layer, not a second indexer.
|
|
373
|
+
|
|
374
|
+
Current behavior is already pointed in the right direction:
|
|
375
|
+
|
|
376
|
+
- local SQLite by default;
|
|
377
|
+
- structural/lexical first;
|
|
378
|
+
- semantic opt-in;
|
|
379
|
+
- bounded probe;
|
|
380
|
+
- backend registry;
|
|
381
|
+
- provider registry;
|
|
382
|
+
- repository-specific lanes;
|
|
383
|
+
- no credentials in project config.
|
|
384
|
+
|
|
385
|
+
The next step is connecting it to run execution.
|
|
386
|
+
|
|
387
|
+
### 10.1 AutoRAG preflight
|
|
388
|
+
|
|
389
|
+
A run requiring repository knowledge asks:
|
|
390
|
+
|
|
391
|
+
~~~text
|
|
392
|
+
knowledge.resolve(repository, task)
|
|
393
|
+
~~~
|
|
394
|
+
|
|
395
|
+
Resolver checks:
|
|
396
|
+
|
|
397
|
+
1. active generation exists;
|
|
398
|
+
2. Merkle/profile freshness;
|
|
399
|
+
3. requested lane availability;
|
|
400
|
+
4. exact/structural retrieval sufficiency;
|
|
401
|
+
5. semantic retrieval configuration;
|
|
402
|
+
6. semantic index freshness;
|
|
403
|
+
7. run budget for paid semantic work.
|
|
404
|
+
|
|
405
|
+
Outcomes:
|
|
406
|
+
|
|
407
|
+
~~~text
|
|
408
|
+
READY
|
|
409
|
+
STALE_BUT_USABLE
|
|
410
|
+
INDEX_REQUIRED
|
|
411
|
+
SEMANTIC_OPTIONAL
|
|
412
|
+
SEMANTIC_REQUIRED
|
|
413
|
+
UNAVAILABLE
|
|
414
|
+
~~~
|
|
415
|
+
|
|
416
|
+
### 10.2 Indexing should not block an LLM
|
|
417
|
+
|
|
418
|
+
If INDEX_REQUIRED:
|
|
419
|
+
|
|
420
|
+
~~~text
|
|
421
|
+
parent run
|
|
422
|
+
|
|
|
423
|
+
+-- enqueue repository.index
|
|
424
|
+
|
|
|
425
|
+
+-- suspend(waiting_child)
|
|
426
|
+
~~~
|
|
427
|
+
|
|
428
|
+
Indexing operates without a model where possible.
|
|
429
|
+
|
|
430
|
+
On generation publication:
|
|
431
|
+
|
|
432
|
+
~~~text
|
|
433
|
+
repository.index completed
|
|
434
|
+
|
|
|
435
|
+
v
|
|
436
|
+
knowledge.generation.published event
|
|
437
|
+
|
|
|
438
|
+
v
|
|
439
|
+
wake parent run
|
|
440
|
+
|
|
|
441
|
+
v
|
|
442
|
+
retrieve
|
|
443
|
+
|
|
|
444
|
+
v
|
|
445
|
+
model reasoning resumes
|
|
446
|
+
~~~
|
|
447
|
+
|
|
448
|
+
### 10.3 Embeddings/vectorization
|
|
449
|
+
|
|
450
|
+
Embedding is its own queue because it has separate batching economics, rate limits, dimensions/model compatibility, and cache semantics.
|
|
451
|
+
|
|
452
|
+
Use content-addressed embedding cache keys:
|
|
453
|
+
|
|
454
|
+
~~~text
|
|
455
|
+
provider
|
|
456
|
+
model
|
|
457
|
+
dimensions
|
|
458
|
+
normalized_content_hash
|
|
459
|
+
profile/lane
|
|
460
|
+
~~~
|
|
461
|
+
|
|
462
|
+
No-change reruns should make zero embedding calls. Changed chunks enqueue only changed content.
|
|
463
|
+
|
|
464
|
+
Provider 429/5xx becomes delayed exponential retry. The parent indexing generation does not need an LLM waiting for that retry.
|
|
465
|
+
|
|
466
|
+
## 11. Cloudflare AutoRAG integration
|
|
467
|
+
|
|
468
|
+
Cloudflare AutoRAG can be one backend/provider integration, not the universal knowledge architecture.
|
|
469
|
+
|
|
470
|
+
Use it when a project deliberately chooses a managed R2/Vectorize pipeline.
|
|
471
|
+
|
|
472
|
+
Portable AgentSam still owns repository identity, run identity, evidence/provenance, freshness expectations, routing, receipts, and fallbacks.
|
|
473
|
+
|
|
474
|
+
Cloudflare AutoRAG may own managed document sync, chunking/index maintenance, embeddings, Vectorize storage, and retrieval/query execution.
|
|
475
|
+
|
|
476
|
+
## 12. Cost-aware reasoning lifecycle
|
|
477
|
+
|
|
478
|
+
~~~text
|
|
479
|
+
RECEIVE
|
|
480
|
+
|
|
|
481
|
+
v
|
|
482
|
+
DETERMINISTIC PREP
|
|
483
|
+
inspect state
|
|
484
|
+
retrieve knowledge
|
|
485
|
+
resolve capabilities
|
|
486
|
+
calculate plan evidence
|
|
487
|
+
|
|
|
488
|
+
v
|
|
489
|
+
MODEL REASON
|
|
490
|
+
only if a decision/generation is needed
|
|
491
|
+
|
|
|
492
|
+
v
|
|
493
|
+
DISPATCH
|
|
494
|
+
tools / child runs / queue jobs
|
|
495
|
+
|
|
|
496
|
+
v
|
|
497
|
+
YIELD
|
|
498
|
+
persist checkpoint + wake condition
|
|
499
|
+
model turn ends
|
|
500
|
+
|
|
|
501
|
+
v
|
|
502
|
+
WAIT FOR EVENT
|
|
503
|
+
zero model tokens
|
|
504
|
+
|
|
|
505
|
+
v
|
|
506
|
+
RESUME
|
|
507
|
+
deterministic state refresh
|
|
508
|
+
bounded retrieval
|
|
509
|
+
model only if a new decision is needed
|
|
510
|
+
~~~
|
|
511
|
+
|
|
512
|
+
A completion event should not automatically trigger another model call. If deterministic machinery can continue the plan safely, continue deterministically.
|
|
513
|
+
|
|
514
|
+
## 13. GOAP / WorkGraph relationship
|
|
515
|
+
|
|
516
|
+
GOAP actions should support explicit wait semantics.
|
|
517
|
+
|
|
518
|
+
~~~ts
|
|
519
|
+
{
|
|
520
|
+
id: "repository.index",
|
|
521
|
+
cost: 2,
|
|
522
|
+
effects: ["knowledge.index.fresh"],
|
|
523
|
+
execution: "queue",
|
|
524
|
+
waitFor: "knowledge.generation.published"
|
|
525
|
+
}
|
|
526
|
+
~~~
|
|
527
|
+
|
|
528
|
+
The planner is not kept resident while the action runs.
|
|
529
|
+
|
|
530
|
+
WorkGraph records dependencies. Queue Control dispatches only runnable nodes.
|
|
531
|
+
|
|
532
|
+
## 14. Child agents / co-workers
|
|
533
|
+
|
|
534
|
+
Child agents use the same mechanics.
|
|
535
|
+
|
|
536
|
+
~~~text
|
|
537
|
+
lead run
|
|
538
|
+
|
|
|
539
|
+
+-- child run: research
|
|
540
|
+
+-- child run: verify
|
|
541
|
+
|
|
|
542
|
+
+-- lead may continue independent work
|
|
543
|
+
|
|
|
544
|
+
+-- if blocked on children -> waiting_child
|
|
545
|
+
~~~
|
|
546
|
+
|
|
547
|
+
Completion emits events; no lead-model polling.
|
|
548
|
+
|
|
549
|
+
Local Studio can subscribe to each child run's agentsam.activity.v1 projection and drive the scene/status/progress already built.
|
|
550
|
+
|
|
551
|
+
## 15. Progress
|
|
552
|
+
|
|
553
|
+
Metric points come from plan/run state, not elapsed time.
|
|
554
|
+
|
|
555
|
+
~~~text
|
|
556
|
+
completed known points / total known points
|
|
557
|
+
~~~
|
|
558
|
+
|
|
559
|
+
Sources include WorkGraph node weights, GOAP action costs, known verification gates, queue job steps, and provider-reported progress.
|
|
560
|
+
|
|
561
|
+
Expose basis = plan-points | phase-points | steps | provider | unknown.
|
|
562
|
+
|
|
563
|
+
## 16. CLI product surface
|
|
564
|
+
|
|
565
|
+
Initial generic run family:
|
|
566
|
+
|
|
567
|
+
~~~text
|
|
568
|
+
agentsam run start
|
|
569
|
+
agentsam run get <id>
|
|
570
|
+
agentsam run watch <id>
|
|
571
|
+
agentsam run tree <id>
|
|
572
|
+
agentsam run cancel <id>
|
|
573
|
+
agentsam run events <id>
|
|
574
|
+
agentsam run artifacts <id>
|
|
575
|
+
agentsam run receipt <id>
|
|
576
|
+
~~~
|
|
577
|
+
|
|
578
|
+
Knowledge payoff surface:
|
|
579
|
+
|
|
580
|
+
~~~text
|
|
581
|
+
agentsam knowledge status
|
|
582
|
+
agentsam knowledge freshness
|
|
583
|
+
agentsam knowledge retrieval "<question>"
|
|
584
|
+
agentsam knowledge generations
|
|
585
|
+
agentsam knowledge receipt <run-id>
|
|
586
|
+
~~~
|
|
587
|
+
|
|
588
|
+
Existing commands such as index, autorag, go, package, and machine stay as friendly domain commands and may compile into the same run machinery.
|
|
589
|
+
|
|
590
|
+
run watch is a client-side event observer. It never keeps a model active.
|
|
591
|
+
|
|
592
|
+
## 17. Hosted AgentSam endpoints
|
|
593
|
+
|
|
594
|
+
A hosted implementation may expose:
|
|
595
|
+
|
|
596
|
+
~~~text
|
|
597
|
+
POST /v1/runs
|
|
598
|
+
GET /v1/runs/:id
|
|
599
|
+
POST /v1/runs/:id/cancel
|
|
600
|
+
|
|
601
|
+
POST /v1/runs/:id/spawn
|
|
602
|
+
GET /v1/runs/:id/children
|
|
603
|
+
|
|
604
|
+
POST /v1/runs/:id/handoff
|
|
605
|
+
POST /v1/runs/:id/approve
|
|
606
|
+
|
|
607
|
+
GET /v1/runs/:id/events
|
|
608
|
+
GET /v1/runs/:id/artifacts
|
|
609
|
+
GET /v1/runs/:id/receipt
|
|
610
|
+
~~~
|
|
611
|
+
|
|
612
|
+
These routes adapt the portable control contract; they do not define AgentSam itself.
|
|
613
|
+
|
|
614
|
+
## 18. Storage additions
|
|
615
|
+
|
|
616
|
+
Prefer extending current run authority rather than creating duplicate state.
|
|
617
|
+
|
|
618
|
+
### Run suspension
|
|
619
|
+
|
|
620
|
+
~~~text
|
|
621
|
+
run_id
|
|
622
|
+
state
|
|
623
|
+
reason
|
|
624
|
+
wake_at
|
|
625
|
+
wake_event
|
|
626
|
+
resume_step_id
|
|
627
|
+
checkpoint_ref
|
|
628
|
+
expires_at
|
|
629
|
+
attempt
|
|
630
|
+
metadata_json
|
|
631
|
+
~~~
|
|
632
|
+
|
|
633
|
+
### Run event journal
|
|
634
|
+
|
|
635
|
+
Append-only:
|
|
636
|
+
|
|
637
|
+
~~~text
|
|
638
|
+
event_id
|
|
639
|
+
run_id
|
|
640
|
+
parent_run_id
|
|
641
|
+
seq
|
|
642
|
+
event_type
|
|
643
|
+
phase
|
|
644
|
+
label
|
|
645
|
+
detail
|
|
646
|
+
progress_current
|
|
647
|
+
progress_total
|
|
648
|
+
source_kind
|
|
649
|
+
source_name
|
|
650
|
+
evidence_json
|
|
651
|
+
created_at
|
|
652
|
+
~~~
|
|
653
|
+
|
|
654
|
+
This journal can project to agentsam.activity.v1.
|
|
655
|
+
|
|
656
|
+
### Dependency edge
|
|
657
|
+
|
|
658
|
+
Use WorkGraph authority if it already owns the relation; otherwise minimally:
|
|
659
|
+
|
|
660
|
+
~~~text
|
|
661
|
+
parent_run_id
|
|
662
|
+
child_run_id
|
|
663
|
+
relationship
|
|
664
|
+
required
|
|
665
|
+
status
|
|
666
|
+
~~~
|
|
667
|
+
|
|
668
|
+
## 19. Retry classes
|
|
669
|
+
|
|
670
|
+
~~~text
|
|
671
|
+
TRANSIENT
|
|
672
|
+
network timeout
|
|
673
|
+
429
|
|
674
|
+
provider 5xx
|
|
675
|
+
temporary runtime unavailable
|
|
676
|
+
|
|
677
|
+
WAIT
|
|
678
|
+
approval
|
|
679
|
+
user input
|
|
680
|
+
external job pending
|
|
681
|
+
|
|
682
|
+
REPLAN
|
|
683
|
+
deterministic precondition failure
|
|
684
|
+
changed repository state
|
|
685
|
+
unavailable capability with alternate lane
|
|
686
|
+
|
|
687
|
+
TERMINAL
|
|
688
|
+
invalid request
|
|
689
|
+
permission denied
|
|
690
|
+
unsupported contract
|
|
691
|
+
explicit policy denial
|
|
692
|
+
~~~
|
|
693
|
+
|
|
694
|
+
Only transient failures enter automatic exponential retry.
|
|
695
|
+
|
|
696
|
+
## 20. Circuit breakers and budgets
|
|
697
|
+
|
|
698
|
+
Per provider/tool maintain cheap health state: closed, open, half_open.
|
|
699
|
+
|
|
700
|
+
If repeated failures open the circuit, stop hammering the provider; reroute when allowed or suspend/fail explicitly.
|
|
701
|
+
|
|
702
|
+
Run budgets should support:
|
|
703
|
+
|
|
704
|
+
~~~text
|
|
705
|
+
max_model_calls
|
|
706
|
+
max_tool_calls
|
|
707
|
+
max_cost
|
|
708
|
+
deadline
|
|
709
|
+
max_child_runs
|
|
710
|
+
max_parallel_children
|
|
711
|
+
max_embedding_calls
|
|
712
|
+
~~~
|
|
713
|
+
|
|
714
|
+
## 21. Observability / payoff metrics
|
|
715
|
+
|
|
716
|
+
### Waiting efficiency
|
|
717
|
+
|
|
718
|
+
- model-active milliseconds;
|
|
719
|
+
- suspended milliseconds;
|
|
720
|
+
- deterministic wakeups;
|
|
721
|
+
- poller jobs;
|
|
722
|
+
- model polls avoided.
|
|
723
|
+
|
|
724
|
+
### Knowledge efficiency
|
|
725
|
+
|
|
726
|
+
- retrieval generation;
|
|
727
|
+
- retrieval cache hits;
|
|
728
|
+
- chunks selected;
|
|
729
|
+
- bytes injected;
|
|
730
|
+
- lexical/structural/semantic lane usage;
|
|
731
|
+
- embedding cache hits;
|
|
732
|
+
- embedding calls;
|
|
733
|
+
- incremental files/chunks changed;
|
|
734
|
+
- fallback repository searches after retrieval.
|
|
735
|
+
|
|
736
|
+
### Queue efficiency
|
|
737
|
+
|
|
738
|
+
- queue wait time;
|
|
739
|
+
- processing time;
|
|
740
|
+
- attempts;
|
|
741
|
+
- delayed retries;
|
|
742
|
+
- DLQ count;
|
|
743
|
+
- concurrency/backlog.
|
|
744
|
+
|
|
745
|
+
### Agent effectiveness
|
|
746
|
+
|
|
747
|
+
- parent/child run tree;
|
|
748
|
+
- plan-point progress;
|
|
749
|
+
- tool receipts;
|
|
750
|
+
- artifacts;
|
|
751
|
+
- verification results;
|
|
752
|
+
- recovery/replan count.
|
|
753
|
+
|
|
754
|
+
Measure these before claiming dollar/token savings.
|
|
755
|
+
|
|
756
|
+
## 22. Implementation slices
|
|
757
|
+
|
|
758
|
+
### Slice A - portable suspension + activity authority
|
|
759
|
+
|
|
760
|
+
1. Expand portable AgentRun contract to align with real agentsam_agent_run.
|
|
761
|
+
2. Add wait/suspension types.
|
|
762
|
+
3. Add canonical run-event-to-agentsam.activity.v1 projection.
|
|
763
|
+
4. Add retry classification.
|
|
764
|
+
5. Test suspend/resume, timeout, cancel, duplicate wake.
|
|
765
|
+
|
|
766
|
+
### Slice B - Queue Control wake machinery
|
|
767
|
+
|
|
768
|
+
1. Add availableAt / delayed retry to queue envelope.
|
|
769
|
+
2. Add idempotency + lease semantics.
|
|
770
|
+
3. Add retry/backoff/jitter helper.
|
|
771
|
+
4. Add DLQ contract.
|
|
772
|
+
5. Implement local SQLite adapter first.
|
|
773
|
+
6. Implement Cloudflare adapter with message delay/retry delay.
|
|
774
|
+
|
|
775
|
+
### Slice C - generic run CLI
|
|
776
|
+
|
|
777
|
+
1. agentsam run start/get/watch/tree/cancel/events/receipt.
|
|
778
|
+
2. Local adapter first.
|
|
779
|
+
3. Hosted adapter second.
|
|
780
|
+
4. Watch consumes events; it never invokes a model.
|
|
781
|
+
|
|
782
|
+
### Slice D - knowledge payoff
|
|
783
|
+
|
|
784
|
+
1. knowledge.resolve pre-model retrieval boundary.
|
|
785
|
+
2. Attach retrieval receipt to run.
|
|
786
|
+
3. repository.index becomes resumable queue work.
|
|
787
|
+
4. generation-published event wakes blocked runs.
|
|
788
|
+
5. Queue changed chunks for embeddings.
|
|
789
|
+
6. Add incremental post-run indexing trigger for verified file changes.
|
|
790
|
+
|
|
791
|
+
### Slice E - child-run orchestration
|
|
792
|
+
|
|
793
|
+
1. spawn/children/handoff semantics.
|
|
794
|
+
2. waiting-child suspension.
|
|
795
|
+
3. Local Studio lead/co-worker subscribe to real run ids.
|
|
796
|
+
4. Parent run resumes from child completion event.
|
|
797
|
+
|
|
798
|
+
### Slice F - hosted AgentSam
|
|
799
|
+
|
|
800
|
+
1. Implement run routes in hosted Go adapter.
|
|
801
|
+
2. Persist/run through same contracts.
|
|
802
|
+
3. Map runtime execution to agentsam.runtime.v1.
|
|
803
|
+
4. Keep MCP as tool plane.
|
|
804
|
+
5. Add webhook/event wake endpoints where required.
|
|
805
|
+
|
|
806
|
+
## 23. Acceptance criteria
|
|
807
|
+
|
|
808
|
+
1. A run waiting 10 minutes for an external operation spends zero model tokens during the wait.
|
|
809
|
+
2. A provider that only supports polling is watched by deterministic backoff jobs, not an LLM.
|
|
810
|
+
3. A child agent can run independently and wake its parent on completion.
|
|
811
|
+
4. A repository index can rebuild incrementally without a model being active.
|
|
812
|
+
5. A no-change index rerun makes zero new embedding calls.
|
|
813
|
+
6. Changed-file indexing embeds only new/changed content where semantic indexing is enabled.
|
|
814
|
+
7. A normal repository task retrieves knowledge before model reasoning and records a retrieval receipt.
|
|
815
|
+
8. CLI and Local Studio can observe the same run/event stream.
|
|
816
|
+
9. Local, hosted, remote and sandbox execution use the same portable run contract.
|
|
817
|
+
10. Retry exhaustion ends in explicit failure/DLQ/receipt, never an infinite loop.
|
|
818
|
+
11. Progress is derived from real plan/step/provider points, not timer animation.
|
|
819
|
+
12. The user can inspect whether knowledge/indexing reduced repeated repository discovery work.
|
|
820
|
+
|
|
821
|
+
## 24. Immediate tickets
|
|
822
|
+
|
|
823
|
+
Implementation checkpoint (2026-10-03): ACP-001 through ACP-007 are implemented on `feat/agent-control-plane`. Portable contracts own the richer run/suspension/wake/event semantics; runtime migration `0006_agent_run_suspend_activity.sql` persists suspension and the append-only journal without rebuilding the legacy `agentsam_agent_run.status` check. Queue Control owns delayed availability, retry/backoff/jitter, stable idempotency identity, lease claim/refresh/release, provider-independent dead-letter jobs, and provider-managed DLQ delegation. Runtime migration `0007_queue_control.sql` plus the SQLite adapter provide the durable local scheduler reference implementation; Cloudflare Queues remains one hosted adapter rather than the control-plane authority.
|
|
824
|
+
|
|
825
|
+
AgentSam Hooks integration checkpoint: ACP does not create a parallel hook mechanism. agent.run execution reuses the existing portable subagent_start / subagent_stop lifecycle contract through runWithSubagentHooks. Hook callbacks remain lifecycle policy/observability; the run journal, Queue Control, WorkGraph linkage, and receipts remain authoritative. This placement is intentionally at execution time rather than child-record creation time, so queued work does not look started before a provider/runtime actually claims it. Runtime selection now hard-filters candidates through agentsam.runtime.v1 capabilities and explicit constraints; provider/substrate preference is caller-supplied rather than a Cloudflare-specific hidden score.
|
|
826
|
+
|
|
827
|
+
ACP host note: `agentsam run` now defaults to project-local SQLite and can target any HTTP-compatible Agent Control Plane via `AGENTSAM_CONTROL_PLANE_URL` / `--url`; no Cloudflare, GCP, AWS, Fly, Docker, VM, or local runtime provider is encoded into run semantics. Hosted implementations must conform to the same `/v1/runs/:id` control contract.
|
|
828
|
+
|
|
829
|
+
Workbench audit note: `@inneranimalmedia/agentsam-workbench` already owns the portable thread + persistent composer surface (`AgentConversationSurface`), and its lead/co-worker/legacy composition tests pass. Do not create a second composer primitive in Local Studio; any remaining disappearing-lead-composer bug should be treated as Local Studio viewport/composition behavior unless a new portable invariant is proven missing.
|
|
830
|
+
|
|
831
|
+
~~~text
|
|
832
|
+
ACP-001 DONE Promote agentsam_agent_run fields into portable AgentRun contract
|
|
833
|
+
ACP-002 DONE Define AgentRunSuspension + wake conditions
|
|
834
|
+
ACP-003 DONE Define append-only run event journal and activity projection
|
|
835
|
+
ACP-004 DONE Add queue availableAt/backoff/jitter/idempotency/lease contract
|
|
836
|
+
ACP-005 DONE Implement local SQLite delayed-work scheduler
|
|
837
|
+
ACP-006 DONE Implement provider queue delay/retry/DLQ adapters (Cloudflare first)
|
|
838
|
+
ACP-007 DONE Add agentsam run get/watch/tree/cancel/events/receipt
|
|
839
|
+
|
|
840
|
+
KNOW-001 Add knowledge.resolve pre-model retrieval boundary
|
|
841
|
+
KNOW-002 Attach KnowledgeRetrievalReceipt to runs
|
|
842
|
+
KNOW-003 Route repository.index through Queue Control
|
|
843
|
+
KNOW-004 Emit knowledge.generation.published and wake dependents
|
|
844
|
+
KNOW-005 Queue incremental embeddings/vectorization by content hash
|
|
845
|
+
KNOW-006 Add verified-change post-run incremental indexing hook
|
|
846
|
+
|
|
847
|
+
MULTI-001 DONE Bind child runs to parent_run_id + WorkGraph dependency
|
|
848
|
+
MULTI-002 DONE Resume parent from child completion without polling
|
|
849
|
+
HOOK-001 DONE Reuse agentsam-hooks subagent_start/subagent_stop at agent.run execution boundary
|
|
850
|
+
RUNTIME-001 DONE Match agent.run runtime requirements against agentsam.runtime.v1 without provider lock-in
|
|
851
|
+
HTTP-001 DONE Define provider-neutral Fetch-compatible /v1/runs host contract
|
|
852
|
+
|
|
853
|
+
UI-001 Bind Local Studio lead/co-worker panels to actual run ids/activity
|
|
854
|
+
OBS-001 Record waiting/model-active/retrieval/queue effectiveness metrics
|
|
855
|
+
~~~
|
|
856
|
+
|
|
857
|
+
## 25. Non-goals
|
|
858
|
+
|
|
859
|
+
This lane does not require:
|
|
860
|
+
|
|
861
|
+
- forcing all AgentSam work through Cloudflare;
|
|
862
|
+
- making agentsam-go-worker the only control plane;
|
|
863
|
+
- keeping an LLM process resident during background work;
|
|
864
|
+
- embedding every repository or chat turn;
|
|
865
|
+
- replacing structural/lexical retrieval with vectors;
|
|
866
|
+
- one giant company-wide vector collection;
|
|
867
|
+
- a new Durable Object architecture for every wait;
|
|
868
|
+
- duplicating Queue Control, WorkGraph, GOAP, AutoRAG, or runtime protocol.
|
|
869
|
+
|
|
870
|
+
The objective is to connect the machinery that already exists into a durable, cheap, observable harness.
|