@inixiative/agent-session 0.6.0 → 0.6.3

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.
@@ -10,7 +10,7 @@
10
10
  // HarnessSession is stateful: it owns a running process, tracks turns,
11
11
  // captures every event for Oracle, and supports fork/interrupt.
12
12
  //
13
- // Implementations: ClaudeCodeSession, CodexMcpSession, CodexAppServerSession,
13
+ // Implementations: ClaudeCodeSession, CodexAppServerSession,
14
14
  // ClaudeAgentSdkSession. How a model is reached is the session's transport
15
15
  // (see transport.ts); every transport implements this one contract.
16
16
  // ---------------------------------------------------------------------------
package/src/index.ts CHANGED
@@ -17,6 +17,7 @@ export {
17
17
  type ClaudeCodeSessionConfig,
18
18
  } from './claude-code-session';
19
19
  export { type ClaudePrimedConfig, ClaudePrimedSessions } from './claude-primed';
20
+ export { type ClaudeSubagentConfig, ClaudeSubagentSessions } from './claude-subagents';
20
21
  export { parseClaudeUsage } from './claude-usage';
21
22
  export {
22
23
  CODEX_DECISION_DISABLED_FEATURES,
@@ -27,15 +28,12 @@ export {
27
28
  codexTokens,
28
29
  } from './codex-primed';
29
30
 
30
- // Codex CLI adapter (persistent JSON-RPC session). CodexSession defaults to the
31
- // mcp-server variant; CodexAppServerSession is the app-server one.
31
+ // Codex CLI adapter: one persistent `codex app-server` JSON-RPC session.
32
32
  export {
33
33
  type CodexApprovalPolicy,
34
34
  CodexAppServerSession,
35
35
  type CodexFileChange,
36
- CodexMcpSession,
37
36
  type CodexSandbox,
38
- CodexSession,
39
37
  type CodexSessionConfig,
40
38
  type CodexSpawn,
41
39
  codexPermissions,
package/src/pool.ts CHANGED
@@ -31,7 +31,7 @@ import {
31
31
  import { TRANSPORTS, type TransportKind } from './transport';
32
32
  import { createSession } from './transports';
33
33
 
34
- export type PooledTransport = 'claude-cli' | 'codex-mcp' | 'codex-app-server' | 'claude-agent-sdk';
34
+ export type PooledTransport = 'claude-cli' | 'codex-app-server' | 'claude-agent-sdk';
35
35
 
36
36
  export interface InstanceConfig {
37
37
  readonly id: string;
package/src/primed.ts CHANGED
@@ -46,6 +46,13 @@ export interface DecisionRequest {
46
46
  readonly outputSchema?: Readonly<Record<string, unknown>>;
47
47
  /** Cancel: refused before dispatch, or the running turn is interrupted and settled. */
48
48
  readonly signal?: AbortSignal;
49
+ /** Decisions of one group share a side session (ClaudeSubagentSessions): a Foundry thread. */
50
+ readonly group?: string;
51
+ /**
52
+ * The group's current context, which precedes `input` (ClaudeSubagentSessions): a member
53
+ * pre-started with exactly this context receives only `input`; otherwise both are sent.
54
+ */
55
+ readonly standby?: string;
49
56
  }
50
57
 
51
58
  export interface DecisionResult {
@@ -121,6 +128,15 @@ export type PrimedEvent =
121
128
  readonly cacheRead?: number;
122
129
  readonly input?: number;
123
130
  }
131
+ | {
132
+ /** A pre-started member's standby turn, until its moment (or its end): what pre-starting costs. */
133
+ readonly type: 'standby';
134
+ readonly key: string;
135
+ readonly input: number;
136
+ readonly output: number;
137
+ readonly cacheRead: number;
138
+ readonly cacheWrite: number;
139
+ }
124
140
  | { readonly type: 'limits'; readonly limits: LimitSnapshot }
125
141
  | { readonly type: 'violation'; readonly key: string; readonly detail: string }
126
142
  | { readonly type: 'hedged'; readonly key: string; readonly afterMs: number }
@@ -142,6 +158,10 @@ export interface PrimedSessions {
142
158
  decide(spec: PrimeSpec, request: DecisionRequest): Promise<DecisionResult>;
143
159
  /** Drop a key's primed session; the next decision re-primes it. */
144
160
  evict(key: string): Promise<void>;
161
+ /** Keep these roles of a group pre-started, holding this standby context (ClaudeSubagentSessions). */
162
+ prestart?(group: string, entries: ReadonlyArray<{ spec: PrimeSpec; standby: string }>): void;
163
+ /** A group is done (its thread closed): stop what it holds (ClaudeSubagentSessions). */
164
+ releaseGroup?(group: string): Promise<void>;
145
165
  limits(): LimitSnapshot | undefined;
146
166
  snapshot(): PrimedSnapshot;
147
167
  close(): Promise<void>;
@@ -262,7 +282,7 @@ export class Slots {
262
282
  }
263
283
  }
264
284
 
265
- /** Per-key serialization: a key's decisions run one at a time, in order. */
285
+ /** Per-key serialization: a key's tasks run one at a time, in order. */
266
286
  export class KeyedQueue {
267
287
  private _tails = new Map<string, Promise<void>>();
268
288
  run<T>(key: string, task: () => Promise<T>): Promise<T> {
package/src/transport.ts CHANGED
@@ -13,21 +13,15 @@
13
13
  // is declared absent, with a note.
14
14
  // ---------------------------------------------------------------------------
15
15
 
16
- export type TransportKind =
17
- | 'claude-cli'
18
- | 'codex-mcp'
19
- | 'codex-app-server'
20
- | 'claude-agent-sdk'
21
- | 'acp'
22
- | 'api';
16
+ export type TransportKind = 'claude-cli' | 'codex-app-server' | 'claude-agent-sdk' | 'acp' | 'api';
23
17
 
24
18
  export type TransportRuntime = 'claude' | 'codex' | 'external';
25
19
 
26
20
  export interface TransportCapabilities {
27
- /** Continue a thread by native ID in a new process (`loaded-only`: only while the original process holds it). */
28
- readonly resume: 'native' | 'loaded-only' | 'none';
29
- /** `native`: a new branch with its own ID; `same-thread`: continues the parent thread (not a real fork). */
30
- readonly fork: 'native' | 'same-thread' | 'none';
21
+ /** Continue a thread by native ID in a new process. */
22
+ readonly resume: 'native' | 'none';
23
+ /** `native`: a new branch with its own ID. */
24
+ readonly fork: 'native' | 'none';
31
25
  /** Drop the last N turns of native history. */
32
26
  readonly rollback: 'native' | 'none';
33
27
  /** `acknowledged`: interruptNative() confirms the stop through the turn's terminal; `local-only`: interrupt() releases the local waiter only. */
@@ -88,29 +82,6 @@ export const TRANSPORTS: Readonly<Record<TransportKind, TransportDescriptor>> =
88
82
  'Rollback (`--resume-session-at`) exists natively but is not wired here.',
89
83
  ],
90
84
  },
91
- 'codex-mcp': {
92
- kind: 'codex-mcp',
93
- runtime: 'codex',
94
- status: 'implemented',
95
- verified: 'live',
96
- capabilities: {
97
- resume: 'loaded-only',
98
- fork: 'same-thread',
99
- rollback: 'none',
100
- interrupt: 'local-only',
101
- push: 'none',
102
- approvals: 'mode',
103
- usage: true,
104
- limits: none,
105
- textOnly: false,
106
- primed: 'none',
107
- billing: 'subscription',
108
- },
109
- notes: [
110
- '`codex mcp-server`; `codex-reply` continues only threads loaded in the same process.',
111
- 'fork() continues the parent thread; it is not a native fork.',
112
- ],
113
- },
114
85
  'codex-app-server': {
115
86
  kind: 'codex-app-server',
116
87
  runtime: 'codex',
package/src/transports.ts CHANGED
@@ -6,7 +6,7 @@ import {
6
6
  type ClaudeAgentSdkSessionConfig,
7
7
  } from './claude-agent-sdk-session';
8
8
  import { ClaudeCodeSession, type ClaudeCodeSessionConfig } from './claude-code-session';
9
- import { CodexAppServerSession, CodexMcpSession, type CodexSessionConfig } from './codex-session';
9
+ import { CodexAppServerSession, type CodexSessionConfig } from './codex-session';
10
10
  import type { HarnessSession } from './harness-session';
11
11
  import {
12
12
  TRANSPORTS,
@@ -36,7 +36,6 @@ export interface ApiSessionConfig {
36
36
 
37
37
  export interface TransportConfigs {
38
38
  'claude-cli': ClaudeCodeSessionConfig;
39
- 'codex-mcp': CodexSessionConfig;
40
39
  'codex-app-server': CodexSessionConfig;
41
40
  'claude-agent-sdk': ClaudeAgentSdkSessionConfig;
42
41
  acp: AcpSessionConfig;
@@ -81,8 +80,6 @@ export function createSession<K extends TransportKind>(
81
80
  switch (kind) {
82
81
  case 'claude-cli':
83
82
  return new ClaudeCodeSession(config as ClaudeCodeSessionConfig);
84
- case 'codex-mcp':
85
- return new CodexMcpSession(config as CodexSessionConfig);
86
83
  case 'codex-app-server':
87
84
  return new CodexAppServerSession(config as CodexSessionConfig);
88
85
  case 'claude-agent-sdk':