@opengeni/sdk 0.36.1 → 0.40.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.
Files changed (44) hide show
  1. package/README.md +57 -2
  2. package/dist/chunk-DXDL7EEW.js +573 -0
  3. package/dist/chunk-DXDL7EEW.js.map +1 -0
  4. package/dist/chunk-OINSI33U.js +97 -0
  5. package/dist/chunk-OINSI33U.js.map +1 -0
  6. package/dist/{chunk-B7E4FPNZ.js → chunk-SSQPCFEN.js} +159 -108
  7. package/dist/chunk-SSQPCFEN.js.map +1 -0
  8. package/dist/chunk-XBBPYTI5.js +2018 -0
  9. package/dist/chunk-XBBPYTI5.js.map +1 -0
  10. package/dist/client.d.ts +39 -4
  11. package/dist/codex-realtime-controller.d.ts +124 -0
  12. package/dist/codex-realtime-controller.js +18 -0
  13. package/dist/codex-realtime-controller.js.map +1 -0
  14. package/dist/codex-realtime-lifecycle.d.ts +18 -0
  15. package/dist/codex-realtime-v3-wire.d.ts +86 -0
  16. package/dist/codex-realtime-v3.d.ts +52 -0
  17. package/dist/codex-realtime.d.ts +68 -0
  18. package/dist/core.js +6 -4
  19. package/dist/gateway-realtime-transport.d.ts +2 -0
  20. package/dist/gateway-realtime-transport.js +7 -0
  21. package/dist/gateway-realtime-transport.js.map +1 -0
  22. package/dist/index.d.ts +13 -4
  23. package/dist/index.js +40 -6
  24. package/dist/index.js.map +1 -1
  25. package/dist/realtime.d.ts +45 -0
  26. package/dist/realtime.js +73 -0
  27. package/dist/realtime.js.map +1 -0
  28. package/dist/types.d.ts +225 -6
  29. package/dist/workspace-instruction-policies.d.ts +12 -0
  30. package/dist/workspace-state.d.ts +70 -4
  31. package/package.json +14 -1
  32. package/src/client.ts +248 -20
  33. package/src/codex-realtime-controller.ts +1465 -0
  34. package/src/codex-realtime-lifecycle.ts +97 -0
  35. package/src/codex-realtime-v3-wire.ts +349 -0
  36. package/src/codex-realtime-v3.ts +575 -0
  37. package/src/codex-realtime.ts +411 -0
  38. package/src/gateway-realtime-transport.ts +650 -0
  39. package/src/index.ts +81 -0
  40. package/src/realtime.ts +172 -0
  41. package/src/types.ts +280 -6
  42. package/src/workspace-instruction-policies.ts +13 -0
  43. package/src/workspace-state.ts +82 -4
  44. package/dist/chunk-B7E4FPNZ.js.map +0 -1
package/dist/types.d.ts CHANGED
@@ -1,4 +1,165 @@
1
1
  import type { WorkspaceTranscriptionPolicy } from "./transcription";
