@kmmao/happy-agent 0.5.4 → 0.7.0
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 +19 -0
- package/dist/index.cjs +2596 -73
- package/dist/index.d.cts +384 -17
- package/dist/index.d.mts +384 -17
- package/dist/index.mjs +2573 -68
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import
|
|
2
|
+
import * as z from 'zod';
|
|
3
|
+
import { z as z$1 } from 'zod';
|
|
3
4
|
import { EventEmitter } from 'node:events';
|
|
4
5
|
import { Socket } from 'socket.io-client';
|
|
5
6
|
|
|
@@ -28,6 +29,378 @@ declare function authLogin(config: Config, opts?: {
|
|
|
28
29
|
declare function authLogout(config: Config): Promise<void>;
|
|
29
30
|
declare function authStatus(config: Config): Promise<void>;
|
|
30
31
|
|
|
32
|
+
/**
|
|
33
|
+
* Machine-related Zod schemas shared across CLI, Agent, and Server.
|
|
34
|
+
*
|
|
35
|
+
* Single source of truth for MachineMetadata, DaemonState,
|
|
36
|
+
* and Tailscale types. All packages import from here.
|
|
37
|
+
*/
|
|
38
|
+
|
|
39
|
+
declare const MachineMetadataSchema: z.ZodObject<{
|
|
40
|
+
host: z.ZodString;
|
|
41
|
+
platform: z.ZodString;
|
|
42
|
+
happyCliVersion: z.ZodString;
|
|
43
|
+
homeDir: z.ZodString;
|
|
44
|
+
happyHomeDir: z.ZodString;
|
|
45
|
+
happyLibDir: z.ZodString;
|
|
46
|
+
}, z.core.$strip>;
|
|
47
|
+
type MachineMetadata = z.infer<typeof MachineMetadataSchema>;
|
|
48
|
+
declare const TunnelEntrySchema: z.ZodObject<{
|
|
49
|
+
provider: z.ZodString;
|
|
50
|
+
localPort: z.ZodNumber;
|
|
51
|
+
remotePort: z.ZodOptional<z.ZodNumber>;
|
|
52
|
+
protocol: z.ZodString;
|
|
53
|
+
path: z.ZodOptional<z.ZodString>;
|
|
54
|
+
target: z.ZodString;
|
|
55
|
+
publicUrl: z.ZodOptional<z.ZodString>;
|
|
56
|
+
accessScope: z.ZodEnum<{
|
|
57
|
+
public: "public";
|
|
58
|
+
private: "private";
|
|
59
|
+
tailnet: "tailnet";
|
|
60
|
+
}>;
|
|
61
|
+
hostname: z.ZodOptional<z.ZodString>;
|
|
62
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
63
|
+
}, z.core.$strip>;
|
|
64
|
+
type TunnelEntry = z.infer<typeof TunnelEntrySchema>;
|
|
65
|
+
declare const TunnelProviderInfoSchema: z.ZodObject<{
|
|
66
|
+
provider: z.ZodString;
|
|
67
|
+
status: z.ZodEnum<{
|
|
68
|
+
"not-installed": "not-installed";
|
|
69
|
+
available: "available";
|
|
70
|
+
unavailable: "unavailable";
|
|
71
|
+
}>;
|
|
72
|
+
version: z.ZodOptional<z.ZodString>;
|
|
73
|
+
entries: z.ZodArray<z.ZodObject<{
|
|
74
|
+
provider: z.ZodString;
|
|
75
|
+
localPort: z.ZodNumber;
|
|
76
|
+
remotePort: z.ZodOptional<z.ZodNumber>;
|
|
77
|
+
protocol: z.ZodString;
|
|
78
|
+
path: z.ZodOptional<z.ZodString>;
|
|
79
|
+
target: z.ZodString;
|
|
80
|
+
publicUrl: z.ZodOptional<z.ZodString>;
|
|
81
|
+
accessScope: z.ZodEnum<{
|
|
82
|
+
public: "public";
|
|
83
|
+
private: "private";
|
|
84
|
+
tailnet: "tailnet";
|
|
85
|
+
}>;
|
|
86
|
+
hostname: z.ZodOptional<z.ZodString>;
|
|
87
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
88
|
+
}, z.core.$strip>>;
|
|
89
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
90
|
+
}, z.core.$strip>;
|
|
91
|
+
type TunnelProviderInfo = z.infer<typeof TunnelProviderInfoSchema>;
|
|
92
|
+
declare const TunnelStateSchema: z.ZodObject<{
|
|
93
|
+
providers: z.ZodArray<z.ZodObject<{
|
|
94
|
+
provider: z.ZodString;
|
|
95
|
+
status: z.ZodEnum<{
|
|
96
|
+
"not-installed": "not-installed";
|
|
97
|
+
available: "available";
|
|
98
|
+
unavailable: "unavailable";
|
|
99
|
+
}>;
|
|
100
|
+
version: z.ZodOptional<z.ZodString>;
|
|
101
|
+
entries: z.ZodArray<z.ZodObject<{
|
|
102
|
+
provider: z.ZodString;
|
|
103
|
+
localPort: z.ZodNumber;
|
|
104
|
+
remotePort: z.ZodOptional<z.ZodNumber>;
|
|
105
|
+
protocol: z.ZodString;
|
|
106
|
+
path: z.ZodOptional<z.ZodString>;
|
|
107
|
+
target: z.ZodString;
|
|
108
|
+
publicUrl: z.ZodOptional<z.ZodString>;
|
|
109
|
+
accessScope: z.ZodEnum<{
|
|
110
|
+
public: "public";
|
|
111
|
+
private: "private";
|
|
112
|
+
tailnet: "tailnet";
|
|
113
|
+
}>;
|
|
114
|
+
hostname: z.ZodOptional<z.ZodString>;
|
|
115
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
116
|
+
}, z.core.$strip>>;
|
|
117
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
118
|
+
}, z.core.$strip>>;
|
|
119
|
+
}, z.core.$strip>;
|
|
120
|
+
type TunnelState = z.infer<typeof TunnelStateSchema>;
|
|
121
|
+
declare const DaemonStateSchema: z.ZodObject<{
|
|
122
|
+
status: z.ZodUnion<readonly [z.ZodEnum<{
|
|
123
|
+
running: "running";
|
|
124
|
+
"shutting-down": "shutting-down";
|
|
125
|
+
}>, z.ZodString]>;
|
|
126
|
+
pid: z.ZodOptional<z.ZodNumber>;
|
|
127
|
+
httpPort: z.ZodOptional<z.ZodNumber>;
|
|
128
|
+
startTime: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
|
|
129
|
+
startedAt: z.ZodOptional<z.ZodNumber>;
|
|
130
|
+
startedWithCliVersion: z.ZodOptional<z.ZodString>;
|
|
131
|
+
shutdownRequestedAt: z.ZodOptional<z.ZodNumber>;
|
|
132
|
+
shutdownSource: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
|
|
133
|
+
unknown: "unknown";
|
|
134
|
+
"mobile-app": "mobile-app";
|
|
135
|
+
cli: "cli";
|
|
136
|
+
"os-signal": "os-signal";
|
|
137
|
+
}>, z.ZodString]>>;
|
|
138
|
+
tailscale: z.ZodOptional<z.ZodObject<{
|
|
139
|
+
status: z.ZodEnum<{
|
|
140
|
+
connected: "connected";
|
|
141
|
+
disconnected: "disconnected";
|
|
142
|
+
"not-installed": "not-installed";
|
|
143
|
+
}>;
|
|
144
|
+
ipv4: z.ZodOptional<z.ZodString>;
|
|
145
|
+
ipv6: z.ZodOptional<z.ZodString>;
|
|
146
|
+
hostname: z.ZodOptional<z.ZodString>;
|
|
147
|
+
tailnetName: z.ZodOptional<z.ZodString>;
|
|
148
|
+
version: z.ZodOptional<z.ZodString>;
|
|
149
|
+
serves: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
150
|
+
port: z.ZodNumber;
|
|
151
|
+
path: z.ZodOptional<z.ZodString>;
|
|
152
|
+
protocol: z.ZodString;
|
|
153
|
+
target: z.ZodString;
|
|
154
|
+
funnel: z.ZodBoolean;
|
|
155
|
+
hostname: z.ZodString;
|
|
156
|
+
}, z.core.$strip>>>;
|
|
157
|
+
}, z.core.$strip>>;
|
|
158
|
+
tunnels: z.ZodOptional<z.ZodObject<{
|
|
159
|
+
providers: z.ZodArray<z.ZodObject<{
|
|
160
|
+
provider: z.ZodString;
|
|
161
|
+
status: z.ZodEnum<{
|
|
162
|
+
"not-installed": "not-installed";
|
|
163
|
+
available: "available";
|
|
164
|
+
unavailable: "unavailable";
|
|
165
|
+
}>;
|
|
166
|
+
version: z.ZodOptional<z.ZodString>;
|
|
167
|
+
entries: z.ZodArray<z.ZodObject<{
|
|
168
|
+
provider: z.ZodString;
|
|
169
|
+
localPort: z.ZodNumber;
|
|
170
|
+
remotePort: z.ZodOptional<z.ZodNumber>;
|
|
171
|
+
protocol: z.ZodString;
|
|
172
|
+
path: z.ZodOptional<z.ZodString>;
|
|
173
|
+
target: z.ZodString;
|
|
174
|
+
publicUrl: z.ZodOptional<z.ZodString>;
|
|
175
|
+
accessScope: z.ZodEnum<{
|
|
176
|
+
public: "public";
|
|
177
|
+
private: "private";
|
|
178
|
+
tailnet: "tailnet";
|
|
179
|
+
}>;
|
|
180
|
+
hostname: z.ZodOptional<z.ZodString>;
|
|
181
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
182
|
+
}, z.core.$strip>>;
|
|
183
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
184
|
+
}, z.core.$strip>>;
|
|
185
|
+
}, z.core.$strip>>;
|
|
186
|
+
automation: z.ZodOptional<z.ZodObject<{
|
|
187
|
+
updatedAt: z.ZodNumber;
|
|
188
|
+
counts: z.ZodObject<{
|
|
189
|
+
queued: z.ZodNumber;
|
|
190
|
+
dispatching: z.ZodNumber;
|
|
191
|
+
running: z.ZodNumber;
|
|
192
|
+
completed: z.ZodNumber;
|
|
193
|
+
failed: z.ZodNumber;
|
|
194
|
+
cancelled: z.ZodNumber;
|
|
195
|
+
}, z.core.$strip>;
|
|
196
|
+
recentJobs: z.ZodArray<z.ZodObject<{
|
|
197
|
+
id: z.ZodString;
|
|
198
|
+
kind: z.ZodEnum<{
|
|
199
|
+
supervisor: "supervisor";
|
|
200
|
+
webhook: "webhook";
|
|
201
|
+
agent_loop: "agent_loop";
|
|
202
|
+
task: "task";
|
|
203
|
+
}>;
|
|
204
|
+
status: z.ZodEnum<{
|
|
205
|
+
running: "running";
|
|
206
|
+
queued: "queued";
|
|
207
|
+
dispatching: "dispatching";
|
|
208
|
+
completed: "completed";
|
|
209
|
+
failed: "failed";
|
|
210
|
+
cancelled: "cancelled";
|
|
211
|
+
}>;
|
|
212
|
+
priority: z.ZodEnum<{
|
|
213
|
+
urgent: "urgent";
|
|
214
|
+
user: "user";
|
|
215
|
+
background: "background";
|
|
216
|
+
}>;
|
|
217
|
+
dedupeKey: z.ZodString;
|
|
218
|
+
attempt: z.ZodNumber;
|
|
219
|
+
maxAttempts: z.ZodNumber;
|
|
220
|
+
createdAt: z.ZodNumber;
|
|
221
|
+
updatedAt: z.ZodNumber;
|
|
222
|
+
dispatchedAt: z.ZodOptional<z.ZodNumber>;
|
|
223
|
+
completedAt: z.ZodOptional<z.ZodNumber>;
|
|
224
|
+
nextRunAt: z.ZodOptional<z.ZodNumber>;
|
|
225
|
+
sessionId: z.ZodOptional<z.ZodString>;
|
|
226
|
+
label: z.ZodOptional<z.ZodString>;
|
|
227
|
+
projectId: z.ZodOptional<z.ZodString>;
|
|
228
|
+
runId: z.ZodOptional<z.ZodString>;
|
|
229
|
+
loopId: z.ZodOptional<z.ZodString>;
|
|
230
|
+
loopIteration: z.ZodOptional<z.ZodNumber>;
|
|
231
|
+
continuityKey: z.ZodOptional<z.ZodString>;
|
|
232
|
+
errorMessage: z.ZodOptional<z.ZodString>;
|
|
233
|
+
recovered: z.ZodOptional<z.ZodBoolean>;
|
|
234
|
+
}, z.core.$strip>>;
|
|
235
|
+
guardians: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
236
|
+
key: z.ZodString;
|
|
237
|
+
projectId: z.ZodString;
|
|
238
|
+
loopId: z.ZodOptional<z.ZodString>;
|
|
239
|
+
sessionId: z.ZodString;
|
|
240
|
+
updatedAt: z.ZodNumber;
|
|
241
|
+
lastRunId: z.ZodOptional<z.ZodString>;
|
|
242
|
+
attached: z.ZodOptional<z.ZodBoolean>;
|
|
243
|
+
recovered: z.ZodOptional<z.ZodBoolean>;
|
|
244
|
+
}, z.core.$strip>>>;
|
|
245
|
+
guardianUsage: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
246
|
+
key: z.ZodString;
|
|
247
|
+
projectId: z.ZodOptional<z.ZodString>;
|
|
248
|
+
loopId: z.ZodOptional<z.ZodString>;
|
|
249
|
+
reuseCount: z.ZodNumber;
|
|
250
|
+
rememberCount: z.ZodNumber;
|
|
251
|
+
resetCount: z.ZodNumber;
|
|
252
|
+
lastUsedAt: z.ZodNumber;
|
|
253
|
+
currentSessionId: z.ZodOptional<z.ZodString>;
|
|
254
|
+
}, z.core.$strip>>>;
|
|
255
|
+
auditStats: z.ZodOptional<z.ZodObject<{
|
|
256
|
+
totalEvents: z.ZodNumber;
|
|
257
|
+
lastEventAt: z.ZodOptional<z.ZodNumber>;
|
|
258
|
+
queuedCount: z.ZodNumber;
|
|
259
|
+
sessionStartedCount: z.ZodNumber;
|
|
260
|
+
terminalCompletedCount: z.ZodNumber;
|
|
261
|
+
terminalFailedCount: z.ZodNumber;
|
|
262
|
+
terminalCancelledCount: z.ZodNumber;
|
|
263
|
+
guardianReuseCount: z.ZodNumber;
|
|
264
|
+
guardianRememberCount: z.ZodNumber;
|
|
265
|
+
guardianResetCount: z.ZodNumber;
|
|
266
|
+
sessionReattachedCount: z.ZodNumber;
|
|
267
|
+
watchdogStopCount: z.ZodNumber;
|
|
268
|
+
stopRequestCount: z.ZodNumber;
|
|
269
|
+
guardianEligibleRunCount: z.ZodNumber;
|
|
270
|
+
guardianReuseRate: z.ZodNumber;
|
|
271
|
+
activeGuardianCount: z.ZodNumber;
|
|
272
|
+
}, z.core.$strip>>;
|
|
273
|
+
recentAuditEvents: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
274
|
+
id: z.ZodString;
|
|
275
|
+
occurredAt: z.ZodNumber;
|
|
276
|
+
kind: z.ZodString;
|
|
277
|
+
jobId: z.ZodOptional<z.ZodString>;
|
|
278
|
+
dedupeKey: z.ZodOptional<z.ZodString>;
|
|
279
|
+
sessionId: z.ZodOptional<z.ZodString>;
|
|
280
|
+
projectId: z.ZodOptional<z.ZodString>;
|
|
281
|
+
runId: z.ZodOptional<z.ZodString>;
|
|
282
|
+
loopId: z.ZodOptional<z.ZodString>;
|
|
283
|
+
trigger: z.ZodOptional<z.ZodString>;
|
|
284
|
+
status: z.ZodOptional<z.ZodString>;
|
|
285
|
+
guardianKey: z.ZodOptional<z.ZodString>;
|
|
286
|
+
guardianSessionId: z.ZodOptional<z.ZodString>;
|
|
287
|
+
message: z.ZodOptional<z.ZodString>;
|
|
288
|
+
}, z.core.$strip>>>;
|
|
289
|
+
loops: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
290
|
+
id: z.ZodString;
|
|
291
|
+
name: z.ZodOptional<z.ZodString>;
|
|
292
|
+
directory: z.ZodString;
|
|
293
|
+
enabled: z.ZodBoolean;
|
|
294
|
+
intervalMs: z.ZodNumber;
|
|
295
|
+
cronExpression: z.ZodOptional<z.ZodString>;
|
|
296
|
+
iteration: z.ZodNumber;
|
|
297
|
+
nextRunAt: z.ZodNumber;
|
|
298
|
+
runtimeState: z.ZodString;
|
|
299
|
+
phase: z.ZodString;
|
|
300
|
+
lastTriggerSource: z.ZodOptional<z.ZodString>;
|
|
301
|
+
lastBriefSummary: z.ZodOptional<z.ZodString>;
|
|
302
|
+
lastError: z.ZodOptional<z.ZodString>;
|
|
303
|
+
agent: z.ZodString;
|
|
304
|
+
}, z.core.$strip>>>;
|
|
305
|
+
bootstrapProfiles: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
306
|
+
id: z.ZodString;
|
|
307
|
+
name: z.ZodOptional<z.ZodString>;
|
|
308
|
+
rootDirectory: z.ZodString;
|
|
309
|
+
intervalMs: z.ZodNumber;
|
|
310
|
+
enabled: z.ZodBoolean;
|
|
311
|
+
status: z.ZodString;
|
|
312
|
+
statusUpdatedAt: z.ZodNumber;
|
|
313
|
+
lastRunAt: z.ZodOptional<z.ZodNumber>;
|
|
314
|
+
lastRepoCount: z.ZodOptional<z.ZodNumber>;
|
|
315
|
+
lastSuggestionCount: z.ZodOptional<z.ZodNumber>;
|
|
316
|
+
lastError: z.ZodOptional<z.ZodString>;
|
|
317
|
+
}, z.core.$strip>>>;
|
|
318
|
+
autoDreamProfiles: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
319
|
+
id: z.ZodString;
|
|
320
|
+
name: z.ZodOptional<z.ZodString>;
|
|
321
|
+
rootDirectory: z.ZodString;
|
|
322
|
+
intervalMs: z.ZodNumber;
|
|
323
|
+
enabled: z.ZodBoolean;
|
|
324
|
+
nextRunAt: z.ZodNumber;
|
|
325
|
+
status: z.ZodString;
|
|
326
|
+
stage: z.ZodString;
|
|
327
|
+
statusUpdatedAt: z.ZodNumber;
|
|
328
|
+
lastRunAt: z.ZodOptional<z.ZodNumber>;
|
|
329
|
+
lastMemoryFiles: z.ZodOptional<z.ZodNumber>;
|
|
330
|
+
lastError: z.ZodOptional<z.ZodString>;
|
|
331
|
+
}, z.core.$strip>>>;
|
|
332
|
+
}, z.core.$strip>>;
|
|
333
|
+
recentBriefs: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
334
|
+
loopId: z.ZodString;
|
|
335
|
+
loopName: z.ZodOptional<z.ZodString>;
|
|
336
|
+
status: z.ZodEnum<{
|
|
337
|
+
completed: "completed";
|
|
338
|
+
failed: "failed";
|
|
339
|
+
cancelled: "cancelled";
|
|
340
|
+
}>;
|
|
341
|
+
summary: z.ZodString;
|
|
342
|
+
detail: z.ZodString;
|
|
343
|
+
generatedAt: z.ZodNumber;
|
|
344
|
+
sessionId: z.ZodOptional<z.ZodString>;
|
|
345
|
+
}, z.core.$strip>>>;
|
|
346
|
+
cliInstall: z.ZodOptional<z.ZodObject<{
|
|
347
|
+
source: z.ZodEnum<{
|
|
348
|
+
unknown: "unknown";
|
|
349
|
+
"npm-global": "npm-global";
|
|
350
|
+
"local-source": "local-source";
|
|
351
|
+
}>;
|
|
352
|
+
canSelfUpgrade: z.ZodBoolean;
|
|
353
|
+
}, z.core.$strip>>;
|
|
354
|
+
killed: z.ZodOptional<z.ZodBoolean>;
|
|
355
|
+
}, z.core.$strip>;
|
|
356
|
+
type DaemonState = z.infer<typeof DaemonStateSchema>;
|
|
357
|
+
|
|
358
|
+
declare const ResolvedRuntimeProfileSchema: z$1.ZodObject<{
|
|
359
|
+
schemaVersion: z$1.ZodDefault<z$1.ZodLiteral<1>>;
|
|
360
|
+
profileId: z$1.ZodOptional<z$1.ZodString>;
|
|
361
|
+
profileName: z$1.ZodOptional<z$1.ZodString>;
|
|
362
|
+
source: z$1.ZodEnum<{
|
|
363
|
+
"built-in-profile": "built-in-profile";
|
|
364
|
+
"account-profile": "account-profile";
|
|
365
|
+
"local-profile": "local-profile";
|
|
366
|
+
"ad-hoc": "ad-hoc";
|
|
367
|
+
}>;
|
|
368
|
+
trust: z$1.ZodEnum<{
|
|
369
|
+
trusted: "trusted";
|
|
370
|
+
untrusted: "untrusted";
|
|
371
|
+
}>;
|
|
372
|
+
isBuiltIn: z$1.ZodOptional<z$1.ZodBoolean>;
|
|
373
|
+
compatibility: z$1.ZodOptional<z$1.ZodObject<{
|
|
374
|
+
claude: z$1.ZodDefault<z$1.ZodBoolean>;
|
|
375
|
+
codex: z$1.ZodDefault<z$1.ZodBoolean>;
|
|
376
|
+
gemini: z$1.ZodDefault<z$1.ZodBoolean>;
|
|
377
|
+
}, z$1.core.$strip>>;
|
|
378
|
+
environmentVariables: z$1.ZodDefault<z$1.ZodRecord<z$1.ZodString, z$1.ZodString>>;
|
|
379
|
+
startupBashScript: z$1.ZodOptional<z$1.ZodString>;
|
|
380
|
+
customModels: z$1.ZodOptional<z$1.ZodArray<z$1.ZodObject<{
|
|
381
|
+
id: z$1.ZodString;
|
|
382
|
+
name: z$1.ZodString;
|
|
383
|
+
description: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
|
|
384
|
+
}, z$1.core.$strip>>>;
|
|
385
|
+
modelMappings: z$1.ZodOptional<z$1.ZodRecord<z$1.ZodString, z$1.ZodString>>;
|
|
386
|
+
defaultSessionType: z$1.ZodOptional<z$1.ZodEnum<{
|
|
387
|
+
simple: "simple";
|
|
388
|
+
worktree: "worktree";
|
|
389
|
+
}>>;
|
|
390
|
+
defaultPermissionMode: z$1.ZodOptional<z$1.ZodEnum<{
|
|
391
|
+
default: "default";
|
|
392
|
+
acceptEdits: "acceptEdits";
|
|
393
|
+
bypassPermissions: "bypassPermissions";
|
|
394
|
+
plan: "plan";
|
|
395
|
+
auto: "auto";
|
|
396
|
+
"read-only": "read-only";
|
|
397
|
+
"safe-yolo": "safe-yolo";
|
|
398
|
+
yolo: "yolo";
|
|
399
|
+
}>>;
|
|
400
|
+
defaultModelMode: z$1.ZodOptional<z$1.ZodString>;
|
|
401
|
+
}, z$1.core.$strip>;
|
|
402
|
+
type ResolvedRuntimeProfile = z$1.infer<typeof ResolvedRuntimeProfileSchema>;
|
|
403
|
+
|
|
31
404
|
type EncryptionVariant = "legacy" | "dataKey";
|
|
32
405
|
type SessionEncryption = {
|
|
33
406
|
readonly key: Uint8Array;
|
|
@@ -54,6 +427,7 @@ type DecryptedSession = {
|
|
|
54
427
|
active: boolean;
|
|
55
428
|
activeAt: number;
|
|
56
429
|
metadata: unknown;
|
|
430
|
+
metadataVersion: number;
|
|
57
431
|
agentState: unknown | null;
|
|
58
432
|
dataEncryptionKey: string | null;
|
|
59
433
|
encryption: SessionEncryption;
|
|
@@ -229,6 +603,8 @@ type SessionClientOptions = {
|
|
|
229
603
|
readonly encryptionVariant: EncryptionVariant;
|
|
230
604
|
readonly token: string;
|
|
231
605
|
readonly serverUrl: string;
|
|
606
|
+
readonly initialMetadata?: unknown | null;
|
|
607
|
+
readonly initialMetadataVersion?: number;
|
|
232
608
|
readonly initialAgentState?: unknown | null;
|
|
233
609
|
/** Working directory for RPC handlers (bash cwd, file operations). Defaults to process.cwd(). */
|
|
234
610
|
readonly workingDirectory?: string;
|
|
@@ -250,13 +626,16 @@ declare class SessionClient extends EventEmitter {
|
|
|
250
626
|
constructor(opts: SessionClientOptions);
|
|
251
627
|
sendMessage(text: string, meta?: Record<string, unknown>): void;
|
|
252
628
|
getMetadata(): unknown | null;
|
|
629
|
+
getMetadataVersion(): number;
|
|
253
630
|
getAgentState(): unknown | null;
|
|
254
631
|
setThinking(thinking: boolean): void;
|
|
255
632
|
waitForConnect(timeoutMs?: number): Promise<void>;
|
|
256
633
|
waitForIdle(timeoutMs?: number): Promise<void>;
|
|
257
634
|
sendStop(): void;
|
|
258
635
|
close(): void;
|
|
636
|
+
private updateMetadataOnce;
|
|
259
637
|
updateMetadata(newMetadata: unknown): Promise<void>;
|
|
638
|
+
updateMetadataWith(handler: (metadata: unknown | null) => unknown): Promise<void>;
|
|
260
639
|
updateAgentState(newState: unknown | null): Promise<void>;
|
|
261
640
|
private setupSocketListeners;
|
|
262
641
|
}
|
|
@@ -611,22 +990,6 @@ declare class AutomationAuditStore {
|
|
|
611
990
|
get size(): number;
|
|
612
991
|
}
|
|
613
992
|
|
|
614
|
-
/**
|
|
615
|
-
* Machine WebSocket client — trimmed from CLI's ApiMachineClient.
|
|
616
|
-
*
|
|
617
|
-
* Core capabilities retained:
|
|
618
|
-
* - Machine-scoped Socket.IO connection
|
|
619
|
-
* - RPC handler registration (via RpcHandlerManager)
|
|
620
|
-
* - keepAlive heartbeat
|
|
621
|
-
* - updateMetadata / updateDaemonState with OCC backoff
|
|
622
|
-
* - Ephemeral event handling (webhook/supervisor triggers)
|
|
623
|
-
*
|
|
624
|
-
* Removed (CLI-only):
|
|
625
|
-
* - Webhook/supervisor status emit + pending queues
|
|
626
|
-
* - Fix kill handler
|
|
627
|
-
* - CLI-specific logging (debugLargeJson)
|
|
628
|
-
*/
|
|
629
|
-
|
|
630
993
|
/** Strongly-typed ephemeral event from server. */
|
|
631
994
|
type EphemeralEvent = {
|
|
632
995
|
type: "activity";
|
|
@@ -669,6 +1032,10 @@ type EphemeralEvent = {
|
|
|
669
1032
|
name: string;
|
|
670
1033
|
content: string;
|
|
671
1034
|
}>;
|
|
1035
|
+
agentType?: string | null;
|
|
1036
|
+
modelOverride?: string | null;
|
|
1037
|
+
profileId?: string;
|
|
1038
|
+
runtimeProfile?: ResolvedRuntimeProfile;
|
|
672
1039
|
};
|
|
673
1040
|
type MachineClientOptions = {
|
|
674
1041
|
readonly token: string;
|