@hydra-acp/cli 0.1.0 → 0.1.2
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/README.md +0 -0
- package/dist/cli.js +1085 -310
- package/dist/index.d.ts +76 -5
- package/dist/index.js +551 -47
- package/package.json +5 -1
package/dist/index.d.ts
CHANGED
|
@@ -1195,6 +1195,25 @@ declare class AgentInstance {
|
|
|
1195
1195
|
kill(signal?: NodeJS.Signals): Promise<void>;
|
|
1196
1196
|
}
|
|
1197
1197
|
|
|
1198
|
+
interface AdvertisedCommand {
|
|
1199
|
+
name: string;
|
|
1200
|
+
description?: string;
|
|
1201
|
+
}
|
|
1202
|
+
|
|
1203
|
+
interface HistoryEntry {
|
|
1204
|
+
method: string;
|
|
1205
|
+
params: unknown;
|
|
1206
|
+
recordedAt: number;
|
|
1207
|
+
}
|
|
1208
|
+
declare class HistoryStore {
|
|
1209
|
+
private writeQueues;
|
|
1210
|
+
append(sessionId: string, entry: HistoryEntry): Promise<void>;
|
|
1211
|
+
rewrite(sessionId: string, entries: HistoryEntry[]): Promise<void>;
|
|
1212
|
+
load(sessionId: string): Promise<HistoryEntry[]>;
|
|
1213
|
+
delete(sessionId: string): Promise<void>;
|
|
1214
|
+
private enqueue;
|
|
1215
|
+
}
|
|
1216
|
+
|
|
1198
1217
|
interface AttachedClient {
|
|
1199
1218
|
clientId: string;
|
|
1200
1219
|
connection: JsonRpcConnection;
|
|
@@ -1203,11 +1222,7 @@ interface AttachedClient {
|
|
|
1203
1222
|
version?: string;
|
|
1204
1223
|
};
|
|
1205
1224
|
}
|
|
1206
|
-
|
|
1207
|
-
method: string;
|
|
1208
|
-
params: unknown;
|
|
1209
|
-
recordedAt: number;
|
|
1210
|
-
}
|
|
1225
|
+
type CachedNotification = HistoryEntry;
|
|
1211
1226
|
interface SpawnReplacementAgentParams {
|
|
1212
1227
|
agentId: string;
|
|
1213
1228
|
cwd: string;
|
|
@@ -1230,6 +1245,11 @@ interface SessionInit {
|
|
|
1230
1245
|
agentArgs?: string[];
|
|
1231
1246
|
idleTimeoutMs?: number;
|
|
1232
1247
|
spawnReplacementAgent?: SpawnReplacementAgent;
|
|
1248
|
+
seedHistory?: CachedNotification[];
|
|
1249
|
+
historyStore?: HistoryStore;
|
|
1250
|
+
currentModel?: string;
|
|
1251
|
+
currentMode?: string;
|
|
1252
|
+
agentCommands?: AdvertisedCommand[];
|
|
1233
1253
|
}
|
|
1234
1254
|
interface CloseOptions {
|
|
1235
1255
|
deleteRecord?: boolean;
|
|
@@ -1243,14 +1263,18 @@ declare class Session {
|
|
|
1243
1263
|
agentMeta: Record<string, unknown> | undefined;
|
|
1244
1264
|
readonly agentArgs: string[] | undefined;
|
|
1245
1265
|
title: string | undefined;
|
|
1266
|
+
currentModel: string | undefined;
|
|
1267
|
+
currentMode: string | undefined;
|
|
1246
1268
|
updatedAt: number;
|
|
1247
1269
|
private clients;
|
|
1248
1270
|
private history;
|
|
1271
|
+
private historyStore;
|
|
1249
1272
|
private promptQueue;
|
|
1250
1273
|
private promptInFlight;
|
|
1251
1274
|
private closed;
|
|
1252
1275
|
private closeHandlers;
|
|
1253
1276
|
private titleHandlers;
|
|
1277
|
+
private broadcastHandlers;
|
|
1254
1278
|
private firstPromptSeeded;
|
|
1255
1279
|
private inFlightPermissions;
|
|
1256
1280
|
private internalPromptCapture;
|
|
@@ -1259,6 +1283,9 @@ declare class Session {
|
|
|
1259
1283
|
private spawnReplacementAgent;
|
|
1260
1284
|
private agentChangeHandlers;
|
|
1261
1285
|
private agentAdvertisedCommands;
|
|
1286
|
+
private agentCommandsHandlers;
|
|
1287
|
+
private modelHandlers;
|
|
1288
|
+
private modeHandlers;
|
|
1262
1289
|
constructor(init: SessionInit);
|
|
1263
1290
|
private broadcastMergedCommands;
|
|
1264
1291
|
private wireAgent;
|
|
@@ -1267,6 +1294,8 @@ declare class Session {
|
|
|
1267
1294
|
upstreamSessionId: string;
|
|
1268
1295
|
}) => void): void;
|
|
1269
1296
|
get attachedCount(): number;
|
|
1297
|
+
getHistorySnapshot(): CachedNotification[];
|
|
1298
|
+
onBroadcast(handler: (entry: CachedNotification) => void): () => void;
|
|
1270
1299
|
attach(client: AttachedClient, historyPolicy: HistoryPolicy): CachedNotification[];
|
|
1271
1300
|
replayPendingPermissions(client: AttachedClient): void;
|
|
1272
1301
|
detach(clientId: string): void;
|
|
@@ -1283,6 +1312,13 @@ declare class Session {
|
|
|
1283
1312
|
onTitleChange(handler: (title: string) => void): void;
|
|
1284
1313
|
private setTitle;
|
|
1285
1314
|
private maybeSeedTitleFromPrompt;
|
|
1315
|
+
private maybeApplyAgentModel;
|
|
1316
|
+
private maybeApplyAgentMode;
|
|
1317
|
+
private setAgentAdvertisedCommands;
|
|
1318
|
+
onAgentCommandsChange(handler: (commands: AdvertisedCommand[]) => void): void;
|
|
1319
|
+
onModelChange(handler: (model: string) => void): void;
|
|
1320
|
+
onModeChange(handler: (mode: string) => void): void;
|
|
1321
|
+
mergedAvailableCommands(): AdvertisedCommand[];
|
|
1286
1322
|
private maybeApplyAgentSessionInfo;
|
|
1287
1323
|
private handleSlashCommand;
|
|
1288
1324
|
private runTitleCommand;
|
|
@@ -1309,6 +1345,18 @@ declare const SessionRecord: z.ZodObject<{
|
|
|
1309
1345
|
cwd: z.ZodString;
|
|
1310
1346
|
title: z.ZodOptional<z.ZodString>;
|
|
1311
1347
|
agentArgs: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
1348
|
+
currentModel: z.ZodOptional<z.ZodString>;
|
|
1349
|
+
currentMode: z.ZodOptional<z.ZodString>;
|
|
1350
|
+
agentCommands: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
1351
|
+
name: z.ZodString;
|
|
1352
|
+
description: z.ZodOptional<z.ZodString>;
|
|
1353
|
+
}, "strip", z.ZodTypeAny, {
|
|
1354
|
+
name: string;
|
|
1355
|
+
description?: string | undefined;
|
|
1356
|
+
}, {
|
|
1357
|
+
name: string;
|
|
1358
|
+
description?: string | undefined;
|
|
1359
|
+
}>, "many">>;
|
|
1312
1360
|
createdAt: z.ZodString;
|
|
1313
1361
|
updatedAt: z.ZodString;
|
|
1314
1362
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -1321,6 +1369,12 @@ declare const SessionRecord: z.ZodObject<{
|
|
|
1321
1369
|
createdAt: string;
|
|
1322
1370
|
title?: string | undefined;
|
|
1323
1371
|
agentArgs?: string[] | undefined;
|
|
1372
|
+
currentModel?: string | undefined;
|
|
1373
|
+
currentMode?: string | undefined;
|
|
1374
|
+
agentCommands?: {
|
|
1375
|
+
name: string;
|
|
1376
|
+
description?: string | undefined;
|
|
1377
|
+
}[] | undefined;
|
|
1324
1378
|
}, {
|
|
1325
1379
|
version: 1;
|
|
1326
1380
|
cwd: string;
|
|
@@ -1331,6 +1385,12 @@ declare const SessionRecord: z.ZodObject<{
|
|
|
1331
1385
|
createdAt: string;
|
|
1332
1386
|
title?: string | undefined;
|
|
1333
1387
|
agentArgs?: string[] | undefined;
|
|
1388
|
+
currentModel?: string | undefined;
|
|
1389
|
+
currentMode?: string | undefined;
|
|
1390
|
+
agentCommands?: {
|
|
1391
|
+
name: string;
|
|
1392
|
+
description?: string | undefined;
|
|
1393
|
+
}[] | undefined;
|
|
1334
1394
|
}>;
|
|
1335
1395
|
type SessionRecord = z.infer<typeof SessionRecord>;
|
|
1336
1396
|
declare class SessionStore {
|
|
@@ -1354,6 +1414,10 @@ interface ResurrectParams {
|
|
|
1354
1414
|
cwd: string;
|
|
1355
1415
|
title?: string;
|
|
1356
1416
|
agentArgs?: string[];
|
|
1417
|
+
seedHistory?: CachedNotification[];
|
|
1418
|
+
currentModel?: string;
|
|
1419
|
+
currentMode?: string;
|
|
1420
|
+
agentCommands?: AdvertisedCommand[];
|
|
1357
1421
|
}
|
|
1358
1422
|
type AgentSpawner = (opts: AgentInstanceOptions) => AgentInstance;
|
|
1359
1423
|
interface SessionManagerOptions {
|
|
@@ -1365,13 +1429,16 @@ declare class SessionManager {
|
|
|
1365
1429
|
private resurrectionInflight;
|
|
1366
1430
|
private spawner;
|
|
1367
1431
|
private store;
|
|
1432
|
+
private histories;
|
|
1368
1433
|
private idleTimeoutMs;
|
|
1434
|
+
private metaWriteQueues;
|
|
1369
1435
|
constructor(registry: Registry, spawner?: AgentSpawner, store?: SessionStore, options?: SessionManagerOptions);
|
|
1370
1436
|
create(params: CreateSessionParams): Promise<Session>;
|
|
1371
1437
|
resurrect(params: ResurrectParams): Promise<Session>;
|
|
1372
1438
|
private doResurrect;
|
|
1373
1439
|
private bootstrapAgent;
|
|
1374
1440
|
private attachManagerHooks;
|
|
1441
|
+
getHistory(sessionId: string): Promise<CachedNotification[] | undefined>;
|
|
1375
1442
|
loadFromDisk(sessionId: string): Promise<ResurrectParams | undefined>;
|
|
1376
1443
|
get(sessionId: string): Session | undefined;
|
|
1377
1444
|
resolveCanonicalId(input: string): Promise<string | undefined>;
|
|
@@ -1382,6 +1449,8 @@ declare class SessionManager {
|
|
|
1382
1449
|
deleteRecord(sessionId: string): Promise<boolean>;
|
|
1383
1450
|
private persistTitle;
|
|
1384
1451
|
private persistAgentChange;
|
|
1452
|
+
private persistSnapshot;
|
|
1453
|
+
private enqueueMetaWrite;
|
|
1385
1454
|
closeAll(): Promise<void>;
|
|
1386
1455
|
}
|
|
1387
1456
|
|
|
@@ -1455,7 +1524,9 @@ declare const paths: {
|
|
|
1455
1524
|
agentsDir: () => string;
|
|
1456
1525
|
agentDir: (id: string) => string;
|
|
1457
1526
|
sessionsDir: () => string;
|
|
1527
|
+
sessionDir: (id: string) => string;
|
|
1458
1528
|
sessionFile: (id: string) => string;
|
|
1529
|
+
historyFile: (id: string) => string;
|
|
1459
1530
|
extensionsDir: () => string;
|
|
1460
1531
|
extensionLogFile: (name: string) => string;
|
|
1461
1532
|
extensionPidFile: (name: string) => string;
|