@hydra-acp/cli 0.1.48 → 0.1.50

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 (4) hide show
  1. package/dist/cli.js +2983 -655
  2. package/dist/index.d.ts +145 -13
  3. package/dist/index.js +1404 -81
  4. package/package.json +2 -1
package/dist/index.d.ts CHANGED
@@ -9,13 +9,13 @@ declare const ExtensionBody: z.ZodObject<{
9
9
  env: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
10
10
  enabled: z.ZodDefault<z.ZodBoolean>;
11
11
  }, "strip", z.ZodTypeAny, {
12
- command: string[];
13
12
  args: string[];
13
+ command: string[];
14
14
  env: Record<string, string>;
15
15
  enabled: boolean;
16
16
  }, {
17
- command?: string[] | undefined;
18
17
  args?: string[] | undefined;
18
+ command?: string[] | undefined;
19
19
  env?: Record<string, string> | undefined;
20
20
  enabled?: boolean | undefined;
21
21
  }>;
@@ -29,13 +29,13 @@ declare const TransformerBody: z.ZodObject<{
29
29
  env: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
30
30
  enabled: z.ZodDefault<z.ZodBoolean>;
31
31
  }, "strip", z.ZodTypeAny, {
32
- command: string[];
33
32
  args: string[];
33
+ command: string[];
34
34
  env: Record<string, string>;
35
35
  enabled: boolean;
36
36
  }, {
37
- command?: string[] | undefined;
38
37
  args?: string[] | undefined;
38
+ command?: string[] | undefined;
39
39
  env?: Record<string, string> | undefined;
40
40
  enabled?: boolean | undefined;
41
41
  }>;
@@ -107,13 +107,13 @@ declare const HydraConfig: z.ZodObject<{
107
107
  env: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
108
108
  enabled: z.ZodDefault<z.ZodBoolean>;
109
109
  }, "strip", z.ZodTypeAny, {
110
- command: string[];
111
110
  args: string[];
111
+ command: string[];
112
112
  env: Record<string, string>;
113
113
  enabled: boolean;
114
114
  }, {
115
- command?: string[] | undefined;
116
115
  args?: string[] | undefined;
116
+ command?: string[] | undefined;
117
117
  env?: Record<string, string> | undefined;
118
118
  enabled?: boolean | undefined;
119
119
  }>>>;
@@ -123,13 +123,13 @@ declare const HydraConfig: z.ZodObject<{
123
123
  env: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
124
124
  enabled: z.ZodDefault<z.ZodBoolean>;
125
125
  }, "strip", z.ZodTypeAny, {
126
- command: string[];
127
126
  args: string[];
127
+ command: string[];
128
128
  env: Record<string, string>;
129
129
  enabled: boolean;
130
130
  }, {
131
- command?: string[] | undefined;
132
131
  args?: string[] | undefined;
132
+ command?: string[] | undefined;
133
133
  env?: Record<string, string> | undefined;
134
134
  enabled?: boolean | undefined;
135
135
  }>>>;
@@ -192,14 +192,14 @@ declare const HydraConfig: z.ZodObject<{
192
192
  publicHost?: string | undefined;
193
193
  };
194
194
  extensions: Record<string, {
195
- command: string[];
196
195
  args: string[];
196
+ command: string[];
197
197
  env: Record<string, string>;
198
198
  enabled: boolean;
199
199
  }>;
200
200
  transformers: Record<string, {
201
- command: string[];
202
201
  args: string[];
202
+ command: string[];
203
203
  env: Record<string, string>;
204
204
  enabled: boolean;
205
205
  }>;
@@ -239,14 +239,14 @@ declare const HydraConfig: z.ZodObject<{
239
239
  publicHost?: string | undefined;
240
240
  } | undefined;
241
241
  extensions?: Record<string, {
242
- command?: string[] | undefined;
243
242
  args?: string[] | undefined;
243
+ command?: string[] | undefined;
244
244
  env?: Record<string, string> | undefined;
245
245
  enabled?: boolean | undefined;
246
246
  }> | undefined;
247
247
  transformers?: Record<string, {
248
- command?: string[] | undefined;
249
248
  args?: string[] | undefined;
249
+ command?: string[] | undefined;
250
250
  env?: Record<string, string> | undefined;
251
251
  enabled?: boolean | undefined;
252
252
  }> | undefined;
