@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.
Files changed (261) hide show
  1. package/README.md +3 -0
  2. package/TRADEMARKS.md +22 -0
  3. package/apps/README.md +3 -0
  4. package/apps/cad-creator/LICENSE +21 -0
  5. package/apps/cad-creator/README.md +4 -1
  6. package/apps/cad-creator/shared/cad/package.json +1 -1
  7. package/apps/client-cms-editor/LICENSE +21 -0
  8. package/apps/client-cms-editor/README.md +3 -0
  9. package/apps/client-cms-editor/backend/package.json +2 -2
  10. package/apps/client-cms-editor/frontend/package.json +3 -3
  11. package/apps/client-cms-editor/package-lock.json +43 -43
  12. package/apps/client-cms-editor/package.json +3 -3
  13. package/apps/client-cms-editor/reference/harvest/HARVEST_RECEIPT.json +1 -1
  14. package/apps/client-cms-editor/reference/harvest/README.md +1 -1
  15. package/apps/client-cms-editor/reference/harvest/plans/ARCHIVE-INTAKE.md +1 -1
  16. package/apps/client-cms-editor/reference/harvest/plans/HARVEST-INDEX.md +1 -1
  17. package/apps/client-cms-editor/reference/harvest/plans/TOOLING-LAB.md +1 -1
  18. package/apps/client-cms-editor/shared/cms/package.json +1 -1
  19. package/docs/MINI.md +4 -2
  20. package/docs/REPO_FILE_MAP.txt +0 -1
  21. package/docs/SOURCE_ARCHITECTURE.md +1 -1
  22. package/docs/architecture/DUAL_ANALYTICS_PRODUCT.md +140 -0
  23. package/docs/content-studio/REVISION_GATE_2026-09-27.md +1 -1
  24. package/docs/engineering/go-portability/01-product-project-deployment-authority.md +69 -0
  25. package/docs/engineering/provider-internal-renames/01-lane-initialization.md +20 -0
  26. package/docs/engineering/provider-internal-renames/01a-runtime-environment-contract.md +115 -0
  27. package/docs/engineering/provider-internal-renames/02-cfoa.md +57 -0
  28. package/docs/engineering/provider-internal-renames/03-gclioa.md +32 -0
  29. package/docs/engineering/provider-internal-renames/04-goaude.md +50 -0
  30. package/docs/engineering/provider-internal-renames/05-gdrv.md +33 -0
  31. package/docs/engineering/provider-internal-renames/06-verification.md +103 -0
  32. package/docs/engineering/provider-internal-renames/README.md +77 -0
  33. package/docs/engineering/provider-internal-renames/runtime-environment-contract.json +220 -0
  34. package/docs/engineering/test-diagnostics/go-cli-test-hang-20261003.md +49 -0
  35. package/docs/engineering/test-diagnostics/go-skip-deploy-docker-fix.md +90 -0
  36. package/docs/knowledge-service-verification.md +3 -3
  37. package/docs/plans/AGENTSAM-SUSPEND-QUEUE-KNOWLEDGE-RDP-2026-10-03.md +870 -0
  38. package/docs/plans/LOCAL-STUDIO-GRADUATION-2026-09-26.md +9 -9
  39. package/docs/plans/MACHINE-FIRST-APPS-TUI-2026-09-24.md +11 -11
  40. package/docs/plans/RECONCILIATION-2026-09-19.md +6 -6
  41. package/docs/plans/SAM_WORK_PROTOCOL.md +667 -0
  42. package/docs/plans/TOMORROW-EXTENSIVE-TODO-2026-09-26.md +2 -2
  43. package/docs/plans/UNIVERSAL-INGEST-MACHINE-FIRST-2026-09-24.md +3 -3
  44. package/examples/hyperspace-demo/src/main.tsx +227 -110
  45. package/migrations/d1/0020_agentsam_receipt_catalog.sql +35 -0
  46. package/migrations/runtime/0006_agent_run_suspend_activity.sql +53 -0
  47. package/migrations/runtime/0007_queue_control.sql +40 -0
  48. package/migrations/runtime/0008_agent_run_dependencies.sql +24 -0
  49. package/migrations/runtime/0008_analytics_legacy_bootstrap.sql +43 -0
  50. package/migrations/runtime/0009_analytics_authority.sql +108 -0
  51. package/package.json +26 -11
  52. package/packages/agentsam-brand/README.md +3 -0
  53. package/packages/agentsam-brand/package.json +2 -2
  54. package/packages/agentsam-contracts/dist/adapter.d.ts +22 -0
  55. package/packages/agentsam-contracts/dist/adapter.js +0 -0
  56. package/packages/agentsam-contracts/dist/agent.d.ts +66 -0
  57. package/packages/agentsam-contracts/dist/agent.js +15 -0
  58. package/packages/agentsam-contracts/dist/artifacts.d.ts +70 -0
  59. package/packages/agentsam-contracts/dist/artifacts.js +0 -0
  60. package/packages/agentsam-contracts/dist/authority.d.ts +21 -0
  61. package/packages/agentsam-contracts/dist/authority.js +0 -0
  62. package/packages/agentsam-contracts/dist/context.d.ts +14 -0
  63. package/packages/agentsam-contracts/dist/context.js +0 -0
  64. package/packages/agentsam-contracts/dist/errors.d.ts +121 -0
  65. package/packages/agentsam-contracts/dist/errors.js +5 -0
  66. package/packages/agentsam-contracts/dist/events.d.ts +53 -0
  67. package/packages/agentsam-contracts/dist/events.js +0 -0
  68. package/packages/agentsam-contracts/dist/execution.d.ts +38 -0
  69. package/packages/agentsam-contracts/dist/execution.js +0 -0
  70. package/packages/agentsam-contracts/dist/hooks.d.ts +31 -0
  71. package/packages/agentsam-contracts/dist/hooks.js +0 -0
  72. package/packages/agentsam-contracts/dist/identity.d.ts +15 -0
  73. package/packages/agentsam-contracts/dist/identity.js +0 -0
  74. package/packages/agentsam-contracts/dist/index.d.ts +16 -0
  75. package/packages/agentsam-contracts/dist/index.js +164 -0
  76. package/packages/agentsam-contracts/dist/models.d.ts +9 -0
  77. package/packages/agentsam-contracts/dist/models.js +0 -0
  78. package/packages/agentsam-contracts/dist/providers.d.ts +27 -0
  79. package/packages/agentsam-contracts/dist/providers.js +0 -0
  80. package/packages/agentsam-contracts/dist/repository.d.ts +56 -0
  81. package/packages/agentsam-contracts/dist/repository.js +15 -0
  82. package/packages/agentsam-contracts/dist/run.d.ts +113 -0
  83. package/packages/agentsam-contracts/dist/run.js +132 -0
  84. package/packages/agentsam-contracts/dist/tools.d.ts +82 -0
  85. package/packages/agentsam-contracts/dist/tools.js +0 -0
  86. package/packages/agentsam-contracts/dist/widgets.d.ts +38 -0
  87. package/packages/agentsam-contracts/dist/widgets.js +0 -0
  88. package/packages/agentsam-contracts/package.json +9 -1
  89. package/packages/agentsam-contracts/scripts/build.mjs +1 -1
  90. package/packages/agentsam-contracts/src/agent.ts +78 -3
  91. package/packages/agentsam-contracts/src/index.ts +2 -0
  92. package/packages/agentsam-contracts/src/run.ts +320 -0
  93. package/packages/agentsam-contracts/src/widgets.ts +58 -0
  94. package/packages/agentsam-contracts/test/contracts.test.mjs +1 -1
  95. package/packages/agentsam-contracts/test/run-contract.test.mjs +94 -0
  96. package/packages/agentsam-errors/package.json +1 -1
  97. package/packages/agentsam-goap/README.md +3 -0
  98. package/packages/agentsam-goap/package.json +2 -2
  99. package/packages/agentsam-hooks/package.json +2 -2
  100. package/packages/agentsam-hooks/src/adapters/agents.js +48 -22
  101. package/packages/agentsam-hooks/src/index.d.ts +16 -0
  102. package/packages/agentsam-knowledge/package.json +1 -1
  103. package/packages/agentsam-knowledge/src/backends/index.js +1 -1
  104. package/packages/agentsam-merch/README.md +62 -0
  105. package/packages/agentsam-merch/bin/agentsam-merch.mjs +16 -0
  106. package/packages/agentsam-merch/package.json +65 -0
  107. package/packages/agentsam-merch/profiles/completeful/dtg-back-large.json +42 -0
  108. package/packages/agentsam-merch/profiles/completeful/laser-engraving.json +39 -0
  109. package/packages/agentsam-merch/profiles/generic/embroidery-digitization.json +22 -0
  110. package/packages/agentsam-merch/schemas/collection-candidate.schema.json +66 -0
  111. package/packages/agentsam-merch/schemas/manufacturing-profile.schema.json +221 -0
  112. package/packages/agentsam-merch/src/adapters-completeful.js +50 -0
  113. package/packages/agentsam-merch/src/cli.js +93 -0
  114. package/packages/agentsam-merch/src/collection-lab.js +60 -0
  115. package/packages/agentsam-merch/src/compatibility.js +501 -0
  116. package/packages/agentsam-merch/src/derivatives.js +112 -0
  117. package/packages/agentsam-merch/src/index.d.ts +316 -0
  118. package/packages/agentsam-merch/src/index.js +46 -0
  119. package/packages/agentsam-merch/src/node/index.d.ts +58 -0
  120. package/packages/agentsam-merch/src/node/index.js +6 -0
  121. package/packages/agentsam-merch/src/node/raster.js +142 -0
  122. package/packages/agentsam-merch/src/node/vector.js +239 -0
  123. package/packages/agentsam-merch/src/product-concepts.js +118 -0
  124. package/packages/agentsam-merch/src/profile-registry.js +104 -0
  125. package/packages/agentsam-merch/src/profile.js +158 -0
  126. package/packages/agentsam-merch/src/transforms.js +215 -0
  127. package/packages/agentsam-merch/test/merch.test.mjs +332 -0
  128. package/packages/agentsam-merch/test/node-transforms.test.mjs +149 -0
  129. package/packages/agentsam-nav/dist/browser.global.js +71 -34
  130. package/packages/agentsam-nav/dist/browser.js +3179 -781
  131. package/packages/agentsam-nav/dist/index.js +3171 -773
  132. package/packages/agentsam-nav/package.json +1 -1
  133. package/packages/agentsam-queue-control/README.md +4 -1
  134. package/packages/agentsam-queue-control/package.json +4 -3
  135. package/packages/agentsam-queue-control/schemas/job-envelope.schema.json +111 -11
  136. package/packages/agentsam-queue-control/src/adapters/cloudflare.js +34 -6
  137. package/packages/agentsam-queue-control/src/adapters/memory.js +11 -2
  138. package/packages/agentsam-queue-control/src/adapters/sqlite.js +259 -0
  139. package/packages/agentsam-queue-control/src/contracts.js +207 -3
  140. package/packages/agentsam-queue-control/src/control-plane.js +62 -2
  141. package/packages/agentsam-queue-control/src/index.js +1 -0
  142. package/packages/agentsam-queue-control/test/queue-control.test.mjs +310 -0
  143. package/packages/agentsam-queue-control/test/sqlite-adapter.test.mjs +91 -0
  144. package/packages/agentsam-rapid-rust/README.md +3 -0
  145. package/packages/agentsam-repository/README.md +3 -0
  146. package/packages/agentsam-repository/package.json +1 -1
  147. package/packages/agentsam-vault/package.json +1 -1
  148. package/packages/agentsam-workbench/README.md +43 -0
  149. package/packages/agentsam-workbench/package.json +13 -3
  150. package/packages/agentsam-workbench/src/agent/AgentConversationSurface.tsx +108 -0
  151. package/packages/agentsam-workbench/src/agent/AgentPanel.tsx +25 -8
  152. package/packages/agentsam-workbench/src/agent/AgentRuntimeField.tsx +152 -0
  153. package/packages/agentsam-workbench/src/agent/Composer.tsx +10 -1
  154. package/packages/agentsam-workbench/src/agent/RunMode.ts +26 -0
  155. package/packages/agentsam-workbench/src/agent/Thread.tsx +18 -3
  156. package/packages/agentsam-workbench/src/agent/index.ts +3 -0
  157. package/packages/agentsam-workbench/src/index.ts +4 -0
  158. package/packages/agentsam-workbench/src/manufacturing/PreflightIndicator.tsx +203 -0
  159. package/packages/agentsam-workbench/src/manufacturing/index.ts +2 -0
  160. package/packages/agentsam-workbench/src/manufacturing/loading.ts +147 -0
  161. package/packages/agentsam-workbench/src/widgets/BuiltinWidget.tsx +22 -0
  162. package/packages/agentsam-workbench/src/widgets/CountdownWidget.tsx +68 -0
  163. package/packages/agentsam-workbench/src/widgets/WidgetFrame.tsx +56 -0
  164. package/packages/agentsam-workbench/src/widgets/countdown.ts +25 -0
  165. package/packages/agentsam-workbench/src/widgets/index.ts +6 -0
  166. package/packages/agentsam-workbench/src/widgets/registry.ts +13 -0
  167. package/packages/agentsam-workbench/src/widgets/useCountdown.ts +128 -0
  168. package/packages/agentsam-workbench/src/widgets/widgets.css +102 -0
  169. package/packages/connectors/{cloudflare → cfoa}/package.json +3 -3
  170. package/packages/heuristic-theme/package.json +1 -1
  171. package/packages/identity/README.md +3 -0
  172. package/packages/identity/backend/README.md +3 -0
  173. package/packages/identity/package.json +1 -1
  174. package/packages/identity/src/frontend/auth-portal/README.md +3 -0
  175. package/packages/identity/src/index.js +1 -1
  176. package/packages/identity/src/oauth/README.md +4 -1
  177. package/packages/identity/src/oauth/credentials.js +1 -1
  178. package/packages/identity/src/server/worker-router.js +1 -1
  179. package/packages/identity/tests/google-desktop-identity-login.test.mjs +1 -1
  180. package/packages/identity/tests/lane1-packed-consumer.test.mjs +1 -1
  181. package/packages/identity/tests/oauth-presets-accounts-ssot.test.mjs +1 -1
  182. package/packages/providers/completeful/package.json +1 -1
  183. package/packages/theme-church-site/package.json +1 -1
  184. package/packages/theme-companions-site/package.json +1 -1
  185. package/packages/theme-floors-site/package.json +1 -1
  186. package/packages/theme-fuelnfree-site/package.json +1 -1
  187. package/packages/theme-handyman-site/package.json +1 -1
  188. package/packages/theme-insurance-site/package.json +1 -1
  189. package/packages/theme-scenes/package.json +1 -1
  190. package/packages/theme-shinshu-site/package.json +1 -1
  191. package/packages/work-graph/package.json +1 -1
  192. package/protocol/models/README.md +3 -0
  193. package/protocol/receipts/agentsam.receipt.v1.json +95 -0
  194. package/protocol/theme-refinery/receipts/products-registry-batch-20260924.json +6 -6
  195. package/protocol/theme-refinery/receipts/theme-harvest-20260924.json +6 -6
  196. package/skills/README.md +3 -0
  197. package/src/acp/agent-executor.js +106 -0
  198. package/src/acp/client.js +316 -0
  199. package/src/acp/dependencies.js +426 -0
  200. package/src/acp/http.js +207 -0
  201. package/src/acp/index.js +22 -0
  202. package/src/acp/runs.js +125 -0
  203. package/src/acp/runtime-selection.js +180 -0
  204. package/src/cli/command-catalog.js +3 -0
  205. package/src/cli.js +24 -0
  206. package/src/commands/cloudflare-login.js +1 -1
  207. package/src/commands/cloudflare.js +2 -2
  208. package/src/commands/connections.js +1 -1
  209. package/src/commands/go.js +76 -6
  210. package/src/commands/merch.js +5 -0
  211. package/src/commands/mini.js +1 -1
  212. package/src/commands/receipts.js +140 -0
  213. package/src/commands/run.js +253 -0
  214. package/src/go/container.js +1 -1
  215. package/src/go/contract.js +61 -18
  216. package/src/go/discover.js +0 -4
  217. package/src/go/index.js +13 -1
  218. package/src/go/probe.js +109 -0
  219. package/src/go/{cloudflare.js → providers/cloudflare.js} +36 -136
  220. package/src/go/verify.js +1 -1
  221. package/src/indexing/ingest/inventory.js +1 -1
  222. package/src/lib/deploy/local-studio.js +2 -2
  223. package/src/lib/mini/scaffold.js +1 -1
  224. package/src/lib/whoami-capabilities.js +1 -1
  225. package/src/local/runtime-store.js +8 -0
  226. package/src/mcp/cloudflare-bundles.js +1 -1
  227. package/src/plugins/index.js +1 -0
  228. package/src/plugins/registry.js +59 -6
  229. package/src/receipts/contract.js +68 -0
  230. package/src/receipts/index.js +20 -0
  231. package/src/receipts/prune.js +64 -0
  232. package/src/receipts/sinks.js +285 -0
  233. package/templates/mini/gadget/app.js +15 -40
  234. package/templates/mini/gadget/index.html +7 -7
  235. package/templates/mini/shared/style.css +1 -1
  236. package/packages/agentsam-repository/src/goap.js.bak-20260922011251 +0 -670
  237. /package/packages/connectors/{cloudflare → cfoa}/OAUTH_STORAGE_AUDIT.md +0 -0
  238. /package/packages/connectors/{cloudflare → cfoa}/src/api-client.js +0 -0
  239. /package/packages/connectors/{cloudflare → cfoa}/src/capabilities.js +0 -0
  240. /package/packages/connectors/{cloudflare → cfoa}/src/credential.js +0 -0
  241. /package/packages/connectors/{cloudflare → cfoa}/src/families/brand-protection.js +0 -0
  242. /package/packages/connectors/{cloudflare → cfoa}/src/families/keyless.js +0 -0
  243. /package/packages/connectors/{cloudflare → cfoa}/src/families/pages.js +0 -0
  244. /package/packages/connectors/{cloudflare → cfoa}/src/families/scanner.js +0 -0
  245. /package/packages/connectors/{cloudflare → cfoa}/src/families/snippets.js +0 -0
  246. /package/packages/connectors/{cloudflare → cfoa}/src/families/tag-gateway.js +0 -0
  247. /package/packages/connectors/{cloudflare → cfoa}/src/families/tags.js +0 -0
  248. /package/packages/connectors/{cloudflare → cfoa}/src/families/token-validation.js +0 -0
  249. /package/packages/connectors/{cloudflare → cfoa}/src/families/vectorize.js +0 -0
  250. /package/packages/connectors/{cloudflare → cfoa}/src/families/workflows.js +0 -0
  251. /package/packages/connectors/{cloudflare → cfoa}/src/index.js +0 -0
  252. /package/packages/connectors/{cloudflare → cfoa}/src/oauth-persist.js +0 -0
  253. /package/packages/connectors/{cloudflare → cfoa}/src/owner.js +0 -0
  254. /package/packages/connectors/{cloudflare → cfoa}/src/permission-options.js +0 -0
  255. /package/packages/connectors/{cloudflare → cfoa}/src/routes.js +0 -0
  256. /package/packages/connectors/{cloudflare → cfoa}/src/scope-catalog.js +0 -0
  257. /package/packages/connectors/{cloudflare → cfoa}/src/vault.js +0 -0
  258. /package/packages/connectors/{cloudflare → cfoa}/tests/capabilities.test.mjs +0 -0
  259. /package/packages/connectors/{cloudflare → cfoa}/tests/connector.test.mjs +0 -0
  260. /package/packages/connectors/{cloudflare → cfoa}/tests/oauth-persist.test.mjs +0 -0
  261. /package/packages/identity/src/oauth/{google-desktop-exchange.js → goaude.js} +0 -0
