@ziggs-ai/agent-sdk 0.10.7 → 0.11.0

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 (95) hide show
  1. package/CHANGELOG.md +11 -11
  2. package/dist/AgentHost.d.ts +15 -15
  3. package/dist/AgentHost.js +22 -22
  4. package/dist/adapters/AnthropicAdapter.js +1 -1
  5. package/dist/adapters/McpAdapter.d.ts +10 -10
  6. package/dist/adapters/McpAdapter.js +33 -21
  7. package/dist/adapters/OpenAIAdapter.js +1 -1
  8. package/dist/agent/Agent.d.ts +2 -2
  9. package/dist/agent/ClaudeSdkAgent.d.ts +6 -6
  10. package/dist/agent/ClaudeSdkAgent.js +25 -25
  11. package/dist/agent/claudeCognition.d.ts +3 -3
  12. package/dist/agent/claudeCognition.js +7 -7
  13. package/dist/agent/claudeSdkTools.d.ts +3 -3
  14. package/dist/agent/claudeSdkTools.js +9 -9
  15. package/dist/agent/hostedAgentConnection.d.ts +1 -1
  16. package/dist/agent/hostedAgentConnection.js +1 -1
  17. package/dist/agent/toolManagerToSdkMcp.d.ts +1 -1
  18. package/dist/agent/toolManagerToSdkMcp.js +2 -2
  19. package/dist/context/applyEffects.js +1 -1
  20. package/dist/defineAgent.js +2 -2
  21. package/dist/formatters/HistoryFormatter.js +2 -2
  22. package/dist/index.d.ts +1 -1
  23. package/dist/index.js +5 -5
  24. package/dist/ingress/normalizeIncoming.d.ts +1 -1
  25. package/dist/ingress/normalizeIncoming.js +7 -7
  26. package/dist/pricing/fleetDefaults.d.ts +3 -3
  27. package/dist/pricing/fleetDefaults.js +3 -3
  28. package/dist/pricing/fleetEvalFree.d.ts +1 -1
  29. package/dist/pricing/fleetEvalFree.js +1 -1
  30. package/dist/pricing/fleetFreeTierA.gen.d.ts +1 -1
  31. package/dist/pricing/fleetFreeTierA.gen.js +1 -1
  32. package/dist/pricing/fleetTierByAgentId.gen.d.ts +1 -1
  33. package/dist/runtime/AgentMachine.d.ts +1 -1
  34. package/dist/runtime/AgentMachine.js +8 -8
  35. package/dist/runtime/PromptBuilder.d.ts +2 -2
  36. package/dist/runtime/PromptBuilder.js +3 -3
  37. package/dist/runtime/bootstrapCtx.d.ts +1 -1
  38. package/dist/runtime/bootstrapCtx.js +2 -2
  39. package/dist/runtime/buildOutcome.d.ts +1 -1
  40. package/dist/runtime/buildOutcome.js +4 -4
  41. package/dist/runtime/defaults.d.ts +5 -5
  42. package/dist/runtime/defaults.js +4 -4
  43. package/dist/runtime/deliveryWriteKeys.d.ts +1 -1
  44. package/dist/runtime/deliveryWriteKeys.js +3 -3
  45. package/dist/runtime/kickoff.d.ts +3 -3
  46. package/dist/runtime/kickoff.js +3 -3
  47. package/dist/runtime/runMechanical.d.ts +1 -1
  48. package/dist/runtime/runMechanical.js +1 -1
  49. package/dist/runtime/runTurn.d.ts +1 -1
  50. package/dist/runtime/runTurn.js +10 -10
  51. package/dist/runtime/taskBookkeeping.d.ts +3 -3
  52. package/dist/runtime/taskBookkeeping.js +3 -3
  53. package/dist/runtime/taskIntake.js +2 -2
  54. package/dist/server/ConnectionPool.js +1 -1
  55. package/dist/server/EventQueue.d.ts +1 -1
  56. package/dist/server/EventQueue.js +1 -1
  57. package/dist/server/SeenMessages.d.ts +2 -2
  58. package/dist/server/SeenMessages.js +2 -2
  59. package/dist/server/ZiggsEffectHandler.d.ts +2 -2
  60. package/dist/server/ZiggsEffectHandler.js +8 -8
  61. package/dist/server/agreements/AgreementService.d.ts +3 -8
  62. package/dist/server/agreements/AgreementService.js +4 -7
  63. package/dist/server/inboxLoop.d.ts +5 -5
  64. package/dist/server/inboxLoop.js +21 -10
  65. package/dist/server/questMatch.d.ts +1 -1
  66. package/dist/server/questMatch.js +1 -1
  67. package/dist/server/runLauncher.js +3 -3
  68. package/dist/server/tools/index.d.ts +1 -0
  69. package/dist/server/tools/index.js +7 -6
  70. package/dist/server/tools/tier1/protocolRunner.d.ts +1 -1
  71. package/dist/server/tools/tier1/protocolRunner.js +19 -19
  72. package/dist/server/tools/tier1/protocolTools.js +5 -4
  73. package/dist/server/tools/tier2/artifactTools.js +2 -2
  74. package/dist/server/tools/tier2/chatTools.js +2 -2
  75. package/dist/server/tools/tier2/connectionTools.js +3 -3
  76. package/dist/server/tools/tier2/contextTools.js +1 -1
  77. package/dist/server/tools/tier2/discoveryTools.js +2 -2
  78. package/dist/server/tools/tier2/grantsTools.js +1 -1
  79. package/dist/server/tools/tier2/linkTools.js +3 -3
  80. package/dist/server/tools/tier2/marketplaceTools.js +1 -1
  81. package/dist/server/tools/tier2/mcpConnectionTools.d.ts +4 -0
  82. package/dist/server/tools/tier2/mcpConnectionTools.js +136 -0
  83. package/dist/server/tools/tier2/paymentTools.js +1 -1
  84. package/dist/shared/operatorKeyClaims.d.ts +2 -2
  85. package/dist/shared/operatorKeyClaims.js +1 -1
  86. package/dist/tasks/protocolRegistry.d.ts +1 -1
  87. package/dist/tasks/protocolRegistry.js +1 -1
  88. package/dist/tools/ToolManager.js +1 -1
  89. package/dist/tools/capabilityAdapter.d.ts +1 -1
  90. package/dist/tools/capabilityAdapter.js +3 -3
  91. package/dist/tools/defineTool.js +1 -1
  92. package/dist/tools/recordReport.d.ts +3 -3
  93. package/dist/tools/recordReport.js +3 -3
  94. package/dist/types.d.ts +17 -17
  95. package/package.json +3 -3
