@ziggs-ai/agent-sdk 0.10.8 → 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.
- package/CHANGELOG.md +11 -11
- package/dist/AgentHost.d.ts +15 -15
- package/dist/AgentHost.js +22 -22
- package/dist/adapters/AnthropicAdapter.js +1 -1
- package/dist/adapters/McpAdapter.d.ts +10 -10
- package/dist/adapters/McpAdapter.js +33 -21
- package/dist/adapters/OpenAIAdapter.js +1 -1
- package/dist/agent/Agent.d.ts +2 -2
- package/dist/agent/ClaudeSdkAgent.d.ts +6 -6
- package/dist/agent/ClaudeSdkAgent.js +25 -25
- package/dist/agent/claudeCognition.d.ts +3 -3
- package/dist/agent/claudeCognition.js +7 -7
- package/dist/agent/claudeSdkTools.d.ts +3 -3
- package/dist/agent/claudeSdkTools.js +9 -9
- package/dist/agent/hostedAgentConnection.d.ts +1 -1
- package/dist/agent/hostedAgentConnection.js +1 -1
- package/dist/agent/toolManagerToSdkMcp.d.ts +1 -1
- package/dist/agent/toolManagerToSdkMcp.js +2 -2
- package/dist/context/applyEffects.js +1 -1
- package/dist/defineAgent.js +2 -2
- package/dist/formatters/HistoryFormatter.js +2 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.js +5 -5
- package/dist/ingress/normalizeIncoming.d.ts +1 -1
- package/dist/ingress/normalizeIncoming.js +7 -7
- package/dist/pricing/fleetDefaults.d.ts +3 -3
- package/dist/pricing/fleetDefaults.js +3 -3
- package/dist/pricing/fleetEvalFree.d.ts +1 -1
- package/dist/pricing/fleetEvalFree.js +1 -1
- package/dist/pricing/fleetFreeTierA.gen.d.ts +1 -1
- package/dist/pricing/fleetFreeTierA.gen.js +1 -1
- package/dist/pricing/fleetTierByAgentId.gen.d.ts +1 -1
- package/dist/runtime/AgentMachine.d.ts +1 -1
- package/dist/runtime/AgentMachine.js +8 -8
- package/dist/runtime/PromptBuilder.d.ts +2 -2
- package/dist/runtime/PromptBuilder.js +3 -3
- package/dist/runtime/bootstrapCtx.d.ts +1 -1
- package/dist/runtime/bootstrapCtx.js +2 -2
- package/dist/runtime/buildOutcome.d.ts +1 -1
- package/dist/runtime/buildOutcome.js +4 -4
- package/dist/runtime/defaults.d.ts +5 -5
- package/dist/runtime/defaults.js +4 -4
- package/dist/runtime/deliveryWriteKeys.d.ts +1 -1
- package/dist/runtime/deliveryWriteKeys.js +3 -3
- package/dist/runtime/kickoff.d.ts +3 -3
- package/dist/runtime/kickoff.js +3 -3
- package/dist/runtime/runMechanical.d.ts +1 -1
- package/dist/runtime/runMechanical.js +1 -1
- package/dist/runtime/runTurn.d.ts +1 -1
- package/dist/runtime/runTurn.js +10 -10
- package/dist/runtime/taskBookkeeping.d.ts +3 -3
- package/dist/runtime/taskBookkeeping.js +3 -3
- package/dist/runtime/taskIntake.js +2 -2
- package/dist/server/ConnectionPool.js +1 -1
- package/dist/server/EventQueue.d.ts +1 -1
- package/dist/server/EventQueue.js +1 -1
- package/dist/server/SeenMessages.d.ts +2 -2
- package/dist/server/SeenMessages.js +2 -2
- package/dist/server/ZiggsEffectHandler.d.ts +2 -2
- package/dist/server/ZiggsEffectHandler.js +8 -8
- package/dist/server/agreements/AgreementService.d.ts +3 -8
- package/dist/server/agreements/AgreementService.js +4 -7
- package/dist/server/inboxLoop.d.ts +5 -5
- package/dist/server/inboxLoop.js +21 -10
- package/dist/server/questMatch.d.ts +1 -1
- package/dist/server/questMatch.js +1 -1
- package/dist/server/runLauncher.js +3 -3
- package/dist/server/tools/index.d.ts +1 -0
- package/dist/server/tools/index.js +7 -6
- package/dist/server/tools/tier1/protocolRunner.d.ts +1 -1
- package/dist/server/tools/tier1/protocolRunner.js +19 -19
- package/dist/server/tools/tier1/protocolTools.js +4 -4
- package/dist/server/tools/tier2/artifactTools.js +2 -2
- package/dist/server/tools/tier2/chatTools.js +2 -2
- package/dist/server/tools/tier2/connectionTools.js +3 -3
- package/dist/server/tools/tier2/contextTools.js +1 -1
- package/dist/server/tools/tier2/discoveryTools.js +2 -2
- package/dist/server/tools/tier2/grantsTools.js +1 -1
- package/dist/server/tools/tier2/linkTools.js +3 -3
- package/dist/server/tools/tier2/marketplaceTools.js +1 -1
- package/dist/server/tools/tier2/mcpConnectionTools.d.ts +4 -0
- package/dist/server/tools/tier2/mcpConnectionTools.js +136 -0
- package/dist/server/tools/tier2/paymentTools.js +1 -1
- package/dist/shared/operatorKeyClaims.d.ts +2 -2
- package/dist/shared/operatorKeyClaims.js +1 -1
- package/dist/tasks/protocolRegistry.d.ts +1 -1
- package/dist/tasks/protocolRegistry.js +1 -1
- package/dist/tools/ToolManager.js +1 -1
- package/dist/tools/capabilityAdapter.d.ts +1 -1
- package/dist/tools/capabilityAdapter.js +3 -3
- package/dist/tools/defineTool.js +1 -1
- package/dist/tools/recordReport.d.ts +3 -3
- package/dist/tools/recordReport.js +3 -3
- package/dist/types.d.ts +17 -17
- package/package.json +3 -3
package/dist/agent/Agent.d.ts
CHANGED
|
@@ -25,7 +25,7 @@ export interface TickInput {
|
|
|
25
25
|
* choice — `counterparty:<id>`, `agreement:<id>:notes`, etc.
|
|
26
26
|
*/
|
|
27
27
|
memory?: MemoryStore;
|
|
28
|
-
/** Optional tap for FSM transition events
|
|
28
|
+
/** Optional tap for FSM transition events. */
|
|
29
29
|
transitionTap?: (event: TransitionEvent) => void;
|
|
30
30
|
/**
|
|
31
31
|
* Aborted by the host when the tick watchdog fires. A brain driving an
|
|
@@ -49,7 +49,7 @@ export interface TickOutput {
|
|
|
49
49
|
/**
|
|
50
50
|
* Accumulated LLM call count and token usage for this tick.
|
|
51
51
|
* `cacheRead` / `cacheCreation` are populated by the Claude brain (its usage
|
|
52
|
-
* exposes cache traffic, which is the bulk of real cost
|
|
52
|
+
* exposes cache traffic, which is the bulk of real cost/813); the
|
|
53
53
|
* FSM path leaves them undefined. `total` includes cache tokens when present.
|
|
54
54
|
*/
|
|
55
55
|
metrics: {
|
|
@@ -4,7 +4,7 @@ import type { ToolManager } from '../tools/ToolManager.js';
|
|
|
4
4
|
import { type RawEvent } from '../runtime/buildOutcome.js';
|
|
5
5
|
import type { TickInput, TickOutput } from './Agent.js';
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
7
|
+
* status notices must not spend a Claude turn answering
|
|
8
8
|
* nobody. Real work wakes arrive as chat `message`, synthetic `task_result`
|
|
9
9
|
* from `wakeTaskAssignment`, or `agreement_lifecycle` (hire / proposal
|
|
10
10
|
* resolution — the FSM kickoffs on the same event; Claude must act too).
|
|
@@ -28,7 +28,7 @@ export interface ClaudeSdkAgentOptions {
|
|
|
28
28
|
toolManager: ToolManager;
|
|
29
29
|
/** Store-facing one-liner. Used as the role block only when `systemPrompt` is absent. */
|
|
30
30
|
description: string;
|
|
31
|
-
/** The agent's system prompt
|
|
31
|
+
/** The agent's system prompt. Preferred over `description` for the role block. */
|
|
32
32
|
systemPrompt?: string;
|
|
33
33
|
specialization?: string | null;
|
|
34
34
|
model: string;
|
|
@@ -36,7 +36,7 @@ export interface ClaudeSdkAgentOptions {
|
|
|
36
36
|
operatorKey: string;
|
|
37
37
|
agentId: string;
|
|
38
38
|
maxTurns?: number;
|
|
39
|
-
/**
|
|
39
|
+
/** when true, never resume the prior Claude session — each wake is a
|
|
40
40
|
* fresh transcript. Keeps per-wake input flat on step-driven orchestrators
|
|
41
41
|
* whose wakes already carry their state. */
|
|
42
42
|
statelessPerWake?: boolean;
|
|
@@ -44,7 +44,7 @@ export interface ClaudeSdkAgentOptions {
|
|
|
44
44
|
queryFn?: typeof query;
|
|
45
45
|
}
|
|
46
46
|
/**
|
|
47
|
-
*
|
|
47
|
+
* "the transcript you asked me to resume is not here".
|
|
48
48
|
*
|
|
49
49
|
* Claude Code answers a `resume` of an unknown id with this, and it is the only
|
|
50
50
|
* failure that a fresh session reliably fixes: the id is valid-looking but its
|
|
@@ -57,7 +57,7 @@ export declare function isMissingSessionError(err: unknown): boolean;
|
|
|
57
57
|
* A Ziggs agent whose brain is the Claude Agent SDK. Same host, same `eff`
|
|
58
58
|
* side channel, same tool surface as the FSM `Agent` — the ONLY difference is
|
|
59
59
|
* the loop: instead of the FSM + `runTurn`, a wake drives a headless Claude
|
|
60
|
-
* `query()` (see
|
|
60
|
+
* `query()` (see "host is the product; the brain is how it decides").
|
|
61
61
|
*/
|
|
62
62
|
export declare class ClaudeSdkAgent {
|
|
63
63
|
workflow: Workflow;
|
|
@@ -72,7 +72,7 @@ export declare class ClaudeSdkAgent {
|
|
|
72
72
|
private statelessPerWake;
|
|
73
73
|
private queryFn;
|
|
74
74
|
/**
|
|
75
|
-
*
|
|
75
|
+
* #7 — tool set is fixed at host construction; rebuilding the
|
|
76
76
|
* in-process MCP server (+ zod schema tree) every wake was pure waste.
|
|
77
77
|
* A mutable holder supplies per-wake context without closing over `tick`.
|
|
78
78
|
*/
|
|
@@ -9,7 +9,7 @@ import { claudeQueryOptions, buildClaudeEventPrompt, summarizeContext, extractAs
|
|
|
9
9
|
import { assertHostedAgentZiggsTools } from './hostedAgentConnection.js';
|
|
10
10
|
import { runtimeLog } from '../shared/runtimeLog.js';
|
|
11
11
|
/**
|
|
12
|
-
*
|
|
12
|
+
* status notices must not spend a Claude turn answering
|
|
13
13
|
* nobody. Real work wakes arrive as chat `message`, synthetic `task_result`
|
|
14
14
|
* from `wakeTaskAssignment`, or `agreement_lifecycle` (hire / proposal
|
|
15
15
|
* resolution — the FSM kickoffs on the same event; Claude must act too).
|
|
@@ -40,13 +40,13 @@ const DEFAULT_STATE = 'ready';
|
|
|
40
40
|
* the direct multiplier on a task's token spend. 30 let a confused MCP agent
|
|
41
41
|
* burn schema×30 per wake; brokered tasks (fetch → record → done) converge in a
|
|
42
42
|
* handful of turns, so 12 is ample. Env-overridable (raise for genuinely long
|
|
43
|
-
* agents).
|
|
43
|
+
* agents). */
|
|
44
44
|
const DEFAULT_MAX_TURNS = Number(process.env.CLAUDE_SDK_MAX_TURNS ?? 12);
|
|
45
45
|
/**
|
|
46
46
|
* Hard ceiling on billable input tokens (incl. cache read/write) a single wake
|
|
47
47
|
* may spend before we abort the query. Defense-in-depth on the shared fleet key
|
|
48
48
|
* against a runaway loop; set high enough that normal tasks never trip it. The
|
|
49
|
-
* task ends unfinished (and logs loudly) rather than burning unbounded.
|
|
49
|
+
* task ends unfinished (and logs loudly) rather than burning unbounded. */
|
|
50
50
|
const MAX_TASK_INPUT_TOKENS = Number(process.env.CLAUDE_SDK_MAX_INPUT_TOKENS ?? 500_000);
|
|
51
51
|
/**
|
|
52
52
|
* Per-lane wake-rate circuit breaker. The per-wake caps above bound one wake;
|
|
@@ -58,7 +58,7 @@ const MAX_TASK_INPUT_TOKENS = Number(process.env.CLAUDE_SDK_MAX_INPUT_TOKENS ??
|
|
|
58
58
|
const WAKE_WINDOW_MS = 10 * 60_000;
|
|
59
59
|
const MAX_WAKES_PER_WINDOW = Number(process.env.CLAUDE_SDK_MAX_WAKES_PER_WINDOW ?? 40);
|
|
60
60
|
/**
|
|
61
|
-
* Resumed-transcript ceiling
|
|
61
|
+
* Resumed-transcript ceiling. Each wake resumes the lane's Claude
|
|
62
62
|
* session, so the whole transcript (event prompts, tool results, summaries)
|
|
63
63
|
* replays on every turn — mostly as cache reads, but it grows without bound on
|
|
64
64
|
* a long-lived lane and dominates per-wake cost. When a wake's billable input
|
|
@@ -69,7 +69,7 @@ const MAX_WAKES_PER_WINDOW = Number(process.env.CLAUDE_SDK_MAX_WAKES_PER_WINDOW
|
|
|
69
69
|
* before it can approach the per-wake abort. */
|
|
70
70
|
const MAX_SESSION_RESUME_INPUT_TOKENS = Number(process.env.CLAUDE_SDK_MAX_SESSION_INPUT_TOKENS ?? 200_000);
|
|
71
71
|
/**
|
|
72
|
-
*
|
|
72
|
+
* "the transcript you asked me to resume is not here".
|
|
73
73
|
*
|
|
74
74
|
* Claude Code answers a `resume` of an unknown id with this, and it is the only
|
|
75
75
|
* failure that a fresh session reliably fixes: the id is valid-looking but its
|
|
@@ -111,7 +111,7 @@ function extractMetrics(message) {
|
|
|
111
111
|
const input = billableInput(usage);
|
|
112
112
|
const output = usage?.output_tokens ?? 0;
|
|
113
113
|
// Cache read/write are already folded into `input` above; surfaced separately
|
|
114
|
-
// here for per-tick visibility (metricsTap metadata / dashboards
|
|
114
|
+
// here for per-tick visibility (metricsTap metadata / dashboards).
|
|
115
115
|
const cacheRead = usage?.cache_read_input_tokens ?? 0;
|
|
116
116
|
const cacheCreation = usage?.cache_creation_input_tokens ?? 0;
|
|
117
117
|
return {
|
|
@@ -121,8 +121,8 @@ function extractMetrics(message) {
|
|
|
121
121
|
};
|
|
122
122
|
}
|
|
123
123
|
/**
|
|
124
|
-
* Resolve the agreement this wake acts under, for a delegated per-user MCP
|
|
125
|
-
*
|
|
124
|
+
* Resolve the agreement this wake acts under, for a delegated per-user MCP
|
|
125
|
+
* call. Without it the gateway resolves the connection owner from
|
|
126
126
|
* `senderId` — which, under a delegation, is the delegating agent (who owns no
|
|
127
127
|
* connection) → a spurious NO_USER_CONNECTION even though the payer IS connected.
|
|
128
128
|
*
|
|
@@ -130,7 +130,7 @@ function extractMetrics(message) {
|
|
|
130
130
|
* `task_result` events. In practice the worker often fetches while reacting to
|
|
131
131
|
* the proposal-approved / agreement-active lifecycle events, which carry the id
|
|
132
132
|
* at the event top level rather than under `result`. Reading only
|
|
133
|
-
* `result.agreementId` (the original
|
|
133
|
+
* `result.agreementId` (the original wiring) left those wakes with no
|
|
134
134
|
* agreement → the false "authorize your connection" prompt. Resolve from every
|
|
135
135
|
* reliable source instead:
|
|
136
136
|
* 1. task_result events → `result.agreementId`
|
|
@@ -170,7 +170,7 @@ function resolveOnBehalfAgreementId(rawEvent, contextSnap, agentId, sessionId) {
|
|
|
170
170
|
* A Ziggs agent whose brain is the Claude Agent SDK. Same host, same `eff`
|
|
171
171
|
* side channel, same tool surface as the FSM `Agent` — the ONLY difference is
|
|
172
172
|
* the loop: instead of the FSM + `runTurn`, a wake drives a headless Claude
|
|
173
|
-
* `query()` (see
|
|
173
|
+
* `query()` (see "host is the product; the brain is how it decides").
|
|
174
174
|
*/
|
|
175
175
|
export class ClaudeSdkAgent {
|
|
176
176
|
workflow;
|
|
@@ -185,7 +185,7 @@ export class ClaudeSdkAgent {
|
|
|
185
185
|
statelessPerWake;
|
|
186
186
|
queryFn;
|
|
187
187
|
/**
|
|
188
|
-
*
|
|
188
|
+
* #7 — tool set is fixed at host construction; rebuilding the
|
|
189
189
|
* in-process MCP server (+ zod schema tree) every wake was pure waste.
|
|
190
190
|
* A mutable holder supplies per-wake context without closing over `tick`.
|
|
191
191
|
*/
|
|
@@ -200,7 +200,7 @@ export class ClaudeSdkAgent {
|
|
|
200
200
|
throw new Error('ClaudeSdkAgent: anthropicKey is required');
|
|
201
201
|
this.workflow = opts.workflow;
|
|
202
202
|
this.toolManager = opts.toolManager;
|
|
203
|
-
//
|
|
203
|
+
// the prompt and the store blurb are two different strings. Agents
|
|
204
204
|
// written before the split still carry the prompt in `description`, so fall
|
|
205
205
|
// back to it rather than silently dropping their role.
|
|
206
206
|
this.rolePrompt = opts.systemPrompt || opts.description;
|
|
@@ -249,7 +249,7 @@ export class ClaudeSdkAgent {
|
|
|
249
249
|
}
|
|
250
250
|
let contextSnap = null;
|
|
251
251
|
try {
|
|
252
|
-
//
|
|
252
|
+
// #5: pre-read is for wake gating + summarizeContext (a count) +
|
|
253
253
|
// onBehalf agreement resolution — same 12-message cap as the tool path.
|
|
254
254
|
// Uncapped pulls burned 35–47k input tokens/wake on long chats.
|
|
255
255
|
contextSnap = await eff({
|
|
@@ -265,7 +265,7 @@ export class ClaudeSdkAgent {
|
|
|
265
265
|
// no longer resolves (deleted / not visible) has no world to act in —
|
|
266
266
|
// skip the query instead of burning a wake on a fabricated empty history.
|
|
267
267
|
//
|
|
268
|
-
//
|
|
268
|
+
// a bare agreement id (`agr_…`, not the `agrn-…` notification
|
|
269
269
|
// chat) is not a chat. If a wake still keys the lane that way, read-context
|
|
270
270
|
// returns chatMissing and used to continue on an empty snapshot with no
|
|
271
271
|
// signal. Loud-log that mis-key; message wakes still skip below.
|
|
@@ -297,7 +297,7 @@ export class ClaudeSdkAgent {
|
|
|
297
297
|
this.specialization ? `Specialization: ${this.specialization}` : '',
|
|
298
298
|
].filter(Boolean).join('\n');
|
|
299
299
|
// Two blocks, not one string: the shared protocol first so its cache prefix
|
|
300
|
-
// is reachable by every hosted agent, this agent's role second
|
|
300
|
+
// is reachable by every hosted agent, this agent's role second.
|
|
301
301
|
const systemPrompt = [CLAUDE_SDK_PROTOCOL, roleBlock];
|
|
302
302
|
const runId = crypto.randomUUID();
|
|
303
303
|
// Replay-stable write keys for this wake (runId is random and can't serve):
|
|
@@ -312,7 +312,7 @@ export class ClaudeSdkAgent {
|
|
|
312
312
|
eff,
|
|
313
313
|
senderId: rawEvent?.senderId != null ? String(rawEvent.senderId) : undefined,
|
|
314
314
|
senderType: rawEvent?.senderType != null ? String(rawEvent.senderType) : undefined,
|
|
315
|
-
|
|
315
|
+
///832: agreement this wake acts under → lets a delegated per-user
|
|
316
316
|
// MCP call resolve the originating end-user (payer) rather than the
|
|
317
317
|
// delegating agent (senderId). Resolved from every reliable wire source,
|
|
318
318
|
// not just task_result events — see resolveOnBehalfAgreementId.
|
|
@@ -352,7 +352,7 @@ export class ClaudeSdkAgent {
|
|
|
352
352
|
let metrics = { llmCalls: 0, tokens: { total: 0, input: 0, output: 0, cacheRead: 0, cacheCreation: 0 } };
|
|
353
353
|
let sessionId = nextCtx.claudeSessionId;
|
|
354
354
|
let spentInput = 0;
|
|
355
|
-
//
|
|
355
|
+
// stateless-per-wake never resumes — each wake is a fresh
|
|
356
356
|
// transcript, so per-wake input stays flat instead of replaying the whole
|
|
357
357
|
// lane history every turn.
|
|
358
358
|
const resumeId = this.statelessPerWake ? undefined : nextCtx.claudeSessionId;
|
|
@@ -379,7 +379,7 @@ export class ClaudeSdkAgent {
|
|
|
379
379
|
sessionId = message.session_id;
|
|
380
380
|
}
|
|
381
381
|
// Surface the model's own prose so a hired Claude agent is as legible as
|
|
382
|
-
// an FSM agent
|
|
382
|
+
// an FSM agent. Each completed assistant turn's text is recorded
|
|
383
383
|
// as a `thought` — the SAME agent-private channel the FSM uses for its
|
|
384
384
|
// reasoning (runTurn `emitThought` → record-event → recordThought), so it
|
|
385
385
|
// shows in the hired-agent view without cluttering the counterparty chat.
|
|
@@ -407,12 +407,12 @@ export class ClaudeSdkAgent {
|
|
|
407
407
|
if (message.type === 'result' && message.subtype !== 'success') {
|
|
408
408
|
runtimeLog.warn('ClaudeSdkAgent', `query ended without success subtype=${message.subtype} session=${identity.sessionId}`);
|
|
409
409
|
}
|
|
410
|
-
// Runaway guard
|
|
410
|
+
// Runaway guard: abort before an unbounded loop drains the
|
|
411
411
|
// shared fleet key. Breaking the for-await calls the generator's return(),
|
|
412
412
|
// which terminates the underlying query.
|
|
413
413
|
spentInput += billableInput(usageOf(message));
|
|
414
414
|
if (spentInput > MAX_TASK_INPUT_TOKENS) {
|
|
415
|
-
runtimeLog.warn('ClaudeSdkAgent', `input-token budget exceeded (~${spentInput} > ${MAX_TASK_INPUT_TOKENS}) session=${identity.sessionId} agent=${this.agentId} — aborting query to cap spend
|
|
415
|
+
runtimeLog.warn('ClaudeSdkAgent', `input-token budget exceeded (~${spentInput} > ${MAX_TASK_INPUT_TOKENS}) session=${identity.sessionId} agent=${this.agentId} — aborting query to cap spend`);
|
|
416
416
|
break;
|
|
417
417
|
}
|
|
418
418
|
}
|
|
@@ -425,7 +425,7 @@ export class ClaudeSdkAgent {
|
|
|
425
425
|
await consumeQuery(resumeId);
|
|
426
426
|
}
|
|
427
427
|
catch (err) {
|
|
428
|
-
//
|
|
428
|
+
// the resumed transcript is gone. Claude Code stores transcripts
|
|
429
429
|
// on the container's own disk while the session id outlives it — persisted
|
|
430
430
|
// per lane in the session store with a 24h TTL — so a redeployed agents
|
|
431
431
|
// task inherits an id pointing at a file that no longer exists. Every wake
|
|
@@ -442,7 +442,7 @@ export class ClaudeSdkAgent {
|
|
|
442
442
|
throw err;
|
|
443
443
|
}
|
|
444
444
|
runtimeLog.info('ClaudeSdkAgent', `resumed Claude session ${resumeId} no longer exists (container replaced?) ` +
|
|
445
|
-
`session=${identity.sessionId} agent=${this.agentId} — retrying once on a fresh session
|
|
445
|
+
`session=${identity.sessionId} agent=${this.agentId} — retrying once on a fresh session`);
|
|
446
446
|
nextCtx.claudeSessionId = undefined;
|
|
447
447
|
sessionId = undefined;
|
|
448
448
|
try {
|
|
@@ -454,13 +454,13 @@ export class ClaudeSdkAgent {
|
|
|
454
454
|
}
|
|
455
455
|
}
|
|
456
456
|
// Stateless-per-wake keeps no session id — clear any carried over from the
|
|
457
|
-
// prior ctx so the next wake starts fresh too
|
|
457
|
+
// prior ctx so the next wake starts fresh too. Otherwise remember
|
|
458
458
|
// this wake's session for resume.
|
|
459
459
|
if (this.statelessPerWake)
|
|
460
460
|
nextCtx.claudeSessionId = undefined;
|
|
461
461
|
else if (sessionId)
|
|
462
462
|
nextCtx.claudeSessionId = sessionId;
|
|
463
|
-
//
|
|
463
|
+
// bound resumed-transcript growth. `metrics.tokens.input` is the
|
|
464
464
|
// wake's billable input off the result message (dominated by the resumed
|
|
465
465
|
// transcript's cache reads); `spentInput` covers an aborted wake that never
|
|
466
466
|
// produced a result. Past the ceiling, forget the session so the next wake
|
|
@@ -468,7 +468,7 @@ export class ClaudeSdkAgent {
|
|
|
468
468
|
const wakeInput = Math.max(metrics.tokens.input, spentInput);
|
|
469
469
|
if (nextCtx.claudeSessionId && wakeInput > MAX_SESSION_RESUME_INPUT_TOKENS) {
|
|
470
470
|
runtimeLog.info('ClaudeSdkAgent', `resetting Claude session (wake input ~${wakeInput} > ${MAX_SESSION_RESUME_INPUT_TOKENS}) ` +
|
|
471
|
-
`session=${identity.sessionId} agent=${this.agentId} — next wake starts fresh
|
|
471
|
+
`session=${identity.sessionId} agent=${this.agentId} — next wake starts fresh`);
|
|
472
472
|
nextCtx.claudeSessionId = undefined;
|
|
473
473
|
}
|
|
474
474
|
return {
|
|
@@ -52,7 +52,7 @@ export declare function resolveClaudeModel(preferred?: string, servicesModel?: s
|
|
|
52
52
|
* fixed here; callers only supply the per-wake variables (prompt, model, tools,
|
|
53
53
|
* turn budget, resume). Returns `Options` so it drops straight into `query()`.
|
|
54
54
|
*
|
|
55
|
-
*
|
|
55
|
+
* prompt caching. The system prompt is handed over as blocks with a
|
|
56
56
|
* trailing `SYSTEM_PROMPT_DYNAMIC_BOUNDARY`: everything before the marker is
|
|
57
57
|
* eligible for cross-session caching, and there is nothing after it because
|
|
58
58
|
* nothing in this prompt varies per wake. Every per-wake input — the event, the
|
|
@@ -75,7 +75,7 @@ export declare function claudeQueryOptions(params: ClaudeQueryOptionsParams): Op
|
|
|
75
75
|
* Concatenate the text blocks of a completed Claude assistant turn. Tool-use,
|
|
76
76
|
* thinking, and other block kinds are skipped — only the model's user-facing
|
|
77
77
|
* prose is returned (empty string for a pure tool-use turn). This is what a
|
|
78
|
-
* Claude-brain wake records as a `thought` per turn
|
|
78
|
+
* Claude-brain wake records as a `thought` per turn, the same way
|
|
79
79
|
* the FSM's `emitThought` surfaces the model's reasoning.
|
|
80
80
|
*/
|
|
81
81
|
export declare function extractAssistantText(message: SDKAssistantMessage): string;
|
|
@@ -86,7 +86,7 @@ export declare function summarizeContext(snap: Record<string, unknown> | null |
|
|
|
86
86
|
* Claude-brain turn. The agent's standing instructions come from its system
|
|
87
87
|
* prompt (protocol + role); this is just "here's what woke you, go handle it."
|
|
88
88
|
*
|
|
89
|
-
*
|
|
89
|
+
* EventQueue coalesces events that arrive while the lane is busy into
|
|
90
90
|
* a `{type:'batch', events:[...]}` frame. The FSM path unwraps those
|
|
91
91
|
* (PromptBuilder), but this path used to render just "Event type: batch" —
|
|
92
92
|
* every payload inside (including task results) was invisible to the model,
|
|
@@ -32,7 +32,7 @@ export function resolveClaudeModel(preferred, servicesModel) {
|
|
|
32
32
|
* fixed here; callers only supply the per-wake variables (prompt, model, tools,
|
|
33
33
|
* turn budget, resume). Returns `Options` so it drops straight into `query()`.
|
|
34
34
|
*
|
|
35
|
-
*
|
|
35
|
+
* prompt caching. The system prompt is handed over as blocks with a
|
|
36
36
|
* trailing `SYSTEM_PROMPT_DYNAMIC_BOUNDARY`: everything before the marker is
|
|
37
37
|
* eligible for cross-session caching, and there is nothing after it because
|
|
38
38
|
* nothing in this prompt varies per wake. Every per-wake input — the event, the
|
|
@@ -76,7 +76,7 @@ export function claudeQueryOptions(params) {
|
|
|
76
76
|
* Concatenate the text blocks of a completed Claude assistant turn. Tool-use,
|
|
77
77
|
* thinking, and other block kinds are skipped — only the model's user-facing
|
|
78
78
|
* prose is returned (empty string for a pure tool-use turn). This is what a
|
|
79
|
-
* Claude-brain wake records as a `thought` per turn
|
|
79
|
+
* Claude-brain wake records as a `thought` per turn, the same way
|
|
80
80
|
* the FSM's `emitThought` surfaces the model's reasoning.
|
|
81
81
|
*/
|
|
82
82
|
export function extractAssistantText(message) {
|
|
@@ -104,7 +104,7 @@ export function summarizeContext(snap) {
|
|
|
104
104
|
function renderEventLines(event, lines) {
|
|
105
105
|
if (event?.type)
|
|
106
106
|
lines.push(`Event type: ${event.type}`);
|
|
107
|
-
//
|
|
107
|
+
// notifications are not counterparty speech.
|
|
108
108
|
// agreement_lifecycle is a work signal (hire approval) — label it as such.
|
|
109
109
|
if (event?.text) {
|
|
110
110
|
const label = event.type === 'agreement_lifecycle'
|
|
@@ -122,7 +122,7 @@ function renderEventLines(event, lines) {
|
|
|
122
122
|
(event.operation === 'proposal_approved' || event.operation === 'proposal_approved_execute')) {
|
|
123
123
|
lines.push('Work signal: proposal approved. If you proposed this agreement, spawn the first task (task_create) under it now. If you are the hired provider, begin fulfilling per the agreement — do not ignore this wake.');
|
|
124
124
|
}
|
|
125
|
-
//
|
|
125
|
+
// store claim wakes as resource_changed (no chat, reason
|
|
126
126
|
// proposal_approved). Distinct from the lifecycle hire path above: open the
|
|
127
127
|
// buyer chat first, then greet and serve terms.
|
|
128
128
|
if (event?.type === 'resource_changed') {
|
|
@@ -155,7 +155,7 @@ function renderEventLines(event, lines) {
|
|
|
155
155
|
if (typeof event?.agreementId === 'string' && event.agreementId) {
|
|
156
156
|
lines.push(`Agreement: ${event.agreementId}`);
|
|
157
157
|
}
|
|
158
|
-
//
|
|
158
|
+
// surface the task/agreement this event carries. Without it the brain
|
|
159
159
|
// can't tell WHICH task to update/complete (workers otherwise stall asking for
|
|
160
160
|
// their own taskId) and can't see whether the referenced step already ran or
|
|
161
161
|
// failed — which makes an orchestrator re-spawn duplicate delegations.
|
|
@@ -167,7 +167,7 @@ function renderEventLines(event, lines) {
|
|
|
167
167
|
lines.push(`Agreement: ${result.agreementId}`);
|
|
168
168
|
if (typeof result.state === 'string')
|
|
169
169
|
lines.push(`Task state: ${result.state}`);
|
|
170
|
-
//
|
|
170
|
+
// surface the task's RESULT payload too. Completion notifies now
|
|
171
171
|
// pin it (backend), and an orchestrator consuming a worker's output has no
|
|
172
172
|
// task-read tool — without this line the step outcome never reaches the
|
|
173
173
|
// model and a chained pipeline stalls right after its first task.
|
|
@@ -183,7 +183,7 @@ function renderEventLines(event, lines) {
|
|
|
183
183
|
* Claude-brain turn. The agent's standing instructions come from its system
|
|
184
184
|
* prompt (protocol + role); this is just "here's what woke you, go handle it."
|
|
185
185
|
*
|
|
186
|
-
*
|
|
186
|
+
* EventQueue coalesces events that arrive while the lane is busy into
|
|
187
187
|
* a `{type:'batch', events:[...]}` frame. The FSM path unwraps those
|
|
188
188
|
* (PromptBuilder), but this path used to render just "Event type: batch" —
|
|
189
189
|
* every payload inside (including task results) was invisible to the model,
|
|
@@ -6,12 +6,12 @@ export interface ClaudeSdkToolContext extends Record<string, unknown> {
|
|
|
6
6
|
chatId?: string | null;
|
|
7
7
|
sessionId?: string | null;
|
|
8
8
|
eff?: EffectHandler;
|
|
9
|
-
/** Human/agent whose message woke the agent — forwarded to the shared tool executor
|
|
9
|
+
/** Human/agent whose message woke the agent — forwarded to the shared tool executor. */
|
|
10
10
|
senderId?: string;
|
|
11
11
|
senderType?: string;
|
|
12
|
-
/** Agreement this wake acts under
|
|
12
|
+
/** Agreement this wake acts under — lets a delegated per-user MCP call resolve the originating end-user. */
|
|
13
13
|
onBehalfOfAgreementId?: string;
|
|
14
|
-
/** Per-wake id grouping this tick's tool calls in telemetry
|
|
14
|
+
/** Per-wake id grouping this tick's tool calls in telemetry. Random — never use for idempotency. */
|
|
15
15
|
runId?: string;
|
|
16
16
|
/** Replay-stable write keys for this wake — write tools derive idempotency keys from here, never from the LLM. */
|
|
17
17
|
writeKeys?: DeliveryWriteKeys;
|
|
@@ -3,7 +3,7 @@ import { listTasks } from '@ziggs-ai/api-client';
|
|
|
3
3
|
import { defineTool } from '../tools/defineTool.js';
|
|
4
4
|
import { listGrantsTool } from '../server/tools/tier2/grantsTools.js';
|
|
5
5
|
import { CHAT_TOOLS } from '../server/tools/tier2/chatTools.js';
|
|
6
|
-
//
|
|
6
|
+
// default message-history cap. An uncapped snapshot returns the whole
|
|
7
7
|
// chat — in a delegation chat that accumulates notification rows, every wake's
|
|
8
8
|
// snapshot ballooned (observed 35–47k input tokens/wake, ~205k/run). 12 recent
|
|
9
9
|
// messages cover "what woke me and what was just said"; the model can pass a
|
|
@@ -12,7 +12,7 @@ const DEFAULT_SNAPSHOT_MAX_MESSAGES = 12;
|
|
|
12
12
|
/**
|
|
13
13
|
* First usable string among the candidates, treating blank as absent.
|
|
14
14
|
*
|
|
15
|
-
*
|
|
15
|
+
* a model that does not know a value fills the field with `""` rather
|
|
16
16
|
* than omitting it — the schema shows `chatId`, the agent has no way to know it,
|
|
17
17
|
* so it sends an empty string. Plain `??` let that blank win over the lane
|
|
18
18
|
* default, and the very next line rejected it as missing. Every wake opened with
|
|
@@ -69,9 +69,9 @@ export const chatSendTool = defineTool('chat_send', {
|
|
|
69
69
|
const receiverId = firstFilled(args.receiverId, c.senderId);
|
|
70
70
|
if (!receiverId)
|
|
71
71
|
throw new Error('chat_send: receiverId is required (this wake has no sender to default to)');
|
|
72
|
-
// Default to the wake's content-derived key
|
|
72
|
+
// Default to the wake's content-derived key: a crash-replay that
|
|
73
73
|
// re-sends the same text re-derives the same messageId and the backend drops
|
|
74
|
-
// the duplicate
|
|
74
|
+
// the duplicate; a re-think with different text gets a new key
|
|
75
75
|
// instead of colliding on a per-wake ordinal. An explicit LLM idempotencyKey
|
|
76
76
|
// still wins (retry-safe resend of the same logical message across wakes);
|
|
77
77
|
// random only when the wake has no durable identity.
|
|
@@ -89,14 +89,14 @@ export const chatSendTool = defineTool('chat_send', {
|
|
|
89
89
|
}, { description: 'Send a user-visible chat message. Conversation only — never use for finished-work reporting.' });
|
|
90
90
|
// Inbox read/ack are deliberately NOT here: the host owns the pull/ack cycle
|
|
91
91
|
// (its per-agent inbox long-poll loop). A brain-side ack would race the host's,
|
|
92
|
-
// and a per-turn inbox poll fed the tool-operation echo loop
|
|
92
|
+
// and a per-turn inbox poll fed the tool-operation echo loop.
|
|
93
93
|
//
|
|
94
|
-
// grant_list IS here
|
|
94
|
+
// grant_list IS here: the hosted agent must always be able to answer
|
|
95
95
|
// "what grants of mine do you hold?" across every rail — the 2026-07-20 incident
|
|
96
96
|
// was a hosted agent with no grant-read tool telling its principal that lookup
|
|
97
97
|
// doesn't exist. It reads operatorKey/agentId straight off the tool context.
|
|
98
98
|
//
|
|
99
|
-
// task_list IS here
|
|
99
|
+
// task_list IS here: MCP delegates have ziggs_task_list; the hosted
|
|
100
100
|
// Claude surface previously had no way to enumerate its own open tasks (reads
|
|
101
101
|
// were prompt-injected only). Same GET /tasks scope as the MCP tool.
|
|
102
102
|
export const listTasksTool = defineTool('task_list', {
|
|
@@ -121,7 +121,7 @@ export const listTasksTool = defineTool('task_list', {
|
|
|
121
121
|
if (!c.agentId)
|
|
122
122
|
throw new Error('task_list: agentId missing from tool context');
|
|
123
123
|
const assignedTo = args.assignedToMe ? c.agentId : args.assignedTo;
|
|
124
|
-
//
|
|
124
|
+
// the lane fences this to the engagement's tasks. Without it the
|
|
125
125
|
// list is every task the agent's key can reach, across all its customers.
|
|
126
126
|
const laneId = c.chatId || c.sessionId || undefined;
|
|
127
127
|
return listTasks({
|
|
@@ -142,7 +142,7 @@ export const CLAUDE_SDK_TOOLS = [
|
|
|
142
142
|
chatSendTool,
|
|
143
143
|
listGrantsTool,
|
|
144
144
|
listTasksTool,
|
|
145
|
-
//
|
|
145
|
+
// store-claim providers must open the buyer chat from the default
|
|
146
146
|
// Claude surface (chat_open was tier-2 / email-agent opt-in only).
|
|
147
147
|
...CHAT_TOOLS,
|
|
148
148
|
];
|
|
@@ -3,7 +3,7 @@ import type { ToolDefinition } from '../tools/defineTool.js';
|
|
|
3
3
|
import type { ClaudeSdkToolContext } from './claudeSdkTools.js';
|
|
4
4
|
/**
|
|
5
5
|
* Map Ziggs `ToolDefinition`s to Claude Agent SDK MCP tools. Each handler routes
|
|
6
|
-
* execution through `eff({ kind: 'tool-call' })` — the shared executor
|
|
6
|
+
* execution through `eff({ kind: 'tool-call' })` — the shared executor.
|
|
7
7
|
*/
|
|
8
8
|
export declare function buildSdkToolDefs(toolDefs: ToolDefinition[], getContext: () => ClaudeSdkToolContext): Array<SdkMcpToolDefinition>;
|
|
9
9
|
export declare function buildZiggsSdkMcpServer(toolDefs: ToolDefinition[], getContext: () => ClaudeSdkToolContext, options?: {
|
|
@@ -54,7 +54,7 @@ function parametersToZodShape(parameters) {
|
|
|
54
54
|
return shape;
|
|
55
55
|
}
|
|
56
56
|
/**
|
|
57
|
-
*
|
|
57
|
+
* the Claude brain's args are validated here, before `eff` hands
|
|
58
58
|
* them to the shared executor, so a plain shape means an unknown param is
|
|
59
59
|
* stripped at this layer and ToolManager's own check never sees it. Closing
|
|
60
60
|
* the object is what makes the rejection reach the brain: the call fails with
|
|
@@ -82,7 +82,7 @@ function toCallToolError(err) {
|
|
|
82
82
|
}
|
|
83
83
|
/**
|
|
84
84
|
* Map Ziggs `ToolDefinition`s to Claude Agent SDK MCP tools. Each handler routes
|
|
85
|
-
* execution through `eff({ kind: 'tool-call' })` — the shared executor
|
|
85
|
+
* execution through `eff({ kind: 'tool-call' })` — the shared executor.
|
|
86
86
|
*/
|
|
87
87
|
export function buildSdkToolDefs(toolDefs, getContext) {
|
|
88
88
|
return toolDefs.map((def) => {
|
|
@@ -21,7 +21,7 @@ function applyTaskOperationResultToContext(updates, operation, result) {
|
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
23
|
if (operation === 'task-update') {
|
|
24
|
-
// `state` only
|
|
24
|
+
// `state` only cut `status` from the wire.
|
|
25
25
|
const state = (task?.['state'] || r['state']);
|
|
26
26
|
if (state === 'completed')
|
|
27
27
|
updates['taskCompleted'] = true;
|
package/dist/defineAgent.js
CHANGED
|
@@ -35,7 +35,7 @@ export function defineAgent(input) {
|
|
|
35
35
|
const workflow = injectTaskIntakeDefault(injectKickoffDefault({
|
|
36
36
|
id: input.agentId,
|
|
37
37
|
// The workflow description is the agent's role text, which PromptBuilder
|
|
38
|
-
// renders into <self>.
|
|
38
|
+
// renders into <self>. split that from the store-facing
|
|
39
39
|
// `description`: prefer the prompt when the author supplied one.
|
|
40
40
|
description: input.systemPrompt || input.description,
|
|
41
41
|
initial: input.initial,
|
|
@@ -68,7 +68,7 @@ export function defineAgent(input) {
|
|
|
68
68
|
tools,
|
|
69
69
|
model,
|
|
70
70
|
workflow,
|
|
71
|
-
//
|
|
71
|
+
// declaration is the source — receiving dynamic proposals is an
|
|
72
72
|
// explicit opt-in, and the default is claim-only (false). Derivation no
|
|
73
73
|
// longer decides; it validates: an explicit opt-in whose workflow wires no
|
|
74
74
|
// agreement_respond action is a declared door that cannot open.
|
|
@@ -24,7 +24,7 @@ export class HistoryFormatter {
|
|
|
24
24
|
const label = labelTypes ? '[CHAT] ' : '';
|
|
25
25
|
return `${label}${this.formatMessage(entry, agentId, timePrefix)}`;
|
|
26
26
|
}
|
|
27
|
-
//
|
|
27
|
+
// notices are not counterparty turns — no "from → to:" speech framing.
|
|
28
28
|
if (entryType === 'notification') {
|
|
29
29
|
const label = labelTypes ? '[NOTICE] ' : '';
|
|
30
30
|
return `${label}${timePrefix}[notice] ${entry['text'] || ''}`;
|
|
@@ -126,7 +126,7 @@ export class HistoryFormatter {
|
|
|
126
126
|
return 'System';
|
|
127
127
|
if (id === agentId)
|
|
128
128
|
return 'You';
|
|
129
|
-
//
|
|
129
|
+
// prefer presentation face when the wire masks the principal.
|
|
130
130
|
const presentation = participant['presentation'];
|
|
131
131
|
const faceName = (typeof presentation?.['name'] === 'string' && presentation['name']) ||
|
|
132
132
|
(typeof presentation?.['persona']?.['name'] === 'string'
|
package/dist/index.d.ts
CHANGED
|
@@ -58,7 +58,7 @@ export { HistoryFormatter, historyFormatter, AgreementFormatter, agreementFormat
|
|
|
58
58
|
export { ProactiveTrigger } from './server/proactive/ProactiveTrigger.js';
|
|
59
59
|
export { PollRegistry, declaredPolls, type PollBinding, type PollContext, type PollKind, type PollResult, } from './server/polls/PollKind.js';
|
|
60
60
|
export { PollRunner, type PollRunnerOptions, type WakeTarget } from './server/polls/PollRunner.js';
|
|
61
|
-
export { PROTOCOL_TOOLS, agreementProposeTool, agreementSubcontractTool, agreementRespondTool, agreementClaimTool, agreementCounterTool, agreementGetTool, agreementRevokeTool, agreementFulfillTool, taskCreateTool, taskSetResultTool, taskUpdatePlanStepTool, dispatchProtocolOp, PAYMENT_TOOLS, paymentBalanceTool, paymentTransferTool, paymentHoldTool, paymentReleaseTool, paymentResolveWalletTool, CONNECTION_TOOLS, connectionProxyTool, connectionListGrantsTool, requestConnectionTool, DISCOVERY_TOOLS, agentSearchTool, agentGetTool, MARKETPLACE_TOOLS, marketplaceViewTool, CONTEXT_TOOLS, contextReadTool, contextDelegateTool, contextExpandReachTool, contextDiscoverGrantableTool, GRANTS_TOOLS, listGrantsTool, LINK_TOOLS, linkCreateInviteTool, linkListTool, ARTIFACT_TOOLS, recordArtifactTool, CHAT_TOOLS, openConversationTool, } from './server/tools/index.js';
|
|
61
|
+
export { PROTOCOL_TOOLS, agreementProposeTool, agreementSubcontractTool, agreementRespondTool, agreementClaimTool, agreementCounterTool, agreementGetTool, agreementRevokeTool, agreementFulfillTool, taskCreateTool, taskSetResultTool, taskUpdatePlanStepTool, dispatchProtocolOp, PAYMENT_TOOLS, paymentBalanceTool, paymentTransferTool, paymentHoldTool, paymentReleaseTool, paymentResolveWalletTool, CONNECTION_TOOLS, connectionProxyTool, connectionListGrantsTool, requestConnectionTool, MCP_CONNECTION_TOOLS, mcpToolCallTool, mcpToolsListTool, DISCOVERY_TOOLS, agentSearchTool, agentGetTool, MARKETPLACE_TOOLS, marketplaceViewTool, CONTEXT_TOOLS, contextReadTool, contextDelegateTool, contextExpandReachTool, contextDiscoverGrantableTool, GRANTS_TOOLS, listGrantsTool, LINK_TOOLS, linkCreateInviteTool, linkListTool, ARTIFACT_TOOLS, recordArtifactTool, CHAT_TOOLS, openConversationTool, } from './server/tools/index.js';
|
|
62
62
|
export { CLAUDE_SDK_TOOLS } from './agent/claudeSdkTools.js';
|
|
63
63
|
export { PROTOCOL_TOOL_NAMES, PROTOCOL_TOOL_TO_OPERATION, mapProtocolToolToOperation, isProtocolToolName } from './tasks/protocolRegistry.js';
|
|
64
64
|
export { InMemoryStore, FileMemoryStore } from './memory/MemoryStore.js';
|
package/dist/index.js
CHANGED
|
@@ -54,10 +54,10 @@ export { HistoryFormatter, historyFormatter, AgreementFormatter, agreementFormat
|
|
|
54
54
|
export { ProactiveTrigger } from './server/proactive/ProactiveTrigger.js';
|
|
55
55
|
export { PollRegistry, declaredPolls, } from './server/polls/PollKind.js';
|
|
56
56
|
export { PollRunner } from './server/polls/PollRunner.js';
|
|
57
|
-
//
|
|
57
|
+
// the hand-rolled ZiggsPayClient / ZiggsConnectClient were deleted;
|
|
58
58
|
// payment and connection tools now use @ziggs-ai/api-client's PaymentsClient /
|
|
59
59
|
// ConnectionsClient, the same clients ziggs-mcp uses.
|
|
60
|
-
//
|
|
60
|
+
// the hand-rolled ZiggsContextClient was deleted; context tools now
|
|
61
61
|
// use the same @ziggs-ai/api-client clients as ziggs-mcp (GrantsClient /
|
|
62
62
|
// ContextGrantsClient / ContextReadClient). Grant/reach types live there.
|
|
63
63
|
// All agent tool bundles live under server/tools/ (tier1 = protocol grammar,
|
|
@@ -66,8 +66,8 @@ export {
|
|
|
66
66
|
// Tier 1 — protocol grammar (framework-managed via taskTools).
|
|
67
67
|
PROTOCOL_TOOLS, agreementProposeTool, agreementSubcontractTool, agreementRespondTool, agreementClaimTool, agreementCounterTool, agreementGetTool, agreementRevokeTool, agreementFulfillTool, taskCreateTool, taskSetResultTool, taskUpdatePlanStepTool, dispatchProtocolOp,
|
|
68
68
|
// Tier 2 — opt-in capability bundles (spread into `tools:`).
|
|
69
|
-
PAYMENT_TOOLS, paymentBalanceTool, paymentTransferTool, paymentHoldTool, paymentReleaseTool, paymentResolveWalletTool, CONNECTION_TOOLS, connectionProxyTool, connectionListGrantsTool, requestConnectionTool, DISCOVERY_TOOLS, agentSearchTool, agentGetTool, MARKETPLACE_TOOLS, marketplaceViewTool, CONTEXT_TOOLS, contextReadTool, contextDelegateTool, contextExpandReachTool, contextDiscoverGrantableTool, GRANTS_TOOLS, listGrantsTool, LINK_TOOLS, linkCreateInviteTool, linkListTool, ARTIFACT_TOOLS, recordArtifactTool, CHAT_TOOLS, openConversationTool, } from './server/tools/index.js';
|
|
70
|
-
// The always-on toolset for the hosted Claude cognition (
|
|
69
|
+
PAYMENT_TOOLS, paymentBalanceTool, paymentTransferTool, paymentHoldTool, paymentReleaseTool, paymentResolveWalletTool, CONNECTION_TOOLS, connectionProxyTool, connectionListGrantsTool, requestConnectionTool, MCP_CONNECTION_TOOLS, mcpToolCallTool, mcpToolsListTool, DISCOVERY_TOOLS, agentSearchTool, agentGetTool, MARKETPLACE_TOOLS, marketplaceViewTool, CONTEXT_TOOLS, contextReadTool, contextDelegateTool, contextExpandReachTool, contextDiscoverGrantableTool, GRANTS_TOOLS, listGrantsTool, LINK_TOOLS, linkCreateInviteTool, linkListTool, ARTIFACT_TOOLS, recordArtifactTool, CHAT_TOOLS, openConversationTool, } from './server/tools/index.js';
|
|
70
|
+
// The always-on toolset for the hosted Claude cognition (parity guard
|
|
71
71
|
// reads this as part of the real SDK registry).
|
|
72
72
|
export { CLAUDE_SDK_TOOLS } from './agent/claudeSdkTools.js';
|
|
73
73
|
export { PROTOCOL_TOOL_NAMES, PROTOCOL_TOOL_TO_OPERATION, mapProtocolToolToOperation, isProtocolToolName } from './tasks/protocolRegistry.js';
|
|
@@ -77,7 +77,7 @@ export { buildContextUpdates, CONTEXT_RESET } from './context/applyEffects.js';
|
|
|
77
77
|
export { getBatchEvents, isTaskResultRelevantToAgent } from './context/batch.js';
|
|
78
78
|
export { classifyWorkflowEvent, findTaskResult, unwrapBatchEvent, findIncomingTaskResult } from './context/routingLabels.js';
|
|
79
79
|
export { MessagesClient, ArtifactsClient, AgentSearchClient, getBackendUrl,
|
|
80
|
-
//
|
|
80
|
+
// self-hosted / non-default backend: consumers of agent-sdk alone
|
|
81
81
|
// must be able to point the shared HTTP client without a direct api-client dep.
|
|
82
82
|
configureApiClient, } from '@ziggs-ai/api-client';
|
|
83
83
|
export { SeenMessages } from './server/SeenMessages.js';
|
|
@@ -12,7 +12,7 @@ export interface NormalizedEvent {
|
|
|
12
12
|
messageId?: string;
|
|
13
13
|
timestamp: number;
|
|
14
14
|
/**
|
|
15
|
-
* `notification` = lifecycle / status notice
|
|
15
|
+
* `notification` = lifecycle / status notice. Not counterparty
|
|
16
16
|
* speech; Claude parks without a model turn. Terminal task notices still
|
|
17
17
|
* use `task_result` so orchestrators see completions.
|
|
18
18
|
*/
|