@ziggs-ai/agent-sdk 0.10.8 → 0.11.1
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/README.md +1 -1
- package/dist/AgentHost.d.ts +96 -16
- package/dist/AgentHost.js +205 -25
- package/dist/adapters/AnthropicAdapter.js +1 -1
- package/dist/adapters/McpAdapter.d.ts +10 -10
- package/dist/adapters/McpAdapter.js +31 -21
- package/dist/adapters/OpenAIAdapter.js +1 -1
- package/dist/agent/Agent.d.ts +2 -2
- package/dist/agent/ClaudeSdkAgent.d.ts +15 -6
- package/dist/agent/ClaudeSdkAgent.js +149 -48
- 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 +34 -15
- 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 +33 -4
- package/dist/formatters/HistoryFormatter.js +2 -2
- package/dist/index.d.ts +4 -2
- package/dist/index.js +8 -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 +2 -2
- package/dist/pricing/fleetTierByAgentId.gen.js +9 -2
- 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 +18 -9
- 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 +27 -11
- package/dist/server/polls/PollRunner.d.ts +36 -1
- package/dist/server/polls/PollRunner.js +42 -2
- 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/tasks/TaskService.d.ts +5 -5
- 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.d.ts +1 -1
- package/dist/tools/ToolManager.js +3 -2
- package/dist/tools/capabilityAdapter.d.ts +1 -1
- package/dist/tools/capabilityAdapter.js +3 -3
- package/dist/tools/defineTool.d.ts +7 -0
- package/dist/tools/defineTool.js +13 -1
- package/dist/tools/needs.d.ts +54 -0
- package/dist/tools/needs.js +84 -0
- package/dist/tools/recordReport.d.ts +3 -3
- package/dist/tools/recordReport.js +3 -3
- package/dist/types.d.ts +28 -18
- package/package.json +3 -3
|
@@ -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
|
|
@@ -25,16 +25,33 @@ function firstFilled(...candidates) {
|
|
|
25
25
|
}
|
|
26
26
|
return undefined;
|
|
27
27
|
}
|
|
28
|
+
/**
|
|
29
|
+
* Accept the agreement id an agent was woken on where a chat id is wanted.
|
|
30
|
+
*
|
|
31
|
+
* An agent woken on an agreement reaches for its context with the only id that
|
|
32
|
+
* wake gave it — the agreement's. That is not a chat id, so the snapshot came
|
|
33
|
+
* back empty: no history, no agreements, the agent itself as the only participant,
|
|
34
|
+
* and a bare `chatMissing`. Observed on the FIRST wake of every two-agent run,
|
|
35
|
+
* and once it sent the provider off to chat instead of to its own task.
|
|
36
|
+
*
|
|
37
|
+
* An agreement's implicit notification chat is `agrn-<agreementId>` — the lane
|
|
38
|
+
* the backend itself routes agreement traffic through — so the id the agent has
|
|
39
|
+
* does name a readable room, one prefix away. Mapping it is the difference
|
|
40
|
+
* between a wasted turn and an answer.
|
|
41
|
+
*/
|
|
42
|
+
function asChatLane(id) {
|
|
43
|
+
return id?.startsWith('agr_') ? `agrn-${id}` : id;
|
|
44
|
+
}
|
|
28
45
|
// Named distinctly from ziggs-mcp's per-type `ziggs_context_read`: this is the
|
|
29
46
|
// one-shot aggregate snapshot (grant-fenced server-side), not a cursored read.
|
|
30
47
|
export const contextSnapshotTool = defineTool('context_snapshot', {
|
|
31
|
-
chatId: { type: 'string', description: 'Omit this to snapshot the chat you were woken in — that is the usual case, and you do not need to know its id. Only pass a chatId to snapshot a DIFFERENT chat.' },
|
|
48
|
+
chatId: { type: 'string', description: 'Omit this to snapshot the chat you were woken in — that is the usual case, and you do not need to know its id. Only pass a chatId to snapshot a DIFFERENT chat. An agreement id is accepted too, and reads that agreement\'s lane.' },
|
|
32
49
|
maxMessages: { type: 'number', description: `Message history cap (default ${DEFAULT_SNAPSHOT_MAX_MESSAGES}). Pass a larger value when you need deeper history.` },
|
|
33
50
|
}, async (args, ctx) => {
|
|
34
51
|
const c = ctx;
|
|
35
52
|
if (!c.eff)
|
|
36
53
|
throw new Error('context_snapshot requires eff in tool context');
|
|
37
|
-
const sessionId = firstFilled(args.chatId, c.chatId, c.sessionId);
|
|
54
|
+
const sessionId = asChatLane(firstFilled(args.chatId, c.chatId, c.sessionId));
|
|
38
55
|
if (!sessionId) {
|
|
39
56
|
throw new Error('context_snapshot: this wake carries no chat to snapshot. Call it with no arguments ' +
|
|
40
57
|
'to read the chat you were woken in; if this wake is on an agreement lane with no ' +
|
|
@@ -57,7 +74,9 @@ export const chatSendTool = defineTool('chat_send', {
|
|
|
57
74
|
const c = ctx;
|
|
58
75
|
if (!c.eff)
|
|
59
76
|
throw new Error('chat_send requires eff in tool context');
|
|
60
|
-
|
|
77
|
+
// Same agreement-id-where-a-chat-id-goes slip as context_snapshot, and the
|
|
78
|
+
// same mapping: an agreement's traffic lane is `agrn-<agreementId>`.
|
|
79
|
+
const sessionId = asChatLane(firstFilled(args.chatId, c.chatId, c.sessionId));
|
|
61
80
|
if (!sessionId) {
|
|
62
81
|
throw new Error('chat_send: this wake carries no chat to send in. Call it with no chatId to reply in ' +
|
|
63
82
|
'the chat you were woken in, or pass the chatId of the chat you mean.');
|
|
@@ -69,9 +88,9 @@ export const chatSendTool = defineTool('chat_send', {
|
|
|
69
88
|
const receiverId = firstFilled(args.receiverId, c.senderId);
|
|
70
89
|
if (!receiverId)
|
|
71
90
|
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
|
|
91
|
+
// Default to the wake's content-derived key: a crash-replay that
|
|
73
92
|
// re-sends the same text re-derives the same messageId and the backend drops
|
|
74
|
-
// the duplicate
|
|
93
|
+
// the duplicate; a re-think with different text gets a new key
|
|
75
94
|
// instead of colliding on a per-wake ordinal. An explicit LLM idempotencyKey
|
|
76
95
|
// still wins (retry-safe resend of the same logical message across wakes);
|
|
77
96
|
// random only when the wake has no durable identity.
|
|
@@ -89,14 +108,14 @@ export const chatSendTool = defineTool('chat_send', {
|
|
|
89
108
|
}, { description: 'Send a user-visible chat message. Conversation only — never use for finished-work reporting.' });
|
|
90
109
|
// Inbox read/ack are deliberately NOT here: the host owns the pull/ack cycle
|
|
91
110
|
// (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
|
|
111
|
+
// and a per-turn inbox poll fed the tool-operation echo loop.
|
|
93
112
|
//
|
|
94
|
-
// grant_list IS here
|
|
95
|
-
// "what grants of mine do you hold?" across every rail
|
|
96
|
-
//
|
|
97
|
-
//
|
|
113
|
+
// grant_list IS here: the hosted agent must always be able to answer
|
|
114
|
+
// "what grants of mine do you hold?" across every rail. Without the tool an
|
|
115
|
+
// agent tells its principal the lookup does not exist. It reads
|
|
116
|
+
// operatorKey/agentId straight off the tool context.
|
|
98
117
|
//
|
|
99
|
-
// task_list IS here
|
|
118
|
+
// task_list IS here: MCP delegates have ziggs_task_list; the hosted
|
|
100
119
|
// Claude surface previously had no way to enumerate its own open tasks (reads
|
|
101
120
|
// were prompt-injected only). Same GET /tasks scope as the MCP tool.
|
|
102
121
|
export const listTasksTool = defineTool('task_list', {
|
|
@@ -121,7 +140,7 @@ export const listTasksTool = defineTool('task_list', {
|
|
|
121
140
|
if (!c.agentId)
|
|
122
141
|
throw new Error('task_list: agentId missing from tool context');
|
|
123
142
|
const assignedTo = args.assignedToMe ? c.agentId : args.assignedTo;
|
|
124
|
-
//
|
|
143
|
+
// the lane fences this to the engagement's tasks. Without it the
|
|
125
144
|
// list is every task the agent's key can reach, across all its customers.
|
|
126
145
|
const laneId = c.chatId || c.sessionId || undefined;
|
|
127
146
|
return listTasks({
|
|
@@ -142,7 +161,7 @@ export const CLAUDE_SDK_TOOLS = [
|
|
|
142
161
|
chatSendTool,
|
|
143
162
|
listGrantsTool,
|
|
144
163
|
listTasksTool,
|
|
145
|
-
//
|
|
164
|
+
// store-claim providers must open the buyer chat from the default
|
|
146
165
|
// Claude surface (chat_open was tier-2 / email-agent opt-in only).
|
|
147
166
|
...CHAT_TOOLS,
|
|
148
167
|
];
|
|
@@ -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
|
@@ -3,6 +3,8 @@ import { injectKickoffDefault } from './runtime/kickoff.js';
|
|
|
3
3
|
import { injectTaskIntakeDefault } from './runtime/taskIntake.js';
|
|
4
4
|
import { runtimeLog } from './shared/runtimeLog.js';
|
|
5
5
|
import { DEFAULT_MODEL } from './AgentHost.js';
|
|
6
|
+
import { normalizeNeeds, toolsForNeeds } from './tools/needs.js';
|
|
7
|
+
import { toolName } from './tools/defineTool.js';
|
|
6
8
|
/**
|
|
7
9
|
* Validates the workflow synchronously, resolves merged tools and model, and
|
|
8
10
|
* returns a frozen AgentConfig. Never mutates the input. `wait` defaults remain
|
|
@@ -35,7 +37,7 @@ export function defineAgent(input) {
|
|
|
35
37
|
const workflow = injectTaskIntakeDefault(injectKickoffDefault({
|
|
36
38
|
id: input.agentId,
|
|
37
39
|
// The workflow description is the agent's role text, which PromptBuilder
|
|
38
|
-
// renders into <self>.
|
|
40
|
+
// renders into <self>. split that from the store-facing
|
|
39
41
|
// `description`: prefer the prompt when the author supplied one.
|
|
40
42
|
description: input.systemPrompt || input.description,
|
|
41
43
|
initial: input.initial,
|
|
@@ -44,10 +46,34 @@ export function defineAgent(input) {
|
|
|
44
46
|
const { warnings } = validateWorkflow(workflow);
|
|
45
47
|
for (const w of warnings)
|
|
46
48
|
runtimeLog.warn('defineAgent', w);
|
|
47
|
-
|
|
49
|
+
// Tools the DECLARATION produces, not the author. An agent that says
|
|
50
|
+
// it needs a connection gets the tools to see and use one, so the prompt and
|
|
51
|
+
// the toolset cannot describe different worlds. Author tools come last and win
|
|
52
|
+
// on name, so hand-listing a derived tool is a no-op rather than a duplicate.
|
|
53
|
+
const needs = normalizeNeeds(input.needs);
|
|
54
|
+
const tools = [];
|
|
55
|
+
const positionByName = new Map();
|
|
56
|
+
for (const tool of [
|
|
57
|
+
...toolsForNeeds(needs),
|
|
48
58
|
...(Array.isArray(input.tools) ? input.tools : []),
|
|
49
59
|
...(Array.isArray(input.services?.tools) ? input.services.tools : []),
|
|
50
|
-
]
|
|
60
|
+
]) {
|
|
61
|
+
const name = toolName(tool);
|
|
62
|
+
// A nameless entry cannot be deduped — keep it and let ToolManager reject
|
|
63
|
+
// it the way it always has, rather than silently dropping it here.
|
|
64
|
+
if (!name) {
|
|
65
|
+
tools.push(tool);
|
|
66
|
+
continue;
|
|
67
|
+
}
|
|
68
|
+
const at = positionByName.get(name);
|
|
69
|
+
if (at === undefined) {
|
|
70
|
+
positionByName.set(name, tools.length);
|
|
71
|
+
tools.push(tool);
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
tools[at] = tool;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
51
77
|
// Model resolution, most-specific-first: a per-agent pin, then the
|
|
52
78
|
// fleet-wide `LLM_MODEL` lever, then the single `DEFAULT_MODEL` fallback (the
|
|
53
79
|
// ONE place the default lives — see AgentHost). The id also picks the provider
|
|
@@ -68,7 +94,7 @@ export function defineAgent(input) {
|
|
|
68
94
|
tools,
|
|
69
95
|
model,
|
|
70
96
|
workflow,
|
|
71
|
-
//
|
|
97
|
+
// declaration is the source — receiving dynamic proposals is an
|
|
72
98
|
// explicit opt-in, and the default is claim-only (false). Derivation no
|
|
73
99
|
// longer decides; it validates: an explicit opt-in whose workflow wires no
|
|
74
100
|
// agreement_respond action is a declared door that cannot open.
|
|
@@ -76,6 +102,9 @@ export function defineAgent(input) {
|
|
|
76
102
|
...(input.services ? { services: input.services } : {}),
|
|
77
103
|
...(taskTools !== undefined ? { taskTools } : {}),
|
|
78
104
|
...rest,
|
|
105
|
+
// After `rest`, so the config carries the NORMALIZED needs — AgentHost
|
|
106
|
+
// enforces these at task start and should not have to re-parse the raw field.
|
|
107
|
+
...(needs.length ? { needs } : {}),
|
|
79
108
|
};
|
|
80
109
|
return Object.freeze(config);
|
|
81
110
|
}
|
|
@@ -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
|
@@ -20,7 +20,7 @@ export type { CognitionKind } from './agent/ClaudeSdkAgent.js';
|
|
|
20
20
|
export { ziggsBrain, claudeBrain, isBrainSelection, isClaudeCognition } from './brain/index.js';
|
|
21
21
|
export type { Brain, BrainSelection, ZiggsBrainConfig, ClaudeBrainConfig, } from './brain/index.js';
|
|
22
22
|
export type { TickInput, TickOutput, AgentOptions } from './agent/Agent.js';
|
|
23
|
-
export type { SessionResolver, AgentHostOptions } from './AgentHost.js';
|
|
23
|
+
export type { SessionResolver, AgentHostOptions, WakeRecord } from './AgentHost.js';
|
|
24
24
|
export { createZiggsEffectHandler } from './server/ZiggsEffectHandler.js';
|
|
25
25
|
export type { ZiggsEffectDeps } from './server/ZiggsEffectHandler.js';
|
|
26
26
|
export { EventQueue } from './server/EventQueue.js';
|
|
@@ -52,13 +52,15 @@ export { ToolProvider } from './tools/ToolProvider.js';
|
|
|
52
52
|
export { defineTool } from './tools/defineTool.js';
|
|
53
53
|
export { recordReport } from './tools/recordReport.js';
|
|
54
54
|
export type { RecordReportInput, RecordReportResult, TaskReport } from './tools/recordReport.js';
|
|
55
|
+
export { MCP_PROVIDER, describeNeed, normalizeNeeds, toolsForNeed, toolsForNeeds, unmetNeeds, unmetNeedsMessage, } from './tools/needs.js';
|
|
56
|
+
export type { AgentNeed, ConnectionNeed } from './tools/needs.js';
|
|
55
57
|
export { OpenAIAdapter } from './adapters/OpenAIAdapter.js';
|
|
56
58
|
export { extractJSON, safeParseJSON } from './utils/jsonExtractor.js';
|
|
57
59
|
export { HistoryFormatter, historyFormatter, AgreementFormatter, agreementFormatter } from './formatters/index.js';
|
|
58
60
|
export { ProactiveTrigger } from './server/proactive/ProactiveTrigger.js';
|
|
59
61
|
export { PollRegistry, declaredPolls, type PollBinding, type PollContext, type PollKind, type PollResult, } from './server/polls/PollKind.js';
|
|
60
62
|
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';
|
|
63
|
+
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
64
|
export { CLAUDE_SDK_TOOLS } from './agent/claudeSdkTools.js';
|
|
63
65
|
export { PROTOCOL_TOOL_NAMES, PROTOCOL_TOOL_TO_OPERATION, mapProtocolToolToOperation, isProtocolToolName } from './tasks/protocolRegistry.js';
|
|
64
66
|
export { InMemoryStore, FileMemoryStore } from './memory/MemoryStore.js';
|
package/dist/index.js
CHANGED
|
@@ -48,16 +48,19 @@ export { ToolManager } from './tools/ToolManager.js';
|
|
|
48
48
|
export { ToolProvider } from './tools/ToolProvider.js';
|
|
49
49
|
export { defineTool } from './tools/defineTool.js';
|
|
50
50
|
export { recordReport } from './tools/recordReport.js';
|
|
51
|
+
// An agent declares the access it cannot work without, and the declaration
|
|
52
|
+
// produces the tools for it.
|
|
53
|
+
export { MCP_PROVIDER, describeNeed, normalizeNeeds, toolsForNeed, toolsForNeeds, unmetNeeds, unmetNeedsMessage, } from './tools/needs.js';
|
|
51
54
|
export { OpenAIAdapter } from './adapters/OpenAIAdapter.js';
|
|
52
55
|
export { extractJSON, safeParseJSON } from './utils/jsonExtractor.js';
|
|
53
56
|
export { HistoryFormatter, historyFormatter, AgreementFormatter, agreementFormatter } from './formatters/index.js';
|
|
54
57
|
export { ProactiveTrigger } from './server/proactive/ProactiveTrigger.js';
|
|
55
58
|
export { PollRegistry, declaredPolls, } from './server/polls/PollKind.js';
|
|
56
59
|
export { PollRunner } from './server/polls/PollRunner.js';
|
|
57
|
-
//
|
|
60
|
+
// the hand-rolled ZiggsPayClient / ZiggsConnectClient were deleted;
|
|
58
61
|
// payment and connection tools now use @ziggs-ai/api-client's PaymentsClient /
|
|
59
62
|
// ConnectionsClient, the same clients ziggs-mcp uses.
|
|
60
|
-
//
|
|
63
|
+
// the hand-rolled ZiggsContextClient was deleted; context tools now
|
|
61
64
|
// use the same @ziggs-ai/api-client clients as ziggs-mcp (GrantsClient /
|
|
62
65
|
// ContextGrantsClient / ContextReadClient). Grant/reach types live there.
|
|
63
66
|
// All agent tool bundles live under server/tools/ (tier1 = protocol grammar,
|
|
@@ -66,8 +69,8 @@ export {
|
|
|
66
69
|
// Tier 1 — protocol grammar (framework-managed via taskTools).
|
|
67
70
|
PROTOCOL_TOOLS, agreementProposeTool, agreementSubcontractTool, agreementRespondTool, agreementClaimTool, agreementCounterTool, agreementGetTool, agreementRevokeTool, agreementFulfillTool, taskCreateTool, taskSetResultTool, taskUpdatePlanStepTool, dispatchProtocolOp,
|
|
68
71
|
// 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 (
|
|
72
|
+
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';
|
|
73
|
+
// The always-on toolset for the hosted Claude cognition (parity guard
|
|
71
74
|
// reads this as part of the real SDK registry).
|
|
72
75
|
export { CLAUDE_SDK_TOOLS } from './agent/claudeSdkTools.js';
|
|
73
76
|
export { PROTOCOL_TOOL_NAMES, PROTOCOL_TOOL_TO_OPERATION, mapProtocolToolToOperation, isProtocolToolName } from './tasks/protocolRegistry.js';
|
|
@@ -77,7 +80,7 @@ export { buildContextUpdates, CONTEXT_RESET } from './context/applyEffects.js';
|
|
|
77
80
|
export { getBatchEvents, isTaskResultRelevantToAgent } from './context/batch.js';
|
|
78
81
|
export { classifyWorkflowEvent, findTaskResult, unwrapBatchEvent, findIncomingTaskResult } from './context/routingLabels.js';
|
|
79
82
|
export { MessagesClient, ArtifactsClient, AgentSearchClient, getBackendUrl,
|
|
80
|
-
//
|
|
83
|
+
// self-hosted / non-default backend: consumers of agent-sdk alone
|
|
81
84
|
// must be able to point the shared HTTP client without a direct api-client dep.
|
|
82
85
|
configureApiClient, } from '@ziggs-ai/api-client';
|
|
83
86
|
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
|
*/
|
|
@@ -33,7 +33,7 @@ function wireAgreementId(metadata) {
|
|
|
33
33
|
* Self-hire / fully-consented create activates before the chat fan-out lands.
|
|
34
34
|
* The wire still says `proposal_created`, but the embedded agreement is already
|
|
35
35
|
* `active` / proposal `approved`. That is the hire work signal (same as
|
|
36
|
-
* `proposal_approved_execute`) — Claude must not park it as a notice
|
|
36
|
+
* `proposal_approved_execute`) — Claude must not park it as a notice.
|
|
37
37
|
*/
|
|
38
38
|
function isAlreadyActivatedProposalCreated(metadata) {
|
|
39
39
|
if (wireOperation(metadata) !== 'proposal_created')
|
|
@@ -46,13 +46,13 @@ function isAlreadyActivatedProposalCreated(metadata) {
|
|
|
46
46
|
return status === 'active' || proposalStatus === 'approved';
|
|
47
47
|
}
|
|
48
48
|
/**
|
|
49
|
-
*
|
|
49
|
+
* a `proposal_created` notification addressed to a party whose
|
|
50
50
|
* approval is PENDING is a consent REQUEST, not a status notice. The backend
|
|
51
51
|
* fans `proposal_created` out specifically to the pending approvers
|
|
52
|
-
|
|
52
|
+
*, and parking it meant the hand-off provider — or any
|
|
53
53
|
* agent whose consent a proposal awaits — was alerted and then never looked:
|
|
54
54
|
* the approval sat pending until a human nudged the chat. Same technique as
|
|
55
|
-
* isAlreadyActivatedProposalCreated
|
|
55
|
+
* isAlreadyActivatedProposalCreated: reclassify by what the
|
|
56
56
|
* embedded agreement SAYS rather than adding a new wake word.
|
|
57
57
|
*/
|
|
58
58
|
function isPendingApprovalRequestNotification(metadata) {
|
|
@@ -90,7 +90,7 @@ function isTerminalTaskState(state) {
|
|
|
90
90
|
* compatibility but no longer gates anything.
|
|
91
91
|
*/
|
|
92
92
|
export function normalizeIncomingEvent({ text, metadata = {} }) {
|
|
93
|
-
//
|
|
93
|
+
// classifier data lives under `service` on the inbox-pull wire;
|
|
94
94
|
// fall back to top-level for hand-built (direct-injection) metadata.
|
|
95
95
|
const taskData = (metadata.service?.task ?? metadata.task) || null;
|
|
96
96
|
const chatId = normalizeChatId(metadata);
|
|
@@ -124,7 +124,7 @@ export function normalizeIncomingEvent({ text, metadata = {} }) {
|
|
|
124
124
|
};
|
|
125
125
|
}
|
|
126
126
|
if (isTaskRelated(metadata, taskData)) {
|
|
127
|
-
//
|
|
127
|
+
// active/spawn chat notices are not work — real assignment arrives
|
|
128
128
|
// on the task channel (`tasksAwaitingMe` → wakeTaskAssignment). Keep terminal
|
|
129
129
|
// task notices as `task_result` so orchestrators still see completions.
|
|
130
130
|
if (entryType === 'notification' && !isTerminalTaskState(taskData?.state)) {
|
|
@@ -144,7 +144,7 @@ export function normalizeIncomingEvent({ text, metadata = {} }) {
|
|
|
144
144
|
event: { ...base, type: 'task_result', result: taskData, text },
|
|
145
145
|
};
|
|
146
146
|
}
|
|
147
|
-
//
|
|
147
|
+
// residual lifecycle notices (proposal_created, agreement active, …)
|
|
148
148
|
// must not fall through as counterparty `message` speech.
|
|
149
149
|
if (entryType === 'notification') {
|
|
150
150
|
const operation = metadata.service?.operation ?? metadata.operation;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* default paid pricing for Ziggs-operated (first-party) agents.
|
|
3
3
|
* Prices are in wallet cents (1 ZIG = 100 cents).
|
|
4
4
|
*/
|
|
5
5
|
import { type FleetPricingTier } from './fleetTierByAgentId.gen.js';
|
|
@@ -22,7 +22,7 @@ export interface ProtocolPricingPayload {
|
|
|
22
22
|
[key: string]: unknown;
|
|
23
23
|
}
|
|
24
24
|
/**
|
|
25
|
-
* Apply
|
|
25
|
+
* Apply defaults when `price` is omitted (null/undefined).
|
|
26
26
|
* Explicit `price: 0` is kept (free-on-purpose).
|
|
27
27
|
*/
|
|
28
28
|
export declare function applyFleetAgreementPricing(operation: 'agreement-propose' | 'agreement-subcontract', payload: ProtocolPricingPayload, actingAgentId: string): ProtocolPricingPayload;
|
|
@@ -36,7 +36,7 @@ export declare function applyFleetAgreementPricing(operation: 'agreement-propose
|
|
|
36
36
|
*/
|
|
37
37
|
export declare function applyFleetCounterPricing<T extends ProtocolPricingPayload>(payload: T, actingAgentId: string): T;
|
|
38
38
|
/**
|
|
39
|
-
* Infer fleet actor when tool context omits agentId (
|
|
39
|
+
* Infer fleet actor when tool context omits agentId (safety net).
|
|
40
40
|
*/
|
|
41
41
|
export declare function inferFleetPricingActorId(payload: ProtocolPricingPayload): string | null;
|
|
42
42
|
/** Apply fleet defaults with optional acting agent (falls back to payload inference). */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* default paid pricing for Ziggs-operated (first-party) agents.
|
|
3
3
|
* Prices are in wallet cents (1 ZIG = 100 cents).
|
|
4
4
|
*/
|
|
5
5
|
import { FLEET_TIER_BY_AGENT_ID } from './fleetTierByAgentId.gen.js';
|
|
@@ -54,7 +54,7 @@ export function resolveDefaultPriceCentsForExecutor(executorId, description) {
|
|
|
54
54
|
return tierPriceCents(tier);
|
|
55
55
|
}
|
|
56
56
|
/**
|
|
57
|
-
* Apply
|
|
57
|
+
* Apply defaults when `price` is omitted (null/undefined).
|
|
58
58
|
* Explicit `price: 0` is kept (free-on-purpose).
|
|
59
59
|
*/
|
|
60
60
|
export function applyFleetAgreementPricing(operation, payload, actingAgentId) {
|
|
@@ -122,7 +122,7 @@ export function applyFleetCounterPricing(payload, actingAgentId) {
|
|
|
122
122
|
return { ...payload, price: cents };
|
|
123
123
|
}
|
|
124
124
|
/**
|
|
125
|
-
* Infer fleet actor when tool context omits agentId (
|
|
125
|
+
* Infer fleet actor when tool context omits agentId (safety net).
|
|
126
126
|
*/
|
|
127
127
|
export function inferFleetPricingActorId(payload) {
|
|
128
128
|
const executor = payload.executorId != null ? String(payload.executorId) : '';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* eval/harness free pricing via env flag (no SANDBOX id-shape regex).
|
|
3
3
|
*/
|
|
4
4
|
/** Capability-probe + test harness agents (agents/test/). */
|
|
5
5
|
export declare const EVAL_HARNESS_AGENT_IDS: Set<string>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* eval/harness free pricing via env flag (no SANDBOX id-shape regex).
|
|
3
3
|
*/
|
|
4
4
|
/** Capability-probe + test harness agents (agents/test/). */
|
|
5
5
|
export const EVAL_HARNESS_AGENT_IDS = new Set([
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* AUTO-GENERATED by scripts/build-fleet-tier-map.mjs — do not edit by hand.
|
|
3
|
-
*
|
|
3
|
+
* Tier A trivial public lookups (free when price omitted).
|
|
4
4
|
*/
|
|
5
5
|
export declare const FREE_TIER_A_AGENT_IDS: Set<string>;
|
|
6
6
|
export declare const FREE_TIER_A_COUNT = 4;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* AUTO-GENERATED by scripts/build-fleet-tier-map.mjs — do not edit by hand.
|
|
3
|
-
*
|
|
3
|
+
* Tier A trivial public lookups (free when price omitted).
|
|
4
4
|
*/
|
|
5
5
|
export const FREE_TIER_A_AGENT_IDS = new Set([
|
|
6
6
|
"site-health-checker",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* AUTO-GENERATED by scripts/build-fleet-tier-map.mjs — do not edit by hand.
|
|
3
|
-
*
|
|
3
|
+
* Local default pricing; the server resolves an agent's own pricing tier.
|
|
4
4
|
*/
|
|
5
5
|
export type FleetPricingTier = 'A' | 'B' | 'C' | 'D';
|
|
6
6
|
export declare const FLEET_TIER_BY_AGENT_ID: Record<string, FleetPricingTier>;
|
|
7
|
-
export declare const FLEET_TIER_MAP_SIZE =
|
|
7
|
+
export declare const FLEET_TIER_MAP_SIZE = 772;
|