package/dist/types.d.ts CHANGED
@@ -70,7 +70,7 @@ export type Outcome = {
70
70
  } | {
71
71
  kind: 'task-closed';
72
72
  status: 'completed' | 'failed';
73
- /** Task being closed — required to clear only that entry (ZIG-977). */
73
+ /** Task being closed — required to clear only that entry. */
74
74
  taskId?: string;
75
75
  result?: unknown;
76
76
  } | {
@@ -95,7 +95,7 @@ export type Outcome = {
95
95
  */
96
96
  proposedByMe: boolean;
97
97
  /**
98
- * ZIG-1278 — true when the wake was a chat-less store/listing claim
98
+ * true when the wake was a chat-less store/listing claim
99
99
  * (`resource_changed` + `reason === 'proposal_approved'`). Distinguishes
100
100
  * the provider claim-kickoff (open chat + greet) from a direct-proposal
101
101
  * counterparty approve, which must never auto-kickoff.
@@ -162,7 +162,7 @@ export interface CollectedSubtaskResult {
162
162
  }
163
163
  /**
164
164
  * Per-assigned-task (or coordinator-lane) bookkeeping under one chat lane.
165
- * Keyed on Ctx.tasks by taskId (ZIG-977) — task-closed clears only its entry.
165
+ * Keyed on Ctx.tasks by taskId — task-closed clears only its entry.
166
166
  */
167
167
  export interface TaskBookkeeping {
168
168
  agreementId: string | null;
@@ -179,7 +179,7 @@ export interface TaskBookkeeping {
179
179
  * Task bookkeeping lives in `tasks` (keyed by taskId). `activeTaskId` /
180
180
  * `activeAgreementId` are the focus scalars for prompt + FSM convenience —
181
181
  * assigning task B no longer destroys task A's pending/collected state, and
182
- * closing A leaves B intact (ZIG-977).
182
+ * closing A leaves B intact.
183
183
  */
184
184
  export interface Ctx {
185
185
  identity: Identity;
@@ -276,7 +276,7 @@ export interface ThinkingState {
276
276
  allowNoWait?: boolean;
277
277
  }
278
278
  /**
279
- * ZIG-764: fixed tool invoke with no LLM turn. Entered after transitions
279
+ * fixed tool invoke with no LLM turn. Entered after transitions
280
280
  * (e.g. task-assigned → executing); runs `tool` once and emits `produces`.
281
281
  */
282
282
  export interface MechanicalState {
@@ -340,7 +340,7 @@ export interface ContextSnapshot {
340
340
  * 404'd) — deleted or never visible to this agent. Message-triggered wakes
341
341
  * check this and skip the LLM instead of reasoning over a fabricated empty
342
342
  * history. Only gates message wakes. A bare agreementId as sessionId also
343
- * trips it (ZIG-975) — that is a mis-keyed lane, not a legitimate task lane;
343
+ * trips it — that is a mis-keyed lane, not a legitimate task lane;
344
344
  * task wakes should key on the agreement's origin/notification chat.
345
345
  */
346
346
  chatMissing?: boolean;
@@ -364,7 +364,7 @@ export interface ToolCallResult {
364
364
  /**
365
365
  * Summed token usage of any nested LLM call the tool made (e.g. llmTool).
366
366
  * Threaded up so the turn's authoritative token count (machine.tokens ->
367
- * result.metrics) includes tool-internal spend rather than leaking it (ZIG-813).
367
+ * result.metrics) includes tool-internal spend rather than leaking it.
368
368
  */
369
369
  usage?: LlmResponse['usage'];
370
370
  }
@@ -385,7 +385,7 @@ export interface DeliveryWriteKeys {
385
385
  readonly wakeKey: string | null;
386
386
  /**
387
387
  * Key for an artifact write of this wake. Pass the artifact's content so the
388
- * key is derived from it (ZIG-1045 semantics): a wake writing several
388
+ * key is derived from it (semantics): a wake writing several
389
389
  * artifacts gets several keys, and a redelivered wake that re-writes the same
390
390
  * content reuses its key instead of colliding on an ordinal slot and being
391
391
  * discarded. Omitting content falls back to a per-wake ordinal — call exactly
@@ -397,7 +397,7 @@ export interface DeliveryWriteKeys {
397
397
  /**
398
398
  * Default messageId for a chat-message send of this wake — the backend dedups
399
399
  * on (chatId, messageId). Derived from the emission's content (text + chat +
400
- * receiver), not a per-wake ordinal (ZIG-1045): a wake that says two things
400
+ * receiver), not a per-wake ordinal: a wake that says two things
401
401
  * gets two keys, and a redelivered wake that re-says the same text reuses the
402
402
  * same key, while a re-think with different text does not collide and drop.
403
403
  */
@@ -437,11 +437,11 @@ export type Effect = {
437
437
  kind: 'llm-call';
438
438
  messages: LlmMessage[];
439
439
  tools: LlmToolSchema[];
440
- /** Chat/session id for monitoring ingest (ZIG-360). */
440
+ /** Chat/session id for monitoring ingest. */
441
441
  sessionId?: string;
442
- /** Per-turn UUID grouping all LLM + tool calls in one turn (ZIG-440). */
442
+ /** Per-turn UUID grouping all LLM + tool calls in one turn. */
443
443
  runId?: string;
444
- /** FSM state name at the time of this call (ZIG-440). */
444
+ /** FSM state name at the time of this call. */
445
445
  stateId?: string;
446
446
  } | {
447
447
  kind: 'stream-text';
@@ -459,15 +459,15 @@ export type Effect = {
459
459
  senderId?: string;
460
460
  senderType?: string;
461
461
  /**
462
- * Agreement this tool call is acting under (ZIG-831). For a delegated
462
+ * Agreement this tool call is acting under. For a delegated
463
463
  * per-user MCP call, `senderId` is the delegating agent, not the end-user
464
464
  * who owns the connection; this lets the gateway resolve the delegation
465
465
  * root's user. Sourced from the waking task event's `result.agreementId`.
466
466
  */
467
467
  onBehalfOfAgreementId?: string;
468
- /** Per-turn UUID (ZIG-440). */
468
+ /** Per-turn UUID. */
469
469
  runId?: string;
470
- /** FSM state name (ZIG-440). */
470
+ /** FSM state name. */
471
471
  stateId?: string;
472
472
  /** Replay-stable write keys for this wake — write-capable tools derive their idempotency key from here, never from the LLM. */
473
473
  writeKeys?: DeliveryWriteKeys;
@@ -484,7 +484,7 @@ export type Effect = {
484
484
  idempotencyKey?: string;
485
485
  };
486
486
  /**
487
- * Typed result map. With this shape, `await eff({ kind: 'read-context', ... })`
487
+ * Typed result map. With this shape, `await eff({ kind: 'read-context', .. })`
488
488
  * resolves to `ContextSnapshot`, not a union — the discriminant carries the
489
489
  * result type. Tests and Server impls implement this map exhaustively.
490
490
  */
@@ -520,7 +520,7 @@ export interface DefineAgentInput {
520
520
  /**
521
521
  * Human-facing one-liner: what this agent does, for a buyer reading the store
522
522
  * row. NOT the system prompt — a claude-sdk agent puts its prompt in
523
- * `systemPrompt` (ZIG-1080: every claude-sdk agent used to pass its prompt
523
+ * `systemPrompt` (every claude-sdk agent used to pass its prompt
524
524
  * here, and `deriveAgentRecord` published it straight to the store).
525
525
  */
526
526
  description: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ziggs-ai/agent-sdk",
3
- "version": "0.10.7",
3
+ "version": "0.11.0",
4
4
  "description": "Agent framework SDK for building autonomous agents on the Ziggs platform",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -17,7 +17,7 @@
17
17
  },
18
18
  "scripts": {
19
19
  "build": "tsc -p tsconfig.json",
20
- "prepack": "npm run build",
20
+ "prepack": "rm -rf dist && npm run build",
21
21
  "typecheck": "tsc -p tsconfig.json --noEmit",
22
22
  "test": "node --experimental-test-module-mocks --import tsx/esm --test --test-reporter=spec test/*.test.ts",
23
23
  "test:watch": "node --experimental-test-module-mocks --import tsx/esm --test --watch test/*.test.ts"
@@ -26,7 +26,7 @@
26
26
  "@anthropic-ai/claude-agent-sdk": "^0.3.204",
27
27
  "@anthropic-ai/sdk": "^0.110.0",
28
28
  "@modelcontextprotocol/sdk": "^1.29.0",
29
- "@ziggs-ai/api-client": "0.9.7",
29
+ "@ziggs-ai/api-client": "0.10.0",
30
30
  "ajv": "^8.17.1",
31
31
  "dotenv": "^17.2.3",
32
32
  "openai": "^4.0.0",