@demicodes/agent 0.19.3 → 0.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -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-CHrPzcrU.mjs";
2
- import { a as AgentClient, i as AgentActionOptions, n as createWebSocketClientTransport, o as AgentClientListener, r as createWebSocketServerTransport, t as JsonWebSocket } from "./websocket-transport-NZ5Btmb4.mjs";
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-_eV2zg9M.mjs";
2
+ import { a as AgentClient, i as AgentActionOptions, n as createWebSocketClientTransport, o as AgentClientListener, r as createWebSocketServerTransport, t as JsonWebSocket } from "./websocket-transport-BC7OstFf.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 };
@@ -1,2 +1,2 @@
1
- import { n as createWebSocketServerTransport, r as AgentClient, t as createWebSocketClientTransport } from "./websocket-transport-CIOotpd-.mjs";
1
+ import { n as createWebSocketServerTransport, r as AgentClient, t as createWebSocketClientTransport } from "./websocket-transport-BsKvbXIp.mjs";
2
2
  export { AgentClient, createWebSocketClientTransport, createWebSocketServerTransport };
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
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-CHrPzcrU.mjs";
2
- import { a as AgentClient, i as AgentActionOptions, n as createWebSocketClientTransport, o as AgentClientListener, r as createWebSocketServerTransport, t as JsonWebSocket } from "./websocket-transport-NZ5Btmb4.mjs";
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-_eV2zg9M.mjs";
2
+ import { a as AgentClient, i as AgentActionOptions, n as createWebSocketClientTransport, o as AgentClientListener, r as createWebSocketServerTransport, t as JsonWebSocket } from "./websocket-transport-BC7OstFf.mjs";
3
3
  import { BashAuditEvent, BashEnvironment, BashEnvironmentOptions, Command, CommandMetadataRecord, 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";
@@ -414,6 +414,8 @@ declare class ChildSupervisor<State = unknown> {
414
414
  private listArchivedJobs;
415
415
  private pruneArchive;
416
416
  abortSubtree(id: string): Promise<void>;
417
+ /** Aborts every live child; the archive is untouched. */
418
+ abortAll(): Promise<void>;
417
419
  private spawn;
418
420
  /** Everything spawn and restore share: the command tree, the harness runtime, and the job record (session attached separately). */
419
421
  private assembleJob;
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { a as cloneBlocks, i as applyTranscriptPatches, n as createWebSocketServerTransport, o as ProviderStreamError, r as AgentClient, s as isContextLengthExceeded, t as createWebSocketClientTransport } from "./websocket-transport-CIOotpd-.mjs";
1
+ import { a as cloneBlocks, i as applyTranscriptPatches, n as createWebSocketServerTransport, o as ProviderStreamError, r as AgentClient, s as isContextLengthExceeded, t as createWebSocketClientTransport } from "./websocket-transport-BsKvbXIp.mjs";
2
2
  import { AbortError, abortable, asError, asRecord, asString, bytesToBase64, createId, decodeUtf8, delay, errorMessage, isAbortError, isRecord, noop, parseJsonOrString, safeJsonStringify, sliceHead, sliceTail, throwIfAborted, toWellFormedText, truncate, utf8Slice } from "@demicodes/utils";
3
3
  import { BashEnvironment, CommandRegistry, MAX_TIMEOUT_MS, heredocDelimiter, shellQuote } from "@demicodes/shell";
4
4
  import { providerRuntime } from "@demicodes/provider";
@@ -3027,6 +3027,10 @@ var ChildSupervisor = class {
3027
3027
  if (!job) return;
3028
3028
  await this.closeJob(job, "aborted");
3029
3029
  }
3030
+ /** Aborts every live child; the archive is untouched. */
3031
+ async abortAll() {
3032
+ for (const id of [...this.jobs.keys()]) await this.abortSubtree(id);
3033
+ }
3030
3034
  async spawn(input) {
3031
3035
  const parent = this.parentSession;
3032
3036
  if (!parent) throw new Error("subagent supervisor has no parent session");
@@ -3942,6 +3946,9 @@ var AgentTransportBindingImpl = class {
3942
3946
  });
3943
3947
  return;
3944
3948
  }
3949
+ case "abort_subagents":
3950
+ await this.supervisor?.abortAll();
3951
+ return;
3945
3952
  case "shell_write":
3946
3953
  await this.handleShellWrite(frame);
3947
3954
  return;
@@ -1,4 +1,4 @@
1
- import { n as AgentServerTransport, t as AgentClientTransport } from "./transport-CHrPzcrU.mjs";
1
+ import { n as AgentServerTransport, t as AgentClientTransport } from "./transport-_eV2zg9M.mjs";
2
2
  import { Readable, Writable } from "node:stream";
3
3
  //#region src/stdio-transport.d.ts
4
4
  declare function createStdioClientTransport(readable: Readable, writable: Writable): AgentClientTransport;
@@ -438,6 +438,8 @@ type ClientFrame = {
438
438
  apply?: ModelSwitchApply;
439
439
  } | {
440
440
  type: 'abort';
441
+ } | {
442
+ type: 'abort_subagents';
441
443
  } | {
442
444
  type: 'retry';
443
445
  metadata?: AgentMetadata;
@@ -1,4 +1,4 @@
1
- import { I as ModelSwitchApply, c as ConversationSummary, n as AgentServerTransport, p as AbortResult, s as ClientSessionEvent, t as AgentClientTransport, x as AgentMetadata } from "./transport-CHrPzcrU.mjs";
1
+ import { I as ModelSwitchApply, c as ConversationSummary, n as AgentServerTransport, p as AbortResult, s as ClientSessionEvent, t as AgentClientTransport, x as AgentMetadata } from "./transport-_eV2zg9M.mjs";
2
2
  import { ProviderSelection } from "@demicodes/provider";
3
3
  import { Block, UserContentBlock } from "@demicodes/core";
4
4
  //#region src/client.d.ts
@@ -59,6 +59,12 @@ declare class AgentClient {
59
59
  resume(options?: AgentActionOptions): Promise<void>;
60
60
  compact(options?: AgentActionOptions): Promise<void>;
61
61
  abort(): Promise<AbortResult>;
62
+ /**
63
+ * Aborts every live child agent of this session (the archive is untouched).
64
+ * Fire-and-forget: each child settles through its own `subagent closed`
65
+ * frame with phase 'aborted'.
66
+ */
67
+ abortSubagents(): void;
62
68
  shellWrite(commandId: string, stdin: string, options?: AgentActionOptions): Promise<void>;
63
69
  close(): Promise<void>;
64
70
  subscribe(listener: AgentClientListener): () => void;
@@ -209,6 +209,14 @@ var AgentClient = class {
209
209
  this.sendFrame({ type: "abort" });
210
210
  return wait;
211
211
  }
212
+ /**
213
+ * Aborts every live child agent of this session (the archive is untouched).
214
+ * Fire-and-forget: each child settles through its own `subagent closed`
215
+ * frame with phase 'aborted'.
216
+ */
217
+ abortSubagents() {
218
+ this.sendFrame({ type: "abort_subagents" });
219
+ }
212
220
  shellWrite(commandId, stdin, options = {}) {
213
221
  const wait = this.waitForShellWrite(commandId);
214
222
  this.sendFrame({
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@demicodes/agent",
3
3
  "description": "Session runtime and transport-neutral client and server protocol for Demi.",
4
- "version": "0.19.3",
4
+ "version": "0.20.0",
5
5
  "private": false,
6
6
  "type": "module",
7
7
  "exports": {
@@ -19,10 +19,10 @@
19
19
  }
20
20
  },
21
21
  "dependencies": {
22
- "@demicodes/core": "^0.19.3",
23
- "@demicodes/provider": "^0.19.3",
24
- "@demicodes/shell": "^0.19.3",
25
- "@demicodes/utils": "^0.19.3",
22
+ "@demicodes/core": "^0.20.0",
23
+ "@demicodes/provider": "^0.20.0",
24
+ "@demicodes/shell": "^0.20.0",
25
+ "@demicodes/utils": "^0.20.0",
26
26
  "zod": "^4.0.0"
27
27
  },
28
28
  "license": "Apache-2.0",