@inneranimalmedia/agentsam-sdk 2.6.10 → 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 +3 -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 +2 -2
- package/apps/client-cms-editor/frontend/package.json +3 -3
- 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 +1 -1
- 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/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/src/main.tsx +227 -110
- package/migrations/d1/0020_agentsam_receipt_catalog.sql +35 -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 +26 -11
- package/packages/agentsam-brand/README.md +3 -0
- package/packages/agentsam-brand/package.json +2 -2
- 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/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 +1 -1
- package/packages/agentsam-goap/README.md +3 -0
- package/packages/agentsam-goap/package.json +2 -2
- package/packages/agentsam-hooks/package.json +2 -2
- package/packages/agentsam-hooks/src/adapters/agents.js +48 -22
- package/packages/agentsam-hooks/src/index.d.ts +16 -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/browser.global.js +71 -34
- package/packages/agentsam-nav/dist/browser.js +3179 -781
- package/packages/agentsam-nav/dist/index.js +3171 -773
- 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 +13 -3
- 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 +1 -1
- 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 +1 -1
- package/packages/theme-companions-site/package.json +1 -1
- package/packages/theme-floors-site/package.json +1 -1
- package/packages/theme-fuelnfree-site/package.json +1 -1
- package/packages/theme-handyman-site/package.json +1 -1
- package/packages/theme-insurance-site/package.json +1 -1
- package/packages/theme-scenes/package.json +1 -1
- package/packages/theme-shinshu-site/package.json +1 -1
- package/packages/work-graph/package.json +1 -1
- package/protocol/models/README.md +3 -0
- package/protocol/receipts/agentsam.receipt.v1.json +95 -0
- package/protocol/theme-refinery/receipts/products-registry-batch-20260924.json +6 -6
- package/protocol/theme-refinery/receipts/theme-harvest-20260924.json +6 -6
- 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/cli/command-catalog.js +3 -0
- package/src/cli.js +24 -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/merch.js +5 -0
- package/src/commands/mini.js +1 -1
- package/src/commands/receipts.js +140 -0
- package/src/commands/run.js +253 -0
- 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/indexing/ingest/inventory.js +1 -1
- package/src/lib/deploy/local-studio.js +2 -2
- package/src/lib/mini/scaffold.js +1 -1
- package/src/lib/whoami-capabilities.js +1 -1
- package/src/local/runtime-store.js +8 -0
- package/src/mcp/cloudflare-bundles.js +1 -1
- package/src/plugins/index.js +1 -0
- package/src/plugins/registry.js +59 -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/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/agentsam-repository/src/goap.js.bak-20260922011251 +0 -670
- /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,132 @@
|
|
|
1
|
+
// src/run.ts
|
|
2
|
+
var WAIT_CODES = /* @__PURE__ */ new Set([
|
|
3
|
+
"approval_required",
|
|
4
|
+
"input_required",
|
|
5
|
+
"external_pending",
|
|
6
|
+
"dependency_pending"
|
|
7
|
+
]);
|
|
8
|
+
var REPLAN_CODES = /* @__PURE__ */ new Set([
|
|
9
|
+
"precondition_failed",
|
|
10
|
+
"repository_changed",
|
|
11
|
+
"capability_unavailable"
|
|
12
|
+
]);
|
|
13
|
+
var TRANSIENT_CODES = /* @__PURE__ */ new Set([
|
|
14
|
+
"timeout",
|
|
15
|
+
"request_timeout",
|
|
16
|
+
"rate_limited",
|
|
17
|
+
"provider_unavailable",
|
|
18
|
+
"runtime_unavailable",
|
|
19
|
+
"econnreset",
|
|
20
|
+
"econnrefused",
|
|
21
|
+
"etimedout",
|
|
22
|
+
"eai_again"
|
|
23
|
+
]);
|
|
24
|
+
function classifyAgentRunRetry(input = {}) {
|
|
25
|
+
const code = String(input.code || "").trim().toLowerCase();
|
|
26
|
+
const statusCode = Number(input.statusCode);
|
|
27
|
+
if (input.retryable === true) {
|
|
28
|
+
return { class: "transient", automaticRetry: true, reason: code || "explicit_retryable" };
|
|
29
|
+
}
|
|
30
|
+
if (input.retryable === false) {
|
|
31
|
+
return { class: "terminal", automaticRetry: false, reason: code || "explicit_non_retryable" };
|
|
32
|
+
}
|
|
33
|
+
if (WAIT_CODES.has(code)) {
|
|
34
|
+
return { class: "wait", automaticRetry: false, reason: code };
|
|
35
|
+
}
|
|
36
|
+
if (REPLAN_CODES.has(code)) {
|
|
37
|
+
return { class: "replan", automaticRetry: false, reason: code };
|
|
38
|
+
}
|
|
39
|
+
if (TRANSIENT_CODES.has(code) || [408, 425, 429, 500, 502, 503, 504].includes(statusCode)) {
|
|
40
|
+
return { class: "transient", automaticRetry: true, reason: code || `http_${statusCode}` };
|
|
41
|
+
}
|
|
42
|
+
return { class: "terminal", automaticRetry: false, reason: code || "unclassified_failure" };
|
|
43
|
+
}
|
|
44
|
+
function evaluateAgentRunWake(suspension, wake, options = {}) {
|
|
45
|
+
const consumed = new Set(options.consumedDedupeKeys || []);
|
|
46
|
+
if (consumed.has(wake.dedupeKey)) return { accepted: false, reason: "duplicate" };
|
|
47
|
+
if (suspension.runId !== wake.runId) return { accepted: false, reason: "run_mismatch" };
|
|
48
|
+
const now = options.now ?? wake.occurredAt;
|
|
49
|
+
if (suspension.expiresAt != null && now > suspension.expiresAt) {
|
|
50
|
+
return { accepted: false, reason: "expired" };
|
|
51
|
+
}
|
|
52
|
+
const matched = wake.kind === "manual" || Boolean(suspension.wakeEvent && wake.eventKey === suspension.wakeEvent) || Boolean(
|
|
53
|
+
wake.kind === "dependency" && wake.dependencyRunId && (suspension.dependencyRunIds || []).includes(wake.dependencyRunId)
|
|
54
|
+
) || Boolean(wake.kind === "scheduled" && suspension.wakeAt != null && now >= suspension.wakeAt);
|
|
55
|
+
return matched ? { accepted: true, reason: "accepted", nextStatus: "queued" } : { accepted: false, reason: "condition_not_met" };
|
|
56
|
+
}
|
|
57
|
+
function wakeMatchesSuspension(suspension, wake, now = wake.occurredAt) {
|
|
58
|
+
return evaluateAgentRunWake(suspension, wake, { now }).accepted;
|
|
59
|
+
}
|
|
60
|
+
function transitionAgentRunStatus(status, action) {
|
|
61
|
+
if (status === "completed" || status === "failed" || status === "cancelled" || status === "timed_out") {
|
|
62
|
+
return status;
|
|
63
|
+
}
|
|
64
|
+
if (action.type === "cancel") return "cancelled";
|
|
65
|
+
if (action.type === "timeout") return "timed_out";
|
|
66
|
+
if (action.type === "complete") return "completed";
|
|
67
|
+
if (action.type === "fail") return "failed";
|
|
68
|
+
if (action.type === "suspend") return action.status;
|
|
69
|
+
if (action.type === "wake") return "queued";
|
|
70
|
+
if (action.type === "start") return "running";
|
|
71
|
+
return status;
|
|
72
|
+
}
|
|
73
|
+
function phaseForRunEvent(event) {
|
|
74
|
+
if (event.phase) return event.phase;
|
|
75
|
+
if (event.eventType === "run.created" || event.eventType === "run.queued" || event.eventType === "run.started") return "boot";
|
|
76
|
+
if (event.eventType === "run.suspended") return "waiting";
|
|
77
|
+
if (event.eventType === "run.woken" || event.eventType === "run.cancel_requested") return "recover";
|
|
78
|
+
if (event.eventType === "verification.completed") return "verify";
|
|
79
|
+
if (event.eventType === "run.completed" || event.eventType === "run.cancelled" || event.eventType === "run.timed_out") return "complete";
|
|
80
|
+
if (event.eventType === "run.failed") return "complete";
|
|
81
|
+
return "execute";
|
|
82
|
+
}
|
|
83
|
+
function activityTypeForRunEvent(event) {
|
|
84
|
+
if (event.eventType === "run.started") return "run.started";
|
|
85
|
+
if (event.eventType === "run.completed") return "run.completed";
|
|
86
|
+
if (event.eventType === "run.failed" || event.eventType === "run.timed_out") return "run.failed";
|
|
87
|
+
if (event.eventType === "run.cancelled" || event.eventType === "run.suspended" || event.eventType === "run.woken" || event.eventType === "run.status" || event.eventType === "run.cancel_requested" || event.eventType === "run.created" || event.eventType === "run.queued") return "phase.changed";
|
|
88
|
+
if (event.eventType === "step.started") return "step.started";
|
|
89
|
+
if (event.eventType === "step.completed") return "step.completed";
|
|
90
|
+
if (event.eventType === "decision.made") return "decision.made";
|
|
91
|
+
if (event.eventType === "tool.started") return "tool.started";
|
|
92
|
+
if (event.eventType === "tool.completed") return "tool.completed";
|
|
93
|
+
if (event.eventType === "artifact.created") return "artifact.created";
|
|
94
|
+
if (event.eventType === "file.changed") return "file.changed";
|
|
95
|
+
if (event.eventType === "approval.required") return "approval.required";
|
|
96
|
+
if (event.eventType === "input.required") return "input.required";
|
|
97
|
+
if (event.eventType === "verification.completed") return "verification.completed";
|
|
98
|
+
return "step.progress";
|
|
99
|
+
}
|
|
100
|
+
function projectRunEventToActivity(event) {
|
|
101
|
+
const evidence = {
|
|
102
|
+
...event.evidence || {},
|
|
103
|
+
run_event_id: event.id,
|
|
104
|
+
run_event_type: event.eventType,
|
|
105
|
+
...event.status ? { run_status: event.status } : {}
|
|
106
|
+
};
|
|
107
|
+
return {
|
|
108
|
+
schema: "agentsam.activity.v1",
|
|
109
|
+
run_id: event.runId,
|
|
110
|
+
seq: event.seq,
|
|
111
|
+
timestamp: new Date(event.createdAt).toISOString(),
|
|
112
|
+
phase: phaseForRunEvent(event),
|
|
113
|
+
event: activityTypeForRunEvent(event),
|
|
114
|
+
step_id: event.stepId ?? null,
|
|
115
|
+
parent_id: event.parentRunId ?? null,
|
|
116
|
+
label: event.label || "",
|
|
117
|
+
detail: event.detail ?? null,
|
|
118
|
+
progress: event.progress ?? null,
|
|
119
|
+
source: {
|
|
120
|
+
kind: event.source?.kind || "sam",
|
|
121
|
+
name: event.source?.name ?? null
|
|
122
|
+
},
|
|
123
|
+
evidence
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
export {
|
|
127
|
+
classifyAgentRunRetry,
|
|
128
|
+
evaluateAgentRunWake,
|
|
129
|
+
projectRunEventToActivity,
|
|
130
|
+
transitionAgentRunStatus,
|
|
131
|
+
wakeMatchesSuspension
|
|
132
|
+
};
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import type { AgentAuthorityRequirement } from './authority';
|
|
2
|
+
export interface AgentCapability {
|
|
3
|
+
id: string;
|
|
4
|
+
label?: string;
|
|
5
|
+
description?: string;
|
|
6
|
+
enabled?: boolean;
|
|
7
|
+
metadata?: Record<string, unknown>;
|
|
8
|
+
}
|
|
9
|
+
export type AgentJsonSchema = Record<string, unknown>;
|
|
10
|
+
export type AgentToolSideEffectLevel = 'none' | 'local_write' | 'external_write' | 'billable_external_write' | 'destructive_possible';
|
|
11
|
+
export type AgentToolRiskLevel = 'low' | 'moderate' | 'high' | 'critical';
|
|
12
|
+
export type AgentToolReceiptMode = 'full' | 'redacted' | 'metadata_only';
|
|
13
|
+
export type AgentToolIdempotencyMode = 'not_applicable' | 'intrinsic' | 'supported' | 'required';
|
|
14
|
+
export type AgentToolHandlerType = 'local' | 'http' | 'worker_rpc' | 'execos' | 'mcp' | 'custom';
|
|
15
|
+
export interface AgentToolHandlerReference {
|
|
16
|
+
type: AgentToolHandlerType;
|
|
17
|
+
ref: string;
|
|
18
|
+
metadata?: Record<string, unknown>;
|
|
19
|
+
}
|
|
20
|
+
export interface AgentToolRetryPolicy {
|
|
21
|
+
maxAttempts: number;
|
|
22
|
+
backoff?: 'none' | 'fixed' | 'exponential';
|
|
23
|
+
baseDelayMs?: number;
|
|
24
|
+
maxDelayMs?: number;
|
|
25
|
+
retryableReasons?: string[];
|
|
26
|
+
}
|
|
27
|
+
export interface AgentToolDefinition {
|
|
28
|
+
toolKey: string;
|
|
29
|
+
displayName: string;
|
|
30
|
+
description?: string;
|
|
31
|
+
provider?: string;
|
|
32
|
+
pluginId?: string;
|
|
33
|
+
capabilityKey: string;
|
|
34
|
+
handler?: AgentToolHandlerReference;
|
|
35
|
+
inputSchema: AgentJsonSchema;
|
|
36
|
+
outputSchema: AgentJsonSchema;
|
|
37
|
+
authority?: AgentAuthorityRequirement[];
|
|
38
|
+
riskLevel: AgentToolRiskLevel;
|
|
39
|
+
sideEffectLevel: AgentToolSideEffectLevel;
|
|
40
|
+
idempotencyMode: AgentToolIdempotencyMode;
|
|
41
|
+
timeoutMs?: number;
|
|
42
|
+
retryPolicy?: AgentToolRetryPolicy;
|
|
43
|
+
receiptMode?: AgentToolReceiptMode;
|
|
44
|
+
sensitiveInputPaths?: string[];
|
|
45
|
+
sensitiveOutputPaths?: string[];
|
|
46
|
+
emitsEvents?: string[];
|
|
47
|
+
active?: boolean;
|
|
48
|
+
metadata?: Record<string, unknown>;
|
|
49
|
+
}
|
|
50
|
+
export type AgentToolCallStatus = 'queued' | 'running' | 'retrying' | 'awaiting_input' | 'completed' | 'failed' | 'cancelled' | 'timed_out';
|
|
51
|
+
export interface AgentToolCall {
|
|
52
|
+
id: string;
|
|
53
|
+
runId?: string;
|
|
54
|
+
name: string;
|
|
55
|
+
toolKey?: string;
|
|
56
|
+
status: AgentToolCallStatus;
|
|
57
|
+
startedAt?: number;
|
|
58
|
+
completedAt?: number;
|
|
59
|
+
input?: unknown;
|
|
60
|
+
output?: unknown;
|
|
61
|
+
error?: string;
|
|
62
|
+
metadata?: Record<string, unknown>;
|
|
63
|
+
}
|
|
64
|
+
export type AgentToolPermissionDecision = 'allow_once' | 'allow_session' | 'deny';
|
|
65
|
+
export interface AgentToolPermissionDatum {
|
|
66
|
+
label: string;
|
|
67
|
+
value: string;
|
|
68
|
+
}
|
|
69
|
+
export interface AgentToolPermissionRequest {
|
|
70
|
+
id: string;
|
|
71
|
+
toolKey: string;
|
|
72
|
+
displayName: string;
|
|
73
|
+
provider?: string;
|
|
74
|
+
summary?: string;
|
|
75
|
+
scope?: string;
|
|
76
|
+
sharedData?: AgentToolPermissionDatum[];
|
|
77
|
+
riskLevel?: AgentToolRiskLevel;
|
|
78
|
+
sideEffectLevel?: AgentToolSideEffectLevel;
|
|
79
|
+
destructive?: boolean;
|
|
80
|
+
openWorld?: boolean;
|
|
81
|
+
metadata?: Record<string, unknown>;
|
|
82
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { AgentSamErrorEnvelope } from './errors';
|
|
2
|
+
export type AgentSamWidgetSize = 'small' | 'medium' | 'large';
|
|
3
|
+
export type AgentSamWidgetKind = 'countdown' | 'clock' | 'metric' | 'list' | 'launcher' | 'brand' | (string & {});
|
|
4
|
+
export interface AgentSamWidgetDataSource {
|
|
5
|
+
/** Existing route key, tool operation id, or host-owned projection id. */
|
|
6
|
+
source: string;
|
|
7
|
+
/** Host-defined refresh class, such as realtime, short, medium, or manual. */
|
|
8
|
+
refresh?: string;
|
|
9
|
+
}
|
|
10
|
+
export interface AgentSamWidgetDefinition {
|
|
11
|
+
id: string;
|
|
12
|
+
kind: AgentSamWidgetKind;
|
|
13
|
+
title: string;
|
|
14
|
+
description?: string;
|
|
15
|
+
icon?: string;
|
|
16
|
+
sizes: readonly AgentSamWidgetSize[];
|
|
17
|
+
data?: AgentSamWidgetDataSource;
|
|
18
|
+
/** Route key or host-resolved deep link. Do not put credentials or raw provider secrets here. */
|
|
19
|
+
deeplink?: string;
|
|
20
|
+
}
|
|
21
|
+
export interface AgentSamWidgetReadyState {
|
|
22
|
+
status: 'ready';
|
|
23
|
+
updated_at?: string;
|
|
24
|
+
}
|
|
25
|
+
export interface AgentSamWidgetStaleState {
|
|
26
|
+
status: 'stale';
|
|
27
|
+
updated_at: string;
|
|
28
|
+
error: AgentSamErrorEnvelope;
|
|
29
|
+
}
|
|
30
|
+
export interface AgentSamWidgetEmptyState {
|
|
31
|
+
status: 'empty';
|
|
32
|
+
updated_at?: string;
|
|
33
|
+
}
|
|
34
|
+
export interface AgentSamWidgetErrorState {
|
|
35
|
+
status: 'error';
|
|
36
|
+
error: AgentSamErrorEnvelope;
|
|
37
|
+
}
|
|
38
|
+
export type AgentSamWidgetState = AgentSamWidgetReadyState | AgentSamWidgetStaleState | AgentSamWidgetEmptyState | AgentSamWidgetErrorState;
|
|
File without changes
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inneranimalmedia/agentsam-contracts",
|
|
3
|
-
"version": "2.6.
|
|
3
|
+
"version": "2.6.11",
|
|
4
4
|
"description": "Framework-neutral AgentSam contracts for workbench, tools, providers, events, hooks, execution, identity and repository context.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -17,6 +17,10 @@
|
|
|
17
17
|
"types": "./dist/events.d.ts",
|
|
18
18
|
"import": "./dist/events.js"
|
|
19
19
|
},
|
|
20
|
+
"./run": {
|
|
21
|
+
"types": "./dist/run.d.ts",
|
|
22
|
+
"import": "./dist/run.js"
|
|
23
|
+
},
|
|
20
24
|
"./tools": {
|
|
21
25
|
"types": "./dist/tools.d.ts",
|
|
22
26
|
"import": "./dist/tools.js"
|
|
@@ -64,6 +68,10 @@
|
|
|
64
68
|
"./errors": {
|
|
65
69
|
"types": "./dist/errors.d.ts",
|
|
66
70
|
"import": "./dist/errors.js"
|
|
71
|
+
},
|
|
72
|
+
"./widgets": {
|
|
73
|
+
"types": "./dist/widgets.d.ts",
|
|
74
|
+
"import": "./dist/widgets.js"
|
|
67
75
|
}
|
|
68
76
|
},
|
|
69
77
|
"scripts": {
|
|
@@ -4,7 +4,7 @@ import { fileURLToPath } from 'node:url';
|
|
|
4
4
|
import { build } from 'esbuild';
|
|
5
5
|
|
|
6
6
|
const cwd = fileURLToPath(new URL('../', import.meta.url));
|
|
7
|
-
const modules = ['index','agent','events','tools','authority','execution','providers','hooks','artifacts','context','adapter','models','identity','repository','errors'];
|
|
7
|
+
const modules = ['index','agent','events','run','tools','authority','execution','providers','hooks','artifacts','context','adapter','models','identity','repository','errors','widgets'];
|
|
8
8
|
rmSync(`${cwd}/dist`, { recursive: true, force: true });
|
|
9
9
|
await build({
|
|
10
10
|
absWorkingDir: cwd,
|
|
@@ -22,14 +22,89 @@ export interface AgentInput {
|
|
|
22
22
|
capabilityIds?: string[];
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
export type
|
|
25
|
+
export type AgentRunMode = 'ask' | 'plan' | 'agent' | 'debug' | 'multitask';
|
|
26
|
+
|
|
27
|
+
export type AgentRunSelectedBy = 'manual' | 'automatic' | 'fallback';
|
|
28
|
+
|
|
29
|
+
export type AgentRunStatus =
|
|
30
|
+
| 'queued'
|
|
31
|
+
| 'running'
|
|
32
|
+
| 'paused'
|
|
33
|
+
| 'waiting_external'
|
|
34
|
+
| 'waiting_child'
|
|
35
|
+
| 'awaiting_input'
|
|
36
|
+
| 'awaiting_approval'
|
|
37
|
+
| 'sleeping'
|
|
38
|
+
| 'retry_scheduled'
|
|
39
|
+
| 'partial'
|
|
40
|
+
| 'completed'
|
|
41
|
+
| 'cancelled'
|
|
42
|
+
| 'failed'
|
|
43
|
+
| 'timed_out';
|
|
44
|
+
|
|
45
|
+
export type AgentRunTerminalStatus = 'completed' | 'cancelled' | 'failed' | 'timed_out';
|
|
46
|
+
|
|
47
|
+
export type AgentRunWaitingStatus =
|
|
48
|
+
| 'waiting_external'
|
|
49
|
+
| 'waiting_child'
|
|
50
|
+
| 'awaiting_input'
|
|
51
|
+
| 'awaiting_approval'
|
|
52
|
+
| 'sleeping'
|
|
53
|
+
| 'retry_scheduled';
|
|
26
54
|
|
|
27
55
|
export interface AgentRun {
|
|
28
56
|
id: string;
|
|
29
|
-
conversationId
|
|
57
|
+
conversationId?: string;
|
|
30
58
|
status: AgentRunStatus;
|
|
31
|
-
startedAt
|
|
59
|
+
startedAt?: number;
|
|
32
60
|
completedAt?: number;
|
|
61
|
+
|
|
62
|
+
accountId?: string;
|
|
63
|
+
kind?: string;
|
|
64
|
+
externalAgentId?: string;
|
|
65
|
+
externalRunId?: string;
|
|
66
|
+
parentRunId?: string;
|
|
67
|
+
sourceClient?: string;
|
|
68
|
+
surface?: string;
|
|
69
|
+
mode?: AgentRunMode;
|
|
33
70
|
modelId?: string;
|
|
71
|
+
modelKey?: string;
|
|
72
|
+
reasoningEffort?: string;
|
|
73
|
+
requestedServiceTier?: string;
|
|
74
|
+
actualServiceTier?: string;
|
|
75
|
+
selectedBy?: AgentRunSelectedBy;
|
|
76
|
+
cancelRequested?: boolean;
|
|
77
|
+
errorCode?: string;
|
|
78
|
+
errorMessage?: string;
|
|
34
79
|
error?: string;
|
|
80
|
+
modelCallCount?: number;
|
|
81
|
+
toolCallCount?: number;
|
|
82
|
+
inputTokens?: number;
|
|
83
|
+
cachedInputTokens?: number;
|
|
84
|
+
outputTokens?: number;
|
|
85
|
+
reasoningTokens?: number;
|
|
86
|
+
costUsd?: number;
|
|
87
|
+
createdAt?: number;
|
|
88
|
+
updatedAt?: number;
|
|
89
|
+
latencyMs?: number;
|
|
90
|
+
planId?: string;
|
|
91
|
+
todoId?: string;
|
|
92
|
+
metadata?: Record<string, unknown>;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export function isAgentRunTerminalStatus(status: AgentRunStatus): status is AgentRunTerminalStatus {
|
|
96
|
+
return status === 'completed' || status === 'cancelled' || status === 'failed' || status === 'timed_out';
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export function isAgentRunWaitingStatus(status: AgentRunStatus): status is AgentRunWaitingStatus {
|
|
100
|
+
return status === 'waiting_external'
|
|
101
|
+
|| status === 'waiting_child'
|
|
102
|
+
|| status === 'awaiting_input'
|
|
103
|
+
|| status === 'awaiting_approval'
|
|
104
|
+
|| status === 'sleeping'
|
|
105
|
+
|| status === 'retry_scheduled';
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
export function isAgentRunModelActiveStatus(status: AgentRunStatus): boolean {
|
|
109
|
+
return status === 'queued' || status === 'running';
|
|
35
110
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export * from './agent';
|
|
2
2
|
export * from './events';
|
|
3
|
+
export * from './run';
|
|
3
4
|
export * from './tools';
|
|
4
5
|
export * from './authority';
|
|
5
6
|
export * from './execution';
|
|
@@ -12,3 +13,4 @@ export * from './models';
|
|
|
12
13
|
export * from './identity';
|
|
13
14
|
export * from './repository';
|
|
14
15
|
export * from './errors';
|
|
16
|
+
export * from './widgets';
|