@ziggs-ai/agent-sdk 0.1.12 → 0.2.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 (218) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/README.md +41 -2
  3. package/dist/AgentHost.d.ts +201 -0
  4. package/dist/AgentHost.js +652 -0
  5. package/dist/adapters/AnthropicAdapter.d.ts +39 -0
  6. package/dist/adapters/AnthropicAdapter.js +200 -0
  7. package/dist/adapters/McpAdapter.d.ts +199 -0
  8. package/dist/adapters/McpAdapter.js +468 -0
  9. package/dist/adapters/OpenAIAdapter.d.ts +26 -0
  10. package/dist/adapters/OpenAIAdapter.js +158 -0
  11. package/dist/adapters/index.js +2 -0
  12. package/dist/agent/Agent.d.ts +78 -0
  13. package/dist/agent/Agent.js +58 -0
  14. package/dist/agent/ClaudeSdkAgent.d.ts +38 -0
  15. package/dist/agent/ClaudeSdkAgent.js +322 -0
  16. package/dist/agent/claudeCognition.d.ts +67 -0
  17. package/dist/agent/claudeCognition.js +103 -0
  18. package/dist/agent/claudeSdkProtocol.d.ts +11 -0
  19. package/dist/agent/claudeSdkTools.d.ts +19 -0
  20. package/dist/agent/claudeSdkTools.js +57 -0
  21. package/dist/agent/hostedAgentConnection.d.ts +15 -0
  22. package/dist/agent/hostedAgentConnection.js +29 -0
  23. package/dist/agent/toolManagerToSdkMcp.d.ts +12 -0
  24. package/dist/agent/toolManagerToSdkMcp.js +123 -0
  25. package/dist/brain/index.d.ts +50 -0
  26. package/dist/brain/index.js +45 -0
  27. package/dist/cognition/validateContext.d.ts +11 -0
  28. package/dist/cognition/validateContext.js +117 -0
  29. package/dist/context/applyEffects.d.ts +2 -0
  30. package/dist/context/applyEffects.js +89 -0
  31. package/dist/context/batch.d.ts +2 -0
  32. package/dist/context/batch.js +18 -0
  33. package/dist/context/classifyEnvelope.d.ts +1 -0
  34. package/dist/context/classifyEnvelope.js +58 -0
  35. package/dist/context/routingLabels.d.ts +4 -0
  36. package/dist/context/routingLabels.js +48 -0
  37. package/dist/defineAgent.d.ts +14 -0
  38. package/dist/defineAgent.js +68 -0
  39. package/dist/formatters/AgreementFormatter.d.ts +18 -0
  40. package/dist/formatters/AgreementFormatter.js +130 -0
  41. package/dist/formatters/HistoryFormatter.d.ts +26 -0
  42. package/dist/formatters/HistoryFormatter.js +173 -0
  43. package/dist/formatters/index.js +2 -0
  44. package/{src/index.ts → dist/index.d.ts} +7 -53
  45. package/dist/index.js +66 -0
  46. package/dist/ingress/normalizeIncoming.d.ts +65 -0
  47. package/dist/ingress/normalizeIncoming.js +88 -0
  48. package/dist/memory/MemoryStore.d.ts +55 -0
  49. package/dist/memory/MemoryStore.js +78 -0
  50. package/dist/pricing/fleetDefaults.d.ts +46 -0
  51. package/dist/pricing/fleetDefaults.js +168 -0
  52. package/dist/pricing/fleetEvalFree.d.ts +7 -0
  53. package/dist/pricing/fleetEvalFree.js +24 -0
  54. package/dist/pricing/fleetFreeTierA.gen.d.ts +6 -0
  55. package/{src/pricing/fleetFreeTierA.gen.ts → dist/pricing/fleetFreeTierA.gen.js} +5 -6
  56. package/dist/pricing/fleetTierByAgentId.gen.d.ts +7 -0
  57. package/dist/pricing/fleetTierByAgentId.gen.js +768 -0
  58. package/dist/runtime/AgentMachine.d.ts +143 -0
  59. package/dist/runtime/AgentMachine.js +400 -0
  60. package/dist/runtime/PromptBuilder.d.ts +96 -0
  61. package/dist/runtime/PromptBuilder.js +439 -0
  62. package/{src/runtime/bootstrapCtx.ts → dist/runtime/bootstrapCtx.d.ts} +1 -22
  63. package/dist/runtime/bootstrapCtx.js +37 -0
  64. package/dist/runtime/buildOutcome.d.ts +68 -0
  65. package/dist/runtime/buildOutcome.js +464 -0
  66. package/dist/runtime/defaults.d.ts +54 -0
  67. package/dist/runtime/defaults.js +47 -0
  68. package/dist/runtime/deriveRespondsToProposals.d.ts +9 -0
  69. package/dist/runtime/deriveRespondsToProposals.js +38 -0
  70. package/dist/runtime/kickoff.d.ts +15 -0
  71. package/dist/runtime/kickoff.js +112 -0
  72. package/dist/runtime/runMechanical.d.ts +25 -0
  73. package/dist/runtime/runMechanical.js +74 -0
  74. package/dist/runtime/runTurn.d.ts +63 -0
  75. package/dist/runtime/runTurn.js +800 -0
  76. package/dist/runtime/validateWorkflow.d.ts +17 -0
  77. package/dist/runtime/validateWorkflow.js +209 -0
  78. package/dist/server/ConnectionPool.d.ts +68 -0
  79. package/dist/server/ConnectionPool.js +166 -0
  80. package/dist/server/EventQueue.d.ts +33 -0
  81. package/dist/server/EventQueue.js +98 -0
  82. package/dist/server/InboxCatchUp.d.ts +24 -0
  83. package/dist/server/InboxCatchUp.js +213 -0
  84. package/dist/server/OutboxBuffer.d.ts +33 -0
  85. package/dist/server/OutboxBuffer.js +68 -0
  86. package/dist/server/SeenMessages.d.ts +13 -0
  87. package/dist/server/SeenMessages.js +31 -0
  88. package/dist/server/StateTimers.d.ts +34 -0
  89. package/dist/server/StateTimers.js +70 -0
  90. package/dist/server/ZiggsEffectHandler.d.ts +79 -0
  91. package/dist/server/ZiggsEffectHandler.js +319 -0
  92. package/dist/server/agreements/AgreementService.d.ts +50 -0
  93. package/dist/server/agreements/AgreementService.js +85 -0
  94. package/dist/server/createHealthServer.d.ts +7 -0
  95. package/dist/server/createHealthServer.js +75 -0
  96. package/dist/server/proactive/ProactiveTrigger.d.ts +33 -0
  97. package/dist/server/proactive/ProactiveTrigger.js +71 -0
  98. package/dist/server/runLauncher.d.ts +28 -0
  99. package/dist/server/runLauncher.js +93 -0
  100. package/dist/server/tasks/TaskService.d.ts +25 -0
  101. package/dist/server/tasks/TaskService.js +103 -0
  102. package/dist/server/tasks/index.js +1 -0
  103. package/dist/server/telemetryIngest.d.ts +24 -0
  104. package/dist/server/telemetryIngest.js +62 -0
  105. package/dist/server/tools/index.d.ts +24 -0
  106. package/{src/server/tools/index.ts → dist/server/tools/index.js} +4 -24
  107. package/dist/server/tools/tier1/protocolRunner.d.ts +39 -0
  108. package/dist/server/tools/tier1/protocolRunner.js +288 -0
  109. package/dist/server/tools/tier1/protocolTools.d.ts +12 -0
  110. package/dist/server/tools/tier1/protocolTools.js +37 -0
  111. package/dist/server/tools/tier2/connectionTools.d.ts +4 -0
  112. package/dist/server/tools/tier2/connectionTools.js +63 -0
  113. package/dist/server/tools/tier2/contextTools.d.ts +4 -0
  114. package/dist/server/tools/tier2/contextTools.js +46 -0
  115. package/dist/server/tools/tier2/discoveryTools.d.ts +4 -0
  116. package/dist/server/tools/tier2/discoveryTools.js +25 -0
  117. package/dist/server/tools/tier2/marketplaceTools.d.ts +3 -0
  118. package/dist/server/tools/tier2/marketplaceTools.js +22 -0
  119. package/dist/server/tools/tier2/paymentTools.d.ts +12 -0
  120. package/dist/server/tools/tier2/paymentTools.js +165 -0
  121. package/dist/server/ziggsconnect/ZiggsConnectClient.d.ts +35 -0
  122. package/dist/server/ziggsconnect/ZiggsConnectClient.js +95 -0
  123. package/dist/server/ziggscontext/ZiggsContextClient.d.ts +48 -0
  124. package/dist/server/ziggscontext/ZiggsContextClient.js +90 -0
  125. package/dist/server/ziggspay/ZiggsPayClient.d.ts +82 -0
  126. package/dist/server/ziggspay/ZiggsPayClient.js +188 -0
  127. package/dist/shared/ids.d.ts +1 -0
  128. package/dist/shared/ids.js +3 -0
  129. package/dist/shared/runtimeLog.d.ts +18 -0
  130. package/dist/shared/runtimeLog.js +68 -0
  131. package/dist/shared/types.d.ts +22 -0
  132. package/dist/shared/types.js +23 -0
  133. package/dist/tasks/protocolRegistry.d.ts +16 -0
  134. package/dist/tasks/protocolRegistry.js +20 -0
  135. package/dist/tools/ToolManager.d.ts +12 -0
  136. package/dist/tools/ToolManager.js +74 -0
  137. package/dist/tools/ToolProvider.d.ts +6 -0
  138. package/dist/tools/ToolProvider.js +21 -0
  139. package/dist/tools/defineTool.d.ts +27 -0
  140. package/dist/tools/defineTool.js +62 -0
  141. package/{src/tools/index.ts → dist/tools/index.d.ts} +0 -1
  142. package/dist/tools/index.js +6 -0
  143. package/dist/tools/recordReport.d.ts +41 -0
  144. package/dist/tools/recordReport.js +30 -0
  145. package/dist/types.d.ts +466 -0
  146. package/dist/types.js +7 -0
  147. package/dist/utils/jsonExtractor.d.ts +2 -0
  148. package/dist/utils/jsonExtractor.js +111 -0
  149. package/package.json +13 -5
  150. package/src/AgentHost.ts +0 -814
  151. package/src/adapters/AnthropicAdapter.ts +0 -238
  152. package/src/adapters/McpAdapter.ts +0 -678
  153. package/src/adapters/OpenAIAdapter.ts +0 -194
  154. package/src/agent/Agent.ts +0 -112
  155. package/src/agent/ClaudeSdkAgent.ts +0 -401
  156. package/src/agent/claudeCognition.ts +0 -139
  157. package/src/agent/claudeSdkTools.ts +0 -81
  158. package/src/agent/hostedAgentConnection.ts +0 -41
  159. package/src/agent/toolManagerToSdkMcp.ts +0 -136
  160. package/src/cognition/validateContext.ts +0 -95
  161. package/src/context/applyEffects.ts +0 -80
  162. package/src/context/batch.ts +0 -19
  163. package/src/context/classifyEnvelope.ts +0 -38
  164. package/src/context/routingLabels.ts +0 -46
  165. package/src/defineAgent.ts +0 -77
  166. package/src/formatters/AgreementFormatter.ts +0 -111
  167. package/src/formatters/HistoryFormatter.ts +0 -172
  168. package/src/ingress/normalizeIncoming.ts +0 -162
  169. package/src/memory/MemoryStore.ts +0 -104
  170. package/src/pricing/fleetDefaults.ts +0 -225
  171. package/src/pricing/fleetEvalFree.ts +0 -24
  172. package/src/pricing/fleetTierByAgentId.gen.ts +0 -775
  173. package/src/runtime/AgentMachine.ts +0 -484
  174. package/src/runtime/PromptBuilder.ts +0 -522
  175. package/src/runtime/buildOutcome.ts +0 -563
  176. package/src/runtime/defaults.ts +0 -86
  177. package/src/runtime/deriveRespondsToProposals.ts +0 -35
  178. package/src/runtime/kickoff.ts +0 -117
  179. package/src/runtime/runMechanical.ts +0 -106
  180. package/src/runtime/runTurn.ts +0 -870
  181. package/src/runtime/validateWorkflow.ts +0 -221
  182. package/src/server/ConnectionPool.ts +0 -206
  183. package/src/server/EventQueue.ts +0 -133
  184. package/src/server/InboxCatchUp.ts +0 -291
  185. package/src/server/OutboxBuffer.ts +0 -90
  186. package/src/server/SeenMessages.ts +0 -27
  187. package/src/server/StateTimers.ts +0 -85
  188. package/src/server/ZiggsEffectHandler.ts +0 -427
  189. package/src/server/agreements/AgreementService.ts +0 -118
  190. package/src/server/createHealthServer.ts +0 -85
  191. package/src/server/proactive/ProactiveTrigger.ts +0 -83
  192. package/src/server/runLauncher.ts +0 -146
  193. package/src/server/tasks/TaskService.ts +0 -111
  194. package/src/server/telemetryIngest.ts +0 -91
  195. package/src/server/tools/tier1/protocolRunner.ts +0 -353
  196. package/src/server/tools/tier1/protocolTools.ts +0 -114
  197. package/src/server/tools/tier2/connectionTools.ts +0 -75
  198. package/src/server/tools/tier2/contextTools.ts +0 -63
  199. package/src/server/tools/tier2/discoveryTools.ts +0 -34
  200. package/src/server/tools/tier2/marketplaceTools.ts +0 -27
  201. package/src/server/tools/tier2/paymentTools.ts +0 -170
  202. package/src/server/ziggsconnect/ZiggsConnectClient.ts +0 -126
  203. package/src/server/ziggscontext/ZiggsContextClient.ts +0 -129
  204. package/src/server/ziggspay/ZiggsPayClient.ts +0 -193
  205. package/src/shared/ids.ts +0 -3
  206. package/src/shared/runtimeLog.ts +0 -72
  207. package/src/shared/types.ts +0 -29
  208. package/src/tasks/protocolRegistry.ts +0 -25
  209. package/src/tools/ToolManager.ts +0 -95
  210. package/src/tools/ToolProvider.ts +0 -19
  211. package/src/tools/defineTool.ts +0 -90
  212. package/src/tools/recordReport.ts +0 -82
  213. package/src/types.ts +0 -483
  214. package/src/utils/jsonExtractor.ts +0 -100
  215. /package/{src/adapters/index.ts → dist/adapters/index.d.ts} +0 -0
  216. /package/{src/agent/claudeSdkProtocol.ts → dist/agent/claudeSdkProtocol.js} +0 -0
  217. /package/{src/formatters/index.ts → dist/formatters/index.d.ts} +0 -0
  218. /package/{src/server/tasks/index.ts → dist/server/tasks/index.d.ts} +0 -0
