@hydra-acp/cli 0.1.52 → 0.1.54

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.
Files changed (5) hide show
  1. package/README.md +16 -2
  2. package/dist/cli.js +8888 -6357
  3. package/dist/index.d.ts +289 -76
  4. package/dist/index.js +2826 -1767
  5. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -1,6 +1,8 @@
1
1
  import { FastifyInstance } from 'fastify';
2
2
  import { z } from 'zod';
3
3
  import { Readable, Writable } from 'node:stream';
4
+ import { ChildProcess } from 'node:child_process';
5
+ import * as fs from 'node:fs';
4
6
  import { WebSocket } from 'ws';
5
7
 
6
8
  declare const ExtensionBody: z.ZodObject<{
@@ -102,6 +104,9 @@ declare const HydraConfig: z.ZodObject<{
102
104
  }>>;
103
105
  defaultAgent: z.ZodDefault<z.ZodString>;
104
106
  defaultModels: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
107
+ synopsisAgent: z.ZodOptional<z.ZodString>;
108
+ synopsisModel: z.ZodOptional<z.ZodString>;
109
+ synopsisOnClose: z.ZodDefault<z.ZodBoolean>;
105
110
  defaultCwd: z.ZodDefault<z.ZodString>;
106
111
  sessionListColdLimit: z.ZodDefault<z.ZodNumber>;
107
112
  extensions: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
@@ -148,6 +153,7 @@ declare const HydraConfig: z.ZodObject<{
148
153
  defaultEnterAction: z.ZodDefault<z.ZodEnum<["enqueue", "amend"]>>;
149
154
  showThoughts: z.ZodDefault<z.ZodBoolean>;
150
155
  promptHistoryMaxEntries: z.ZodDefault<z.ZodNumber>;
156
+ showFileUpdates: z.ZodDefault<z.ZodEnum<["none", "edit", "diff"]>>;
151
157
  }, "strip", z.ZodTypeAny, {
152
158
  repaintThrottleMs: number;
153
159
  maxScrollbackLines: number;
@@ -158,6 +164,7 @@ declare const HydraConfig: z.ZodObject<{
158
164
  defaultEnterAction: "enqueue" | "amend";
159
165
  showThoughts: boolean;
160
166
  promptHistoryMaxEntries: number;
167
+ showFileUpdates: "diff" | "none" | "edit";
161
168
  }, {
162
169
  repaintThrottleMs?: number | undefined;
163
170
  maxScrollbackLines?: number | undefined;
@@ -168,6 +175,7 @@ declare const HydraConfig: z.ZodObject<{
168
175
  defaultEnterAction?: "enqueue" | "amend" | undefined;
169
176
  showThoughts?: boolean | undefined;
170
177
  promptHistoryMaxEntries?: number | undefined;
178
+ showFileUpdates?: "diff" | "none" | "edit" | undefined;
171
179
  }>>;
172
180
  }, "strip", z.ZodTypeAny, {
173
181
  tui: {
@@ -180,6 +188,7 @@ declare const HydraConfig: z.ZodObject<{
180
188
  defaultEnterAction: "enqueue" | "amend";
181
189
  showThoughts: boolean;
182
190
  promptHistoryMaxEntries: number;
191
+ showFileUpdates: "diff" | "none" | "edit";
183
192
  };
184
193
  daemon: {
185
194
  host: string;
@@ -213,9 +222,12 @@ declare const HydraConfig: z.ZodObject<{
213
222
  };
214
223
  defaultAgent: string;
215
224
  defaultModels: Record<string, string>;
225
+ synopsisOnClose: boolean;
216
226
  defaultCwd: string;
217
227
  sessionListColdLimit: number;
218
228
  defaultTransformers: string[];
229
+ synopsisAgent?: string | undefined;
230
+ synopsisModel?: string | undefined;
219
231
  npmRegistry?: string | undefined;
220
232
  }, {
221
233
  tui?: {
@@ -228,6 +240,7 @@ declare const HydraConfig: z.ZodObject<{
228
240
  defaultEnterAction?: "enqueue" | "amend" | undefined;
229
241
  showThoughts?: boolean | undefined;
230
242
  promptHistoryMaxEntries?: number | undefined;
243
+ showFileUpdates?: "diff" | "none" | "edit" | undefined;
231
244
  } | undefined;
232
245
  daemon?: {
233
246
  host?: string | undefined;
@@ -261,6 +274,9 @@ declare const HydraConfig: z.ZodObject<{
261
274
  } | undefined;
262
275
  defaultAgent?: string | undefined;
263
276
  defaultModels?: Record<string, string> | undefined;
277
+ synopsisAgent?: string | undefined;
278
+ synopsisModel?: string | undefined;
279
+ synopsisOnClose?: boolean | undefined;
264
280
  defaultCwd?: string | undefined;
265
281
  sessionListColdLimit?: number | undefined;
266
282
  defaultTransformers?: string[] | undefined;
@@ -1396,7 +1412,7 @@ declare const SessionAttachParams: z.ZodObject<{
1396
1412
  _meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1397
1413
  }, "strip", z.ZodTypeAny, {
1398
1414
  sessionId: string;
1399
- historyPolicy: "full" | "pending_only" | "none" | "after_message";
1415
+ historyPolicy: "none" | "full" | "pending_only" | "after_message";
1400
1416
  readonly?: boolean | undefined;
1401
1417
  clientInfo?: {
1402
1418
  name: string;
@@ -1412,7 +1428,7 @@ declare const SessionAttachParams: z.ZodObject<{
1412
1428
  name: string;
1413
1429
  version?: string | undefined;
1414
1430
  } | undefined;
1415
- historyPolicy?: "full" | "pending_only" | "none" | "after_message" | undefined;
1431
+ historyPolicy?: "none" | "full" | "pending_only" | "after_message" | undefined;
1416
1432
  afterMessageId?: string | undefined;
1417
1433
  clientId?: string | undefined;
1418
1434
  _meta?: Record<string, unknown> | undefined;
@@ -1475,6 +1491,8 @@ declare const SessionListEntry: z.ZodObject<{
1475
1491
  importedFromMachine: z.ZodOptional<z.ZodString>;
1476
1492
  importedFromUpstreamSessionId: z.ZodOptional<z.ZodString>;
1477
1493
  parentSessionId: z.ZodOptional<z.ZodString>;
1494
+ forkedFromSessionId: z.ZodOptional<z.ZodString>;
1495
+ forkedFromMessageId: z.ZodOptional<z.ZodString>;
1478
1496
  originatingClient: z.ZodOptional<z.ZodObject<{
1479
1497
  name: z.ZodString;
1480
1498
  version: z.ZodOptional<z.ZodString>;
@@ -1511,6 +1529,8 @@ declare const SessionListEntry: z.ZodObject<{
1511
1529
  importedFromMachine?: string | undefined;
1512
1530
  importedFromUpstreamSessionId?: string | undefined;
1513
1531
  parentSessionId?: string | undefined;
1532
+ forkedFromSessionId?: string | undefined;
1533
+ forkedFromMessageId?: string | undefined;
1514
1534
  originatingClient?: {
1515
1535
  name: string;
1516
1536
  version?: string | undefined;
@@ -1535,6 +1555,8 @@ declare const SessionListEntry: z.ZodObject<{
1535
1555
  importedFromMachine?: string | undefined;
1536
1556
  importedFromUpstreamSessionId?: string | undefined;
1537
1557
  parentSessionId?: string | undefined;
1558
+ forkedFromSessionId?: string | undefined;
1559
+ forkedFromMessageId?: string | undefined;
1538
1560
  originatingClient?: {
1539
1561
  name: string;
1540
1562
  version?: string | undefined;
@@ -1737,8 +1759,10 @@ declare class AgentInstance {
1737
1759
  private stderrTail;
1738
1760
  private stderrTailBytes;
1739
1761
  private logger?;
1762
+ private fileLog?;
1740
1763
  private exitHandlers;
1741
1764
  private constructor();
1765
+ private writeLog;
1742
1766
  private formatFailure;
1743
1767
  static spawn(opts: AgentInstanceOptions): AgentInstance;
1744
1768
  onExit(handler: (code: number | null, signal: NodeJS.Signals | null) => void): void;
@@ -1766,12 +1790,34 @@ declare class ProcessTokenRegistry implements TokenValidator {
1766
1790
  validate(token: string): Promise<string | undefined>;
1767
1791
  }
1768
1792
 
1769
- interface TransformerRef {
1793
+ interface BreakerOptions {
1794
+ windowMs?: number;
1795
+ maxFailuresInWindow?: number;
1796
+ now?: () => number;
1797
+ }
1798
+ type BreakerDecision = "restart" | {
1799
+ tripped: string;
1800
+ };
1801
+ declare class RestartBreaker {
1802
+ private readonly windowMs;
1803
+ private readonly maxFailures;
1804
+ private readonly now;
1805
+ private recentExits;
1806
+ private tripped_;
1807
+ constructor(opts?: BreakerOptions);
1808
+ recordExit(code: number | null, name: string, kind: string): BreakerDecision;
1809
+ reset(): void;
1810
+ get tripped(): string | undefined;
1811
+ }
1812
+
1813
+ interface BaseChildConfig {
1770
1814
  name: string;
1771
- intercepts: Set<string>;
1772
- connection: JsonRpcConnection;
1815
+ command: string[];
1816
+ args: string[];
1817
+ env: Record<string, string>;
1818
+ enabled: boolean;
1773
1819
  }
1774
- interface TransformerContext {
1820
+ interface BaseChildContext {
1775
1821
  daemonUrl: string;
1776
1822
  daemonHost: string;
1777
1823
  daemonPort: number;
@@ -1779,10 +1825,10 @@ interface TransformerContext {
1779
1825
  daemonWsUrl: string;
1780
1826
  hydraHome: string;
1781
1827
  }
1782
- type TransformerStatus = "running" | "stopped" | "restarting" | "disabled";
1783
- interface TransformerInfo {
1828
+ type BaseChildStatus = "running" | "stopped" | "restarting" | "disabled" | "failed";
1829
+ interface BaseChildInfo {
1784
1830
  name: string;
1785
- status: TransformerStatus;
1831
+ status: BaseChildStatus;
1786
1832
  pid: number | undefined;
1787
1833
  enabled: boolean;
1788
1834
  restartCount: number;
@@ -1790,37 +1836,83 @@ interface TransformerInfo {
1790
1836
  lastExitCode: number | undefined;
1791
1837
  logPath: string;
1792
1838
  version: string | undefined;
1839
+ failureReason: string | undefined;
1793
1840
  }
1794
- declare class TransformerManager {
1795
- private entries;
1796
- private connected;
1841
+ interface SupervisorAdapter {
1842
+ kind: "extension" | "transformer";
1843
+ nameEnvVar: string;
1844
+ tokenRole: "extension" | "transformer";
1845
+ paths: {
1846
+ dir: () => string;
1847
+ logFile: (name: string) => string;
1848
+ pidFile: (name: string) => string;
1849
+ };
1850
+ }
1851
+ interface ChildEntry<TConfig extends BaseChildConfig> {
1852
+ config: TConfig;
1853
+ child: ChildProcess | undefined;
1854
+ logStream: fs.WriteStream | undefined;
1855
+ restartTimer: NodeJS.Timeout | undefined;
1856
+ pid: number | undefined;
1857
+ startedAt: number | undefined;
1858
+ restartCount: number;
1859
+ lastExitCode: number | undefined;
1860
+ manuallyStopped: boolean;
1861
+ exitWaiters: Array<() => void>;
1862
+ version: string | undefined;
1863
+ processToken: string | undefined;
1864
+ breaker: RestartBreaker;
1865
+ failureReason: string | undefined;
1866
+ }
1867
+ interface ChildSupervisorOptions {
1868
+ tokenRegistry?: ProcessTokenRegistry;
1869
+ breakerOptions?: BreakerOptions;
1870
+ restartBaseMs?: number;
1871
+ restartCapMs?: number;
1872
+ }
1873
+ declare class ChildSupervisor<TConfig extends BaseChildConfig> {
1874
+ protected entries: Map<string, ChildEntry<TConfig>>;
1797
1875
  private stopping;
1798
1876
  private context;
1799
1877
  private tokenRegistry;
1800
- constructor(transformers: TransformerConfig[], context?: TransformerContext, options?: {
1801
- tokenRegistry?: ProcessTokenRegistry;
1802
- });
1803
- setContext(context: TransformerContext): void;
1878
+ private breakerOptions;
1879
+ private restartBaseMs;
1880
+ private restartCapMs;
1881
+ private adapter;
1882
+ constructor(configs: TConfig[], adapter: SupervisorAdapter, context?: BaseChildContext, options?: ChildSupervisorOptions);
1883
+ setContext(context: BaseChildContext): void;
1804
1884
  reportVersion(name: string, version: string): void;
1805
- registerConnection(name: string, connection: JsonRpcConnection, intercepts: string[]): void;
1806
- deregisterConnection(name: string): void;
1807
- resolveChain(names: string[]): TransformerRef[];
1808
1885
  start(): Promise<void>;
1809
1886
  stop(): Promise<void>;
1810
- list(): TransformerInfo[];
1811
- get(name: string): TransformerInfo | undefined;
1887
+ list(): BaseChildInfo[];
1888
+ get(name: string): BaseChildInfo | undefined;
1812
1889
  has(name: string): boolean;
1813
- startByName(name: string): Promise<TransformerInfo>;
1814
- stopByName(name: string): Promise<TransformerInfo>;
1815
- restartByName(name: string): Promise<TransformerInfo>;
1816
- register(config: TransformerConfig): TransformerInfo;
1890
+ startByName(name: string): Promise<BaseChildInfo>;
1891
+ stopByName(name: string): Promise<BaseChildInfo>;
1892
+ restartByName(name: string): Promise<BaseChildInfo>;
1893
+ register(config: TConfig): BaseChildInfo;
1817
1894
  unregister(name: string): Promise<void>;
1818
1895
  private terminate;
1819
- private infoFor;
1896
+ protected infoFor(entry: ChildEntry<TConfig>): BaseChildInfo;
1820
1897
  private makeEntry;
1821
1898
  private reapOrphans;
1822
1899
  private spawn;
1823
1900
  private scheduleRestart;
1901
+ private managerName;
1902
+ }
1903
+
1904
+ type TransformerContext = BaseChildContext;
1905
+ interface TransformerRef {
1906
+ name: string;
1907
+ intercepts: Set<string>;
1908
+ connection: JsonRpcConnection;
1909
+ }
1910
+ declare class TransformerManager extends ChildSupervisor<TransformerConfig> {
1911
+ private connected;
1912
+ constructor(transformers: TransformerConfig[], context?: TransformerContext, options?: ChildSupervisorOptions);
1913
+ registerConnection(name: string, connection: JsonRpcConnection, intercepts: string[]): void;
1914
+ deregisterConnection(name: string): void;
1915
+ resolveChain(names: string[]): TransformerRef[];
1824
1916
  }
1825
1917
 
1826
1918
  interface StreamGrepLine {
@@ -1906,6 +1998,7 @@ declare class HistoryStore {
1906
1998
  rewrite(sessionId: string, entries: HistoryEntry[]): Promise<void>;
1907
1999
  compact(sessionId: string, maxEntries: number): Promise<void>;
1908
2000
  load(sessionId: string): Promise<HistoryEntry[]>;
2001
+ flushAll(): Promise<void>;
1909
2002
  delete(sessionId: string): Promise<void>;
1910
2003
  private enqueue;
1911
2004
  }
@@ -1976,10 +2069,13 @@ interface SessionInit {
1976
2069
  agentModes?: AdvertisedMode[];
1977
2070
  agentModels?: AdvertisedModel[];
1978
2071
  firstPromptSeeded?: boolean;
2072
+ scheduleSynopsis?: () => void;
1979
2073
  createdAt?: number;
1980
2074
  transformChain?: TransformerRef[];
1981
2075
  idleEventTimeoutMs?: number;
1982
2076
  parentSessionId?: string;
2077
+ forkedFromSessionId?: string;
2078
+ forkedFromMessageId?: string;
1983
2079
  originatingClient?: {
1984
2080
  name: string;
1985
2081
  version?: string;
@@ -1995,8 +2091,6 @@ interface SessionInit {
1995
2091
  }
1996
2092
  interface CloseOptions {
1997
2093
  deleteRecord?: boolean;
1998
- regenTitle?: boolean;
1999
- regenTitleTimeoutMs?: number;
2000
2094
  }
2001
2095
  declare class Session {
2002
2096
  readonly sessionId: string;
@@ -2008,6 +2102,8 @@ declare class Session {
2008
2102
  agentCapabilities: AgentCapabilities | undefined;
2009
2103
  readonly agentArgs: string[] | undefined;
2010
2104
  readonly parentSessionId: string | undefined;
2105
+ readonly forkedFromSessionId: string | undefined;
2106
+ readonly forkedFromMessageId: string | undefined;
2011
2107
  readonly originatingClient: {
2012
2108
  name: string;
2013
2109
  version?: string;
@@ -2025,10 +2121,14 @@ declare class Session {
2025
2121
  private promptInFlight;
2026
2122
  private queueWriteChain;
2027
2123
  private closed;
2124
+ private closing;
2125
+ private closeInFlight;
2028
2126
  private closeHandlers;
2029
2127
  private titleHandlers;
2128
+ private scheduleSynopsisHook?;
2030
2129
  private broadcastHandlers;
2031
- private firstPromptSeeded;
2130
+ private _firstPromptSeeded;
2131
+ get firstPromptSeeded(): boolean;
2032
2132
  private promptStartedAt;
2033
2133
  private appendCount;
2034
2134
  private historyMaxEntries;
@@ -2120,6 +2220,7 @@ declare class Session {
2120
2220
  emitToChain(emitterName: string, method: string, envelope: unknown): Promise<void>;
2121
2221
  private rewriteForAgent;
2122
2222
  close(opts?: CloseOptions): Promise<void>;
2223
+ private doClose;
2123
2224
  onClose(handler: (opts: {
2124
2225
  deleteRecord: boolean;
2125
2226
  }) => void): void;
@@ -2158,7 +2259,6 @@ declare class Session {
2158
2259
  private handleHelpCommand;
2159
2260
  private handleModelCommand;
2160
2261
  private runTitleCommand;
2161
- private runTitleRegen;
2162
2262
  private runInternalPrompt;
2163
2263
  private runAgentCommand;
2164
2264
  private runKillCommand;
@@ -2229,6 +2329,30 @@ declare class Session {
2229
2329
  private clearAmendIfMatches;
2230
2330
  }
2231
2331
 
2332
+ declare const SessionSynopsis: z.ZodObject<{
2333
+ goal: z.ZodOptional<z.ZodString>;
2334
+ outcome: z.ZodOptional<z.ZodString>;
2335
+ files_touched: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
2336
+ tools_used: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
2337
+ rejected_approaches: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
2338
+ open_threads: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
2339
+ }, "strip", z.ZodTypeAny, {
2340
+ outcome?: string | undefined;
2341
+ goal?: string | undefined;
2342
+ files_touched?: string[] | undefined;
2343
+ tools_used?: string[] | undefined;
2344
+ rejected_approaches?: string[] | undefined;
2345
+ open_threads?: string[] | undefined;
2346
+ }, {
2347
+ outcome?: string | undefined;
2348
+ goal?: string | undefined;
2349
+ files_touched?: string[] | undefined;
2350
+ tools_used?: string[] | undefined;
2351
+ rejected_approaches?: string[] | undefined;
2352
+ open_threads?: string[] | undefined;
2353
+ }>;
2354
+ type SessionSynopsis = z.infer<typeof SessionSynopsis>;
2355
+
2232
2356
  declare const SessionRecord: z.ZodObject<{
2233
2357
  version: z.ZodLiteral<1>;
2234
2358
  sessionId: z.ZodString;
@@ -2240,6 +2364,29 @@ declare const SessionRecord: z.ZodObject<{
2240
2364
  agentId: z.ZodString;
2241
2365
  cwd: z.ZodString;
2242
2366
  title: z.ZodOptional<z.ZodString>;
2367
+ synopsis: z.ZodOptional<z.ZodObject<{
2368
+ goal: z.ZodOptional<z.ZodString>;
2369
+ outcome: z.ZodOptional<z.ZodString>;
2370
+ files_touched: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
2371
+ tools_used: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
2372
+ rejected_approaches: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
2373
+ open_threads: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
2374
+ }, "strip", z.ZodTypeAny, {
2375
+ outcome?: string | undefined;
2376
+ goal?: string | undefined;
2377
+ files_touched?: string[] | undefined;
2378
+ tools_used?: string[] | undefined;
2379
+ rejected_approaches?: string[] | undefined;
2380
+ open_threads?: string[] | undefined;
2381
+ }, {
2382
+ outcome?: string | undefined;
2383
+ goal?: string | undefined;
2384
+ files_touched?: string[] | undefined;
2385
+ tools_used?: string[] | undefined;
2386
+ rejected_approaches?: string[] | undefined;
2387
+ open_threads?: string[] | undefined;
2388
+ }>>;
2389
+ summarizedThroughEntry: z.ZodOptional<z.ZodNumber>;
2243
2390
  agentArgs: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
2244
2391
  currentModel: z.ZodOptional<z.ZodString>;
2245
2392
  currentMode: z.ZodOptional<z.ZodString>;
@@ -2300,6 +2447,8 @@ declare const SessionRecord: z.ZodObject<{
2300
2447
  }>, "many">>;
2301
2448
  pendingHistorySync: z.ZodOptional<z.ZodBoolean>;
2302
2449
  parentSessionId: z.ZodOptional<z.ZodString>;
2450
+ forkedFromSessionId: z.ZodOptional<z.ZodString>;
2451
+ forkedFromMessageId: z.ZodOptional<z.ZodString>;
2303
2452
  originatingClient: z.ZodOptional<z.ZodObject<{
2304
2453
  name: z.ZodString;
2305
2454
  version: z.ZodOptional<z.ZodString>;
@@ -2334,12 +2483,23 @@ declare const SessionRecord: z.ZodObject<{
2334
2483
  importedFromMachine?: string | undefined;
2335
2484
  importedFromUpstreamSessionId?: string | undefined;
2336
2485
  parentSessionId?: string | undefined;
2486
+ forkedFromSessionId?: string | undefined;
2487
+ forkedFromMessageId?: string | undefined;
2337
2488
  originatingClient?: {
2338
2489
  name: string;
2339
2490
  version?: string | undefined;
2340
2491
  } | undefined;
2492
+ synopsis?: {
2493
+ outcome?: string | undefined;
2494
+ goal?: string | undefined;
2495
+ files_touched?: string[] | undefined;
2496
+ tools_used?: string[] | undefined;
2497
+ rejected_approaches?: string[] | undefined;
2498
+ open_threads?: string[] | undefined;
2499
+ } | undefined;
2341
2500
  lineageId?: string | undefined;
2342
2501
  importedFromSessionId?: string | undefined;
2502
+ summarizedThroughEntry?: number | undefined;
2343
2503
  agentCommands?: {
2344
2504
  name: string;
2345
2505
  description?: string | undefined;
@@ -2377,12 +2537,23 @@ declare const SessionRecord: z.ZodObject<{
2377
2537
  importedFromMachine?: string | undefined;
2378
2538
  importedFromUpstreamSessionId?: string | undefined;
2379
2539
  parentSessionId?: string | undefined;
2540
+ forkedFromSessionId?: string | undefined;
2541
+ forkedFromMessageId?: string | undefined;
2380
2542
  originatingClient?: {
2381
2543
  name: string;
2382
2544
  version?: string | undefined;
2383
2545
  } | undefined;
2546
+ synopsis?: {
2547
+ outcome?: string | undefined;
2548
+ goal?: string | undefined;
2549
+ files_touched?: string[] | undefined;
2550
+ tools_used?: string[] | undefined;
2551
+ rejected_approaches?: string[] | undefined;
2552
+ open_threads?: string[] | undefined;
2553
+ } | undefined;
2384
2554
  lineageId?: string | undefined;
2385
2555
  importedFromSessionId?: string | undefined;
2556
+ summarizedThroughEntry?: number | undefined;
2386
2557
  agentCommands?: {
2387
2558
  name: string;
2388
2559
  description?: string | undefined;
@@ -2431,6 +2602,29 @@ declare const Bundle: z.ZodObject<{
2431
2602
  agentId: z.ZodString;
2432
2603
  cwd: z.ZodString;
2433
2604
  title: z.ZodOptional<z.ZodString>;
2605
+ synopsis: z.ZodOptional<z.ZodObject<{
2606
+ goal: z.ZodOptional<z.ZodString>;
2607
+ outcome: z.ZodOptional<z.ZodString>;
2608
+ files_touched: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
2609
+ tools_used: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
2610
+ rejected_approaches: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
2611
+ open_threads: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
2612
+ }, "strip", z.ZodTypeAny, {
2613
+ outcome?: string | undefined;
2614
+ goal?: string | undefined;
2615
+ files_touched?: string[] | undefined;
2616
+ tools_used?: string[] | undefined;
2617
+ rejected_approaches?: string[] | undefined;
2618
+ open_threads?: string[] | undefined;
2619
+ }, {
2620
+ outcome?: string | undefined;
2621
+ goal?: string | undefined;
2622
+ files_touched?: string[] | undefined;
2623
+ tools_used?: string[] | undefined;
2624
+ rejected_approaches?: string[] | undefined;
2625
+ open_threads?: string[] | undefined;
2626
+ }>>;
2627
+ summarizedThroughEntry: z.ZodOptional<z.ZodNumber>;
2434
2628
  currentModel: z.ZodOptional<z.ZodString>;
2435
2629
  currentMode: z.ZodOptional<z.ZodString>;
2436
2630
  currentUsage: z.ZodOptional<z.ZodObject<{
@@ -2495,6 +2689,15 @@ declare const Bundle: z.ZodObject<{
2495
2689
  costCurrency?: string | undefined;
2496
2690
  cumulativeCost?: number | undefined;
2497
2691
  } | undefined;
2692
+ synopsis?: {
2693
+ outcome?: string | undefined;
2694
+ goal?: string | undefined;
2695
+ files_touched?: string[] | undefined;
2696
+ tools_used?: string[] | undefined;
2697
+ rejected_approaches?: string[] | undefined;
2698
+ open_threads?: string[] | undefined;
2699
+ } | undefined;
2700
+ summarizedThroughEntry?: number | undefined;
2498
2701
  agentCommands?: {
2499
2702
  name: string;
2500
2703
  description?: string | undefined;
@@ -2522,6 +2725,15 @@ declare const Bundle: z.ZodObject<{
2522
2725
  costCurrency?: string | undefined;
2523
2726
  cumulativeCost?: number | undefined;
2524
2727
  } | undefined;
2728
+ synopsis?: {
2729
+ outcome?: string | undefined;
2730
+ goal?: string | undefined;
2731
+ files_touched?: string[] | undefined;
2732
+ tools_used?: string[] | undefined;
2733
+ rejected_approaches?: string[] | undefined;
2734
+ open_threads?: string[] | undefined;
2735
+ } | undefined;
2736
+ summarizedThroughEntry?: number | undefined;
2525
2737
  agentCommands?: {
2526
2738
  name: string;
2527
2739
  description?: string | undefined;
@@ -2566,6 +2778,15 @@ declare const Bundle: z.ZodObject<{
2566
2778
  costCurrency?: string | undefined;
2567
2779
  cumulativeCost?: number | undefined;
2568
2780
  } | undefined;
2781
+ synopsis?: {
2782
+ outcome?: string | undefined;
2783
+ goal?: string | undefined;
2784
+ files_touched?: string[] | undefined;
2785
+ tools_used?: string[] | undefined;
2786
+ rejected_approaches?: string[] | undefined;
2787
+ open_threads?: string[] | undefined;
2788
+ } | undefined;
2789
+ summarizedThroughEntry?: number | undefined;
2569
2790
  agentCommands?: {
2570
2791
  name: string;
2571
2792
  description?: string | undefined;
@@ -2608,6 +2829,15 @@ declare const Bundle: z.ZodObject<{
2608
2829
  costCurrency?: string | undefined;
2609
2830
  cumulativeCost?: number | undefined;
2610
2831
  } | undefined;
2832
+ synopsis?: {
2833
+ outcome?: string | undefined;
2834
+ goal?: string | undefined;
2835
+ files_touched?: string[] | undefined;
2836
+ tools_used?: string[] | undefined;
2837
+ rejected_approaches?: string[] | undefined;
2838
+ open_threads?: string[] | undefined;
2839
+ } | undefined;
2840
+ summarizedThroughEntry?: number | undefined;
2611
2841
  agentCommands?: {
2612
2842
  name: string;
2613
2843
  description?: string | undefined;
@@ -2654,6 +2884,8 @@ interface ResurrectParams {
2654
2884
  agentId: string;
2655
2885
  cwd: string;
2656
2886
  title?: string;
2887
+ synopsis?: SessionSynopsis;
2888
+ summarizedThroughEntry?: number;
2657
2889
  agentArgs?: string[];
2658
2890
  onInstallProgress?: AgentInstallProgressCallback;
2659
2891
  currentModel?: string;
@@ -2668,11 +2900,16 @@ interface ResurrectParams {
2668
2900
  name: string;
2669
2901
  version?: string;
2670
2902
  };
2903
+ forkedFromSessionId?: string;
2904
+ forkedFromMessageId?: string;
2671
2905
  }
2672
2906
  type AgentSpawner = (opts: AgentInstanceOptions) => AgentInstance;
2673
2907
  interface SessionManagerOptions {
2674
2908
  idleTimeoutMs?: number;
2675
2909
  defaultModels?: Record<string, string>;
2910
+ synopsisAgent?: string;
2911
+ synopsisModel?: string;
2912
+ synopsisOnClose?: boolean;
2676
2913
  sessionHistoryMaxEntries?: number;
2677
2914
  defaultTransformers?: string[];
2678
2915
  idleEventTimeoutMs?: number;
@@ -2689,6 +2926,9 @@ declare class SessionManager {
2689
2926
  private histories;
2690
2927
  private idleTimeoutMs;
2691
2928
  private defaultModels;
2929
+ private synopsisAgent?;
2930
+ private synopsisModel?;
2931
+ private synopsisOnClose;
2692
2932
  readonly defaultTransformers: string[];
2693
2933
  private idleEventTimeoutMs;
2694
2934
  private sessionHistoryMaxEntries;
@@ -2696,6 +2936,7 @@ declare class SessionManager {
2696
2936
  private logger?;
2697
2937
  private npmRegistry?;
2698
2938
  private extensionCommands?;
2939
+ private synopsisCoordinator;
2699
2940
  constructor(registry: Registry, spawner?: AgentSpawner, store?: SessionStore, options?: SessionManagerOptions);
2700
2941
  create(params: CreateSessionParams): Promise<Session>;
2701
2942
  resurrect(params: ResurrectParams): Promise<Session>;
@@ -2737,65 +2978,36 @@ declare class SessionManager {
2737
2978
  importedFromSessionId: string;
2738
2979
  replaced: boolean;
2739
2980
  }>;
2981
+ forkSession(sourceSessionId: string, opts?: {
2982
+ forkAt?: string;
2983
+ cwd?: string;
2984
+ agentId?: string;
2985
+ }): Promise<{
2986
+ sessionId: string;
2987
+ forkedFromSessionId: string;
2988
+ forkedAt: string;
2989
+ }>;
2740
2990
  private writeImportedRecord;
2741
2991
  deleteRecord(sessionId: string): Promise<boolean>;
2742
2992
  hasRecord(sessionId: string): Promise<boolean>;
2743
2993
  setTitle(sessionId: string, title: string): Promise<boolean>;
2744
2994
  private persistTitle;
2995
+ private persistSynopsis;
2745
2996
  private persistAgentChange;
2746
2997
  private persistSnapshot;
2747
2998
  private enqueueMetaWrite;
2748
2999
  closeAll(): Promise<void>;
3000
+ flushSynopsis(timeoutMs: number): Promise<void>;
3001
+ shutdownSynopsis(): Promise<void>;
3002
+ scheduleSynopsis(sessionId: string): void;
2749
3003
  flushMetaWrites(): Promise<void>;
3004
+ flushHistoryWrites(): Promise<void>;
2750
3005
  resurrectPendingQueues(): Promise<void>;
2751
3006
  }
2752
3007
 
2753
- interface ExtensionContext {
2754
- daemonUrl: string;
2755
- daemonHost: string;
2756
- daemonPort: number;
2757
- serviceToken: string;
2758
- daemonWsUrl: string;
2759
- hydraHome: string;
2760
- }
2761
- type ExtensionStatus = "running" | "stopped" | "restarting" | "disabled";
2762
- interface ExtensionInfo {
2763
- name: string;
2764
- status: ExtensionStatus;
2765
- pid: number | undefined;
2766
- enabled: boolean;
2767
- restartCount: number;
2768
- startedAt: number | undefined;
2769
- lastExitCode: number | undefined;
2770
- logPath: string;
2771
- version: string | undefined;
2772
- }
2773
- declare class ExtensionManager {
2774
- private entries;
2775
- private stopping;
2776
- private context;
2777
- private tokenRegistry;
2778
- constructor(extensions: ExtensionConfig[], context?: ExtensionContext, options?: {
2779
- tokenRegistry?: ProcessTokenRegistry;
2780
- });
2781
- setContext(context: ExtensionContext): void;
2782
- reportVersion(name: string, version: string): void;
2783
- start(): Promise<void>;
2784
- stop(): Promise<void>;
2785
- list(): ExtensionInfo[];
2786
- get(name: string): ExtensionInfo | undefined;
2787
- has(name: string): boolean;
2788
- startByName(name: string): Promise<ExtensionInfo>;
2789
- stopByName(name: string): Promise<ExtensionInfo>;
2790
- restartByName(name: string): Promise<ExtensionInfo>;
2791
- register(config: ExtensionConfig): ExtensionInfo;
2792
- unregister(name: string): Promise<void>;
2793
- private terminate;
2794
- private infoFor;
2795
- private makeEntry;
2796
- private reapOrphans;
2797
- private spawn;
2798
- private scheduleRestart;
3008
+ type ExtensionContext = BaseChildContext;
3009
+ declare class ExtensionManager extends ChildSupervisor<ExtensionConfig> {
3010
+ constructor(extensions: ExtensionConfig[], context?: ExtensionContext, options?: ChildSupervisorOptions);
2799
3011
  }
2800
3012
 
2801
3013
  interface TokenReservation {
@@ -2875,6 +3087,7 @@ declare const paths: {
2875
3087
  currentLogFile: () => string;
2876
3088
  registryCache: () => string;
2877
3089
  agentsDir: () => string;
3090
+ agentLogFile: (id: string) => string;
2878
3091
  agentInstallDir: (id: string, platformKey: string, version: string) => string;
2879
3092
  agentNpmInstallDir: (id: string, platformKey: string, version: string) => string;
2880
3093
  sessionsDir: () => string;