@hydra-acp/cli 0.1.1 → 0.1.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/README.md +4 -2
- package/dist/cli.js +2139 -635
- package/dist/index.d.ts +88 -6
- package/dist/index.js +669 -61
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -92,10 +92,13 @@ declare const HydraConfig: z.ZodObject<{
|
|
|
92
92
|
}>>>;
|
|
93
93
|
tui: z.ZodDefault<z.ZodObject<{
|
|
94
94
|
repaintThrottleMs: z.ZodDefault<z.ZodNumber>;
|
|
95
|
+
maxScrollbackLines: z.ZodDefault<z.ZodNumber>;
|
|
95
96
|
}, "strip", z.ZodTypeAny, {
|
|
96
97
|
repaintThrottleMs: number;
|
|
98
|
+
maxScrollbackLines: number;
|
|
97
99
|
}, {
|
|
98
100
|
repaintThrottleMs?: number | undefined;
|
|
101
|
+
maxScrollbackLines?: number | undefined;
|
|
99
102
|
}>>;
|
|
100
103
|
}, "strip", z.ZodTypeAny, {
|
|
101
104
|
daemon: {
|
|
@@ -117,6 +120,7 @@ declare const HydraConfig: z.ZodObject<{
|
|
|
117
120
|
}>;
|
|
118
121
|
tui: {
|
|
119
122
|
repaintThrottleMs: number;
|
|
123
|
+
maxScrollbackLines: number;
|
|
120
124
|
};
|
|
121
125
|
registry: {
|
|
122
126
|
url: string;
|
|
@@ -145,6 +149,7 @@ declare const HydraConfig: z.ZodObject<{
|
|
|
145
149
|
}> | undefined;
|
|
146
150
|
tui?: {
|
|
147
151
|
repaintThrottleMs?: number | undefined;
|
|
152
|
+
maxScrollbackLines?: number | undefined;
|
|
148
153
|
} | undefined;
|
|
149
154
|
registry?: {
|
|
150
155
|
url?: string | undefined;
|
|
@@ -1195,6 +1200,25 @@ declare class AgentInstance {
|
|
|
1195
1200
|
kill(signal?: NodeJS.Signals): Promise<void>;
|
|
1196
1201
|
}
|
|
1197
1202
|
|
|
1203
|
+
interface AdvertisedCommand {
|
|
1204
|
+
name: string;
|
|
1205
|
+
description?: string;
|
|
1206
|
+
}
|
|
1207
|
+
|
|
1208
|
+
interface HistoryEntry {
|
|
1209
|
+
method: string;
|
|
1210
|
+
params: unknown;
|
|
1211
|
+
recordedAt: number;
|
|
1212
|
+
}
|
|
1213
|
+
declare class HistoryStore {
|
|
1214
|
+
private writeQueues;
|
|
1215
|
+
append(sessionId: string, entry: HistoryEntry): Promise<void>;
|
|
1216
|
+
rewrite(sessionId: string, entries: HistoryEntry[]): Promise<void>;
|
|
1217
|
+
load(sessionId: string): Promise<HistoryEntry[]>;
|
|
1218
|
+
delete(sessionId: string): Promise<void>;
|
|
1219
|
+
private enqueue;
|
|
1220
|
+
}
|
|
1221
|
+
|
|
1198
1222
|
interface AttachedClient {
|
|
1199
1223
|
clientId: string;
|
|
1200
1224
|
connection: JsonRpcConnection;
|
|
@@ -1203,11 +1227,7 @@ interface AttachedClient {
|
|
|
1203
1227
|
version?: string;
|
|
1204
1228
|
};
|
|
1205
1229
|
}
|
|
1206
|
-
|
|
1207
|
-
method: string;
|
|
1208
|
-
params: unknown;
|
|
1209
|
-
recordedAt: number;
|
|
1210
|
-
}
|
|
1230
|
+
type CachedNotification = HistoryEntry;
|
|
1211
1231
|
interface SpawnReplacementAgentParams {
|
|
1212
1232
|
agentId: string;
|
|
1213
1233
|
cwd: string;
|
|
@@ -1230,9 +1250,17 @@ interface SessionInit {
|
|
|
1230
1250
|
agentArgs?: string[];
|
|
1231
1251
|
idleTimeoutMs?: number;
|
|
1232
1252
|
spawnReplacementAgent?: SpawnReplacementAgent;
|
|
1253
|
+
seedHistory?: CachedNotification[];
|
|
1254
|
+
historyStore?: HistoryStore;
|
|
1255
|
+
currentModel?: string;
|
|
1256
|
+
currentMode?: string;
|
|
1257
|
+
agentCommands?: AdvertisedCommand[];
|
|
1258
|
+
firstPromptSeeded?: boolean;
|
|
1233
1259
|
}
|
|
1234
1260
|
interface CloseOptions {
|
|
1235
1261
|
deleteRecord?: boolean;
|
|
1262
|
+
regenTitle?: boolean;
|
|
1263
|
+
regenTitleTimeoutMs?: number;
|
|
1236
1264
|
}
|
|
1237
1265
|
declare class Session {
|
|
1238
1266
|
readonly sessionId: string;
|
|
@@ -1243,14 +1271,18 @@ declare class Session {
|
|
|
1243
1271
|
agentMeta: Record<string, unknown> | undefined;
|
|
1244
1272
|
readonly agentArgs: string[] | undefined;
|
|
1245
1273
|
title: string | undefined;
|
|
1274
|
+
currentModel: string | undefined;
|
|
1275
|
+
currentMode: string | undefined;
|
|
1246
1276
|
updatedAt: number;
|
|
1247
1277
|
private clients;
|
|
1248
1278
|
private history;
|
|
1279
|
+
private historyStore;
|
|
1249
1280
|
private promptQueue;
|
|
1250
1281
|
private promptInFlight;
|
|
1251
1282
|
private closed;
|
|
1252
1283
|
private closeHandlers;
|
|
1253
1284
|
private titleHandlers;
|
|
1285
|
+
private broadcastHandlers;
|
|
1254
1286
|
private firstPromptSeeded;
|
|
1255
1287
|
private inFlightPermissions;
|
|
1256
1288
|
private internalPromptCapture;
|
|
@@ -1259,6 +1291,9 @@ declare class Session {
|
|
|
1259
1291
|
private spawnReplacementAgent;
|
|
1260
1292
|
private agentChangeHandlers;
|
|
1261
1293
|
private agentAdvertisedCommands;
|
|
1294
|
+
private agentCommandsHandlers;
|
|
1295
|
+
private modelHandlers;
|
|
1296
|
+
private modeHandlers;
|
|
1262
1297
|
constructor(init: SessionInit);
|
|
1263
1298
|
private broadcastMergedCommands;
|
|
1264
1299
|
private wireAgent;
|
|
@@ -1267,6 +1302,9 @@ declare class Session {
|
|
|
1267
1302
|
upstreamSessionId: string;
|
|
1268
1303
|
}) => void): void;
|
|
1269
1304
|
get attachedCount(): number;
|
|
1305
|
+
get turnStartedAt(): number | undefined;
|
|
1306
|
+
getHistorySnapshot(): CachedNotification[];
|
|
1307
|
+
onBroadcast(handler: (entry: CachedNotification) => void): () => void;
|
|
1270
1308
|
attach(client: AttachedClient, historyPolicy: HistoryPolicy): CachedNotification[];
|
|
1271
1309
|
replayPendingPermissions(client: AttachedClient): void;
|
|
1272
1310
|
detach(clientId: string): void;
|
|
@@ -1283,6 +1321,13 @@ declare class Session {
|
|
|
1283
1321
|
onTitleChange(handler: (title: string) => void): void;
|
|
1284
1322
|
private setTitle;
|
|
1285
1323
|
private maybeSeedTitleFromPrompt;
|
|
1324
|
+
private maybeApplyAgentModel;
|
|
1325
|
+
private maybeApplyAgentMode;
|
|
1326
|
+
private setAgentAdvertisedCommands;
|
|
1327
|
+
onAgentCommandsChange(handler: (commands: AdvertisedCommand[]) => void): void;
|
|
1328
|
+
onModelChange(handler: (model: string) => void): void;
|
|
1329
|
+
onModeChange(handler: (mode: string) => void): void;
|
|
1330
|
+
mergedAvailableCommands(): AdvertisedCommand[];
|
|
1286
1331
|
private maybeApplyAgentSessionInfo;
|
|
1287
1332
|
private handleSlashCommand;
|
|
1288
1333
|
private runTitleCommand;
|
|
@@ -1309,6 +1354,18 @@ declare const SessionRecord: z.ZodObject<{
|
|
|
1309
1354
|
cwd: z.ZodString;
|
|
1310
1355
|
title: z.ZodOptional<z.ZodString>;
|
|
1311
1356
|
agentArgs: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
1357
|
+
currentModel: z.ZodOptional<z.ZodString>;
|
|
1358
|
+
currentMode: z.ZodOptional<z.ZodString>;
|
|
1359
|
+
agentCommands: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
1360
|
+
name: z.ZodString;
|
|
1361
|
+
description: z.ZodOptional<z.ZodString>;
|
|
1362
|
+
}, "strip", z.ZodTypeAny, {
|
|
1363
|
+
name: string;
|
|
1364
|
+
description?: string | undefined;
|
|
1365
|
+
}, {
|
|
1366
|
+
name: string;
|
|
1367
|
+
description?: string | undefined;
|
|
1368
|
+
}>, "many">>;
|
|
1312
1369
|
createdAt: z.ZodString;
|
|
1313
1370
|
updatedAt: z.ZodString;
|
|
1314
1371
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -1321,6 +1378,12 @@ declare const SessionRecord: z.ZodObject<{
|
|
|
1321
1378
|
createdAt: string;
|
|
1322
1379
|
title?: string | undefined;
|
|
1323
1380
|
agentArgs?: string[] | undefined;
|
|
1381
|
+
currentModel?: string | undefined;
|
|
1382
|
+
currentMode?: string | undefined;
|
|
1383
|
+
agentCommands?: {
|
|
1384
|
+
name: string;
|
|
1385
|
+
description?: string | undefined;
|
|
1386
|
+
}[] | undefined;
|
|
1324
1387
|
}, {
|
|
1325
1388
|
version: 1;
|
|
1326
1389
|
cwd: string;
|
|
@@ -1331,6 +1394,12 @@ declare const SessionRecord: z.ZodObject<{
|
|
|
1331
1394
|
createdAt: string;
|
|
1332
1395
|
title?: string | undefined;
|
|
1333
1396
|
agentArgs?: string[] | undefined;
|
|
1397
|
+
currentModel?: string | undefined;
|
|
1398
|
+
currentMode?: string | undefined;
|
|
1399
|
+
agentCommands?: {
|
|
1400
|
+
name: string;
|
|
1401
|
+
description?: string | undefined;
|
|
1402
|
+
}[] | undefined;
|
|
1334
1403
|
}>;
|
|
1335
1404
|
type SessionRecord = z.infer<typeof SessionRecord>;
|
|
1336
1405
|
declare class SessionStore {
|
|
@@ -1354,6 +1423,10 @@ interface ResurrectParams {
|
|
|
1354
1423
|
cwd: string;
|
|
1355
1424
|
title?: string;
|
|
1356
1425
|
agentArgs?: string[];
|
|
1426
|
+
seedHistory?: CachedNotification[];
|
|
1427
|
+
currentModel?: string;
|
|
1428
|
+
currentMode?: string;
|
|
1429
|
+
agentCommands?: AdvertisedCommand[];
|
|
1357
1430
|
}
|
|
1358
1431
|
type AgentSpawner = (opts: AgentInstanceOptions) => AgentInstance;
|
|
1359
1432
|
interface SessionManagerOptions {
|
|
@@ -1365,13 +1438,16 @@ declare class SessionManager {
|
|
|
1365
1438
|
private resurrectionInflight;
|
|
1366
1439
|
private spawner;
|
|
1367
1440
|
private store;
|
|
1441
|
+
private histories;
|
|
1368
1442
|
private idleTimeoutMs;
|
|
1443
|
+
private metaWriteQueues;
|
|
1369
1444
|
constructor(registry: Registry, spawner?: AgentSpawner, store?: SessionStore, options?: SessionManagerOptions);
|
|
1370
1445
|
create(params: CreateSessionParams): Promise<Session>;
|
|
1371
1446
|
resurrect(params: ResurrectParams): Promise<Session>;
|
|
1372
1447
|
private doResurrect;
|
|
1373
1448
|
private bootstrapAgent;
|
|
1374
1449
|
private attachManagerHooks;
|
|
1450
|
+
getHistory(sessionId: string): Promise<CachedNotification[] | undefined>;
|
|
1375
1451
|
loadFromDisk(sessionId: string): Promise<ResurrectParams | undefined>;
|
|
1376
1452
|
get(sessionId: string): Session | undefined;
|
|
1377
1453
|
resolveCanonicalId(input: string): Promise<string | undefined>;
|
|
@@ -1380,8 +1456,11 @@ declare class SessionManager {
|
|
|
1380
1456
|
cwd?: string;
|
|
1381
1457
|
}): Promise<SessionListEntry[]>;
|
|
1382
1458
|
deleteRecord(sessionId: string): Promise<boolean>;
|
|
1459
|
+
hasRecord(sessionId: string): Promise<boolean>;
|
|
1383
1460
|
private persistTitle;
|
|
1384
1461
|
private persistAgentChange;
|
|
1462
|
+
private persistSnapshot;
|
|
1463
|
+
private enqueueMetaWrite;
|
|
1385
1464
|
closeAll(): Promise<void>;
|
|
1386
1465
|
}
|
|
1387
1466
|
|
|
@@ -1455,11 +1534,14 @@ declare const paths: {
|
|
|
1455
1534
|
agentsDir: () => string;
|
|
1456
1535
|
agentDir: (id: string) => string;
|
|
1457
1536
|
sessionsDir: () => string;
|
|
1537
|
+
sessionDir: (id: string) => string;
|
|
1458
1538
|
sessionFile: (id: string) => string;
|
|
1539
|
+
historyFile: (id: string) => string;
|
|
1459
1540
|
extensionsDir: () => string;
|
|
1460
1541
|
extensionLogFile: (name: string) => string;
|
|
1461
1542
|
extensionPidFile: (name: string) => string;
|
|
1462
|
-
tuiHistoryFile: () => string;
|
|
1543
|
+
tuiHistoryFile: (id: string) => string;
|
|
1544
|
+
tuiLogFile: () => string;
|
|
1463
1545
|
};
|
|
1464
1546
|
|
|
1465
1547
|
export { type AgentCapabilities, AgentInstance, HistoryPolicy, HydraConfig, type InitializeResult, JsonRpcConnection, type MessageStream, Registry, Session, SessionAttachParams, type SessionCapabilities, SessionDetachParams, SessionListEntry, SessionListParams, SessionListResult, SessionManager, defaultConfig, ensureConfig, generateAuthToken, loadConfig, ndjsonStreamFromStdio, paths, planSpawn, startDaemon, writeConfig, wsToMessageStream };
|