@demicodes/agent 0.21.0 → 0.22.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/dist/client-entry.d.mts +2 -2
- package/dist/index.d.mts +192 -44
- package/dist/index.mjs +435 -200
- package/dist/stdio-transport.d.mts +1 -1
- package/dist/{transport-_eV2zg9M.d.mts → transport-vzA9vMxT.d.mts} +2 -0
- package/dist/{websocket-transport-BC7OstFf.d.mts → websocket-transport-CyoM_NS1.d.mts} +1 -1
- package/package.json +5 -5
package/dist/client-entry.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { f as TranscriptPatch, l as ServerFrame, n as AgentServerTransport, o as ClientFrame, r as AgentTransport, s as ClientSessionEvent, t as AgentClientTransport, u as ShellCommandStatusLike, x as AgentMetadata } from "./transport-
|
|
2
|
-
import { a as AgentClient, i as AgentActionOptions, n as createWebSocketClientTransport, o as AgentClientListener, r as createWebSocketServerTransport, t as JsonWebSocket } from "./websocket-transport-
|
|
1
|
+
import { f as TranscriptPatch, l as ServerFrame, n as AgentServerTransport, o as ClientFrame, r as AgentTransport, s as ClientSessionEvent, t as AgentClientTransport, u as ShellCommandStatusLike, x as AgentMetadata } from "./transport-vzA9vMxT.mjs";
|
|
2
|
+
import { a as AgentClient, i as AgentActionOptions, n as createWebSocketClientTransport, o as AgentClientListener, r as createWebSocketServerTransport, t as JsonWebSocket } from "./websocket-transport-CyoM_NS1.mjs";
|
|
3
3
|
import { ProviderSelection } from "@demicodes/provider";
|
|
4
4
|
export { type AgentActionOptions, AgentClient, type AgentClientListener, type AgentClientTransport, type AgentMetadata, type AgentServerTransport, type AgentTransport, type ClientFrame, type ClientSessionEvent, type JsonWebSocket, type ProviderSelection, type ServerFrame, type ShellCommandStatusLike, type TranscriptPatch, createWebSocketClientTransport, createWebSocketServerTransport };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { A as AgentSystemPromptContext, B as CompactionWindow, C as AgentReferenceResolveContext, D as AgentSessionParams, E as AgentSessionOptions, F as ExternalMutationReservation, G as DEFAULT_TURN_RETRY_POLICY, H as TranscriptLog, I as ModelSwitchApply, J as resolveRetryPolicy, K as TurnRetryPolicy, L as SessionEvent, M as AgentToolContext, N as AgentToolInvokeContext, O as AgentSessionRestoreParams, P as AgentToolInvokeResult, R as SessionEventListener, S as AgentPromptContext, T as AgentSessionCloneParams, U as TranscriptOptions, V as DrainedTranscriptPatches, W as estimateTranscriptBlockTokens, Y as retryDelayMs, _ as AgentHarnessContext, a as createInProcessTransportPair, b as AgentLifecycleEvent, c as ConversationSummary, d as SubagentJob, f as TranscriptPatch, g as AgentHarness, h as AgentDisposeContext, i as InProcessTransportPair, j as AgentTool, k as AgentSessionStore, l as ServerFrame, m as AbortTarget, n as AgentServerTransport, o as ClientFrame, p as AbortResult, q as isRetryableCode, r as AgentTransport, s as ClientSessionEvent, t as AgentClientTransport, u as ShellCommandStatusLike, v as AgentHarnessRuntime, w as AgentSessionCheckpoint, x as AgentMetadata, y as AgentHostContext, z as SubagentProfile } from "./transport-
|
|
2
|
-
import { a as AgentClient, i as AgentActionOptions, n as createWebSocketClientTransport, o as AgentClientListener, r as createWebSocketServerTransport, t as JsonWebSocket } from "./websocket-transport-
|
|
3
|
-
import { BashAuditEvent, BashEnvironment, BashEnvironmentOptions, Command, CommandMetadataRecord, Host, HostStore, ShellCommandStatus, ShellOutputChunk } from "@demicodes/shell";
|
|
1
|
+
import { A as AgentSystemPromptContext, B as CompactionWindow, C as AgentReferenceResolveContext, D as AgentSessionParams, E as AgentSessionOptions, F as ExternalMutationReservation, G as DEFAULT_TURN_RETRY_POLICY, H as TranscriptLog, I as ModelSwitchApply, J as resolveRetryPolicy, K as TurnRetryPolicy, L as SessionEvent, M as AgentToolContext, N as AgentToolInvokeContext, O as AgentSessionRestoreParams, P as AgentToolInvokeResult, R as SessionEventListener, S as AgentPromptContext, T as AgentSessionCloneParams, U as TranscriptOptions, V as DrainedTranscriptPatches, W as estimateTranscriptBlockTokens, Y as retryDelayMs, _ as AgentHarnessContext, a as createInProcessTransportPair, b as AgentLifecycleEvent, c as ConversationSummary, d as SubagentJob, f as TranscriptPatch, g as AgentHarness, h as AgentDisposeContext, i as InProcessTransportPair, j as AgentTool, k as AgentSessionStore, l as ServerFrame, m as AbortTarget, n as AgentServerTransport, o as ClientFrame, p as AbortResult, q as isRetryableCode, r as AgentTransport, s as ClientSessionEvent, t as AgentClientTransport, u as ShellCommandStatusLike, v as AgentHarnessRuntime, w as AgentSessionCheckpoint, x as AgentMetadata, y as AgentHostContext, z as SubagentProfile } from "./transport-vzA9vMxT.mjs";
|
|
2
|
+
import { a as AgentClient, i as AgentActionOptions, n as createWebSocketClientTransport, o as AgentClientListener, r as createWebSocketServerTransport, t as JsonWebSocket } from "./websocket-transport-CyoM_NS1.mjs";
|
|
3
|
+
import { BashAuditEvent, BashEnvironment, BashEnvironmentOptions, Command, CommandMetadataRecord, CommandRegistry, Host, HostStore, ShellCommandStatus, ShellOutputChunk } from "@demicodes/shell";
|
|
4
4
|
import { AgentProvider, Provider } from "@demicodes/provider";
|
|
5
5
|
import { Block, Model, ModelMediaKind, ModelSelection, ProviderErrorDiagnostics, QueuedMessage, SessionPhase, UserContentBlock } from "@demicodes/core";
|
|
6
6
|
//#region src/recovery.d.ts
|
|
@@ -140,6 +140,8 @@ declare class AgentSession<State> {
|
|
|
140
140
|
abort(): Promise<AbortResult>;
|
|
141
141
|
scheduleYieldWakeup(durationMs: number, metadata?: AgentMetadata | null): AgentToolInvokeResult;
|
|
142
142
|
waitUntilDone(): Promise<void>;
|
|
143
|
+
/** True when no turn is running and no action (including queued user sends) is pending. */
|
|
144
|
+
isSettled(): boolean;
|
|
143
145
|
/**
|
|
144
146
|
* Tears the session down: aborts any in-flight turn and releases provider-held resources
|
|
145
147
|
* (e.g. a long-lived CLI subprocess). Called when the owning connection closes.
|
|
@@ -273,11 +275,18 @@ interface AgentServerOptions {
|
|
|
273
275
|
session?: AgentServerSessionOptions;
|
|
274
276
|
subagents?: {
|
|
275
277
|
/**
|
|
276
|
-
* When false, a child closing never wakes
|
|
277
|
-
* user send; the host app observes the `subagent
|
|
278
|
-
* the
|
|
278
|
+
* When false, a child of the ROOT session closing never wakes the idle
|
|
279
|
+
* root with an automatic user send; the host app observes the `subagent
|
|
280
|
+
* closed` frame and drives the root itself. Applies to the root level
|
|
281
|
+
* only: a subagent parent has no host-side message channel, so deeper
|
|
282
|
+
* levels always self-notify. Defaults to true.
|
|
279
283
|
*/
|
|
280
284
|
notifyParentOnIdle?: boolean;
|
|
285
|
+
/**
|
|
286
|
+
* Live-children ceiling applied to every session in the tree (each session
|
|
287
|
+
* counts its own direct children). Defaults to {@link MAX_LIVE_SUBAGENTS}.
|
|
288
|
+
*/
|
|
289
|
+
maxLiveSubagents?: number;
|
|
281
290
|
};
|
|
282
291
|
/**
|
|
283
292
|
* Optional host-side shell prep (env, PATH, etc.). Implementation-agnostic —
|
|
@@ -323,6 +332,7 @@ declare class AgentServer {
|
|
|
323
332
|
private readonly sessionOptions;
|
|
324
333
|
private readonly prepareShell;
|
|
325
334
|
private readonly notifyParentOnIdle;
|
|
335
|
+
private readonly maxLiveSubagents;
|
|
326
336
|
private readonly bindings;
|
|
327
337
|
private readonly sessionOwnership;
|
|
328
338
|
constructor(options: AgentServerOptions);
|
|
@@ -338,35 +348,140 @@ declare class AgentServer {
|
|
|
338
348
|
}
|
|
339
349
|
//#endregion
|
|
340
350
|
//#region src/subagent.d.ts
|
|
351
|
+
/** Default per-session live-children ceiling; override with `AgentServerOptions.subagents.maxLiveSubagents`. */
|
|
341
352
|
declare const MAX_LIVE_SUBAGENTS = 8;
|
|
342
|
-
declare const MAX_ARCHIVED_SUBAGENTS = 16;
|
|
343
353
|
declare const SUBAGENT_RESULT_MAX_BYTES: number;
|
|
344
354
|
type SubagentExecution = 'idle' | 'provider_streaming' | 'tool_executing' | 'compacting' | 'finalizing' | 'pending_yield';
|
|
355
|
+
interface SubagentClose {
|
|
356
|
+
phase: 'completed' | 'aborted' | 'error';
|
|
357
|
+
result?: string;
|
|
358
|
+
failure?: string;
|
|
359
|
+
}
|
|
360
|
+
interface ChildToolRecord {
|
|
361
|
+
toolUseId: string;
|
|
362
|
+
title: string;
|
|
363
|
+
startedAt: number;
|
|
364
|
+
endedAt: number | null;
|
|
365
|
+
status: 'executing' | 'completed' | 'error';
|
|
366
|
+
}
|
|
367
|
+
interface ChildJob<State> {
|
|
368
|
+
id: string;
|
|
369
|
+
description: string;
|
|
370
|
+
profile: SubagentProfile<State>;
|
|
371
|
+
profileName: string | null;
|
|
372
|
+
metadata: AgentMetadata | null;
|
|
373
|
+
session: AgentSession<State>;
|
|
374
|
+
/** Supervisor of this child's own children (the grandchildren of this supervisor's owner). */
|
|
375
|
+
ownSupervisor: ChildSupervisor<State>;
|
|
376
|
+
commandRegistry: CommandRegistry;
|
|
377
|
+
commandNames: string[];
|
|
378
|
+
environments: Map<Host, BashEnvironment>;
|
|
379
|
+
pendingEnvironments: Map<Host, Promise<BashEnvironment>>;
|
|
380
|
+
readonlyHosts: WeakMap<Host, Host>;
|
|
381
|
+
spawnedAt: number;
|
|
382
|
+
lastEventAt: number;
|
|
383
|
+
tools: ChildToolRecord[];
|
|
384
|
+
lastAssistantTextAt: number | null;
|
|
385
|
+
phase: SubagentJob['phase'];
|
|
386
|
+
failure: string | null;
|
|
387
|
+
unsubscribe: () => void;
|
|
388
|
+
closed: Promise<SubagentClose>;
|
|
389
|
+
settleClosed: (close: SubagentClose) => void;
|
|
390
|
+
isClosing: boolean;
|
|
391
|
+
/** Wakes the settle loop when the child set or an inbound send changes the picture. */
|
|
392
|
+
wake: (() => void) | null;
|
|
393
|
+
}
|
|
394
|
+
/**
|
|
395
|
+
* Connection-wide flat registry of every live session in the tree: the root
|
|
396
|
+
* plus every subagent at any depth. The sole basis for cross-tree addressing —
|
|
397
|
+
* `send`, `steer`, `show`, and `list` resolve here, with no routing rules
|
|
398
|
+
* along the tree.
|
|
399
|
+
*/
|
|
400
|
+
declare class AgentDirectory<State = unknown> {
|
|
401
|
+
private root;
|
|
402
|
+
private readonly entries;
|
|
403
|
+
attachRoot(session: AgentSession<State>, supervisor: ChildSupervisor<State>): void;
|
|
404
|
+
rootId(): string;
|
|
405
|
+
rootSession(): AgentSession<State>;
|
|
406
|
+
register(job: ChildJob<State>, owner: ChildSupervisor<State>): void;
|
|
407
|
+
unregister(id: string): void;
|
|
408
|
+
liveEntry(id: string): {
|
|
409
|
+
job: ChildJob<State>;
|
|
410
|
+
owner: ChildSupervisor<State>;
|
|
411
|
+
} | null;
|
|
412
|
+
/** The parent session id of a live agent; null for the root, undefined for an unknown id. */
|
|
413
|
+
parentIdOf(id: string): string | null | undefined;
|
|
414
|
+
/**
|
|
415
|
+
* The whole session tree: the root, every live agent, and each live node's
|
|
416
|
+
* archived children (their supervisors exist, so their archives are
|
|
417
|
+
* readable). Live children order by spawn time; archived newest first.
|
|
418
|
+
*/
|
|
419
|
+
tree(): Promise<AgentTreeNode[]>;
|
|
420
|
+
}
|
|
421
|
+
interface AgentTreeNode {
|
|
422
|
+
id: string;
|
|
423
|
+
parentId: string | null;
|
|
424
|
+
kind: 'root' | 'live' | 'archived';
|
|
425
|
+
description: string;
|
|
426
|
+
profile: string | null;
|
|
427
|
+
phase: SubagentJob['phase'];
|
|
428
|
+
closedAgoMs: number | null;
|
|
429
|
+
/** Pre-rendered live status line (id, phase, ages, execution, activity); null for root/archived. */
|
|
430
|
+
line: string | null;
|
|
431
|
+
children: AgentTreeNode[];
|
|
432
|
+
}
|
|
345
433
|
interface ChildSupervisorOptions<State> {
|
|
346
434
|
agent: AgentHarness<State>;
|
|
347
435
|
cwd: string;
|
|
348
436
|
/** Harness-configured profiles; null means the implicit `default` only. */
|
|
349
437
|
profiles: SubagentProfile<State>[] | null;
|
|
350
|
-
/**
|
|
438
|
+
/** The owner session's harness commands, before the `demi agent` injection. */
|
|
351
439
|
parentCommands: Command[];
|
|
352
440
|
shellOptions: Omit<BashEnvironmentOptions, 'host' | 'commands'>;
|
|
353
441
|
prepareShell: PrepareShell | null;
|
|
354
442
|
sessionOptions: AgentServerSessionOptions;
|
|
355
443
|
/** When false, a child closing never wakes an idle parent; the host app orchestrates the wakeup from the `subagent closed` frame. */
|
|
356
444
|
notifyParentOnIdle: boolean;
|
|
357
|
-
/** Backing store for child checkpoints and job metadata
|
|
445
|
+
/** Backing store for child checkpoints and job metadata. */
|
|
358
446
|
store: HostStore;
|
|
447
|
+
/** Store key prefix of the owner session's directory (e.g. `agent-sessions/<id>`); children nest under `<prefix>/subagents/<childId>`. */
|
|
448
|
+
storePrefix: string;
|
|
449
|
+
/** Connection-wide registry shared by every supervisor in the tree. */
|
|
450
|
+
directory: AgentDirectory<State>;
|
|
451
|
+
/** Live-children ceiling for this supervisor (from `AgentServerOptions.subagents.maxLiveSubagents`). */
|
|
452
|
+
maxLiveSubagents: number;
|
|
453
|
+
/** When false, this supervisor's owner may not spawn: its `demi agent` tree carries communication and reads only. */
|
|
454
|
+
canSpawn: boolean;
|
|
455
|
+
/** Invoked whenever the live-children set changes; wired to the owning job's settle loop. */
|
|
456
|
+
onJobsChanged: (() => void) | null;
|
|
359
457
|
emit(frame: ServerFrame): void;
|
|
360
458
|
}
|
|
361
459
|
/**
|
|
362
|
-
*
|
|
363
|
-
*
|
|
364
|
-
*
|
|
365
|
-
*
|
|
366
|
-
*
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
460
|
+
* The on-store shape of a child (`<prefix>/subagents/<id>/job.json`); its
|
|
461
|
+
* checkpoint sits beside it. Without `closedPhase` the child is live (a parent
|
|
462
|
+
* restore resumes it); with `closedPhase` it is archived — finished but
|
|
463
|
+
* revivable with `demi agent resume`, skipped by restore, never pruned: it
|
|
464
|
+
* lives exactly as long as the owning session directory.
|
|
465
|
+
*/
|
|
466
|
+
interface PersistedSubagentJob {
|
|
467
|
+
description: string;
|
|
468
|
+
profileName: string | null;
|
|
469
|
+
metadata: AgentMetadata | null;
|
|
470
|
+
spawnedAt: number;
|
|
471
|
+
/** Absent means true; false pins the child to a communication-only `demi agent` tree across restores. */
|
|
472
|
+
canSpawnSubagents?: boolean;
|
|
473
|
+
closedPhase?: SubagentClose['phase'];
|
|
474
|
+
closedAt?: number;
|
|
475
|
+
}
|
|
476
|
+
/**
|
|
477
|
+
* Per-session subagent supervisor. Every session — root or subagent — owns one
|
|
478
|
+
* and carries the identical `demi agent` command tree, so spawn nests to any
|
|
479
|
+
* depth. The supervisor owns its direct children's lifecycle (spawn / abort /
|
|
480
|
+
* resume / natural end), their shell environments, and the `subagent*`
|
|
481
|
+
* protocol frames; communication and reads (`send` / `steer` / `show` /
|
|
482
|
+
* `list`) resolve through the shared AgentDirectory and reach any live agent
|
|
483
|
+
* in the tree. Children persist under the owner's session directory,
|
|
484
|
+
* recursively, and reopening a session restores its whole subtree.
|
|
370
485
|
*/
|
|
371
486
|
declare class ChildSupervisor<State = unknown> {
|
|
372
487
|
private readonly options;
|
|
@@ -375,29 +490,33 @@ declare class ChildSupervisor<State = unknown> {
|
|
|
375
490
|
private isDisposed;
|
|
376
491
|
constructor(options: ChildSupervisorOptions<State>);
|
|
377
492
|
attachParent(session: AgentSession<State>): void;
|
|
378
|
-
|
|
493
|
+
ownerId(): string;
|
|
494
|
+
hasLiveJobs(): boolean;
|
|
495
|
+
/** The `agent` node AgentServer (and every child assembly) grafts under the registry's `demi` root. */
|
|
379
496
|
rootCommandNode(): Command;
|
|
497
|
+
private spawnableCommandNode;
|
|
380
498
|
hasShell(shellId: string): boolean;
|
|
381
|
-
/** Resolves the
|
|
499
|
+
/** Resolves the descendant scope owning a shell (recursively), for the command bridge dispatch. */
|
|
382
500
|
environmentScopeForShell(shellId: string): {
|
|
383
501
|
environment: BashEnvironment;
|
|
384
502
|
commandNames: ReadonlySet<string>;
|
|
385
503
|
agentSessionId: string;
|
|
386
504
|
} | null;
|
|
387
|
-
/** Re-emits `subagent started` + transcript reset for
|
|
505
|
+
/** Re-emits `subagent started` + transcript reset for the whole live subtree (transcript resync). */
|
|
388
506
|
replay(): void;
|
|
389
507
|
/**
|
|
390
|
-
* Detaches
|
|
391
|
-
* flushes checkpoints, and keeps the persisted
|
|
392
|
-
*
|
|
508
|
+
* Detaches the live subtree on connection teardown: aborts in-flight turns,
|
|
509
|
+
* flushes checkpoints, and keeps the persisted jobs so the next open of the
|
|
510
|
+
* owner restores them — the same dispose semantics as the owner session.
|
|
393
511
|
* No `closed` frame is emitted: the children are not done, just paused.
|
|
394
512
|
*/
|
|
395
513
|
dispose(): Promise<void>;
|
|
396
514
|
/**
|
|
397
|
-
* Rebuilds every persisted live child of this
|
|
515
|
+
* Rebuilds every persisted live child of this owner and finishes what it was
|
|
398
516
|
* doing: an interrupted turn resumes from its resume point; an already
|
|
399
|
-
* quiescent child closes with its result.
|
|
400
|
-
*
|
|
517
|
+
* quiescent child closes with its result. Recursive: each restored child
|
|
518
|
+
* restores its own subtree. Children share the owner's persistence
|
|
519
|
+
* lifecycle — a session restore is a subtree restore.
|
|
401
520
|
*/
|
|
402
521
|
restore(): Promise<void>;
|
|
403
522
|
private restoreJob;
|
|
@@ -410,14 +529,21 @@ declare class ChildSupervisor<State = unknown> {
|
|
|
410
529
|
* transcript.
|
|
411
530
|
*/
|
|
412
531
|
private resumeArchived;
|
|
413
|
-
/** Every archived (finished, revivable) child of this
|
|
414
|
-
|
|
415
|
-
|
|
532
|
+
/** Every archived (finished, revivable) child of this owner, newest first. */
|
|
533
|
+
listArchivedJobs(): Promise<{
|
|
534
|
+
id: string;
|
|
535
|
+
meta: PersistedSubagentJob;
|
|
536
|
+
}[]>;
|
|
416
537
|
abortSubtree(id: string): Promise<void>;
|
|
417
|
-
/** Aborts every live child; the archive is untouched. */
|
|
538
|
+
/** Aborts every live child (each with its subtree); the archive is untouched. */
|
|
418
539
|
abortAll(): Promise<void>;
|
|
419
540
|
private spawn;
|
|
420
|
-
/**
|
|
541
|
+
/**
|
|
542
|
+
* Everything spawn and restore share: the command tree (identical to the
|
|
543
|
+
* owner's — children spawn, message, and observe exactly like any session),
|
|
544
|
+
* the child's own supervisor, the harness runtime, and the job record
|
|
545
|
+
* (session attached separately).
|
|
546
|
+
*/
|
|
421
547
|
private assembleJob;
|
|
422
548
|
private attachSession;
|
|
423
549
|
private childStoreKey;
|
|
@@ -425,20 +551,42 @@ declare class ChildSupervisor<State = unknown> {
|
|
|
425
551
|
private deletePersistedJob;
|
|
426
552
|
/** Shared spawn/resume foreground behaviour: announce the id, wire abort and stdin steers, wait for close, report the outcome. */
|
|
427
553
|
private attendChild;
|
|
428
|
-
/**
|
|
554
|
+
/**
|
|
555
|
+
* Resolves a send/steer target against the directory. `parent` is the
|
|
556
|
+
* session that spawned the caller; a caller cannot message itself.
|
|
557
|
+
*/
|
|
558
|
+
private resolveTarget;
|
|
559
|
+
/**
|
|
560
|
+
* Mailbox delivery: an ordinary user send on the target session. The
|
|
561
|
+
* session's own action queue is the inbox — a busy target sees it as a new
|
|
562
|
+
* user turn after the current one; an idle root wakes; a finishing subagent
|
|
563
|
+
* is kept open for one more turn by its settle loop (the enqueue lands
|
|
564
|
+
* before the loop's synchronous close check, so nothing drops silently).
|
|
565
|
+
*/
|
|
566
|
+
private deliverSend;
|
|
567
|
+
/** Chime-in delivery: injects into the target's running turn; no fallback when idle. */
|
|
568
|
+
private deliverSteer;
|
|
569
|
+
private senderPrefix;
|
|
570
|
+
/** Metadata for a turn on the root: the sender subtree's spawning round, or null from the root itself. */
|
|
571
|
+
private senderMetadata;
|
|
572
|
+
/** Delivers one stdin chunk from the attending spawner: mid-turn as a steer, otherwise as a new user turn. */
|
|
429
573
|
private steerChild;
|
|
430
574
|
private pumpStdinSteers;
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
575
|
+
/** Observes one turn promise of an own child: a non-abort failure closes the job as an error. */
|
|
576
|
+
private trackTurn;
|
|
577
|
+
/**
|
|
578
|
+
* The one place a child closes naturally. Loops until the child is
|
|
579
|
+
* quiescent: no running or queued turn (the session action queue doubles as
|
|
580
|
+
* the mailbox), no pending yield wakeups, and no live children of its own.
|
|
581
|
+
* The final check-and-close is synchronous, so a send that lands before it
|
|
582
|
+
* is processed and one that lands after it fails on `isClosing` — nothing
|
|
583
|
+
* drops silently.
|
|
584
|
+
*/
|
|
585
|
+
private settleJob;
|
|
436
586
|
private closeJob;
|
|
437
587
|
private disposeJobShells;
|
|
438
|
-
/** Wakes an idle
|
|
588
|
+
/** Wakes an idle owner with a user send; an owner blocked in the spawn gets the tool result instead. */
|
|
439
589
|
private notifyIdleParent;
|
|
440
|
-
private createChildAgentNode;
|
|
441
|
-
private deliverToParent;
|
|
442
590
|
private childEnvironment;
|
|
443
591
|
private createChildEnvironment;
|
|
444
592
|
private resolveProfile;
|
|
@@ -448,9 +596,9 @@ declare class ChildSupervisor<State = unknown> {
|
|
|
448
596
|
private executionOf;
|
|
449
597
|
private activityOf;
|
|
450
598
|
private executionForMs;
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
599
|
+
snapshot(job: ChildJob<State>, detailed: boolean): Record<string, unknown>;
|
|
600
|
+
renderListLine(job: ChildJob<State>): string;
|
|
601
|
+
renderShow(job: ChildJob<State>): string;
|
|
454
602
|
private wireJob;
|
|
455
603
|
}
|
|
456
604
|
/**
|
|
@@ -534,4 +682,4 @@ interface ShellToolView {
|
|
|
534
682
|
declare function finishShellToolResult<State>(environment: BashEnvironment, result: ShellCommandStatus, ctx: AgentToolInvokeContext<State>): Promise<AgentToolInvokeResult>;
|
|
535
683
|
declare function shellCommandHandleRequired(result: ShellCommandStatus, budgetTokens: number): boolean;
|
|
536
684
|
//#endregion
|
|
537
|
-
export { AbortResult, AbortTarget, ActiveTurnPhase, AgentActionOptions, AgentClient, AgentClientListener, AgentClientTransport, AgentDisposeContext, AgentHarness, AgentHarnessContext, AgentHarnessRuntime, AgentHostContext, AgentLifecycleEvent, AgentMetadata, AgentPromptContext, AgentReferenceResolveContext, AgentServer, AgentServerOptions, AgentServerSessionOptions, AgentServerTransport, AgentSession, AgentSessionCheckpoint, AgentSessionCloneParams, AgentSessionOptions, AgentSessionParams, AgentSessionRestoreParams, AgentSessionStore, AgentSystemPromptContext, AgentTool, AgentToolContext, AgentToolInvokeContext, AgentToolInvokeResult, AgentTransport, AgentTransportBinding, ChildSupervisor, ChildSupervisorOptions, ClientFrame, ClientSessionEvent, CompactionWindow, ConversationSummary, DEFAULT_MAX_MEDIA_BYTES, DEFAULT_TURN_RETRY_POLICY, DrainedTranscriptPatches, ExternalMutationReservation, InProcessTransportPair, JsonWebSocket,
|
|
685
|
+
export { AbortResult, AbortTarget, ActiveTurnPhase, AgentActionOptions, AgentClient, AgentClientListener, AgentClientTransport, AgentDirectory, AgentDisposeContext, AgentHarness, AgentHarnessContext, AgentHarnessRuntime, AgentHostContext, AgentLifecycleEvent, AgentMetadata, AgentPromptContext, AgentReferenceResolveContext, AgentServer, AgentServerOptions, AgentServerSessionOptions, AgentServerTransport, AgentSession, AgentSessionCheckpoint, AgentSessionCloneParams, AgentSessionOptions, AgentSessionParams, AgentSessionRestoreParams, AgentSessionStore, AgentSystemPromptContext, AgentTool, AgentToolContext, AgentToolInvokeContext, AgentToolInvokeResult, AgentTransport, AgentTransportBinding, AgentTreeNode, ChildSupervisor, ChildSupervisorOptions, ClientFrame, ClientSessionEvent, CompactionWindow, ConversationSummary, DEFAULT_MAX_MEDIA_BYTES, DEFAULT_TURN_RETRY_POLICY, DrainedTranscriptPatches, ExternalMutationReservation, InProcessTransportPair, JsonWebSocket, MAX_LIVE_SUBAGENTS, ModelSwitchApply, PrepareShell, PrepareShellContext, ProviderStreamError, ResumePoint, RunCommandLineCommandNotRegisteredError, RunCommandLineOptions, RunCommandLineResult, RunCommandLineShellNotFoundError, RunCommandLineTimeoutError, SHELL_VIEW_MAX_CHARS, SUBAGENT_RESULT_MAX_BYTES, ServerFrame, SessionEvent, SessionEventListener, ShellCommandStatusLike, ShellToolResultOptions, ShellToolView, StandardAgentToolOptions, SubagentExecution, SubagentJob, SubagentProfile, TranscriptLog, TranscriptOptions, TranscriptPatch, TurnRetryPolicy, applyTranscriptPatches, cloneBlocks, createInProcessTransportPair, createReadonlyHost, createStandardAgentTools, createWebSocketClientTransport, createWebSocketServerTransport, estimateTranscriptBlockTokens, findResumePoint, finishShellToolResult, injectSubagentCommand, isContextLengthExceeded, isRetryableCode, resolveRetryPolicy, retryDelayMs, shellCommandHandleRequired, shellPreviewBudgetTokens, toShellToolResult };
|