@hydra-acp/cli 0.1.2 → 0.1.4

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/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;
@@ -1209,6 +1214,7 @@ declare class HistoryStore {
1209
1214
  private writeQueues;
1210
1215
  append(sessionId: string, entry: HistoryEntry): Promise<void>;
1211
1216
  rewrite(sessionId: string, entries: HistoryEntry[]): Promise<void>;
1217
+ compact(sessionId: string, maxEntries: number): Promise<void>;
1212
1218
  load(sessionId: string): Promise<HistoryEntry[]>;
1213
1219
  delete(sessionId: string): Promise<void>;
1214
1220
  private enqueue;
@@ -1245,14 +1251,17 @@ interface SessionInit {
1245
1251
  agentArgs?: string[];
1246
1252
  idleTimeoutMs?: number;
1247
1253
  spawnReplacementAgent?: SpawnReplacementAgent;
1248
- seedHistory?: CachedNotification[];
1249
1254
  historyStore?: HistoryStore;
1250
1255
  currentModel?: string;
1251
1256
  currentMode?: string;
1252
1257
  agentCommands?: AdvertisedCommand[];
1258
+ firstPromptSeeded?: boolean;
1259
+ createdAt?: number;
1253
1260
  }
1254
1261
  interface CloseOptions {
1255
1262
  deleteRecord?: boolean;
1263
+ regenTitle?: boolean;
1264
+ regenTitleTimeoutMs?: number;
1256
1265
  }
1257
1266
  declare class Session {
1258
1267
  readonly sessionId: string;
@@ -1266,8 +1275,8 @@ declare class Session {
1266
1275
  currentModel: string | undefined;
1267
1276
  currentMode: string | undefined;
1268
1277
  updatedAt: number;
1278
+ readonly createdAt: number;
1269
1279
  private clients;
1270
- private history;
1271
1280
  private historyStore;
1272
1281
  private promptQueue;
1273
1282
  private promptInFlight;
@@ -1276,10 +1285,13 @@ declare class Session {
1276
1285
  private titleHandlers;
1277
1286
  private broadcastHandlers;
1278
1287
  private firstPromptSeeded;
1288
+ private promptStartedAt;
1289
+ private appendCount;
1279
1290
  private inFlightPermissions;
1280
1291
  private internalPromptCapture;
1281
1292
  private idleTimeoutMs;
1282
1293
  private idleTimer;
1294
+ private lastRecordedAt;
1283
1295
  private spawnReplacementAgent;
1284
1296
  private agentChangeHandlers;
1285
1297
  private agentAdvertisedCommands;
@@ -1294,9 +1306,10 @@ declare class Session {
1294
1306
  upstreamSessionId: string;
1295
1307
  }) => void): void;
1296
1308
  get attachedCount(): number;
1297
- getHistorySnapshot(): CachedNotification[];
1309
+ get turnStartedAt(): number | undefined;
1310
+ getHistorySnapshot(): Promise<CachedNotification[]>;
1298
1311
  onBroadcast(handler: (entry: CachedNotification) => void): () => void;
1299
- attach(client: AttachedClient, historyPolicy: HistoryPolicy): CachedNotification[];
1312
+ attach(client: AttachedClient, historyPolicy: HistoryPolicy): Promise<CachedNotification[]>;
1300
1313
  replayPendingPermissions(client: AttachedClient): void;
1301
1314
  detach(clientId: string): void;
1302
1315
  prompt(clientId: string, params: unknown): Promise<unknown>;
@@ -1319,6 +1332,7 @@ declare class Session {
1319
1332
  onModelChange(handler: (model: string) => void): void;
1320
1333
  onModeChange(handler: (mode: string) => void): void;
1321
1334
  mergedAvailableCommands(): AdvertisedCommand[];
1335
+ agentOnlyAdvertisedCommands(): AdvertisedCommand[];
1322
1336
  private maybeApplyAgentSessionInfo;
1323
1337
  private handleSlashCommand;
1324
1338
  private runTitleCommand;
@@ -1326,9 +1340,13 @@ declare class Session {
1326
1340
  private runInternalPrompt;
1327
1341
  private runSwitchCommand;
1328
1342
  private buildSwitchTranscript;
1343
+ seedFromImport(): Promise<void>;
1329
1344
  private broadcastAgentSwitch;
1330
1345
  private markClosed;
1331
- private maybeStartIdleTimer;
1346
+ private get lastActivityAt();
1347
+ private scheduleIdleCheck;
1348
+ private armIdleTimer;
1349
+ private checkIdle;
1332
1350
  private cancelIdleTimer;
1333
1351
  private rewriteForClient;
1334
1352
  private recordAndBroadcast;
@@ -1340,7 +1358,9 @@ declare class Session {
1340
1358
  declare const SessionRecord: z.ZodObject<{
1341
1359
  version: z.ZodLiteral<1>;
1342
1360
  sessionId: z.ZodString;
1361
+ lineageId: z.ZodOptional<z.ZodString>;
1343
1362
  upstreamSessionId: z.ZodString;
1363
+ importedFromSessionId: z.ZodOptional<z.ZodString>;
1344
1364
  agentId: z.ZodString;
1345
1365
  cwd: z.ZodString;
1346
1366
  title: z.ZodOptional<z.ZodString>;
@@ -1371,6 +1391,8 @@ declare const SessionRecord: z.ZodObject<{
1371
1391
  agentArgs?: string[] | undefined;
1372
1392
  currentModel?: string | undefined;
1373
1393
  currentMode?: string | undefined;
1394
+ lineageId?: string | undefined;
1395
+ importedFromSessionId?: string | undefined;
1374
1396
  agentCommands?: {
1375
1397
  name: string;
1376
1398
  description?: string | undefined;
@@ -1387,6 +1409,8 @@ declare const SessionRecord: z.ZodObject<{
1387
1409
  agentArgs?: string[] | undefined;
1388
1410
  currentModel?: string | undefined;
1389
1411
  currentMode?: string | undefined;
1412
+ lineageId?: string | undefined;
1413
+ importedFromSessionId?: string | undefined;
1390
1414
  agentCommands?: {
1391
1415
  name: string;
1392
1416
  description?: string | undefined;
@@ -1397,9 +1421,145 @@ declare class SessionStore {
1397
1421
  write(record: Omit<SessionRecord, "version">): Promise<void>;
1398
1422
  read(sessionId: string): Promise<SessionRecord | undefined>;
1399
1423
  delete(sessionId: string): Promise<void>;
1424
+ findByLineageId(lineageId: string): Promise<SessionRecord | undefined>;
1400
1425
  list(): Promise<SessionRecord[]>;
1401
1426
  }
1402
1427
 
1428
+ declare const Bundle: z.ZodObject<{
1429
+ version: z.ZodLiteral<1>;
1430
+ exportedAt: z.ZodString;
1431
+ exportedFrom: z.ZodObject<{
1432
+ hydraVersion: z.ZodString;
1433
+ machine: z.ZodString;
1434
+ }, "strip", z.ZodTypeAny, {
1435
+ hydraVersion: string;
1436
+ machine: string;
1437
+ }, {
1438
+ hydraVersion: string;
1439
+ machine: string;
1440
+ }>;
1441
+ session: z.ZodObject<{
1442
+ sessionId: z.ZodString;
1443
+ lineageId: z.ZodString;
1444
+ agentId: z.ZodString;
1445
+ cwd: z.ZodString;
1446
+ title: z.ZodOptional<z.ZodString>;
1447
+ currentModel: z.ZodOptional<z.ZodString>;
1448
+ currentMode: z.ZodOptional<z.ZodString>;
1449
+ agentCommands: z.ZodOptional<z.ZodArray<z.ZodObject<{
1450
+ name: z.ZodString;
1451
+ description: z.ZodOptional<z.ZodString>;
1452
+ }, "strip", z.ZodTypeAny, {
1453
+ name: string;
1454
+ description?: string | undefined;
1455
+ }, {
1456
+ name: string;
1457
+ description?: string | undefined;
1458
+ }>, "many">>;
1459
+ createdAt: z.ZodString;
1460
+ updatedAt: z.ZodString;
1461
+ }, "strip", z.ZodTypeAny, {
1462
+ cwd: string;
1463
+ agentId: string;
1464
+ sessionId: string;
1465
+ updatedAt: string;
1466
+ lineageId: string;
1467
+ createdAt: string;
1468
+ title?: string | undefined;
1469
+ currentModel?: string | undefined;
1470
+ currentMode?: string | undefined;
1471
+ agentCommands?: {
1472
+ name: string;
1473
+ description?: string | undefined;
1474
+ }[] | undefined;
1475
+ }, {
1476
+ cwd: string;
1477
+ agentId: string;
1478
+ sessionId: string;
1479
+ updatedAt: string;
1480
+ lineageId: string;
1481
+ createdAt: string;
1482
+ title?: string | undefined;
1483
+ currentModel?: string | undefined;
1484
+ currentMode?: string | undefined;
1485
+ agentCommands?: {
1486
+ name: string;
1487
+ description?: string | undefined;
1488
+ }[] | undefined;
1489
+ }>;
1490
+ history: z.ZodArray<z.ZodObject<{
1491
+ method: z.ZodString;
1492
+ params: z.ZodUnknown;
1493
+ recordedAt: z.ZodNumber;
1494
+ }, "strip", z.ZodTypeAny, {
1495
+ method: string;
1496
+ recordedAt: number;
1497
+ params?: unknown;
1498
+ }, {
1499
+ method: string;
1500
+ recordedAt: number;
1501
+ params?: unknown;
1502
+ }>, "many">;
1503
+ promptHistory: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1504
+ }, "strip", z.ZodTypeAny, {
1505
+ version: 1;
1506
+ exportedAt: string;
1507
+ exportedFrom: {
1508
+ hydraVersion: string;
1509
+ machine: string;
1510
+ };
1511
+ session: {
1512
+ cwd: string;
1513
+ agentId: string;
1514
+ sessionId: string;
1515
+ updatedAt: string;
1516
+ lineageId: string;
1517
+ createdAt: string;
1518
+ title?: string | undefined;
1519
+ currentModel?: string | undefined;
1520
+ currentMode?: string | undefined;
1521
+ agentCommands?: {
1522
+ name: string;
1523
+ description?: string | undefined;
1524
+ }[] | undefined;
1525
+ };
1526
+ history: {
1527
+ method: string;
1528
+ recordedAt: number;
1529
+ params?: unknown;
1530
+ }[];
1531
+ promptHistory?: string[] | undefined;
1532
+ }, {
1533
+ version: 1;
1534
+ exportedAt: string;
1535
+ exportedFrom: {
1536
+ hydraVersion: string;
1537
+ machine: string;
1538
+ };
1539
+ session: {
1540
+ cwd: string;
1541
+ agentId: string;
1542
+ sessionId: string;
1543
+ updatedAt: string;
1544
+ lineageId: string;
1545
+ createdAt: string;
1546
+ title?: string | undefined;
1547
+ currentModel?: string | undefined;
1548
+ currentMode?: string | undefined;
1549
+ agentCommands?: {
1550
+ name: string;
1551
+ description?: string | undefined;
1552
+ }[] | undefined;
1553
+ };
1554
+ history: {
1555
+ method: string;
1556
+ recordedAt: number;
1557
+ params?: unknown;
1558
+ }[];
1559
+ promptHistory?: string[] | undefined;
1560
+ }>;
1561
+ type Bundle = z.infer<typeof Bundle>;
1562
+
1403
1563
  interface CreateSessionParams {
1404
1564
  cwd: string;
1405
1565
  agentId: string;
@@ -1414,10 +1574,10 @@ interface ResurrectParams {
1414
1574
  cwd: string;
1415
1575
  title?: string;
1416
1576
  agentArgs?: string[];
1417
- seedHistory?: CachedNotification[];
1418
1577
  currentModel?: string;
1419
1578
  currentMode?: string;
1420
1579
  agentCommands?: AdvertisedCommand[];
1580
+ createdAt?: string;
1421
1581
  }
1422
1582
  type AgentSpawner = (opts: AgentInstanceOptions) => AgentInstance;
1423
1583
  interface SessionManagerOptions {
@@ -1436,22 +1596,41 @@ declare class SessionManager {
1436
1596
  create(params: CreateSessionParams): Promise<Session>;
1437
1597
  resurrect(params: ResurrectParams): Promise<Session>;
1438
1598
  private doResurrect;
1599
+ private doResurrectFromImport;
1439
1600
  private bootstrapAgent;
1440
1601
  private attachManagerHooks;
1441
- getHistory(sessionId: string): Promise<CachedNotification[] | undefined>;
1602
+ getHistory(sessionId: string): Promise<HistoryEntry[] | undefined>;
1442
1603
  loadFromDisk(sessionId: string): Promise<ResurrectParams | undefined>;
1604
+ private deriveTitleFromHistory;
1443
1605
  get(sessionId: string): Session | undefined;
1444
1606
  resolveCanonicalId(input: string): Promise<string | undefined>;
1445
1607
  require(sessionId: string): Session;
1446
1608
  list(filter?: {
1447
1609
  cwd?: string;
1448
1610
  }): Promise<SessionListEntry[]>;
1611
+ exportBundle(sessionId: string): Promise<{
1612
+ record: SessionRecord & {
1613
+ lineageId: string;
1614
+ };
1615
+ history: HistoryEntry[];
1616
+ promptHistory: string[];
1617
+ } | undefined>;
1618
+ importBundle(bundle: Bundle, opts?: {
1619
+ replace?: boolean;
1620
+ }): Promise<{
1621
+ sessionId: string;
1622
+ importedFromSessionId: string;
1623
+ replaced: boolean;
1624
+ }>;
1625
+ private writeImportedRecord;
1449
1626
  deleteRecord(sessionId: string): Promise<boolean>;
1627
+ hasRecord(sessionId: string): Promise<boolean>;
1450
1628
  private persistTitle;
1451
1629
  private persistAgentChange;
1452
1630
  private persistSnapshot;
1453
1631
  private enqueueMetaWrite;
1454
1632
  closeAll(): Promise<void>;
1633
+ flushMetaWrites(): Promise<void>;
1455
1634
  }
1456
1635
 
1457
1636
  interface ExtensionContext {
@@ -1530,7 +1709,8 @@ declare const paths: {
1530
1709
  extensionsDir: () => string;
1531
1710
  extensionLogFile: (name: string) => string;
1532
1711
  extensionPidFile: (name: string) => string;
1533
- tuiHistoryFile: () => string;
1712
+ tuiHistoryFile: (id: string) => string;
1713
+ tuiLogFile: () => string;
1534
1714
  };
1535
1715
 
1536
1716
  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 };