@opengeni/sdk 4.0.2 → 5.0.3-canary.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 +58 -9
- package/dist/artifact-client.d.ts +18 -8
- package/dist/artifacts.js +4 -4
- package/dist/browser.js +2 -2
- package/dist/chat/ids.d.ts +3 -3
- package/dist/chat/index.js +38 -51
- package/dist/chat/index.js.map +1 -1
- package/dist/chat/opengeni.d.ts +10 -12
- package/dist/chat/types.d.ts +7 -3
- package/dist/{chunk-O23OOWJK.js → chunk-4YAL54F3.js} +2 -2
- package/dist/{chunk-UW22XVCT.js → chunk-ARGX7UY4.js} +97 -2
- package/dist/chunk-ARGX7UY4.js.map +1 -0
- package/dist/chunk-J5USCWPE.js +195 -0
- package/dist/chunk-J5USCWPE.js.map +1 -0
- package/dist/{chunk-WNEGCYCE.js → chunk-TARU5CD2.js} +1 -1
- package/dist/chunk-TARU5CD2.js.map +1 -0
- package/dist/{chunk-3IZMCD2K.js → chunk-TOB3B4ZJ.js} +28 -41
- package/dist/chunk-TOB3B4ZJ.js.map +1 -0
- package/dist/{chunk-2H7P45YQ.js → chunk-UQGHX4DI.js} +173 -7
- package/dist/chunk-UQGHX4DI.js.map +1 -0
- package/dist/client.d.ts +39 -4
- package/dist/core.js +3 -3
- package/dist/document-authority.js +3 -3
- package/dist/editable-artifacts.js +1 -1
- package/dist/embedding-client.d.ts +72 -0
- package/dist/index.d.ts +4 -1
- package/dist/index.js +13 -8
- package/dist/index.js.map +1 -1
- package/dist/site-tool-bridge.d.ts +39 -0
- package/dist/site.d.ts +2 -0
- package/dist/site.js +7 -3
- package/dist/types.d.ts +23 -12
- package/package.json +3 -2
- package/src/artifact-client.ts +38 -63
- package/src/chat/ids.ts +3 -3
- package/src/chat/opengeni.ts +41 -57
- package/src/chat/types.ts +7 -3
- package/src/client.ts +253 -12
- package/src/embedding-client.ts +308 -0
- package/src/index.ts +16 -1
- package/src/site-tool-bridge.ts +141 -0
- package/src/site.ts +7 -0
- package/src/types.ts +18 -6
- package/dist/chunk-2H7P45YQ.js.map +0 -1
- package/dist/chunk-3IZMCD2K.js.map +0 -1
- package/dist/chunk-UW22XVCT.js.map +0 -1
- package/dist/chunk-WNEGCYCE.js.map +0 -1
- /package/dist/{chunk-O23OOWJK.js.map → chunk-4YAL54F3.js.map} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
OpenGeniDocumentAuthorityClient
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-4YAL54F3.js";
|
|
4
4
|
|
|
5
5
|
// src/artifact-client.ts
|
|
6
6
|
var OpenGeniClient = class extends OpenGeniDocumentAuthorityClient {
|
|
@@ -76,57 +76,44 @@ var OpenGeniClient = class extends OpenGeniDocumentAuthorityClient {
|
|
|
76
76
|
options
|
|
77
77
|
);
|
|
78
78
|
}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
`/v1/workspaces/${workspaceId}/published-artifacts${suffix}`
|
|
89
|
-
);
|
|
90
|
-
}
|
|
91
|
-
async getWorkspaceArtifact(workspaceId, artifactId) {
|
|
92
|
-
return await this.requestJson(
|
|
93
|
-
"GET",
|
|
94
|
-
`/v1/workspaces/${workspaceId}/published-artifacts/${encodeURIComponent(artifactId)}`
|
|
79
|
+
/** Exact Site-version gateway call. Keep this client on the authenticated host;
|
|
80
|
+
* the API enforces live viewer access and the version's declared tool allowlist. */
|
|
81
|
+
async callWorkspaceSiteTool(workspaceId, request, options = {}) {
|
|
82
|
+
return this.requestJson(
|
|
83
|
+
"POST",
|
|
84
|
+
`/v1/workspaces/${encodeURIComponent(workspaceId)}/tools/calls`,
|
|
85
|
+
request,
|
|
86
|
+
void 0,
|
|
87
|
+
options
|
|
95
88
|
);
|
|
96
89
|
}
|
|
97
|
-
async getWorkspaceArtifactContent(workspaceId, artifactId,
|
|
98
|
-
const
|
|
90
|
+
async getWorkspaceArtifactContent(workspaceId, artifactId, versionOrOptions) {
|
|
91
|
+
const options = typeof versionOrOptions === "string" ? { versionId: versionOrOptions } : versionOrOptions ?? {};
|
|
92
|
+
const query = options.versionId ? `?versionId=${encodeURIComponent(options.versionId)}` : "";
|
|
99
93
|
return await this.requestJson(
|
|
100
94
|
"GET",
|
|
101
|
-
`/v1/workspaces/${workspaceId}/published-artifacts/${encodeURIComponent(artifactId)}/content${query}
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
return await this.requestJson(
|
|
106
|
-
"POST",
|
|
107
|
-
`/v1/workspaces/${workspaceId}/published-artifacts`,
|
|
108
|
-
request
|
|
95
|
+
`/v1/workspaces/${encodeURIComponent(workspaceId)}/published-artifacts/${encodeURIComponent(artifactId)}/content${query}`,
|
|
96
|
+
void 0,
|
|
97
|
+
void 0,
|
|
98
|
+
options
|
|
109
99
|
);
|
|
110
100
|
}
|
|
111
|
-
async
|
|
101
|
+
async createWorkspaceArtifact(workspaceId, request, options = {}) {
|
|
112
102
|
return await this.requestJson(
|
|
113
103
|
"POST",
|
|
114
|
-
`/v1/workspaces/${workspaceId}/published-artifacts
|
|
115
|
-
request
|
|
104
|
+
`/v1/workspaces/${encodeURIComponent(workspaceId)}/published-artifacts`,
|
|
105
|
+
request,
|
|
106
|
+
void 0,
|
|
107
|
+
options
|
|
116
108
|
);
|
|
117
109
|
}
|
|
118
|
-
async
|
|
110
|
+
async publishWorkspaceArtifactVersion(workspaceId, artifactId, request, options = {}) {
|
|
119
111
|
return await this.requestJson(
|
|
120
112
|
"POST",
|
|
121
|
-
`/v1/workspaces/${workspaceId}/published-artifacts/${encodeURIComponent(artifactId)}/
|
|
122
|
-
request
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
async setWorkspaceArtifactStatus(workspaceId, artifactId, request) {
|
|
126
|
-
return await this.requestJson(
|
|
127
|
-
"PATCH",
|
|
128
|
-
`/v1/workspaces/${workspaceId}/published-artifacts/${encodeURIComponent(artifactId)}/status`,
|
|
129
|
-
request
|
|
113
|
+
`/v1/workspaces/${encodeURIComponent(workspaceId)}/published-artifacts/${encodeURIComponent(artifactId)}/versions`,
|
|
114
|
+
request,
|
|
115
|
+
void 0,
|
|
116
|
+
options
|
|
130
117
|
);
|
|
131
118
|
}
|
|
132
119
|
};
|
|
@@ -134,4 +121,4 @@ var OpenGeniClient = class extends OpenGeniDocumentAuthorityClient {
|
|
|
134
121
|
export {
|
|
135
122
|
OpenGeniClient
|
|
136
123
|
};
|
|
137
|
-
//# sourceMappingURL=chunk-
|
|
124
|
+
//# sourceMappingURL=chunk-TOB3B4ZJ.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 { SiteToolCallRequest } from \"./site-tool-bridge\";\nimport type { ToolGatewayCallResponse } from \"./types\";\nimport type {\n CreateWorkspaceArtifactRequest,\n PublishWorkspaceArtifactVersionRequest,\n WorkspaceArtifactContentResponse,\n WorkspaceArtifactMutationResponse,\n} from \"./workspace-artifacts\";\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\";\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 /** Exact Site-version gateway call. Keep this client on the authenticated host;\n * the API enforces live viewer access and the version's declared tool allowlist. */\n async callWorkspaceSiteTool(\n workspaceId: string,\n request: SiteToolCallRequest,\n options: { signal?: AbortSignal } = {},\n ): Promise<ToolGatewayCallResponse> {\n return this.requestJson<ToolGatewayCallResponse>(\n \"POST\",\n `/v1/workspaces/${encodeURIComponent(workspaceId)}/tools/calls`,\n request,\n undefined,\n options,\n );\n }\n\n async getWorkspaceArtifactContent(\n workspaceId: string,\n artifactId: string,\n versionOrOptions?: string | { versionId?: string; signal?: AbortSignal },\n ): Promise<WorkspaceArtifactContentResponse> {\n const options =\n typeof versionOrOptions === \"string\"\n ? { versionId: versionOrOptions }\n : (versionOrOptions ?? {});\n const query = options.versionId ? `?versionId=${encodeURIComponent(options.versionId)}` : \"\";\n return await this.requestJson<WorkspaceArtifactContentResponse>(\n \"GET\",\n `/v1/workspaces/${encodeURIComponent(workspaceId)}/published-artifacts/${encodeURIComponent(artifactId)}/content${query}`,\n undefined,\n undefined,\n options,\n );\n }\n\n async createWorkspaceArtifact(\n workspaceId: string,\n request: CreateWorkspaceArtifactRequest,\n options: { signal?: AbortSignal } = {},\n ): Promise<WorkspaceArtifactMutationResponse> {\n return await this.requestJson<WorkspaceArtifactMutationResponse>(\n \"POST\",\n `/v1/workspaces/${encodeURIComponent(workspaceId)}/published-artifacts`,\n request,\n undefined,\n options,\n );\n }\n\n async publishWorkspaceArtifactVersion(\n workspaceId: string,\n artifactId: string,\n request: PublishWorkspaceArtifactVersionRequest,\n options: { signal?: AbortSignal } = {},\n ): Promise<WorkspaceArtifactMutationResponse> {\n return await this.requestJson<WorkspaceArtifactMutationResponse>(\n \"POST\",\n `/v1/workspaces/${encodeURIComponent(workspaceId)}/published-artifacts/${encodeURIComponent(artifactId)}/versions`,\n request,\n undefined,\n options,\n );\n }\n}\n"],"mappings":"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","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-TARU5CD2.js";
|
|
13
13
|
import {
|
|
14
14
|
OpenGeniApiContractMismatchError,
|
|
15
15
|
OpenGeniApiError,
|
|
@@ -774,12 +774,12 @@ function safeIntegerBetween(value, min, max) {
|
|
|
774
774
|
|
|
775
775
|
// src/client.ts
|
|
776
776
|
function sessionListQuery(options) {
|
|
777
|
-
const { limit, parentSessionId,
|
|
777
|
+
const { limit, parentSessionId, scopeSubjectId } = options;
|
|
778
778
|
return {
|
|
779
779
|
...options.originSiteId ? { originSiteId: options.originSiteId } : {},
|
|
780
780
|
...limit === void 0 ? {} : { limit: String(limit) },
|
|
781
781
|
...parentSessionId === void 0 ? {} : { parentSessionId: parentSessionId ?? "null" },
|
|
782
|
-
...
|
|
782
|
+
...scopeSubjectId === void 0 ? {} : { scopeSubjectId }
|
|
783
783
|
};
|
|
784
784
|
}
|
|
785
785
|
function hasSessionPageFilters(options) {
|
|
@@ -868,6 +868,7 @@ function createLazyToolsFacade(transport) {
|
|
|
868
868
|
};
|
|
869
869
|
}
|
|
870
870
|
var OpenGeniClient = class {
|
|
871
|
+
externalActorHeader;
|
|
871
872
|
baseUrl;
|
|
872
873
|
options;
|
|
873
874
|
fetchImpl;
|
|
@@ -1068,7 +1069,7 @@ var OpenGeniClient = class {
|
|
|
1068
1069
|
async createSession(workspaceId, request) {
|
|
1069
1070
|
return await this.requestJson(
|
|
1070
1071
|
"POST",
|
|
1071
|
-
`/v1/workspaces/${workspaceId}/sessions`,
|
|
1072
|
+
`/v1/workspaces/${encodeURIComponent(workspaceId)}/sessions`,
|
|
1072
1073
|
request
|
|
1073
1074
|
);
|
|
1074
1075
|
}
|
|
@@ -3501,6 +3502,109 @@ var OpenGeniClient = class {
|
|
|
3501
3502
|
async listWorkspaces() {
|
|
3502
3503
|
return await this.requestJson("GET", "/v1/workspaces");
|
|
3503
3504
|
}
|
|
3505
|
+
/** Uses this client's fixed actor and standard contract/error/abort handling.
|
|
3506
|
+
* Disconnect revokes OpenGeni connection access, not upstream provider consent. */
|
|
3507
|
+
connectTransport() {
|
|
3508
|
+
const root = (workspaceId) => `/v1/workspaces/${encodeURIComponent(workspaceId)}/connect`;
|
|
3509
|
+
return {
|
|
3510
|
+
catalog: (workspaceId, options) => this.requestJson("GET", `${root(workspaceId)}/catalog`, void 0, void 0, options),
|
|
3511
|
+
accounts: (workspaceId, options) => this.requestJson("GET", `${root(workspaceId)}/accounts`, void 0, void 0, options),
|
|
3512
|
+
pending: (workspaceId, options) => this.requestJson("GET", `${root(workspaceId)}/attempts`, void 0, void 0, options),
|
|
3513
|
+
begin: (workspaceId, input, options) => this.requestJson("POST", `${root(workspaceId)}/attempts`, input, void 0, options),
|
|
3514
|
+
get: (workspaceId, id, options) => this.requestJson(
|
|
3515
|
+
"GET",
|
|
3516
|
+
`${root(workspaceId)}/attempts/${encodeURIComponent(id)}`,
|
|
3517
|
+
void 0,
|
|
3518
|
+
void 0,
|
|
3519
|
+
options
|
|
3520
|
+
),
|
|
3521
|
+
advance: (workspaceId, id, input, options) => this.requestJson(
|
|
3522
|
+
"POST",
|
|
3523
|
+
`${root(workspaceId)}/attempts/${encodeURIComponent(id)}/advance`,
|
|
3524
|
+
input,
|
|
3525
|
+
void 0,
|
|
3526
|
+
options
|
|
3527
|
+
),
|
|
3528
|
+
cancel: (workspaceId, id, input, options) => this.requestJson(
|
|
3529
|
+
"POST",
|
|
3530
|
+
`${root(workspaceId)}/attempts/${encodeURIComponent(id)}/cancel`,
|
|
3531
|
+
input,
|
|
3532
|
+
void 0,
|
|
3533
|
+
options
|
|
3534
|
+
),
|
|
3535
|
+
disconnect: async (workspaceId, id, options) => {
|
|
3536
|
+
if (id.startsWith("social:")) {
|
|
3537
|
+
const connectionId = id.slice("social:".length);
|
|
3538
|
+
if (!/^[0-9a-f-]{36}$/i.test(connectionId)) throw new Error("Invalid social account ID");
|
|
3539
|
+
await this.disconnectSocialConnection(workspaceId, connectionId);
|
|
3540
|
+
return;
|
|
3541
|
+
}
|
|
3542
|
+
if (id.startsWith("lens-registration:")) {
|
|
3543
|
+
const registrationId = id.slice("lens-registration:".length);
|
|
3544
|
+
if (!/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(registrationId))
|
|
3545
|
+
throw new Error("Invalid Lens registration ID");
|
|
3546
|
+
await this.requestJson(
|
|
3547
|
+
"DELETE",
|
|
3548
|
+
`/v1/workspaces/${encodeURIComponent(workspaceId)}/pr-review/registrations/${registrationId}`,
|
|
3549
|
+
void 0,
|
|
3550
|
+
void 0,
|
|
3551
|
+
options
|
|
3552
|
+
);
|
|
3553
|
+
return;
|
|
3554
|
+
}
|
|
3555
|
+
if (id.startsWith("github-installation:")) {
|
|
3556
|
+
const installationId = id.slice("github-installation:".length);
|
|
3557
|
+
if (!/^[1-9][0-9]*$/.test(installationId) || !Number.isSafeInteger(Number(installationId)))
|
|
3558
|
+
throw new Error("Invalid GitHub installation ID");
|
|
3559
|
+
await this.requestJson(
|
|
3560
|
+
"DELETE",
|
|
3561
|
+
`/v1/workspaces/${encodeURIComponent(workspaceId)}/github/installations/${installationId}`,
|
|
3562
|
+
void 0,
|
|
3563
|
+
void 0,
|
|
3564
|
+
options
|
|
3565
|
+
);
|
|
3566
|
+
return;
|
|
3567
|
+
}
|
|
3568
|
+
const expectedVersion = options?.expectedVersion;
|
|
3569
|
+
if (expectedVersion !== void 0 && (!Number.isSafeInteger(expectedVersion) || expectedVersion < 1)) {
|
|
3570
|
+
throw new Error("invalid expected connection version");
|
|
3571
|
+
}
|
|
3572
|
+
const query = expectedVersion === void 0 ? "" : `?expectedVersion=${expectedVersion}`;
|
|
3573
|
+
await this.requestJson(
|
|
3574
|
+
"DELETE",
|
|
3575
|
+
`/v1/workspaces/${encodeURIComponent(workspaceId)}/connections/${encodeURIComponent(id)}${query}`,
|
|
3576
|
+
void 0,
|
|
3577
|
+
void 0,
|
|
3578
|
+
options
|
|
3579
|
+
);
|
|
3580
|
+
}
|
|
3581
|
+
};
|
|
3582
|
+
}
|
|
3583
|
+
/** Browse first-party Atlassian sources without choosing or starting sync. */
|
|
3584
|
+
async browseAtlassianSources(workspaceId, connectionId) {
|
|
3585
|
+
return this.requestJson(
|
|
3586
|
+
"GET",
|
|
3587
|
+
`/v1/workspaces/${workspaceId}/connections/atlassian/${connectionId}/browse`
|
|
3588
|
+
);
|
|
3589
|
+
}
|
|
3590
|
+
async saveAtlassianSources(workspaceId, connectionId, request) {
|
|
3591
|
+
return this.requestJson(
|
|
3592
|
+
"POST",
|
|
3593
|
+
`/v1/workspaces/${workspaceId}/connections/atlassian/${connectionId}/source`,
|
|
3594
|
+
request
|
|
3595
|
+
);
|
|
3596
|
+
}
|
|
3597
|
+
async setAtlassianLifecycle(workspaceId, connectionId, request) {
|
|
3598
|
+
return this.requestJson(
|
|
3599
|
+
"PATCH",
|
|
3600
|
+
`/v1/workspaces/${workspaceId}/connections/atlassian/${connectionId}/lifecycle`,
|
|
3601
|
+
request
|
|
3602
|
+
);
|
|
3603
|
+
}
|
|
3604
|
+
/** Begin durable setup. Completion requirements are provider-specific. */
|
|
3605
|
+
async beginConnect(workspaceId, request) {
|
|
3606
|
+
return this.requestJson("POST", `/v1/workspaces/${workspaceId}/connect/attempts`, request);
|
|
3607
|
+
}
|
|
3504
3608
|
async createWorkspace(request) {
|
|
3505
3609
|
return await this.requestJson("POST", "/v1/workspaces", request);
|
|
3506
3610
|
}
|
|
@@ -4760,6 +4864,58 @@ var OpenGeniClient = class {
|
|
|
4760
4864
|
`/v1/workspaces/${workspaceId}/capabilities/${encodeURIComponent(capabilityId)}/disable`
|
|
4761
4865
|
);
|
|
4762
4866
|
}
|
|
4867
|
+
async listWorkspaceArtifacts(workspaceId, options = {}) {
|
|
4868
|
+
const query = new URLSearchParams();
|
|
4869
|
+
if (options.limit !== void 0) query.set("limit", String(options.limit));
|
|
4870
|
+
if (options.cursor) query.set("cursor", options.cursor);
|
|
4871
|
+
if (options.status) query.set("status", options.status);
|
|
4872
|
+
if (options.sourceSessionId) query.set("sourceSessionId", options.sourceSessionId);
|
|
4873
|
+
const suffix = query.size > 0 ? `?${query.toString()}` : "";
|
|
4874
|
+
return await this.requestJson(
|
|
4875
|
+
"GET",
|
|
4876
|
+
`/v1/workspaces/${encodeURIComponent(workspaceId)}/published-artifacts${suffix}`,
|
|
4877
|
+
void 0,
|
|
4878
|
+
void 0,
|
|
4879
|
+
options
|
|
4880
|
+
);
|
|
4881
|
+
}
|
|
4882
|
+
async getWorkspaceArtifact(workspaceId, artifactId, options = {}) {
|
|
4883
|
+
return await this.requestJson(
|
|
4884
|
+
"GET",
|
|
4885
|
+
`/v1/workspaces/${encodeURIComponent(workspaceId)}/published-artifacts/${encodeURIComponent(artifactId)}`,
|
|
4886
|
+
void 0,
|
|
4887
|
+
void 0,
|
|
4888
|
+
options
|
|
4889
|
+
);
|
|
4890
|
+
}
|
|
4891
|
+
/** Display-only HTML delivery: do not download the retained source bundle to render a Site. */
|
|
4892
|
+
async getWorkspaceArtifactHtml(workspaceId, artifactId, options) {
|
|
4893
|
+
const response = await this.requestResponse(
|
|
4894
|
+
"GET",
|
|
4895
|
+
`/v1/workspaces/${encodeURIComponent(workspaceId)}/published-artifacts/${encodeURIComponent(artifactId)}/html`,
|
|
4896
|
+
{ versionId: options.versionId },
|
|
4897
|
+
options
|
|
4898
|
+
);
|
|
4899
|
+
return response.text();
|
|
4900
|
+
}
|
|
4901
|
+
async rollbackWorkspaceArtifact(workspaceId, artifactId, request, options = {}) {
|
|
4902
|
+
return await this.requestJson(
|
|
4903
|
+
"POST",
|
|
4904
|
+
`/v1/workspaces/${encodeURIComponent(workspaceId)}/published-artifacts/${encodeURIComponent(artifactId)}/rollback`,
|
|
4905
|
+
request,
|
|
4906
|
+
void 0,
|
|
4907
|
+
options
|
|
4908
|
+
);
|
|
4909
|
+
}
|
|
4910
|
+
async setWorkspaceArtifactStatus(workspaceId, artifactId, request, options = {}) {
|
|
4911
|
+
return await this.requestJson(
|
|
4912
|
+
"PATCH",
|
|
4913
|
+
`/v1/workspaces/${encodeURIComponent(workspaceId)}/published-artifacts/${encodeURIComponent(artifactId)}/status`,
|
|
4914
|
+
request,
|
|
4915
|
+
void 0,
|
|
4916
|
+
options
|
|
4917
|
+
);
|
|
4918
|
+
}
|
|
4763
4919
|
/** Search the official MCP registry for installable capabilities. */
|
|
4764
4920
|
async discoverMcpCapabilities(workspaceId, options = {}) {
|
|
4765
4921
|
return await this.requestJson(
|
|
@@ -5325,7 +5481,7 @@ var OpenGeniClient = class {
|
|
|
5325
5481
|
{
|
|
5326
5482
|
...options.limit === void 0 ? {} : { limit: String(options.limit) },
|
|
5327
5483
|
...options.cursor === void 0 ? {} : { cursor: options.cursor },
|
|
5328
|
-
...options.
|
|
5484
|
+
...options.scopeSubjectId ? { scopeSubjectId: options.scopeSubjectId } : {},
|
|
5329
5485
|
...options.status === void 0 ? {} : { status: options.status }
|
|
5330
5486
|
},
|
|
5331
5487
|
{ signal: options.signal }
|
|
@@ -5399,12 +5555,19 @@ var OpenGeniClient = class {
|
|
|
5399
5555
|
// --- Internals -------------------------------------------------------------
|
|
5400
5556
|
headers(correlationId) {
|
|
5401
5557
|
const extra = typeof this.options.headers === "function" ? this.options.headers() : this.options.headers;
|
|
5402
|
-
|
|
5558
|
+
const headers = {
|
|
5403
5559
|
...this.options.apiKey ? { Authorization: `Bearer ${this.options.apiKey}` } : {},
|
|
5404
5560
|
...extra,
|
|
5405
5561
|
[OPENGENI_API_CONTRACT_HEADER]: OPENGENI_API_CONTRACT_REVISION,
|
|
5406
5562
|
...correlationId ? { [OPENGENI_CORRELATION_HEADER]: correlationId } : {}
|
|
5407
5563
|
};
|
|
5564
|
+
if (this.externalActorHeader) {
|
|
5565
|
+
for (const key of Object.keys(headers)) {
|
|
5566
|
+
if (key.toLowerCase() === "x-opengeni-external-actor") delete headers[key];
|
|
5567
|
+
}
|
|
5568
|
+
headers["x-opengeni-external-actor"] = this.externalActorHeader;
|
|
5569
|
+
}
|
|
5570
|
+
return headers;
|
|
5408
5571
|
}
|
|
5409
5572
|
url(path, query = {}) {
|
|
5410
5573
|
const params = new URLSearchParams(query).toString();
|
|
@@ -5673,6 +5836,9 @@ var OpenGeniClient = class {
|
|
|
5673
5836
|
const correlationId = crypto.randomUUID();
|
|
5674
5837
|
const abort = requestAbortSignal(options);
|
|
5675
5838
|
try {
|
|
5839
|
+
if (abort.signal?.aborted) {
|
|
5840
|
+
throw abort.signal.reason ?? new DOMException("Request aborted", "AbortError");
|
|
5841
|
+
}
|
|
5676
5842
|
let response;
|
|
5677
5843
|
try {
|
|
5678
5844
|
response = await awaitWithAbort(
|
|
@@ -6052,4 +6218,4 @@ export {
|
|
|
6052
6218
|
parseMediaGenerationResult,
|
|
6053
6219
|
OpenGeniClient
|
|
6054
6220
|
};
|
|
6055
|
-
//# sourceMappingURL=chunk-
|
|
6221
|
+
//# sourceMappingURL=chunk-UQGHX4DI.js.map
|