@hydra-acp/cli 0.1.6 → 0.1.8
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 +3 -1
- package/dist/cli.js +2185 -634
- package/dist/index.d.ts +68 -5
- package/dist/index.js +471 -106
- 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>;
|
|
@@ -94,20 +100,31 @@ declare const HydraConfig: z.ZodObject<{
|
|
|
94
100
|
tui: z.ZodDefault<z.ZodObject<{
|
|
95
101
|
repaintThrottleMs: z.ZodDefault<z.ZodNumber>;
|
|
96
102
|
maxScrollbackLines: z.ZodDefault<z.ZodNumber>;
|
|
103
|
+
mouse: z.ZodDefault<z.ZodBoolean>;
|
|
104
|
+
logMaxBytes: z.ZodDefault<z.ZodNumber>;
|
|
105
|
+
cwdColumnMaxWidth: z.ZodDefault<z.ZodNumber>;
|
|
97
106
|
}, "strip", z.ZodTypeAny, {
|
|
98
107
|
repaintThrottleMs: number;
|
|
99
108
|
maxScrollbackLines: number;
|
|
109
|
+
mouse: boolean;
|
|
110
|
+
logMaxBytes: number;
|
|
111
|
+
cwdColumnMaxWidth: number;
|
|
100
112
|
}, {
|
|
101
113
|
repaintThrottleMs?: number | undefined;
|
|
102
114
|
maxScrollbackLines?: number | undefined;
|
|
115
|
+
mouse?: boolean | undefined;
|
|
116
|
+
logMaxBytes?: number | undefined;
|
|
117
|
+
cwdColumnMaxWidth?: number | undefined;
|
|
103
118
|
}>>;
|
|
104
119
|
}, "strip", z.ZodTypeAny, {
|
|
105
120
|
daemon: {
|
|
106
121
|
host: string;
|
|
107
122
|
port: number;
|
|
108
123
|
authToken: string;
|
|
109
|
-
logLevel: "
|
|
124
|
+
logLevel: "info" | "debug" | "warn" | "error";
|
|
110
125
|
sessionIdleTimeoutSeconds: number;
|
|
126
|
+
sessionHistoryMaxEntries: number;
|
|
127
|
+
agentStderrTailBytes: number;
|
|
111
128
|
tls?: {
|
|
112
129
|
cert: string;
|
|
113
130
|
key: string;
|
|
@@ -122,6 +139,9 @@ declare const HydraConfig: z.ZodObject<{
|
|
|
122
139
|
tui: {
|
|
123
140
|
repaintThrottleMs: number;
|
|
124
141
|
maxScrollbackLines: number;
|
|
142
|
+
mouse: boolean;
|
|
143
|
+
logMaxBytes: number;
|
|
144
|
+
cwdColumnMaxWidth: number;
|
|
125
145
|
};
|
|
126
146
|
registry: {
|
|
127
147
|
url: string;
|
|
@@ -136,12 +156,14 @@ declare const HydraConfig: z.ZodObject<{
|
|
|
136
156
|
authToken: string;
|
|
137
157
|
host?: string | undefined;
|
|
138
158
|
port?: number | undefined;
|
|
139
|
-
logLevel?: "
|
|
159
|
+
logLevel?: "info" | "debug" | "warn" | "error" | undefined;
|
|
140
160
|
tls?: {
|
|
141
161
|
cert: string;
|
|
142
162
|
key: string;
|
|
143
163
|
} | undefined;
|
|
144
164
|
sessionIdleTimeoutSeconds?: number | undefined;
|
|
165
|
+
sessionHistoryMaxEntries?: number | undefined;
|
|
166
|
+
agentStderrTailBytes?: number | undefined;
|
|
145
167
|
};
|
|
146
168
|
extensions?: Record<string, {
|
|
147
169
|
command?: string[] | undefined;
|
|
@@ -152,6 +174,9 @@ declare const HydraConfig: z.ZodObject<{
|
|
|
152
174
|
tui?: {
|
|
153
175
|
repaintThrottleMs?: number | undefined;
|
|
154
176
|
maxScrollbackLines?: number | undefined;
|
|
177
|
+
mouse?: boolean | undefined;
|
|
178
|
+
logMaxBytes?: number | undefined;
|
|
179
|
+
cwdColumnMaxWidth?: number | undefined;
|
|
155
180
|
} | undefined;
|
|
156
181
|
registry?: {
|
|
157
182
|
url?: string | undefined;
|
|
@@ -182,16 +207,19 @@ declare const RegistryAgent: z.ZodObject<{
|
|
|
182
207
|
distribution: z.ZodObject<{
|
|
183
208
|
npx: z.ZodOptional<z.ZodObject<{
|
|
184
209
|
package: z.ZodString;
|
|
210
|
+
bin: z.ZodOptional<z.ZodString>;
|
|
185
211
|
args: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
186
212
|
env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
187
213
|
}, "strip", z.ZodTypeAny, {
|
|
188
214
|
package: string;
|
|
189
215
|
args?: string[] | undefined;
|
|
190
216
|
env?: Record<string, string> | undefined;
|
|
217
|
+
bin?: string | undefined;
|
|
191
218
|
}, {
|
|
192
219
|
package: string;
|
|
193
220
|
args?: string[] | undefined;
|
|
194
221
|
env?: Record<string, string> | undefined;
|
|
222
|
+
bin?: string | undefined;
|
|
195
223
|
}>>;
|
|
196
224
|
binary: z.ZodOptional<z.ZodObject<{
|
|
197
225
|
"darwin-aarch64": z.ZodOptional<z.ZodObject<{
|
|
@@ -421,6 +449,7 @@ declare const RegistryAgent: z.ZodObject<{
|
|
|
421
449
|
package: string;
|
|
422
450
|
args?: string[] | undefined;
|
|
423
451
|
env?: Record<string, string> | undefined;
|
|
452
|
+
bin?: string | undefined;
|
|
424
453
|
} | undefined;
|
|
425
454
|
uvx?: {
|
|
426
455
|
package: string;
|
|
@@ -470,6 +499,7 @@ declare const RegistryAgent: z.ZodObject<{
|
|
|
470
499
|
package: string;
|
|
471
500
|
args?: string[] | undefined;
|
|
472
501
|
env?: Record<string, string> | undefined;
|
|
502
|
+
bin?: string | undefined;
|
|
473
503
|
} | undefined;
|
|
474
504
|
uvx?: {
|
|
475
505
|
package: string;
|
|
@@ -523,6 +553,7 @@ declare const RegistryAgent: z.ZodObject<{
|
|
|
523
553
|
package: string;
|
|
524
554
|
args?: string[] | undefined;
|
|
525
555
|
env?: Record<string, string> | undefined;
|
|
556
|
+
bin?: string | undefined;
|
|
526
557
|
} | undefined;
|
|
527
558
|
uvx?: {
|
|
528
559
|
package: string;
|
|
@@ -583,6 +614,7 @@ declare const RegistryAgent: z.ZodObject<{
|
|
|
583
614
|
package: string;
|
|
584
615
|
args?: string[] | undefined;
|
|
585
616
|
env?: Record<string, string> | undefined;
|
|
617
|
+
bin?: string | undefined;
|
|
586
618
|
} | undefined;
|
|
587
619
|
uvx?: {
|
|
588
620
|
package: string;
|
|
@@ -614,16 +646,19 @@ declare const RegistryDocument: z.ZodObject<{
|
|
|
614
646
|
distribution: z.ZodObject<{
|
|
615
647
|
npx: z.ZodOptional<z.ZodObject<{
|
|
616
648
|
package: z.ZodString;
|
|
649
|
+
bin: z.ZodOptional<z.ZodString>;
|
|
617
650
|
args: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
618
651
|
env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
619
652
|
}, "strip", z.ZodTypeAny, {
|
|
620
653
|
package: string;
|
|
621
654
|
args?: string[] | undefined;
|
|
622
655
|
env?: Record<string, string> | undefined;
|
|
656
|
+
bin?: string | undefined;
|
|
623
657
|
}, {
|
|
624
658
|
package: string;
|
|
625
659
|
args?: string[] | undefined;
|
|
626
660
|
env?: Record<string, string> | undefined;
|
|
661
|
+
bin?: string | undefined;
|
|
627
662
|
}>>;
|
|
628
663
|
binary: z.ZodOptional<z.ZodObject<{
|
|
629
664
|
"darwin-aarch64": z.ZodOptional<z.ZodObject<{
|
|
@@ -853,6 +888,7 @@ declare const RegistryDocument: z.ZodObject<{
|
|
|
853
888
|
package: string;
|
|
854
889
|
args?: string[] | undefined;
|
|
855
890
|
env?: Record<string, string> | undefined;
|
|
891
|
+
bin?: string | undefined;
|
|
856
892
|
} | undefined;
|
|
857
893
|
uvx?: {
|
|
858
894
|
package: string;
|
|
@@ -902,6 +938,7 @@ declare const RegistryDocument: z.ZodObject<{
|
|
|
902
938
|
package: string;
|
|
903
939
|
args?: string[] | undefined;
|
|
904
940
|
env?: Record<string, string> | undefined;
|
|
941
|
+
bin?: string | undefined;
|
|
905
942
|
} | undefined;
|
|
906
943
|
uvx?: {
|
|
907
944
|
package: string;
|
|
@@ -955,6 +992,7 @@ declare const RegistryDocument: z.ZodObject<{
|
|
|
955
992
|
package: string;
|
|
956
993
|
args?: string[] | undefined;
|
|
957
994
|
env?: Record<string, string> | undefined;
|
|
995
|
+
bin?: string | undefined;
|
|
958
996
|
} | undefined;
|
|
959
997
|
uvx?: {
|
|
960
998
|
package: string;
|
|
@@ -1015,6 +1053,7 @@ declare const RegistryDocument: z.ZodObject<{
|
|
|
1015
1053
|
package: string;
|
|
1016
1054
|
args?: string[] | undefined;
|
|
1017
1055
|
env?: Record<string, string> | undefined;
|
|
1056
|
+
bin?: string | undefined;
|
|
1018
1057
|
} | undefined;
|
|
1019
1058
|
uvx?: {
|
|
1020
1059
|
package: string;
|
|
@@ -1079,6 +1118,7 @@ declare const RegistryDocument: z.ZodObject<{
|
|
|
1079
1118
|
package: string;
|
|
1080
1119
|
args?: string[] | undefined;
|
|
1081
1120
|
env?: Record<string, string> | undefined;
|
|
1121
|
+
bin?: string | undefined;
|
|
1082
1122
|
} | undefined;
|
|
1083
1123
|
uvx?: {
|
|
1084
1124
|
package: string;
|
|
@@ -1143,6 +1183,7 @@ declare const RegistryDocument: z.ZodObject<{
|
|
|
1143
1183
|
package: string;
|
|
1144
1184
|
args?: string[] | undefined;
|
|
1145
1185
|
env?: Record<string, string> | undefined;
|
|
1186
|
+
bin?: string | undefined;
|
|
1146
1187
|
} | undefined;
|
|
1147
1188
|
uvx?: {
|
|
1148
1189
|
package: string;
|
|
@@ -1178,7 +1219,7 @@ interface SpawnPlan {
|
|
|
1178
1219
|
args: string[];
|
|
1179
1220
|
env: Record<string, string>;
|
|
1180
1221
|
}
|
|
1181
|
-
declare function planSpawn(agent: RegistryAgent,
|
|
1222
|
+
declare function planSpawn(agent: RegistryAgent, callerArgs?: string[]): Promise<SpawnPlan>;
|
|
1182
1223
|
|
|
1183
1224
|
type JsonRpcId = string | number;
|
|
1184
1225
|
interface JsonRpcRequest {
|
|
@@ -1476,6 +1517,8 @@ declare class JsonRpcConnection {
|
|
|
1476
1517
|
private requestHandlers;
|
|
1477
1518
|
private defaultRequestHandler;
|
|
1478
1519
|
private notificationHandlers;
|
|
1520
|
+
private bufferedNotifications;
|
|
1521
|
+
private static readonly MAX_BUFFERED_PER_METHOD;
|
|
1479
1522
|
private pending;
|
|
1480
1523
|
private closed;
|
|
1481
1524
|
private closeHandlers;
|
|
@@ -1491,6 +1534,7 @@ declare class JsonRpcConnection {
|
|
|
1491
1534
|
};
|
|
1492
1535
|
notify(method: string, params?: unknown): Promise<void>;
|
|
1493
1536
|
close(): Promise<void>;
|
|
1537
|
+
fail(err: Error): void;
|
|
1494
1538
|
private handleIncoming;
|
|
1495
1539
|
private handleRequest;
|
|
1496
1540
|
private handleNotification;
|
|
@@ -1504,6 +1548,7 @@ interface AgentInstanceOptions {
|
|
|
1504
1548
|
cwd: string;
|
|
1505
1549
|
plan: SpawnPlan;
|
|
1506
1550
|
extraEnv?: Record<string, string>;
|
|
1551
|
+
stderrTailBytes?: number;
|
|
1507
1552
|
}
|
|
1508
1553
|
declare class AgentInstance {
|
|
1509
1554
|
readonly agentId: string;
|
|
@@ -1511,8 +1556,12 @@ declare class AgentInstance {
|
|
|
1511
1556
|
readonly connection: JsonRpcConnection;
|
|
1512
1557
|
private child;
|
|
1513
1558
|
private exited;
|
|
1559
|
+
private killed;
|
|
1560
|
+
private stderrTail;
|
|
1561
|
+
private stderrTailBytes;
|
|
1514
1562
|
private exitHandlers;
|
|
1515
1563
|
private constructor();
|
|
1564
|
+
private formatFailure;
|
|
1516
1565
|
static spawn(opts: AgentInstanceOptions): AgentInstance;
|
|
1517
1566
|
onExit(handler: (code: number | null, signal: NodeJS.Signals | null) => void): void;
|
|
1518
1567
|
isAlive(): boolean;
|
|
@@ -1529,8 +1578,13 @@ interface HistoryEntry {
|
|
|
1529
1578
|
params: unknown;
|
|
1530
1579
|
recordedAt: number;
|
|
1531
1580
|
}
|
|
1581
|
+
interface HistoryStoreOptions {
|
|
1582
|
+
maxEntries?: number;
|
|
1583
|
+
}
|
|
1532
1584
|
declare class HistoryStore {
|
|
1533
1585
|
private writeQueues;
|
|
1586
|
+
private maxEntries;
|
|
1587
|
+
constructor(options?: HistoryStoreOptions);
|
|
1534
1588
|
append(sessionId: string, entry: HistoryEntry): Promise<void>;
|
|
1535
1589
|
rewrite(sessionId: string, entries: HistoryEntry[]): Promise<void>;
|
|
1536
1590
|
compact(sessionId: string, maxEntries: number): Promise<void>;
|
|
@@ -1577,6 +1631,7 @@ interface SessionInit {
|
|
|
1577
1631
|
idleTimeoutMs?: number;
|
|
1578
1632
|
spawnReplacementAgent?: SpawnReplacementAgent;
|
|
1579
1633
|
historyStore?: HistoryStore;
|
|
1634
|
+
historyMaxEntries?: number;
|
|
1580
1635
|
currentModel?: string;
|
|
1581
1636
|
currentMode?: string;
|
|
1582
1637
|
currentUsage?: UsageSnapshot;
|
|
@@ -1614,6 +1669,8 @@ declare class Session {
|
|
|
1614
1669
|
private firstPromptSeeded;
|
|
1615
1670
|
private promptStartedAt;
|
|
1616
1671
|
private appendCount;
|
|
1672
|
+
private historyMaxEntries;
|
|
1673
|
+
private compactEvery;
|
|
1617
1674
|
private inFlightPermissions;
|
|
1618
1675
|
private internalPromptCapture;
|
|
1619
1676
|
private idleTimeoutMs;
|
|
@@ -1983,6 +2040,7 @@ type AgentSpawner = (opts: AgentInstanceOptions) => AgentInstance;
|
|
|
1983
2040
|
interface SessionManagerOptions {
|
|
1984
2041
|
idleTimeoutMs?: number;
|
|
1985
2042
|
defaultModels?: Record<string, string>;
|
|
2043
|
+
sessionHistoryMaxEntries?: number;
|
|
1986
2044
|
}
|
|
1987
2045
|
declare class SessionManager {
|
|
1988
2046
|
private registry;
|
|
@@ -1993,12 +2051,14 @@ declare class SessionManager {
|
|
|
1993
2051
|
private histories;
|
|
1994
2052
|
private idleTimeoutMs;
|
|
1995
2053
|
private defaultModels;
|
|
2054
|
+
private sessionHistoryMaxEntries;
|
|
1996
2055
|
private metaWriteQueues;
|
|
1997
2056
|
constructor(registry: Registry, spawner?: AgentSpawner, store?: SessionStore, options?: SessionManagerOptions);
|
|
1998
2057
|
create(params: CreateSessionParams): Promise<Session>;
|
|
1999
2058
|
resurrect(params: ResurrectParams): Promise<Session>;
|
|
2000
2059
|
private doResurrect;
|
|
2001
2060
|
private doResurrectFromImport;
|
|
2061
|
+
private resolveImportCwd;
|
|
2002
2062
|
private bootstrapAgent;
|
|
2003
2063
|
private attachManagerHooks;
|
|
2004
2064
|
getHistory(sessionId: string): Promise<HistoryEntry[] | undefined>;
|
|
@@ -2019,6 +2079,7 @@ declare class SessionManager {
|
|
|
2019
2079
|
} | undefined>;
|
|
2020
2080
|
importBundle(bundle: Bundle, opts?: {
|
|
2021
2081
|
replace?: boolean;
|
|
2082
|
+
cwd?: string;
|
|
2022
2083
|
}): Promise<{
|
|
2023
2084
|
sessionId: string;
|
|
2024
2085
|
importedFromSessionId: string;
|
|
@@ -2098,12 +2159,14 @@ declare function hydraHome(): string;
|
|
|
2098
2159
|
declare const paths: {
|
|
2099
2160
|
home: typeof hydraHome;
|
|
2100
2161
|
config: () => string;
|
|
2162
|
+
authToken: () => string;
|
|
2101
2163
|
pidFile: () => string;
|
|
2102
2164
|
logFile: () => string;
|
|
2103
2165
|
currentLogFile: () => string;
|
|
2104
2166
|
registryCache: () => string;
|
|
2105
2167
|
agentsDir: () => string;
|
|
2106
2168
|
agentInstallDir: (id: string, platformKey: string, version: string) => string;
|
|
2169
|
+
agentNpmInstallDir: (id: string, platformKey: string, version: string) => string;
|
|
2107
2170
|
sessionsDir: () => string;
|
|
2108
2171
|
sessionDir: (id: string) => string;
|
|
2109
2172
|
sessionFile: (id: string) => string;
|