@opengeni/sdk 6.1.0 → 7.0.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 +84 -45
- package/dist/artifacts.js +4 -4
- package/dist/browser.d.ts +2 -0
- package/dist/browser.js +2 -2
- package/dist/chat/index.js +5 -5
- package/dist/{chunk-64S3VKJU.js → chunk-7ESHQLTB.js} +130 -83
- package/dist/chunk-7ESHQLTB.js.map +1 -0
- package/dist/{chunk-IZH5F7QC.js → chunk-L3MYVTPO.js} +10 -2
- package/dist/chunk-L3MYVTPO.js.map +1 -0
- package/dist/{chunk-CFSYTYMA.js → chunk-MXQX4M36.js} +2 -2
- package/dist/{chunk-VDACQXJZ.js → chunk-N76DIO4E.js} +8 -87
- package/dist/chunk-N76DIO4E.js.map +1 -0
- package/dist/{chunk-CMEU67C4.js → chunk-P7OFNKCH.js} +2 -2
- package/dist/chunk-P7OFNKCH.js.map +1 -0
- package/dist/{chunk-4ZQQQBOH.js → chunk-RCVWE6UR.js} +2 -2
- package/dist/client.d.ts +47 -21
- package/dist/core.js +3 -3
- package/dist/document-authority-client.d.ts +3 -1
- package/dist/document-authority.js +3 -3
- package/dist/editable-artifacts.js +13 -2
- package/dist/editable-artifacts.js.map +1 -1
- package/dist/embedding-client.d.ts +3 -21
- package/dist/index.d.ts +3 -1
- package/dist/index.js +6 -6
- package/dist/knowledge.d.ts +5 -3
- package/dist/knowledge.js +12 -3
- package/dist/knowledge.js.map +1 -1
- package/dist/organization-integration-policy.d.ts +26 -0
- package/dist/organization-integration-policy.js +26 -0
- package/dist/organization-integration-policy.js.map +1 -0
- package/dist/session-message-search.d.ts +41 -0
- package/dist/site-browser-runtime.gen.d.ts +1 -1
- package/dist/site-document.js +1 -1
- package/dist/site-document.js.map +1 -1
- package/dist/site.js +3 -3
- package/dist/skills.d.ts +3 -0
- package/dist/types.d.ts +168 -380
- package/package.json +7 -3
- package/src/browser.ts +12 -0
- package/src/client.ts +206 -136
- package/src/document-authority-client.ts +15 -0
- package/src/editable-artifacts/controller.ts +25 -1
- package/src/embedding-client.ts +10 -134
- package/src/index.ts +25 -34
- package/src/knowledge.ts +22 -1
- package/src/organization-integration-policy.ts +54 -0
- package/src/session-message-search.ts +39 -0
- package/src/site-browser-runtime.gen.ts +1 -1
- package/src/skills.ts +3 -0
- package/src/types.ts +176 -432
- package/dist/chunk-64S3VKJU.js.map +0 -1
- package/dist/chunk-CMEU67C4.js.map +0 -1
- package/dist/chunk-IZH5F7QC.js.map +0 -1
- package/dist/chunk-VDACQXJZ.js.map +0 -1
- /package/dist/{chunk-CFSYTYMA.js.map → chunk-MXQX4M36.js.map} +0 -0
- /package/dist/{chunk-4ZQQQBOH.js.map → chunk-RCVWE6UR.js.map} +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opengeni/sdk",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "7.0.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": {
|
|
@@ -74,6 +74,10 @@
|
|
|
74
74
|
"types": "./dist/pr-review.d.ts",
|
|
75
75
|
"import": "./dist/pr-review.js"
|
|
76
76
|
},
|
|
77
|
+
"./organization-integration-policy": {
|
|
78
|
+
"types": "./dist/organization-integration-policy.d.ts",
|
|
79
|
+
"import": "./dist/organization-integration-policy.js"
|
|
80
|
+
},
|
|
77
81
|
"./organization-private-session-settings": {
|
|
78
82
|
"types": "./dist/organization-private-session-settings.d.ts",
|
|
79
83
|
"import": "./dist/organization-private-session-settings.js"
|
|
@@ -125,8 +129,8 @@
|
|
|
125
129
|
"prepublishOnly": "bash ../../scripts/prepublish-guard"
|
|
126
130
|
},
|
|
127
131
|
"dependencies": {
|
|
128
|
-
"@opengeni/connect": "^0.
|
|
129
|
-
"@opengeni/contracts": "^
|
|
132
|
+
"@opengeni/connect": "^0.3.0",
|
|
133
|
+
"@opengeni/contracts": "^5.0.0"
|
|
130
134
|
},
|
|
131
135
|
"engines": {
|
|
132
136
|
"node": ">=18"
|
package/src/browser.ts
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
/** Browser-console client. Optional SDK surfaces must not enter this eager graph. */
|
|
2
2
|
export { OpenGeniClient as OpenGeniBrowserClient } from "./client";
|
|
3
|
+
export type {
|
|
4
|
+
SessionMessageSearchRequest,
|
|
5
|
+
SessionMessageSearchMatch,
|
|
6
|
+
SessionMessageSearchResponse,
|
|
7
|
+
} from "./session-message-search";
|
|
3
8
|
export {
|
|
4
9
|
OpenGeniToolCallError,
|
|
5
10
|
OpenGeniToolReapprovalRequiredError,
|
|
@@ -35,3 +40,10 @@ export {
|
|
|
35
40
|
export type { OpenGeniSecureContextRequiredReason } from "./errors";
|
|
36
41
|
export { resolveWorkspaceVoiceInputEnabled } from "./transcription";
|
|
37
42
|
export { OPENGENI_API_CONTRACT_HEADER, OPENGENI_API_CONTRACT_REVISION } from "./types";
|
|
43
|
+
|
|
44
|
+
export type {
|
|
45
|
+
ConnectorToolPermission,
|
|
46
|
+
ConnectorToolPermissionEntry,
|
|
47
|
+
ConnectorToolPermissionsResponse,
|
|
48
|
+
UpdateConnectorToolPermissionsRequest,
|
|
49
|
+
} from "./types";
|
package/src/client.ts
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import type { ArtifactCatalogListOptions, ArtifactCatalogListResponse } from "./artifact-catalog";
|
|
2
|
+
import type {
|
|
3
|
+
SessionMessageSearchRequest,
|
|
4
|
+
SessionMessageSearchResponse,
|
|
5
|
+
} from "./session-message-search";
|
|
2
6
|
import type {
|
|
3
7
|
KnowledgeOriginalFileDownload,
|
|
4
8
|
AgentLearningContext,
|
|
@@ -151,6 +155,7 @@ import type {
|
|
|
151
155
|
BillingEntitlementsResponse,
|
|
152
156
|
CodexAccount,
|
|
153
157
|
CodexAccountsResponse,
|
|
158
|
+
SessionCodexAccountsResponse,
|
|
154
159
|
CodexAppsUpdate,
|
|
155
160
|
CodexRotationSettings,
|
|
156
161
|
CodexOverviewResponse,
|
|
@@ -181,6 +186,8 @@ import type {
|
|
|
181
186
|
BeginSessionRealtimeRequest,
|
|
182
187
|
CapabilityCatalogItem,
|
|
183
188
|
CapabilityCatalogResponse,
|
|
189
|
+
ConnectorToolPermissionsResponse,
|
|
190
|
+
UpdateConnectorToolPermissionsRequest,
|
|
184
191
|
CapabilityInstallation,
|
|
185
192
|
ApiIntegrationPreview,
|
|
186
193
|
ApiIntegrationOAuthStartRequest,
|
|
@@ -278,8 +285,6 @@ import type {
|
|
|
278
285
|
CreateWorkspaceRequest,
|
|
279
286
|
EnsureWorkspaceRequest,
|
|
280
287
|
EnsureWorkspaceResponse,
|
|
281
|
-
// Enrollment UX (design 11): the click-Grant approve-page lookup/deny + headless
|
|
282
|
-
// enroll-token mint.
|
|
283
288
|
DeviceEnrollmentApproveRequest,
|
|
284
289
|
DeviceEnrollmentApproveResponse,
|
|
285
290
|
DeviceEnrollmentDenyResponse,
|
|
@@ -290,10 +295,8 @@ import type {
|
|
|
290
295
|
Document,
|
|
291
296
|
DocumentBase,
|
|
292
297
|
EnableCapabilityRequest,
|
|
293
|
-
EnablePackRequest,
|
|
294
298
|
FileAsset,
|
|
295
299
|
FileDownloadUrlResponse,
|
|
296
|
-
GetPackResponse,
|
|
297
300
|
GitHubActionPoliciesResponse,
|
|
298
301
|
GitHubActionPolicyActorState,
|
|
299
302
|
GitHubAppInfo,
|
|
@@ -307,8 +310,6 @@ import type {
|
|
|
307
310
|
ListManagedOrganizationMembershipsResponse,
|
|
308
311
|
ListUserResourceAuthoritiesOptions,
|
|
309
312
|
ListUserResourceAuthoritiesResponse,
|
|
310
|
-
IssueUserResourceGrantRequest,
|
|
311
|
-
UserResourceGrantMutationResponse,
|
|
312
313
|
UpdateGitHubActionPolicyRequest,
|
|
313
314
|
RevokeUserResourceGrantResponse,
|
|
314
315
|
ListOrganizationInvitationsPageResponse,
|
|
@@ -344,8 +345,6 @@ import type {
|
|
|
344
345
|
StartOrganizationRecoveryOperationRequest,
|
|
345
346
|
UpdateOrganizationWorkspaceRequest,
|
|
346
347
|
UpdateOrganizationRetentionPolicyRequest,
|
|
347
|
-
ListPacksResponse,
|
|
348
|
-
// Bring-your-own-compute: the Machines dashboard + per-machine metrics (M10).
|
|
349
348
|
MachinesResponse,
|
|
350
349
|
MetricSample,
|
|
351
350
|
MachineMetricsSeriesResponse,
|
|
@@ -354,20 +353,15 @@ import type {
|
|
|
354
353
|
MachineOperationPolicy,
|
|
355
354
|
UpdateMachineOperationPolicyRequest,
|
|
356
355
|
UpdateMachineAgentResponse,
|
|
357
|
-
// Bring-your-own-compute: the user-authenticated active-sandbox swap (M7).
|
|
358
356
|
SwapActiveSandboxRequest,
|
|
359
357
|
SwapActiveSandboxResponse,
|
|
360
358
|
ListWorkspaceMembersResponse,
|
|
361
359
|
ListWorkspaceMemberCandidatesResponse,
|
|
362
|
-
InstallPackRequest,
|
|
363
|
-
PackInstallationPreview,
|
|
364
360
|
ListSlackUserLinkAccessRequestsResponse,
|
|
365
361
|
PrepareSlackUserLinkAccessRequest,
|
|
366
362
|
SlackUserLinkAccessMutationRequest,
|
|
367
363
|
SlackUserLinkAccessRequest,
|
|
368
364
|
ApproveSlackUserLinkAccessRequest,
|
|
369
|
-
PackInstallation,
|
|
370
|
-
PackUninstallPreview,
|
|
371
365
|
RetainedScreenshotDownload,
|
|
372
366
|
RetainedScreenshotDownloadOptions,
|
|
373
367
|
RetainedArtifactDownload,
|
|
@@ -381,8 +375,6 @@ import type {
|
|
|
381
375
|
VideoGenerationOperationSummary,
|
|
382
376
|
VideoGenerationPolicy,
|
|
383
377
|
WorkspaceVideoGenerationSettings,
|
|
384
|
-
RegisterCapabilityPackRequest,
|
|
385
|
-
PreviewPackInstallationRequest,
|
|
386
378
|
PreviewSkillImportRequest,
|
|
387
379
|
ScheduledTask,
|
|
388
380
|
ScheduledTaskRun,
|
|
@@ -402,8 +394,6 @@ import type {
|
|
|
402
394
|
UpdateSessionPinRequest,
|
|
403
395
|
UpdateSessionVisibilityRequest,
|
|
404
396
|
UpdateSessionVisibilityResponse,
|
|
405
|
-
UninstallPackRequest,
|
|
406
|
-
UninstallPackResult,
|
|
407
397
|
SessionScopeSubjectId,
|
|
408
398
|
SessionEvent,
|
|
409
399
|
SessionEventCompactResult,
|
|
@@ -440,11 +430,15 @@ import type {
|
|
|
440
430
|
SaveNewSessionDraftRequest,
|
|
441
431
|
SteerSessionQueueItemRequest,
|
|
442
432
|
SessionControlResponse,
|
|
433
|
+
SessionRetryRequest,
|
|
434
|
+
SandboxRecoveryProjection,
|
|
435
|
+
SandboxRecoveryRequest,
|
|
436
|
+
SandboxRecoveryResponse,
|
|
437
|
+
SessionRetryResponse,
|
|
443
438
|
WorkspaceInferenceControlResponse,
|
|
444
439
|
WorkspaceControlEvent,
|
|
445
440
|
SessionTurn,
|
|
446
441
|
SubmitHumanInputResponseRequest,
|
|
447
|
-
// Stream surfacing (Phase 5): capability negotiation + viewer lifecycle + config.
|
|
448
442
|
SessionCapabilities,
|
|
449
443
|
AttachViewerRequest,
|
|
450
444
|
AttachViewerResponse,
|
|
@@ -452,7 +446,6 @@ import type {
|
|
|
452
446
|
AcknowledgeStreamResponse,
|
|
453
447
|
ViewerHeartbeatRequest,
|
|
454
448
|
ViewerHeartbeatResponse,
|
|
455
|
-
// Channel-A structured services (P4.4).
|
|
456
449
|
FsListRequest,
|
|
457
450
|
FsListResponse,
|
|
458
451
|
FsListBatchRequest,
|
|
@@ -479,7 +472,6 @@ import type {
|
|
|
479
472
|
GitLogResponse,
|
|
480
473
|
GitShowRequest,
|
|
481
474
|
GitShowResponse,
|
|
482
|
-
// Workbench v2 turn-end capture reads (M2).
|
|
483
475
|
GetWorkspaceCaptureResponse,
|
|
484
476
|
GetWorkspaceCaptureFileResponse,
|
|
485
477
|
TerminalExecRequest,
|
|
@@ -521,7 +513,6 @@ import type {
|
|
|
521
513
|
ProposeRigChangeRequest,
|
|
522
514
|
WorkspaceMember,
|
|
523
515
|
WorkspaceMemberCandidate,
|
|
524
|
-
WorkspaceRegisteredPack,
|
|
525
516
|
Workspace,
|
|
526
517
|
ListConnectionsResponse,
|
|
527
518
|
ListSlackInstallationBindingsResponse,
|
|
@@ -644,6 +635,8 @@ export type SessionListPageOptions = {
|
|
|
644
635
|
pinsOnly?: boolean;
|
|
645
636
|
/** Return archived root chats instead of the active session list. */
|
|
646
637
|
archivedOnly?: boolean;
|
|
638
|
+
sortBy?: "updatedAt" | "createdAt" | "name";
|
|
639
|
+
archiveStatus?: "active" | "archived" | "all";
|
|
647
640
|
/** Stop this caller's finite page read when its owning route is abandoned. */
|
|
648
641
|
signal?: AbortSignal | undefined;
|
|
649
642
|
};
|
|
@@ -1312,6 +1305,31 @@ export class OpenGeniClient {
|
|
|
1312
1305
|
);
|
|
1313
1306
|
}
|
|
1314
1307
|
|
|
1308
|
+
/** Search durable visible user/assistant text, including unloaded history.
|
|
1309
|
+
* Pages may be empty with hasMore=true. Never fall back to title search on
|
|
1310
|
+
* older servers. Use listEventPage before/after the returned sequence for context.
|
|
1311
|
+
*/
|
|
1312
|
+
async searchSessionMessages(
|
|
1313
|
+
workspaceId: string,
|
|
1314
|
+
request: SessionMessageSearchRequest,
|
|
1315
|
+
options: OpenGeniRequestOptions = {},
|
|
1316
|
+
): Promise<SessionMessageSearchResponse> {
|
|
1317
|
+
return this.requestJson<SessionMessageSearchResponse>(
|
|
1318
|
+
"GET",
|
|
1319
|
+
`/v1/workspaces/${workspaceId}/session-message-search`,
|
|
1320
|
+
undefined,
|
|
1321
|
+
{
|
|
1322
|
+
query: request.query,
|
|
1323
|
+
...(request.sessionId !== undefined ? { sessionId: request.sessionId } : {}),
|
|
1324
|
+
...(request.groupBy !== undefined ? { groupBy: request.groupBy } : {}),
|
|
1325
|
+
...(request.archiveStatus !== undefined ? { archiveStatus: request.archiveStatus } : {}),
|
|
1326
|
+
...(request.limit !== undefined ? { limit: String(request.limit) } : {}),
|
|
1327
|
+
...(request.cursor !== undefined ? { cursor: request.cursor } : {}),
|
|
1328
|
+
},
|
|
1329
|
+
options,
|
|
1330
|
+
);
|
|
1331
|
+
}
|
|
1332
|
+
|
|
1315
1333
|
async listSessions(
|
|
1316
1334
|
workspaceId: string,
|
|
1317
1335
|
options: {
|
|
@@ -1397,6 +1415,8 @@ export class OpenGeniClient {
|
|
|
1397
1415
|
...(options.createdBefore ? { createdBefore: options.createdBefore } : {}),
|
|
1398
1416
|
...(options.pinsOnly ? { pinsOnly: "true" } : {}),
|
|
1399
1417
|
...(options.archivedOnly ? { archivedOnly: "true" } : {}),
|
|
1418
|
+
...(options.sortBy ? { sortBy: options.sortBy } : {}),
|
|
1419
|
+
...(options.archiveStatus ? { archiveStatus: options.archiveStatus } : {}),
|
|
1400
1420
|
},
|
|
1401
1421
|
{ signal: options.signal },
|
|
1402
1422
|
);
|
|
@@ -1412,6 +1432,16 @@ export class OpenGeniClient {
|
|
|
1412
1432
|
}
|
|
1413
1433
|
throw error;
|
|
1414
1434
|
}
|
|
1435
|
+
if (
|
|
1436
|
+
(options.sortBy !== undefined &&
|
|
1437
|
+
(Array.isArray(response) || response.sortBy !== options.sortBy)) ||
|
|
1438
|
+
(options.archiveStatus !== undefined &&
|
|
1439
|
+
(Array.isArray(response) || response.archiveStatus !== options.archiveStatus))
|
|
1440
|
+
) {
|
|
1441
|
+
throw new Error(
|
|
1442
|
+
"The connected OpenGeni API does not support the requested session sorting/archive filter",
|
|
1443
|
+
);
|
|
1444
|
+
}
|
|
1415
1445
|
if (Array.isArray(response)) {
|
|
1416
1446
|
// Rolling/same-major compatibility: an older API ignores `view=page` and
|
|
1417
1447
|
// returns the historical array. That is an honest one-page projection;
|
|
@@ -2489,6 +2519,43 @@ export class OpenGeniClient {
|
|
|
2489
2519
|
);
|
|
2490
2520
|
}
|
|
2491
2521
|
|
|
2522
|
+
/** Inspect bounded checkpoint recovery eligibility without changing session state. */
|
|
2523
|
+
async getSandboxRecovery(
|
|
2524
|
+
workspaceId: string,
|
|
2525
|
+
sessionId: string,
|
|
2526
|
+
): Promise<SandboxRecoveryProjection> {
|
|
2527
|
+
return this.requestJson(
|
|
2528
|
+
"GET",
|
|
2529
|
+
`/v1/workspaces/${workspaceId}/sessions/${sessionId}/sandbox-recovery`,
|
|
2530
|
+
);
|
|
2531
|
+
}
|
|
2532
|
+
|
|
2533
|
+
/** Restore only the explicitly selected checkpoint; never retry a command. */
|
|
2534
|
+
async recoverSandbox(
|
|
2535
|
+
workspaceId: string,
|
|
2536
|
+
sessionId: string,
|
|
2537
|
+
request: SandboxRecoveryRequest,
|
|
2538
|
+
): Promise<SandboxRecoveryResponse> {
|
|
2539
|
+
return this.requestSessionCommand(
|
|
2540
|
+
"POST",
|
|
2541
|
+
`/v1/workspaces/${workspaceId}/sessions/${sessionId}/sandbox-recovery`,
|
|
2542
|
+
request,
|
|
2543
|
+
);
|
|
2544
|
+
}
|
|
2545
|
+
|
|
2546
|
+
/** Retry the exact failed turn. Keep clientEventId unchanged on transport retries. */
|
|
2547
|
+
async retrySession(
|
|
2548
|
+
workspaceId: string,
|
|
2549
|
+
sessionId: string,
|
|
2550
|
+
request: SessionRetryRequest,
|
|
2551
|
+
): Promise<SessionRetryResponse> {
|
|
2552
|
+
return await this.requestSessionCommand<SessionRetryResponse>(
|
|
2553
|
+
"POST",
|
|
2554
|
+
`/v1/workspaces/${workspaceId}/sessions/${sessionId}/retry`,
|
|
2555
|
+
request,
|
|
2556
|
+
);
|
|
2557
|
+
}
|
|
2558
|
+
|
|
2492
2559
|
async controlSession(
|
|
2493
2560
|
workspaceId: string,
|
|
2494
2561
|
sessionId: string,
|
|
@@ -4499,19 +4566,6 @@ export class OpenGeniClient {
|
|
|
4499
4566
|
);
|
|
4500
4567
|
}
|
|
4501
4568
|
|
|
4502
|
-
/** Issue an exact-session or standing personal-resource grant. */
|
|
4503
|
-
async issueUserResourceGrant(
|
|
4504
|
-
workspaceId: string,
|
|
4505
|
-
authorityId: string,
|
|
4506
|
-
request: IssueUserResourceGrantRequest,
|
|
4507
|
-
): Promise<UserResourceGrantMutationResponse> {
|
|
4508
|
-
return await this.requestJson<UserResourceGrantMutationResponse>(
|
|
4509
|
-
"POST",
|
|
4510
|
-
`/v1/workspaces/${workspaceId}/user-resource-authorities/${authorityId}/grants`,
|
|
4511
|
-
request,
|
|
4512
|
-
);
|
|
4513
|
-
}
|
|
4514
|
-
|
|
4515
4569
|
/** Revoke an owner grant through the exact workspace it targets. */
|
|
4516
4570
|
async revokeUserResourceGrant(
|
|
4517
4571
|
workspaceId: string,
|
|
@@ -6101,11 +6155,11 @@ export class OpenGeniClient {
|
|
|
6101
6155
|
async getFile(
|
|
6102
6156
|
workspaceId: string,
|
|
6103
6157
|
fileId: string,
|
|
6104
|
-
options: OpenGeniRequestOptions = {},
|
|
6158
|
+
options: OpenGeniRequestOptions & { sessionId?: string | undefined } = {},
|
|
6105
6159
|
): Promise<FileAsset> {
|
|
6106
6160
|
return await this.requestJson<FileAsset>(
|
|
6107
6161
|
"GET",
|
|
6108
|
-
`/v1/workspaces/${workspaceId}/files/${fileId}`,
|
|
6162
|
+
`/v1/workspaces/${workspaceId}/files/${fileId}${options.sessionId ? `?sessionId=${encodeURIComponent(options.sessionId)}` : ""}`,
|
|
6109
6163
|
undefined,
|
|
6110
6164
|
{},
|
|
6111
6165
|
options,
|
|
@@ -6321,11 +6375,11 @@ export class OpenGeniClient {
|
|
|
6321
6375
|
async createFileDownloadUrl(
|
|
6322
6376
|
workspaceId: string,
|
|
6323
6377
|
fileId: string,
|
|
6324
|
-
options: OpenGeniRequestOptions = {},
|
|
6378
|
+
options: OpenGeniRequestOptions & { sessionId?: string | undefined } = {},
|
|
6325
6379
|
): Promise<FileDownloadUrlResponse> {
|
|
6326
6380
|
return await this.requestJson<FileDownloadUrlResponse>(
|
|
6327
6381
|
"POST",
|
|
6328
|
-
`/v1/workspaces/${workspaceId}/files/${fileId}/download-url`,
|
|
6382
|
+
`/v1/workspaces/${workspaceId}/files/${fileId}/download-url${options.sessionId ? `?sessionId=${encodeURIComponent(options.sessionId)}` : ""}`,
|
|
6329
6383
|
undefined,
|
|
6330
6384
|
{},
|
|
6331
6385
|
options,
|
|
@@ -6687,105 +6741,7 @@ export class OpenGeniClient {
|
|
|
6687
6741
|
);
|
|
6688
6742
|
}
|
|
6689
6743
|
|
|
6690
|
-
// --- Capability packs ------------------------------------------------------------------
|
|
6691
|
-
|
|
6692
|
-
/** Built-in + registered packs, with the workspace's installations. */
|
|
6693
|
-
async listPacks(workspaceId: string): Promise<ListPacksResponse> {
|
|
6694
|
-
return await this.requestJson<ListPacksResponse>("GET", `/v1/workspaces/${workspaceId}/packs`);
|
|
6695
|
-
}
|
|
6696
|
-
|
|
6697
|
-
/** Register (or replace) a workspace-scoped pack from a manifest. */
|
|
6698
|
-
async registerPack(
|
|
6699
|
-
workspaceId: string,
|
|
6700
|
-
manifest: RegisterCapabilityPackRequest,
|
|
6701
|
-
): Promise<WorkspaceRegisteredPack> {
|
|
6702
|
-
return await this.requestJson<WorkspaceRegisteredPack>(
|
|
6703
|
-
"POST",
|
|
6704
|
-
`/v1/workspaces/${workspaceId}/packs`,
|
|
6705
|
-
manifest,
|
|
6706
|
-
);
|
|
6707
|
-
}
|
|
6708
|
-
|
|
6709
|
-
async getPack(workspaceId: string, packId: string): Promise<GetPackResponse> {
|
|
6710
|
-
return await this.requestJson<GetPackResponse>(
|
|
6711
|
-
"GET",
|
|
6712
|
-
`/v1/workspaces/${workspaceId}/packs/${encodeURIComponent(packId)}`,
|
|
6713
|
-
);
|
|
6714
|
-
}
|
|
6715
|
-
|
|
6716
|
-
async enablePack(
|
|
6717
|
-
workspaceId: string,
|
|
6718
|
-
packId: string,
|
|
6719
|
-
request: EnablePackRequest = {},
|
|
6720
|
-
): Promise<PackInstallation> {
|
|
6721
|
-
return await this.requestJson<PackInstallation>(
|
|
6722
|
-
"POST",
|
|
6723
|
-
`/v1/workspaces/${workspaceId}/packs/${encodeURIComponent(packId)}/enable`,
|
|
6724
|
-
request,
|
|
6725
|
-
);
|
|
6726
|
-
}
|
|
6727
|
-
|
|
6728
6744
|
/** Resolve pinned components, Variable Set, and Rig requirements before installation. */
|
|
6729
|
-
async previewPackInstallation(
|
|
6730
|
-
workspaceId: string,
|
|
6731
|
-
packId: string,
|
|
6732
|
-
request: PreviewPackInstallationRequest = {},
|
|
6733
|
-
): Promise<PackInstallationPreview> {
|
|
6734
|
-
return await this.requestJson<PackInstallationPreview>(
|
|
6735
|
-
"POST",
|
|
6736
|
-
`/v1/workspaces/${workspaceId}/packs/${encodeURIComponent(packId)}/installation-preview`,
|
|
6737
|
-
request,
|
|
6738
|
-
);
|
|
6739
|
-
}
|
|
6740
|
-
|
|
6741
|
-
/** Install, update, or repair a Pack from an exact previewed manifest. */
|
|
6742
|
-
async installPack(
|
|
6743
|
-
workspaceId: string,
|
|
6744
|
-
packId: string,
|
|
6745
|
-
request: InstallPackRequest,
|
|
6746
|
-
): Promise<PackInstallation> {
|
|
6747
|
-
return await this.requestJson<PackInstallation>(
|
|
6748
|
-
"POST",
|
|
6749
|
-
`/v1/workspaces/${workspaceId}/packs/${encodeURIComponent(packId)}/install`,
|
|
6750
|
-
request,
|
|
6751
|
-
);
|
|
6752
|
-
}
|
|
6753
|
-
|
|
6754
|
-
/** Preview which Pack-owned components will be retained by other owners. */
|
|
6755
|
-
async previewPackUninstall(workspaceId: string, packId: string): Promise<PackUninstallPreview> {
|
|
6756
|
-
return await this.requestJson<PackUninstallPreview>(
|
|
6757
|
-
"GET",
|
|
6758
|
-
`/v1/workspaces/${workspaceId}/packs/${encodeURIComponent(packId)}/uninstall-preview`,
|
|
6759
|
-
);
|
|
6760
|
-
}
|
|
6761
|
-
|
|
6762
|
-
/** Safely release Pack ownership and disable only now-ownerless components. */
|
|
6763
|
-
async uninstallPack(
|
|
6764
|
-
workspaceId: string,
|
|
6765
|
-
packId: string,
|
|
6766
|
-
request: UninstallPackRequest,
|
|
6767
|
-
): Promise<UninstallPackResult> {
|
|
6768
|
-
return await this.requestJson<UninstallPackResult>(
|
|
6769
|
-
"DELETE",
|
|
6770
|
-
`/v1/workspaces/${workspaceId}/packs/${encodeURIComponent(packId)}/installation`,
|
|
6771
|
-
request,
|
|
6772
|
-
);
|
|
6773
|
-
}
|
|
6774
|
-
|
|
6775
|
-
/** Unregister a workspace-scoped pack (built-in packs cannot be deleted). */
|
|
6776
|
-
async deletePack(workspaceId: string, packId: string): Promise<void> {
|
|
6777
|
-
await this.requestVoid(
|
|
6778
|
-
"DELETE",
|
|
6779
|
-
`/v1/workspaces/${workspaceId}/packs/${encodeURIComponent(packId)}`,
|
|
6780
|
-
);
|
|
6781
|
-
}
|
|
6782
|
-
|
|
6783
|
-
async listPackInstallations(workspaceId: string): Promise<PackInstallation[]> {
|
|
6784
|
-
return await this.requestJson<PackInstallation[]>(
|
|
6785
|
-
"GET",
|
|
6786
|
-
`/v1/workspaces/${workspaceId}/packs/installations`,
|
|
6787
|
-
);
|
|
6788
|
-
}
|
|
6789
6745
|
|
|
6790
6746
|
// --- Capabilities -------------------------------------------------------------------------
|
|
6791
6747
|
|
|
@@ -6808,6 +6764,35 @@ export class OpenGeniClient {
|
|
|
6808
6764
|
);
|
|
6809
6765
|
}
|
|
6810
6766
|
|
|
6767
|
+
async getConnectorToolPermissions(
|
|
6768
|
+
workspaceId: string,
|
|
6769
|
+
capabilityId: string,
|
|
6770
|
+
options: { signal?: AbortSignal } = {},
|
|
6771
|
+
): Promise<ConnectorToolPermissionsResponse> {
|
|
6772
|
+
return await this.requestJson(
|
|
6773
|
+
"GET",
|
|
6774
|
+
`/v1/workspaces/${workspaceId}/capabilities/${encodeURIComponent(capabilityId)}/tool-permissions`,
|
|
6775
|
+
undefined,
|
|
6776
|
+
{},
|
|
6777
|
+
options,
|
|
6778
|
+
);
|
|
6779
|
+
}
|
|
6780
|
+
|
|
6781
|
+
async updateConnectorToolPermissions(
|
|
6782
|
+
workspaceId: string,
|
|
6783
|
+
capabilityId: string,
|
|
6784
|
+
request: UpdateConnectorToolPermissionsRequest,
|
|
6785
|
+
options: { signal?: AbortSignal } = {},
|
|
6786
|
+
): Promise<{ saved: boolean }> {
|
|
6787
|
+
return await this.requestJson(
|
|
6788
|
+
"PATCH",
|
|
6789
|
+
`/v1/workspaces/${workspaceId}/capabilities/${encodeURIComponent(capabilityId)}/tool-permissions`,
|
|
6790
|
+
request,
|
|
6791
|
+
{},
|
|
6792
|
+
options,
|
|
6793
|
+
);
|
|
6794
|
+
}
|
|
6795
|
+
|
|
6811
6796
|
async enableCapability(
|
|
6812
6797
|
workspaceId: string,
|
|
6813
6798
|
capabilityId: string,
|
|
@@ -7379,6 +7364,15 @@ export class OpenGeniClient {
|
|
|
7379
7364
|
|
|
7380
7365
|
// --- Connections -------------------------------------------------------------------------------
|
|
7381
7366
|
|
|
7367
|
+
/** The authenticated user's active accounts across this organization. */
|
|
7368
|
+
async listOwnConnectionAccounts(workspaceId: string): Promise<ConnectionMetadata[]> {
|
|
7369
|
+
const response = await this.requestJson<ListConnectionsResponse>(
|
|
7370
|
+
"GET",
|
|
7371
|
+
`/v1/workspaces/${workspaceId}/connections/accounts`,
|
|
7372
|
+
);
|
|
7373
|
+
return response.connections;
|
|
7374
|
+
}
|
|
7375
|
+
|
|
7382
7376
|
async listConnections(workspaceId: string): Promise<ConnectionMetadata[]> {
|
|
7383
7377
|
const response = await this.requestJson<ListConnectionsResponse>(
|
|
7384
7378
|
"GET",
|
|
@@ -7675,6 +7669,27 @@ export class OpenGeniClient {
|
|
|
7675
7669
|
return logoAssetPath ? `${this.baseUrl}/v1/${logoAssetPath}` : null;
|
|
7676
7670
|
}
|
|
7677
7671
|
|
|
7672
|
+
/** Read a passive catalog mark through this client's authenticated transport.
|
|
7673
|
+
* Useful when an embedding backend protects even public upstream assets. */
|
|
7674
|
+
async downloadCatalogAsset(
|
|
7675
|
+
logoAssetPath: string,
|
|
7676
|
+
options: OpenGeniRequestOptions = {},
|
|
7677
|
+
): Promise<Blob> {
|
|
7678
|
+
if (
|
|
7679
|
+
!/^catalog-assets\/[a-zA-Z0-9_./-]+$/.test(logoAssetPath) ||
|
|
7680
|
+
logoAssetPath.split("/").some((part) => !part || part === "." || part === "..")
|
|
7681
|
+
)
|
|
7682
|
+
throw new TypeError("A catalog asset path is required");
|
|
7683
|
+
const response = await this.requestResponse("GET", `/v1/${logoAssetPath}`, {}, options);
|
|
7684
|
+
const type = response.headers.get("content-type")?.split(";")[0] ?? "";
|
|
7685
|
+
if (!type.startsWith("image/")) {
|
|
7686
|
+
await response.body?.cancel();
|
|
7687
|
+
throw new Error("The catalog asset is not an image");
|
|
7688
|
+
}
|
|
7689
|
+
const bytes = await readBoundedResponseBytes(response, 2_000_000, null);
|
|
7690
|
+
return new Blob([Uint8Array.from(bytes)], { type });
|
|
7691
|
+
}
|
|
7692
|
+
|
|
7678
7693
|
// --- GitHub ----------------------------------------------------------------------------------
|
|
7679
7694
|
|
|
7680
7695
|
/** GitHub App server configuration plus truthful workspace binding status. */
|
|
@@ -7866,6 +7881,48 @@ export class OpenGeniClient {
|
|
|
7866
7881
|
});
|
|
7867
7882
|
}
|
|
7868
7883
|
|
|
7884
|
+
async getOrganizationUsageSummary(
|
|
7885
|
+
options: {
|
|
7886
|
+
accountId: string;
|
|
7887
|
+
period?: import("@opengeni/contracts").OrganizationUsagePeriod;
|
|
7888
|
+
},
|
|
7889
|
+
requestOptions: OpenGeniRequestOptions = {},
|
|
7890
|
+
): Promise<import("@opengeni/contracts").OrganizationUsageSummary> {
|
|
7891
|
+
return await this.requestJson(
|
|
7892
|
+
"GET",
|
|
7893
|
+
"/v1/billing/usage-summary",
|
|
7894
|
+
undefined,
|
|
7895
|
+
{
|
|
7896
|
+
accountId: options.accountId,
|
|
7897
|
+
period: options.period ?? "month",
|
|
7898
|
+
},
|
|
7899
|
+
requestOptions,
|
|
7900
|
+
);
|
|
7901
|
+
}
|
|
7902
|
+
|
|
7903
|
+
async getOrganizationUsageWorkspacePage(
|
|
7904
|
+
options: {
|
|
7905
|
+
accountId: string;
|
|
7906
|
+
period?: import("@opengeni/contracts").OrganizationUsagePeriod;
|
|
7907
|
+
until: string;
|
|
7908
|
+
afterWorkspaceId?: string;
|
|
7909
|
+
},
|
|
7910
|
+
requestOptions: OpenGeniRequestOptions = {},
|
|
7911
|
+
): Promise<import("@opengeni/contracts").OrganizationUsageWorkspacePage> {
|
|
7912
|
+
return await this.requestJson(
|
|
7913
|
+
"GET",
|
|
7914
|
+
"/v1/billing/usage-workspaces",
|
|
7915
|
+
undefined,
|
|
7916
|
+
{
|
|
7917
|
+
accountId: options.accountId,
|
|
7918
|
+
period: options.period ?? "month",
|
|
7919
|
+
until: options.until,
|
|
7920
|
+
...(options.afterWorkspaceId ? { afterWorkspaceId: options.afterWorkspaceId } : {}),
|
|
7921
|
+
},
|
|
7922
|
+
requestOptions,
|
|
7923
|
+
);
|
|
7924
|
+
}
|
|
7925
|
+
|
|
7869
7926
|
async getBillingUsage(
|
|
7870
7927
|
options: { accountId?: string; workspaceId?: string } = {},
|
|
7871
7928
|
): Promise<BillingUsageResponse> {
|
|
@@ -7881,6 +7938,7 @@ export class OpenGeniClient {
|
|
|
7881
7938
|
range?: InsightsRange;
|
|
7882
7939
|
provider?: string;
|
|
7883
7940
|
model?: string;
|
|
7941
|
+
signal?: AbortSignal;
|
|
7884
7942
|
} = {},
|
|
7885
7943
|
): Promise<WorkspaceInsightsResponse> {
|
|
7886
7944
|
return await this.requestJson<WorkspaceInsightsResponse>(
|
|
@@ -7892,6 +7950,7 @@ export class OpenGeniClient {
|
|
|
7892
7950
|
...(options.provider !== undefined ? { provider: options.provider } : {}),
|
|
7893
7951
|
...(options.model !== undefined ? { model: options.model } : {}),
|
|
7894
7952
|
},
|
|
7953
|
+
{ signal: options.signal },
|
|
7895
7954
|
);
|
|
7896
7955
|
}
|
|
7897
7956
|
|
|
@@ -8021,6 +8080,17 @@ export class OpenGeniClient {
|
|
|
8021
8080
|
);
|
|
8022
8081
|
}
|
|
8023
8082
|
|
|
8083
|
+
/** Session-authorized retry choices plus the current accepted account. */
|
|
8084
|
+
async listSessionCodexAccounts(
|
|
8085
|
+
workspaceId: string,
|
|
8086
|
+
sessionId: string,
|
|
8087
|
+
): Promise<SessionCodexAccountsResponse> {
|
|
8088
|
+
return await this.requestJson<SessionCodexAccountsResponse>(
|
|
8089
|
+
"GET",
|
|
8090
|
+
`/v1/workspaces/${workspaceId}/sessions/${sessionId}/codex-accounts`,
|
|
8091
|
+
);
|
|
8092
|
+
}
|
|
8093
|
+
|
|
8024
8094
|
/** Switch the workspace ACTIVE Codex account (the one unpinned sessions use). */
|
|
8025
8095
|
async activateCodexAccount(
|
|
8026
8096
|
workspaceId: string,
|
|
@@ -2,6 +2,8 @@ import type { CompanyBrainOkfDownload, CompanyBrainOkfPackage } from "./company-
|
|
|
2
2
|
import { OpenGeniClient as OpenGeniCoreClient } from "./client";
|
|
3
3
|
import type {
|
|
4
4
|
Document,
|
|
5
|
+
IssueUserResourceGrantRequest,
|
|
6
|
+
UserResourceGrantMutationResponse,
|
|
5
7
|
DocumentBase,
|
|
6
8
|
FileDownloadUrlResponse,
|
|
7
9
|
DocumentAuthorityReclassification,
|
|
@@ -24,6 +26,19 @@ import type {
|
|
|
24
26
|
* methods or their routes.
|
|
25
27
|
*/
|
|
26
28
|
export class OpenGeniDocumentAuthorityClient extends OpenGeniCoreClient {
|
|
29
|
+
/** Issue an exact-session or standing personal-resource grant. */
|
|
30
|
+
async issueUserResourceGrant(
|
|
31
|
+
workspaceId: string,
|
|
32
|
+
authorityId: string,
|
|
33
|
+
request: IssueUserResourceGrantRequest,
|
|
34
|
+
): Promise<UserResourceGrantMutationResponse> {
|
|
35
|
+
return await this.requestJson<UserResourceGrantMutationResponse>(
|
|
36
|
+
"POST",
|
|
37
|
+
`/v1/workspaces/${workspaceId}/user-resource-authorities/${authorityId}/grants`,
|
|
38
|
+
request,
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
|
|
27
42
|
async listDocumentBases(workspaceId: string): Promise<DocumentBase[]> {
|
|
28
43
|
return await this.requestJson<DocumentBase[]>(
|
|
29
44
|
"GET",
|
|
@@ -714,8 +714,15 @@ class EditableArtifactSyncControllerImpl implements EditableArtifactSyncControll
|
|
|
714
714
|
stored.snapshot.modality === "spreadsheet" ? stored.snapshot.causalFrontier : null;
|
|
715
715
|
let nativeRevision =
|
|
716
716
|
stored.snapshot.modality === "spreadsheet" ? null : stored.snapshot.nativeRevision;
|
|
717
|
+
const retainedAcceptances: {
|
|
718
|
+
transaction: EditableArtifactCommittedTransaction;
|
|
719
|
+
pending: Pick<
|
|
720
|
+
EditableArtifactPendingTransaction,
|
|
721
|
+
"clientTransactionId" | "requestHash" | "intentBytes"
|
|
722
|
+
>;
|
|
723
|
+
}[] = [];
|
|
717
724
|
for (const transaction of stored.tail) {
|
|
718
|
-
validateCommittedTransaction(
|
|
725
|
+
const embeddedPending = validateCommittedTransaction(
|
|
719
726
|
transaction,
|
|
720
727
|
this.artifactId,
|
|
721
728
|
this.modality,
|
|
@@ -728,6 +735,15 @@ class EditableArtifactSyncControllerImpl implements EditableArtifactSyncControll
|
|
|
728
735
|
requireStateHash(transaction.priorStateHash, stateHash, "retained transaction prior state");
|
|
729
736
|
const applied = await this.kernel.applyRecovered(transaction);
|
|
730
737
|
requireStateHash(applied.stateHash, transaction.stateHash, "retained transaction");
|
|
738
|
+
if (embeddedPending) {
|
|
739
|
+
const pending = this.pending.get(embeddedPending.clientTransactionId);
|
|
740
|
+
if (
|
|
741
|
+
pending?.requestHash === embeddedPending.requestHash &&
|
|
742
|
+
bytesEqual(pending.intentBytes, embeddedPending.intentBytes)
|
|
743
|
+
) {
|
|
744
|
+
retainedAcceptances.push({ transaction, pending: embeddedPending });
|
|
745
|
+
}
|
|
746
|
+
}
|
|
731
747
|
cursor = transaction.endSequence;
|
|
732
748
|
stateHash = transaction.stateHash;
|
|
733
749
|
if (transaction.modality === "spreadsheet") {
|
|
@@ -763,6 +779,14 @@ class EditableArtifactSyncControllerImpl implements EditableArtifactSyncControll
|
|
|
763
779
|
this.retainedTailTransactions = stored.tail.length;
|
|
764
780
|
this.cursor = cursor;
|
|
765
781
|
this.headSequence = cursor;
|
|
782
|
+
// Reload may interrupt between retaining a commit and deleting its WAL entry.
|
|
783
|
+
// Only settle exact embedded identities after the entire retained head verifies;
|
|
784
|
+
// otherwise speculative replay mistakes our own committed edit for a conflict.
|
|
785
|
+
// Callers restore the pending overlay after this confirmed projection is ready.
|
|
786
|
+
for (const { transaction, pending } of retainedAcceptances) {
|
|
787
|
+
this.recordAcceptedMappingIdentity(transaction.transactionId, pending);
|
|
788
|
+
await this.settlePending(transaction, true);
|
|
789
|
+
}
|
|
766
790
|
}
|
|
767
791
|
|
|
768
792
|
private async run(): Promise<void> {
|