2
+ export type CodexRealtimeWebrtcVersion = "v3";
3
+ export type CodexRealtimeVoice = "juniper" | "maple" | "spruce" | "ember" | "vale" | "breeze" | "arbor" | "sol" | "cove";
4
+ export type CodexRealtimeWebrtcRequest = {
5
+ realtimeId: string;
6
+ operationId: string;
7
+ browserInstanceId: string;
8
+ ownerKey: string;
9
+ expectedVersion: number;
10
+ expectedConnectionEpoch: number;
11
+ rotate: boolean;
12
+ browserActivation?: "required" | undefined;
13
+ sdp: string;
14
+ version: CodexRealtimeWebrtcVersion;
15
+ instructions?: string | undefined;
16
+ voice?: CodexRealtimeVoice | undefined;
17
+ };
18
+ export type CodexRealtimeWebrtcResponse = {
19
+ sdp: string;
20
+ version: CodexRealtimeWebrtcVersion;
21
+ model: "gpt-live-1-boulder-alpha";
22
+ connectionId: string;
23
+ connectionEpoch: number;
24
+ startupFenceSequence: number;
25
+ modeVersion: number;
26
+ replay: boolean;
27
+ };
28
+ export type GatewayRealtimeConnectRequest = {
29
+ realtimeId: string;
30
+ operationId: string;
31
+ browserInstanceId: string;
32
+ ownerKey: string;
33
+ expectedVersion: number;
34
+ expectedConnectionEpoch: number;
35
+ rotate: boolean;
36
+ };
37
+ export type GatewayRealtimeInitialItem = {
38
+ role: "user" | "developer" | "assistant";
39
+ text: string;
40
+ };
41
+ export type GatewayRealtimeConnectResponse = {
42
+ token: string;
43
+ url: string;
44
+ upstreamModelId: string;
45
+ expiresAt: number | null;
46
+ connectionId: string;
47
+ connectionEpoch: number;
48
+ startupFenceSequence: number;
49
+ modeVersion: number;
50
+ initialItems: GatewayRealtimeInitialItem[];
51
+ instructions: string;
52
+ replay: false;
53
+ };
54
+ export type ActivateCodexRealtimeConnectionRequest = {
55
+ operationId: string;
56
+ browserInstanceId: string;
57
+ ownerKey: string;
58
+ connectionEpoch: number;
59
+ expectedVersion: number;
60
+ expectedConnectionEpoch: number;
61
+ };
62
+ export type SessionRealtimeLedgerDirection = "provider_in" | "provider_out";
63
+ export type SessionRealtimeLedgerKind = "user_transcript" | "assistant_transcript" | "delegation_call" | "delegation_progress" | "delegation_result" | "interruption" | "session_update" | "error";
64
+ export type SessionRealtimeLedgerEntry = {
65
+ id: string;
66
+ realtimeId: string;
67
+ operationId: string;
68
+ connectionEpoch: number;
69
+ sequence: number;
70
+ direction: SessionRealtimeLedgerDirection;
71
+ kind: SessionRealtimeLedgerKind;
72
+ role: "user" | "assistant" | null;
73
+ providerEventId: string | null;
74
+ delegationItemId: string | null;
75
+ sourceUpdateId: string | null;
76
+ historyItemId: string | null;
77
+ turnId: string | null;
78
+ text: string | null;
79
+ payload: Record<string, unknown>;
80
+ clientAckedAt: string | null;
81
+ providerAckedAt: string | null;
82
+ createdAt: string;
83
+ updatedAt: string;
84
+ };
85
+ export type SessionRealtimeInboundEntry = {
86
+ operationId: string;
87
+ kind: Exclude<SessionRealtimeLedgerKind, "delegation_progress" | "delegation_result" | "session_update">;
88
+ role?: "user" | "assistant" | null | undefined;
89
+ providerEventId?: string | null | undefined;
90
+ delegationItemId?: string | null | undefined;
91
+ text?: string | null | undefined;
92
+ payload?: Record<string, unknown> | undefined;
93
+ };
94
+ export type SyncSessionRealtimeLedgerRequest = {
95
+ browserInstanceId: string;
96
+ ownerKey: string;
97
+ expectedVersion: number;
98
+ connectionId: string;
99
+ connectionEpoch: number;
100
+ entries?: SessionRealtimeInboundEntry[] | undefined;
101
+ clientAckThroughSequence?: number | null | undefined;
102
+ providerAckSequences?: number[] | undefined;
103
+ providerStarted?: {
104
+ providerSessionId: string;
105
+ providerEventId?: string | null | undefined;
106
+ } | undefined;
107
+ };
108
+ export type SyncSessionRealtimeLedgerResponse = {
109
+ accepted: Array<{
110
+ entry: SessionRealtimeLedgerEntry;
111
+ replay: boolean;
112
+ }>;
113
+ outbound: SessionRealtimeLedgerEntry[];
114
+ };
115
+ export type SessionRealtimeModel = "gpt-live-1-boulder-alpha" | "opengeni-gateway/openai/gpt-realtime-2.1" | "opengeni-gateway/openai/gpt-realtime-mini" | "opengeni-gateway/xai/grok-voice-think-fast-2.0" | "workspace-gateway/openai/gpt-realtime-2.1" | "workspace-gateway/openai/gpt-realtime-mini" | "workspace-gateway/xai/grok-voice-think-fast-2.0";
116
+ export type WorkspaceRealtimeModelCatalogItem = {
117
+ id: SessionRealtimeModel;
118
+ label: string;
119
+ provider: "OpenGeni" | "Connected Codex" | "Your Gateway";
120
+ description: string;
121
+ available: boolean;
122
+ unavailableReason: string | null;
123
+ recommended: boolean;
124
+ };
125
+ export type WorkspaceRealtimeModelCatalogResponse = {
126
+ models: WorkspaceRealtimeModelCatalogItem[];
127
+ };
128
+ export type SessionRealtimeState = "active" | "ended";
129
+ export type SessionRealtimeEndReason = "user_stop" | "browser_unload" | "lease_expired";
130
+ export type SessionRealtimeMode = {
131
+ id: string;
132
+ sessionId: string;
133
+ operationId: string;
134
+ browserInstanceId: string;
135
+ model: SessionRealtimeModel;
136
+ state: SessionRealtimeState;
137
+ version: number;
138
+ connectionEpoch: number;
139
+ leaseExpiresAt: string;
140
+ lastHeartbeatAt: string;
141
+ startedAt: string;
142
+ endedAt: string | null;
143
+ endReason: SessionRealtimeEndReason | null;
144
+ };
145
+ export type BeginSessionRealtimeRequest = {
146
+ operationId: string;
147
+ browserInstanceId: string;
148
+ ownerKey: string;
149
+ model: SessionRealtimeModel;
150
+ };
151
+ export type RenewSessionRealtimeRequest = {
152
+ browserInstanceId: string;
153
+ ownerKey: string;
154
+ expectedVersion: number;
155
+ };
156
+ export type EndSessionRealtimeRequest = RenewSessionRealtimeRequest & {
157
+ reason: Extract<SessionRealtimeEndReason, "user_stop" | "browser_unload">;
158
+ };
159
+ export type SessionRealtimeMutationResponse = {
160
+ mode: SessionRealtimeMode;
161
+ replay: boolean;
162
+ };
2
163
  export type SessionStatus = "queued" | "running" | "idle" | "requires_action" | "recovering" | "waiting_capacity" | "failed" | "cancelled";