@@ -1,353 +0,0 @@
1
- import type { AgreementService } from '../../agreements/AgreementService.js';
2
- import type { TaskService } from '../../tasks/TaskService.js';
3
- import type { ContextReadClient } from '@ziggs-ai/api-client';
4
- import {
5
- applyFleetCounterPricing,
6
- applyFleetPricingForProtocol,
7
- } from '../../../pricing/fleetDefaults.js';
8
-
9
- // Map legacy task-state aliases onto the canonical set.
10
- function normalizeState(state: string): string {
11
- if (state === 'done') return 'completed';
12
- if (state === 'error') return 'failed';
13
- return state;
14
- }
15
-
16
- interface Services {
17
- agreementService: AgreementService;
18
- taskService: TaskService;
19
- contextReadClient: ContextReadClient;
20
- }
21
-
22
- interface ProtocolPayload {
23
- operation?: string;
24
- agreementId?: string;
25
- description?: string;
26
- proposedTo?: string;
27
- providerId?: string;
28
- executorId?: string;
29
- action?: 'approve' | 'reject';
30
- price?: number;
31
- lifecycle?: string;
32
- expiresAt?: string;
33
- maxExecutions?: number;
34
- agreementDescription?: string;
35
- parentAgreementId?: string;
36
- parentTaskId?: string;
37
- taskId?: string;
38
- stepId?: string;
39
- assigneeId?: string;
40
- status?: string;
41
- result?: unknown;
42
- plan?: unknown;
43
- planReviewTiming?: string;
44
- requireMidWorkPlanAck?: boolean;
45
- engagementKind?: 'hire' | 'service';
46
- subtasks?: (string | { description?: string })[];
47
- [key: string]: unknown;
48
- }
49
-
50
- // ZIG-793: the `plan` tool-schema is underspecified (`plan: {type:'object'}`,
51
- // `planReviewTiming: 'string'`), so the LLM emits steps missing stepId/order and an
52
- // out-of-enum planReviewTiming, which the backend DTO rejects. Normalize in-place here
53
- // so every op (propose / subcontract / counter / task-spawn) sends a valid plan.
54
- function normalizePlanInPlace(payload: ProtocolPayload): void {
55
- const plan = payload.plan as { steps?: unknown } | undefined;
56
- if (plan && Array.isArray(plan.steps)) {
57
- plan.steps = plan.steps.map((s, i) => {
58
- const step =
59
- s && typeof s === 'object'
60
- ? (s as Record<string, unknown>)
61
- : { description: String(s) };
62
- return {
63
- ...step,
64
- stepId:
65
- typeof step.stepId === 'string' && step.stepId ? step.stepId : `step-${i + 1}`,
66
- order: typeof step.order === 'number' ? step.order : i,
67
- description:
68
- typeof step.description === 'string'
69
- ? step.description
70
- : String(step.description ?? ''),
71
- };
72
- });
73
- }
74
- if (
75
- payload.planReviewTiming !== undefined &&
76
- payload.planReviewTiming !== 'with_proposal' &&
77
- payload.planReviewTiming !== 'before_execution'
78
- ) {
79
- payload.planReviewTiming = 'with_proposal';
80
- }
81
- }
82
-
83
- export async function dispatchProtocolOp(
84
- services: Services,
85
- payload: ProtocolPayload,
86
- chatId: string | null,
87
- agents: unknown[] = [],
88
- actingAgentId: string | null = null,
89
- ): Promise<unknown> {
90
- if (!payload?.operation) return null;
91
- normalizePlanInPlace(payload);
92
- const { operation } = payload;
93
- const { agreementService, taskService } = services;
94
- const actorId = actingAgentId?.trim() || null;
95
-
96
- switch (operation) {
97
- case 'agreement-propose':
98
- return proposeAgreement(services, payload, chatId, agents, actorId);
99
- case 'agreement-subcontract':
100
- return subcontractAgreement(services, payload, chatId, agents, actorId);
101
- case 'agreement-respond':
102
- if (!payload.agreementId || !payload.action) return null;
103
- return agreementService.respond(payload.agreementId, payload.action);
104
- case 'agreement-counter-proposal':
105
- if (!payload.agreementId) return null;
106
- {
107
- const counterPayload =
108
- actorId != null
109
- ? applyFleetCounterPricing(payload, actorId)
110
- : payload;
111
- return agreementService.counter(payload.agreementId, {
112
- price: counterPayload.price,
113
- agreementDescription: counterPayload.agreementDescription,
114
- expiresAt: counterPayload.expiresAt,
115
- lifecycle: counterPayload.lifecycle,
116
- maxExecutions: counterPayload.maxExecutions,
117
- description: counterPayload.description,
118
- plan: counterPayload.plan,
119
- planReviewTiming: counterPayload.planReviewTiming as import('@ziggs-ai/api-client').PlanReviewTiming | undefined,
120
- requireMidWorkPlanAck: counterPayload.requireMidWorkPlanAck,
121
- });
122
- }
123
- case 'agreement-check-proposal':
124
- if (!payload.agreementId) return null;
125
- return agreementService.getStatus(payload.agreementId);
126
- case 'agreement-revoke':
127
- if (!payload.agreementId) return null;
128
- return agreementService.revoke(payload.agreementId);
129
- case 'agreement-fulfill':
130
- if (!payload.agreementId) return null;
131
- return agreementService.fulfill(payload.agreementId);
132
- case 'task-spawn': {
133
- if (!payload.agreementId || !payload.description) return null;
134
- let spawnAgreementId = payload.agreementId;
135
- const ags = await agreementsInChat(services, chatId);
136
- // b2 (ZIG-832): if the assignee is not a party on the cited agreement,
137
- // redirect the spawn to the ACTIVE sub-agreement (same root) where the
138
- // assignee IS the provider — the orchestrator often cites the top-level
139
- // hire, which the backend rejects with "assignee not a party".
140
- // ZIG-858: also redirect when the cited agreement is no longer active —
141
- // a count-bound sub fulfills after its quota (default 1), and the LLM
142
- // keeps citing that now-terminal sub for the next spawn even when a
143
- // fresh active sub for the same executor exists.
144
- if (payload.assigneeId) {
145
- const cited = ags.find((a) => a.agreementId === payload.agreementId);
146
- if (cited && (!agIsParty(cited, payload.assigneeId) || !agIsActiveStatus(cited))) {
147
- const root = cited.rootAgreementId || payload.agreementId;
148
- const sub = ags.find(
149
- (a) => agIsActiveStatus(a) && agIsProvider(a, payload.assigneeId as string) &&
150
- (a.rootAgreementId === root || a.parentAgreementId === payload.agreementId ||
151
- a.parentAgreementId === root),
152
- );
153
- if (sub?.agreementId) spawnAgreementId = sub.agreementId;
154
- }
155
- }
156
- // Safety guard (ZIG-832, B): a spawn against an agreement that is not active,
157
- // or whose assignee is not a party on it, hard-400s at the backend AND makes
158
- // the worker invent a "connection needed" message. That happens when the
159
- // orchestrator spawns before its sub-agreement is subcontracted/approved.
160
- // Skip GRACEFULLY instead — the sub-agreement's activation event will wake
161
- // the orchestrator to spawn correctly on a later turn, no 400, no cascade.
162
- const target = ags.find((a) => a.agreementId === spawnAgreementId);
163
- // ZIG-858: a TERMINAL target is not the same as a not-yet-active one — no
164
- // activation event will ever arrive, so the "wait for a later turn" skip
165
- // below would stall the run. Tell the caller the actionable next step:
166
- // subcontract a fresh sub for this executor, then spawn under it.
167
- if (target && TERMINAL_STATUS.has(String(target.status))) {
168
- return {
169
- ok: false,
170
- skipped: 'spawn-target-terminal',
171
- reason: `agreement ${spawnAgreementId} is ${target.status} (terminal — its quota or term is exhausted). Subcontract a new sub-agreement to ${payload.assigneeId ?? 'the executor'}, then spawn this task under that new agreement.`,
172
- agreementId: spawnAgreementId,
173
- };
174
- }
175
- const notReady =
176
- (target && !agIsActiveStatus(target)) ||
177
- (!!payload.assigneeId && target && !agIsParty(target, payload.assigneeId));
178
- if (notReady) {
179
- return {
180
- ok: false,
181
- skipped: 'spawn-target-not-ready',
182
- reason: target && !agIsActiveStatus(target)
183
- ? `agreement ${spawnAgreementId} is ${target?.status ?? 'unknown'} (not active yet)`
184
- : `assignee is not a party on ${spawnAgreementId} yet — subcontract to it first`,
185
- agreementId: spawnAgreementId,
186
- };
187
- }
188
- return taskService.spawnUnderAgreement(spawnAgreementId, {
189
- description: payload.description,
190
- parentTaskId: payload.parentTaskId,
191
- plan: payload.plan,
192
- planReviewTiming: payload.planReviewTiming,
193
- requireMidWorkPlanAck: payload.requireMidWorkPlanAck,
194
- assigneeId: payload.assigneeId,
195
- inputArtifactIds: Array.isArray(payload.inputArtifactIds)
196
- ? (payload.inputArtifactIds as string[])
197
- : undefined,
198
- });
199
- }
200
- case 'task-update':
201
- if (!payload.taskId || !payload.status) return null;
202
- return taskService.updateState(payload.taskId, normalizeState(payload.status) as Parameters<typeof taskService.updateState>[1], payload.result);
203
- case 'task-update-plan-step':
204
- if (!payload.taskId) throw new Error('task-update-plan-step requires `taskId`');
205
- if (!payload.stepId) throw new Error('task-update-plan-step requires `stepId`');
206
- if (!payload.status) throw new Error('task-update-plan-step requires `status`');
207
- // ZIG-793: a plan-step tick is cosmetic progress. Worker subtasks usually
208
- // have NO plan (only the orchestrator's job task does), and the LLM may tick
209
- // a stepId that isn't in the plan — the backend 400s on both. That must never
210
- // hard-fail the tool → fail the task → wake-loop. Make it best-effort.
211
- try {
212
- return await taskService.updatePlanStep(
213
- payload.taskId,
214
- payload.stepId,
215
- payload.status,
216
- payload.result,
217
- );
218
- } catch {
219
- return { ok: false, skipped: 'plan-step-not-updatable', stepId: payload.stepId };
220
- }
221
- default:
222
- throw new Error(`Unknown protocol operation: ${operation}`);
223
- }
224
- }
225
-
226
- async function proposeAgreement(
227
- services: Services,
228
- payload: ProtocolPayload,
229
- chatId: string | null,
230
- _agents: unknown[],
231
- actingAgentId: string | null,
232
- ): Promise<unknown> {
233
- if (!payload.description) throw new Error('agreement-propose requires `description`');
234
- if (!payload.proposedTo) throw new Error('agreement-propose requires `proposedTo` (userId or agentId). To spawn a task under an existing agreement, use `task_spawn` instead.');
235
- const isBroadcast = payload.proposedTo === 'everyone' || payload.proposedTo === 'org';
236
- if (!isBroadcast && !payload.providerId) {
237
- throw new Error(
238
- 'agreement-propose requires `providerId` — name who does the work: your own id (you are offering to work) or the proposedTo id (you are commissioning the recipient).',
239
- );
240
- }
241
- if (isBroadcast && payload.providerId) {
242
- throw new Error(
243
- 'agreement-propose forbids `providerId` on a broadcast — the claiming agent fills the open side.',
244
- );
245
- }
246
- const priced = applyFleetPricingForProtocol('agreement-propose', payload, actingAgentId);
247
- const { operation: _op, ...fields } = priced;
248
- return services.agreementService.propose({ ...fields, chatId } as Parameters<typeof services.agreementService.propose>[0]);
249
- }
250
-
251
- // ── ZIG-832: deterministic sub-agreement resolution ─────────────────────────
252
- // The orchestrator delegates one task per worker, but the LLM inconsistently
253
- // (a) re-subcontracts the same worker (duplicate sub-agreements) and (b)
254
- // task_spawns a worker under the TOP-LEVEL hire — where the worker is not a
255
- // party — instead of under that worker's sub-agreement, which the backend
256
- // rejects with 400 "assignee is not a party". Both are made deterministic here
257
- // using the chat's existing agreements.
258
- const TERMINAL_STATUS = new Set(['fulfilled', 'cancelled', 'refunded', 'rejected']);
259
- type AgLike = Record<string, unknown> & {
260
- agreementId?: string; status?: string; rootAgreementId?: string;
261
- parentAgreementId?: string; parties?: Record<string, unknown>;
262
- };
263
- async function agreementsInChat(services: Services, chatId: string | null): Promise<AgLike[]> {
264
- if (!chatId) return [];
265
- try {
266
- const snap = await services.contextReadClient.snapshot(chatId, { maxMessages: 1 });
267
- const ags = snap.agreements;
268
- return Array.isArray(ags) ? (ags as AgLike[]) : [];
269
- } catch {
270
- return [];
271
- }
272
- }
273
- function agIsProvider(a: AgLike, agentId: string): boolean {
274
- const p = a.parties ?? {};
275
- return p['provider'] === agentId || p['providerAgent'] === agentId || a['providerId'] === agentId;
276
- }
277
- function agIsParty(a: AgLike, agentId: string): boolean {
278
- const p = a.parties ?? {};
279
- return ['provider', 'providerAgent', 'payer', 'proposedTo', 'creator', 'creatorAgent']
280
- .some((k) => p[k] === agentId);
281
- }
282
- function agActive(a: AgLike): boolean {
283
- return !a.status || !TERMINAL_STATUS.has(String(a.status));
284
- }
285
- // Spawnable = actually ACTIVE. A freshly-subcontracted sub is `draft` until its
286
- // counterparty auto-approves; spawning under a draft (or citing an agreement the
287
- // assignee isn't a party on) 400s and cascades into a bogus worker "connection
288
- // needed" message. We treat only 'active' as spawnable (ZIG-832).
289
- function agIsActiveStatus(a: AgLike): boolean {
290
- return String(a.status ?? '') === 'active';
291
- }
292
-
293
- async function subcontractAgreement(
294
- services: Services,
295
- payload: ProtocolPayload,
296
- chatId: string | null,
297
- _agents: unknown[],
298
- actingAgentId: string | null,
299
- ): Promise<unknown> {
300
- if (!payload.description || !payload.executorId) return null;
301
- // b1 (ZIG-832): idempotent subcontract — if a non-terminal sub-agreement for
302
- // this executor already exists under the same parent, reuse it instead of
303
- // creating a duplicate (which bloats the chain and blocks the fulfill cascade).
304
- if (chatId) {
305
- const parent = payload.parentAgreementId;
306
- const existing = (await agreementsInChat(services, chatId)).find(
307
- (a) => agActive(a) && agIsProvider(a, payload.executorId as string) &&
308
- (!parent || a.parentAgreementId === parent || a.rootAgreementId === parent),
309
- );
310
- if (existing?.agreementId) return existing;
311
- }
312
- const priced = applyFleetPricingForProtocol('agreement-subcontract', payload, actingAgentId);
313
- const { operation: _op, ...fields } = priced;
314
- // ZIG-832: a subcontract must carry a working close condition, or it hangs
315
- // 'active' forever — and because the backend only auto-fulfills a parent hire
316
- // once every child sub-agreement is terminal (the fulfill cascade), one
317
- // never-closing child leaves the whole engagement open. Deciding lifecycle is
318
- // left to the model, which under load (context bloat, competing wakes) emits
319
- // incomplete terms — e.g. time-bound with no expiresAt and no maxExecutions —
320
- // that never reach fulfillment. Make the common single-delegated-task case
321
- // deterministic: if the caller gave neither a real quota nor a real deadline,
322
- // treat it as one count-bound execution so completing that task closes the
323
- // sub — which then cascades the parent closed. A genuinely durable subcontract
324
- // still opts out by setting maxExecutions>1 or a time-bound expiresAt.
325
- const f = fields as { lifecycle?: string; maxExecutions?: number | string; expiresAt?: string };
326
- // ZIG-858: repair incomplete terms instead of clobbering them. The model
327
- // often emits a real quota or deadline but gets the envelope wrong — a
328
- // numeric-string maxExecutions, or a quota/deadline with the lifecycle field
329
- // missing or mismatched. The old check treated all of those as "no close
330
- // condition" and forced count-bound/1, silently discarding the stated intent
331
- // (e.g. maxExecutions=2 → 1, so the sub fulfills one task early and the next
332
- // spawn under it fails).
333
- if (typeof f.maxExecutions === 'string' && f.maxExecutions.trim() !== '' && Number.isFinite(Number(f.maxExecutions))) {
334
- f.maxExecutions = Number(f.maxExecutions);
335
- }
336
- const hasQuota = typeof f.maxExecutions === 'number' && f.maxExecutions > 0;
337
- const hasDeadline = typeof f.expiresAt === 'string' && f.expiresAt.length > 0;
338
- if (f.lifecycle === 'count-bound' && hasQuota) {
339
- // coherent as stated
340
- } else if (f.lifecycle === 'time-bound' && hasDeadline) {
341
- // coherent as stated
342
- } else if (hasQuota) {
343
- f.lifecycle = 'count-bound'; // quota given, lifecycle missing/mismatched — keep the quota
344
- } else if (hasDeadline) {
345
- f.lifecycle = 'time-bound'; // deadline given, lifecycle missing/mismatched — keep the deadline
346
- } else {
347
- // no usable close condition at all — the deterministic single-task default
348
- f.lifecycle = 'count-bound';
349
- f.maxExecutions = 1;
350
- }
351
- return services.agreementService.delegate({ ...fields, chatId } as Parameters<typeof services.agreementService.delegate>[0]);
352
- }
353
-
@@ -1,114 +0,0 @@
1
- import { defineTool, type ToolDefinition } from '../../../tools/defineTool.js';
2
- import { dispatchProtocolOp } from './protocolRunner.js';
3
- import type { AgreementService } from '../../agreements/AgreementService.js';
4
- import type { TaskService } from '../../tasks/TaskService.js';
5
- import type { ContextReadClient } from '@ziggs-ai/api-client';
6
-
7
- interface ToolContext extends Record<string, unknown> {
8
- taskService: TaskService;
9
- agreementService: AgreementService;
10
- contextReadClient: ContextReadClient;
11
- chatId?: string | null;
12
- agents?: unknown[];
13
- /** Acting agent (ZIG-368 default pricing). */
14
- agentId?: string;
15
- }
16
-
17
- function handlerFor(operation: string) {
18
- return async (args: Record<string, unknown>, ctx: Record<string, unknown>): Promise<unknown> => {
19
- const c = ctx as ToolContext;
20
- if (!c.taskService) throw new Error('taskService missing from tool context (expected when running under Agent)');
21
- if (!c.agreementService) throw new Error('agreementService missing from tool context (expected when running under Agent)');
22
- if (!c.contextReadClient) throw new Error('contextReadClient missing from tool context (expected when running under Agent)');
23
- const result = await dispatchProtocolOp(
24
- {
25
- taskService: c.taskService,
26
- agreementService: c.agreementService,
27
- contextReadClient: c.contextReadClient,
28
- },
29
- { operation, ...args },
30
- c.chatId ?? null,
31
- c.agents ?? [],
32
- typeof c.agentId === 'string' ? c.agentId : null,
33
- );
34
- if (result == null) throw new Error(`Operation ${operation} returned no result`);
35
- return result;
36
- };
37
- }
38
-
39
- export const agreementProposeTool: ToolDefinition = defineTool(
40
- 'agreement_propose',
41
- { description: { type: 'string', required: true }, proposedTo: { type: 'string', required: true }, engagementKind: { type: 'string', enum: ['hire', 'service'], description: 'Contract type. Defaults to service when omitted.' }, parentAgreementId: 'string', parentTaskId: 'string', providerId: { type: 'string', description: 'Who does the work — required on direct proposals, forbidden on broadcasts (the claiming agent fills the open side). Pass your own id when YOU are offering to do the work, or the proposedTo id when you are commissioning the RECIPIENT. Naming any other third party requires that party to have a matching published offer. The payer is always derived as the non-providing side.' }, price: 'number', lifecycle: 'string', expiresAt: 'string', maxExecutions: 'number', agreementDescription: 'string', plan: { type: 'object' }, planReviewTiming: 'string', requireMidWorkPlanAck: 'boolean' },
42
- handlerFor('agreement-propose'),
43
- { description: 'Propose a contract to a user, agent, or as an open broadcast. Direction is stated, never guessed: providerId = your own id ("I work, you pay") or providerId = proposedTo ("you work, I pay"). Required on direct proposals; omit it only for a broadcast — proposedTo="everyone" (fully public — any agent may claim) or proposedTo="org" (scoped to your org). engagementKind defaults to service.', isAgreementCreation: true },
44
- );
45
-
46
- export const agreementSubcontractTool: ToolDefinition = defineTool(
47
- 'agreement_subcontract',
48
- { description: { type: 'string', required: true }, executorId: { type: 'string', required: true }, parentAgreementId: { type: 'string', required: true }, parentTaskId: 'string', payerId: 'string', price: 'number', lifecycle: 'string', expiresAt: 'string', maxExecutions: 'number', agreementDescription: 'string', plan: { type: 'object' }, planReviewTiming: 'string', requireMidWorkPlanAck: 'boolean' },
49
- handlerFor('agreement-subcontract'),
50
- { description: 'Delegate work to another agent under an existing parent agreement. Requires parentAgreementId.', isAgreementCreation: true },
51
- );
52
-
53
- export const agreementRespondTool: ToolDefinition = defineTool(
54
- 'agreement_respond',
55
- { agreementId: { type: 'string', required: true }, action: { type: 'string', required: true, enum: ['approve', 'reject'] } },
56
- handlerFor('agreement-respond'),
57
- { description: 'Approve or reject a pending agreement proposal.' },
58
- );
59
-
60
- export const taskUpdateTool: ToolDefinition = defineTool(
61
- 'task_update',
62
- { taskId: { type: 'string', required: true }, status: { type: 'string', required: true, enum: ['completed', 'failed', 'cancelled'] }, result: 'string' },
63
- handlerFor('task-update'),
64
- { description: 'Transition a task to completed, failed, or cancelled. Include a result string for completed tasks.' },
65
- );
66
-
67
- export const agreementCounterProposalTool: ToolDefinition = defineTool(
68
- 'agreement_counter_proposal',
69
- { agreementId: { type: 'string', required: true }, price: 'number', agreementDescription: 'string', expiresAt: 'string', lifecycle: 'string', maxExecutions: 'number', description: 'string', plan: { type: 'object' }, planReviewTiming: 'string', requireMidWorkPlanAck: 'boolean' },
70
- handlerFor('agreement-counter-proposal'),
71
- { description: 'Counter a pending proposal with revised terms instead of approving or rejecting. Check status first with agreement_check_proposal.' },
72
- );
73
-
74
- export const agreementCheckProposalTool: ToolDefinition = defineTool(
75
- 'agreement_check_proposal',
76
- { agreementId: { type: 'string', required: true } },
77
- handlerFor('agreement-check-proposal'),
78
- { description: 'Read the current proposal status for an agreement (pending, approved, rejected, countered, expired).' },
79
- );
80
-
81
- export const agreementRevokeTool: ToolDefinition = defineTool(
82
- 'agreement_revoke',
83
- { agreementId: { type: 'string', required: true } },
84
- handlerFor('agreement-revoke'),
85
- { description: 'Revoke a pending proposal you created so it can no longer be approved. Use when the user has clearly moved on to a different request before responding to the previous proposal card.' },
86
- );
87
-
88
- export const agreementFulfillTool: ToolDefinition = defineTool(
89
- 'agreement_fulfill',
90
- { agreementId: { type: 'string', required: true } },
91
- handlerFor('agreement-fulfill'),
92
- { description: 'Mark an agreement you provide as fulfilled (complete) once its work is delivered — closes the engagement so it no longer reads as in-progress. Use on your hire after the final deliverable is done and delivered to the human.' },
93
- );
94
-
95
- export const taskUpdatePlanStepTool: ToolDefinition = defineTool(
96
- 'task_update_plan_step',
97
- { taskId: { type: 'string', required: true }, stepId: { type: 'string', required: true }, status: { type: 'string', required: true }, result: 'string' },
98
- handlerFor('task-update-plan-step'),
99
- { description: "Update the status of a single step within a task's plan." },
100
- );
101
-
102
- export const taskSpawnTool: ToolDefinition = defineTool(
103
- 'task_spawn',
104
- { agreementId: { type: 'string', required: true }, description: { type: 'string', required: true }, parentTaskId: 'string', assigneeId: { type: 'string', description: 'Explicitly hand this task to one specific agent (e.g. a worker your orchestrator selected via agent search) instead of leaving it unassigned. Must be a party on the agreement (payer, provider, creator, or creator agent).' }, inputArtifactIds: { type: 'array', items: { type: 'string' }, description: 'ZIG-734: prior-step output artifact handles for structured input links.' }, plan: { type: 'object' }, planReviewTiming: 'string', requireMidWorkPlanAck: 'boolean' },
105
- handlerFor('task-spawn'),
106
- { description: 'Spawn a new task under an existing approved agreement. Use when the contract is already in place. Pass assigneeId to delegate the task to a specific agent rather than leaving it open.' },
107
- );
108
-
109
- export const PROTOCOL_TOOLS: ToolDefinition[] = [
110
- agreementProposeTool, agreementSubcontractTool,
111
- agreementRespondTool, agreementCounterProposalTool, agreementCheckProposalTool, agreementRevokeTool,
112
- agreementFulfillTool,
113
- taskSpawnTool, taskUpdateTool, taskUpdatePlanStepTool,
114
- ];
@@ -1,75 +0,0 @@
1
- import { defineTool, type ToolDefinition } from '../../../tools/defineTool.js';
2
- import { ZiggsConnectClient } from '../../ziggsconnect/ZiggsConnectClient.js';
3
-
4
- type Ctx = Record<string, unknown>;
5
- type AnyObj = Record<string, unknown>;
6
-
7
- interface ConnectError extends Error {
8
- status?: number;
9
- body?: string;
10
- }
11
-
12
- function clientFor(ctx: Ctx): ZiggsConnectClient {
13
- const operatorKey = ctx?.['operatorKey'] as string | undefined;
14
- if (!operatorKey) throw new Error('operatorKey missing from tool context');
15
- return new ZiggsConnectClient({
16
- operatorKey,
17
- actAsAgentId: (ctx?.['agentId'] as string) || undefined,
18
- });
19
- }
20
-
21
- function rethrowWithContext(error: unknown, prefix: string): never {
22
- const e = error as ConnectError;
23
- const wrapped = new Error(`${prefix}: ${e.message}`) as ConnectError;
24
- if (e.status !== undefined) wrapped.status = e.status;
25
- if (e.body !== undefined) wrapped.body = e.body;
26
- (wrapped as unknown as AnyObj)['cause'] = error;
27
- throw wrapped;
28
- }
29
-
30
- export const connectionProxyTool: ToolDefinition = defineTool(
31
- 'connection_proxy',
32
- {
33
- connectionId: { type: 'string', required: true },
34
- grantId: { type: 'string', required: true },
35
- action: { type: 'string', required: true },
36
- payload: { type: 'object' },
37
- },
38
- async (args, ctx) => {
39
- if (!args['connectionId']) throw new Error('connectionId is required');
40
- if (!args['grantId']) throw new Error('grantId is required');
41
- if (!args['action']) throw new Error('action is required');
42
- try {
43
- const result = await clientFor(ctx as Ctx).proxy({
44
- connectionId: args['connectionId'] as string,
45
- grantId: args['grantId'] as string,
46
- action: args['action'] as string,
47
- payload: args['payload'],
48
- });
49
- return { status: 'ok', result };
50
- } catch (e) {
51
- rethrowWithContext(e, 'Connection proxy failed');
52
- }
53
- },
54
- );
55
-
56
- export const connectionListGrantsTool: ToolDefinition = defineTool(
57
- 'connection_list_grants',
58
- { connectionId: { type: 'string', required: true } },
59
- async (args, ctx) => {
60
- if (!args['connectionId']) throw new Error('connectionId is required');
61
- try {
62
- const grants = await clientFor(ctx as Ctx).listGrants({
63
- connectionId: args['connectionId'] as string,
64
- });
65
- return { grants: grants || [] };
66
- } catch (e) {
67
- rethrowWithContext(e, 'Failed to list connection grants');
68
- }
69
- },
70
- );
71
-
72
- export const CONNECTION_TOOLS: ToolDefinition[] = [
73
- connectionProxyTool,
74
- connectionListGrantsTool,
75
- ];
@@ -1,63 +0,0 @@
1
- import { defineTool, type ToolDefinition } from '../../../tools/defineTool.js';
2
- import { ZiggsContextClient } from '../../ziggscontext/ZiggsContextClient.js';
3
-
4
- type Ctx = Record<string, unknown>;
5
-
6
- function clientFor(ctx: Ctx): ZiggsContextClient {
7
- const operatorKey = ctx?.['operatorKey'] as string | undefined;
8
- if (!operatorKey) throw new Error('operatorKey missing from tool context');
9
- return new ZiggsContextClient({
10
- operatorKey,
11
- actAsAgentId: (ctx?.['agentId'] as string) || undefined,
12
- });
13
- }
14
-
15
- export const contextDiscoverTool: ToolDefinition = defineTool(
16
- 'context_discover',
17
- {},
18
- async (_args, ctx) => clientFor(ctx as Ctx).discover(),
19
- {
20
- description:
21
- 'List every context grant this agent holds, as scope descriptors — grantId, scope, temporal, watermarkAt, expiresAt (no message or artifact content).',
22
- },
23
- );
24
-
25
- export const contextDelegateTool: ToolDefinition = defineTool(
26
- 'context_delegate',
27
- {
28
- parentGrantId: { type: 'string', required: true },
29
- holderId: { type: 'string', required: true },
30
- scopeKind: { type: 'string', required: true },
31
- scopeId: { type: 'string', required: true },
32
- temporal: { type: 'string', required: true },
33
- expiresAt: 'string',
34
- watermarkAt: 'string',
35
- },
36
- async (args, ctx) => {
37
- const temporal = args['temporal'] as string;
38
- if (temporal !== 'from-now' && temporal !== 'from-start') {
39
- throw new Error('temporal must be from-now or from-start');
40
- }
41
- const scopeKind = args['scopeKind'] as string;
42
- if (scopeKind !== 'chat' && scopeKind !== 'agreement' && scopeKind !== 'org') {
43
- throw new Error('scopeKind must be chat, agreement, or org');
44
- }
45
- return clientFor(ctx as Ctx).delegate({
46
- parentGrantId: args['parentGrantId'] as string,
47
- holderId: args['holderId'] as string,
48
- scope: { kind: scopeKind as 'chat' | 'agreement' | 'org', id: args['scopeId'] as string },
49
- temporal,
50
- expiresAt: (args['expiresAt'] as string | undefined) ?? undefined,
51
- watermarkAt: args['watermarkAt'] as string | undefined,
52
- });
53
- },
54
- {
55
- description:
56
- 'Delegate a narrower child context grant (tighter scope, shorter expiry, or from-now). Holder-only.',
57
- },
58
- );
59
-
60
- export const CONTEXT_TOOLS = [
61
- contextDiscoverTool,
62
- contextDelegateTool,
63
- ] as const;
@@ -1,34 +0,0 @@
1
- import { defineTool, type ToolDefinition } from '../../../tools/defineTool.js';
2
- import { AgentSearchClient } from '@ziggs-ai/api-client';
3
-
4
- type Ctx = Record<string, unknown>;
5
-
6
- function clientFor(ctx: Ctx): AgentSearchClient {
7
- const operatorKey = ctx?.['operatorKey'] as string | undefined;
8
- const agentId = ctx?.['agentId'] as string | undefined;
9
- if (!operatorKey) throw new Error('operatorKey missing from tool context');
10
- if (!agentId) throw new Error('agentId missing from tool context');
11
- return new AgentSearchClient(operatorKey, agentId);
12
- }
13
-
14
- export const agentSearchTool: ToolDefinition = defineTool('agent_search',
15
- { query: { type: 'string', required: true }, limit: 'number' },
16
- async (args, ctx) => {
17
- if (!args['query']) throw new Error('query is required');
18
- const options: { limit?: number } = {};
19
- if (typeof args['limit'] === 'number') options.limit = args['limit'] as number;
20
- return clientFor(ctx as Ctx).searchAgents(args['query'] as string, options);
21
- },
22
- { description: 'Search for agents by capability, name, or description. Returns ranked results with relevance scores. Use before agreement_propose or agreement_subcontract to discover the right agent for a job.', isGenericFallback: true },
23
- );
24
-
25
- export const agentGetTool: ToolDefinition = defineTool('agent_get',
26
- { agentId: { type: 'string', required: true } },
27
- async (args, ctx) => {
28
- if (!args['agentId']) throw new Error('agentId is required');
29
- return clientFor(ctx as Ctx).getAgentById(args['agentId'] as string);
30
- },
31
- { description: 'Fetch the full profile of a specific agent by ID. Use to confirm capabilities and terms before proposing an agreement.' },
32
- );
33
-
34
- export const DISCOVERY_TOOLS: ToolDefinition[] = [agentSearchTool, agentGetTool];
@@ -1,27 +0,0 @@
1
- import { defineTool, type ToolDefinition } from '../../../tools/defineTool.js';
2
- import { pullQuests } from '@ziggs-ai/api-client';
3
-
4
- type Ctx = Record<string, unknown>;
5
-
6
- // Read-only marketplace access. Publishing an open quest is NOT here: it is the
7
- // tier-1 protocol verb agreement_propose({ proposedTo: "everyone" | "org" }).
8
- // This feed already returns only quests the caller may see — org-scoped quests
9
- // appear here only for members of the quest's org (filtered server-side).
10
- export const marketplaceViewTool: ToolDefinition = defineTool('marketplace_view',
11
- { limit: 'number', since: 'string' },
12
- async (args, ctx) => {
13
- const operatorKey = (ctx as Ctx)?.['operatorKey'] as string | undefined;
14
- const agentId = (ctx as Ctx)?.['agentId'] as string | undefined;
15
- if (!operatorKey) throw new Error('operatorKey missing from tool context');
16
- if (!agentId) throw new Error('agentId missing from tool context');
17
- const options: { limit?: number; since?: string } = {
18
- limit: typeof args['limit'] === 'number' ? args['limit'] as number : 20,
19
- };
20
- if (args['since']) options.since = args['since'] as string;
21
- const quests = await pullQuests(options, { operatorKey, agentId });
22
- return { quests, count: quests.length };
23
- },
24
- { description: 'Browse open quests on the marketplace — work buyers have broadcast to willing agents. Returns public quests plus any org-scoped quests in your org. To claim a quest, use agreement_respond on the returned agreementId. To publish your own, use agreement_propose({ proposedTo: "everyone" }) for a public quest or proposedTo: "org" to keep it inside your org.' },
25
- );
26
-
27
- export const MARKETPLACE_TOOLS: ToolDefinition[] = [marketplaceViewTool];