@@ -0,0 +1,53 @@
1
+ import type { AgentArtifact } from './artifacts';
2
+ import type { AgentMessage, AgentRunStatus } from './agent';
3
+ import type { AgentToolCall } from './tools';
4
+ /**
5
+ * Workbench-facing event stream retained for UI/runtime compatibility.
6
+ */
7
+ export type AgentEvent = {
8
+ type: 'message';
9
+ message: AgentMessage;
10
+ } | {
11
+ type: 'message.delta';
12
+ messageId: string;
13
+ delta: string;
14
+ } | {
15
+ type: 'run.status';
16
+ runId: string;
17
+ status: AgentRunStatus;
18
+ error?: string;
19
+ } | {
20
+ type: 'tool';
21
+ toolCall: AgentToolCall;
22
+ } | {
23
+ type: 'artifact';
24
+ artifact: AgentArtifact;
25
+ } | {
26
+ type: 'error';
27
+ runId?: string;
28
+ error: string;
29
+ };
30
+ export type AgentEventSourceKind = 'webhook' | 'tool' | 'workflow' | 'provider' | 'system' | 'user';
31
+ export interface AgentEventSource {
32
+ kind: AgentEventSourceKind;
33
+ provider?: string;
34
+ ref?: string;
35
+ metadata?: Record<string, unknown>;
36
+ }
37
+ /**
38
+ * Portable orchestration/domain event. Provider events can be retained while a host
39
+ * additionally emits normalized domain events (for example completeful.order.created
40
+ * followed by commerce.order.created).
41
+ */
42
+ export interface AgentOrchestrationEvent<TPayload = unknown> {
43
+ id: string;
44
+ eventKey: string;
45
+ occurredAt: number;
46
+ source: AgentEventSource;
47
+ payload: TPayload;
48
+ accountId?: string;
49
+ subject?: string;
50
+ correlationId?: string;
51
+ causationId?: string;
52
+ metadata?: Record<string, unknown>;
53
+ }
File without changes
@@ -0,0 +1,38 @@
1
+ import type { AgentSamErrorEnvelope } from './errors';
2
+ export type AgentExecutionStatus = 'queued' | 'running' | 'retrying' | 'awaiting_input' | 'completed' | 'failed' | 'cancelled' | 'timed_out';
3
+ export interface AgentToolInvocation<TInput = unknown> {
4
+ id: string;
5
+ toolKey: string;
6
+ input: TInput;
7
+ requestedAt: number;
8
+ accountId?: string;
9
+ correlationId?: string;
10
+ causationId?: string;
11
+ idempotencyKey?: string;
12
+ metadata?: Record<string, unknown>;
13
+ }
14
+ export interface AgentToolExecutionResult<TOutput = unknown> {
15
+ output?: TOutput;
16
+ providerRequestId?: string;
17
+ usage?: Record<string, unknown>;
18
+ metadata?: Record<string, unknown>;
19
+ }
20
+ export interface AgentToolExecutionReceipt<TOutput = unknown> {
21
+ invocationId: string;
22
+ toolKey: string;
23
+ status: AgentExecutionStatus;
24
+ ok: boolean;
25
+ attempt: number;
26
+ queuedAt?: number;
27
+ startedAt?: number;
28
+ completedAt?: number;
29
+ durationMs?: number;
30
+ provider?: string;
31
+ input?: unknown;
32
+ output?: TOutput;
33
+ error?: AgentSamErrorEnvelope;
34
+ emittedEventIds?: string[];
35
+ providerRequestId?: string;
36
+ usage?: Record<string, unknown>;
37
+ metadata?: Record<string, unknown>;
38
+ }
File without changes
@@ -0,0 +1,31 @@
1
+ export type AgentHookActionType = 'tool' | 'workflow' | 'event';
2
+ export interface AgentHookAction {
3
+ actionId?: string;
4
+ type: AgentHookActionType;
5
+ target: string;
6
+ input?: unknown;
7
+ metadata?: Record<string, unknown>;
8
+ }
9
+ export interface AgentHookDefinition {
10
+ hookKey: string;
11
+ displayName?: string;
12
+ description?: string;
13
+ eventKeys: string[];
14
+ enabled: boolean;
15
+ filter?: Record<string, unknown>;
16
+ actions: AgentHookAction[];
17
+ metadata?: Record<string, unknown>;
18
+ }
19
+ export type AgentHookExecutionStatus = 'queued' | 'running' | 'completed' | 'failed' | 'cancelled';
20
+ export interface AgentHookExecutionReceipt {
21
+ executionId: string;
22
+ hookKey: string;
23
+ eventId: string;
24
+ status: AgentHookExecutionStatus;
25
+ startedAt?: number;
26
+ completedAt?: number;
27
+ durationMs?: number;
28
+ actionExecutionIds?: string[];
29
+ error?: unknown;
30
+ metadata?: Record<string, unknown>;
31
+ }
File without changes
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Identity is established outside the workbench. These contracts only carry the
3
+ * authenticated principal into product authorization and runtime adapters.
4
+ */
5
+ export interface AgentPrincipal {
6
+ accountId: string;
7
+ authUserId: string;
8
+ displayName?: string;
9
+ email?: string;
10
+ claims?: Record<string, unknown>;
11
+ }
12
+ export interface AgentIdentityProvider {
13
+ getPrincipal(): AgentPrincipal | null | Promise<AgentPrincipal | null>;
14
+ subscribe?(onChange: (principal: AgentPrincipal | null) => void): () => void;
15
+ }
File without changes
@@ -0,0 +1,16 @@
1
+ export * from './agent';
2
+ export * from './events';
3
+ export * from './run';
4
+ export * from './tools';
5
+ export * from './authority';
6
+ export * from './execution';
7
+ export * from './providers';
8
+ export * from './hooks';
9
+ export * from './artifacts';
10
+ export * from './context';
11
+ export * from './adapter';
12
+ export * from './models';
13
+ export * from './identity';
14
+ export * from './repository';
15
+ export * from './errors';
16
+ export * from './widgets';
@@ -0,0 +1,164 @@
1
+ // src/agent.ts
2
+ function isAgentRunTerminalStatus(status) {
3
+ return status === "completed" || status === "cancelled" || status === "failed" || status === "timed_out";
4
+ }
5
+ function isAgentRunWaitingStatus(status) {
6
+ return status === "waiting_external" || status === "waiting_child" || status === "awaiting_input" || status === "awaiting_approval" || status === "sleeping" || status === "retry_scheduled";
7
+ }
8
+ function isAgentRunModelActiveStatus(status) {
9
+ return status === "queued" || status === "running";
10
+ }
11
+
12
+ // src/run.ts
13
+ var WAIT_CODES = /* @__PURE__ */ new Set([
14
+ "approval_required",
15
+ "input_required",
16
+ "external_pending",
17
+ "dependency_pending"
18
+ ]);
19
+ var REPLAN_CODES = /* @__PURE__ */ new Set([
20
+ "precondition_failed",
21
+ "repository_changed",
22
+ "capability_unavailable"
23
+ ]);
24
+ var TRANSIENT_CODES = /* @__PURE__ */ new Set([
25
+ "timeout",
26
+ "request_timeout",
27
+ "rate_limited",
28
+ "provider_unavailable",
29
+ "runtime_unavailable",
30
+ "econnreset",
31
+ "econnrefused",
32
+ "etimedout",
33
+ "eai_again"
34
+ ]);
35
+ function classifyAgentRunRetry(input = {}) {
36
+ const code = String(input.code || "").trim().toLowerCase();
37
+ const statusCode = Number(input.statusCode);
38
+ if (input.retryable === true) {
39
+ return { class: "transient", automaticRetry: true, reason: code || "explicit_retryable" };
40
+ }
41
+ if (input.retryable === false) {
42
+ return { class: "terminal", automaticRetry: false, reason: code || "explicit_non_retryable" };
43
+ }
44
+ if (WAIT_CODES.has(code)) {
45
+ return { class: "wait", automaticRetry: false, reason: code };
46
+ }
47
+ if (REPLAN_CODES.has(code)) {
48
+ return { class: "replan", automaticRetry: false, reason: code };
49
+ }
50
+ if (TRANSIENT_CODES.has(code) || [408, 425, 429, 500, 502, 503, 504].includes(statusCode)) {
51
+ return { class: "transient", automaticRetry: true, reason: code || `http_${statusCode}` };
52
+ }
53
+ return { class: "terminal", automaticRetry: false, reason: code || "unclassified_failure" };
54
+ }
55
+ function evaluateAgentRunWake(suspension, wake, options = {}) {
56
+ const consumed = new Set(options.consumedDedupeKeys || []);
57
+ if (consumed.has(wake.dedupeKey)) return { accepted: false, reason: "duplicate" };
58
+ if (suspension.runId !== wake.runId) return { accepted: false, reason: "run_mismatch" };
59
+ const now = options.now ?? wake.occurredAt;
60
+ if (suspension.expiresAt != null && now > suspension.expiresAt) {
61
+ return { accepted: false, reason: "expired" };
62
+ }
63
+ const matched = wake.kind === "manual" || Boolean(suspension.wakeEvent && wake.eventKey === suspension.wakeEvent) || Boolean(
64
+ wake.kind === "dependency" && wake.dependencyRunId && (suspension.dependencyRunIds || []).includes(wake.dependencyRunId)
65
+ ) || Boolean(wake.kind === "scheduled" && suspension.wakeAt != null && now >= suspension.wakeAt);
66
+ return matched ? { accepted: true, reason: "accepted", nextStatus: "queued" } : { accepted: false, reason: "condition_not_met" };
67
+ }
68
+ function wakeMatchesSuspension(suspension, wake, now = wake.occurredAt) {
69
+ return evaluateAgentRunWake(suspension, wake, { now }).accepted;
70
+ }
71
+ function transitionAgentRunStatus(status, action) {
72
+ if (status === "completed" || status === "failed" || status === "cancelled" || status === "timed_out") {
73
+ return status;
74
+ }
75
+ if (action.type === "cancel") return "cancelled";
76
+ if (action.type === "timeout") return "timed_out";
77
+ if (action.type === "complete") return "completed";
78
+ if (action.type === "fail") return "failed";
79
+ if (action.type === "suspend") return action.status;
80
+ if (action.type === "wake") return "queued";
81
+ if (action.type === "start") return "running";
82
+ return status;
83
+ }
84
+ function phaseForRunEvent(event) {
85
+ if (event.phase) return event.phase;
86
+ if (event.eventType === "run.created" || event.eventType === "run.queued" || event.eventType === "run.started") return "boot";
87
+ if (event.eventType === "run.suspended") return "waiting";
88
+ if (event.eventType === "run.woken" || event.eventType === "run.cancel_requested") return "recover";
89
+ if (event.eventType === "verification.completed") return "verify";
90
+ if (event.eventType === "run.completed" || event.eventType === "run.cancelled" || event.eventType === "run.timed_out") return "complete";
91
+ if (event.eventType === "run.failed") return "complete";
92
+ return "execute";
93
+ }
94
+ function activityTypeForRunEvent(event) {
95
+ if (event.eventType === "run.started") return "run.started";
96
+ if (event.eventType === "run.completed") return "run.completed";
97
+ if (event.eventType === "run.failed" || event.eventType === "run.timed_out") return "run.failed";
98
+ 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";
99
+ if (event.eventType === "step.started") return "step.started";
100
+ if (event.eventType === "step.completed") return "step.completed";
101
+ if (event.eventType === "decision.made") return "decision.made";
102
+ if (event.eventType === "tool.started") return "tool.started";
103
+ if (event.eventType === "tool.completed") return "tool.completed";
104
+ if (event.eventType === "artifact.created") return "artifact.created";
105
+ if (event.eventType === "file.changed") return "file.changed";
106
+ if (event.eventType === "approval.required") return "approval.required";
107
+ if (event.eventType === "input.required") return "input.required";
108
+ if (event.eventType === "verification.completed") return "verification.completed";
109
+ return "step.progress";
110
+ }
111
+ function projectRunEventToActivity(event) {
112
+ const evidence = {
113
+ ...event.evidence || {},
114
+ run_event_id: event.id,
115
+ run_event_type: event.eventType,
116
+ ...event.status ? { run_status: event.status } : {}
117
+ };
118
+ return {
119
+ schema: "agentsam.activity.v1",
120
+ run_id: event.runId,
121
+ seq: event.seq,
122
+ timestamp: new Date(event.createdAt).toISOString(),
123
+ phase: phaseForRunEvent(event),
124
+ event: activityTypeForRunEvent(event),
125
+ step_id: event.stepId ?? null,
126
+ parent_id: event.parentRunId ?? null,
127
+ label: event.label || "",
128
+ detail: event.detail ?? null,
129
+ progress: event.progress ?? null,
130
+ source: {
131
+ kind: event.source?.kind || "sam",
132
+ name: event.source?.name ?? null
133
+ },
134
+ evidence
135
+ };
136
+ }
137
+
138
+ // src/repository.ts
139
+ var REPOSITORY_STATUSES = ["active", "archived", "disabled"];
140
+ var REPOSITORY_CONTRACT_TYPES = ["api", "schema", "runtime", "cli", "event", "receipt", "package"];
141
+ var REPOSITORY_CONTRACT_STATUSES = ["active", "deprecated", "retired"];
142
+ var REPOSITORY_DEPENDENCY_TYPES = ["runtime", "build", "contract", "package", "deploy", "tool", "data"];
143
+ var REPOSITORY_DEPENDENCY_CRITICALITIES = ["informational", "compatible", "strict", "critical"];
144
+ var REPOSITORY_FAILURE_POLICIES = ["warn", "block_certification", "block_deploy", "degrade"];
145
+
146
+ // src/errors.ts
147
+ var AGENTSAM_ERROR_SCHEMA_VERSION = 2;
148
+ export {
149
+ AGENTSAM_ERROR_SCHEMA_VERSION,
150
+ REPOSITORY_CONTRACT_STATUSES,
151
+ REPOSITORY_CONTRACT_TYPES,
152
+ REPOSITORY_DEPENDENCY_CRITICALITIES,
153
+ REPOSITORY_DEPENDENCY_TYPES,
154
+ REPOSITORY_FAILURE_POLICIES,
155
+ REPOSITORY_STATUSES,
156
+ classifyAgentRunRetry,
157
+ evaluateAgentRunWake,
158
+ isAgentRunModelActiveStatus,
159
+ isAgentRunTerminalStatus,
160
+ isAgentRunWaitingStatus,
161
+ projectRunEventToActivity,
162
+ transitionAgentRunStatus,
163
+ wakeMatchesSuspension
164
+ };
@@ -0,0 +1,9 @@
1
+ export interface ModelOption {
2
+ id: string;
3
+ label: string;
4
+ short?: string;
5
+ description?: string;
6
+ provider?: string;
7
+ disabled?: boolean;
8
+ metadata?: Record<string, unknown>;
9
+ }
File without changes
@@ -0,0 +1,27 @@
1
+ import type { AgentAuthorityRequirement, AgentResolvedAuthorityReference } from './authority';
2
+ import type { AgentToolExecutionResult, AgentToolInvocation } from './execution';
3
+ import type { AgentToolDefinition } from './tools';
4
+ export interface AgentProviderDefinition {
5
+ providerKey: string;
6
+ displayName: string;
7
+ description?: string;
8
+ capabilityKeys?: string[];
9
+ toolKeys?: string[];
10
+ authority?: AgentAuthorityRequirement[];
11
+ metadata?: Record<string, unknown>;
12
+ }
13
+ export interface AgentProviderExecutionContext {
14
+ authority?: AgentResolvedAuthorityReference[];
15
+ accountId?: string;
16
+ deadlineAt?: number;
17
+ metadata?: Record<string, unknown>;
18
+ }
19
+ /**
20
+ * Provider adapters implement provider-specific mechanics only.
21
+ * Generic retries, receipts, hooks, queueing and event dispatch remain execution-plane concerns.
22
+ */
23
+ export interface AgentProviderAdapter<TContext extends AgentProviderExecutionContext = AgentProviderExecutionContext> {
24
+ readonly providerKey: string;
25
+ listTools?(): AgentToolDefinition[] | Promise<AgentToolDefinition[]>;
26
+ invoke<TInput = unknown, TOutput = unknown>(invocation: AgentToolInvocation<TInput>, context: TContext): Promise<AgentToolExecutionResult<TOutput>>;
27
+ }
File without changes
@@ -0,0 +1,56 @@
1
+ export declare const REPOSITORY_STATUSES: readonly ["active", "archived", "disabled"];
2
+ export type RepositoryStatus = (typeof REPOSITORY_STATUSES)[number];
3
+ export declare const REPOSITORY_CONTRACT_TYPES: readonly ["api", "schema", "runtime", "cli", "event", "receipt", "package"];
4
+ export type RepositoryContractType = (typeof REPOSITORY_CONTRACT_TYPES)[number];
5
+ export declare const REPOSITORY_CONTRACT_STATUSES: readonly ["active", "deprecated", "retired"];
6
+ export type RepositoryContractStatus = (typeof REPOSITORY_CONTRACT_STATUSES)[number];
7
+ export declare const REPOSITORY_DEPENDENCY_TYPES: readonly ["runtime", "build", "contract", "package", "deploy", "tool", "data"];
8
+ export type RepositoryDependencyType = (typeof REPOSITORY_DEPENDENCY_TYPES)[number];
9
+ export declare const REPOSITORY_DEPENDENCY_CRITICALITIES: readonly ["informational", "compatible", "strict", "critical"];
10
+ export type RepositoryDependencyCriticality = (typeof REPOSITORY_DEPENDENCY_CRITICALITIES)[number];
11
+ export declare const REPOSITORY_FAILURE_POLICIES: readonly ["warn", "block_certification", "block_deploy", "degrade"];
12
+ export type RepositoryFailurePolicy = (typeof REPOSITORY_FAILURE_POLICIES)[number];
13
+ /** Portable repository identity. Account ownership belongs to the host registry, not this object. */
14
+ export interface RepositoryIdentity {
15
+ schema_version: 1;
16
+ repository_id: string;
17
+ full_name: string;
18
+ role: string;
19
+ default_branch: string;
20
+ canonical_url: string | null;
21
+ status: RepositoryStatus;
22
+ }
23
+ /** Account-bound declaration of one contract provided by a repository. */
24
+ export interface RepositoryContract {
25
+ schema_version: 1;
26
+ id: string;
27
+ account_id: string;
28
+ repository_id: string;
29
+ contract_key: string;
30
+ contract_version: string;
31
+ contract_type: RepositoryContractType;
32
+ name: string;
33
+ description: string | null;
34
+ manifest_path: string | null;
35
+ contract_hash: string;
36
+ status: RepositoryContractStatus;
37
+ created_at: number | null;
38
+ updated_at: number | null;
39
+ }
40
+ /** Account-bound cross-repository dependency edge. */
41
+ export interface RepositoryDependency {
42
+ schema_version: 1;
43
+ id: string;
44
+ account_id: string;
45
+ source_repository_id: string;
46
+ target_repository_id: string;
47
+ dependency_type: RepositoryDependencyType;
48
+ contract_id: string | null;
49
+ criticality: RepositoryDependencyCriticality;
50
+ required_version: string | null;
51
+ required_contract_hash: string | null;
52
+ failure_policy: RepositoryFailurePolicy;
53
+ description: string | null;
54
+ created_at: number | null;
55
+ updated_at: number | null;
56
+ }
@@ -0,0 +1,15 @@
1
+ // src/repository.ts
2
+ var REPOSITORY_STATUSES = ["active", "archived", "disabled"];
3
+ var REPOSITORY_CONTRACT_TYPES = ["api", "schema", "runtime", "cli", "event", "receipt", "package"];
4
+ var REPOSITORY_CONTRACT_STATUSES = ["active", "deprecated", "retired"];
5
+ var REPOSITORY_DEPENDENCY_TYPES = ["runtime", "build", "contract", "package", "deploy", "tool", "data"];
6
+ var REPOSITORY_DEPENDENCY_CRITICALITIES = ["informational", "compatible", "strict", "critical"];
7
+ var REPOSITORY_FAILURE_POLICIES = ["warn", "block_certification", "block_deploy", "degrade"];
8
+ export {
9
+ REPOSITORY_CONTRACT_STATUSES,
10
+ REPOSITORY_CONTRACT_TYPES,
11
+ REPOSITORY_DEPENDENCY_CRITICALITIES,
12
+ REPOSITORY_DEPENDENCY_TYPES,
13
+ REPOSITORY_FAILURE_POLICIES,
14
+ REPOSITORY_STATUSES
15
+ };
@@ -0,0 +1,113 @@
1
+ import type { AgentRunStatus } from './agent';
2
+ export type AgentRunSuspensionReason = 'external' | 'child_run' | 'approval' | 'input' | 'retry' | 'scheduled' | 'rate_limit';
3
+ export interface AgentRunSuspension {
4
+ runId: string;
5
+ state: 'waiting_external' | 'waiting_child' | 'awaiting_input' | 'awaiting_approval' | 'sleeping' | 'retry_scheduled';
6
+ reason: AgentRunSuspensionReason;
7
+ wakeAt?: number;
8
+ wakeEvent?: string;
9
+ dependencyRunIds?: string[];
10
+ attempt?: number;
11
+ resumeStepId?: string;
12
+ checkpointRef?: string;
13
+ expiresAt?: number;
14
+ metadata?: Record<string, unknown>;
15
+ }
16
+ export type AgentRunWakeKind = 'event' | 'dependency' | 'scheduled' | 'manual';
17
+ export interface AgentRunWakeSignal {
18
+ id: string;
19
+ runId: string;
20
+ kind: AgentRunWakeKind;
21
+ occurredAt: number;
22
+ dedupeKey: string;
23
+ eventKey?: string;
24
+ dependencyRunId?: string;
25
+ metadata?: Record<string, unknown>;
26
+ }
27
+ export type AgentRunRetryClass = 'transient' | 'wait' | 'replan' | 'terminal';
28
+ export interface AgentRunRetryClassificationInput {
29
+ code?: string | null;
30
+ statusCode?: number | null;
31
+ retryable?: boolean | null;
32
+ }
33
+ export interface AgentRunRetryClassification {
34
+ class: AgentRunRetryClass;
35
+ automaticRetry: boolean;
36
+ reason: string;
37
+ }
38
+ export declare function classifyAgentRunRetry(input?: AgentRunRetryClassificationInput): AgentRunRetryClassification;
39
+ export type AgentRunWakeDecisionReason = 'accepted' | 'duplicate' | 'run_mismatch' | 'expired' | 'condition_not_met';
40
+ export interface AgentRunWakeDecision {
41
+ accepted: boolean;
42
+ reason: AgentRunWakeDecisionReason;
43
+ nextStatus?: 'queued';
44
+ }
45
+ export declare function evaluateAgentRunWake(suspension: AgentRunSuspension, wake: AgentRunWakeSignal, options?: {
46
+ consumedDedupeKeys?: Iterable<string>;
47
+ now?: number;
48
+ }): AgentRunWakeDecision;
49
+ export declare function wakeMatchesSuspension(suspension: AgentRunSuspension, wake: AgentRunWakeSignal, now?: number): boolean;
50
+ export type AgentRunLifecycleAction = {
51
+ type: 'start';
52
+ } | {
53
+ type: 'suspend';
54
+ status: AgentRunSuspension['state'];
55
+ } | {
56
+ type: 'wake';
57
+ } | {
58
+ type: 'complete';
59
+ } | {
60
+ type: 'fail';
61
+ } | {
62
+ type: 'cancel';
63
+ } | {
64
+ type: 'timeout';
65
+ };
66
+ export declare function transitionAgentRunStatus(status: AgentRunStatus, action: AgentRunLifecycleAction): AgentRunStatus;
67
+ export type AgentRunEventType = 'run.created' | 'run.queued' | 'run.started' | 'run.status' | 'run.suspended' | 'run.woken' | 'run.cancel_requested' | 'run.cancelled' | 'run.timed_out' | 'run.failed' | 'run.completed' | 'step.started' | 'step.progress' | 'step.completed' | 'decision.made' | 'tool.started' | 'tool.completed' | 'artifact.created' | 'file.changed' | 'approval.required' | 'input.required' | 'verification.completed' | (string & {});
68
+ export type AgentActivityPhase = 'boot' | 'observe' | 'context' | 'plan' | 'execute' | 'verify' | 'compact' | 'waiting' | 'recover' | 'complete';
69
+ export type AgentActivityEventType = 'run.started' | 'phase.changed' | 'step.started' | 'step.progress' | 'step.completed' | 'decision.made' | 'tool.started' | 'tool.completed' | 'artifact.created' | 'file.changed' | 'approval.required' | 'input.required' | 'verification.completed' | 'run.failed' | 'run.completed';
70
+ export interface AgentRunEvent {
71
+ id: string;
72
+ runId: string;
73
+ parentRunId?: string;
74
+ seq: number;
75
+ eventType: AgentRunEventType;
76
+ status?: AgentRunStatus;
77
+ phase?: AgentActivityPhase;
78
+ stepId?: string;
79
+ label?: string;
80
+ detail?: string | null;
81
+ progress?: {
82
+ current: number;
83
+ total: number;
84
+ } | null;
85
+ source?: {
86
+ kind?: string;
87
+ name?: string | null;
88
+ } | null;
89
+ evidence?: Record<string, unknown> | null;
90
+ createdAt: number;
91
+ }
92
+ export interface AgentActivityEventV1 {
93
+ schema: 'agentsam.activity.v1';
94
+ run_id: string;
95
+ seq: number;
96
+ timestamp: string;
97
+ phase: AgentActivityPhase;
98
+ event: AgentActivityEventType;
99
+ step_id: string | null;
100
+ parent_id: string | null;
101
+ label: string;
102
+ detail: string | null;
103
+ progress: {
104
+ current: number;
105
+ total: number;
106
+ } | null;
107
+ source: {
108
+ kind: string;
109
+ name: string | null;
110
+ };
111
+ evidence: Record<string, unknown> | null;
112
+ }
113
+ export declare function projectRunEventToActivity(event: AgentRunEvent): AgentActivityEventV1;