@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
package/CHANGELOG.md
CHANGED
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
|
|
5
5
|
### Removed (breaking)
|
|
6
6
|
|
|
7
|
-
- Removed exports `createStaleBacklogGate`, `resolveReplayPolicy`, `newestActionableAt`, `parseReplayMaxAge`. The launcher rewrite deleted the wake machinery these gated: every agent stays connected and the write signals it, so there is no backlog to age out and nothing to replay-gate
|
|
7
|
+
- Removed exports `createStaleBacklogGate`, `resolveReplayPolicy`, `newestActionableAt`, `parseReplayMaxAge`. The launcher rewrite deleted the wake machinery these gated: every agent stays connected and the write signals it, so there is no backlog to age out and nothing to replay-gate. Pinned to 0.4.x and importing any of the four? Delete the call — the behaviour it bought is now unconditional. There is no replacement API.
|
|
8
8
|
- `FLEET_REPLAY_MAX_AGE` is no longer read; the replay window it set no longer exists. Nothing in this repo sets it, but it can come out of any deployment env that does.
|
|
9
|
-
- `Ctx` no longer carries `pendingSubtasks`, `collectedResults`, or `delegatedAgreementIds`.
|
|
10
|
-
- `WireResult.status` removed.
|
|
9
|
+
- `Ctx` no longer carries `pendingSubtasks`, `collectedResults`, or `delegatedAgreementIds`. The real bookkeeping moved into `Ctx.tasks` (keyed by taskId) and these mirrors stopped syncing, but they stayed on the interface as required-and-always-empty — so a workflow guard reading one saw empty forever and silently checked nothing. Read via `allPendingSubtasks(ctx)` / `allCollectedResults(ctx)` / `allDelegatedAgreementIds(ctx)`. Sessions persisted before `tasks` existed are still migrated on restore.
|
|
10
|
+
- `WireResult.status` removed. The wire carries `state` only; the `|| r.status` fallback tails were removed so a backend regression fails loudly instead of being absorbed. Task state resolves as `task?.state || r.state`.
|
|
11
11
|
|
|
12
12
|
### Added
|
|
13
13
|
|
|
@@ -18,16 +18,16 @@
|
|
|
18
18
|
- Attention gate: only the addressed agent spends a turn. A message addressed elsewhere in a shared room no longer wakes every participant.
|
|
19
19
|
- No turn on a lane whose agreement has ended, and none on the echo of a task that already reported — both previously cost a turn and produced nothing.
|
|
20
20
|
- Persona wire shapes are understood on inbound frames.
|
|
21
|
-
- A wake declares its lane so the backend can fence reach
|
|
22
|
-
- A proposal awaiting the agent's own consent counts as actionable rather than a notice to park
|
|
23
|
-
- Artifact idempotency keys are derived from content
|
|
24
|
-
- Blank tool arguments fall back to the wake's lane
|
|
21
|
+
- A wake declares its lane so the backend can fence reach.
|
|
22
|
+
- A proposal awaiting the agent's own consent counts as actionable rather than a notice to park.
|
|
23
|
+
- Artifact idempotency keys are derived from content.
|
|
24
|
+
- Blank tool arguments fall back to the wake's lane.
|
|
25
25
|
|
|
26
26
|
## 0.9.0 — 2026-07-30
|
|
27
27
|
|
|
28
28
|
### Changed (breaking)
|
|
29
29
|
|
|
30
|
-
- `task-update` / `task_set_result` accept `state` only — legacy `status` alias removed
|
|
30
|
+
- `task-update` / `task_set_result` accept `state` only — legacy `status` alias removed.
|
|
31
31
|
- Removed export `syncAggregateTaskViews`; read pending/collected/delegated via `allPendingSubtasks` / `allCollectedResults` / `allDelegatedAgreementIds`. Ctx aggregate mirrors stay empty.
|
|
32
32
|
|
|
33
33
|
## 0.4.0 — 2026-07-23
|
|
@@ -38,8 +38,8 @@
|
|
|
38
38
|
|
|
39
39
|
### Changed (breaking)
|
|
40
40
|
|
|
41
|
-
- Removed legacy socket-frame aliases; wire frames use canonical names only
|
|
42
|
-
- Delivery-law: classify inbound messages from the `service` wire shape
|
|
41
|
+
- Removed legacy socket-frame aliases; wire frames use canonical names only.
|
|
42
|
+
- Delivery-law: classify inbound messages from the `service` wire shape.
|
|
43
43
|
- Bumped `@ziggs-ai/api-client` to `^0.3.0`.
|
|
44
44
|
|
|
45
45
|
## 0.3.0 — 2026-07-22
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
|
|
51
51
|
## 0.2.0 — 2026-07-16
|
|
52
52
|
|
|
53
|
-
### Added
|
|
53
|
+
### Added
|
|
54
54
|
|
|
55
55
|
- Public brain selection API: `ziggsBrain()`, `claudeBrain()`, and `Brain` interface (`tick()`).
|
|
56
56
|
- `AgentHost` / `createAgent` accept `brain` — preferred over legacy `cognition: 'fsm' | 'claude-sdk'`.
|
package/README.md
CHANGED
|
@@ -91,7 +91,7 @@ The public **`Brain`** interface is `tick(TickInput): Promise<TickOutput>`. Buil
|
|
|
91
91
|
2. Pass **`openaiKey`**, **`operatorKey`** (Ziggs operator token), **`agentId`**, etc., and **`createAgent(config)`** (returns an **`AgentHost`**).
|
|
92
92
|
3. **`connect()`** to go live; the SDK long-polls the HTTP inbox and routes deliveries into **`handleMessage`**.
|
|
93
93
|
|
|
94
|
-
|
|
94
|
+
Worked examples and the full build path: https://ziggsai.com/docs
|
|
95
95
|
|
|
96
96
|
Point the shared HTTP client at a non-default backend (self-hosted / local) before constructing hosts — no direct `@ziggs-ai/api-client` dependency needed:
|
|
97
97
|
|
package/dist/AgentHost.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { AgentConfig, Ctx, Workflow } from './types.js';
|
|
2
|
-
import { Agent } from './agent/Agent.js';
|
|
2
|
+
import { Agent, type TickOutput } from './agent/Agent.js';
|
|
3
3
|
import { ClaudeSdkAgent, type CognitionKind } from './agent/ClaudeSdkAgent.js';
|
|
4
4
|
import { type BrainSelection } from './brain/index.js';
|
|
5
5
|
export type { CognitionKind };
|
|
@@ -25,6 +25,7 @@ export interface SessionStore {
|
|
|
25
25
|
import { ToolManager } from './tools/ToolManager.js';
|
|
26
26
|
import type { ToolDefinition } from './tools/defineTool.js';
|
|
27
27
|
import { OpenAIAdapter } from './adapters/OpenAIAdapter.js';
|
|
28
|
+
import { type AgentNeed } from './tools/needs.js';
|
|
28
29
|
/**
|
|
29
30
|
* The single fleet-wide default model — the one place the fallback lives.
|
|
30
31
|
* Change this (or set `LLM_MODEL`) to move the whole fleet; nothing hardcodes a
|
|
@@ -41,13 +42,13 @@ export declare const DEFAULT_MODEL = "claude-haiku-4-5";
|
|
|
41
42
|
*/
|
|
42
43
|
export type SessionResolver = (normalized: NormalizedEvent, ownAgentId: string) => string | null;
|
|
43
44
|
/**
|
|
44
|
-
*
|
|
45
|
+
* one lane key per unit of work, derived the same way as inbox wakes.
|
|
45
46
|
*
|
|
46
47
|
* Inbox deliveries key on `chatId` (DEFAULT_SESSION_RESOLVER). Bootstrap used to
|
|
47
48
|
* prefer bare `agreementId`, which opened a second lane for the same task and
|
|
48
49
|
* made the snapshot read treat the agreement id as a chat (`chatMissing: true`,
|
|
49
50
|
* empty context). Prefer the origin chat when present; otherwise the agreement's
|
|
50
|
-
* notification chat (`agrn-<agreementId>`), which is always linked after
|
|
51
|
+
* notification chat (`agrn-<agreementId>`), which is always linked after.
|
|
51
52
|
*/
|
|
52
53
|
export declare function laneSessionIdForTask(task: {
|
|
53
54
|
originChatId?: string | null;
|
|
@@ -72,16 +73,22 @@ export interface AgentHostOptions {
|
|
|
72
73
|
name?: string | null;
|
|
73
74
|
/** Store-facing one-liner. See DefineAgentInput.description. */
|
|
74
75
|
description?: string;
|
|
75
|
-
/** Claude-brain system prompt
|
|
76
|
+
/** Claude-brain system prompt; falls back to `description`. */
|
|
76
77
|
systemPrompt?: string;
|
|
77
78
|
specialization?: string | null;
|
|
78
79
|
/**
|
|
79
|
-
*
|
|
80
|
+
* strings compared exactly against a quest's `match` field.
|
|
80
81
|
* Miss → ack with zero LLM. Match → normal wake. `specialization` is also
|
|
81
82
|
* checked when set.
|
|
82
83
|
*/
|
|
83
84
|
questMatchTags?: string[];
|
|
84
85
|
tools?: ToolDefinition[];
|
|
86
|
+
/**
|
|
87
|
+
* Access this agent cannot work without. Enforced at task start:
|
|
88
|
+
* a task arriving with no live grant behind a declared need is failed with the
|
|
89
|
+
* missing access named, before the tick spends anything.
|
|
90
|
+
*/
|
|
91
|
+
needs?: AgentNeed[];
|
|
85
92
|
taskTools?: 'all' | 'none' | string[];
|
|
86
93
|
/**
|
|
87
94
|
* Brain selection — preferred over legacy `cognition`.
|
|
@@ -96,7 +103,7 @@ export interface AgentHostOptions {
|
|
|
96
103
|
/** Max agentic turns per Claude SDK wake. Default 30. */
|
|
97
104
|
claudeMaxTurns?: number;
|
|
98
105
|
/**
|
|
99
|
-
*
|
|
106
|
+
* claude-sdk agents resume their transcript across wakes by default,
|
|
100
107
|
* so per-wake input grows monotonically on a long lane. When true, each wake
|
|
101
108
|
* starts a fresh Claude session — the protocol is backend-authoritative (the
|
|
102
109
|
* brain re-reads via context_snapshot / the wake event), so the
|
|
@@ -125,14 +132,14 @@ export interface AgentHostOptions {
|
|
|
125
132
|
sessionStore?: SessionStore;
|
|
126
133
|
/** Observability tap: called after every effect with the effect and its response. */
|
|
127
134
|
effectTap?: (effect: import('./types.js').Effect, response: unknown) => void;
|
|
128
|
-
/** Observability tap: called on every FSM state transition, no-match, depth-guard, or error-escape
|
|
135
|
+
/** Observability tap: called on every FSM state transition, no-match, depth-guard, or error-escape. */
|
|
129
136
|
transitionTap?: (event: import('./runtime/AgentMachine.js').TransitionEvent) => void;
|
|
130
137
|
/**
|
|
131
138
|
* Usage/cost tap: called once per settled tick with the tick's authoritative
|
|
132
139
|
* token usage (result.metrics). This is the SINGLE source of truth for
|
|
133
140
|
* usage/cost across every cognition — the FSM (llm-call + streamed reply +
|
|
134
141
|
* tool-internal LLM) and the Claude brain (incl. cache tokens) both funnel
|
|
135
|
-
* their spend here
|
|
142
|
+
* their spend here. effectTap / tool generations are structural
|
|
136
143
|
* tracing only and must NOT also carry billable usage, or cost double-counts.
|
|
137
144
|
*/
|
|
138
145
|
metricsTap?: (info: {
|
|
@@ -142,14 +149,47 @@ export interface AgentHostOptions {
|
|
|
142
149
|
cognition: string;
|
|
143
150
|
metrics: import('./agent/Agent.js').TickOutput['metrics'];
|
|
144
151
|
}) => void;
|
|
145
|
-
/**
|
|
152
|
+
/**
|
|
153
|
+
* Called with everything a wake consists of, immediately before the brain
|
|
154
|
+
* runs. Pair it with {@link AgentHost.replayWake} to re-run that exact wake
|
|
155
|
+
* later against edited agent source — the difference between iterating on a
|
|
156
|
+
* prompt in seconds and standing a whole world back up to see one turn.
|
|
157
|
+
*
|
|
158
|
+
* Emitted for every wake, including ones the brain then declines to spend an
|
|
159
|
+
* LLM call on, because "why did nothing happen?" is the question a recording
|
|
160
|
+
* most often has to answer.
|
|
161
|
+
*/
|
|
162
|
+
wakeTap?: (record: WakeRecord) => void;
|
|
163
|
+
/** Production monitoring ingest. Default on; set false to disable. */
|
|
146
164
|
telemetryIngest?: boolean;
|
|
147
165
|
/**
|
|
148
|
-
* Pull inbox on every WS connect/reconnect
|
|
166
|
+
* Pull inbox on every WS connect/reconnect. Default true.
|
|
149
167
|
* Recovers messages lost when backend in-memory pending queues are dropped.
|
|
150
168
|
*/
|
|
151
169
|
inboxCatchUp?: boolean;
|
|
152
170
|
}
|
|
171
|
+
/**
|
|
172
|
+
* One wake, as the brain received it.
|
|
173
|
+
*
|
|
174
|
+
* These four fields ARE the tick's input (`agent.tick({ event, ctx, state,
|
|
175
|
+
* identity })`) — everything else a tick touches is rebuilt from the agent's own
|
|
176
|
+
* config. So a record is replayable on its own, and a replay that behaves
|
|
177
|
+
* differently differs because the agent changed, not because the input drifted.
|
|
178
|
+
*
|
|
179
|
+
* Plain JSON on purpose: a record is meant to survive being written to a file
|
|
180
|
+
* and read back by another process.
|
|
181
|
+
*/
|
|
182
|
+
export interface WakeRecord {
|
|
183
|
+
agentId: string;
|
|
184
|
+
sessionId: string;
|
|
185
|
+
laneKey: string;
|
|
186
|
+
/** The event frame that woke the agent. */
|
|
187
|
+
event: unknown;
|
|
188
|
+
/** FSM context carried into the tick — undefined on a cold lane. */
|
|
189
|
+
ctx?: unknown;
|
|
190
|
+
/** FSM state the lane was parked in — undefined on a cold lane. */
|
|
191
|
+
state?: string;
|
|
192
|
+
}
|
|
153
193
|
/**
|
|
154
194
|
* ToolManager is a Map keyed by tool name, so the last registration silently
|
|
155
195
|
* wins. An agent's own tools register last — which means an `extraTools` entry
|
|
@@ -167,7 +207,7 @@ export declare function warnOnShadowedPlatformTools(platformTools: ToolDefinitio
|
|
|
167
207
|
* a transport (Ziggs WebSocket), and the lane router (per-session FIFO queue
|
|
168
208
|
* + in-memory session state).
|
|
169
209
|
*
|
|
170
|
-
* transport (WS) → handleMessage → agent.tick(
|
|
210
|
+
* transport (WS) → handleMessage → agent.tick(.. , eff) → ..
|
|
171
211
|
*/
|
|
172
212
|
export declare class AgentHost {
|
|
173
213
|
options: Required<Pick<AgentHostOptions, 'agentId' | 'operatorKey' | 'openaiKey'>> & AgentHostOptions;
|
|
@@ -189,6 +229,8 @@ export declare class AgentHost {
|
|
|
189
229
|
/** The per-agent inbox long-poll loop — this agent's sole wake source. */
|
|
190
230
|
private inboxLoop;
|
|
191
231
|
private inboxLoopEnabled;
|
|
232
|
+
/** Short-lived grant-provider cache for the declared-needs gate. */
|
|
233
|
+
private grantProviderCache;
|
|
192
234
|
constructor(options?: AgentHostOptions);
|
|
193
235
|
private _validate;
|
|
194
236
|
private _setup;
|
|
@@ -208,7 +250,7 @@ export declare class AgentHost {
|
|
|
208
250
|
/** Wire entry. Normalize → resolve session → enqueue on the right lane. */
|
|
209
251
|
handleMessage(text: string, metadata?: Record<string, unknown>): Promise<void>;
|
|
210
252
|
/**
|
|
211
|
-
*
|
|
253
|
+
* part 3 — an agreement lane outlives the agreement.
|
|
212
254
|
*
|
|
213
255
|
* A lane named `agrn-<agreementId>` keeps its Claude session for the whole
|
|
214
256
|
* engagement, so a trailing event after the deal ends pays for all of it: on
|
|
@@ -226,11 +268,11 @@ export declare class AgentHost {
|
|
|
226
268
|
*/
|
|
227
269
|
private laneAgreementIsTerminal;
|
|
228
270
|
/**
|
|
229
|
-
*
|
|
271
|
+
* the trailing turn on work that is already reported.
|
|
230
272
|
*
|
|
231
273
|
* A lane session carries the whole engagement, so the LAST wake is the most
|
|
232
274
|
* expensive one: on prod, the frame that followed a completed elicitation cost
|
|
233
|
-
* **158,733 tokens** with the session's input at 366,417 before
|
|
275
|
+
* **158,733 tokens** with the session's input at 366,417 before reset
|
|
234
276
|
* it, and produced nothing — the spec had been written and the task closed one
|
|
235
277
|
* frame earlier.
|
|
236
278
|
*
|
|
@@ -245,18 +287,56 @@ export declare class AgentHost {
|
|
|
245
287
|
* still gets its turn, because that is an agent with something left to say.
|
|
246
288
|
*/
|
|
247
289
|
private isSettledTaskEcho;
|
|
290
|
+
/** Providers of this agent's live connection grants. Its own seam, so the gate below is testable without a backend. */
|
|
291
|
+
private _listGrantProviders;
|
|
292
|
+
/**
|
|
293
|
+
* Short TTL on purpose: the gate runs on every wake, and a claim produces
|
|
294
|
+
* several in seconds — but hire comes before grant, so a grant arriving
|
|
295
|
+
* mid-engagement has to take effect without a restart.
|
|
296
|
+
*/
|
|
297
|
+
private _grantProvidersCached;
|
|
298
|
+
/**
|
|
299
|
+
* Refuse work this agent has no way to do, before it costs a turn.
|
|
300
|
+
* Returns true when work was refused and the tick must not run.
|
|
301
|
+
*
|
|
302
|
+
* Enforced at wake for an agent holding assigned work, not at hire: hire comes
|
|
303
|
+
* first and the grant second, so a hire-time gate would refuse every honest
|
|
304
|
+
* one. Not limited to the task frame either — a store claim wakes the agent on
|
|
305
|
+
* the agreement first, and a task-only gate let the model take that turn and
|
|
306
|
+
* reason its own way to "I have no grant" (measured on linear-janitor: 8 calls,
|
|
307
|
+
* 114,025 tokens, for what one HTTP call answers).
|
|
308
|
+
*
|
|
309
|
+
* It fails the task rather than skipping quietly, which would leave it active
|
|
310
|
+
* with nothing working it — the same invisible stall from the buyer's side.
|
|
311
|
+
*/
|
|
312
|
+
private _refuseIfNeedsUnmet;
|
|
248
313
|
private _processEvent;
|
|
314
|
+
/**
|
|
315
|
+
* Re-run one recorded wake against THIS host's agent, and nothing else.
|
|
316
|
+
*
|
|
317
|
+
* The dev loop for a prompt: record a wake off a live run, edit the agent, and
|
|
318
|
+
* see what it does differently in seconds instead of standing a world back up
|
|
319
|
+
* for one turn. The brain, tools and effect handler are the real ones, so the
|
|
320
|
+
* turn is real — its tool calls hit the backend this host is pointed at, which
|
|
321
|
+
* is why it belongs against a disposable world and not a shared one.
|
|
322
|
+
*
|
|
323
|
+
* Deliberately NOT routed through `_processEvent`: everything that method does
|
|
324
|
+
* around the tick is lane bookkeeping — session state, liveness timers, session
|
|
325
|
+
* persistence, ack decisions, failure re-arm — and a replay has no lane to keep.
|
|
326
|
+
* Borrowing that path would make a dev tool able to disturb a live one.
|
|
327
|
+
*/
|
|
328
|
+
replayWake(record: WakeRecord): Promise<TickOutput>;
|
|
249
329
|
/** Arms the lane's liveness timer iff stateName is a parked state declaring timeoutMs. */
|
|
250
330
|
private _armIfTimedParked;
|
|
251
331
|
private _resolveOwnAgentId;
|
|
252
332
|
connectAsync(_timeout?: number): Promise<this>;
|
|
253
333
|
/**
|
|
254
|
-
*
|
|
334
|
+
* plain string compare against {@link AgentHostOptions.questMatchTags}
|
|
255
335
|
* and `specialization`. No match → return (caller acks). Match → normal wake.
|
|
256
336
|
*/
|
|
257
337
|
private triageQuestDelivery;
|
|
258
338
|
private _bootstrapAssignedActiveTasks;
|
|
259
|
-
/**
|
|
339
|
+
/** replay task-assigned for an existing active task (demo recovery). */
|
|
260
340
|
wakeTaskAssignment(taskId: string): Promise<void>;
|
|
261
341
|
disconnect(): void;
|
|
262
342
|
/** Waits for all in-flight ticks to complete. Call before process.exit() on SIGTERM. */
|