@@ -1469,6 +1469,16 @@ declare const SessionListEntry: z.ZodObject<{
1469
1469
  importedFromMachine: z.ZodOptional<z.ZodString>;
1470
1470
  importedFromUpstreamSessionId: z.ZodOptional<z.ZodString>;
1471
1471
  parentSessionId: z.ZodOptional<z.ZodString>;
1472
+ originatingClient: z.ZodOptional<z.ZodObject<{
1473
+ name: z.ZodString;
1474
+ version: z.ZodOptional<z.ZodString>;
1475
+ }, "strip", z.ZodTypeAny, {
1476
+ name: string;
1477
+ version?: string | undefined;
1478
+ }, {
1479
+ name: string;
1480
+ version?: string | undefined;
1481
+ }>>;
1472
1482
  updatedAt: z.ZodString;
1473
1483
  attachedClients: z.ZodNumber;
1474
1484
  status: z.ZodDefault<z.ZodEnum<["live", "cold"]>>;
@@ -1495,6 +1505,10 @@ declare const SessionListEntry: z.ZodObject<{
1495
1505
  importedFromMachine?: string | undefined;
1496
1506
  importedFromUpstreamSessionId?: string | undefined;
1497
1507
  parentSessionId?: string | undefined;
1508
+ originatingClient?: {
1509
+ name: string;
1510
+ version?: string | undefined;
1511
+ } | undefined;
1498
1512
  }, {
1499
1513
  sessionId: string;
1500
1514
  cwd: string;
@@ -1515,6 +1529,10 @@ declare const SessionListEntry: z.ZodObject<{
1515
1529
  importedFromMachine?: string | undefined;
1516
1530
  importedFromUpstreamSessionId?: string | undefined;
1517
1531
  parentSessionId?: string | undefined;
1532
+ originatingClient?: {
1533
+ name: string;
1534
+ version?: string | undefined;
1535
+ } | undefined;
1518
1536
  busy?: boolean | undefined;
1519
1537
  }>;
1520
1538
  type SessionListEntry = z.infer<typeof SessionListEntry>;
@@ -1672,7 +1690,7 @@ declare class JsonRpcConnection {
1672
1690
  onRequest(method: string, handler: RequestHandler): void;
1673
1691
  setDefaultHandler(handler: RequestHandler): void;
1674
1692
  onNotification(method: string, handler: NotificationHandler): void;
1675
- drainBuffered(method: string): void;
1693
+ drainBuffered(method: string): number;
1676
1694
  onClose(handler: (err?: Error) => void): void;
1677
1695
  request<T = unknown>(method: string, params?: unknown): Promise<T>;
1678
1696
  requestWithId<T = unknown>(method: string, params?: unknown): {
@@ -1799,6 +1817,34 @@ declare class TransformerManager {
1799
1817
  private scheduleRestart;
1800
1818
  }
1801
1819
 
1820
+ interface StreamGrepLine {
1821
+ cursor: number;
1822
+ line: string;
1823
+ }
1824
+ interface StreamGrepMatch extends StreamGrepLine {
1825
+ before?: StreamGrepLine[];
1826
+ after?: StreamGrepLine[];
1827
+ }
1828
+ interface StreamGrepResult {
1829
+ matches: StreamGrepMatch[];
1830
+ truncated: boolean;
1831
+ nextCursor: number;
1832
+ gap?: number;
1833
+ scannedBytes: number;
1834
+ eof?: boolean;
1835
+ }
1836
+ interface StreamGrepOptions {
1837
+ pattern: string;
1838
+ regex?: boolean;
1839
+ caseInsensitive?: boolean;
1840
+ invert?: boolean;
1841
+ maxMatches?: number;
1842
+ maxBytes?: number;
1843
+ contextBefore?: number;
1844
+ contextAfter?: number;
1845
+ cursor?: number;
1846
+ }
1847
+
1802
1848
  interface AdvertisedCommand {
1803
1849
  name: string;
1804
1850
  description?: string;
@@ -1814,6 +1860,30 @@ interface AdvertisedModel {
1814
1860
  description?: string;
1815
1861
  }
1816
1862
 
1863
+ interface ExtensionCommandSpec {
1864
+ verb: string;
1865
+ argsHint?: string;
1866
+ description?: string;
1867
+ }
1868
+ interface Entry {
1869
+ connection: JsonRpcConnection;
1870
+ commands: ExtensionCommandSpec[];
1871
+ }
1872
+ declare class ExtensionCommandRegistry {
1873
+ private entries;
1874
+ private changeHandlers;
1875
+ register(name: string, connection: JsonRpcConnection, commands: ExtensionCommandSpec[]): void;
1876
+ clear(name: string): void;
1877
+ get(name: string): Entry | undefined;
1878
+ has(name: string): boolean;
1879
+ list(): Array<{
1880
+ name: string;
1881
+ command: ExtensionCommandSpec;
1882
+ }>;
1883
+ onChange(handler: () => void): () => void;
1884
+ private fireChanged;
1885
+ }
1886
+
1817
1887
  interface HistoryEntry {
1818
1888
  method: string;
1819
1889
  params: unknown;
@@ -1904,6 +1974,10 @@ interface SessionInit {
1904
1974
  transformChain?: TransformerRef[];
1905
1975
  idleEventTimeoutMs?: number;
1906
1976
  parentSessionId?: string;
1977
+ originatingClient?: {
1978
+ name: string;
1979
+ version?: string;
1980
+ };
1907
1981
  listSessions?: () => Promise<{
1908
1982
  sessionId: string;
1909
1983
  title?: string;
@@ -1911,6 +1985,7 @@ interface SessionInit {
1911
1985
  agentId?: string;
1912
1986
  currentModel?: string;
1913
1987
  }[]>;
1988
+ extensionCommands?: ExtensionCommandRegistry;
1914
1989
  }
1915
1990
  interface CloseOptions {
1916
1991
  deleteRecord?: boolean;
@@ -1927,6 +2002,10 @@ declare class Session {
1927
2002
  agentCapabilities: AgentCapabilities | undefined;
1928
2003
  readonly agentArgs: string[] | undefined;
1929
2004
  readonly parentSessionId: string | undefined;
2005
+ readonly originatingClient: {
2006
+ name: string;
2007
+ version?: string;
2008
+ } | undefined;
1930
2009
  title: string | undefined;
1931
2010
  currentModel: string | undefined;
1932
2011
  currentMode: string | undefined;
@@ -1959,6 +2038,8 @@ declare class Session {
1959
2038
  private listSessions;
1960
2039
  private logger;
1961
2040
  private transformChain;
2041
+ private extensionCommands;
2042
+ private extensionCommandsUnsub;
1962
2043
  private pendingClaims;
1963
2044
  private agentChangeHandlers;
1964
2045
  private agentAdvertisedCommands;
@@ -2056,6 +2137,7 @@ declare class Session {
2056
2137
  onAgentModelsChange(handler: (models: AdvertisedModel[]) => void): void;
2057
2138
  onModelChange(handler: (model: string) => void): void;
2058
2139
  onModeChange(handler: (mode: string) => void): void;
2140
+ applyModelChange(modelId: string): void;
2059
2141
  applyModeChange(modeId: string): void;
2060
2142
  onUsageChange(handler: (usage: UsageSnapshot) => void): void;
2061
2143
  mergedAvailableCommands(): AdvertisedCommand[];
@@ -2064,6 +2146,8 @@ declare class Session {
2064
2146
  availableModels(): AdvertisedModel[];
2065
2147
  private maybeApplyAgentSessionInfo;
2066
2148
  private handleSlashCommand;
2149
+ private runExtensionCommand;
2150
+ private emitExtensionReply;
2067
2151
  private handleSessionsCommand;
2068
2152
  private handleHelpCommand;
2069
2153
  private handleModelCommand;
@@ -2097,6 +2181,26 @@ declare class Session {
2097
2181
  gap?: number;
2098
2182
  eof?: boolean;
2099
2183
  }>;
2184
+ streamTail(bytes: number): {
2185
+ bytes: string;
2186
+ startCursor: number;
2187
+ endCursor: number;
2188
+ truncated: boolean;
2189
+ };
2190
+ streamHead(bytes: number): {
2191
+ bytes: string;
2192
+ startCursor: number;
2193
+ endCursor: number;
2194
+ truncated: boolean;
2195
+ };
2196
+ streamWaitFor(cursor: number, timeoutMs: number): Promise<"data" | "eof" | "timeout">;
2197
+ streamGrep(opts: StreamGrepOptions): StreamGrepResult;
2198
+ streamInfo(): {
2199
+ writeCursor: number;
2200
+ oldestAvailable: number;
2201
+ capacity: number;
2202
+ closed: boolean;
2203
+ };
2100
2204
  private requireStreamBuffer;
2101
2205
  private markClosed;
2102
2206
  private get lastActivityAt();
@@ -2190,6 +2294,16 @@ declare const SessionRecord: z.ZodObject<{
2190
2294
  }>, "many">>;
2191
2295
  pendingHistorySync: z.ZodOptional<z.ZodBoolean>;
2192
2296
  parentSessionId: z.ZodOptional<z.ZodString>;
2297
+ originatingClient: z.ZodOptional<z.ZodObject<{
2298
+ name: z.ZodString;
2299
+ version: z.ZodOptional<z.ZodString>;
2300
+ }, "strip", z.ZodTypeAny, {
2301
+ name: string;
2302
+ version?: string | undefined;
2303
+ }, {
2304
+ name: string;
2305
+ version?: string | undefined;
2306
+ }>>;
2193
2307
  createdAt: z.ZodString;
2194
2308
  updatedAt: z.ZodString;
2195
2309
  }, "strip", z.ZodTypeAny, {
@@ -2214,6 +2328,10 @@ declare const SessionRecord: z.ZodObject<{
2214
2328
  importedFromMachine?: string | undefined;
2215
2329
  importedFromUpstreamSessionId?: string | undefined;
2216
2330
  parentSessionId?: string | undefined;
2331
+ originatingClient?: {
2332
+ name: string;
2333
+ version?: string | undefined;
2334
+ } | undefined;
2217
2335
  lineageId?: string | undefined;
2218
2336
  importedFromSessionId?: string | undefined;
2219
2337
  agentCommands?: {
@@ -2253,6 +2371,10 @@ declare const SessionRecord: z.ZodObject<{
2253
2371
  importedFromMachine?: string | undefined;
2254
2372
  importedFromUpstreamSessionId?: string | undefined;
2255
2373
  parentSessionId?: string | undefined;
2374
+ originatingClient?: {
2375
+ name: string;
2376
+ version?: string | undefined;
2377
+ } | undefined;
2256
2378
  lineageId?: string | undefined;
2257
2379
  importedFromSessionId?: string | undefined;
2258
2380
  agentCommands?: {
@@ -2515,6 +2637,10 @@ interface CreateSessionParams {
2515
2637
  onInstallProgress?: AgentInstallProgressCallback;
2516
2638
  transformChain?: TransformerRef[];
2517
2639
  parentSessionId?: string;
2640
+ originatingClient?: {
2641
+ name: string;
2642
+ version?: string;
2643
+ };
2518
2644
  }
2519
2645
  interface ResurrectParams {
2520
2646
  hydraSessionId: string;
@@ -2532,6 +2658,10 @@ interface ResurrectParams {
2532
2658
  agentModels?: AdvertisedModel[];
2533
2659
  createdAt?: string;
2534
2660
  pendingHistorySync?: boolean;
2661
+ originatingClient?: {
2662
+ name: string;
2663
+ version?: string;
2664
+ };
2535
2665
  }
2536
2666
  type AgentSpawner = (opts: AgentInstanceOptions) => AgentInstance;
2537
2667
  interface SessionManagerOptions {
@@ -2542,6 +2672,7 @@ interface SessionManagerOptions {
2542
2672
  idleEventTimeoutMs?: number;
2543
2673
  logger?: AgentLogger;
2544
2674
  npmRegistry?: string;
2675
+ extensionCommands?: ExtensionCommandRegistry;
2545
2676
  }
2546
2677
  declare class SessionManager {
2547
2678
  private registry;
@@ -2558,6 +2689,7 @@ declare class SessionManager {
2558
2689
  private metaWriteQueues;
2559
2690
  private logger?;
2560
2691
  private npmRegistry?;
2692
+ private extensionCommands?;
2561
2693
  constructor(registry: Registry, spawner?: AgentSpawner, store?: SessionStore, options?: SessionManagerOptions);
2562
2694
  create(params: CreateSessionParams): Promise<Session>;
2563
2695
  resurrect(params: ResurrectParams): Promise<Session>;