@opengeni/sdk 0.15.0 → 0.20.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 +33 -6
- package/dist/index.d.ts +442 -29
- package/dist/index.js +379 -40
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/client.ts +222 -23
- package/src/index.ts +51 -0
- package/src/transcription.ts +496 -0
- package/src/types.ts +330 -23
package/src/types.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { WorkspaceTranscriptionPolicy } from "./transcription";
|
|
2
|
+
|
|
1
3
|
// Hand-written mirrors of the public wire shapes in `@opengeni/contracts`.
|
|
2
4
|
// The SDK keeps zero runtime dependencies so it stays framework-agnostic and
|
|
3
5
|
// publishable on its own; `test/contract-parity.test.ts` pins these types to
|
|
@@ -148,7 +150,11 @@ export type StreamUrlRotatedPayload = {
|
|
|
148
150
|
transport: "vnc-ws";
|
|
149
151
|
viewerId: string | null;
|
|
150
152
|
};
|
|
151
|
-
export type StreamOpenedPayload = {
|
|
153
|
+
export type StreamOpenedPayload = {
|
|
154
|
+
viewerId: string;
|
|
155
|
+
shared: boolean;
|
|
156
|
+
viewerCount: number;
|
|
157
|
+
};
|
|
152
158
|
export type StreamClosedPayload = {
|
|
153
159
|
viewerId: string;
|
|
154
160
|
reason: "client-disconnect" | "reaped" | "revoked" | "box-rollover";
|
|
@@ -164,7 +170,10 @@ export type StreamRevokedPayload = {
|
|
|
164
170
|
// `desktop:true` opts into the un-redacted pixel plane (the consent-gated noVNC
|
|
165
171
|
// stream); a terminal/files-only warm attach omits it (defaults false) so it
|
|
166
172
|
// warms the box + mints the pty-ws terminal cell WITHOUT tripping the consent 409.
|
|
167
|
-
export type AttachViewerRequest = {
|
|
173
|
+
export type AttachViewerRequest = {
|
|
174
|
+
viewerId?: string | undefined;
|
|
175
|
+
desktop?: boolean | undefined;
|
|
176
|
+
};
|
|
168
177
|
|
|
169
178
|
// Mirror of `@opengeni/contracts` ViewerHolder + the P4.2 desktop-stream fields
|
|
170
179
|
// the POST /viewers handler folds in when the pixel plane is minted in-process.
|
|
@@ -202,7 +211,10 @@ export type AcknowledgeStreamRequest = {
|
|
|
202
211
|
acknowledgeUnredacted?: boolean | undefined;
|
|
203
212
|
acknowledgeShared?: boolean | undefined;
|
|
204
213
|
};
|
|
205
|
-
export type AcknowledgeStreamResponse = {
|
|
214
|
+
export type AcknowledgeStreamResponse = {
|
|
215
|
+
acknowledged: boolean;
|
|
216
|
+
acknowledgedShared: boolean;
|
|
217
|
+
};
|
|
206
218
|
|
|
207
219
|
// Mirror of `@opengeni/contracts` ViewerHeartbeatRequest/Response — the
|
|
208
220
|
// Channel-A viewer-liveness ping, epoch-fenced (a stale-epoch beat → alive:false
|
|
@@ -212,14 +224,24 @@ export type ViewerHeartbeatResponse = { alive: boolean };
|
|
|
212
224
|
|
|
213
225
|
export type ReasoningEffort = "none" | "minimal" | "low" | "medium" | "high" | "xhigh";
|
|
214
226
|
export type GitCredentialProvider = "github" | "gitlab" | "azure_devops";
|
|
227
|
+
export type GitCredentialBindingId = string;
|
|
228
|
+
export type GitRepositoryAccess = "read" | "write";
|
|
215
229
|
|
|
216
230
|
export type RepositoryResourceRef = {
|
|
217
231
|
kind: "repository";
|
|
218
232
|
uri: string;
|
|
219
233
|
ref: string;
|
|
234
|
+
/**
|
|
235
|
+
* Optional workspace-relative override. When omitted, OpenGeni persists
|
|
236
|
+
* `repos/<encoded-host>/<owner>/<repo>` so equal names on different Git
|
|
237
|
+
* providers do not collide. Explicit paths are portable, traversal-free, and
|
|
238
|
+
* collision-checked case-insensitively before sandbox execution.
|
|
239
|
+
*/
|
|
220
240
|
mountPath?: string | undefined;
|
|
221
241
|
subpath?: string | undefined;
|
|
222
242
|
provider?: GitCredentialProvider | undefined;
|
|
243
|
+
credentialBindingId?: GitCredentialBindingId | undefined;
|
|
244
|
+
access?: GitRepositoryAccess | undefined;
|
|
223
245
|
repositoryId?: number | string | undefined;
|
|
224
246
|
installationId?: number | string | undefined;
|
|
225
247
|
projectId?: number | string | undefined;
|
|
@@ -231,6 +253,7 @@ export type RepositoryResourceRef = {
|
|
|
231
253
|
export type FileResourceRef = {
|
|
232
254
|
kind: "file";
|
|
233
255
|
fileId: string;
|
|
256
|
+
/** Optional workspace-relative override; defaults to `files/<file-id>`. */
|
|
234
257
|
mountPath?: string | undefined;
|
|
235
258
|
};
|
|
236
259
|
|
|
@@ -254,7 +277,10 @@ export type SessionMcpServerInput = {
|
|
|
254
277
|
allowedTools?: string[] | undefined;
|
|
255
278
|
timeoutMs?: number | undefined;
|
|
256
279
|
cacheToolsList?: boolean | undefined;
|
|
280
|
+
/** Require human approval for every tool, or only the listed unprefixed tool names. */
|
|
281
|
+
requireApproval?: boolean | string[] | undefined;
|
|
257
282
|
headers?: Record<string, string> | undefined;
|
|
283
|
+
connectionRef?: McpServerConnectionRef | undefined;
|
|
258
284
|
};
|
|
259
285
|
|
|
260
286
|
export type SessionMcpCredentialUpdateInput = {
|
|
@@ -268,6 +294,7 @@ export type SessionMcpServerMetadata = {
|
|
|
268
294
|
url: string;
|
|
269
295
|
headerNames: string[];
|
|
270
296
|
credentialVersion: number;
|
|
297
|
+
connectionRef: McpServerConnectionRef | null;
|
|
271
298
|
};
|
|
272
299
|
|
|
273
300
|
export type ConnectionKind = "oauth2" | "api_key" | "app_install" | "delegated";
|
|
@@ -275,10 +302,17 @@ export type ConnectionStatus = "active" | "needs_reauth" | "revoked" | "error";
|
|
|
275
302
|
|
|
276
303
|
export type McpServerConnectionRef = {
|
|
277
304
|
connectionId?: string | undefined;
|
|
305
|
+
provider?: string | undefined;
|
|
278
306
|
providerDomain: string;
|
|
279
307
|
kind?: ConnectionKind | undefined;
|
|
280
308
|
scopes?: string[] | undefined;
|
|
281
309
|
resource?: string | undefined;
|
|
310
|
+
selectedResources?:
|
|
311
|
+
| Array<{
|
|
312
|
+
id: string;
|
|
313
|
+
kind: "repository";
|
|
314
|
+
}>
|
|
315
|
+
| undefined;
|
|
282
316
|
subjectScope?: "workspace" | "subject" | undefined;
|
|
283
317
|
};
|
|
284
318
|
|
|
@@ -354,6 +388,20 @@ export type OAuthStartResponse = {
|
|
|
354
388
|
expiresAt: string;
|
|
355
389
|
};
|
|
356
390
|
|
|
391
|
+
/** The immutable principal whose authority accepted a session or turn. */
|
|
392
|
+
export type TurnInitiator = {
|
|
393
|
+
kind: "subject" | "service";
|
|
394
|
+
subjectId: string;
|
|
395
|
+
/** Display-only snapshot; never an authorization input. */
|
|
396
|
+
label?: string | undefined;
|
|
397
|
+
};
|
|
398
|
+
|
|
399
|
+
/** A trusted embedding host's causal machine/service principal. */
|
|
400
|
+
export type ServiceTurnInitiator = TurnInitiator & { kind: "service" };
|
|
401
|
+
|
|
402
|
+
/** Bounded host provenance; OpenGeni-owned lineage keys are reserved. */
|
|
403
|
+
export type ServiceTurnInitiatorContext = Record<string, unknown>;
|
|
404
|
+
|
|
357
405
|
export type IntegrationClientMetadata = {
|
|
358
406
|
client_id: string;
|
|
359
407
|
client_name: "OpenGeni";
|
|
@@ -377,6 +425,9 @@ export type Session = {
|
|
|
377
425
|
resources: ResourceRef[];
|
|
378
426
|
tools: ToolRef[];
|
|
379
427
|
metadata: Record<string, unknown>;
|
|
428
|
+
/** Frozen creator fact; later turns carry their own independent initiator. */
|
|
429
|
+
createdBy: TurnInitiator;
|
|
430
|
+
createdByContext: Record<string, unknown>;
|
|
380
431
|
model: string;
|
|
381
432
|
sandboxBackend: SandboxBackend;
|
|
382
433
|
sandboxOs: SandboxOs;
|
|
@@ -421,17 +472,26 @@ export type Session = {
|
|
|
421
472
|
attentionDescendants: number;
|
|
422
473
|
pausedDescendants: number;
|
|
423
474
|
failedDescendants: number;
|
|
475
|
+
/** Counts are lower bounds rather than exact totals when true. */
|
|
476
|
+
truncated: boolean;
|
|
424
477
|
}
|
|
425
478
|
| undefined;
|
|
426
479
|
createdAt: string;
|
|
427
480
|
updatedAt: string;
|
|
428
481
|
};
|
|
429
482
|
|
|
483
|
+
/** Additive receipt returned by POST /sessions. */
|
|
484
|
+
export type CreateSessionResponse = Session & {
|
|
485
|
+
initialTurnId: string | null;
|
|
486
|
+
};
|
|
487
|
+
|
|
430
488
|
export type SessionSummary = Session;
|
|
431
489
|
|
|
432
490
|
/** Canonical session-list page; pinned rows are excluded from ordinary pages. */
|
|
433
491
|
export type SessionListResponse = {
|
|
434
492
|
pinned: Session[];
|
|
493
|
+
/** True when the server omitted older pins from its bounded pinned section. */
|
|
494
|
+
pinnedTruncated?: boolean;
|
|
435
495
|
sessions: Session[];
|
|
436
496
|
nextCursor: string | null;
|
|
437
497
|
};
|
|
@@ -493,6 +553,8 @@ export type SessionTurn = {
|
|
|
493
553
|
executionGeneration: number;
|
|
494
554
|
activeAttemptId: string | null;
|
|
495
555
|
lineage: Record<string, unknown>;
|
|
556
|
+
initiator: TurnInitiator;
|
|
557
|
+
initiatorContext: Record<string, unknown>;
|
|
496
558
|
cancelledBy?: string | null;
|
|
497
559
|
cancelReason?: string | null;
|
|
498
560
|
startedAt: string | null;
|
|
@@ -501,10 +563,74 @@ export type SessionTurn = {
|
|
|
501
563
|
updatedAt: string;
|
|
502
564
|
};
|
|
503
565
|
|
|
566
|
+
export type HumanInputQuestionKind = "text" | "single_select" | "multi_select";
|
|
567
|
+
|
|
568
|
+
export type HumanInputOption = {
|
|
569
|
+
id: string;
|
|
570
|
+
label: string;
|
|
571
|
+
description?: string | null | undefined;
|
|
572
|
+
};
|
|
573
|
+
|
|
574
|
+
export type HumanInputQuestion = {
|
|
575
|
+
id: string;
|
|
576
|
+
kind: HumanInputQuestionKind;
|
|
577
|
+
prompt: string;
|
|
578
|
+
label?: string | null | undefined;
|
|
579
|
+
helpText?: string | null | undefined;
|
|
580
|
+
options: HumanInputOption[];
|
|
581
|
+
required: boolean;
|
|
582
|
+
allowOther: boolean;
|
|
583
|
+
validation?:
|
|
584
|
+
| {
|
|
585
|
+
minLength?: number | null | undefined;
|
|
586
|
+
maxLength?: number | null | undefined;
|
|
587
|
+
minSelections?: number | null | undefined;
|
|
588
|
+
maxSelections?: number | null | undefined;
|
|
589
|
+
}
|
|
590
|
+
| null
|
|
591
|
+
| undefined;
|
|
592
|
+
};
|
|
593
|
+
|
|
594
|
+
export type HumanInputAnswer = {
|
|
595
|
+
questionId: string;
|
|
596
|
+
values: string[];
|
|
597
|
+
other?: string | null | undefined;
|
|
598
|
+
};
|
|
599
|
+
|
|
600
|
+
export type HumanInputResponse =
|
|
601
|
+
| { outcome: "answered"; answers: HumanInputAnswer[] }
|
|
602
|
+
| { outcome: "skipped" | "expired" | "cancelled" };
|
|
603
|
+
|
|
604
|
+
export type SubmitHumanInputResponseRequest =
|
|
605
|
+
| { outcome: "answered"; answers: HumanInputAnswer[] }
|
|
606
|
+
| { outcome: "skipped" };
|
|
607
|
+
|
|
608
|
+
export type SessionHumanInputRequest = {
|
|
609
|
+
id: string;
|
|
610
|
+
workspaceId: string;
|
|
611
|
+
sessionId: string;
|
|
612
|
+
turnId: string;
|
|
613
|
+
turnGeneration: number;
|
|
614
|
+
creationAttemptId: string;
|
|
615
|
+
toolCallId: string;
|
|
616
|
+
status: "pending" | "answered" | "skipped" | "expired" | "cancelled";
|
|
617
|
+
questions: HumanInputQuestion[];
|
|
618
|
+
allowSkip: boolean;
|
|
619
|
+
response: HumanInputResponse | null;
|
|
620
|
+
respondedBy: string | null;
|
|
621
|
+
respondedAt: string | null;
|
|
622
|
+
expiresAt: string | null;
|
|
623
|
+
createdAt: string;
|
|
624
|
+
updatedAt: string;
|
|
625
|
+
};
|
|
626
|
+
|
|
504
627
|
export const SESSION_EVENT_TYPES = [
|
|
505
628
|
"session.created",
|
|
629
|
+
// Defensive bounded projection for malformed/legacy oversized envelopes.
|
|
630
|
+
"session.event.envelope_omitted",
|
|
506
631
|
"session.status.changed",
|
|
507
632
|
"session.requiresAction",
|
|
633
|
+
"session.humanInput.requested",
|
|
508
634
|
"session.context.compaction.requested",
|
|
509
635
|
"session.context.compacted",
|
|
510
636
|
"session.context.compaction.skipped",
|
|
@@ -512,6 +638,7 @@ export const SESSION_EVENT_TYPES = [
|
|
|
512
638
|
"user.message",
|
|
513
639
|
"user.pause",
|
|
514
640
|
"user.approvalDecision",
|
|
641
|
+
"user.humanInputResponse",
|
|
515
642
|
"turn.queued",
|
|
516
643
|
"turn.started",
|
|
517
644
|
"turn.completed",
|
|
@@ -527,6 +654,7 @@ export const SESSION_EVENT_TYPES = [
|
|
|
527
654
|
"agent.toolCall.output",
|
|
528
655
|
"agent.model.usage",
|
|
529
656
|
"tool.auth_needed",
|
|
657
|
+
"credential.auth_needed",
|
|
530
658
|
"agent.updated",
|
|
531
659
|
"rig.setup.started",
|
|
532
660
|
"rig.setup.completed",
|
|
@@ -577,9 +705,9 @@ export const SESSION_EVENT_TYPES = [
|
|
|
577
705
|
"session.title_set",
|
|
578
706
|
// Multi-account Codex (P1): the session's inference account changed.
|
|
579
707
|
"codex.account.switched",
|
|
580
|
-
//
|
|
708
|
+
// credential allocator metadata-only per-turn credential selection audit.
|
|
581
709
|
"codex.credential.selected",
|
|
582
|
-
//
|
|
710
|
+
// credential allocator durable zero-capacity wait lifecycle. These are system/runtime
|
|
583
711
|
// events, never synthetic user messages.
|
|
584
712
|
"codex.capacity.waiting",
|
|
585
713
|
"codex.capacity.resumed",
|
|
@@ -635,14 +763,78 @@ export type SessionEvent = {
|
|
|
635
763
|
duplicateReason?: string | null | undefined;
|
|
636
764
|
};
|
|
637
765
|
|
|
766
|
+
export type SessionEventSemanticClass =
|
|
767
|
+
| "control"
|
|
768
|
+
| "terminal"
|
|
769
|
+
| "failure"
|
|
770
|
+
| "checkpoint"
|
|
771
|
+
| "tool_receipt"
|
|
772
|
+
| "provider_account";
|
|
773
|
+
export type SessionEventPayloadMode = "none" | "summary" | "full";
|
|
774
|
+
export type SessionEventReadMode = "monitoring" | "forensic";
|
|
775
|
+
export type SessionEventReadDirection = "after" | "before";
|
|
776
|
+
|
|
777
|
+
type SessionEventListCommonOptions = {
|
|
778
|
+
after?: number;
|
|
779
|
+
before?: number;
|
|
780
|
+
limit?: number;
|
|
781
|
+
compact?: boolean;
|
|
782
|
+
mode?: SessionEventReadMode;
|
|
783
|
+
direction?: SessionEventReadDirection;
|
|
784
|
+
payloadMode?: SessionEventPayloadMode;
|
|
785
|
+
};
|
|
786
|
+
|
|
787
|
+
export type SessionEventListOptions = SessionEventListCommonOptions &
|
|
788
|
+
(
|
|
789
|
+
| {
|
|
790
|
+
latest?: never;
|
|
791
|
+
includeTypes?: SessionEventType[];
|
|
792
|
+
excludeTypes?: SessionEventType[];
|
|
793
|
+
includeClasses?: SessionEventSemanticClass[];
|
|
794
|
+
excludeClasses?: SessionEventSemanticClass[];
|
|
795
|
+
}
|
|
796
|
+
| {
|
|
797
|
+
/** Exclusive lookup for the newest event in exactly this semantic class. */
|
|
798
|
+
latest: SessionEventSemanticClass;
|
|
799
|
+
includeTypes?: never;
|
|
800
|
+
excludeTypes?: never;
|
|
801
|
+
includeClasses?: never;
|
|
802
|
+
excludeClasses?: never;
|
|
803
|
+
}
|
|
804
|
+
);
|
|
805
|
+
|
|
806
|
+
export type SessionEventPage = {
|
|
807
|
+
events: SessionEvent[];
|
|
808
|
+
mode: SessionEventReadMode;
|
|
809
|
+
payloadMode: SessionEventPayloadMode;
|
|
810
|
+
direction: SessionEventReadDirection;
|
|
811
|
+
bytes: number;
|
|
812
|
+
maxBytes: number;
|
|
813
|
+
truncated: boolean;
|
|
814
|
+
hasMore: boolean;
|
|
815
|
+
truncatedBy: "count" | "bytes" | "http_bytes" | null;
|
|
816
|
+
coveredSequence: { first: number; last: number } | null;
|
|
817
|
+
nextAfter: number | null;
|
|
818
|
+
nextBefore: number | null;
|
|
819
|
+
forensicExact: boolean;
|
|
820
|
+
};
|
|
821
|
+
|
|
638
822
|
export type ToolAuthNeededPayload = {
|
|
639
823
|
serverId: string;
|
|
640
824
|
toolName?: string | null | undefined;
|
|
641
825
|
providerDomain: string;
|
|
826
|
+
provider?: string | undefined;
|
|
642
827
|
connectionId?: string | null | undefined;
|
|
643
|
-
reason:
|
|
828
|
+
reason:
|
|
829
|
+
| "missing_connection"
|
|
830
|
+
| "expired"
|
|
831
|
+
| "insufficient_scope"
|
|
832
|
+
| "refresh_failed"
|
|
833
|
+
| "unsupported_auth"
|
|
834
|
+
| "resource_scope_unavailable";
|
|
644
835
|
scopes?: string[] | undefined;
|
|
645
836
|
resource?: string | undefined;
|
|
837
|
+
selectedResources?: Array<{ id: string; kind: "repository" }> | undefined;
|
|
646
838
|
authorizationUrl?: string | undefined;
|
|
647
839
|
subjectId?: string | null | undefined;
|
|
648
840
|
};
|
|
@@ -771,8 +963,16 @@ export type FsListRequest = {
|
|
|
771
963
|
maxEntries?: number;
|
|
772
964
|
includeHidden?: boolean;
|
|
773
965
|
};
|
|
774
|
-
export type FsListResponse = {
|
|
775
|
-
|
|
966
|
+
export type FsListResponse = {
|
|
967
|
+
root: FsTreeNode;
|
|
968
|
+
revision: number;
|
|
969
|
+
truncated: boolean;
|
|
970
|
+
};
|
|
971
|
+
export type FsReadRequest = {
|
|
972
|
+
path: string;
|
|
973
|
+
encoding?: FsEncoding;
|
|
974
|
+
maxBytes?: number;
|
|
975
|
+
};
|
|
776
976
|
export type FsReadResponse = {
|
|
777
977
|
path: string;
|
|
778
978
|
encoding: FsEncoding;
|
|
@@ -789,7 +989,11 @@ export type FsWriteRequest = {
|
|
|
789
989
|
overwrite?: boolean;
|
|
790
990
|
createParents?: boolean;
|
|
791
991
|
};
|
|
792
|
-
export type FsWriteResponse = {
|
|
992
|
+
export type FsWriteResponse = {
|
|
993
|
+
path: string;
|
|
994
|
+
sizeBytes: number;
|
|
995
|
+
revision: number;
|
|
996
|
+
};
|
|
793
997
|
export type FsDeleteRequest = { path: string; recursive?: boolean };
|
|
794
998
|
export type FsDeleteResponse = { revision: number };
|
|
795
999
|
export type FsMoveRequest = {
|
|
@@ -798,7 +1002,11 @@ export type FsMoveRequest = {
|
|
|
798
1002
|
overwrite?: boolean;
|
|
799
1003
|
createParents?: boolean;
|
|
800
1004
|
};
|
|
801
|
-
export type FsMoveResponse = {
|
|
1005
|
+
export type FsMoveResponse = {
|
|
1006
|
+
path: string;
|
|
1007
|
+
newPath: string;
|
|
1008
|
+
revision: number;
|
|
1009
|
+
};
|
|
802
1010
|
export type FsMkdirRequest = { path: string; recursive?: boolean };
|
|
803
1011
|
export type FsMkdirResponse = { path: string; revision: number };
|
|
804
1012
|
|
|
@@ -860,6 +1068,7 @@ export type GitFileDiff = {
|
|
|
860
1068
|
export type GitDiffRequest = {
|
|
861
1069
|
path?: string;
|
|
862
1070
|
staged?: boolean;
|
|
1071
|
+
includeUntracked?: boolean;
|
|
863
1072
|
fromRef?: string;
|
|
864
1073
|
toRef?: string;
|
|
865
1074
|
pathspec?: string[];
|
|
@@ -895,12 +1104,17 @@ export type GitShowRequest = {
|
|
|
895
1104
|
export type GitShowResponse = {
|
|
896
1105
|
commit: GitCommit | null;
|
|
897
1106
|
files: GitFileDiff[];
|
|
898
|
-
blob: {
|
|
1107
|
+
blob: {
|
|
1108
|
+
content: string;
|
|
1109
|
+
encoding: FsEncoding;
|
|
1110
|
+
sizeBytes: number;
|
|
1111
|
+
truncated: boolean;
|
|
1112
|
+
} | null;
|
|
899
1113
|
revision: number;
|
|
900
1114
|
};
|
|
901
1115
|
|
|
902
1116
|
// Workbench v2 turn-end capture (mirror of `@opengeni/contracts` WorkspaceCapture*
|
|
903
|
-
// + the M2 read-API response shapes
|
|
1117
|
+
// + the M2 read-API response shapes). Reuses FsTreeNode /
|
|
904
1118
|
// GitFileStatus / GitFileDiff / GitFileStatusCode / FsEncoding above.
|
|
905
1119
|
export type WorkspaceCaptureFile = {
|
|
906
1120
|
path: string;
|
|
@@ -1018,8 +1232,17 @@ export type TerminalExecResponse = {
|
|
|
1018
1232
|
running: boolean;
|
|
1019
1233
|
wallTimeSeconds: number;
|
|
1020
1234
|
};
|
|
1021
|
-
export type PtyOpenRequest = {
|
|
1022
|
-
|
|
1235
|
+
export type PtyOpenRequest = {
|
|
1236
|
+
cols?: number;
|
|
1237
|
+
rows?: number;
|
|
1238
|
+
cwd?: string;
|
|
1239
|
+
shell?: string;
|
|
1240
|
+
};
|
|
1241
|
+
export type PtyOpenResponse = {
|
|
1242
|
+
ptyId: string;
|
|
1243
|
+
streamVia: "sse-events";
|
|
1244
|
+
supportsInput: boolean;
|
|
1245
|
+
};
|
|
1023
1246
|
export type PtyWriteRequest = { ptyId: string; data: string };
|
|
1024
1247
|
export type PtyResizeRequest = { ptyId: string; cols: number; rows: number };
|
|
1025
1248
|
export type PtyCloseRequest = { ptyId: string };
|
|
@@ -1095,7 +1318,13 @@ export type ScheduledTask = {
|
|
|
1095
1318
|
};
|
|
1096
1319
|
|
|
1097
1320
|
export type CreateSessionRequest = {
|
|
1321
|
+
// Optional UUID preallocated by an embedding host so it can durably link its
|
|
1322
|
+
// projection before OpenGeni admits the initial turn. Replays must retain the
|
|
1323
|
+
// same UUID and idempotency key.
|
|
1324
|
+
requestedSessionId?: string | undefined;
|
|
1098
1325
|
initialMessage: string;
|
|
1326
|
+
/** System instructions scoped to the initial turn; never visible timeline text. */
|
|
1327
|
+
turnInstructions?: string | undefined;
|
|
1099
1328
|
// Per-session agent persona/system instructions (org-visible metadata, not a
|
|
1100
1329
|
// secret). Delivered system-level, composed AFTER the per-workspace persona —
|
|
1101
1330
|
// how a host supplies per-agent-type prompts without leaking them into the
|
|
@@ -1150,7 +1379,7 @@ export const KNOWN_PERMISSIONS = [
|
|
|
1150
1379
|
"sessions:create",
|
|
1151
1380
|
"sessions:read",
|
|
1152
1381
|
"sessions:control",
|
|
1153
|
-
//
|
|
1382
|
+
// sandbox workspace (mirror of @opengeni/contracts Permission). stream:view is
|
|
1154
1383
|
// strictly broader than sessions:read (un-redacted pixels); stream:control is
|
|
1155
1384
|
// the never-granted-v1 raw-input plane; stream:acknowledge is the secret-leak
|
|
1156
1385
|
// consent gate.
|
|
@@ -1223,7 +1452,11 @@ export type CodexConnectionStatus = {
|
|
|
1223
1452
|
lastError?: string | null;
|
|
1224
1453
|
models?: ClientModel[];
|
|
1225
1454
|
/** The account a session runs on when unpinned (label for the in-session indicator). */
|
|
1226
|
-
activeAccount?: {
|
|
1455
|
+
activeAccount?: {
|
|
1456
|
+
id: string;
|
|
1457
|
+
label?: string | null;
|
|
1458
|
+
chatgptAccountId?: string | null;
|
|
1459
|
+
} | null;
|
|
1227
1460
|
/** How many Codex accounts the workspace has connected. */
|
|
1228
1461
|
accountCount?: number;
|
|
1229
1462
|
};
|
|
@@ -1329,7 +1562,12 @@ export type CodexConnectStart = {
|
|
|
1329
1562
|
export type CodexConnectPoll =
|
|
1330
1563
|
| { status: "pending" }
|
|
1331
1564
|
| { status: "expired" }
|
|
1332
|
-
| {
|
|
1565
|
+
| {
|
|
1566
|
+
status: "connected";
|
|
1567
|
+
plan?: string | null;
|
|
1568
|
+
accountId?: string;
|
|
1569
|
+
isActive?: boolean;
|
|
1570
|
+
};
|
|
1333
1571
|
|
|
1334
1572
|
/** Remaining usage/limits for one account. `usage` is the normalized P2 payload. */
|
|
1335
1573
|
export type CodexUsage = {
|
|
@@ -1353,7 +1591,7 @@ export type ClientAuthConfig =
|
|
|
1353
1591
|
|
|
1354
1592
|
// Kept value-identical to @opengeni/contracts and pinned by the SDK contract
|
|
1355
1593
|
// parity suite. The SDK has no runtime dependency on the Zod contracts package.
|
|
1356
|
-
export const OPENGENI_API_CONTRACT_REVISION = "2026-07-
|
|
1594
|
+
export const OPENGENI_API_CONTRACT_REVISION = "2026-07-turn-instructions-v1" as const;
|
|
1357
1595
|
export const OPENGENI_API_CONTRACT_HEADER = "x-opengeni-api-contract" as const;
|
|
1358
1596
|
|
|
1359
1597
|
/**
|
|
@@ -1380,7 +1618,11 @@ export type ClientConfig = {
|
|
|
1380
1618
|
// at all (P4.4). Per-session availability is negotiated on /stream-capabilities;
|
|
1381
1619
|
// this is the coarse on/off the client uses to decide whether to even attempt
|
|
1382
1620
|
// the fs/git/terminal panels.
|
|
1383
|
-
structuredServices: {
|
|
1621
|
+
structuredServices: {
|
|
1622
|
+
fileSystem: boolean;
|
|
1623
|
+
git: boolean;
|
|
1624
|
+
terminalEvents: boolean;
|
|
1625
|
+
};
|
|
1384
1626
|
};
|
|
1385
1627
|
|
|
1386
1628
|
export type AccountRole = "owner" | "admin" | "member";
|
|
@@ -1401,6 +1643,8 @@ export type AccessGrant = {
|
|
|
1401
1643
|
subjectLabel?: string | undefined;
|
|
1402
1644
|
permissions: Permission[];
|
|
1403
1645
|
metadata?: Record<string, unknown> | undefined;
|
|
1646
|
+
serviceInitiator?: ServiceTurnInitiator | undefined;
|
|
1647
|
+
serviceInitiatorContext?: ServiceTurnInitiatorContext | undefined;
|
|
1404
1648
|
};
|
|
1405
1649
|
|
|
1406
1650
|
export type AccessContext = {
|
|
@@ -1436,11 +1680,13 @@ export type Workspace = {
|
|
|
1436
1680
|
|
|
1437
1681
|
export type WorkspaceSettings = {
|
|
1438
1682
|
memoryEnabled?: boolean | undefined;
|
|
1683
|
+
transcription?: WorkspaceTranscriptionPolicy | undefined;
|
|
1439
1684
|
[key: string]: unknown;
|
|
1440
1685
|
};
|
|
1441
1686
|
|
|
1442
1687
|
export type UpdateWorkspaceSettingsRequest = {
|
|
1443
1688
|
memoryEnabled?: boolean | undefined;
|
|
1689
|
+
transcription?: WorkspaceTranscriptionPolicy | undefined;
|
|
1444
1690
|
[key: string]: unknown;
|
|
1445
1691
|
};
|
|
1446
1692
|
|
|
@@ -1594,7 +1840,12 @@ export type EffectiveSessionControl = {
|
|
|
1594
1840
|
blockers: EffectiveControlBlocker[];
|
|
1595
1841
|
resumeOptions: EffectiveControlResumeOption[];
|
|
1596
1842
|
override: { rootSessionId: string; revision: number } | null;
|
|
1597
|
-
settlement: {
|
|
1843
|
+
settlement: {
|
|
1844
|
+
state: "stopping";
|
|
1845
|
+
attemptCount: number;
|
|
1846
|
+
interruptionPendingCount: number;
|
|
1847
|
+
quiescencePendingCount: number;
|
|
1848
|
+
} | null;
|
|
1598
1849
|
};
|
|
1599
1850
|
|
|
1600
1851
|
export type SessionCommandReceipt = {
|
|
@@ -1625,6 +1876,8 @@ export type ComposerDraft = {
|
|
|
1625
1876
|
export type SessionQueueSnapshot = {
|
|
1626
1877
|
version: number;
|
|
1627
1878
|
effectiveControl: EffectiveSessionControl;
|
|
1879
|
+
/** The latest interrupted attempt has not yet durably proved physical quiescence. */
|
|
1880
|
+
stoppingPreviousAttempt: boolean;
|
|
1628
1881
|
items: SessionTurn[];
|
|
1629
1882
|
};
|
|
1630
1883
|
|
|
@@ -1690,6 +1943,26 @@ export type WorkspaceControlEvent = {
|
|
|
1690
1943
|
reason: string | null;
|
|
1691
1944
|
actor: string;
|
|
1692
1945
|
occurredAt: string;
|
|
1946
|
+
truncation?: {
|
|
1947
|
+
truncated: true;
|
|
1948
|
+
surface:
|
|
1949
|
+
| "durable_control"
|
|
1950
|
+
| "database_guard"
|
|
1951
|
+
| "http_projection"
|
|
1952
|
+
| "nats_legacy_guard"
|
|
1953
|
+
| "sse_legacy_guard";
|
|
1954
|
+
deliveredBytes: number;
|
|
1955
|
+
fields: Array<{
|
|
1956
|
+
field: "reason" | "actor";
|
|
1957
|
+
originalBytes: number;
|
|
1958
|
+
deliveredBytes: number;
|
|
1959
|
+
omittedBytes: number;
|
|
1960
|
+
}>;
|
|
1961
|
+
fullEvidence: {
|
|
1962
|
+
available: false;
|
|
1963
|
+
reason: "not_retained";
|
|
1964
|
+
};
|
|
1965
|
+
} | null;
|
|
1693
1966
|
};
|
|
1694
1967
|
|
|
1695
1968
|
export type SessionQueueMutationResponse = {
|
|
@@ -2390,6 +2663,7 @@ export type CapabilityKind = "pack" | "mcp" | "api" | "skill" | "plugin";
|
|
|
2390
2663
|
|
|
2391
2664
|
export type CapabilitySource =
|
|
2392
2665
|
| "built_in"
|
|
2666
|
+
| "library"
|
|
2393
2667
|
| "configured"
|
|
2394
2668
|
| "public_registry"
|
|
2395
2669
|
| "registry"
|
|
@@ -2439,7 +2713,11 @@ export type CapabilityCatalogItem = {
|
|
|
2439
2713
|
enabled: boolean;
|
|
2440
2714
|
enabledReason: string | null;
|
|
2441
2715
|
/** The connection backing this enabled installation, or null when none is involved. */
|
|
2442
|
-
connectionRef: {
|
|
2716
|
+
connectionRef: {
|
|
2717
|
+
connectionId: string;
|
|
2718
|
+
providerDomain: string;
|
|
2719
|
+
kind: string;
|
|
2720
|
+
} | null;
|
|
2443
2721
|
metadata: Record<string, unknown>;
|
|
2444
2722
|
createdAt?: string | undefined;
|
|
2445
2723
|
updatedAt?: string | undefined;
|
|
@@ -2519,13 +2797,29 @@ export type GitHubRepository = {
|
|
|
2519
2797
|
accountType: string | null;
|
|
2520
2798
|
};
|
|
2521
2799
|
|
|
2800
|
+
export type GitHubRepositoryScope = "all" | "selected";
|
|
2801
|
+
|
|
2802
|
+
export type GitHubInstallationBinding = {
|
|
2803
|
+
installationId: number;
|
|
2804
|
+
accountLogin: string | null;
|
|
2805
|
+
accountType: string | null;
|
|
2806
|
+
repositoryScope: GitHubRepositoryScope;
|
|
2807
|
+
repositoryCount: number;
|
|
2808
|
+
createdAt: string;
|
|
2809
|
+
updatedAt: string;
|
|
2810
|
+
};
|
|
2811
|
+
|
|
2522
2812
|
export type GitHubAppInfo = {
|
|
2523
2813
|
configured: boolean;
|
|
2524
2814
|
appId: string | null;
|
|
2525
2815
|
clientId: string | null;
|
|
2526
2816
|
appSlug: string | null;
|
|
2527
|
-
/**
|
|
2817
|
+
/** Reserved compatibility field; null while new installation binding is disabled. */
|
|
2528
2818
|
installUrl: string | null;
|
|
2819
|
+
/** Reserved compatibility field; null while new installation binding is disabled. */
|
|
2820
|
+
linkUrl: string | null;
|
|
2821
|
+
/** Installation bindings owned independently by this workspace. */
|
|
2822
|
+
installations: GitHubInstallationBinding[];
|
|
2529
2823
|
/** Setting names still missing when `configured` is false. */
|
|
2530
2824
|
missing: string[];
|
|
2531
2825
|
};
|
|
@@ -2635,6 +2929,7 @@ export type UserMessageEventInput = {
|
|
|
2635
2929
|
clientEventId?: string | undefined;
|
|
2636
2930
|
payload: {
|
|
2637
2931
|
text: string;
|
|
2932
|
+
turnInstructions?: string | undefined;
|
|
2638
2933
|
resources?: ResourceRef[] | undefined;
|
|
2639
2934
|
tools?: ToolRef[] | undefined;
|
|
2640
2935
|
model?: string | undefined;
|
|
@@ -2653,8 +2948,20 @@ export type UserApprovalDecisionEventInput = {
|
|
|
2653
2948
|
};
|
|
2654
2949
|
};
|
|
2655
2950
|
|
|
2951
|
+
export type UserHumanInputResponseEventInput = {
|
|
2952
|
+
type: "user.humanInputResponse";
|
|
2953
|
+
clientEventId?: string | undefined;
|
|
2954
|
+
payload: {
|
|
2955
|
+
requestId: string;
|
|
2956
|
+
response: SubmitHumanInputResponseRequest;
|
|
2957
|
+
};
|
|
2958
|
+
};
|
|
2959
|
+
|
|
2656
2960
|
/** Control/user events a client may POST to a session's event log. */
|
|
2657
|
-
export type ClientSessionEventInput =
|
|
2961
|
+
export type ClientSessionEventInput =
|
|
2962
|
+
| UserMessageEventInput
|
|
2963
|
+
| UserApprovalDecisionEventInput
|
|
2964
|
+
| UserHumanInputResponseEventInput;
|
|
2658
2965
|
|
|
2659
2966
|
// ── Bring-your-own-compute: Machines dashboard + per-machine metrics (M10) ────
|
|
2660
2967
|
// Hand-written mirrors of the `@opengeni/contracts` MetricSample / MachineView /
|