@hydra-acp/cli 0.1.7 → 0.1.9
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 -4
- package/dist/cli.js +2089 -539
- package/dist/index.d.ts +82 -9
- package/dist/index.js +587 -105
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -40,12 +40,16 @@ declare const HydraConfig: z.ZodObject<{
|
|
|
40
40
|
key: string;
|
|
41
41
|
}>>;
|
|
42
42
|
sessionIdleTimeoutSeconds: z.ZodDefault<z.ZodNumber>;
|
|
43
|
+
sessionHistoryMaxEntries: z.ZodDefault<z.ZodNumber>;
|
|
44
|
+
agentStderrTailBytes: z.ZodDefault<z.ZodNumber>;
|
|
43
45
|
}, "strip", z.ZodTypeAny, {
|
|
44
46
|
host: string;
|
|
45
47
|
port: number;
|
|
46
48
|
authToken: string;
|
|
47
|
-
logLevel: "
|
|
49
|
+
logLevel: "info" | "debug" | "warn" | "error";
|
|
48
50
|
sessionIdleTimeoutSeconds: number;
|
|
51
|
+
sessionHistoryMaxEntries: number;
|
|
52
|
+
agentStderrTailBytes: number;
|
|
49
53
|
tls?: {
|
|
50
54
|
cert: string;
|
|
51
55
|
key: string;
|
|
@@ -54,12 +58,14 @@ declare const HydraConfig: z.ZodObject<{
|
|
|
54
58
|
authToken: string;
|
|
55
59
|
host?: string | undefined;
|
|
56
60
|
port?: number | undefined;
|
|
57
|
-
logLevel?: "
|
|
61
|
+
logLevel?: "info" | "debug" | "warn" | "error" | undefined;
|
|
58
62
|
tls?: {
|
|
59
63
|
cert: string;
|
|
60
64
|
key: string;
|
|
61
65
|
} | undefined;
|
|
62
66
|
sessionIdleTimeoutSeconds?: number | undefined;
|
|
67
|
+
sessionHistoryMaxEntries?: number | undefined;
|
|
68
|
+
agentStderrTailBytes?: number | undefined;
|
|
63
69
|
}>;
|
|
64
70
|
registry: z.ZodDefault<z.ZodObject<{
|
|
65
71
|
url: z.ZodDefault<z.ZodString>;
|
|
@@ -95,22 +101,30 @@ declare const HydraConfig: z.ZodObject<{
|
|
|
95
101
|
repaintThrottleMs: z.ZodDefault<z.ZodNumber>;
|
|
96
102
|
maxScrollbackLines: z.ZodDefault<z.ZodNumber>;
|
|
97
103
|
mouse: z.ZodDefault<z.ZodBoolean>;
|
|
104
|
+
logMaxBytes: z.ZodDefault<z.ZodNumber>;
|
|
105
|
+
cwdColumnMaxWidth: z.ZodDefault<z.ZodNumber>;
|
|
98
106
|
}, "strip", z.ZodTypeAny, {
|
|
99
107
|
repaintThrottleMs: number;
|
|
100
108
|
maxScrollbackLines: number;
|
|
101
109
|
mouse: boolean;
|
|
110
|
+
logMaxBytes: number;
|
|
111
|
+
cwdColumnMaxWidth: number;
|
|
102
112
|
}, {
|
|
103
113
|
repaintThrottleMs?: number | undefined;
|
|
104
114
|
maxScrollbackLines?: number | undefined;
|
|
105
115
|
mouse?: boolean | undefined;
|
|
116
|
+
logMaxBytes?: number | undefined;
|
|
117
|
+
cwdColumnMaxWidth?: number | undefined;
|
|
106
118
|
}>>;
|
|
107
119
|
}, "strip", z.ZodTypeAny, {
|
|
108
120
|
daemon: {
|
|
109
121
|
host: string;
|
|
110
122
|
port: number;
|
|
111
123
|
authToken: string;
|
|
112
|
-
logLevel: "
|
|
124
|
+
logLevel: "info" | "debug" | "warn" | "error";
|
|
113
125
|
sessionIdleTimeoutSeconds: number;
|
|
126
|
+
sessionHistoryMaxEntries: number;
|
|
127
|
+
agentStderrTailBytes: number;
|
|
114
128
|
tls?: {
|
|
115
129
|
cert: string;
|
|
116
130
|
key: string;
|
|
@@ -126,6 +140,8 @@ declare const HydraConfig: z.ZodObject<{
|
|
|
126
140
|
repaintThrottleMs: number;
|
|
127
141
|
maxScrollbackLines: number;
|
|
128
142
|
mouse: boolean;
|
|
143
|
+
logMaxBytes: number;
|
|
144
|
+
cwdColumnMaxWidth: number;
|
|
129
145
|
};
|
|
130
146
|
registry: {
|
|
131
147
|
url: string;
|
|
@@ -140,12 +156,14 @@ declare const HydraConfig: z.ZodObject<{
|
|
|
140
156
|
authToken: string;
|
|
141
157
|
host?: string | undefined;
|
|
142
158
|
port?: number | undefined;
|
|
143
|
-
logLevel?: "
|
|
159
|
+
logLevel?: "info" | "debug" | "warn" | "error" | undefined;
|
|
144
160
|
tls?: {
|
|
145
161
|
cert: string;
|
|
146
162
|
key: string;
|
|
147
163
|
} | undefined;
|
|
148
164
|
sessionIdleTimeoutSeconds?: number | undefined;
|
|
165
|
+
sessionHistoryMaxEntries?: number | undefined;
|
|
166
|
+
agentStderrTailBytes?: number | undefined;
|
|
149
167
|
};
|
|
150
168
|
extensions?: Record<string, {
|
|
151
169
|
command?: string[] | undefined;
|
|
@@ -157,6 +175,8 @@ declare const HydraConfig: z.ZodObject<{
|
|
|
157
175
|
repaintThrottleMs?: number | undefined;
|
|
158
176
|
maxScrollbackLines?: number | undefined;
|
|
159
177
|
mouse?: boolean | undefined;
|
|
178
|
+
logMaxBytes?: number | undefined;
|
|
179
|
+
cwdColumnMaxWidth?: number | undefined;
|
|
160
180
|
} | undefined;
|
|
161
181
|
registry?: {
|
|
162
182
|
url?: string | undefined;
|
|
@@ -187,16 +207,19 @@ declare const RegistryAgent: z.ZodObject<{
|
|
|
187
207
|
distribution: z.ZodObject<{
|
|
188
208
|
npx: z.ZodOptional<z.ZodObject<{
|
|
189
209
|
package: z.ZodString;
|
|
210
|
+
bin: z.ZodOptional<z.ZodString>;
|
|
190
211
|
args: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
191
212
|
env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
192
213
|
}, "strip", z.ZodTypeAny, {
|
|
193
214
|
package: string;
|
|
194
215
|
args?: string[] | undefined;
|
|
195
216
|
env?: Record<string, string> | undefined;
|
|
217
|
+
bin?: string | undefined;
|
|
196
218
|
}, {
|
|
197
219
|
package: string;
|
|
198
220
|
args?: string[] | undefined;
|
|
199
221
|
env?: Record<string, string> | undefined;
|
|
222
|
+
bin?: string | undefined;
|
|
200
223
|
}>>;
|
|
201
224
|
binary: z.ZodOptional<z.ZodObject<{
|
|
202
225
|
"darwin-aarch64": z.ZodOptional<z.ZodObject<{
|
|
@@ -426,6 +449,7 @@ declare const RegistryAgent: z.ZodObject<{
|
|
|
426
449
|
package: string;
|
|
427
450
|
args?: string[] | undefined;
|
|
428
451
|
env?: Record<string, string> | undefined;
|
|
452
|
+
bin?: string | undefined;
|
|
429
453
|
} | undefined;
|
|
430
454
|
uvx?: {
|
|
431
455
|
package: string;
|
|
@@ -475,6 +499,7 @@ declare const RegistryAgent: z.ZodObject<{
|
|
|
475
499
|
package: string;
|
|
476
500
|
args?: string[] | undefined;
|
|
477
501
|
env?: Record<string, string> | undefined;
|
|
502
|
+
bin?: string | undefined;
|
|
478
503
|
} | undefined;
|
|
479
504
|
uvx?: {
|
|
480
505
|
package: string;
|
|
@@ -528,6 +553,7 @@ declare const RegistryAgent: z.ZodObject<{
|
|
|
528
553
|
package: string;
|
|
529
554
|
args?: string[] | undefined;
|
|
530
555
|
env?: Record<string, string> | undefined;
|
|
556
|
+
bin?: string | undefined;
|
|
531
557
|
} | undefined;
|
|
532
558
|
uvx?: {
|
|
533
559
|
package: string;
|
|
@@ -588,6 +614,7 @@ declare const RegistryAgent: z.ZodObject<{
|
|
|
588
614
|
package: string;
|
|
589
615
|
args?: string[] | undefined;
|
|
590
616
|
env?: Record<string, string> | undefined;
|
|
617
|
+
bin?: string | undefined;
|
|
591
618
|
} | undefined;
|
|
592
619
|
uvx?: {
|
|
593
620
|
package: string;
|
|
@@ -619,16 +646,19 @@ declare const RegistryDocument: z.ZodObject<{
|
|
|
619
646
|
distribution: z.ZodObject<{
|
|
620
647
|
npx: z.ZodOptional<z.ZodObject<{
|
|
621
648
|
package: z.ZodString;
|
|
649
|
+
bin: z.ZodOptional<z.ZodString>;
|
|
622
650
|
args: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
623
651
|
env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
624
652
|
}, "strip", z.ZodTypeAny, {
|
|
625
653
|
package: string;
|
|
626
654
|
args?: string[] | undefined;
|
|
627
655
|
env?: Record<string, string> | undefined;
|
|
656
|
+
bin?: string | undefined;
|
|
628
657
|
}, {
|
|
629
658
|
package: string;
|
|
630
659
|
args?: string[] | undefined;
|
|
631
660
|
env?: Record<string, string> | undefined;
|
|
661
|
+
bin?: string | undefined;
|
|
632
662
|
}>>;
|
|
633
663
|
binary: z.ZodOptional<z.ZodObject<{
|
|
634
664
|
"darwin-aarch64": z.ZodOptional<z.ZodObject<{
|
|
@@ -858,6 +888,7 @@ declare const RegistryDocument: z.ZodObject<{
|
|
|
858
888
|
package: string;
|
|
859
889
|
args?: string[] | undefined;
|
|
860
890
|
env?: Record<string, string> | undefined;
|
|
891
|
+
bin?: string | undefined;
|
|
861
892
|
} | undefined;
|
|
862
893
|
uvx?: {
|
|
863
894
|
package: string;
|
|
@@ -907,6 +938,7 @@ declare const RegistryDocument: z.ZodObject<{
|
|
|
907
938
|
package: string;
|
|
908
939
|
args?: string[] | undefined;
|
|
909
940
|
env?: Record<string, string> | undefined;
|
|
941
|
+
bin?: string | undefined;
|
|
910
942
|
} | undefined;
|
|
911
943
|
uvx?: {
|
|
912
944
|
package: string;
|
|
@@ -960,6 +992,7 @@ declare const RegistryDocument: z.ZodObject<{
|
|
|
960
992
|
package: string;
|
|
961
993
|
args?: string[] | undefined;
|
|
962
994
|
env?: Record<string, string> | undefined;
|
|
995
|
+
bin?: string | undefined;
|
|
963
996
|
} | undefined;
|
|
964
997
|
uvx?: {
|
|
965
998
|
package: string;
|
|
@@ -1020,6 +1053,7 @@ declare const RegistryDocument: z.ZodObject<{
|
|
|
1020
1053
|
package: string;
|
|
1021
1054
|
args?: string[] | undefined;
|
|
1022
1055
|
env?: Record<string, string> | undefined;
|
|
1056
|
+
bin?: string | undefined;
|
|
1023
1057
|
} | undefined;
|
|
1024
1058
|
uvx?: {
|
|
1025
1059
|
package: string;
|
|
@@ -1084,6 +1118,7 @@ declare const RegistryDocument: z.ZodObject<{
|
|
|
1084
1118
|
package: string;
|
|
1085
1119
|
args?: string[] | undefined;
|
|
1086
1120
|
env?: Record<string, string> | undefined;
|
|
1121
|
+
bin?: string | undefined;
|
|
1087
1122
|
} | undefined;
|
|
1088
1123
|
uvx?: {
|
|
1089
1124
|
package: string;
|
|
@@ -1148,6 +1183,7 @@ declare const RegistryDocument: z.ZodObject<{
|
|
|
1148
1183
|
package: string;
|
|
1149
1184
|
args?: string[] | undefined;
|
|
1150
1185
|
env?: Record<string, string> | undefined;
|
|
1186
|
+
bin?: string | undefined;
|
|
1151
1187
|
} | undefined;
|
|
1152
1188
|
uvx?: {
|
|
1153
1189
|
package: string;
|
|
@@ -1209,11 +1245,13 @@ interface JsonRpcError {
|
|
|
1209
1245
|
data?: unknown;
|
|
1210
1246
|
}
|
|
1211
1247
|
type JsonRpcMessage = JsonRpcRequest | JsonRpcNotification | JsonRpcResponse;
|
|
1212
|
-
declare const HistoryPolicy: z.ZodEnum<["full", "pending_only", "none"]>;
|
|
1248
|
+
declare const HistoryPolicy: z.ZodEnum<["full", "pending_only", "none", "after_message"]>;
|
|
1213
1249
|
type HistoryPolicy = z.infer<typeof HistoryPolicy>;
|
|
1214
1250
|
declare const SessionAttachParams: z.ZodObject<{
|
|
1215
1251
|
sessionId: z.ZodString;
|
|
1216
|
-
historyPolicy: z.ZodDefault<z.ZodEnum<["full", "pending_only", "none"]>>;
|
|
1252
|
+
historyPolicy: z.ZodDefault<z.ZodEnum<["full", "pending_only", "none", "after_message"]>>;
|
|
1253
|
+
afterMessageId: z.ZodOptional<z.ZodString>;
|
|
1254
|
+
clientId: z.ZodOptional<z.ZodString>;
|
|
1217
1255
|
clientInfo: z.ZodOptional<z.ZodObject<{
|
|
1218
1256
|
name: z.ZodString;
|
|
1219
1257
|
version: z.ZodOptional<z.ZodString>;
|
|
@@ -1227,11 +1265,13 @@ declare const SessionAttachParams: z.ZodObject<{
|
|
|
1227
1265
|
_meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
1228
1266
|
}, "strip", z.ZodTypeAny, {
|
|
1229
1267
|
sessionId: string;
|
|
1230
|
-
historyPolicy: "full" | "pending_only" | "none";
|
|
1268
|
+
historyPolicy: "full" | "pending_only" | "none" | "after_message";
|
|
1231
1269
|
clientInfo?: {
|
|
1232
1270
|
name: string;
|
|
1233
1271
|
version?: string | undefined;
|
|
1234
1272
|
} | undefined;
|
|
1273
|
+
afterMessageId?: string | undefined;
|
|
1274
|
+
clientId?: string | undefined;
|
|
1235
1275
|
_meta?: Record<string, unknown> | undefined;
|
|
1236
1276
|
}, {
|
|
1237
1277
|
sessionId: string;
|
|
@@ -1239,7 +1279,9 @@ declare const SessionAttachParams: z.ZodObject<{
|
|
|
1239
1279
|
name: string;
|
|
1240
1280
|
version?: string | undefined;
|
|
1241
1281
|
} | undefined;
|
|
1242
|
-
historyPolicy?: "full" | "pending_only" | "none" | undefined;
|
|
1282
|
+
historyPolicy?: "full" | "pending_only" | "none" | "after_message" | undefined;
|
|
1283
|
+
afterMessageId?: string | undefined;
|
|
1284
|
+
clientId?: string | undefined;
|
|
1243
1285
|
_meta?: Record<string, unknown> | undefined;
|
|
1244
1286
|
}>;
|
|
1245
1287
|
type SessionAttachParams = z.infer<typeof SessionAttachParams>;
|
|
@@ -1498,6 +1540,7 @@ declare class JsonRpcConnection {
|
|
|
1498
1540
|
};
|
|
1499
1541
|
notify(method: string, params?: unknown): Promise<void>;
|
|
1500
1542
|
close(): Promise<void>;
|
|
1543
|
+
fail(err: Error): void;
|
|
1501
1544
|
private handleIncoming;
|
|
1502
1545
|
private handleRequest;
|
|
1503
1546
|
private handleNotification;
|
|
@@ -1511,6 +1554,7 @@ interface AgentInstanceOptions {
|
|
|
1511
1554
|
cwd: string;
|
|
1512
1555
|
plan: SpawnPlan;
|
|
1513
1556
|
extraEnv?: Record<string, string>;
|
|
1557
|
+
stderrTailBytes?: number;
|
|
1514
1558
|
}
|
|
1515
1559
|
declare class AgentInstance {
|
|
1516
1560
|
readonly agentId: string;
|
|
@@ -1518,8 +1562,12 @@ declare class AgentInstance {
|
|
|
1518
1562
|
readonly connection: JsonRpcConnection;
|
|
1519
1563
|
private child;
|
|
1520
1564
|
private exited;
|
|
1565
|
+
private killed;
|
|
1566
|
+
private stderrTail;
|
|
1567
|
+
private stderrTailBytes;
|
|
1521
1568
|
private exitHandlers;
|
|
1522
1569
|
private constructor();
|
|
1570
|
+
private formatFailure;
|
|
1523
1571
|
static spawn(opts: AgentInstanceOptions): AgentInstance;
|
|
1524
1572
|
onExit(handler: (code: number | null, signal: NodeJS.Signals | null) => void): void;
|
|
1525
1573
|
isAlive(): boolean;
|
|
@@ -1536,8 +1584,13 @@ interface HistoryEntry {
|
|
|
1536
1584
|
params: unknown;
|
|
1537
1585
|
recordedAt: number;
|
|
1538
1586
|
}
|
|
1587
|
+
interface HistoryStoreOptions {
|
|
1588
|
+
maxEntries?: number;
|
|
1589
|
+
}
|
|
1539
1590
|
declare class HistoryStore {
|
|
1540
1591
|
private writeQueues;
|
|
1592
|
+
private maxEntries;
|
|
1593
|
+
constructor(options?: HistoryStoreOptions);
|
|
1541
1594
|
append(sessionId: string, entry: HistoryEntry): Promise<void>;
|
|
1542
1595
|
rewrite(sessionId: string, entries: HistoryEntry[]): Promise<void>;
|
|
1543
1596
|
compact(sessionId: string, maxEntries: number): Promise<void>;
|
|
@@ -1584,6 +1637,7 @@ interface SessionInit {
|
|
|
1584
1637
|
idleTimeoutMs?: number;
|
|
1585
1638
|
spawnReplacementAgent?: SpawnReplacementAgent;
|
|
1586
1639
|
historyStore?: HistoryStore;
|
|
1640
|
+
historyMaxEntries?: number;
|
|
1587
1641
|
currentModel?: string;
|
|
1588
1642
|
currentMode?: string;
|
|
1589
1643
|
currentUsage?: UsageSnapshot;
|
|
@@ -1621,6 +1675,8 @@ declare class Session {
|
|
|
1621
1675
|
private firstPromptSeeded;
|
|
1622
1676
|
private promptStartedAt;
|
|
1623
1677
|
private appendCount;
|
|
1678
|
+
private historyMaxEntries;
|
|
1679
|
+
private compactEvery;
|
|
1624
1680
|
private inFlightPermissions;
|
|
1625
1681
|
private internalPromptCapture;
|
|
1626
1682
|
private idleTimeoutMs;
|
|
@@ -1641,12 +1697,24 @@ declare class Session {
|
|
|
1641
1697
|
upstreamSessionId: string;
|
|
1642
1698
|
}) => void): void;
|
|
1643
1699
|
get attachedCount(): number;
|
|
1700
|
+
connectedClients(excludeClientId?: string): Array<{
|
|
1701
|
+
clientId: string;
|
|
1702
|
+
name?: string;
|
|
1703
|
+
version?: string;
|
|
1704
|
+
}>;
|
|
1644
1705
|
get turnStartedAt(): number | undefined;
|
|
1645
1706
|
getHistorySnapshot(): Promise<CachedNotification[]>;
|
|
1646
1707
|
onBroadcast(handler: (entry: CachedNotification) => void): () => void;
|
|
1647
|
-
attach(client: AttachedClient, historyPolicy: HistoryPolicy
|
|
1708
|
+
attach(client: AttachedClient, historyPolicy: HistoryPolicy, opts?: {
|
|
1709
|
+
afterMessageId?: string;
|
|
1710
|
+
}): Promise<{
|
|
1711
|
+
entries: CachedNotification[];
|
|
1712
|
+
appliedPolicy: HistoryPolicy;
|
|
1713
|
+
}>;
|
|
1714
|
+
private loadReplay;
|
|
1648
1715
|
replayPendingPermissions(client: AttachedClient): void;
|
|
1649
1716
|
detach(clientId: string): void;
|
|
1717
|
+
private broadcastClientDisconnected;
|
|
1650
1718
|
prompt(clientId: string, params: unknown): Promise<unknown>;
|
|
1651
1719
|
private broadcastPromptReceived;
|
|
1652
1720
|
private broadcastTurnComplete;
|
|
@@ -1990,6 +2058,7 @@ type AgentSpawner = (opts: AgentInstanceOptions) => AgentInstance;
|
|
|
1990
2058
|
interface SessionManagerOptions {
|
|
1991
2059
|
idleTimeoutMs?: number;
|
|
1992
2060
|
defaultModels?: Record<string, string>;
|
|
2061
|
+
sessionHistoryMaxEntries?: number;
|
|
1993
2062
|
}
|
|
1994
2063
|
declare class SessionManager {
|
|
1995
2064
|
private registry;
|
|
@@ -2000,12 +2069,14 @@ declare class SessionManager {
|
|
|
2000
2069
|
private histories;
|
|
2001
2070
|
private idleTimeoutMs;
|
|
2002
2071
|
private defaultModels;
|
|
2072
|
+
private sessionHistoryMaxEntries;
|
|
2003
2073
|
private metaWriteQueues;
|
|
2004
2074
|
constructor(registry: Registry, spawner?: AgentSpawner, store?: SessionStore, options?: SessionManagerOptions);
|
|
2005
2075
|
create(params: CreateSessionParams): Promise<Session>;
|
|
2006
2076
|
resurrect(params: ResurrectParams): Promise<Session>;
|
|
2007
2077
|
private doResurrect;
|
|
2008
2078
|
private doResurrectFromImport;
|
|
2079
|
+
private resolveImportCwd;
|
|
2009
2080
|
private bootstrapAgent;
|
|
2010
2081
|
private attachManagerHooks;
|
|
2011
2082
|
getHistory(sessionId: string): Promise<HistoryEntry[] | undefined>;
|
|
@@ -2026,6 +2097,7 @@ declare class SessionManager {
|
|
|
2026
2097
|
} | undefined>;
|
|
2027
2098
|
importBundle(bundle: Bundle, opts?: {
|
|
2028
2099
|
replace?: boolean;
|
|
2100
|
+
cwd?: string;
|
|
2029
2101
|
}): Promise<{
|
|
2030
2102
|
sessionId: string;
|
|
2031
2103
|
importedFromSessionId: string;
|
|
@@ -2112,6 +2184,7 @@ declare const paths: {
|
|
|
2112
2184
|
registryCache: () => string;
|
|
2113
2185
|
agentsDir: () => string;
|
|
2114
2186
|
agentInstallDir: (id: string, platformKey: string, version: string) => string;
|
|
2187
|
+
agentNpmInstallDir: (id: string, platformKey: string, version: string) => string;
|
|
2115
2188
|
sessionsDir: () => string;
|
|
2116
2189
|
sessionDir: (id: string) => string;
|
|
2117
2190
|
sessionFile: (id: string) => string;
|