@opengeni/sdk 3.5.1-canary.0 → 3.7.0-canary.1
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 +65 -4
- package/dist/artifact-client.d.ts +2 -1
- package/dist/artifacts.js +4 -4
- package/dist/browser.d.ts +2 -0
- package/dist/browser.js +10 -2
- package/dist/{chunk-3VIQGNRX.js → chunk-C44ZOFSF.js} +10 -2
- package/dist/chunk-C44ZOFSF.js.map +1 -0
- package/dist/{chunk-GXC4RESV.js → chunk-DWCHEOMP.js} +107 -15
- package/dist/chunk-DWCHEOMP.js.map +1 -0
- package/dist/chunk-FMLDFJ2Q.js +246 -0
- package/dist/chunk-FMLDFJ2Q.js.map +1 -0
- package/dist/{chunk-PPWKSUDS.js → chunk-M4MKZ4LN.js} +2 -2
- package/dist/chunk-NLW73SND.js +518 -0
- package/dist/chunk-NLW73SND.js.map +1 -0
- package/dist/{chunk-HILHQEZD.js → chunk-PRD5R2QI.js} +3 -1
- package/dist/chunk-PRD5R2QI.js.map +1 -0
- package/dist/client.d.ts +45 -21
- package/dist/core.d.ts +2 -0
- package/dist/core.js +11 -3
- package/dist/document-authority.js +3 -3
- package/dist/editable-artifacts.js +1 -1
- package/dist/index.d.ts +9 -3
- package/dist/index.js +42 -5
- package/dist/index.js.map +1 -1
- package/dist/model-context.d.ts +49 -0
- package/dist/proxy.d.ts +7 -5
- package/dist/site-http.d.ts +16 -0
- package/dist/site.d.ts +99 -0
- package/dist/site.js +44 -0
- package/dist/site.js.map +1 -0
- package/dist/tools-FSTY4FAY.js +12 -0
- package/dist/tools-FSTY4FAY.js.map +1 -0
- package/dist/tools.d.ts +61 -0
- package/dist/types.d.ts +139 -6
- package/dist/workspace-artifacts.d.ts +32 -5
- package/package.json +6 -2
- package/src/artifact-client.ts +14 -0
- package/src/browser.ts +13 -0
- package/src/client.ts +156 -20
- package/src/core.ts +13 -0
- package/src/index.ts +75 -0
- package/src/model-context.ts +69 -0
- package/src/proxy.ts +17 -6
- package/src/site-http.ts +161 -0
- package/src/site.ts +578 -0
- package/src/tools.ts +396 -0
- package/src/types.ts +173 -6
- package/src/workspace-artifacts.ts +39 -6
- package/dist/chunk-3VIQGNRX.js.map +0 -1
- package/dist/chunk-GXC4RESV.js.map +0 -1
- package/dist/chunk-HILHQEZD.js.map +0 -1
- /package/dist/{chunk-PPWKSUDS.js.map → chunk-M4MKZ4LN.js.map} +0 -0
package/README.md
CHANGED
|
@@ -422,10 +422,13 @@ assign product types such as app, page, dashboard, or gallery. List pages are
|
|
|
422
422
|
bounded and expose both `truncated` and an opaque `nextCursor` so callers never
|
|
423
423
|
mistake a partial page for the complete workspace catalog.
|
|
424
424
|
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
425
|
+
Each Site version retains one self-contained executable HTML runtime, its
|
|
426
|
+
bounded editable source bundle, and the exact canonical tool identities it
|
|
427
|
+
requested. The web host renders that runtime in an opaque-origin sandboxed
|
|
428
|
+
iframe. Credentials, cookies, API URLs, workspace ids, and parent DOM authority
|
|
429
|
+
never enter the iframe; `@opengeni/sdk/site` uses a single parent-owned
|
|
430
|
+
`MessagePort` that exposes only the retained tool allowlist intersected with the
|
|
431
|
+
current viewer's live workspace catalog.
|
|
429
432
|
|
|
430
433
|
```ts
|
|
431
434
|
let cursor: string | undefined;
|
|
@@ -445,6 +448,64 @@ return the exact source session, turn, attempt, and execution generation that
|
|
|
445
448
|
published them. Version and event history are bounded; inspect
|
|
446
449
|
`versionsTruncated` and `eventsTruncated` on the detail response.
|
|
447
450
|
|
|
451
|
+
## Workspace tools
|
|
452
|
+
|
|
453
|
+
The browser-safe SDK exposes the same gateway catalog and executor used by
|
|
454
|
+
model MCP calls and Codemode. Generated declarations augment the lazy namespace
|
|
455
|
+
for exact installed-tool types; canonical `{ serverId, toolName }` identity and
|
|
456
|
+
the server-side catalog remain authoritative.
|
|
457
|
+
|
|
458
|
+
```ts
|
|
459
|
+
const tools = client.tools.forWorkspace(workspaceId);
|
|
460
|
+
const documents = await tools.docs.search({ query: "launch plan" });
|
|
461
|
+
```
|
|
462
|
+
|
|
463
|
+
An approval-required call needs a server-issued capability. A trusted host
|
|
464
|
+
shows its approval UI first, then asks for one token bound to the current human,
|
|
465
|
+
workspace, operation id, catalog digest, exact tool identity, and arguments.
|
|
466
|
+
The token expires after five minutes, is stored only as a hash, and is consumed
|
|
467
|
+
once by the matching call.
|
|
468
|
+
|
|
469
|
+
Connection-backed tools configured for both provider policy and one-shot human
|
|
470
|
+
approval are omitted from this HTTP catalog until their provider adapter can
|
|
471
|
+
preflight credential and resource authorization before consuming the token.
|
|
472
|
+
|
|
473
|
+
```ts
|
|
474
|
+
const operationId = crypto.randomUUID();
|
|
475
|
+
const identity = { serverId: "linear", toolName: "issues_update" };
|
|
476
|
+
const input = { issueId, state: "Done" };
|
|
477
|
+
const approval = await tools.$approve(identity, input, { operationId });
|
|
478
|
+
|
|
479
|
+
await tools.$call(identity, input, {
|
|
480
|
+
operationId,
|
|
481
|
+
approvalToken: approval.approvalToken,
|
|
482
|
+
});
|
|
483
|
+
```
|
|
484
|
+
|
|
485
|
+
When a call or approval request receives the typed
|
|
486
|
+
`409 details.code = "catalog_stale"` response, the SDK refreshes the catalog,
|
|
487
|
+
re-resolves the exact identity or generated namespace path, preserves the
|
|
488
|
+
operation id (generating it before the first attempt when omitted), and retries
|
|
489
|
+
once. A call that already carries an approval token cannot reuse that
|
|
490
|
+
single-use capability after the catalog digest changes; instead it throws
|
|
491
|
+
`OpenGeniToolReapprovalRequiredError` with the refreshed identity and digest so
|
|
492
|
+
the trusted host can show approval again for the same operation id.
|
|
493
|
+
|
|
494
|
+
Reapproval is valid only before the original capability is consumed. Once a
|
|
495
|
+
call crosses that boundary, the server retains a hash-only tombstone for the
|
|
496
|
+
operation id and rejects another approval with
|
|
497
|
+
`409 details.code = "tool_gateway_operation_already_started"` and
|
|
498
|
+
`outcomeUnknown: true`. The host must reconcile the provider outcome; it must
|
|
499
|
+
not turn an ambiguous call into a second approved execution by minting a fresh
|
|
500
|
+
operation id automatically.
|
|
501
|
+
|
|
502
|
+
Do not request approval capabilities speculatively or expose them to Site iframe
|
|
503
|
+
code. The host projects only the active immutable version's requested identities,
|
|
504
|
+
supplies the Site context on direct calls, and the server revalidates the active
|
|
505
|
+
version and viewer's live authority. The requested set is a maximum allowlist,
|
|
506
|
+
not an authority grant; ordinary gateway approval still applies. Archived Sites
|
|
507
|
+
receive no tool bridge.
|
|
508
|
+
|
|
448
509
|
Omit `firstPartyMcpTools` for the complete OpenGeni tool catalog. An explicit
|
|
449
510
|
`[]` exposes no broad first-party tools; attached resources and separately
|
|
450
511
|
selected `files`/`docs` MCP servers are unaffected.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { OpenGeniDocumentAuthorityClient } from "./document-authority-client.js";
|
|
2
2
|
import type { FetchResponse } from "./client.js";
|
|
3
3
|
import type { CreateEditableArtifactMaterializationRequest, CreateEditableArtifactResourceRequest, EditableArtifactListResource, EditableArtifactMaterializationJobResource, EditableArtifactPinnedVersionResource, EditableArtifactResource, ImportEditableArtifactResourceRequest, ListSessionEditableArtifactResourcesOptions, PinEditableArtifactVersionRequest, ReadEditableArtifactMaterializationOptions, ReadEditableArtifactResourceOptions } from "./editable-artifact-resources.js";
|
|
4
|
-
import type { CreateWorkspaceArtifactRequest, PublishWorkspaceArtifactVersionRequest, RollbackWorkspaceArtifactRequest, WorkspaceArtifactContentResponse, WorkspaceArtifactDetailResponse, WorkspaceArtifactListOptions, WorkspaceArtifactListResponse, WorkspaceArtifactMutationResponse } from "./workspace-artifacts.js";
|
|
4
|
+
import type { CreateWorkspaceArtifactRequest, PublishWorkspaceArtifactVersionRequest, RollbackWorkspaceArtifactRequest, SetWorkspaceArtifactStatusRequest, WorkspaceArtifactContentResponse, WorkspaceArtifactDetailResponse, WorkspaceArtifactListOptions, WorkspaceArtifactListResponse, WorkspaceArtifactMutationResponse } from "./workspace-artifacts.js";
|
|
5
5
|
/** Public SDK client. Optional operator and artifact operations stay out of the console core. */
|
|
6
6
|
export declare class OpenGeniClient extends OpenGeniDocumentAuthorityClient {
|
|
7
7
|
createEditableArtifact(workspaceId: string, request: CreateEditableArtifactResourceRequest, options?: Readonly<{
|
|
@@ -27,4 +27,5 @@ export declare class OpenGeniClient extends OpenGeniDocumentAuthorityClient {
|
|
|
27
27
|
createWorkspaceArtifact(workspaceId: string, request: CreateWorkspaceArtifactRequest): Promise<WorkspaceArtifactMutationResponse>;
|
|
28
28
|
publishWorkspaceArtifactVersion(workspaceId: string, artifactId: string, request: PublishWorkspaceArtifactVersionRequest): Promise<WorkspaceArtifactMutationResponse>;
|
|
29
29
|
rollbackWorkspaceArtifact(workspaceId: string, artifactId: string, request: RollbackWorkspaceArtifactRequest): Promise<WorkspaceArtifactMutationResponse>;
|
|
30
|
+
setWorkspaceArtifactStatus(workspaceId: string, artifactId: string, request: SetWorkspaceArtifactStatusRequest): Promise<WorkspaceArtifactMutationResponse>;
|
|
30
31
|
}
|
package/dist/artifacts.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
OpenGeniClient
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
5
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-C44ZOFSF.js";
|
|
4
|
+
import "./chunk-M4MKZ4LN.js";
|
|
5
|
+
import "./chunk-DWCHEOMP.js";
|
|
6
6
|
import "./chunk-QTBAMHEF.js";
|
|
7
|
-
import "./chunk-
|
|
7
|
+
import "./chunk-PRD5R2QI.js";
|
|
8
8
|
import "./chunk-OO5LPTO7.js";
|
|
9
9
|
export {
|
|
10
10
|
OpenGeniClient
|
package/dist/browser.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
/** Browser-console client. Optional SDK surfaces must not enter this eager graph. */
|
|
2
2
|
export { OpenGeniClient as OpenGeniBrowserClient } from "./client.js";
|
|
3
|
+
export { OpenGeniToolCallError, OpenGeniToolReapprovalRequiredError, OpenGeniToolsClient, } from "./tools.js";
|
|
4
|
+
export type { OpenGeniGeneratedTools, OpenGeniDynamicToolNode, OpenGeniToolCallOptions, OpenGeniToolFunction, OpenGeniToolsFacade, OpenGeniWorkspaceTools, } from "./tools.js";
|
|
3
5
|
export type { FetchLike, FetchResponse, GetSessionOptions, OpenGeniClientOptions, OpenGeniRequestOptions, SendMessageInput, SteerMessageResult, TranscribeAudioInput, WorkspaceControlEventPage, } from "./client.js";
|
|
4
6
|
export { OpenGeniApiContractMismatchError, OpenGeniApiError, OpenGeniSecureContextRequiredError, OpenGeniSessionListCursorError, OpenGeniStreamError, isRetryableStreamError, } from "./errors.js";
|
|
5
7
|
export type { OpenGeniSecureContextRequiredReason } from "./errors.js";
|
package/dist/browser.js
CHANGED
|
@@ -1,14 +1,19 @@
|
|
|
1
1
|
import {
|
|
2
2
|
resolveWorkspaceVoiceInputEnabled
|
|
3
3
|
} from "./chunk-VYCTL62C.js";
|
|
4
|
+
import {
|
|
5
|
+
OpenGeniToolCallError,
|
|
6
|
+
OpenGeniToolReapprovalRequiredError,
|
|
7
|
+
OpenGeniToolsClient
|
|
8
|
+
} from "./chunk-FMLDFJ2Q.js";
|
|
4
9
|
import {
|
|
5
10
|
OpenGeniClient
|
|
6
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-DWCHEOMP.js";
|
|
7
12
|
import "./chunk-QTBAMHEF.js";
|
|
8
13
|
import {
|
|
9
14
|
OPENGENI_API_CONTRACT_HEADER,
|
|
10
15
|
OPENGENI_API_CONTRACT_REVISION
|
|
11
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-PRD5R2QI.js";
|
|
12
17
|
import {
|
|
13
18
|
OpenGeniApiContractMismatchError,
|
|
14
19
|
OpenGeniApiError,
|
|
@@ -26,6 +31,9 @@ export {
|
|
|
26
31
|
OpenGeniSecureContextRequiredError,
|
|
27
32
|
OpenGeniSessionListCursorError,
|
|
28
33
|
OpenGeniStreamError,
|
|
34
|
+
OpenGeniToolCallError,
|
|
35
|
+
OpenGeniToolReapprovalRequiredError,
|
|
36
|
+
OpenGeniToolsClient,
|
|
29
37
|
isRetryableStreamError,
|
|
30
38
|
resolveWorkspaceVoiceInputEnabled
|
|
31
39
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
OpenGeniDocumentAuthorityClient
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-M4MKZ4LN.js";
|
|
4
4
|
|
|
5
5
|
// src/artifact-client.ts
|
|
6
6
|
var OpenGeniClient = class extends OpenGeniDocumentAuthorityClient {
|
|
@@ -80,6 +80,7 @@ var OpenGeniClient = class extends OpenGeniDocumentAuthorityClient {
|
|
|
80
80
|
const query = new URLSearchParams();
|
|
81
81
|
if (options.limit !== void 0) query.set("limit", String(options.limit));
|
|
82
82
|
if (options.cursor) query.set("cursor", options.cursor);
|
|
83
|
+
if (options.status) query.set("status", options.status);
|
|
83
84
|
const suffix = query.size > 0 ? `?${query.toString()}` : "";
|
|
84
85
|
return await this.requestJson(
|
|
85
86
|
"GET",
|
|
@@ -120,9 +121,16 @@ var OpenGeniClient = class extends OpenGeniDocumentAuthorityClient {
|
|
|
120
121
|
request
|
|
121
122
|
);
|
|
122
123
|
}
|
|
124
|
+
async setWorkspaceArtifactStatus(workspaceId, artifactId, request) {
|
|
125
|
+
return await this.requestJson(
|
|
126
|
+
"PATCH",
|
|
127
|
+
`/v1/workspaces/${workspaceId}/published-artifacts/${encodeURIComponent(artifactId)}/status`,
|
|
128
|
+
request
|
|
129
|
+
);
|
|
130
|
+
}
|
|
123
131
|
};
|
|
124
132
|
|
|
125
133
|
export {
|
|
126
134
|
OpenGeniClient
|
|
127
135
|
};
|
|
128
|
-
//# sourceMappingURL=chunk-
|
|
136
|
+
//# sourceMappingURL=chunk-C44ZOFSF.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/artifact-client.ts"],"sourcesContent":["import { OpenGeniDocumentAuthorityClient } from \"./document-authority-client\";\nimport type { FetchResponse } from \"./client\";\nimport type {\n CreateEditableArtifactMaterializationRequest,\n CreateEditableArtifactResourceRequest,\n EditableArtifactListResource,\n EditableArtifactMaterializationJobResource,\n EditableArtifactPinnedVersionResource,\n EditableArtifactResource,\n ImportEditableArtifactResourceRequest,\n ListSessionEditableArtifactResourcesOptions,\n PinEditableArtifactVersionRequest,\n ReadEditableArtifactMaterializationOptions,\n ReadEditableArtifactResourceOptions,\n} from \"./editable-artifact-resources\";\nimport type {\n CreateWorkspaceArtifactRequest,\n PublishWorkspaceArtifactVersionRequest,\n RollbackWorkspaceArtifactRequest,\n SetWorkspaceArtifactStatusRequest,\n WorkspaceArtifactContentResponse,\n WorkspaceArtifactDetailResponse,\n WorkspaceArtifactListOptions,\n WorkspaceArtifactListResponse,\n WorkspaceArtifactMutationResponse,\n} from \"./workspace-artifacts\";\n\n/** Public SDK client. Optional operator and artifact operations stay out of the console core. */\nexport class OpenGeniClient extends OpenGeniDocumentAuthorityClient {\n async createEditableArtifact(\n workspaceId: string,\n request: CreateEditableArtifactResourceRequest,\n options: Readonly<{ signal?: AbortSignal | undefined }> = {},\n ): Promise<EditableArtifactResource> {\n return await this.requestJson<EditableArtifactResource>(\n \"POST\",\n `/v1/workspaces/${encodeURIComponent(workspaceId)}/editable-artifacts`,\n request,\n {},\n options,\n );\n }\n\n async importEditableArtifact(\n workspaceId: string,\n request: ImportEditableArtifactResourceRequest,\n options: Readonly<{ signal?: AbortSignal | undefined }> = {},\n ): Promise<EditableArtifactResource> {\n return await this.requestJson<EditableArtifactResource>(\n \"POST\",\n `/v1/workspaces/${encodeURIComponent(workspaceId)}/editable-artifacts/imports`,\n request,\n {},\n options,\n );\n }\n\n async getEditableArtifact(\n workspaceId: string,\n artifactId: string,\n options: ReadEditableArtifactResourceOptions,\n ): Promise<EditableArtifactResource> {\n return await this.requestJson<EditableArtifactResource>(\n \"GET\",\n `/v1/workspaces/${encodeURIComponent(workspaceId)}/editable-artifacts/${encodeURIComponent(artifactId)}`,\n undefined,\n { replicaId: options.replicaId },\n options,\n );\n }\n\n async listSessionEditableArtifacts(\n workspaceId: string,\n sourceSessionId: string,\n options: ListSessionEditableArtifactResourcesOptions,\n ): Promise<EditableArtifactListResource> {\n return await this.requestJson<EditableArtifactListResource>(\n \"GET\",\n `/v1/workspaces/${encodeURIComponent(workspaceId)}/editable-artifacts`,\n undefined,\n { sourceSessionId, replicaId: options.replicaId },\n options,\n );\n }\n\n async pinEditableArtifactVersion(\n workspaceId: string,\n artifactId: string,\n request: PinEditableArtifactVersionRequest,\n options: Readonly<{ signal?: AbortSignal | undefined }> = {},\n ): Promise<EditableArtifactPinnedVersionResource> {\n return await this.requestJson<EditableArtifactPinnedVersionResource>(\n \"POST\",\n `/v1/workspaces/${encodeURIComponent(workspaceId)}/editable-artifacts/${encodeURIComponent(artifactId)}/versions`,\n request,\n {},\n options,\n );\n }\n\n async createEditableArtifactMaterialization(\n workspaceId: string,\n artifactId: string,\n request: CreateEditableArtifactMaterializationRequest,\n options: Readonly<{ signal?: AbortSignal | undefined }> = {},\n ): Promise<EditableArtifactMaterializationJobResource> {\n return await this.requestJson<EditableArtifactMaterializationJobResource>(\n \"POST\",\n `/v1/workspaces/${encodeURIComponent(workspaceId)}/editable-artifacts/${encodeURIComponent(artifactId)}/materializations`,\n request,\n {},\n options,\n );\n }\n\n async getEditableArtifactMaterialization(\n workspaceId: string,\n artifactId: string,\n jobId: string,\n options: ReadEditableArtifactMaterializationOptions,\n ): Promise<EditableArtifactMaterializationJobResource> {\n return await this.requestJson<EditableArtifactMaterializationJobResource>(\n \"GET\",\n `/v1/workspaces/${encodeURIComponent(workspaceId)}/editable-artifacts/${encodeURIComponent(artifactId)}/materializations/${encodeURIComponent(jobId)}`,\n undefined,\n { replicaId: options.replicaId },\n options,\n );\n }\n\n /** The caller owns the returned bounded response stream. */\n async downloadEditableArtifactMaterialization(\n workspaceId: string,\n artifactId: string,\n jobId: string,\n options: ReadEditableArtifactMaterializationOptions,\n ): Promise<FetchResponse> {\n return await this.requestResponse(\n \"GET\",\n `/v1/workspaces/${encodeURIComponent(workspaceId)}/editable-artifacts/${encodeURIComponent(artifactId)}/materializations/${encodeURIComponent(jobId)}/download`,\n { replicaId: options.replicaId },\n options,\n );\n }\n\n async listWorkspaceArtifacts(\n workspaceId: string,\n options: WorkspaceArtifactListOptions = {},\n ): Promise<WorkspaceArtifactListResponse> {\n const query = new URLSearchParams();\n if (options.limit !== undefined) query.set(\"limit\", String(options.limit));\n if (options.cursor) query.set(\"cursor\", options.cursor);\n if (options.status) query.set(\"status\", options.status);\n const suffix = query.size > 0 ? `?${query.toString()}` : \"\";\n return await this.requestJson<WorkspaceArtifactListResponse>(\n \"GET\",\n `/v1/workspaces/${workspaceId}/published-artifacts${suffix}`,\n );\n }\n\n async getWorkspaceArtifact(\n workspaceId: string,\n artifactId: string,\n ): Promise<WorkspaceArtifactDetailResponse> {\n return await this.requestJson<WorkspaceArtifactDetailResponse>(\n \"GET\",\n `/v1/workspaces/${workspaceId}/published-artifacts/${encodeURIComponent(artifactId)}`,\n );\n }\n\n async getWorkspaceArtifactContent(\n workspaceId: string,\n artifactId: string,\n versionId?: string,\n ): Promise<WorkspaceArtifactContentResponse> {\n const query = versionId ? `?versionId=${encodeURIComponent(versionId)}` : \"\";\n return await this.requestJson<WorkspaceArtifactContentResponse>(\n \"GET\",\n `/v1/workspaces/${workspaceId}/published-artifacts/${encodeURIComponent(artifactId)}/content${query}`,\n );\n }\n\n async createWorkspaceArtifact(\n workspaceId: string,\n request: CreateWorkspaceArtifactRequest,\n ): Promise<WorkspaceArtifactMutationResponse> {\n return await this.requestJson<WorkspaceArtifactMutationResponse>(\n \"POST\",\n `/v1/workspaces/${workspaceId}/published-artifacts`,\n request,\n );\n }\n\n async publishWorkspaceArtifactVersion(\n workspaceId: string,\n artifactId: string,\n request: PublishWorkspaceArtifactVersionRequest,\n ): Promise<WorkspaceArtifactMutationResponse> {\n return await this.requestJson<WorkspaceArtifactMutationResponse>(\n \"POST\",\n `/v1/workspaces/${workspaceId}/published-artifacts/${encodeURIComponent(artifactId)}/versions`,\n request,\n );\n }\n\n async rollbackWorkspaceArtifact(\n workspaceId: string,\n artifactId: string,\n request: RollbackWorkspaceArtifactRequest,\n ): Promise<WorkspaceArtifactMutationResponse> {\n return await this.requestJson<WorkspaceArtifactMutationResponse>(\n \"POST\",\n `/v1/workspaces/${workspaceId}/published-artifacts/${encodeURIComponent(artifactId)}/rollback`,\n request,\n );\n }\n\n async setWorkspaceArtifactStatus(\n workspaceId: string,\n artifactId: string,\n request: SetWorkspaceArtifactStatusRequest,\n ): Promise<WorkspaceArtifactMutationResponse> {\n return await this.requestJson<WorkspaceArtifactMutationResponse>(\n \"PATCH\",\n `/v1/workspaces/${workspaceId}/published-artifacts/${encodeURIComponent(artifactId)}/status`,\n request,\n );\n }\n}\n"],"mappings":";;;;;AA4BO,IAAM,iBAAN,cAA6B,gCAAgC;AAAA,EAClE,MAAM,uBACJ,aACA,SACA,UAA0D,CAAC,GACxB;AACnC,WAAO,MAAM,KAAK;AAAA,MAChB;AAAA,MACA,kBAAkB,mBAAmB,WAAW,CAAC;AAAA,MACjD;AAAA,MACA,CAAC;AAAA,MACD;AAAA,IACF;AAAA,EACF;AAAA,EAEA,MAAM,uBACJ,aACA,SACA,UAA0D,CAAC,GACxB;AACnC,WAAO,MAAM,KAAK;AAAA,MAChB;AAAA,MACA,kBAAkB,mBAAmB,WAAW,CAAC;AAAA,MACjD;AAAA,MACA,CAAC;AAAA,MACD;AAAA,IACF;AAAA,EACF;AAAA,EAEA,MAAM,oBACJ,aACA,YACA,SACmC;AACnC,WAAO,MAAM,KAAK;AAAA,MAChB;AAAA,MACA,kBAAkB,mBAAmB,WAAW,CAAC,uBAAuB,mBAAmB,UAAU,CAAC;AAAA,MACtG;AAAA,MACA,EAAE,WAAW,QAAQ,UAAU;AAAA,MAC/B;AAAA,IACF;AAAA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,EACF;AAAA,EAEA,MAAM,2BACJ,aACA,YACA,SAC4C;AAC5C,WAAO,MAAM,KAAK;AAAA,MAChB;AAAA,MACA,kBAAkB,WAAW,wBAAwB,mBAAmB,UAAU,CAAC;AAAA,MACnF;AAAA,IACF;AAAA,EACF;AACF;","names":[]}
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
OPENGENI_API_CONTRACT_REVISION,
|
|
10
10
|
OPENGENI_CORRELATION_HEADER,
|
|
11
11
|
RETAINED_OUTPUT_MAX_PAGE_BYTES
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-PRD5R2QI.js";
|
|
13
13
|
import {
|
|
14
14
|
OpenGeniApiContractMismatchError,
|
|
15
15
|
OpenGeniApiError,
|
|
@@ -780,6 +780,9 @@ function sessionListQuery(options) {
|
|
|
780
780
|
...parentSessionId === void 0 ? {} : { parentSessionId: parentSessionId ?? "null" }
|
|
781
781
|
};
|
|
782
782
|
}
|
|
783
|
+
function hasSessionPageFilters(options) {
|
|
784
|
+
return options.channelId !== void 0 || options.createdBy !== void 0 || options.updatedFrom !== void 0 || options.updatedBefore !== void 0 || options.createdFrom !== void 0 || options.createdBefore !== void 0;
|
|
785
|
+
}
|
|
783
786
|
function createSingleFlightReadEntry(generation, onRequestStart) {
|
|
784
787
|
let resolve;
|
|
785
788
|
let reject;
|
|
@@ -825,6 +828,43 @@ function normalizeScheduledTaskMachineTarget(request) {
|
|
|
825
828
|
}
|
|
826
829
|
};
|
|
827
830
|
}
|
|
831
|
+
function createLazyToolsFacade(transport) {
|
|
832
|
+
return {
|
|
833
|
+
forWorkspace(workspaceId) {
|
|
834
|
+
const normalizedWorkspaceId = workspaceId.trim();
|
|
835
|
+
if (!normalizedWorkspaceId) throw new TypeError("workspaceId is required");
|
|
836
|
+
let workspaceTools;
|
|
837
|
+
const load = () => workspaceTools ??= import("./tools-FSTY4FAY.js").then(
|
|
838
|
+
({ OpenGeniToolsClient }) => new OpenGeniToolsClient(transport).forWorkspace(normalizedWorkspaceId)
|
|
839
|
+
);
|
|
840
|
+
const node = (path) => new Proxy(
|
|
841
|
+
async (...args) => {
|
|
842
|
+
let target = await load();
|
|
843
|
+
for (const segment of path) {
|
|
844
|
+
target = target[segment];
|
|
845
|
+
}
|
|
846
|
+
if (typeof target !== "function")
|
|
847
|
+
throw new TypeError("OpenGeni tool path is not callable");
|
|
848
|
+
return await Reflect.apply(target, void 0, args);
|
|
849
|
+
},
|
|
850
|
+
{
|
|
851
|
+
get: (_target, property) => {
|
|
852
|
+
if (property === "then") return void 0;
|
|
853
|
+
if (typeof property !== "string") return void 0;
|
|
854
|
+
return node([...path, property]);
|
|
855
|
+
}
|
|
856
|
+
}
|
|
857
|
+
);
|
|
858
|
+
return new Proxy(/* @__PURE__ */ Object.create(null), {
|
|
859
|
+
get: (_target, property) => {
|
|
860
|
+
if (property === "then") return void 0;
|
|
861
|
+
if (typeof property !== "string") return void 0;
|
|
862
|
+
return node([property]);
|
|
863
|
+
}
|
|
864
|
+
});
|
|
865
|
+
}
|
|
866
|
+
};
|
|
867
|
+
}
|
|
828
868
|
var OpenGeniClient = class {
|
|
829
869
|
baseUrl;
|
|
830
870
|
options;
|
|
@@ -835,6 +875,8 @@ var OpenGeniClient = class {
|
|
|
835
875
|
queued = /* @__PURE__ */ new Map();
|
|
836
876
|
/** Resource-oriented Browser/Computer facade over this exact authenticated client. */
|
|
837
877
|
interaction;
|
|
878
|
+
/** Dynamic typed tool facade backed by the canonical workspace gateway. */
|
|
879
|
+
tools;
|
|
838
880
|
constructor(options) {
|
|
839
881
|
this.baseUrl = options.baseUrl.replace(/\/+$/, "");
|
|
840
882
|
this.options = options;
|
|
@@ -845,6 +887,7 @@ var OpenGeniClient = class {
|
|
|
845
887
|
}
|
|
846
888
|
this.sessionCommandTimeoutMs = sessionCommandTimeoutMs;
|
|
847
889
|
this.interaction = new OpenGeniInteractionClient(this);
|
|
890
|
+
this.tools = createLazyToolsFacade(this);
|
|
848
891
|
}
|
|
849
892
|
// --- Session lifecycle ---------------------------------------------------
|
|
850
893
|
/** Make one finalization attempt for a recording; callers may retry retained audio. */
|
|
@@ -1051,6 +1094,13 @@ var OpenGeniClient = class {
|
|
|
1051
1094
|
options
|
|
1052
1095
|
);
|
|
1053
1096
|
}
|
|
1097
|
+
/** Exact model-visible prefix captured from the latest provider request. */
|
|
1098
|
+
async getSessionModelContext(workspaceId, sessionId) {
|
|
1099
|
+
return await this.requestJson(
|
|
1100
|
+
"GET",
|
|
1101
|
+
`/v1/workspaces/${workspaceId}/sessions/${sessionId}/model-context`
|
|
1102
|
+
);
|
|
1103
|
+
}
|
|
1054
1104
|
async updateSession(workspaceId, sessionId, request) {
|
|
1055
1105
|
return await this.requestJson(
|
|
1056
1106
|
"PATCH",
|
|
@@ -1121,10 +1171,14 @@ var OpenGeniClient = class {
|
|
|
1121
1171
|
sessionListQuery(options)
|
|
1122
1172
|
);
|
|
1123
1173
|
}
|
|
1124
|
-
|
|
1174
|
+
/** Running and stopping commands only; settled results remain in session history. */
|
|
1175
|
+
async listSessionBackgroundCommands(workspaceId, sessionId, options = {}) {
|
|
1125
1176
|
return await this.requestJson(
|
|
1126
1177
|
"GET",
|
|
1127
|
-
`/v1/workspaces/${workspaceId}/sessions/${sessionId}/background-commands
|
|
1178
|
+
`/v1/workspaces/${workspaceId}/sessions/${sessionId}/background-commands`,
|
|
1179
|
+
void 0,
|
|
1180
|
+
{},
|
|
1181
|
+
options
|
|
1128
1182
|
);
|
|
1129
1183
|
}
|
|
1130
1184
|
async cancelSessionBackgroundCommand(workspaceId, sessionId, commandId) {
|
|
@@ -1147,6 +1201,15 @@ var OpenGeniClient = class {
|
|
|
1147
1201
|
...sessionListQuery(options),
|
|
1148
1202
|
...options.cursor !== void 0 ? { cursor: options.cursor } : {},
|
|
1149
1203
|
...search ? { search } : {},
|
|
1204
|
+
...options.channelId !== void 0 ? { channelId: options.channelId ?? "null" } : {},
|
|
1205
|
+
...options.createdBy ? {
|
|
1206
|
+
createdByKind: options.createdBy.kind,
|
|
1207
|
+
createdBySubjectId: options.createdBy.subjectId
|
|
1208
|
+
} : {},
|
|
1209
|
+
...options.updatedFrom ? { updatedFrom: options.updatedFrom } : {},
|
|
1210
|
+
...options.updatedBefore ? { updatedBefore: options.updatedBefore } : {},
|
|
1211
|
+
...options.createdFrom ? { createdFrom: options.createdFrom } : {},
|
|
1212
|
+
...options.createdBefore ? { createdBefore: options.createdBefore } : {},
|
|
1150
1213
|
...options.pinsOnly ? { pinsOnly: "true" } : {},
|
|
1151
1214
|
...options.archivedOnly ? { archivedOnly: "true" } : {}
|
|
1152
1215
|
},
|
|
@@ -1177,8 +1240,14 @@ var OpenGeniClient = class {
|
|
|
1177
1240
|
if (options.archivedOnly) {
|
|
1178
1241
|
throw new Error("The connected OpenGeni API does not support archived session lists");
|
|
1179
1242
|
}
|
|
1243
|
+
if (hasSessionPageFilters(options)) {
|
|
1244
|
+
throw new Error("The connected OpenGeni API does not support filtered session lists");
|
|
1245
|
+
}
|
|
1180
1246
|
return { pinned: [], sessions: response, nextCursor: null };
|
|
1181
1247
|
}
|
|
1248
|
+
if (hasSessionPageFilters(options) && response.filtersApplied !== true) {
|
|
1249
|
+
throw new Error("The connected OpenGeni API does not support filtered session lists");
|
|
1250
|
+
}
|
|
1182
1251
|
return response;
|
|
1183
1252
|
}
|
|
1184
1253
|
/** Compact, bounded workspace agent hierarchy page. */
|
|
@@ -1602,6 +1671,8 @@ var OpenGeniClient = class {
|
|
|
1602
1671
|
`/v1/workspaces/${workspaceId}/scheduled-tasks`,
|
|
1603
1672
|
void 0,
|
|
1604
1673
|
{
|
|
1674
|
+
...options.offset !== void 0 ? { offset: String(options.offset) } : {},
|
|
1675
|
+
...options.sessionId ? { sessionId: options.sessionId } : {},
|
|
1605
1676
|
...options.limit !== void 0 ? { limit: String(options.limit) } : {}
|
|
1606
1677
|
}
|
|
1607
1678
|
);
|
|
@@ -3527,11 +3598,12 @@ var OpenGeniClient = class {
|
|
|
3527
3598
|
`/v1/workspaces/${workspaceId}/instruction-policies/${encodeURIComponent(revisionId)}`
|
|
3528
3599
|
);
|
|
3529
3600
|
}
|
|
3530
|
-
async createWorkspaceInstructionPolicyDraft(workspaceId, request) {
|
|
3531
|
-
return await this.
|
|
3601
|
+
async createWorkspaceInstructionPolicyDraft(workspaceId, request, options = {}) {
|
|
3602
|
+
return await this.requestSessionCommand(
|
|
3532
3603
|
"POST",
|
|
3533
3604
|
`/v1/workspaces/${workspaceId}/instruction-policies/drafts`,
|
|
3534
|
-
request
|
|
3605
|
+
request,
|
|
3606
|
+
options
|
|
3535
3607
|
);
|
|
3536
3608
|
}
|
|
3537
3609
|
/** List the newest immutable onboarding proposals and their inactive policy drafts. */
|
|
@@ -3570,11 +3642,12 @@ var OpenGeniClient = class {
|
|
|
3570
3642
|
`/v1/workspaces/${workspaceId}/instruction-policies/diff?${params}`
|
|
3571
3643
|
);
|
|
3572
3644
|
}
|
|
3573
|
-
async activateWorkspaceInstructionPolicyRevision(workspaceId, revisionId, request) {
|
|
3574
|
-
return await this.
|
|
3645
|
+
async activateWorkspaceInstructionPolicyRevision(workspaceId, revisionId, request, options = {}) {
|
|
3646
|
+
return await this.requestSessionCommand(
|
|
3575
3647
|
"POST",
|
|
3576
3648
|
`/v1/workspaces/${workspaceId}/instruction-policies/${encodeURIComponent(revisionId)}/activate`,
|
|
3577
|
-
request
|
|
3649
|
+
request,
|
|
3650
|
+
options
|
|
3578
3651
|
);
|
|
3579
3652
|
}
|
|
3580
3653
|
async rollbackWorkspaceInstructionPolicyRevision(workspaceId, request) {
|
|
@@ -5099,6 +5172,21 @@ var OpenGeniClient = class {
|
|
|
5099
5172
|
`/v1/workspaces/${workspaceId}/github/repositories`
|
|
5100
5173
|
);
|
|
5101
5174
|
}
|
|
5175
|
+
/** Effective confirmation policy for each GitHub identity available to this caller. */
|
|
5176
|
+
async getGitHubActionPolicies(workspaceId) {
|
|
5177
|
+
return await this.requestJson(
|
|
5178
|
+
"GET",
|
|
5179
|
+
`/v1/workspaces/${workspaceId}/github/action-policies`
|
|
5180
|
+
);
|
|
5181
|
+
}
|
|
5182
|
+
/** Change one GitHub action group without broadening review or merge policy. */
|
|
5183
|
+
async updateGitHubActionPolicy(workspaceId, request) {
|
|
5184
|
+
return await this.requestJson(
|
|
5185
|
+
"PATCH",
|
|
5186
|
+
`/v1/workspaces/${workspaceId}/github/action-policies`,
|
|
5187
|
+
request
|
|
5188
|
+
);
|
|
5189
|
+
}
|
|
5102
5190
|
/** Re-sync the installation's repository list from GitHub. */
|
|
5103
5191
|
async syncGitHubRepositories(workspaceId) {
|
|
5104
5192
|
return await this.requestJson(
|
|
@@ -5446,14 +5534,18 @@ var OpenGeniClient = class {
|
|
|
5446
5534
|
throw error;
|
|
5447
5535
|
}
|
|
5448
5536
|
assertApiContractResponse(response);
|
|
5449
|
-
if (!response.ok) {
|
|
5450
|
-
throw await apiErrorFromResponse(response, { method, correlationId });
|
|
5451
|
-
}
|
|
5452
|
-
await assertJsonResponse(response, { method, correlationId });
|
|
5453
5537
|
try {
|
|
5454
|
-
|
|
5538
|
+
if (!response.ok) {
|
|
5539
|
+
throw await awaitWithAbort(
|
|
5540
|
+
apiErrorFromResponse(response, { method, correlationId }),
|
|
5541
|
+
abort.signal
|
|
5542
|
+
);
|
|
5543
|
+
}
|
|
5544
|
+
await awaitWithAbort(assertJsonResponse(response, { method, correlationId }), abort.signal);
|
|
5545
|
+
return await awaitWithAbort(response.json(), abort.signal);
|
|
5455
5546
|
} catch (error) {
|
|
5456
5547
|
if (options.signal?.aborted) throw error;
|
|
5548
|
+
if (error instanceof OpenGeniApiError) throw error;
|
|
5457
5549
|
if (isMutationMethod(method)) {
|
|
5458
5550
|
throw mutationTransportError(correlationId);
|
|
5459
5551
|
}
|
|
@@ -5798,4 +5890,4 @@ export {
|
|
|
5798
5890
|
parseMediaGenerationResult,
|
|
5799
5891
|
OpenGeniClient
|
|
5800
5892
|
};
|
|
5801
|
-
//# sourceMappingURL=chunk-
|
|
5893
|
+
//# sourceMappingURL=chunk-DWCHEOMP.js.map
|