@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.
- package/README.md +57 -2
- package/dist/chunk-DXDL7EEW.js +573 -0
- package/dist/chunk-DXDL7EEW.js.map +1 -0
- package/dist/chunk-OINSI33U.js +97 -0
- package/dist/chunk-OINSI33U.js.map +1 -0
- package/dist/{chunk-B7E4FPNZ.js → chunk-SSQPCFEN.js} +159 -108
- package/dist/chunk-SSQPCFEN.js.map +1 -0
- package/dist/chunk-XBBPYTI5.js +2018 -0
- package/dist/chunk-XBBPYTI5.js.map +1 -0
- package/dist/client.d.ts +39 -4
- package/dist/codex-realtime-controller.d.ts +124 -0
- package/dist/codex-realtime-controller.js +18 -0
- package/dist/codex-realtime-controller.js.map +1 -0
- package/dist/codex-realtime-lifecycle.d.ts +18 -0
- package/dist/codex-realtime-v3-wire.d.ts +86 -0
- package/dist/codex-realtime-v3.d.ts +52 -0
- package/dist/codex-realtime.d.ts +68 -0
- package/dist/core.js +6 -4
- package/dist/gateway-realtime-transport.d.ts +2 -0
- package/dist/gateway-realtime-transport.js +7 -0
- package/dist/gateway-realtime-transport.js.map +1 -0
- package/dist/index.d.ts +13 -4
- package/dist/index.js +40 -6
- package/dist/index.js.map +1 -1
- package/dist/realtime.d.ts +45 -0
- package/dist/realtime.js +73 -0
- package/dist/realtime.js.map +1 -0
- package/dist/types.d.ts +225 -6
- package/dist/workspace-instruction-policies.d.ts +12 -0
- package/dist/workspace-state.d.ts +70 -4
- package/package.json +14 -1
- package/src/client.ts +248 -20
- package/src/codex-realtime-controller.ts +1465 -0
- package/src/codex-realtime-lifecycle.ts +97 -0
- package/src/codex-realtime-v3-wire.ts +349 -0
- package/src/codex-realtime-v3.ts +575 -0
- package/src/codex-realtime.ts +411 -0
- package/src/gateway-realtime-transport.ts +650 -0
- package/src/index.ts +81 -0
- package/src/realtime.ts +172 -0
- package/src/types.ts +280 -6
- package/src/workspace-instruction-policies.ts +13 -0
- package/src/workspace-state.ts +82 -4
- package/dist/chunk-B7E4FPNZ.js.map +0 -1
package/src/types.ts
CHANGED
|
@@ -5,6 +5,210 @@ import type { WorkspaceTranscriptionPolicy } from "./transcription";
|
|
|
5
5
|
// publishable on its own; `test/contract-parity.test.ts` pins these types to
|
|
6
6
|
// the contracts package so drift fails the gate instead of shipping.
|
|
7
7
|
|
|
8
|
+
export type CodexRealtimeWebrtcVersion = "v3";
|
|
9
|
+
export type CodexRealtimeVoice =
|
|
10
|
+
| "juniper"
|
|
11
|
+
| "maple"
|
|
12
|
+
| "spruce"
|
|
13
|
+
| "ember"
|
|
14
|
+
| "vale"
|
|
15
|
+
| "breeze"
|
|
16
|
+
| "arbor"
|
|
17
|
+
| "sol"
|
|
18
|
+
| "cove";
|
|
19
|
+
|
|
20
|
+
export type CodexRealtimeWebrtcRequest = {
|
|
21
|
+
realtimeId: string;
|
|
22
|
+
operationId: string;
|
|
23
|
+
browserInstanceId: string;
|
|
24
|
+
ownerKey: string;
|
|
25
|
+
expectedVersion: number;
|
|
26
|
+
expectedConnectionEpoch: number;
|
|
27
|
+
rotate: boolean;
|
|
28
|
+
browserActivation?: "required" | undefined;
|
|
29
|
+
sdp: string;
|
|
30
|
+
version: CodexRealtimeWebrtcVersion;
|
|
31
|
+
instructions?: string | undefined;
|
|
32
|
+
voice?: CodexRealtimeVoice | undefined;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export type CodexRealtimeWebrtcResponse = {
|
|
36
|
+
sdp: string;
|
|
37
|
+
version: CodexRealtimeWebrtcVersion;
|
|
38
|
+
model: "gpt-live-1-boulder-alpha";
|
|
39
|
+
connectionId: string;
|
|
40
|
+
connectionEpoch: number;
|
|
41
|
+
startupFenceSequence: number;
|
|
42
|
+
modeVersion: number;
|
|
43
|
+
replay: boolean;
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export type GatewayRealtimeConnectRequest = {
|
|
47
|
+
realtimeId: string;
|
|
48
|
+
operationId: string;
|
|
49
|
+
browserInstanceId: string;
|
|
50
|
+
ownerKey: string;
|
|
51
|
+
expectedVersion: number;
|
|
52
|
+
expectedConnectionEpoch: number;
|
|
53
|
+
rotate: boolean;
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
export type GatewayRealtimeInitialItem = {
|
|
57
|
+
role: "user" | "developer" | "assistant";
|
|
58
|
+
text: string;
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
export type GatewayRealtimeConnectResponse = {
|
|
62
|
+
token: string;
|
|
63
|
+
url: string;
|
|
64
|
+
upstreamModelId: string;
|
|
65
|
+
expiresAt: number | null;
|
|
66
|
+
connectionId: string;
|
|
67
|
+
connectionEpoch: number;
|
|
68
|
+
startupFenceSequence: number;
|
|
69
|
+
modeVersion: number;
|
|
70
|
+
initialItems: GatewayRealtimeInitialItem[];
|
|
71
|
+
instructions: string;
|
|
72
|
+
replay: false;
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
export type ActivateCodexRealtimeConnectionRequest = {
|
|
76
|
+
operationId: string;
|
|
77
|
+
browserInstanceId: string;
|
|
78
|
+
ownerKey: string;
|
|
79
|
+
connectionEpoch: number;
|
|
80
|
+
expectedVersion: number;
|
|
81
|
+
expectedConnectionEpoch: number;
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
export type SessionRealtimeLedgerDirection = "provider_in" | "provider_out";
|
|
85
|
+
export type SessionRealtimeLedgerKind =
|
|
86
|
+
| "user_transcript"
|
|
87
|
+
| "assistant_transcript"
|
|
88
|
+
| "delegation_call"
|
|
89
|
+
| "delegation_progress"
|
|
90
|
+
| "delegation_result"
|
|
91
|
+
| "interruption"
|
|
92
|
+
| "session_update"
|
|
93
|
+
| "error";
|
|
94
|
+
|
|
95
|
+
export type SessionRealtimeLedgerEntry = {
|
|
96
|
+
id: string;
|
|
97
|
+
realtimeId: string;
|
|
98
|
+
operationId: string;
|
|
99
|
+
connectionEpoch: number;
|
|
100
|
+
sequence: number;
|
|
101
|
+
direction: SessionRealtimeLedgerDirection;
|
|
102
|
+
kind: SessionRealtimeLedgerKind;
|
|
103
|
+
role: "user" | "assistant" | null;
|
|
104
|
+
providerEventId: string | null;
|
|
105
|
+
delegationItemId: string | null;
|
|
106
|
+
sourceUpdateId: string | null;
|
|
107
|
+
historyItemId: string | null;
|
|
108
|
+
turnId: string | null;
|
|
109
|
+
text: string | null;
|
|
110
|
+
payload: Record<string, unknown>;
|
|
111
|
+
clientAckedAt: string | null;
|
|
112
|
+
providerAckedAt: string | null;
|
|
113
|
+
createdAt: string;
|
|
114
|
+
updatedAt: string;
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
export type SessionRealtimeInboundEntry = {
|
|
118
|
+
operationId: string;
|
|
119
|
+
kind: Exclude<
|
|
120
|
+
SessionRealtimeLedgerKind,
|
|
121
|
+
"delegation_progress" | "delegation_result" | "session_update"
|
|
122
|
+
>;
|
|
123
|
+
role?: "user" | "assistant" | null | undefined;
|
|
124
|
+
providerEventId?: string | null | undefined;
|
|
125
|
+
delegationItemId?: string | null | undefined;
|
|
126
|
+
text?: string | null | undefined;
|
|
127
|
+
payload?: Record<string, unknown> | undefined;
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
export type SyncSessionRealtimeLedgerRequest = {
|
|
131
|
+
browserInstanceId: string;
|
|
132
|
+
ownerKey: string;
|
|
133
|
+
expectedVersion: number;
|
|
134
|
+
connectionId: string;
|
|
135
|
+
connectionEpoch: number;
|
|
136
|
+
entries?: SessionRealtimeInboundEntry[] | undefined;
|
|
137
|
+
clientAckThroughSequence?: number | null | undefined;
|
|
138
|
+
providerAckSequences?: number[] | undefined;
|
|
139
|
+
providerStarted?:
|
|
140
|
+
| { providerSessionId: string; providerEventId?: string | null | undefined }
|
|
141
|
+
| undefined;
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
export type SyncSessionRealtimeLedgerResponse = {
|
|
145
|
+
accepted: Array<{ entry: SessionRealtimeLedgerEntry; replay: boolean }>;
|
|
146
|
+
outbound: SessionRealtimeLedgerEntry[];
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
export type SessionRealtimeModel =
|
|
150
|
+
| "gpt-live-1-boulder-alpha"
|
|
151
|
+
| "opengeni-gateway/openai/gpt-realtime-2.1"
|
|
152
|
+
| "opengeni-gateway/openai/gpt-realtime-mini"
|
|
153
|
+
| "opengeni-gateway/xai/grok-voice-think-fast-2.0"
|
|
154
|
+
| "workspace-gateway/openai/gpt-realtime-2.1"
|
|
155
|
+
| "workspace-gateway/openai/gpt-realtime-mini"
|
|
156
|
+
| "workspace-gateway/xai/grok-voice-think-fast-2.0";
|
|
157
|
+
|
|
158
|
+
export type WorkspaceRealtimeModelCatalogItem = {
|
|
159
|
+
id: SessionRealtimeModel;
|
|
160
|
+
label: string;
|
|
161
|
+
provider: "OpenGeni" | "Connected Codex" | "Your Gateway";
|
|
162
|
+
description: string;
|
|
163
|
+
available: boolean;
|
|
164
|
+
unavailableReason: string | null;
|
|
165
|
+
recommended: boolean;
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
export type WorkspaceRealtimeModelCatalogResponse = {
|
|
169
|
+
models: WorkspaceRealtimeModelCatalogItem[];
|
|
170
|
+
};
|
|
171
|
+
export type SessionRealtimeState = "active" | "ended";
|
|
172
|
+
export type SessionRealtimeEndReason = "user_stop" | "browser_unload" | "lease_expired";
|
|
173
|
+
|
|
174
|
+
export type SessionRealtimeMode = {
|
|
175
|
+
id: string;
|
|
176
|
+
sessionId: string;
|
|
177
|
+
operationId: string;
|
|
178
|
+
browserInstanceId: string;
|
|
179
|
+
model: SessionRealtimeModel;
|
|
180
|
+
state: SessionRealtimeState;
|
|
181
|
+
version: number;
|
|
182
|
+
connectionEpoch: number;
|
|
183
|
+
leaseExpiresAt: string;
|
|
184
|
+
lastHeartbeatAt: string;
|
|
185
|
+
startedAt: string;
|
|
186
|
+
endedAt: string | null;
|
|
187
|
+
endReason: SessionRealtimeEndReason | null;
|
|
188
|
+
};
|
|
189
|
+
|
|
190
|
+
export type BeginSessionRealtimeRequest = {
|
|
191
|
+
operationId: string;
|
|
192
|
+
browserInstanceId: string;
|
|
193
|
+
ownerKey: string;
|
|
194
|
+
model: SessionRealtimeModel;
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
export type RenewSessionRealtimeRequest = {
|
|
198
|
+
browserInstanceId: string;
|
|
199
|
+
ownerKey: string;
|
|
200
|
+
expectedVersion: number;
|
|
201
|
+
};
|
|
202
|
+
|
|
203
|
+
export type EndSessionRealtimeRequest = RenewSessionRealtimeRequest & {
|
|
204
|
+
reason: Extract<SessionRealtimeEndReason, "user_stop" | "browser_unload">;
|
|
205
|
+
};
|
|
206
|
+
|
|
207
|
+
export type SessionRealtimeMutationResponse = {
|
|
208
|
+
mode: SessionRealtimeMode;
|
|
209
|
+
replay: boolean;
|
|
210
|
+
};
|
|
211
|
+
|
|
8
212
|
export type SessionStatus =
|
|
9
213
|
| "queued"
|
|
10
214
|
| "running"
|
|
@@ -228,7 +432,7 @@ export type AcknowledgeStreamResponse = {
|
|
|
228
432
|
export type ViewerHeartbeatRequest = { leaseEpoch: number };
|
|
229
433
|
export type ViewerHeartbeatResponse = { alive: boolean };
|
|
230
434
|
|
|
231
|
-
export type ReasoningEffort = "none" | "minimal" | "low" | "medium" | "high" | "xhigh";
|
|
435
|
+
export type ReasoningEffort = "none" | "minimal" | "low" | "medium" | "high" | "xhigh" | "max";
|
|
232
436
|
export type LatencyMode = "standard" | "priority" | "fast";
|
|
233
437
|
export type GitCredentialProvider = "github" | "gitlab" | "azure_devops";
|
|
234
438
|
export type GitCredentialBindingId = string;
|
|
@@ -257,10 +461,13 @@ export type RepositoryResourceRef = {
|
|
|
257
461
|
githubRepositoryId?: number | undefined;
|
|
258
462
|
};
|
|
259
463
|
|
|
464
|
+
/** Value mirror of `@opengeni/contracts`; parity-tested without adding an SDK runtime dependency. */
|
|
465
|
+
export const DEFAULT_FILE_RESOURCE_MOUNT_ROOT = ".opengeni/files" as const;
|
|
466
|
+
|
|
260
467
|
export type FileResourceRef = {
|
|
261
468
|
kind: "file";
|
|
262
469
|
fileId: string;
|
|
263
|
-
/** Optional workspace-relative override; defaults to
|
|
470
|
+
/** Optional workspace-relative override; defaults to `.opengeni/files/<file-id>`. */
|
|
264
471
|
mountPath?: string | undefined;
|
|
265
472
|
};
|
|
266
473
|
|
|
@@ -437,6 +644,22 @@ export type OpenGeniSlackBotInstallStart = {
|
|
|
437
644
|
export type GoogleDriveTargetScope = "user" | "workspace" | "organization";
|
|
438
645
|
export type GoogleDriveSyncCadence = "manual" | "hourly" | "daily";
|
|
439
646
|
export type GoogleDriveReadPolicy = "allow" | "ask" | "block";
|
|
647
|
+
export type GoogleDriveConnectionLifecycleState =
|
|
648
|
+
| "active"
|
|
649
|
+
| "paused"
|
|
650
|
+
| "token_revoked"
|
|
651
|
+
| "app_removed"
|
|
652
|
+
| "disconnected"
|
|
653
|
+
| "reconnect_required"
|
|
654
|
+
| "reconsent_required";
|
|
655
|
+
|
|
656
|
+
export type GoogleDriveConnectionLifecycle =
|
|
657
|
+
| {
|
|
658
|
+
state: Exclude<GoogleDriveConnectionLifecycleState, "app_removed">;
|
|
659
|
+
recoverable: true;
|
|
660
|
+
observedAt: string;
|
|
661
|
+
}
|
|
662
|
+
| { state: "app_removed"; recoverable: false; observedAt: string };
|
|
440
663
|
|
|
441
664
|
export type GoogleDriveSelectedSource = {
|
|
442
665
|
id: string;
|
|
@@ -457,6 +680,7 @@ export type GoogleDriveConnectionMetadata = {
|
|
|
457
680
|
googleDisplayName: string | null;
|
|
458
681
|
verifiedAt: string;
|
|
459
682
|
accessMode: "metadata_readonly" | "readonly";
|
|
683
|
+
lifecycle?: GoogleDriveConnectionLifecycle | undefined;
|
|
460
684
|
selectedSources?: GoogleDriveSelectedSource[] | undefined;
|
|
461
685
|
/** @deprecated Read selectedSources; retained while existing connections migrate. */
|
|
462
686
|
selectedSource?: GoogleDriveSelectedSource | null | undefined;
|
|
@@ -472,6 +696,16 @@ export type GoogleDriveOAuthStartResponse = {
|
|
|
472
696
|
expiresAt: string;
|
|
473
697
|
};
|
|
474
698
|
|
|
699
|
+
export type GoogleDriveLifecycleActionRequest = {
|
|
700
|
+
action: "pause" | "resume";
|
|
701
|
+
expectedVersion: number;
|
|
702
|
+
};
|
|
703
|
+
|
|
704
|
+
export type GoogleDriveDisconnectRequest = {
|
|
705
|
+
expectedVersion: number;
|
|
706
|
+
idempotencyKey: string;
|
|
707
|
+
};
|
|
708
|
+
|
|
475
709
|
export type GoogleDriveBrowseItem = {
|
|
476
710
|
id: string;
|
|
477
711
|
name: string;
|
|
@@ -614,6 +848,8 @@ export type Session = {
|
|
|
614
848
|
// Per-session agent persona/system instructions supplied at create; null when
|
|
615
849
|
// the session carried none. Org-visible metadata, never a timeline event.
|
|
616
850
|
instructions: string | null;
|
|
851
|
+
/** Immutable normalized prompt-policy role; distinct from membership roles. */
|
|
852
|
+
policyRole: string | null;
|
|
617
853
|
resources: ResourceRef[];
|
|
618
854
|
skills: SessionSkill[];
|
|
619
855
|
tools: ToolRef[];
|
|
@@ -794,8 +1030,6 @@ export type HumanInputQuestion = {
|
|
|
794
1030
|
allowOther: boolean;
|
|
795
1031
|
validation?:
|
|
796
1032
|
| {
|
|
797
|
-
minLength?: number | null | undefined;
|
|
798
|
-
maxLength?: number | null | undefined;
|
|
799
1033
|
minSelections?: number | null | undefined;
|
|
800
1034
|
maxSelections?: number | null | undefined;
|
|
801
1035
|
}
|
|
@@ -841,6 +1075,8 @@ export const SESSION_EVENT_TYPES = [
|
|
|
841
1075
|
// Defensive bounded projection for malformed/legacy oversized envelopes.
|
|
842
1076
|
"session.event.envelope_omitted",
|
|
843
1077
|
"session.status.changed",
|
|
1078
|
+
"session.realtime.started",
|
|
1079
|
+
"session.realtime.ended",
|
|
844
1080
|
"session.requiresAction",
|
|
845
1081
|
"session.humanInput.requested",
|
|
846
1082
|
"session.context.compaction.requested",
|
|
@@ -1692,7 +1928,9 @@ export type CreateSessionRequest = {
|
|
|
1692
1928
|
// projection before OpenGeni admits the initial turn. Replays must retain the
|
|
1693
1929
|
// same UUID and idempotency key.
|
|
1694
1930
|
requestedSessionId?: string | undefined;
|
|
1695
|
-
initialMessage
|
|
1931
|
+
initialMessage?: string | undefined;
|
|
1932
|
+
/** Create an idle session shell so realtime voice can be the first interaction. */
|
|
1933
|
+
startMode?: "realtime" | undefined;
|
|
1696
1934
|
/** System instructions scoped to the initial turn; never visible timeline text. */
|
|
1697
1935
|
turnInstructions?: string | undefined;
|
|
1698
1936
|
// Per-session agent persona/system instructions (org-visible metadata, not a
|
|
@@ -1700,6 +1938,8 @@ export type CreateSessionRequest = {
|
|
|
1700
1938
|
// how a host supplies per-agent-type prompts without leaking them into the
|
|
1701
1939
|
// user-visible timeline. Trimmed, non-empty, max 32768 chars.
|
|
1702
1940
|
instructions?: string | undefined;
|
|
1941
|
+
/** Immutable normalized prompt-policy role; distinct from membership roles. */
|
|
1942
|
+
policyRole?: string | undefined;
|
|
1703
1943
|
resources?: ResourceRef[] | undefined;
|
|
1704
1944
|
/** Inline skills fixed onto this session; omitted children inherit them. */
|
|
1705
1945
|
skills?: SessionSkill[] | undefined;
|
|
@@ -1892,6 +2132,7 @@ export type ModelCapabilitiesV1 = {
|
|
|
1892
2132
|
codeExecution: ModelCapabilityStateV1;
|
|
1893
2133
|
};
|
|
1894
2134
|
inputModalities: Array<"text" | "image" | "audio">;
|
|
2135
|
+
inputFileMediaTypes?: string[] | undefined;
|
|
1895
2136
|
outputModalities: Array<"text" | "image" | "audio">;
|
|
1896
2137
|
transports: {
|
|
1897
2138
|
sse: ModelCapabilityStateV1;
|
|
@@ -2163,7 +2404,9 @@ export type CodexAccountOverview = {
|
|
|
2163
2404
|
};
|
|
2164
2405
|
|
|
2165
2406
|
/** Independently settled live overview keyed by workspace credential id. */
|
|
2166
|
-
export type CodexOverviewResponse = {
|
|
2407
|
+
export type CodexOverviewResponse = {
|
|
2408
|
+
accounts: Record<string, CodexAccountOverview>;
|
|
2409
|
+
};
|
|
2167
2410
|
|
|
2168
2411
|
export type CodexAllocatorUpdate = {
|
|
2169
2412
|
allocatorEnabled: boolean;
|
|
@@ -2366,9 +2609,27 @@ export type WorkspaceSettings = {
|
|
|
2366
2609
|
maxNestedAgentDepth?: number | null | undefined;
|
|
2367
2610
|
/** Default for new Codex sessions; absent ⇒ remote_v2. */
|
|
2368
2611
|
codexCompactionDefault?: "remote_v2" | "portable" | undefined;
|
|
2612
|
+
slackReactionSummon?: WorkspaceSlackReactionSummonSettings | undefined;
|
|
2369
2613
|
[key: string]: unknown;
|
|
2370
2614
|
};
|
|
2371
2615
|
|
|
2616
|
+
export type WorkspaceSlackReactionSummonSettings = {
|
|
2617
|
+
enabled: boolean;
|
|
2618
|
+
emoji: string;
|
|
2619
|
+
channelPolicy: { mode: "bot_member" } | { mode: "allowlist"; channelIds: string[] };
|
|
2620
|
+
};
|
|
2621
|
+
|
|
2622
|
+
export type SlackReactionChannel = {
|
|
2623
|
+
id: string;
|
|
2624
|
+
name: string | null;
|
|
2625
|
+
isPrivate: boolean;
|
|
2626
|
+
};
|
|
2627
|
+
|
|
2628
|
+
export type SlackReactionChannelListResponse = {
|
|
2629
|
+
channels: SlackReactionChannel[];
|
|
2630
|
+
nextCursor: string | null;
|
|
2631
|
+
};
|
|
2632
|
+
|
|
2372
2633
|
export type WorkspaceVoiceInputSettings = {
|
|
2373
2634
|
enabled: boolean;
|
|
2374
2635
|
};
|
|
@@ -2379,6 +2640,7 @@ export type UpdateWorkspaceSettingsRequest = {
|
|
|
2379
2640
|
transcription?: WorkspaceTranscriptionPolicy | undefined;
|
|
2380
2641
|
maxNestedAgentDepth?: number | null | undefined;
|
|
2381
2642
|
codexCompactionDefault?: "remote_v2" | "portable" | undefined;
|
|
2643
|
+
slackReactionSummon?: WorkspaceSlackReactionSummonSettings | undefined;
|
|
2382
2644
|
[key: string]: unknown;
|
|
2383
2645
|
};
|
|
2384
2646
|
|
|
@@ -2682,6 +2944,8 @@ export type SessionControlResponse = {
|
|
|
2682
2944
|
effectiveControl: EffectiveSessionControl;
|
|
2683
2945
|
interruptionCount: number;
|
|
2684
2946
|
wakeCount: number;
|
|
2947
|
+
cancelledSessionCount: number;
|
|
2948
|
+
cancelledTurnCount: number;
|
|
2685
2949
|
};
|
|
2686
2950
|
|
|
2687
2951
|
export type WorkspaceInferenceControlResponse = {
|
|
@@ -3130,6 +3394,8 @@ export type KnowledgeSourceKind =
|
|
|
3130
3394
|
| "other";
|
|
3131
3395
|
export type DocumentSearchMode = "hybrid" | "vector" | "keyword";
|
|
3132
3396
|
|
|
3397
|
+
export type DocumentAuthorityKind = "organization" | "workspace" | "personal";
|
|
3398
|
+
|
|
3133
3399
|
export type DocumentVisibility = "workspace" | "private";
|
|
3134
3400
|
|
|
3135
3401
|
export type DocumentCurationStatus = "none" | "pending" | "suggested" | "auto_filed" | "failed";
|
|
@@ -3171,6 +3437,9 @@ export type Document = {
|
|
|
3171
3437
|
sourceUpdatedAt: string | null;
|
|
3172
3438
|
sourceVersion: string | null;
|
|
3173
3439
|
aclTags: string[];
|
|
3440
|
+
authorityKind: DocumentAuthorityKind;
|
|
3441
|
+
authorityWorkspaceId: string | null;
|
|
3442
|
+
authoritySubjectId: string | null;
|
|
3174
3443
|
visibility: DocumentVisibility;
|
|
3175
3444
|
createdBy: string | null;
|
|
3176
3445
|
agentAccess: boolean;
|
|
@@ -3205,6 +3474,9 @@ export type DocumentSearchResult = {
|
|
|
3205
3474
|
sourceUpdatedAt: string | null;
|
|
3206
3475
|
sourceVersion: string | null;
|
|
3207
3476
|
aclTags: string[];
|
|
3477
|
+
authorityKind: DocumentAuthorityKind;
|
|
3478
|
+
authorityWorkspaceId: string | null;
|
|
3479
|
+
authoritySubjectId: string | null;
|
|
3208
3480
|
};
|
|
3209
3481
|
|
|
3210
3482
|
export type CreateDocumentBaseRequest = {
|
|
@@ -3224,6 +3496,7 @@ export type AddDocumentRequest = {
|
|
|
3224
3496
|
sourceUpdatedAt?: string | undefined;
|
|
3225
3497
|
sourceVersion?: string | undefined;
|
|
3226
3498
|
aclTags?: string[] | undefined;
|
|
3499
|
+
authorityKind?: DocumentAuthorityKind | undefined;
|
|
3227
3500
|
visibility?: DocumentVisibility | undefined;
|
|
3228
3501
|
agentAccess?: boolean | undefined;
|
|
3229
3502
|
};
|
|
@@ -3233,6 +3506,7 @@ export type CreateKnowledgeDropRequest = {
|
|
|
3233
3506
|
fileId?: string | undefined;
|
|
3234
3507
|
filename?: string | undefined;
|
|
3235
3508
|
title?: string | undefined;
|
|
3509
|
+
authorityKind?: DocumentAuthorityKind | undefined;
|
|
3236
3510
|
visibility?: DocumentVisibility | undefined;
|
|
3237
3511
|
agentAccess?: boolean | undefined;
|
|
3238
3512
|
};
|
|
@@ -29,6 +29,7 @@ export type WorkspaceInstructionPolicyRevisionIdentity = {
|
|
|
29
29
|
|
|
30
30
|
export type WorkspaceInstructionPolicyRevision = WorkspaceInstructionPolicyRevisionIdentity &
|
|
31
31
|
WorkspaceInstructionPolicyTarget & {
|
|
32
|
+
operationId: string;
|
|
32
33
|
accountId: string;
|
|
33
34
|
workspaceId: string;
|
|
34
35
|
content: string;
|
|
@@ -52,6 +53,7 @@ export type WorkspaceInstructionPolicyHead = WorkspaceInstructionPolicyTarget &
|
|
|
52
53
|
|
|
53
54
|
export type WorkspaceInstructionPolicyActivationEvent = WorkspaceInstructionPolicyTarget & {
|
|
54
55
|
id: string;
|
|
56
|
+
operationId: string;
|
|
55
57
|
accountId: string;
|
|
56
58
|
workspaceId: string;
|
|
57
59
|
type: WorkspaceInstructionPolicyActivationType;
|
|
@@ -64,6 +66,7 @@ export type WorkspaceInstructionPolicyActivationEvent = WorkspaceInstructionPoli
|
|
|
64
66
|
};
|
|
65
67
|
|
|
66
68
|
export type CreateWorkspaceInstructionPolicyDraftRequest = WorkspaceInstructionPolicyTarget & {
|
|
69
|
+
operationId?: string;
|
|
67
70
|
content: string;
|
|
68
71
|
provenanceSource?: WorkspaceInstructionPolicyDraftProvenanceSource;
|
|
69
72
|
provenanceSourceId?: string | null;
|
|
@@ -71,6 +74,7 @@ export type CreateWorkspaceInstructionPolicyDraftRequest = WorkspaceInstructionP
|
|
|
71
74
|
};
|
|
72
75
|
|
|
73
76
|
export type ImportLegacyWorkspaceInstructionPolicyDraftRequest = {
|
|
77
|
+
operationId?: string;
|
|
74
78
|
supersedesRevisionId?: string | null;
|
|
75
79
|
};
|
|
76
80
|
|
|
@@ -102,13 +106,17 @@ export type WorkspaceInstructionPolicyDiffResponse = {
|
|
|
102
106
|
};
|
|
103
107
|
|
|
104
108
|
export type ActivateWorkspaceInstructionPolicyRequest = {
|
|
109
|
+
operationId?: string;
|
|
105
110
|
expectedCurrentRevisionId: string | null;
|
|
111
|
+
expectedActivationVersion?: number;
|
|
106
112
|
reason: string;
|
|
107
113
|
};
|
|
108
114
|
|
|
109
115
|
export type RollbackWorkspaceInstructionPolicyRequest = {
|
|
116
|
+
operationId?: string;
|
|
110
117
|
targetRevisionId: string;
|
|
111
118
|
expectedCurrentRevisionId: string;
|
|
119
|
+
expectedActivationVersion?: number;
|
|
112
120
|
reason: string;
|
|
113
121
|
};
|
|
114
122
|
|
|
@@ -122,3 +130,8 @@ export type WorkspaceInstructionPolicyConflictResponse = {
|
|
|
122
130
|
message: string;
|
|
123
131
|
currentHead: WorkspaceInstructionPolicyHead | null;
|
|
124
132
|
};
|
|
133
|
+
|
|
134
|
+
export type WorkspaceInstructionPolicyOperationReuseResponse = {
|
|
135
|
+
code: "WORKSPACE_INSTRUCTION_POLICY_OPERATION_REUSED";
|
|
136
|
+
message: string;
|
|
137
|
+
};
|
package/src/workspace-state.ts
CHANGED
|
@@ -49,15 +49,93 @@ export type WorkspaceStateGapCode =
|
|
|
49
49
|
| "pending_memory_review"
|
|
50
50
|
| "partial_inventory";
|
|
51
51
|
|
|
52
|
+
export type WorkspaceStateGovernanceDriftStatus =
|
|
53
|
+
| "identical"
|
|
54
|
+
| "changed"
|
|
55
|
+
| "superseded"
|
|
56
|
+
| "missing"
|
|
57
|
+
| "unavailable"
|
|
58
|
+
| "truncated";
|
|
59
|
+
|
|
60
|
+
export type WorkspaceStateGetOptions = { attemptId?: string };
|
|
61
|
+
|
|
62
|
+
export type WorkspaceStateAttemptGovernance =
|
|
63
|
+
| { status: "not_requested" }
|
|
64
|
+
| {
|
|
65
|
+
status: "unavailable";
|
|
66
|
+
reason: "attempt_not_found_or_not_authorized";
|
|
67
|
+
driftStatus: "unavailable";
|
|
68
|
+
}
|
|
69
|
+
| {
|
|
70
|
+
status: "available";
|
|
71
|
+
attemptId: string;
|
|
72
|
+
executionGeneration: number;
|
|
73
|
+
acceptedAt: string;
|
|
74
|
+
policySnapshot:
|
|
75
|
+
| { status: "missing" }
|
|
76
|
+
| {
|
|
77
|
+
status: "available";
|
|
78
|
+
id: string;
|
|
79
|
+
createdAt: string;
|
|
80
|
+
entryHash: string;
|
|
81
|
+
policyRole: string | null;
|
|
82
|
+
roleSource:
|
|
83
|
+
| "session_binding"
|
|
84
|
+
| "metadata_fallback"
|
|
85
|
+
| "none"
|
|
86
|
+
| "invalid_metadata_fallback";
|
|
87
|
+
entries: Array<{
|
|
88
|
+
kind: WorkspaceInstructionPolicyKind;
|
|
89
|
+
scope: WorkspaceInstructionPolicyScope;
|
|
90
|
+
roleKey: string | null;
|
|
91
|
+
revisionId: string;
|
|
92
|
+
revision: number;
|
|
93
|
+
contentHash: string;
|
|
94
|
+
activationVersion: number;
|
|
95
|
+
activatedAt: string;
|
|
96
|
+
provenance: {
|
|
97
|
+
source: WorkspaceInstructionPolicyProvenanceSource;
|
|
98
|
+
sourceIdHash: string | null;
|
|
99
|
+
};
|
|
100
|
+
}>;
|
|
101
|
+
};
|
|
102
|
+
preferenceSnapshot:
|
|
103
|
+
| { status: "missing" }
|
|
104
|
+
| {
|
|
105
|
+
status: "available";
|
|
106
|
+
id: string;
|
|
107
|
+
createdAt: string;
|
|
108
|
+
descriptorHash: string;
|
|
109
|
+
descriptorCount: number;
|
|
110
|
+
truncated: boolean;
|
|
111
|
+
};
|
|
112
|
+
drift: {
|
|
113
|
+
overall: WorkspaceStateGovernanceDriftStatus;
|
|
114
|
+
policy: {
|
|
115
|
+
status: WorkspaceStateGovernanceDriftStatus;
|
|
116
|
+
snapshotHash: string | null;
|
|
117
|
+
currentHash: string | null;
|
|
118
|
+
snapshotTargetCount: number;
|
|
119
|
+
currentTargetCount: number;
|
|
120
|
+
};
|
|
121
|
+
preferences: {
|
|
122
|
+
status: WorkspaceStateGovernanceDriftStatus;
|
|
123
|
+
snapshotHash: string | null;
|
|
124
|
+
currentHash: string | null;
|
|
125
|
+
snapshotDescriptorCount: number;
|
|
126
|
+
currentDescriptorCount: number;
|
|
127
|
+
snapshotTruncated: boolean;
|
|
128
|
+
currentTruncated: boolean;
|
|
129
|
+
};
|
|
130
|
+
};
|
|
131
|
+
};
|
|
132
|
+
|
|
52
133
|
export type WorkspaceStateResponse = {
|
|
53
134
|
workspaceId: string;
|
|
54
135
|
generatedAt: string;
|
|
55
136
|
truth: {
|
|
56
137
|
current: { source: "read_time_projection"; capturedAt: string };
|
|
57
|
-
|
|
58
|
-
status: "not_captured";
|
|
59
|
-
reason: "workspace_instruction_policy_snapshot_not_implemented";
|
|
60
|
-
};
|
|
138
|
+
attemptGovernance: WorkspaceStateAttemptGovernance;
|
|
61
139
|
};
|
|
62
140
|
policy: {
|
|
63
141
|
authority: "workspace_instruction_policy_heads";
|