@opengeni/sdk 0.9.0 → 0.13.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/LICENSE +190 -0
- package/README.md +18 -1
- package/dist/index.d.ts +748 -87
- package/dist/index.js +774 -179
- package/dist/index.js.map +1 -1
- package/package.json +10 -16
- package/src/client.ts +1273 -336
- package/src/errors.ts +7 -1
- package/src/index.ts +76 -4
- package/src/proxy.ts +1 -1
- package/src/sse.ts +11 -8
- package/src/stream.ts +6 -2
- package/src/types.ts +1012 -98
package/dist/index.js
CHANGED
|
@@ -105,7 +105,8 @@ async function* streamSessionEvents(transport, options = {}) {
|
|
|
105
105
|
let failedAttempts = 0;
|
|
106
106
|
let delayMs = baseDelayMs;
|
|
107
107
|
let everConnected = false;
|
|
108
|
-
while (
|
|
108
|
+
while (true) {
|
|
109
|
+
if (signal?.aborted) break;
|
|
109
110
|
options.onStateChange?.(everConnected || failedAttempts > 0 ? "reconnecting" : "connecting");
|
|
110
111
|
const cursorAtOpen = cursor;
|
|
111
112
|
try {
|
|
@@ -219,23 +220,89 @@ var OpenGeniClient = class {
|
|
|
219
220
|
}
|
|
220
221
|
// --- Session lifecycle ---------------------------------------------------
|
|
221
222
|
async createSession(workspaceId, request) {
|
|
222
|
-
return await this.requestJson(
|
|
223
|
+
return await this.requestJson(
|
|
224
|
+
"POST",
|
|
225
|
+
`/v1/workspaces/${workspaceId}/sessions`,
|
|
226
|
+
request
|
|
227
|
+
);
|
|
223
228
|
}
|
|
224
229
|
async getSession(workspaceId, sessionId) {
|
|
225
|
-
return await this.requestJson(
|
|
230
|
+
return await this.requestJson(
|
|
231
|
+
"GET",
|
|
232
|
+
`/v1/workspaces/${workspaceId}/sessions/${sessionId}`
|
|
233
|
+
);
|
|
226
234
|
}
|
|
227
235
|
async updateSession(workspaceId, sessionId, request) {
|
|
228
|
-
return await this.requestJson(
|
|
236
|
+
return await this.requestJson(
|
|
237
|
+
"PATCH",
|
|
238
|
+
`/v1/workspaces/${workspaceId}/sessions/${sessionId}`,
|
|
239
|
+
request
|
|
240
|
+
);
|
|
229
241
|
}
|
|
230
242
|
async listSessions(workspaceId, options = {}) {
|
|
231
|
-
return await this.requestJson(
|
|
232
|
-
|
|
233
|
-
|
|
243
|
+
return await this.requestJson(
|
|
244
|
+
"GET",
|
|
245
|
+
`/v1/workspaces/${workspaceId}/sessions`,
|
|
246
|
+
void 0,
|
|
247
|
+
{
|
|
248
|
+
...options.limit !== void 0 ? { limit: String(options.limit) } : {},
|
|
249
|
+
...options.search?.trim() ? { search: options.search.trim() } : {},
|
|
250
|
+
...Object.prototype.hasOwnProperty.call(options, "parentSessionId") && options.parentSessionId !== void 0 ? {
|
|
251
|
+
parentSessionId: options.parentSessionId === null ? "null" : String(options.parentSessionId)
|
|
252
|
+
} : {}
|
|
253
|
+
}
|
|
254
|
+
);
|
|
255
|
+
}
|
|
256
|
+
/** Pin-aware ordinary-session page with a stable keyset cursor. */
|
|
257
|
+
async listSessionPage(workspaceId, options = {}) {
|
|
258
|
+
const response = await this.requestJson(
|
|
259
|
+
"GET",
|
|
260
|
+
`/v1/workspaces/${workspaceId}/sessions`,
|
|
261
|
+
void 0,
|
|
262
|
+
{
|
|
263
|
+
view: "page",
|
|
264
|
+
...options.limit !== void 0 ? { limit: String(options.limit) } : {},
|
|
265
|
+
...options.cursor !== void 0 ? { cursor: options.cursor } : {},
|
|
266
|
+
...options.search?.trim() ? { search: options.search.trim() } : {},
|
|
267
|
+
...Object.prototype.hasOwnProperty.call(options, "parentSessionId") && options.parentSessionId !== void 0 ? {
|
|
268
|
+
parentSessionId: options.parentSessionId === null ? "null" : String(options.parentSessionId)
|
|
269
|
+
} : {}
|
|
270
|
+
}
|
|
271
|
+
);
|
|
272
|
+
if (Array.isArray(response)) {
|
|
273
|
+
if (options.cursor) {
|
|
274
|
+
throw new Error("The connected OpenGeni API does not support stable session-page cursors");
|
|
275
|
+
}
|
|
276
|
+
if (options.search?.trim()) {
|
|
277
|
+
throw new Error("The connected OpenGeni API does not support session search");
|
|
278
|
+
}
|
|
279
|
+
return { pinned: [], sessions: response, nextCursor: null };
|
|
280
|
+
}
|
|
281
|
+
return response;
|
|
282
|
+
}
|
|
283
|
+
/** Set this authenticated member's personal workspace pin for a session. */
|
|
284
|
+
async updateSessionPin(workspaceId, sessionId, request) {
|
|
285
|
+
return await this.requestJson(
|
|
286
|
+
"PUT",
|
|
287
|
+
`/v1/workspaces/${workspaceId}/sessions/${sessionId}/pin`,
|
|
288
|
+
request
|
|
289
|
+
);
|
|
290
|
+
}
|
|
291
|
+
async getSessionLineage(workspaceId, sessionId) {
|
|
292
|
+
return await this.requestJson(
|
|
293
|
+
"GET",
|
|
294
|
+
`/v1/workspaces/${workspaceId}/sessions/${sessionId}/lineage`
|
|
295
|
+
);
|
|
234
296
|
}
|
|
235
297
|
async listTurns(workspaceId, sessionId, options = {}) {
|
|
236
|
-
return await this.requestJson(
|
|
237
|
-
|
|
238
|
-
|
|
298
|
+
return await this.requestJson(
|
|
299
|
+
"GET",
|
|
300
|
+
`/v1/workspaces/${workspaceId}/sessions/${sessionId}/turns`,
|
|
301
|
+
void 0,
|
|
302
|
+
{
|
|
303
|
+
...options.limit !== void 0 ? { limit: String(options.limit) } : {}
|
|
304
|
+
}
|
|
305
|
+
);
|
|
239
306
|
}
|
|
240
307
|
// --- Bring-your-own-compute: Machines dashboard + metrics (M10) ------------
|
|
241
308
|
/**
|
|
@@ -245,9 +312,14 @@ var OpenGeniClient = class {
|
|
|
245
312
|
* session's synthetic Modal group box + the active-sandbox pointer.
|
|
246
313
|
*/
|
|
247
314
|
async listMachines(workspaceId, options = {}) {
|
|
248
|
-
return await this.requestJson(
|
|
249
|
-
|
|
250
|
-
|
|
315
|
+
return await this.requestJson(
|
|
316
|
+
"GET",
|
|
317
|
+
`/v1/workspaces/${workspaceId}/machines`,
|
|
318
|
+
void 0,
|
|
319
|
+
{
|
|
320
|
+
...options.sessionId !== void 0 ? { sessionId: options.sessionId } : {}
|
|
321
|
+
}
|
|
322
|
+
);
|
|
251
323
|
}
|
|
252
324
|
/**
|
|
253
325
|
* Read the downsampled (~1/min) metrics series for ONE machine over a time
|
|
@@ -273,7 +345,11 @@ var OpenGeniClient = class {
|
|
|
273
345
|
* the request.
|
|
274
346
|
*/
|
|
275
347
|
async lookupDeviceEnrollment(userCode) {
|
|
276
|
-
return await this.requestJson(
|
|
348
|
+
return await this.requestJson(
|
|
349
|
+
"POST",
|
|
350
|
+
"/v1/enrollments/device/lookup",
|
|
351
|
+
{ userCode }
|
|
352
|
+
);
|
|
277
353
|
}
|
|
278
354
|
/**
|
|
279
355
|
* Approve a pending device-enrollment flow (the LOUD consent step). `allowScreenControl`
|
|
@@ -325,12 +401,20 @@ var OpenGeniClient = class {
|
|
|
325
401
|
}
|
|
326
402
|
// --- Scheduled tasks -------------------------------------------------------
|
|
327
403
|
async listScheduledTasks(workspaceId, options = {}) {
|
|
328
|
-
return await this.requestJson(
|
|
329
|
-
|
|
330
|
-
|
|
404
|
+
return await this.requestJson(
|
|
405
|
+
"GET",
|
|
406
|
+
`/v1/workspaces/${workspaceId}/scheduled-tasks`,
|
|
407
|
+
void 0,
|
|
408
|
+
{
|
|
409
|
+
...options.limit !== void 0 ? { limit: String(options.limit) } : {}
|
|
410
|
+
}
|
|
411
|
+
);
|
|
331
412
|
}
|
|
332
413
|
async getScheduledTask(workspaceId, taskId) {
|
|
333
|
-
return await this.requestJson(
|
|
414
|
+
return await this.requestJson(
|
|
415
|
+
"GET",
|
|
416
|
+
`/v1/workspaces/${workspaceId}/scheduled-tasks/${taskId}`
|
|
417
|
+
);
|
|
334
418
|
}
|
|
335
419
|
// --- Events: replay, send, stream ----------------------------------------
|
|
336
420
|
/**
|
|
@@ -340,16 +424,25 @@ var OpenGeniClient = class {
|
|
|
340
424
|
* for resume cursors.
|
|
341
425
|
*/
|
|
342
426
|
async listEvents(workspaceId, sessionId, options = {}) {
|
|
343
|
-
return await this.requestJson(
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
427
|
+
return await this.requestJson(
|
|
428
|
+
"GET",
|
|
429
|
+
`/v1/workspaces/${workspaceId}/sessions/${sessionId}/events`,
|
|
430
|
+
void 0,
|
|
431
|
+
{
|
|
432
|
+
...options.after !== void 0 ? { after: String(options.after) } : {},
|
|
433
|
+
...options.before !== void 0 ? { before: String(options.before) } : {},
|
|
434
|
+
...options.limit !== void 0 ? { limit: String(options.limit) } : {},
|
|
435
|
+
...options.compact ? { compact: "1" } : {}
|
|
436
|
+
}
|
|
437
|
+
);
|
|
349
438
|
}
|
|
350
439
|
/** POST a user/control event to the session. Returns the accepted event. */
|
|
351
440
|
async sendEvent(workspaceId, sessionId, event) {
|
|
352
|
-
return await this.requestJson(
|
|
441
|
+
return await this.requestJson(
|
|
442
|
+
"POST",
|
|
443
|
+
`/v1/workspaces/${workspaceId}/sessions/${sessionId}/events`,
|
|
444
|
+
event
|
|
445
|
+
);
|
|
353
446
|
}
|
|
354
447
|
async sendMessage(workspaceId, sessionId, message) {
|
|
355
448
|
const input = typeof message === "string" ? { text: message } : message;
|
|
@@ -360,12 +453,11 @@ var OpenGeniClient = class {
|
|
|
360
453
|
payload
|
|
361
454
|
});
|
|
362
455
|
}
|
|
363
|
-
async
|
|
364
|
-
return await this.
|
|
365
|
-
|
|
366
|
-
...options
|
|
367
|
-
|
|
368
|
-
});
|
|
456
|
+
async pauseSession(workspaceId, sessionId, options = {}) {
|
|
457
|
+
return (await this.controlSession(workspaceId, sessionId, {
|
|
458
|
+
mode: "pause",
|
|
459
|
+
...options
|
|
460
|
+
})).event;
|
|
369
461
|
}
|
|
370
462
|
async sendApprovalDecision(workspaceId, sessionId, decision) {
|
|
371
463
|
const { clientEventId, ...payload } = decision;
|
|
@@ -386,7 +478,10 @@ var OpenGeniClient = class {
|
|
|
386
478
|
/** The transport `streamEvents` runs on; useful for custom streaming layers. */
|
|
387
479
|
eventStreamTransport(workspaceId, sessionId) {
|
|
388
480
|
return {
|
|
389
|
-
openStream: async (after, signal) => await this.openEventStream(workspaceId, sessionId, {
|
|
481
|
+
openStream: async (after, signal) => await this.openEventStream(workspaceId, sessionId, {
|
|
482
|
+
after,
|
|
483
|
+
...signal ? { signal } : {}
|
|
484
|
+
}),
|
|
390
485
|
listEvents: async (after, limit) => await this.listEvents(workspaceId, sessionId, { after, limit })
|
|
391
486
|
};
|
|
392
487
|
}
|
|
@@ -409,23 +504,34 @@ var OpenGeniClient = class {
|
|
|
409
504
|
return response.body;
|
|
410
505
|
}
|
|
411
506
|
// --- Turn queue ------------------------------------------------------------
|
|
412
|
-
|
|
413
|
-
async updateQueuedTurn(workspaceId, sessionId, turnId, update) {
|
|
507
|
+
async getQueue(workspaceId, sessionId) {
|
|
414
508
|
return await this.requestJson(
|
|
415
|
-
"
|
|
416
|
-
`/v1/workspaces/${workspaceId}/sessions/${sessionId}/
|
|
417
|
-
update
|
|
509
|
+
"GET",
|
|
510
|
+
`/v1/workspaces/${workspaceId}/sessions/${sessionId}/queue`
|
|
418
511
|
);
|
|
419
512
|
}
|
|
420
|
-
|
|
421
|
-
* Reorder the queued turns. `turnIds` must all reference queued turns; the
|
|
422
|
-
* server assigns positions in the given order and returns the queue.
|
|
423
|
-
*/
|
|
424
|
-
async reorderQueuedTurns(workspaceId, sessionId, turnIds) {
|
|
513
|
+
async cancelQueueItem(workspaceId, sessionId, turnId, request) {
|
|
425
514
|
return await this.requestJson(
|
|
426
515
|
"POST",
|
|
427
|
-
`/v1/workspaces/${workspaceId}/sessions/${sessionId}/
|
|
428
|
-
|
|
516
|
+
`/v1/workspaces/${workspaceId}/sessions/${sessionId}/queue/${turnId}/cancel`,
|
|
517
|
+
request
|
|
518
|
+
);
|
|
519
|
+
}
|
|
520
|
+
async controlSession(workspaceId, sessionId, request) {
|
|
521
|
+
return await this.requestJson(
|
|
522
|
+
"POST",
|
|
523
|
+
`/v1/workspaces/${workspaceId}/sessions/${sessionId}/control`,
|
|
524
|
+
request
|
|
525
|
+
);
|
|
526
|
+
}
|
|
527
|
+
async resumeSession(workspaceId, sessionId, options = {}) {
|
|
528
|
+
return await this.controlSession(workspaceId, sessionId, { mode: "resume", ...options });
|
|
529
|
+
}
|
|
530
|
+
async setWorkspaceInferenceState(workspaceId, request) {
|
|
531
|
+
return await this.requestJson(
|
|
532
|
+
"POST",
|
|
533
|
+
`/v1/workspaces/${workspaceId}/inference-control`,
|
|
534
|
+
request
|
|
429
535
|
);
|
|
430
536
|
}
|
|
431
537
|
/** Cancel a queued turn before it is claimed. Returns the cancelled turn. */
|
|
@@ -436,60 +542,34 @@ var OpenGeniClient = class {
|
|
|
436
542
|
);
|
|
437
543
|
}
|
|
438
544
|
/**
|
|
439
|
-
* Steer:
|
|
440
|
-
*
|
|
441
|
-
* running turn so the session picks the steer turn up next. On a session
|
|
442
|
-
* that is not running this degrades gracefully to a plain queued message.
|
|
443
|
-
*
|
|
444
|
-
* The steer turn is located by `triggerEventId` across ALL turns (retried
|
|
445
|
-
* briefly in case the server is still materializing it) — not just the
|
|
446
|
-
* queued ones, because the worker can claim the steer turn before it is
|
|
447
|
-
* ever observed queued, and a claimed steer turn means the message is
|
|
448
|
-
* already being delivered: interrupting then would cancel the very message
|
|
449
|
-
* being steered. If the turn cannot be found while other turns are queued,
|
|
450
|
-
* the interrupt is also skipped — stopping the running turn would otherwise
|
|
451
|
-
* promote someone else's queued work over this message — and the call
|
|
452
|
-
* degrades to a plain queued send (`interrupted: false`).
|
|
545
|
+
* Steer: atomically put this prompt at the head and supersede the current
|
|
546
|
+
* inference. The client performs one request and renders server order.
|
|
453
547
|
*/
|
|
454
548
|
async steerMessage(workspaceId, sessionId, message) {
|
|
455
|
-
const
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
}
|
|
462
|
-
const turns = await this.listTurns(workspaceId, sessionId);
|
|
463
|
-
queued = turns.filter((turn) => turn.status === "queued").sort((a, b) => a.position - b.position || a.createdAt.localeCompare(b.createdAt));
|
|
464
|
-
steerTurn = turns.find((turn) => turn.triggerEventId === accepted.id) ?? null;
|
|
465
|
-
if (steerTurn) {
|
|
466
|
-
break;
|
|
467
|
-
}
|
|
468
|
-
}
|
|
469
|
-
const steerTurnQueued = steerTurn?.status === "queued";
|
|
470
|
-
if (steerTurn && steerTurnQueued && queued.length > 1) {
|
|
471
|
-
const front = steerTurn;
|
|
472
|
-
await this.reorderQueuedTurns(workspaceId, sessionId, [
|
|
473
|
-
front.id,
|
|
474
|
-
...queued.filter((turn) => turn.id !== front.id).map((turn) => turn.id)
|
|
475
|
-
]);
|
|
476
|
-
}
|
|
477
|
-
const canDeliverNext = steerTurnQueued || steerTurn === null && queued.length === 0;
|
|
478
|
-
const session = await this.getSession(workspaceId, sessionId);
|
|
479
|
-
const steerTurnAlreadyActive = steerTurn !== null && session.activeTurnId === steerTurn.id;
|
|
480
|
-
const interrupted = canDeliverNext && !steerTurnAlreadyActive && (session.status === "running" || session.status === "requires_action");
|
|
481
|
-
if (interrupted) {
|
|
482
|
-
await this.interrupt(workspaceId, sessionId, { reason: "steer" });
|
|
483
|
-
}
|
|
484
|
-
return { accepted, turn: steerTurn, interrupted };
|
|
549
|
+
const input = typeof message === "string" ? { text: message } : message;
|
|
550
|
+
return await this.requestJson(
|
|
551
|
+
"POST",
|
|
552
|
+
`/v1/workspaces/${workspaceId}/sessions/${sessionId}/steer`,
|
|
553
|
+
input
|
|
554
|
+
);
|
|
485
555
|
}
|
|
486
556
|
// --- Goals -------------------------------------------------------------------
|
|
487
557
|
/** The session's goal. 404s when the session never had one. */
|
|
488
558
|
async getGoal(workspaceId, sessionId) {
|
|
489
|
-
return await this.requestJson(
|
|
559
|
+
return await this.requestJson(
|
|
560
|
+
"GET",
|
|
561
|
+
`/v1/workspaces/${workspaceId}/sessions/${sessionId}/goal`
|
|
562
|
+
);
|
|
490
563
|
}
|
|
491
564
|
async updateGoal(workspaceId, sessionId, request) {
|
|
492
|
-
return await this.requestJson(
|
|
565
|
+
return await this.requestJson(
|
|
566
|
+
"PATCH",
|
|
567
|
+
`/v1/workspaces/${workspaceId}/sessions/${sessionId}/goal`,
|
|
568
|
+
request
|
|
569
|
+
);
|
|
570
|
+
}
|
|
571
|
+
async deleteGoal(workspaceId, sessionId) {
|
|
572
|
+
await this.requestVoid("DELETE", `/v1/workspaces/${workspaceId}/sessions/${sessionId}/goal`);
|
|
493
573
|
}
|
|
494
574
|
/** Pause the goal loop: the session stops self-continuing until resumed. */
|
|
495
575
|
async pauseGoal(workspaceId, sessionId, options = {}) {
|
|
@@ -511,16 +591,19 @@ var OpenGeniClient = class {
|
|
|
511
591
|
* context — the destructive intent is explicit on the wire.
|
|
512
592
|
*/
|
|
513
593
|
async clearSessionContext(workspaceId, sessionId) {
|
|
514
|
-
await this.requestVoid(
|
|
594
|
+
await this.requestVoid(
|
|
595
|
+
"POST",
|
|
596
|
+
`/v1/workspaces/${workspaceId}/sessions/${sessionId}/context/clear`,
|
|
597
|
+
{ confirm: true }
|
|
598
|
+
);
|
|
515
599
|
}
|
|
516
|
-
/**
|
|
517
|
-
* Trigger conversation compaction now. On the client-managed (Azure) path this
|
|
518
|
-
* queues a forced compaction the worker honors before the next turn
|
|
519
|
-
* (`status:"queued"`); on a server-managed provider or when compaction is off
|
|
520
|
-
* it is a no-op (`status:"noop"`) with an explanatory message.
|
|
521
|
-
*/
|
|
600
|
+
/** Request one durable portable compaction at the next safe model boundary. */
|
|
522
601
|
async compactSessionContext(workspaceId, sessionId) {
|
|
523
|
-
return await this.requestJson(
|
|
602
|
+
return await this.requestJson(
|
|
603
|
+
"POST",
|
|
604
|
+
`/v1/workspaces/${workspaceId}/sessions/${sessionId}/context/compact`,
|
|
605
|
+
{}
|
|
606
|
+
);
|
|
524
607
|
}
|
|
525
608
|
// --- Channel-A structured services (P4.4) ------------------------------------
|
|
526
609
|
// FileSystem (Pierre tree), Git (Pierre diff), Terminal (exec + PTY). Each is a
|
|
@@ -528,64 +611,147 @@ var OpenGeniClient = class {
|
|
|
528
611
|
// notifications + the PTY output stream arrive on the existing event SSE.
|
|
529
612
|
/** FileSystem: list a directory tree (feeds the Pierre file tree). */
|
|
530
613
|
async fsList(workspaceId, sessionId, request = {}) {
|
|
531
|
-
return await this.requestJson(
|
|
614
|
+
return await this.requestJson(
|
|
615
|
+
"POST",
|
|
616
|
+
`/v1/workspaces/${workspaceId}/sessions/${sessionId}/fs/list`,
|
|
617
|
+
request
|
|
618
|
+
);
|
|
532
619
|
}
|
|
533
620
|
/** FileSystem: read a file (text or base64; binary-safe, size-capped). */
|
|
534
621
|
async fsRead(workspaceId, sessionId, request) {
|
|
535
|
-
return await this.requestJson(
|
|
622
|
+
return await this.requestJson(
|
|
623
|
+
"POST",
|
|
624
|
+
`/v1/workspaces/${workspaceId}/sessions/${sessionId}/fs/read`,
|
|
625
|
+
request
|
|
626
|
+
);
|
|
536
627
|
}
|
|
537
628
|
/** FileSystem: write a file (last-writer-wins; emits fs.changed). */
|
|
538
629
|
async fsWrite(workspaceId, sessionId, request) {
|
|
539
|
-
return await this.requestJson(
|
|
630
|
+
return await this.requestJson(
|
|
631
|
+
"POST",
|
|
632
|
+
`/v1/workspaces/${workspaceId}/sessions/${sessionId}/fs/write`,
|
|
633
|
+
request
|
|
634
|
+
);
|
|
540
635
|
}
|
|
541
636
|
/** FileSystem: delete a path (emits fs.changed). */
|
|
542
637
|
async fsDelete(workspaceId, sessionId, request) {
|
|
543
|
-
return await this.requestJson(
|
|
638
|
+
return await this.requestJson(
|
|
639
|
+
"POST",
|
|
640
|
+
`/v1/workspaces/${workspaceId}/sessions/${sessionId}/fs/delete`,
|
|
641
|
+
request
|
|
642
|
+
);
|
|
544
643
|
}
|
|
545
644
|
/** FileSystem: move/rename a path (emits fs.changed; 409 if destination exists and overwrite is false). */
|
|
546
645
|
async fsMove(workspaceId, sessionId, request) {
|
|
547
|
-
return await this.requestJson(
|
|
646
|
+
return await this.requestJson(
|
|
647
|
+
"POST",
|
|
648
|
+
`/v1/workspaces/${workspaceId}/sessions/${sessionId}/fs/move`,
|
|
649
|
+
request
|
|
650
|
+
);
|
|
548
651
|
}
|
|
549
652
|
/** FileSystem: create a directory (emits fs.changed; recursive defaults to true). */
|
|
550
653
|
async fsMkdir(workspaceId, sessionId, request) {
|
|
551
|
-
return await this.requestJson(
|
|
654
|
+
return await this.requestJson(
|
|
655
|
+
"POST",
|
|
656
|
+
`/v1/workspaces/${workspaceId}/sessions/${sessionId}/fs/mkdir`,
|
|
657
|
+
request
|
|
658
|
+
);
|
|
552
659
|
}
|
|
553
660
|
/** Git: working-tree/index status (the Pierre file-status feed). */
|
|
554
661
|
async gitStatus(workspaceId, sessionId, request = {}) {
|
|
555
|
-
return await this.requestJson(
|
|
662
|
+
return await this.requestJson(
|
|
663
|
+
"POST",
|
|
664
|
+
`/v1/workspaces/${workspaceId}/sessions/${sessionId}/git/status`,
|
|
665
|
+
request
|
|
666
|
+
);
|
|
556
667
|
}
|
|
557
668
|
/** Git: structured diff hunks (the Pierre diff feed). */
|
|
558
669
|
async gitDiff(workspaceId, sessionId, request = {}) {
|
|
559
|
-
return await this.requestJson(
|
|
670
|
+
return await this.requestJson(
|
|
671
|
+
"POST",
|
|
672
|
+
`/v1/workspaces/${workspaceId}/sessions/${sessionId}/git/diff`,
|
|
673
|
+
request
|
|
674
|
+
);
|
|
560
675
|
}
|
|
561
676
|
/** Git: commit log. */
|
|
562
677
|
async gitLog(workspaceId, sessionId, request = {}) {
|
|
563
|
-
return await this.requestJson(
|
|
678
|
+
return await this.requestJson(
|
|
679
|
+
"POST",
|
|
680
|
+
`/v1/workspaces/${workspaceId}/sessions/${sessionId}/git/log`,
|
|
681
|
+
request
|
|
682
|
+
);
|
|
564
683
|
}
|
|
565
684
|
/** Git: show a commit (diff vs first parent) or fetch a raw blob at a ref. */
|
|
566
685
|
async gitShow(workspaceId, sessionId, request) {
|
|
567
|
-
return await this.requestJson(
|
|
686
|
+
return await this.requestJson(
|
|
687
|
+
"POST",
|
|
688
|
+
`/v1/workspaces/${workspaceId}/sessions/${sessionId}/git/show`,
|
|
689
|
+
request
|
|
690
|
+
);
|
|
691
|
+
}
|
|
692
|
+
/** Workspace capture: the latest turn-end snapshot of the session's workspace
|
|
693
|
+
* (tree + per-repo diff + file after-image refs), served from durable storage
|
|
694
|
+
* WITHOUT warming a machine — the workbench cold-paint source. Returns
|
|
695
|
+
* `{available:false}` when no capture exists yet (fall back to the live path). */
|
|
696
|
+
async getWorkspaceCapture(workspaceId, sessionId) {
|
|
697
|
+
return await this.requestJson(
|
|
698
|
+
"GET",
|
|
699
|
+
`/v1/workspaces/${workspaceId}/sessions/${sessionId}/workspace/capture`
|
|
700
|
+
);
|
|
701
|
+
}
|
|
702
|
+
/** Workspace capture: a single file's after-image from the capture (revision
|
|
703
|
+
* pins a specific one; omitted → latest). Content is inline for small files,
|
|
704
|
+
* else a short-TTL signed URL; a tooLarge file returns metadata only. */
|
|
705
|
+
async getWorkspaceCaptureFile(workspaceId, sessionId, path, revision) {
|
|
706
|
+
const query = { path };
|
|
707
|
+
if (revision !== void 0) query.revision = String(revision);
|
|
708
|
+
return await this.requestJson(
|
|
709
|
+
"GET",
|
|
710
|
+
`/v1/workspaces/${workspaceId}/sessions/${sessionId}/workspace/capture/file`,
|
|
711
|
+
void 0,
|
|
712
|
+
query
|
|
713
|
+
);
|
|
568
714
|
}
|
|
569
715
|
/** Terminal: run a bounded command, returning buffered stdout/stderr inline. */
|
|
570
716
|
async terminalExec(workspaceId, sessionId, request) {
|
|
571
|
-
return await this.requestJson(
|
|
717
|
+
return await this.requestJson(
|
|
718
|
+
"POST",
|
|
719
|
+
`/v1/workspaces/${workspaceId}/sessions/${sessionId}/terminal/exec`,
|
|
720
|
+
request
|
|
721
|
+
);
|
|
572
722
|
}
|
|
573
723
|
/** Terminal: open an interactive PTY. Output streams on the event SSE as
|
|
574
724
|
* terminal.pty.output.delta; drive it with terminalPtyWrite. */
|
|
575
725
|
async terminalPtyOpen(workspaceId, sessionId, request = {}) {
|
|
576
|
-
return await this.requestJson(
|
|
726
|
+
return await this.requestJson(
|
|
727
|
+
"POST",
|
|
728
|
+
`/v1/workspaces/${workspaceId}/sessions/${sessionId}/terminal/pty`,
|
|
729
|
+
request
|
|
730
|
+
);
|
|
577
731
|
}
|
|
578
732
|
/** Terminal: send stdin to an open PTY (output rides A1). */
|
|
579
733
|
async terminalPtyWrite(workspaceId, sessionId, request) {
|
|
580
|
-
await this.requestVoid(
|
|
734
|
+
await this.requestVoid(
|
|
735
|
+
"POST",
|
|
736
|
+
`/v1/workspaces/${workspaceId}/sessions/${sessionId}/terminal/pty/write`,
|
|
737
|
+
request
|
|
738
|
+
);
|
|
581
739
|
}
|
|
582
740
|
/** Terminal: resize an open PTY. */
|
|
583
741
|
async terminalPtyResize(workspaceId, sessionId, request) {
|
|
584
|
-
await this.requestVoid(
|
|
742
|
+
await this.requestVoid(
|
|
743
|
+
"POST",
|
|
744
|
+
`/v1/workspaces/${workspaceId}/sessions/${sessionId}/terminal/pty/resize`,
|
|
745
|
+
request
|
|
746
|
+
);
|
|
585
747
|
}
|
|
586
748
|
/** Terminal: close an open PTY (idempotent). */
|
|
587
749
|
async terminalPtyClose(workspaceId, sessionId, request) {
|
|
588
|
-
await this.requestVoid(
|
|
750
|
+
await this.requestVoid(
|
|
751
|
+
"POST",
|
|
752
|
+
`/v1/workspaces/${workspaceId}/sessions/${sessionId}/terminal/pty/close`,
|
|
753
|
+
request
|
|
754
|
+
);
|
|
589
755
|
}
|
|
590
756
|
// --- Stream surfacing: capability negotiation + viewer lifecycle (Phase 5) ---
|
|
591
757
|
// The capability doc is the single source of UI truth (degradation is always a
|
|
@@ -641,7 +807,10 @@ var OpenGeniClient = class {
|
|
|
641
807
|
}
|
|
642
808
|
/** Detach a viewer (delete this holder; idempotent delete-my-row). */
|
|
643
809
|
async detachViewer(workspaceId, sessionId, viewerId) {
|
|
644
|
-
await this.requestVoid(
|
|
810
|
+
await this.requestVoid(
|
|
811
|
+
"DELETE",
|
|
812
|
+
`/v1/workspaces/${workspaceId}/sessions/${sessionId}/viewers/${viewerId}`
|
|
813
|
+
);
|
|
645
814
|
}
|
|
646
815
|
// --- Access + workspaces -----------------------------------------------------
|
|
647
816
|
/**
|
|
@@ -680,7 +849,10 @@ var OpenGeniClient = class {
|
|
|
680
849
|
// --- Members ("People with access") -------------------------------------------
|
|
681
850
|
/** The workspace's members (user + api_key subjects). */
|
|
682
851
|
async listWorkspaceMembers(workspaceId) {
|
|
683
|
-
const response = await this.requestJson(
|
|
852
|
+
const response = await this.requestJson(
|
|
853
|
+
"GET",
|
|
854
|
+
`/v1/workspaces/${workspaceId}/members`
|
|
855
|
+
);
|
|
684
856
|
return response.members;
|
|
685
857
|
}
|
|
686
858
|
/**
|
|
@@ -688,7 +860,11 @@ var OpenGeniClient = class {
|
|
|
688
860
|
* exists (email invites for unknown users are deferred).
|
|
689
861
|
*/
|
|
690
862
|
async addWorkspaceMember(workspaceId, request) {
|
|
691
|
-
return await this.requestJson(
|
|
863
|
+
return await this.requestJson(
|
|
864
|
+
"POST",
|
|
865
|
+
`/v1/workspaces/${workspaceId}/members`,
|
|
866
|
+
request
|
|
867
|
+
);
|
|
692
868
|
}
|
|
693
869
|
async updateWorkspaceMember(workspaceId, subjectId, request) {
|
|
694
870
|
return await this.requestJson(
|
|
@@ -702,20 +878,37 @@ var OpenGeniClient = class {
|
|
|
702
878
|
* member who can still manage the workspace.
|
|
703
879
|
*/
|
|
704
880
|
async removeWorkspaceMember(workspaceId, subjectId) {
|
|
705
|
-
await this.requestVoid(
|
|
881
|
+
await this.requestVoid(
|
|
882
|
+
"DELETE",
|
|
883
|
+
`/v1/workspaces/${workspaceId}/members/${encodeURIComponent(subjectId)}`
|
|
884
|
+
);
|
|
706
885
|
}
|
|
707
886
|
// --- Scheduled tasks (write + runs) -------------------------------------------
|
|
708
887
|
async createScheduledTask(workspaceId, request) {
|
|
709
|
-
return await this.requestJson(
|
|
888
|
+
return await this.requestJson(
|
|
889
|
+
"POST",
|
|
890
|
+
`/v1/workspaces/${workspaceId}/scheduled-tasks`,
|
|
891
|
+
request
|
|
892
|
+
);
|
|
710
893
|
}
|
|
711
894
|
async updateScheduledTask(workspaceId, taskId, request) {
|
|
712
|
-
return await this.requestJson(
|
|
895
|
+
return await this.requestJson(
|
|
896
|
+
"PATCH",
|
|
897
|
+
`/v1/workspaces/${workspaceId}/scheduled-tasks/${taskId}`,
|
|
898
|
+
request
|
|
899
|
+
);
|
|
713
900
|
}
|
|
714
901
|
async pauseScheduledTask(workspaceId, taskId) {
|
|
715
|
-
return await this.requestJson(
|
|
902
|
+
return await this.requestJson(
|
|
903
|
+
"POST",
|
|
904
|
+
`/v1/workspaces/${workspaceId}/scheduled-tasks/${taskId}/pause`
|
|
905
|
+
);
|
|
716
906
|
}
|
|
717
907
|
async resumeScheduledTask(workspaceId, taskId) {
|
|
718
|
-
return await this.requestJson(
|
|
908
|
+
return await this.requestJson(
|
|
909
|
+
"POST",
|
|
910
|
+
`/v1/workspaces/${workspaceId}/scheduled-tasks/${taskId}/resume`
|
|
911
|
+
);
|
|
719
912
|
}
|
|
720
913
|
/**
|
|
721
914
|
* Fire the task immediately (manual trigger), independent of its schedule.
|
|
@@ -730,7 +923,10 @@ var OpenGeniClient = class {
|
|
|
730
923
|
);
|
|
731
924
|
}
|
|
732
925
|
async deleteScheduledTask(workspaceId, taskId) {
|
|
733
|
-
await this.requestJson(
|
|
926
|
+
await this.requestJson(
|
|
927
|
+
"DELETE",
|
|
928
|
+
`/v1/workspaces/${workspaceId}/scheduled-tasks/${taskId}`
|
|
929
|
+
);
|
|
734
930
|
}
|
|
735
931
|
async listScheduledTaskRuns(workspaceId, taskId, options = {}) {
|
|
736
932
|
return await this.requestJson(
|
|
@@ -740,45 +936,178 @@ var OpenGeniClient = class {
|
|
|
740
936
|
{ ...options.limit !== void 0 ? { limit: String(options.limit) } : {} }
|
|
741
937
|
);
|
|
742
938
|
}
|
|
743
|
-
// ---
|
|
939
|
+
// --- VariableSets --------------------------------------------------------------
|
|
744
940
|
// Variable values are write-only: reads return name/version metadata only.
|
|
745
|
-
async
|
|
746
|
-
return await this.requestJson(
|
|
941
|
+
async listVariableSets(workspaceId) {
|
|
942
|
+
return await this.requestJson(
|
|
943
|
+
"GET",
|
|
944
|
+
`/v1/workspaces/${workspaceId}/variable-sets`
|
|
945
|
+
);
|
|
747
946
|
}
|
|
748
|
-
async
|
|
749
|
-
return await this.requestJson(
|
|
947
|
+
async createVariableSet(workspaceId, request) {
|
|
948
|
+
return await this.requestJson(
|
|
949
|
+
"POST",
|
|
950
|
+
`/v1/workspaces/${workspaceId}/variable-sets`,
|
|
951
|
+
request
|
|
952
|
+
);
|
|
750
953
|
}
|
|
751
|
-
async
|
|
752
|
-
return await this.requestJson(
|
|
954
|
+
async getVariableSet(workspaceId, variableSetId) {
|
|
955
|
+
return await this.requestJson(
|
|
956
|
+
"GET",
|
|
957
|
+
`/v1/workspaces/${workspaceId}/variable-sets/${variableSetId}`
|
|
958
|
+
);
|
|
753
959
|
}
|
|
754
|
-
async
|
|
960
|
+
async updateVariableSet(workspaceId, variableSetId, request) {
|
|
755
961
|
return await this.requestJson(
|
|
756
962
|
"PATCH",
|
|
757
|
-
`/v1/workspaces/${workspaceId}/
|
|
963
|
+
`/v1/workspaces/${workspaceId}/variable-sets/${variableSetId}`,
|
|
758
964
|
request
|
|
759
965
|
);
|
|
760
966
|
}
|
|
761
|
-
async
|
|
762
|
-
await this.requestJson(
|
|
967
|
+
async deleteVariableSet(workspaceId, variableSetId) {
|
|
968
|
+
await this.requestJson(
|
|
969
|
+
"DELETE",
|
|
970
|
+
`/v1/workspaces/${workspaceId}/variable-sets/${variableSetId}`
|
|
971
|
+
);
|
|
763
972
|
}
|
|
764
973
|
/** Create or rotate a variable. The value never comes back on any read. */
|
|
765
|
-
async
|
|
974
|
+
async setVariableSetVariable(workspaceId, variableSetId, name, value) {
|
|
766
975
|
return await this.requestJson(
|
|
767
976
|
"PUT",
|
|
768
|
-
`/v1/workspaces/${workspaceId}/
|
|
977
|
+
`/v1/workspaces/${workspaceId}/variable-sets/${variableSetId}/variables/${encodeURIComponent(name)}`,
|
|
769
978
|
{ value }
|
|
770
979
|
);
|
|
771
980
|
}
|
|
772
|
-
async
|
|
981
|
+
async deleteVariableSetVariable(workspaceId, variableSetId, name) {
|
|
773
982
|
await this.requestJson(
|
|
774
983
|
"DELETE",
|
|
775
|
-
`/v1/workspaces/${workspaceId}/
|
|
984
|
+
`/v1/workspaces/${workspaceId}/variable-sets/${variableSetId}/variables/${encodeURIComponent(name)}`
|
|
985
|
+
);
|
|
986
|
+
}
|
|
987
|
+
// --- Rigs ------------------------------------------------------------------
|
|
988
|
+
// Workspace-scoped, versioned sandbox machine definitions. rigs:use gates read
|
|
989
|
+
// + proposeRigChange; rigs:manage gates create / update / delete / activate.
|
|
990
|
+
async listRigs(workspaceId) {
|
|
991
|
+
return await this.requestJson("GET", `/v1/workspaces/${workspaceId}/rigs`);
|
|
992
|
+
}
|
|
993
|
+
async createRig(workspaceId, request) {
|
|
994
|
+
return await this.requestJson("POST", `/v1/workspaces/${workspaceId}/rigs`, request);
|
|
995
|
+
}
|
|
996
|
+
async getRig(workspaceId, rigId) {
|
|
997
|
+
return await this.requestJson("GET", `/v1/workspaces/${workspaceId}/rigs/${rigId}`);
|
|
998
|
+
}
|
|
999
|
+
async updateRig(workspaceId, rigId, request) {
|
|
1000
|
+
return await this.requestJson(
|
|
1001
|
+
"PATCH",
|
|
1002
|
+
`/v1/workspaces/${workspaceId}/rigs/${rigId}`,
|
|
1003
|
+
request
|
|
1004
|
+
);
|
|
1005
|
+
}
|
|
1006
|
+
async deleteRig(workspaceId, rigId) {
|
|
1007
|
+
await this.requestJson("DELETE", `/v1/workspaces/${workspaceId}/rigs/${rigId}`);
|
|
1008
|
+
}
|
|
1009
|
+
async listRigVersions(workspaceId, rigId) {
|
|
1010
|
+
return await this.requestJson(
|
|
1011
|
+
"GET",
|
|
1012
|
+
`/v1/workspaces/${workspaceId}/rigs/${rigId}/versions`
|
|
1013
|
+
);
|
|
1014
|
+
}
|
|
1015
|
+
/** Roll the active version to an existing one (rollback / promote-activate). */
|
|
1016
|
+
async activateRigVersion(workspaceId, rigId, versionId) {
|
|
1017
|
+
return await this.requestJson(
|
|
1018
|
+
"POST",
|
|
1019
|
+
`/v1/workspaces/${workspaceId}/rigs/${rigId}/versions/${versionId}/activate`
|
|
776
1020
|
);
|
|
777
1021
|
}
|
|
1022
|
+
async listRigChanges(workspaceId, rigId) {
|
|
1023
|
+
return await this.requestJson(
|
|
1024
|
+
"GET",
|
|
1025
|
+
`/v1/workspaces/${workspaceId}/rigs/${rigId}/changes`
|
|
1026
|
+
);
|
|
1027
|
+
}
|
|
1028
|
+
/** Propose a change against the rig's active version (rigs:use). */
|
|
1029
|
+
async proposeRigChange(workspaceId, rigId, request) {
|
|
1030
|
+
return await this.requestJson(
|
|
1031
|
+
"POST",
|
|
1032
|
+
`/v1/workspaces/${workspaceId}/rigs/${rigId}/changes`,
|
|
1033
|
+
request
|
|
1034
|
+
);
|
|
1035
|
+
}
|
|
1036
|
+
async getRigChange(workspaceId, rigId, changeId) {
|
|
1037
|
+
return await this.requestJson(
|
|
1038
|
+
"GET",
|
|
1039
|
+
`/v1/workspaces/${workspaceId}/rigs/${rigId}/changes/${changeId}`
|
|
1040
|
+
);
|
|
1041
|
+
}
|
|
1042
|
+
/**
|
|
1043
|
+
* Re-run verification for a change (rigs:use). Verification is asynchronous:
|
|
1044
|
+
* this returns the change immediately with status `verifying`; poll
|
|
1045
|
+
* `getRigChange`/`listRigChanges` for the terminal outcome + logs.
|
|
1046
|
+
*/
|
|
1047
|
+
async verifyRigChange(workspaceId, rigId, changeId) {
|
|
1048
|
+
return await this.requestJson(
|
|
1049
|
+
"POST",
|
|
1050
|
+
`/v1/workspaces/${workspaceId}/rigs/${rigId}/changes/${changeId}/verify`
|
|
1051
|
+
);
|
|
1052
|
+
}
|
|
1053
|
+
/**
|
|
1054
|
+
* Promote a verified `definition_edit` change into a new active rig version
|
|
1055
|
+
* (rigs:manage). Only valid once the change's verification passed; returns the
|
|
1056
|
+
* newly minted version.
|
|
1057
|
+
*/
|
|
1058
|
+
async promoteRigChange(workspaceId, rigId, changeId) {
|
|
1059
|
+
return await this.requestJson(
|
|
1060
|
+
"POST",
|
|
1061
|
+
`/v1/workspaces/${workspaceId}/rigs/${rigId}/changes/${changeId}/promote`
|
|
1062
|
+
);
|
|
1063
|
+
}
|
|
1064
|
+
/**
|
|
1065
|
+
* Re-run the active version's checks in a clean throwaway sandbox (rigs:use).
|
|
1066
|
+
* Asynchronous — returns the version id being verified; the outcome lands on
|
|
1067
|
+
* the version's audit trail.
|
|
1068
|
+
*/
|
|
1069
|
+
async verifyRig(workspaceId, rigId) {
|
|
1070
|
+
return await this.requestJson(
|
|
1071
|
+
"POST",
|
|
1072
|
+
`/v1/workspaces/${workspaceId}/rigs/${rigId}/verify`
|
|
1073
|
+
);
|
|
1074
|
+
}
|
|
1075
|
+
/** @deprecated use listVariableSets */
|
|
1076
|
+
async listEnvironments(workspaceId) {
|
|
1077
|
+
return await this.listVariableSets(workspaceId);
|
|
1078
|
+
}
|
|
1079
|
+
/** @deprecated use createVariableSet */
|
|
1080
|
+
async createEnvironment(workspaceId, request) {
|
|
1081
|
+
return await this.createVariableSet(workspaceId, request);
|
|
1082
|
+
}
|
|
1083
|
+
/** @deprecated use getVariableSet */
|
|
1084
|
+
async getEnvironment(workspaceId, environmentId) {
|
|
1085
|
+
return await this.getVariableSet(workspaceId, environmentId);
|
|
1086
|
+
}
|
|
1087
|
+
/** @deprecated use updateVariableSet */
|
|
1088
|
+
async updateEnvironment(workspaceId, environmentId, request) {
|
|
1089
|
+
return await this.updateVariableSet(workspaceId, environmentId, request);
|
|
1090
|
+
}
|
|
1091
|
+
/** @deprecated use deleteVariableSet */
|
|
1092
|
+
async deleteEnvironment(workspaceId, environmentId) {
|
|
1093
|
+
await this.deleteVariableSet(workspaceId, environmentId);
|
|
1094
|
+
}
|
|
1095
|
+
/** @deprecated use setVariableSetVariable */
|
|
1096
|
+
async setEnvironmentVariable(workspaceId, environmentId, name, value) {
|
|
1097
|
+
return await this.setVariableSetVariable(workspaceId, environmentId, name, value);
|
|
1098
|
+
}
|
|
1099
|
+
/** @deprecated use deleteVariableSetVariable */
|
|
1100
|
+
async deleteEnvironmentVariable(workspaceId, environmentId, name) {
|
|
1101
|
+
await this.deleteVariableSetVariable(workspaceId, environmentId, name);
|
|
1102
|
+
}
|
|
778
1103
|
// --- Files -----------------------------------------------------------------------
|
|
779
1104
|
/** Step 1 of the upload flow: returns the pre-signed PUT target. */
|
|
780
1105
|
async beginFileUpload(workspaceId, request) {
|
|
781
|
-
return await this.requestJson(
|
|
1106
|
+
return await this.requestJson(
|
|
1107
|
+
"POST",
|
|
1108
|
+
`/v1/workspaces/${workspaceId}/files/uploads`,
|
|
1109
|
+
request
|
|
1110
|
+
);
|
|
782
1111
|
}
|
|
783
1112
|
/** Step 3 of the upload flow: server verifies the object and marks it ready. */
|
|
784
1113
|
async completeFileUpload(workspaceId, uploadId) {
|
|
@@ -819,28 +1148,51 @@ var OpenGeniClient = class {
|
|
|
819
1148
|
return await this.completeFileUpload(workspaceId, upload.uploadId);
|
|
820
1149
|
}
|
|
821
1150
|
async getFile(workspaceId, fileId) {
|
|
822
|
-
return await this.requestJson(
|
|
1151
|
+
return await this.requestJson(
|
|
1152
|
+
"GET",
|
|
1153
|
+
`/v1/workspaces/${workspaceId}/files/${fileId}`
|
|
1154
|
+
);
|
|
823
1155
|
}
|
|
824
1156
|
/** Mint a short-lived signed download URL for a ready file. */
|
|
825
1157
|
async createFileDownloadUrl(workspaceId, fileId) {
|
|
826
|
-
return await this.requestJson(
|
|
1158
|
+
return await this.requestJson(
|
|
1159
|
+
"POST",
|
|
1160
|
+
`/v1/workspaces/${workspaceId}/files/${fileId}/download-url`
|
|
1161
|
+
);
|
|
827
1162
|
}
|
|
828
1163
|
// --- Documents ----------------------------------------------------------------------
|
|
829
1164
|
async createDocumentBase(workspaceId, request) {
|
|
830
|
-
return await this.requestJson(
|
|
1165
|
+
return await this.requestJson(
|
|
1166
|
+
"POST",
|
|
1167
|
+
`/v1/workspaces/${workspaceId}/document-bases`,
|
|
1168
|
+
request
|
|
1169
|
+
);
|
|
831
1170
|
}
|
|
832
1171
|
async listDocumentBases(workspaceId) {
|
|
833
|
-
return await this.requestJson(
|
|
1172
|
+
return await this.requestJson(
|
|
1173
|
+
"GET",
|
|
1174
|
+
`/v1/workspaces/${workspaceId}/document-bases`
|
|
1175
|
+
);
|
|
834
1176
|
}
|
|
835
1177
|
async getDocumentBase(workspaceId, baseId) {
|
|
836
|
-
return await this.requestJson(
|
|
1178
|
+
return await this.requestJson(
|
|
1179
|
+
"GET",
|
|
1180
|
+
`/v1/workspaces/${workspaceId}/document-bases/${baseId}`
|
|
1181
|
+
);
|
|
837
1182
|
}
|
|
838
1183
|
/** Index an uploaded file into the base. The file must be `ready`. */
|
|
839
1184
|
async addDocument(workspaceId, baseId, request) {
|
|
840
|
-
return await this.requestJson(
|
|
1185
|
+
return await this.requestJson(
|
|
1186
|
+
"POST",
|
|
1187
|
+
`/v1/workspaces/${workspaceId}/document-bases/${baseId}/documents`,
|
|
1188
|
+
request
|
|
1189
|
+
);
|
|
841
1190
|
}
|
|
842
1191
|
async listDocuments(workspaceId, baseId) {
|
|
843
|
-
return await this.requestJson(
|
|
1192
|
+
return await this.requestJson(
|
|
1193
|
+
"GET",
|
|
1194
|
+
`/v1/workspaces/${workspaceId}/document-bases/${baseId}/documents`
|
|
1195
|
+
);
|
|
844
1196
|
}
|
|
845
1197
|
/** Retry indexing for a failed document. */
|
|
846
1198
|
async reindexDocument(workspaceId, baseId, documentId) {
|
|
@@ -866,6 +1218,69 @@ var OpenGeniClient = class {
|
|
|
866
1218
|
request
|
|
867
1219
|
);
|
|
868
1220
|
}
|
|
1221
|
+
async searchKnowledge(workspaceId, request) {
|
|
1222
|
+
return await this.requestJson(
|
|
1223
|
+
"POST",
|
|
1224
|
+
`/v1/workspaces/${workspaceId}/knowledge/search`,
|
|
1225
|
+
request
|
|
1226
|
+
);
|
|
1227
|
+
}
|
|
1228
|
+
async listKnowledgeMemories(workspaceId, request = {}) {
|
|
1229
|
+
const params = new URLSearchParams();
|
|
1230
|
+
if (request.query) params.set("query", request.query);
|
|
1231
|
+
if (request.status) params.set("status", request.status);
|
|
1232
|
+
if (request.kind) params.set("kind", request.kind);
|
|
1233
|
+
if (request.scope) params.set("scope", request.scope);
|
|
1234
|
+
if (request.limit) params.set("limit", String(request.limit));
|
|
1235
|
+
const query = params.toString();
|
|
1236
|
+
return await this.requestJson(
|
|
1237
|
+
"GET",
|
|
1238
|
+
`/v1/workspaces/${workspaceId}/knowledge/memories${query ? `?${query}` : ""}`
|
|
1239
|
+
);
|
|
1240
|
+
}
|
|
1241
|
+
async getKnowledgeMemory(workspaceId, memoryId) {
|
|
1242
|
+
return await this.requestJson(
|
|
1243
|
+
"GET",
|
|
1244
|
+
`/v1/workspaces/${workspaceId}/knowledge/memories/${memoryId}`
|
|
1245
|
+
);
|
|
1246
|
+
}
|
|
1247
|
+
async createKnowledgeMemory(workspaceId, request) {
|
|
1248
|
+
return await this.requestJson(
|
|
1249
|
+
"POST",
|
|
1250
|
+
`/v1/workspaces/${workspaceId}/knowledge/memories`,
|
|
1251
|
+
request
|
|
1252
|
+
);
|
|
1253
|
+
}
|
|
1254
|
+
async updateKnowledgeMemory(workspaceId, memoryId, request) {
|
|
1255
|
+
return await this.requestJson(
|
|
1256
|
+
"PATCH",
|
|
1257
|
+
`/v1/workspaces/${workspaceId}/knowledge/memories/${memoryId}`,
|
|
1258
|
+
request
|
|
1259
|
+
);
|
|
1260
|
+
}
|
|
1261
|
+
/** Hybrid (semantic + keyword) search over the workspace's agent-visible memory. */
|
|
1262
|
+
async searchWorkspaceMemories(workspaceId, request) {
|
|
1263
|
+
return await this.requestJson(
|
|
1264
|
+
"POST",
|
|
1265
|
+
`/v1/workspaces/${workspaceId}/knowledge/memories/search`,
|
|
1266
|
+
request
|
|
1267
|
+
);
|
|
1268
|
+
}
|
|
1269
|
+
/** Deep-merge a settings patch into the workspace (preserves unknown keys). */
|
|
1270
|
+
async updateWorkspaceSettings(workspaceId, request) {
|
|
1271
|
+
return await this.requestJson(
|
|
1272
|
+
"PATCH",
|
|
1273
|
+
`/v1/workspaces/${workspaceId}/settings`,
|
|
1274
|
+
request
|
|
1275
|
+
);
|
|
1276
|
+
}
|
|
1277
|
+
async setWorkspaceDefaultRig(workspaceId, request) {
|
|
1278
|
+
return await this.requestJson(
|
|
1279
|
+
"PUT",
|
|
1280
|
+
`/v1/workspaces/${workspaceId}/default-rig`,
|
|
1281
|
+
request
|
|
1282
|
+
);
|
|
1283
|
+
}
|
|
869
1284
|
// --- Capability packs ------------------------------------------------------------------
|
|
870
1285
|
/** Built-in + registered packs, with the workspace's installations. */
|
|
871
1286
|
async listPacks(workspaceId) {
|
|
@@ -873,10 +1288,17 @@ var OpenGeniClient = class {
|
|
|
873
1288
|
}
|
|
874
1289
|
/** Register (or replace) a workspace-scoped pack from a manifest. */
|
|
875
1290
|
async registerPack(workspaceId, manifest) {
|
|
876
|
-
return await this.requestJson(
|
|
1291
|
+
return await this.requestJson(
|
|
1292
|
+
"POST",
|
|
1293
|
+
`/v1/workspaces/${workspaceId}/packs`,
|
|
1294
|
+
manifest
|
|
1295
|
+
);
|
|
877
1296
|
}
|
|
878
1297
|
async getPack(workspaceId, packId) {
|
|
879
|
-
return await this.requestJson(
|
|
1298
|
+
return await this.requestJson(
|
|
1299
|
+
"GET",
|
|
1300
|
+
`/v1/workspaces/${workspaceId}/packs/${encodeURIComponent(packId)}`
|
|
1301
|
+
);
|
|
880
1302
|
}
|
|
881
1303
|
async enablePack(workspaceId, packId, request = {}) {
|
|
882
1304
|
return await this.requestJson(
|
|
@@ -887,18 +1309,31 @@ var OpenGeniClient = class {
|
|
|
887
1309
|
}
|
|
888
1310
|
/** Unregister a workspace-scoped pack (built-in packs cannot be deleted). */
|
|
889
1311
|
async deletePack(workspaceId, packId) {
|
|
890
|
-
await this.requestVoid(
|
|
1312
|
+
await this.requestVoid(
|
|
1313
|
+
"DELETE",
|
|
1314
|
+
`/v1/workspaces/${workspaceId}/packs/${encodeURIComponent(packId)}`
|
|
1315
|
+
);
|
|
891
1316
|
}
|
|
892
1317
|
async listPackInstallations(workspaceId) {
|
|
893
|
-
return await this.requestJson(
|
|
1318
|
+
return await this.requestJson(
|
|
1319
|
+
"GET",
|
|
1320
|
+
`/v1/workspaces/${workspaceId}/packs/installations`
|
|
1321
|
+
);
|
|
894
1322
|
}
|
|
895
1323
|
// --- Capabilities -------------------------------------------------------------------------
|
|
896
1324
|
async listCapabilities(workspaceId) {
|
|
897
|
-
return await this.requestJson(
|
|
1325
|
+
return await this.requestJson(
|
|
1326
|
+
"GET",
|
|
1327
|
+
`/v1/workspaces/${workspaceId}/capabilities`
|
|
1328
|
+
);
|
|
898
1329
|
}
|
|
899
1330
|
/** Add a manual capability catalog item (e.g. a remote MCP server). */
|
|
900
1331
|
async createCapability(workspaceId, request) {
|
|
901
|
-
return await this.requestJson(
|
|
1332
|
+
return await this.requestJson(
|
|
1333
|
+
"POST",
|
|
1334
|
+
`/v1/workspaces/${workspaceId}/capabilities`,
|
|
1335
|
+
request
|
|
1336
|
+
);
|
|
902
1337
|
}
|
|
903
1338
|
async enableCapability(workspaceId, capabilityId, request = {}) {
|
|
904
1339
|
return await this.requestJson(
|
|
@@ -925,6 +1360,49 @@ var OpenGeniClient = class {
|
|
|
925
1360
|
}
|
|
926
1361
|
);
|
|
927
1362
|
}
|
|
1363
|
+
// --- Connections -------------------------------------------------------------------------------
|
|
1364
|
+
async listConnections(workspaceId) {
|
|
1365
|
+
const response = await this.requestJson(
|
|
1366
|
+
"GET",
|
|
1367
|
+
`/v1/workspaces/${workspaceId}/connections`
|
|
1368
|
+
);
|
|
1369
|
+
return response.connections;
|
|
1370
|
+
}
|
|
1371
|
+
async createConnection(workspaceId, request) {
|
|
1372
|
+
const response = await this.requestJson(
|
|
1373
|
+
"POST",
|
|
1374
|
+
`/v1/workspaces/${workspaceId}/connections`,
|
|
1375
|
+
request
|
|
1376
|
+
);
|
|
1377
|
+
return response.connection;
|
|
1378
|
+
}
|
|
1379
|
+
async updateConnection(workspaceId, connectionId, request) {
|
|
1380
|
+
const response = await this.requestJson(
|
|
1381
|
+
"PATCH",
|
|
1382
|
+
`/v1/workspaces/${workspaceId}/connections/${connectionId}`,
|
|
1383
|
+
request
|
|
1384
|
+
);
|
|
1385
|
+
return response.connection;
|
|
1386
|
+
}
|
|
1387
|
+
async deleteConnection(workspaceId, connectionId) {
|
|
1388
|
+
const response = await this.requestJson(
|
|
1389
|
+
"DELETE",
|
|
1390
|
+
`/v1/workspaces/${workspaceId}/connections/${connectionId}`
|
|
1391
|
+
);
|
|
1392
|
+
return response.connection;
|
|
1393
|
+
}
|
|
1394
|
+
/** Start an OAuth connection flow; redirect the user to the returned `authorizationUrl`. */
|
|
1395
|
+
async startConnectionOAuth(workspaceId, request) {
|
|
1396
|
+
return await this.requestJson(
|
|
1397
|
+
"POST",
|
|
1398
|
+
`/v1/workspaces/${workspaceId}/connections/oauth/start`,
|
|
1399
|
+
request
|
|
1400
|
+
);
|
|
1401
|
+
}
|
|
1402
|
+
/** Public, immutably-cached URL for a catalog item's logo, or null when the item has none. */
|
|
1403
|
+
catalogAssetUrl(logoAssetPath) {
|
|
1404
|
+
return logoAssetPath ? `${this.baseUrl}/v1/${logoAssetPath}` : null;
|
|
1405
|
+
}
|
|
928
1406
|
// --- GitHub ----------------------------------------------------------------------------------
|
|
929
1407
|
/** GitHub App configuration status + a signed install URL when configured. */
|
|
930
1408
|
async getGitHubApp(workspaceId) {
|
|
@@ -939,11 +1417,17 @@ var OpenGeniClient = class {
|
|
|
939
1417
|
return this.url(`/v1/workspaces/${workspaceId}/github/connect`, { state });
|
|
940
1418
|
}
|
|
941
1419
|
async listGitHubRepositories(workspaceId) {
|
|
942
|
-
return await this.requestJson(
|
|
1420
|
+
return await this.requestJson(
|
|
1421
|
+
"GET",
|
|
1422
|
+
`/v1/workspaces/${workspaceId}/github/repositories`
|
|
1423
|
+
);
|
|
943
1424
|
}
|
|
944
1425
|
/** Re-sync the installation's repository list from GitHub. */
|
|
945
1426
|
async syncGitHubRepositories(workspaceId) {
|
|
946
|
-
return await this.requestJson(
|
|
1427
|
+
return await this.requestJson(
|
|
1428
|
+
"POST",
|
|
1429
|
+
`/v1/workspaces/${workspaceId}/github/repositories/sync`
|
|
1430
|
+
);
|
|
947
1431
|
}
|
|
948
1432
|
/** Build a GitHub App manifest + the GitHub URL to submit it to. */
|
|
949
1433
|
async createGitHubAppManifest(workspaceId, request = {}) {
|
|
@@ -955,16 +1439,26 @@ var OpenGeniClient = class {
|
|
|
955
1439
|
}
|
|
956
1440
|
// --- API keys ----------------------------------------------------------------------------------
|
|
957
1441
|
async listApiKeys(workspaceId) {
|
|
958
|
-
const response = await this.requestJson(
|
|
1442
|
+
const response = await this.requestJson(
|
|
1443
|
+
"GET",
|
|
1444
|
+
`/v1/workspaces/${workspaceId}/api-keys`
|
|
1445
|
+
);
|
|
959
1446
|
return response.apiKeys;
|
|
960
1447
|
}
|
|
961
1448
|
/** The returned `token` is shown once; only its prefix is stored. */
|
|
962
1449
|
async createApiKey(workspaceId, request) {
|
|
963
|
-
return await this.requestJson(
|
|
1450
|
+
return await this.requestJson(
|
|
1451
|
+
"POST",
|
|
1452
|
+
`/v1/workspaces/${workspaceId}/api-keys`,
|
|
1453
|
+
request
|
|
1454
|
+
);
|
|
964
1455
|
}
|
|
965
1456
|
/** Revoke an API key. Returns the revoked key. */
|
|
966
1457
|
async deleteApiKey(workspaceId, apiKeyId) {
|
|
967
|
-
return await this.requestJson(
|
|
1458
|
+
return await this.requestJson(
|
|
1459
|
+
"DELETE",
|
|
1460
|
+
`/v1/workspaces/${workspaceId}/api-keys/${apiKeyId}`
|
|
1461
|
+
);
|
|
968
1462
|
}
|
|
969
1463
|
// --- Billing (account-scoped) --------------------------------------------------------------------
|
|
970
1464
|
async getBilling(options = {}) {
|
|
@@ -979,9 +1473,14 @@ var OpenGeniClient = class {
|
|
|
979
1473
|
});
|
|
980
1474
|
}
|
|
981
1475
|
async getBillingEntitlements(options = {}) {
|
|
982
|
-
return await this.requestJson(
|
|
983
|
-
|
|
984
|
-
|
|
1476
|
+
return await this.requestJson(
|
|
1477
|
+
"GET",
|
|
1478
|
+
"/v1/billing/entitlements",
|
|
1479
|
+
void 0,
|
|
1480
|
+
{
|
|
1481
|
+
...options.accountId !== void 0 ? { accountId: options.accountId } : {}
|
|
1482
|
+
}
|
|
1483
|
+
);
|
|
985
1484
|
}
|
|
986
1485
|
/** Start a Stripe checkout for prepaid credits. */
|
|
987
1486
|
async createBillingCheckout(request) {
|
|
@@ -1002,15 +1501,25 @@ var OpenGeniClient = class {
|
|
|
1002
1501
|
// --- Codex (ChatGPT) subscription (workspace-scoped) --------------------------------------------
|
|
1003
1502
|
/** Connection state + the codex models the workspace may select (empty until connected). */
|
|
1004
1503
|
async codexStatus(workspaceId) {
|
|
1005
|
-
return await this.requestJson(
|
|
1504
|
+
return await this.requestJson(
|
|
1505
|
+
"GET",
|
|
1506
|
+
`/v1/workspaces/${workspaceId}/codex/status`
|
|
1507
|
+
);
|
|
1006
1508
|
}
|
|
1007
1509
|
/** Begin device-code login: show `userCode` at `verificationUri`, then poll with `state`. */
|
|
1008
1510
|
async codexConnectStart(workspaceId) {
|
|
1009
|
-
return await this.requestJson(
|
|
1511
|
+
return await this.requestJson(
|
|
1512
|
+
"POST",
|
|
1513
|
+
`/v1/workspaces/${workspaceId}/codex/connect/start`
|
|
1514
|
+
);
|
|
1010
1515
|
}
|
|
1011
1516
|
/** Poll device-code authorization with the `state` from {@link codexConnectStart}. */
|
|
1012
1517
|
async codexConnectPoll(workspaceId, state) {
|
|
1013
|
-
return await this.requestJson(
|
|
1518
|
+
return await this.requestJson(
|
|
1519
|
+
"POST",
|
|
1520
|
+
`/v1/workspaces/${workspaceId}/codex/connect/poll`,
|
|
1521
|
+
{ state }
|
|
1522
|
+
);
|
|
1014
1523
|
}
|
|
1015
1524
|
/** Remaining usage / limits for the connected (ACTIVE) subscription. Back-compat. */
|
|
1016
1525
|
async codexUsage(workspaceId) {
|
|
@@ -1018,39 +1527,69 @@ var OpenGeniClient = class {
|
|
|
1018
1527
|
}
|
|
1019
1528
|
/** Live per-account usage read (refreshes THIS account's bearer; writes the cache). */
|
|
1020
1529
|
async codexAccountUsage(workspaceId, accountId) {
|
|
1021
|
-
return await this.requestJson(
|
|
1530
|
+
return await this.requestJson(
|
|
1531
|
+
"GET",
|
|
1532
|
+
`/v1/workspaces/${workspaceId}/codex/accounts/${accountId}/usage`
|
|
1533
|
+
);
|
|
1022
1534
|
}
|
|
1023
1535
|
/** Batched live refresh across every connected account, keyed by credential id. */
|
|
1024
1536
|
async refreshCodexUsage(workspaceId) {
|
|
1025
|
-
return await this.requestJson(
|
|
1537
|
+
return await this.requestJson(
|
|
1538
|
+
"POST",
|
|
1539
|
+
`/v1/workspaces/${workspaceId}/codex/usage/refresh`
|
|
1540
|
+
);
|
|
1026
1541
|
}
|
|
1027
1542
|
/** Disconnect ALL accounts (legacy workspace-wide). Prefer `disconnectCodexAccount`. */
|
|
1028
1543
|
async codexDisconnect(workspaceId) {
|
|
1029
|
-
return await this.requestJson(
|
|
1544
|
+
return await this.requestJson(
|
|
1545
|
+
"DELETE",
|
|
1546
|
+
`/v1/workspaces/${workspaceId}/codex`
|
|
1547
|
+
);
|
|
1030
1548
|
}
|
|
1031
1549
|
/** List every connected Codex account + the workspace active pointer + settings. */
|
|
1032
1550
|
async listCodexAccounts(workspaceId) {
|
|
1033
|
-
return await this.requestJson(
|
|
1551
|
+
return await this.requestJson(
|
|
1552
|
+
"GET",
|
|
1553
|
+
`/v1/workspaces/${workspaceId}/codex/accounts`
|
|
1554
|
+
);
|
|
1034
1555
|
}
|
|
1035
1556
|
/** Switch the workspace ACTIVE Codex account (the one unpinned sessions use). */
|
|
1036
1557
|
async activateCodexAccount(workspaceId, accountId) {
|
|
1037
|
-
return await this.requestJson(
|
|
1558
|
+
return await this.requestJson(
|
|
1559
|
+
"POST",
|
|
1560
|
+
`/v1/workspaces/${workspaceId}/codex/accounts/${accountId}/activate`
|
|
1561
|
+
);
|
|
1038
1562
|
}
|
|
1039
1563
|
/** P3: enable/disable Codex auto-rotation and/or pick the strategy. Returns the effective settings. */
|
|
1040
1564
|
async setCodexRotationSettings(workspaceId, patch) {
|
|
1041
|
-
return await this.requestJson(
|
|
1565
|
+
return await this.requestJson(
|
|
1566
|
+
"PATCH",
|
|
1567
|
+
`/v1/workspaces/${workspaceId}/codex/settings`,
|
|
1568
|
+
patch
|
|
1569
|
+
);
|
|
1042
1570
|
}
|
|
1043
1571
|
/** Disconnect ONE Codex account by id (re-picks active when the removed one was active). */
|
|
1044
1572
|
async disconnectCodexAccount(workspaceId, accountId) {
|
|
1045
|
-
return await this.requestJson(
|
|
1573
|
+
return await this.requestJson(
|
|
1574
|
+
"DELETE",
|
|
1575
|
+
`/v1/workspaces/${workspaceId}/codex/accounts/${accountId}`
|
|
1576
|
+
);
|
|
1046
1577
|
}
|
|
1047
1578
|
/** Rename a Codex account (label only in P1). */
|
|
1048
1579
|
async renameCodexAccount(workspaceId, accountId, label) {
|
|
1049
|
-
return await this.requestJson(
|
|
1580
|
+
return await this.requestJson(
|
|
1581
|
+
"PATCH",
|
|
1582
|
+
`/v1/workspaces/${workspaceId}/codex/accounts/${accountId}`,
|
|
1583
|
+
{ label }
|
|
1584
|
+
);
|
|
1050
1585
|
}
|
|
1051
1586
|
/** Pin (or unpin via "auto") a session's Codex account. Applies on the next turn. */
|
|
1052
1587
|
async pinSessionCodexAccount(workspaceId, sessionId, target) {
|
|
1053
|
-
return await this.requestJson(
|
|
1588
|
+
return await this.requestJson(
|
|
1589
|
+
"POST",
|
|
1590
|
+
`/v1/workspaces/${workspaceId}/sessions/${sessionId}/codex-account`,
|
|
1591
|
+
{ target }
|
|
1592
|
+
);
|
|
1054
1593
|
}
|
|
1055
1594
|
async requestJson(method, path, body, query = {}) {
|
|
1056
1595
|
const response = await this.fetchImpl(this.url(path, query), {
|
|
@@ -1090,9 +1629,6 @@ async function safeText(response) {
|
|
|
1090
1629
|
return "";
|
|
1091
1630
|
}
|
|
1092
1631
|
}
|
|
1093
|
-
function delay(ms) {
|
|
1094
|
-
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
1095
|
-
}
|
|
1096
1632
|
|
|
1097
1633
|
// src/proxy.ts
|
|
1098
1634
|
function formatSseEvent(event) {
|
|
@@ -1282,24 +1818,33 @@ var SESSION_EVENT_TYPES = [
|
|
|
1282
1818
|
"session.created",
|
|
1283
1819
|
"session.status.changed",
|
|
1284
1820
|
"session.requiresAction",
|
|
1821
|
+
"session.context.compaction.requested",
|
|
1285
1822
|
"session.context.compacted",
|
|
1823
|
+
"session.context.compaction.skipped",
|
|
1286
1824
|
"session.context.cleared",
|
|
1287
1825
|
"user.message",
|
|
1288
|
-
"user.
|
|
1826
|
+
"user.pause",
|
|
1289
1827
|
"user.approvalDecision",
|
|
1290
1828
|
"turn.queued",
|
|
1291
|
-
"turn.updated",
|
|
1292
1829
|
"turn.started",
|
|
1293
1830
|
"turn.completed",
|
|
1294
1831
|
"turn.failed",
|
|
1295
1832
|
"turn.cancelled",
|
|
1296
|
-
"turn.
|
|
1833
|
+
"turn.superseded",
|
|
1834
|
+
"turn.recovery.requested",
|
|
1835
|
+
"turn.capacity_waiting",
|
|
1297
1836
|
"agent.message.delta",
|
|
1298
1837
|
"agent.message.completed",
|
|
1299
1838
|
"agent.reasoning.delta",
|
|
1300
1839
|
"agent.toolCall.created",
|
|
1301
1840
|
"agent.toolCall.output",
|
|
1841
|
+
"agent.model.usage",
|
|
1842
|
+
"tool.auth_needed",
|
|
1302
1843
|
"agent.updated",
|
|
1844
|
+
"rig.setup.started",
|
|
1845
|
+
"rig.setup.completed",
|
|
1846
|
+
"rig.setup.skipped",
|
|
1847
|
+
"rig.setup.failed",
|
|
1303
1848
|
"sandbox.operation.started",
|
|
1304
1849
|
"sandbox.operation.completed",
|
|
1305
1850
|
"sandbox.operation.failed",
|
|
@@ -1310,7 +1855,20 @@ var SESSION_EVENT_TYPES = [
|
|
|
1310
1855
|
"goal.completed",
|
|
1311
1856
|
"goal.paused",
|
|
1312
1857
|
"goal.resumed",
|
|
1858
|
+
"goal.cleared",
|
|
1313
1859
|
"goal.continuation",
|
|
1860
|
+
"system.update.pending",
|
|
1861
|
+
"system.update.delivered",
|
|
1862
|
+
"session.control.paused",
|
|
1863
|
+
"session.control.resumed",
|
|
1864
|
+
"session.control.steer_requested",
|
|
1865
|
+
"workspace.inference.paused",
|
|
1866
|
+
"workspace.inference.resumed",
|
|
1867
|
+
"session.queue.prompt.cancelled",
|
|
1868
|
+
"session.queue.history",
|
|
1869
|
+
"turn.event.rejected_late",
|
|
1870
|
+
"memory.saved",
|
|
1871
|
+
"memory.corrected",
|
|
1314
1872
|
// Channel-B desktop pixel-plane signals (mirror of contracts SessionEventType;
|
|
1315
1873
|
// the contract-parity test asserts sorted equality).
|
|
1316
1874
|
"stream.url.rotated",
|
|
@@ -1330,7 +1888,37 @@ var SESSION_EVENT_TYPES = [
|
|
|
1330
1888
|
"terminal.pty.exited",
|
|
1331
1889
|
"session.title_set",
|
|
1332
1890
|
// Multi-account Codex (P1): the session's inference account changed.
|
|
1333
|
-
"codex.account.switched"
|
|
1891
|
+
"codex.account.switched",
|
|
1892
|
+
// OPE-21 metadata-only per-turn credential selection audit.
|
|
1893
|
+
"codex.credential.selected",
|
|
1894
|
+
// OPE-21 durable zero-capacity wait lifecycle. These are system/runtime
|
|
1895
|
+
// events, never synthetic user messages.
|
|
1896
|
+
"codex.capacity.waiting",
|
|
1897
|
+
"codex.capacity.resumed",
|
|
1898
|
+
"codex.capacity.superseded",
|
|
1899
|
+
// Sandbox durability observability (mirror of contracts SessionEventType):
|
|
1900
|
+
// box lifecycle + manifest-env drift, attributable from the DB alone.
|
|
1901
|
+
"sandbox.box.created",
|
|
1902
|
+
"sandbox.box.lost",
|
|
1903
|
+
"sandbox.box.terminated",
|
|
1904
|
+
"sandbox.box.snapshot",
|
|
1905
|
+
"sandbox.env.drift",
|
|
1906
|
+
// Active-sandbox pointer reconcile (issue #341; announce-only; mirror of contracts
|
|
1907
|
+
// SessionEventType — the contract-parity test asserts sorted equality).
|
|
1908
|
+
"session.route.reconciled",
|
|
1909
|
+
// Workbench v2 turn-end workspace capture (announce-only; mirror of contracts
|
|
1910
|
+
// SessionEventType — the contract-parity test asserts sorted equality).
|
|
1911
|
+
"workspace.revision.captured",
|
|
1912
|
+
"workspace.revision.degraded",
|
|
1913
|
+
// Connected Machine op-outcome observability (announce-only, quiet; mirror of
|
|
1914
|
+
// contracts SessionEventType — the contract-parity test asserts sorted equality).
|
|
1915
|
+
"machine.op.failed",
|
|
1916
|
+
"machine.op.recovered",
|
|
1917
|
+
// Connected Machine link-plane observability (announce-only, quiet; mirror of
|
|
1918
|
+
// contracts SessionEventType — the contract-parity test asserts sorted equality).
|
|
1919
|
+
"machine.link.lost",
|
|
1920
|
+
"machine.link.restored",
|
|
1921
|
+
"machine.runner.restarted"
|
|
1334
1922
|
];
|
|
1335
1923
|
var KNOWN_PERMISSIONS = [
|
|
1336
1924
|
"account:read",
|
|
@@ -1362,12 +1950,19 @@ var KNOWN_PERMISSIONS = [
|
|
|
1362
1950
|
"github:manage",
|
|
1363
1951
|
"github:use",
|
|
1364
1952
|
"api_keys:manage",
|
|
1953
|
+
"connections:read",
|
|
1954
|
+
"connections:write",
|
|
1365
1955
|
"environments:manage",
|
|
1366
1956
|
"environments:use",
|
|
1957
|
+
"variable-sets:manage",
|
|
1958
|
+
"variable-sets:use",
|
|
1367
1959
|
"mcp_servers:attach",
|
|
1960
|
+
"toolspace:call",
|
|
1368
1961
|
"goals:manage",
|
|
1369
1962
|
"enrollments:read",
|
|
1370
|
-
"enrollments:manage"
|
|
1963
|
+
"enrollments:manage",
|
|
1964
|
+
"rigs:use",
|
|
1965
|
+
"rigs:manage"
|
|
1371
1966
|
];
|
|
1372
1967
|
var KNOWN_USAGE_EVENT_TYPES = [
|
|
1373
1968
|
"agent_run.created",
|