@inixiative/agent-session 0.6.1 → 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.
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,
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>;