3
164
  export type SandboxBackend = "docker" | "modal" | "local" | "none" | "daytona" | "runloop" | "e2b" | "blaxel" | "cloudflare" | "vercel" | "selfhosted";
4
165
  export type SandboxOs = "linux" | "macos" | "windows";
@@ -130,7 +291,7 @@ export type ViewerHeartbeatRequest = {
130
291
  export type ViewerHeartbeatResponse = {
131
292
  alive: boolean;
132
293
  };
133
- export type ReasoningEffort = "none" | "minimal" | "low" | "medium" | "high" | "xhigh";
294
+ export type ReasoningEffort = "none" | "minimal" | "low" | "medium" | "high" | "xhigh" | "max";
134
295
  export type LatencyMode = "standard" | "priority" | "fast";
135
296
  export type GitCredentialProvider = "github" | "gitlab" | "azure_devops";
136
297
  export type GitCredentialBindingId = string;
@@ -157,10 +318,12 @@ export type RepositoryResourceRef = {
157
318
  githubInstallationId?: number | undefined;
158
319
  githubRepositoryId?: number | undefined;
159
320
  };
321
+ /** Value mirror of `@opengeni/contracts`; parity-tested without adding an SDK runtime dependency. */
322
+ export declare const DEFAULT_FILE_RESOURCE_MOUNT_ROOT: ".opengeni/files";
160
323
  export type FileResourceRef = {
161
324
  kind: "file";
162
325
  fileId: string;
163
- /** Optional workspace-relative override; defaults to `files/<file-id>`. */
326
+ /** Optional workspace-relative override; defaults to `.opengeni/files/<file-id>`. */
164
327
  mountPath?: string | undefined;
165
328
  };
166
329
  export type ResourceRef = RepositoryResourceRef | FileResourceRef;
@@ -309,6 +472,16 @@ export type OpenGeniSlackBotInstallStart = {
309
472
  export type GoogleDriveTargetScope = "user" | "workspace" | "organization";
310
473
  export type GoogleDriveSyncCadence = "manual" | "hourly" | "daily";
311
474
  export type GoogleDriveReadPolicy = "allow" | "ask" | "block";
475
+ export type GoogleDriveConnectionLifecycleState = "active" | "paused" | "token_revoked" | "app_removed" | "disconnected" | "reconnect_required" | "reconsent_required";
476
+ export type GoogleDriveConnectionLifecycle = {
477
+ state: Exclude<GoogleDriveConnectionLifecycleState, "app_removed">;
478
+ recoverable: true;
479
+ observedAt: string;
480
+ } | {
481
+ state: "app_removed";
482
+ recoverable: false;
483
+ observedAt: string;
484
+ };
312
485
  export type GoogleDriveSelectedSource = {
313
486
  id: string;
314
487
  name: string;
@@ -327,6 +500,7 @@ export type GoogleDriveConnectionMetadata = {
327
500
  googleDisplayName: string | null;
328
501
  verifiedAt: string;
329
502
  accessMode: "metadata_readonly" | "readonly";
503
+ lifecycle?: GoogleDriveConnectionLifecycle | undefined;
330
504
  selectedSources?: GoogleDriveSelectedSource[] | undefined;
331
505
  /** @deprecated Read selectedSources; retained while existing connections migrate. */
332
506
  selectedSource?: GoogleDriveSelectedSource | null | undefined;
@@ -339,6 +513,14 @@ export type GoogleDriveOAuthStartResponse = {
339
513
  authorizationUrl: string;
340
514
  expiresAt: string;
341
515
  };
516
+ export type GoogleDriveLifecycleActionRequest = {
517
+ action: "pause" | "resume";
518
+ expectedVersion: number;
519
+ };
520
+ export type GoogleDriveDisconnectRequest = {
521
+ expectedVersion: number;
522
+ idempotencyKey: string;
523
+ };
342
524
  export type GoogleDriveBrowseItem = {
343
525
  id: string;
344
526
  name: string;
@@ -453,6 +635,8 @@ export type Session = {
453
635
  title: string | null;
454
636
  titleSource: "user" | "agent" | null;
455
637
  instructions: string | null;
638
+ /** Immutable normalized prompt-policy role; distinct from membership roles. */
639
+ policyRole: string | null;
456
640
  resources: ResourceRef[];
457
641
  skills: SessionSkill[];
458
642
  tools: ToolRef[];
@@ -600,8 +784,6 @@ export type HumanInputQuestion = {
600
784
  required: boolean;
601
785
  allowOther: boolean;
602
786
  validation?: {
603
- minLength?: number | null | undefined;
604
- maxLength?: number | null | undefined;
605
787
  minSelections?: number | null | undefined;
606
788
  maxSelections?: number | null | undefined;
607
789
  } | null | undefined;
@@ -641,7 +823,7 @@ export type SessionHumanInputRequest = {
641
823
  createdAt: string;
642
824
  updatedAt: string;
643
825
  };
644
- export declare const SESSION_EVENT_TYPES: readonly ["session.created", "session.event.envelope_omitted", "session.status.changed", "session.requiresAction", "session.humanInput.requested", "session.context.compaction.requested", "session.context.compaction.started", "session.context.compacted", "session.context.compaction.skipped", "session.context.cleared", "user.message", "user.pause", "user.approvalDecision", "user.humanInputResponse", "turn.queued", "turn.started", "turn.completed", "turn.failed", "turn.cancelled", "turn.superseded", "turn.recovery.requested", "turn.capacity_waiting", "agent.message.delta", "agent.message.completed", "agent.reasoning.delta", "agent.toolCall.created", "agent.toolCall.output", "agent.model.request", "agent.model.usage", "tool.auth_needed", "credential.auth_needed", "agent.updated", "rig.setup.started", "rig.setup.completed", "rig.setup.skipped", "rig.setup.failed", "sandbox.operation.started", "sandbox.operation.completed", "sandbox.operation.failed", "sandbox.command.output.delta", "artifact.created", "goal.set", "goal.updated", "goal.completed", "goal.paused", "goal.resumed", "goal.cleared", "goal.continuation", "system.update.pending", "system.update.delivered", "system.update.superseded", "system.update.cancelled", "system.update.settled", "session.control.paused", "session.control.resumed", "session.control.steer_requested", "workspace.inference.paused", "workspace.inference.resumed", "session.queue.changed", "session.queue.prompt.cancelled", "session.queue.history", "turn.event.rejected_late", "memory.saved", "memory.corrected", "stream.url.rotated", "stream.opened", "stream.closed", "stream.revoked", "recording.started", "recording.available", "recording.failed", "fs.changed", "git.changed", "terminal.pty.started", "terminal.pty.output.delta", "terminal.pty.exited", "session.title_set", "session.mcp.approval_policy.updated", "session.tool_policy.updated", "codex.account.switched", "codex.credential.selected", "codex.fleet.decision", "codex.capacity.waiting", "codex.capacity.resumed", "codex.capacity.superseded", "sandbox.box.created", "sandbox.box.lost", "sandbox.box.terminated", "sandbox.box.snapshot", "sandbox.env.drift", "session.route.reconciled", "workspace.revision.captured", "workspace.revision.degraded", "machine.op.failed", "machine.op.recovered", "machine.link.lost", "machine.link.restored", "machine.runner.restarted"];
826
+ export declare const SESSION_EVENT_TYPES: readonly ["session.created", "session.event.envelope_omitted", "session.status.changed", "session.realtime.started", "session.realtime.ended", "session.requiresAction", "session.humanInput.requested", "session.context.compaction.requested", "session.context.compaction.started", "session.context.compacted", "session.context.compaction.skipped", "session.context.cleared", "user.message", "user.pause", "user.approvalDecision", "user.humanInputResponse", "turn.queued", "turn.started", "turn.completed", "turn.failed", "turn.cancelled", "turn.superseded", "turn.recovery.requested", "turn.capacity_waiting", "agent.message.delta", "agent.message.completed", "agent.reasoning.delta", "agent.toolCall.created", "agent.toolCall.output", "agent.model.request", "agent.model.usage", "tool.auth_needed", "credential.auth_needed", "agent.updated", "rig.setup.started", "rig.setup.completed", "rig.setup.skipped", "rig.setup.failed", "sandbox.operation.started", "sandbox.operation.completed", "sandbox.operation.failed", "sandbox.command.output.delta", "artifact.created", "goal.set", "goal.updated", "goal.completed", "goal.paused", "goal.resumed", "goal.cleared", "goal.continuation", "system.update.pending", "system.update.delivered", "system.update.superseded", "system.update.cancelled", "system.update.settled", "session.control.paused", "session.control.resumed", "session.control.steer_requested", "workspace.inference.paused", "workspace.inference.resumed", "session.queue.changed", "session.queue.prompt.cancelled", "session.queue.history", "turn.event.rejected_late", "memory.saved", "memory.corrected", "stream.url.rotated", "stream.opened", "stream.closed", "stream.revoked", "recording.started", "recording.available", "recording.failed", "fs.changed", "git.changed", "terminal.pty.started", "terminal.pty.output.delta", "terminal.pty.exited", "session.title_set", "session.mcp.approval_policy.updated", "session.tool_policy.updated", "codex.account.switched", "codex.credential.selected", "codex.fleet.decision", "codex.capacity.waiting", "codex.capacity.resumed", "codex.capacity.superseded", "sandbox.box.created", "sandbox.box.lost", "sandbox.box.terminated", "sandbox.box.snapshot", "sandbox.env.drift", "session.route.reconciled", "workspace.revision.captured", "workspace.revision.degraded", "machine.op.failed", "machine.op.recovered", "machine.link.lost", "machine.link.restored", "machine.runner.restarted"];
645
827
  export type KnownSessionEventType = (typeof SESSION_EVENT_TYPES)[number];
646
828
  /**
647
829
  * Event types the SDK knows about today, kept open so a newer OpenGeni server
@@ -1321,10 +1503,14 @@ export type ScheduledTask = {
1321
1503
  };
1322
1504
  export type CreateSessionRequest = {
1323
1505
  requestedSessionId?: string | undefined;
1324
- initialMessage: string;
1506
+ initialMessage?: string | undefined;
1507
+ /** Create an idle session shell so realtime voice can be the first interaction. */
1508
+ startMode?: "realtime" | undefined;
1325
1509
  /** System instructions scoped to the initial turn; never visible timeline text. */
1326
1510
  turnInstructions?: string | undefined;
1327
1511
  instructions?: string | undefined;
1512
+ /** Immutable normalized prompt-policy role; distinct from membership roles. */
1513
+ policyRole?: string | undefined;
1328
1514
  resources?: ResourceRef[] | undefined;
1329
1515
  /** Inline skills fixed onto this session; omitted children inherit them. */
1330
1516
  skills?: SessionSkill[] | undefined;
@@ -1380,6 +1566,7 @@ export type ModelCapabilitiesV1 = {
1380
1566
  codeExecution: ModelCapabilityStateV1;
1381
1567
  };
1382
1568
  inputModalities: Array<"text" | "image" | "audio">;
1569
+ inputFileMediaTypes?: string[] | undefined;
1383
1570
  outputModalities: Array<"text" | "image" | "audio">;
1384
1571
  transports: {
1385
1572
  sse: ModelCapabilityStateV1;
@@ -1810,8 +1997,28 @@ export type WorkspaceSettings = {
1810
1997
  maxNestedAgentDepth?: number | null | undefined;
1811
1998
  /** Default for new Codex sessions; absent ⇒ remote_v2. */
1812
1999
  codexCompactionDefault?: "remote_v2" | "portable" | undefined;
2000
+ slackReactionSummon?: WorkspaceSlackReactionSummonSettings | undefined;
1813
2001
  [key: string]: unknown;
1814
2002
  };
2003
+ export type WorkspaceSlackReactionSummonSettings = {
2004
+ enabled: boolean;
2005
+ emoji: string;
2006
+ channelPolicy: {
2007
+ mode: "bot_member";
2008
+ } | {
2009
+ mode: "allowlist";
2010
+ channelIds: string[];
2011
+ };
2012
+ };
2013
+ export type SlackReactionChannel = {
2014
+ id: string;
2015
+ name: string | null;
2016
+ isPrivate: boolean;
2017
+ };
2018
+ export type SlackReactionChannelListResponse = {
2019
+ channels: SlackReactionChannel[];
2020
+ nextCursor: string | null;
2021
+ };
1815
2022
  export type WorkspaceVoiceInputSettings = {
1816
2023
  enabled: boolean;
1817
2024
  };
@@ -1821,6 +2028,7 @@ export type UpdateWorkspaceSettingsRequest = {
1821
2028
  transcription?: WorkspaceTranscriptionPolicy | undefined;
1822
2029
  maxNestedAgentDepth?: number | null | undefined;
1823
2030
  codexCompactionDefault?: "remote_v2" | "portable" | undefined;
2031
+ slackReactionSummon?: WorkspaceSlackReactionSummonSettings | undefined;
1824
2032
  [key: string]: unknown;
1825
2033
  };
1826
2034
  export type SetWorkspaceDefaultRigRequest = {
@@ -2054,6 +2262,8 @@ export type SessionControlResponse = {
2054
2262
  effectiveControl: EffectiveSessionControl;
2055
2263
  interruptionCount: number;
2056
2264
  wakeCount: number;
2265
+ cancelledSessionCount: number;
2266
+ cancelledTurnCount: number;
2057
2267
  };
2058
2268
  export type WorkspaceInferenceControlResponse = {
2059
2269
  receipt: SessionCommandReceipt;
@@ -2414,6 +2624,7 @@ export type UploadFileInput = {
2414
2624
  export type DocumentStatus = "queued" | "indexing" | "ready" | "failed";
2415
2625
  export type KnowledgeSourceKind = "manual_upload" | "meeting_transcript" | "repository" | "email" | "chat" | "document" | "web" | "other";
2416
2626
  export type DocumentSearchMode = "hybrid" | "vector" | "keyword";
2627
+ export type DocumentAuthorityKind = "organization" | "workspace" | "personal";
2417
2628
  export type DocumentVisibility = "workspace" | "private";
2418
2629
  export type DocumentCurationStatus = "none" | "pending" | "suggested" | "auto_filed" | "failed";
2419
2630
  export type DocumentCuration = {
@@ -2451,6 +2662,9 @@ export type Document = {
2451
2662
  sourceUpdatedAt: string | null;
2452
2663
  sourceVersion: string | null;
2453
2664
  aclTags: string[];
2665
+ authorityKind: DocumentAuthorityKind;
2666
+ authorityWorkspaceId: string | null;
2667
+ authoritySubjectId: string | null;
2454
2668
  visibility: DocumentVisibility;
2455
2669
  createdBy: string | null;
2456
2670
  agentAccess: boolean;
@@ -2484,6 +2698,9 @@ export type DocumentSearchResult = {
2484
2698
  sourceUpdatedAt: string | null;
2485
2699
  sourceVersion: string | null;
2486
2700
  aclTags: string[];
2701
+ authorityKind: DocumentAuthorityKind;
2702
+ authorityWorkspaceId: string | null;
2703
+ authoritySubjectId: string | null;
2487
2704
  };
2488
2705
  export type CreateDocumentBaseRequest = {
2489
2706
  name: string;
@@ -2501,6 +2718,7 @@ export type AddDocumentRequest = {
2501
2718
  sourceUpdatedAt?: string | undefined;
2502
2719
  sourceVersion?: string | undefined;
2503
2720
  aclTags?: string[] | undefined;
2721
+ authorityKind?: DocumentAuthorityKind | undefined;
2504
2722
  visibility?: DocumentVisibility | undefined;
2505
2723
  agentAccess?: boolean | undefined;
2506
2724
  };
@@ -2509,6 +2727,7 @@ export type CreateKnowledgeDropRequest = {
2509
2727
  fileId?: string | undefined;
2510
2728
  filename?: string | undefined;
2511
2729
  title?: string | undefined;
2730
+ authorityKind?: DocumentAuthorityKind | undefined;
2512
2731
  visibility?: DocumentVisibility | undefined;
2513
2732
  agentAccess?: boolean | undefined;
2514
2733
  };
@@ -15,6 +15,7 @@ export type WorkspaceInstructionPolicyRevisionIdentity = {
15
15
  contentHash: string;
16
16
  };
17
17
  export type WorkspaceInstructionPolicyRevision = WorkspaceInstructionPolicyRevisionIdentity & WorkspaceInstructionPolicyTarget & {
18
+ operationId: string;
18
19
  accountId: string;
19
20
  workspaceId: string;
20
21
  content: string;
@@ -36,6 +37,7 @@ export type WorkspaceInstructionPolicyHead = WorkspaceInstructionPolicyTarget &
36
37
  };
37
38
  export type WorkspaceInstructionPolicyActivationEvent = WorkspaceInstructionPolicyTarget & {
38
39
  id: string;
40
+ operationId: string;
39
41
  accountId: string;
40
42
  workspaceId: string;
41
43
  type: WorkspaceInstructionPolicyActivationType;
@@ -47,12 +49,14 @@ export type WorkspaceInstructionPolicyActivationEvent = WorkspaceInstructionPoli
47
49
  createdAt: string;
48
50
  };
49
51
  export type CreateWorkspaceInstructionPolicyDraftRequest = WorkspaceInstructionPolicyTarget & {
52
+ operationId?: string;
50
53
  content: string;
51
54
  provenanceSource?: WorkspaceInstructionPolicyDraftProvenanceSource;
52
55
  provenanceSourceId?: string | null;
53
56
  supersedesRevisionId?: string | null;
54
57
  };
55
58
  export type ImportLegacyWorkspaceInstructionPolicyDraftRequest = {
59
+ operationId?: string;
56
60
  supersedesRevisionId?: string | null;
57
61
  };
58
62
  export type WorkspaceInstructionPolicyListOptions = {
@@ -79,12 +83,16 @@ export type WorkspaceInstructionPolicyDiffResponse = {
79
83
  diff: string;
80
84
  };
81
85
  export type ActivateWorkspaceInstructionPolicyRequest = {
86
+ operationId?: string;
82
87
  expectedCurrentRevisionId: string | null;
88
+ expectedActivationVersion?: number;
83
89
  reason: string;
84
90
  };
85
91
  export type RollbackWorkspaceInstructionPolicyRequest = {
92
+ operationId?: string;
86
93
  targetRevisionId: string;
87
94
  expectedCurrentRevisionId: string;
95
+ expectedActivationVersion?: number;
88
96
  reason: string;
89
97
  };
90
98
  export type WorkspaceInstructionPolicyActivationResponse = {
@@ -96,3 +104,7 @@ export type WorkspaceInstructionPolicyConflictResponse = {
96
104
  message: string;
97
105
  currentHead: WorkspaceInstructionPolicyHead | null;
98
106
  };
107
+ export type WorkspaceInstructionPolicyOperationReuseResponse = {
108
+ code: "WORKSPACE_INSTRUCTION_POLICY_OPERATION_REUSED";
109
+ message: string;
110
+ };
@@ -31,6 +31,75 @@ export type WorkspaceStateMemoryKindCounts = {
31
31
  preference: number;
32
32
  };
33
33
  export type WorkspaceStateGapCode = "no_document_bases" | "no_visible_documents" | "failed_documents" | "processing_documents" | "missing_topic_coverage" | "no_memory_records" | "pending_memory_review" | "partial_inventory";
34
+ export type WorkspaceStateGovernanceDriftStatus = "identical" | "changed" | "superseded" | "missing" | "unavailable" | "truncated";
35
+ export type WorkspaceStateGetOptions = {
36
+ attemptId?: string;
37
+ };
38
+ export type WorkspaceStateAttemptGovernance = {
39
+ status: "not_requested";
40
+ } | {
41
+ status: "unavailable";
42
+ reason: "attempt_not_found_or_not_authorized";
43
+ driftStatus: "unavailable";
44
+ } | {
45
+ status: "available";
46
+ attemptId: string;
47
+ executionGeneration: number;
48
+ acceptedAt: string;
49
+ policySnapshot: {
50
+ status: "missing";
51
+ } | {
52
+ status: "available";
53
+ id: string;
54
+ createdAt: string;
55
+ entryHash: string;
56
+ policyRole: string | null;
57
+ roleSource: "session_binding" | "metadata_fallback" | "none" | "invalid_metadata_fallback";
58
+ entries: Array<{
59
+ kind: WorkspaceInstructionPolicyKind;
60
+ scope: WorkspaceInstructionPolicyScope;
61
+ roleKey: string | null;
62
+ revisionId: string;
63
+ revision: number;
64
+ contentHash: string;
65
+ activationVersion: number;
66
+ activatedAt: string;
67
+ provenance: {
68
+ source: WorkspaceInstructionPolicyProvenanceSource;
69
+ sourceIdHash: string | null;
70
+ };
71
+ }>;
72
+ };
73
+ preferenceSnapshot: {
74
+ status: "missing";
75
+ } | {
76
+ status: "available";
77
+ id: string;
78
+ createdAt: string;
79
+ descriptorHash: string;
80
+ descriptorCount: number;
81
+ truncated: boolean;
82
+ };
83
+ drift: {
84
+ overall: WorkspaceStateGovernanceDriftStatus;
85
+ policy: {
86
+ status: WorkspaceStateGovernanceDriftStatus;
87
+ snapshotHash: string | null;
88
+ currentHash: string | null;
89
+ snapshotTargetCount: number;
90
+ currentTargetCount: number;
91
+ };
92
+ preferences: {
93
+ status: WorkspaceStateGovernanceDriftStatus;
94
+ snapshotHash: string | null;
95
+ currentHash: string | null;
96
+ snapshotDescriptorCount: number;
97
+ currentDescriptorCount: number;
98
+ snapshotTruncated: boolean;
99
+ currentTruncated: boolean;
100
+ };
101
+ };
102
+ };
34
103
  export type WorkspaceStateResponse = {
35
104
  workspaceId: string;
36
105
  generatedAt: string;
@@ -39,10 +108,7 @@ export type WorkspaceStateResponse = {
39
108
  source: "read_time_projection";
40
109
  capturedAt: string;
41
110
  };
42
- policySnapshot: {
43
- status: "not_captured";
44
- reason: "workspace_instruction_policy_snapshot_not_implemented";
45
- };
111
+ attemptGovernance: WorkspaceStateAttemptGovernance;
46
112
  };
47
113
  policy: {
48
114
  authority: "workspace_instruction_policy_heads";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengeni/sdk",
3
- "version": "0.36.1",
3
+ "version": "0.40.0",
4
4
  "description": "Framework-agnostic TypeScript SDK for the OpenGeni API: typed client, session lifecycle, SSE event streaming with reconnect + replay-by-sequence, and proxy re-streaming helpers.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -25,6 +25,18 @@
25
25
  "./core": {
26
26
  "types": "./dist/core.d.ts",
27
27
  "import": "./dist/core.js"
28
+ },
29
+ "./realtime": {
30
+ "types": "./dist/realtime.d.ts",
31
+ "import": "./dist/realtime.js"
32
+ },
33
+ "./codex-realtime-controller": {
34
+ "types": "./dist/codex-realtime-controller.d.ts",
35
+ "import": "./dist/codex-realtime-controller.js"
36
+ },
37
+ "./gateway-realtime-transport": {
38
+ "types": "./dist/gateway-realtime-transport.d.ts",
39
+ "import": "./dist/gateway-realtime-transport.js"
28
40
  }
29
41
  },
30
42
  "publishConfig": {
@@ -36,6 +48,7 @@
36
48
  "build": "bun ../../scripts/build-typescript-package.ts",
37
49
  "prepublishOnly": "bash ../../scripts/prepublish-guard"
38
50
  },
51
+ "dependencies": {},
39
52
  "engines": {
40
53
  "node": ">=18"
41
54
  }