@opengeni/sdk 0.57.0 → 1.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 +1017 -26
- package/dist/accounts.d.ts +153 -0
- package/dist/accounts.js +307 -0
- package/dist/accounts.js.map +1 -0
- package/dist/adapters/express.d.ts +31 -0
- package/dist/adapters/express.js +87 -0
- package/dist/adapters/express.js.map +1 -0
- package/dist/adapters/hono.d.ts +16 -0
- package/dist/adapters/hono.js +8 -0
- package/dist/adapters/hono.js.map +1 -0
- package/dist/adapters/next.d.ts +29 -0
- package/dist/adapters/next.js +22 -0
- package/dist/adapters/next.js.map +1 -0
- package/dist/allowance-refusal.d.ts +2 -0
- package/dist/allowance-refusal.js +50 -0
- package/dist/allowance-refusal.js.map +1 -0
- package/dist/artifact-catalog.d.ts +31 -0
- package/dist/artifact-client.d.ts +23 -11
- package/dist/artifacts.d.ts +1 -1
- package/dist/artifacts.js +7 -5
- package/dist/automations-client.d.ts +17 -0
- package/dist/automations.d.ts +3 -0
- package/dist/automations.js +84 -0
- package/dist/automations.js.map +1 -0
- package/dist/browser.d.ts +11 -0
- package/dist/browser.js +47 -0
- package/dist/browser.js.map +1 -0
- package/dist/chat/fold.d.ts +75 -0
- package/dist/chat/handler.d.ts +41 -0
- package/dist/chat/http.d.ts +67 -0
- package/dist/chat/ids.d.ts +34 -0
- package/dist/chat/index.d.ts +9 -0
- package/dist/chat/index.js +1694 -0
- package/dist/chat/index.js.map +1 -0
- package/dist/chat/openai.d.ts +30 -0
- package/dist/chat/opengeni.d.ts +128 -0
- package/dist/chat/types.d.ts +207 -0
- package/dist/chat/vercel.d.ts +49 -0
- package/dist/chats.d.ts +8 -0
- package/dist/{chunk-JDLDDRNE.js → chunk-2UXZUCEZ.js} +291 -34
- package/dist/chunk-2UXZUCEZ.js.map +1 -0
- package/dist/chunk-4SMEOV3P.js +246 -0
- package/dist/chunk-4SMEOV3P.js.map +1 -0
- package/dist/{chunk-JRPFWI6T.js → chunk-AH5D5Q5V.js} +31 -35
- package/dist/chunk-AH5D5Q5V.js.map +1 -0
- package/dist/chunk-APXVSSSY.js +301 -0
- package/dist/chunk-APXVSSSY.js.map +1 -0
- package/dist/chunk-DUVIYER4.js +639 -0
- package/dist/chunk-DUVIYER4.js.map +1 -0
- package/dist/{chunk-PKQ377ED.js → chunk-FG3OO5LM.js} +2686 -611
- package/dist/chunk-FG3OO5LM.js.map +1 -0
- package/dist/chunk-GZYZT22T.js +260 -0
- package/dist/chunk-GZYZT22T.js.map +1 -0
- package/dist/chunk-HMGADJGZ.js +150 -0
- package/dist/chunk-HMGADJGZ.js.map +1 -0
- package/dist/{chunk-YKZME56C.js → chunk-KWADQ227.js} +3 -3
- package/dist/{chunk-YKZME56C.js.map → chunk-KWADQ227.js.map} +1 -1
- package/dist/chunk-LY2K6ELJ.js +126 -0
- package/dist/chunk-LY2K6ELJ.js.map +1 -0
- package/dist/chunk-MOTJYIYL.js +340 -0
- package/dist/chunk-MOTJYIYL.js.map +1 -0
- package/dist/{chunk-ST5DDKJP.js → chunk-NC57YMUO.js} +121 -3
- package/dist/chunk-NC57YMUO.js.map +1 -0
- package/dist/chunk-RWKB6YZG.js +1270 -0
- package/dist/chunk-RWKB6YZG.js.map +1 -0
- package/dist/chunk-U6CV2SXO.js +195 -0
- package/dist/chunk-U6CV2SXO.js.map +1 -0
- package/dist/chunk-UM4ZXXJR.js +9 -0
- package/dist/chunk-UM4ZXXJR.js.map +1 -0
- package/dist/chunk-V6GIY62B.js +229 -0
- package/dist/chunk-V6GIY62B.js.map +1 -0
- package/dist/chunk-WU6GQG25.js +268 -0
- package/dist/chunk-WU6GQG25.js.map +1 -0
- package/dist/{chunk-VWE2QIVO.js → chunk-XNG7YGR3.js} +23 -6
- package/dist/chunk-XNG7YGR3.js.map +1 -0
- package/dist/{chunk-HJ3HHUT5.js → chunk-YIKA2QT4.js} +33 -2
- package/dist/chunk-YIKA2QT4.js.map +1 -0
- package/dist/chunk-ZKPY6YAJ.js +135 -0
- package/dist/chunk-ZKPY6YAJ.js.map +1 -0
- package/dist/client.d.ts +740 -94
- package/dist/codex-realtime-controller.d.ts +3 -0
- package/dist/codex-realtime-controller.js +2 -2
- package/dist/codex-realtime-v3.d.ts +13 -2
- package/dist/company-brain.d.ts +22 -0
- package/dist/company-profile.d.ts +14 -1
- package/dist/core.d.ts +9 -3
- package/dist/core.js +25 -6
- package/dist/deprecation.d.ts +47 -0
- package/dist/document-authority-client.d.ts +51 -0
- package/dist/document-authority.d.ts +2 -0
- package/dist/document-authority.js +12 -0
- package/dist/document-authority.js.map +1 -0
- package/dist/editable-artifacts/browser-session.d.ts +7 -3
- package/dist/editable-artifacts/controller.d.ts +4 -1
- package/dist/editable-artifacts/errors.d.ts +1 -1
- package/dist/editable-artifacts/http-live-transport.d.ts +6 -2
- package/dist/editable-artifacts/index.d.ts +2 -0
- package/dist/editable-artifacts/open-failure.d.ts +9 -0
- package/dist/editable-artifacts/types.d.ts +6 -3
- package/dist/editable-artifacts/worker/kernel-adapter.d.ts +1 -1
- package/dist/editable-artifacts-worker.js +44 -17
- package/dist/editable-artifacts-worker.js.map +1 -1
- package/dist/editable-artifacts.js +240 -121
- package/dist/editable-artifacts.js.map +1 -1
- package/dist/embedding-client.d.ts +129 -0
- package/dist/errors.d.ts +36 -1
- package/dist/feedback.d.ts +23 -0
- package/dist/gateway-realtime-transport.js +1 -1
- package/dist/github-repositories.d.ts +10 -0
- package/dist/github-repositories.js +36 -0
- package/dist/github-repositories.js.map +1 -0
- package/dist/index.d.ts +56 -11
- package/dist/index.js +242 -125
- package/dist/index.js.map +1 -1
- package/dist/interaction.d.ts +84 -1
- package/dist/interaction.js +6 -1
- package/dist/knowledge.d.ts +7 -0
- package/dist/knowledge.js +20 -0
- package/dist/knowledge.js.map +1 -0
- package/dist/message-links.d.ts +68 -0
- package/dist/model-context.d.ts +68 -0
- package/dist/model-display.d.ts +2 -0
- package/dist/model-display.js +15 -0
- package/dist/model-display.js.map +1 -0
- package/dist/model-picker-order.d.ts +1 -0
- package/dist/model-picker-order.js +10 -0
- package/dist/model-picker-order.js.map +1 -0
- 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/organization-private-session-settings.d.ts +6 -0
- package/dist/organization-private-session-settings.js +22 -0
- package/dist/organization-private-session-settings.js.map +1 -0
- package/dist/organization-user-setup.d.ts +8 -0
- package/dist/organization-user-setup.js +16 -0
- package/dist/organization-user-setup.js.map +1 -0
- package/dist/pr-review-client.d.ts +16 -0
- package/dist/pr-review.d.ts +4 -0
- package/dist/pr-review.js +62 -0
- package/dist/pr-review.js.map +1 -0
- package/dist/preference-registry.d.ts +9 -1
- package/dist/proxy.d.ts +7 -5
- package/dist/realtime.d.ts +3 -1
- package/dist/realtime.js +6 -6
- package/dist/realtime.js.map +1 -1
- package/dist/retained-artifacts.d.ts +5 -1
- package/dist/session-history-import.d.ts +22 -0
- package/dist/session-history-import.js +36 -0
- package/dist/session-history-import.js.map +1 -0
- package/dist/session-list-entries.d.ts +1 -0
- package/dist/session-list-entries.js +7 -0
- package/dist/session-list-entries.js.map +1 -0
- package/dist/session-message-search.d.ts +53 -0
- package/dist/session-proxy-client.d.ts +24 -0
- package/dist/session-proxy.d.ts +245 -0
- package/dist/session-proxy.js +24 -0
- package/dist/session-proxy.js.map +1 -0
- package/dist/session-titles.d.ts +2 -0
- package/dist/site-browser-entry.d.ts +1 -0
- package/dist/site-browser-runtime.gen.d.ts +1 -0
- package/dist/site-document.d.ts +5 -0
- package/dist/site-document.js +20 -0
- package/dist/site-document.js.map +1 -0
- package/dist/site-document.test.d.ts +1 -0
- package/dist/site-http.d.ts +16 -0
- package/dist/site-tool-bridge.d.ts +44 -0
- package/dist/site.d.ts +101 -0
- package/dist/site.js +49 -0
- package/dist/site.js.map +1 -0
- package/dist/skills.d.ts +75 -0
- package/dist/stream.d.ts +2 -0
- package/dist/tenant-workspaces.d.ts +47 -0
- package/dist/tenant-workspaces.js +8 -0
- package/dist/tenant-workspaces.js.map +1 -0
- package/dist/tool-auth.d.ts +87 -0
- package/dist/tool-auth.js +23 -0
- package/dist/tool-auth.js.map +1 -0
- package/dist/tool-display-metadata.d.ts +3 -0
- package/dist/tools-FXBLUWAE.js +12 -0
- package/dist/tools-FXBLUWAE.js.map +1 -0
- package/dist/tools.d.ts +61 -0
- package/dist/types.d.ts +2863 -424
- package/dist/usage-allowances.d.ts +36 -0
- package/dist/usage-allowances.js +80 -0
- package/dist/usage-allowances.js.map +1 -0
- package/dist/workspace-artifacts.d.ts +33 -5
- package/dist/workspace-instruction-policies.d.ts +24 -2
- package/dist/workspace-integrations.d.ts +74 -0
- package/dist/workspace-integrations.js +65 -0
- package/dist/workspace-integrations.js.map +1 -0
- package/dist/workspace-learning.d.ts +124 -0
- package/dist/workspace-state.d.ts +8 -71
- package/package.json +108 -3
- package/src/accounts.ts +443 -0
- package/src/adapters/express.ts +136 -0
- package/src/adapters/hono.ts +18 -0
- package/src/adapters/next.ts +42 -0
- package/src/allowance-refusal.ts +5 -0
- package/src/artifact-catalog.ts +41 -0
- package/src/artifact-client.ts +43 -52
- package/src/artifacts.ts +7 -1
- package/src/automations-client.ts +124 -0
- package/src/automations.ts +15 -0
- package/src/browser.ts +54 -0
- package/src/chat/fold.ts +431 -0
- package/src/chat/handler.ts +240 -0
- package/src/chat/http.ts +257 -0
- package/src/chat/ids.ts +85 -0
- package/src/chat/index.ts +87 -0
- package/src/chat/openai.ts +439 -0
- package/src/chat/opengeni.ts +722 -0
- package/src/chat/types.ts +219 -0
- package/src/chat/vercel.ts +204 -0
- package/src/chats.ts +16 -0
- package/src/client.ts +4084 -515
- package/src/codex-realtime-controller.ts +235 -5
- package/src/codex-realtime-v3.ts +162 -31
- package/src/codex-realtime.ts +1 -1
- package/src/company-brain.ts +59 -0
- package/src/company-profile.ts +17 -1
- package/src/core.ts +23 -1
- package/src/deprecation.ts +149 -0
- package/src/document-authority-client.ts +219 -0
- package/src/document-authority.ts +17 -0
- package/src/editable-artifacts/browser-session.ts +36 -22
- package/src/editable-artifacts/controller.ts +102 -47
- package/src/editable-artifacts/errors.ts +2 -0
- package/src/editable-artifacts/http-live-transport.ts +62 -37
- package/src/editable-artifacts/index.ts +6 -0
- package/src/editable-artifacts/open-failure.ts +79 -0
- package/src/editable-artifacts/storage.ts +31 -40
- package/src/editable-artifacts/types.ts +6 -3
- package/src/editable-artifacts/worker/kernel-adapter.ts +23 -7
- package/src/editable-artifacts/worker/runtime.ts +26 -13
- package/src/editable-artifacts/worker/wire-codec.ts +23 -5
- package/src/embedding-client.ts +519 -0
- package/src/errors.ts +169 -2
- package/src/feedback.ts +20 -0
- package/src/gateway-realtime-transport.ts +3 -3
- package/src/github-repositories.ts +60 -0
- package/src/index.ts +561 -41
- package/src/interaction.ts +276 -4
- package/src/knowledge.ts +72 -0
- package/src/message-links.ts +178 -0
- package/src/model-context.ts +112 -0
- package/src/model-display.ts +10 -0
- package/src/model-picker-order.ts +6 -0
- package/src/organization-integration-policy.ts +54 -0
- package/src/organization-private-session-settings.ts +33 -0
- package/src/organization-user-setup.ts +31 -0
- package/src/pr-review-client.ts +92 -0
- package/src/pr-review.ts +17 -0
- package/src/preference-registry.ts +11 -0
- package/src/proxy.ts +17 -6
- package/src/realtime.ts +1 -0
- package/src/retained-artifacts.ts +101 -0
- package/src/session-history-import.ts +84 -0
- package/src/session-list-entries.ts +1 -0
- package/src/session-message-search.ts +47 -0
- package/src/session-proxy-client.ts +64 -0
- package/src/session-proxy.ts +1473 -0
- package/src/session-titles.ts +10 -0
- package/src/site-browser-entry.ts +6 -0
- package/src/site-browser-runtime.gen.ts +2 -0
- package/src/site-document.test.ts +64 -0
- package/src/site-document.ts +18 -0
- package/src/site-http.ts +162 -0
- package/src/site-tool-bridge.ts +146 -0
- package/src/site.ts +585 -0
- package/src/skills.ts +69 -0
- package/src/sse.ts +8 -2
- package/src/stream.ts +38 -4
- package/src/tenant-workspaces.ts +148 -0
- package/src/tool-auth.ts +301 -0
- package/src/tool-display-metadata.ts +19 -0
- package/src/tools.ts +396 -0
- package/src/types.ts +3346 -501
- package/src/usage-allowances.ts +189 -0
- package/src/workspace-artifacts.ts +40 -6
- package/src/workspace-instruction-policies.ts +26 -1
- package/src/workspace-integrations.ts +402 -0
- package/src/workspace-learning.ts +138 -0
- package/src/workspace-state.ts +8 -82
- package/dist/chunk-GU6JF75T.js +0 -119
- package/dist/chunk-GU6JF75T.js.map +0 -1
- package/dist/chunk-HJ3HHUT5.js.map +0 -1
- package/dist/chunk-JDLDDRNE.js.map +0 -1
- package/dist/chunk-JRPFWI6T.js.map +0 -1
- package/dist/chunk-PKQ377ED.js.map +0 -1
- package/dist/chunk-ST5DDKJP.js.map +0 -1
- package/dist/chunk-VWE2QIVO.js.map +0 -1
package/dist/site.d.ts
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
export { createSiteToolBridge, isSiteCatalogStaleError } from "./site-tool-bridge.js";
|
|
2
|
+
export type { SiteToolBridge, SiteToolCaller, SiteToolCallRequest, CreateSiteToolBridgeOptions, } from "./site-tool-bridge.js";
|
|
3
|
+
import { type OpenGeniWorkspaceTools } from "./tools.js";
|
|
4
|
+
import { OpenGeniClient } from "./client.js";
|
|
5
|
+
export { isSiteHttpRequest, serveSiteHttp, siteSessionPath, type SiteHttpRequest, } from "./site-http.js";
|
|
6
|
+
import type { ToolGatewayCallRequest, ToolGatewayCallResponse, ToolGatewayCatalog, ToolGatewayDeclarationsResponse } from "./types.js";
|
|
7
|
+
export declare const OPENGENI_SITE_BRIDGE_VERSION: 2;
|
|
8
|
+
export declare const OPENGENI_SITE_BRIDGE_CONNECT: "opengeni.site.connect";
|
|
9
|
+
export declare const OPENGENI_SITE_BRIDGE_READY: "opengeni.site.ready";
|
|
10
|
+
export declare const OPENGENI_SITE_BRIDGE_REQUEST: "opengeni.site.request";
|
|
11
|
+
export declare const OPENGENI_SITE_BRIDGE_RESPONSE: "opengeni.site.response";
|
|
12
|
+
export declare const OPENGENI_SITE_BRIDGE_CANCEL: "opengeni.site.cancel";
|
|
13
|
+
export declare const OPENGENI_SITE_BRIDGE_BOOTSTRAP_GLOBAL: "__opengeniSiteBridgeBootstrapV2";
|
|
14
|
+
export declare const OPENGENI_SITE_LOCAL_CODEMODE_PATH: "/__opengeni/site-tools";
|
|
15
|
+
export type OpenGeniSiteBridgeConnectMessage = {
|
|
16
|
+
type: typeof OPENGENI_SITE_BRIDGE_CONNECT;
|
|
17
|
+
version: typeof OPENGENI_SITE_BRIDGE_VERSION;
|
|
18
|
+
};
|
|
19
|
+
export type OpenGeniSiteBridgeReadyMessage = {
|
|
20
|
+
type: typeof OPENGENI_SITE_BRIDGE_READY;
|
|
21
|
+
version: typeof OPENGENI_SITE_BRIDGE_VERSION;
|
|
22
|
+
};
|
|
23
|
+
/** Site-originated calls cannot carry host-only approval tokens or Site-version authority. */
|
|
24
|
+
export type OpenGeniSiteToolCallRequest = Omit<ToolGatewayCallRequest, "approvalToken" | "siteArtifactId" | "siteVersionId">;
|
|
25
|
+
/** Host-filtered catalog projection. Tenant routing context never enters Site code. */
|
|
26
|
+
export type OpenGeniSiteToolCatalog = Omit<ToolGatewayCatalog, "accountId" | "workspaceId">;
|
|
27
|
+
export type OpenGeniSiteWorkspaceTools = OpenGeniWorkspaceTools<OpenGeniSiteToolCatalog>;
|
|
28
|
+
export type OpenGeniSiteBridgeRequestMessage = {
|
|
29
|
+
type: typeof OPENGENI_SITE_BRIDGE_REQUEST;
|
|
30
|
+
version: typeof OPENGENI_SITE_BRIDGE_VERSION;
|
|
31
|
+
requestId: string;
|
|
32
|
+
} & ({
|
|
33
|
+
method: "catalog";
|
|
34
|
+
} | {
|
|
35
|
+
method: "call";
|
|
36
|
+
payload: OpenGeniSiteToolCallRequest;
|
|
37
|
+
} | {
|
|
38
|
+
method: "declarations";
|
|
39
|
+
});
|
|
40
|
+
export type OpenGeniSiteBridgeCancelMessage = {
|
|
41
|
+
type: typeof OPENGENI_SITE_BRIDGE_CANCEL;
|
|
42
|
+
version: typeof OPENGENI_SITE_BRIDGE_VERSION;
|
|
43
|
+
requestId: string;
|
|
44
|
+
};
|
|
45
|
+
export type OpenGeniSiteBridgeResponseMessage = {
|
|
46
|
+
type: typeof OPENGENI_SITE_BRIDGE_RESPONSE;
|
|
47
|
+
version: typeof OPENGENI_SITE_BRIDGE_VERSION;
|
|
48
|
+
requestId: string;
|
|
49
|
+
} & ({
|
|
50
|
+
ok: true;
|
|
51
|
+
value: OpenGeniSiteToolCatalog | ToolGatewayCallResponse | ToolGatewayDeclarationsResponse;
|
|
52
|
+
} | {
|
|
53
|
+
ok: false;
|
|
54
|
+
error: {
|
|
55
|
+
code: string;
|
|
56
|
+
message: string;
|
|
57
|
+
retryable: boolean;
|
|
58
|
+
outcomeUnknown?: boolean;
|
|
59
|
+
};
|
|
60
|
+
});
|
|
61
|
+
export type OpenGeniSiteClient = {
|
|
62
|
+
/** Ordinary SDK, including React session/composer methods and SSE streams. */
|
|
63
|
+
readonly client: OpenGeniClient;
|
|
64
|
+
/** Host-bound routing alias, not a credential or a caller-selected tenant. */
|
|
65
|
+
readonly workspaceId: string;
|
|
66
|
+
/** Workspace-bound typed facade. The parent host owns workspace identity and credentials. */
|
|
67
|
+
readonly tools: OpenGeniSiteWorkspaceTools;
|
|
68
|
+
close(): void;
|
|
69
|
+
};
|
|
70
|
+
export type OpenGeniSiteClientOptions = {
|
|
71
|
+
/** Advanced embedding seam; ordinary Sites accept bootstrap only from their exact parent. */
|
|
72
|
+
parentWindow?: MessageEventSource;
|
|
73
|
+
/** Advanced embedding seam for listening to the host's document-bound bootstrap message. */
|
|
74
|
+
siteWindow?: Pick<Window, "parent" | "addEventListener" | "removeEventListener">;
|
|
75
|
+
/** Test/embedding seam for an already document-bound host bootstrap port. */
|
|
76
|
+
bootstrapPort?: MessagePort;
|
|
77
|
+
connectTimeoutMs?: number;
|
|
78
|
+
requestTimeoutMs?: number;
|
|
79
|
+
createMessageChannel?: () => MessageChannel;
|
|
80
|
+
/** Local-preview seam. Top-level pages use this same-origin Codemode proxy automatically. */
|
|
81
|
+
localCodemodePath?: string | false;
|
|
82
|
+
/** Test/embedding seam for local-preview requests. */
|
|
83
|
+
fetch?: typeof globalThis.fetch;
|
|
84
|
+
};
|
|
85
|
+
export declare class OpenGeniSiteBridgeError extends Error {
|
|
86
|
+
readonly code: string;
|
|
87
|
+
readonly retryable: boolean;
|
|
88
|
+
readonly outcomeUnknown: boolean;
|
|
89
|
+
constructor(code: string, message: string, retryable?: boolean, outcomeUnknown?: boolean);
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Create the browser client used by a Site. Published iframes use the parent
|
|
93
|
+
* MessagePort; top-level sandbox previews use the same-origin Codemode adapter.
|
|
94
|
+
* Credentials remain in the selected host and never enter Site code.
|
|
95
|
+
*/
|
|
96
|
+
export declare function createOpenGeniSiteClient(options?: OpenGeniSiteClientOptions): OpenGeniSiteClient;
|
|
97
|
+
export declare function isOpenGeniSiteBridgeConnectMessage(value: unknown): value is OpenGeniSiteBridgeConnectMessage;
|
|
98
|
+
export declare function isOpenGeniSiteBridgeRequestMessage(value: unknown): value is OpenGeniSiteBridgeRequestMessage;
|
|
99
|
+
export declare function isOpenGeniSiteBridgeCancelMessage(value: unknown): value is OpenGeniSiteBridgeCancelMessage;
|
|
100
|
+
/** Strip every host-only field before a call crosses the Site boundary. */
|
|
101
|
+
export declare function sanitizeOpenGeniSiteToolCallRequest(value: ToolGatewayCallRequest): OpenGeniSiteToolCallRequest;
|
package/dist/site.js
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import {
|
|
2
|
+
OPENGENI_SITE_BRIDGE_BOOTSTRAP_GLOBAL,
|
|
3
|
+
OPENGENI_SITE_BRIDGE_CANCEL,
|
|
4
|
+
OPENGENI_SITE_BRIDGE_CONNECT,
|
|
5
|
+
OPENGENI_SITE_BRIDGE_READY,
|
|
6
|
+
OPENGENI_SITE_BRIDGE_REQUEST,
|
|
7
|
+
OPENGENI_SITE_BRIDGE_RESPONSE,
|
|
8
|
+
OPENGENI_SITE_BRIDGE_VERSION,
|
|
9
|
+
OPENGENI_SITE_LOCAL_CODEMODE_PATH,
|
|
10
|
+
OpenGeniSiteBridgeError,
|
|
11
|
+
createOpenGeniSiteClient,
|
|
12
|
+
createSiteToolBridge,
|
|
13
|
+
isOpenGeniSiteBridgeCancelMessage,
|
|
14
|
+
isOpenGeniSiteBridgeConnectMessage,
|
|
15
|
+
isOpenGeniSiteBridgeRequestMessage,
|
|
16
|
+
isSiteCatalogStaleError,
|
|
17
|
+
isSiteHttpRequest,
|
|
18
|
+
sanitizeOpenGeniSiteToolCallRequest,
|
|
19
|
+
serveSiteHttp,
|
|
20
|
+
siteSessionPath
|
|
21
|
+
} from "./chunk-DUVIYER4.js";
|
|
22
|
+
import "./chunk-4SMEOV3P.js";
|
|
23
|
+
import "./chunk-FG3OO5LM.js";
|
|
24
|
+
import "./chunk-APXVSSSY.js";
|
|
25
|
+
import "./chunk-YIKA2QT4.js";
|
|
26
|
+
import "./chunk-NC57YMUO.js";
|
|
27
|
+
import "./chunk-V6GIY62B.js";
|
|
28
|
+
export {
|
|
29
|
+
OPENGENI_SITE_BRIDGE_BOOTSTRAP_GLOBAL,
|
|
30
|
+
OPENGENI_SITE_BRIDGE_CANCEL,
|
|
31
|
+
OPENGENI_SITE_BRIDGE_CONNECT,
|
|
32
|
+
OPENGENI_SITE_BRIDGE_READY,
|
|
33
|
+
OPENGENI_SITE_BRIDGE_REQUEST,
|
|
34
|
+
OPENGENI_SITE_BRIDGE_RESPONSE,
|
|
35
|
+
OPENGENI_SITE_BRIDGE_VERSION,
|
|
36
|
+
OPENGENI_SITE_LOCAL_CODEMODE_PATH,
|
|
37
|
+
OpenGeniSiteBridgeError,
|
|
38
|
+
createOpenGeniSiteClient,
|
|
39
|
+
createSiteToolBridge,
|
|
40
|
+
isOpenGeniSiteBridgeCancelMessage,
|
|
41
|
+
isOpenGeniSiteBridgeConnectMessage,
|
|
42
|
+
isOpenGeniSiteBridgeRequestMessage,
|
|
43
|
+
isSiteCatalogStaleError,
|
|
44
|
+
isSiteHttpRequest,
|
|
45
|
+
sanitizeOpenGeniSiteToolCallRequest,
|
|
46
|
+
serveSiteHttp,
|
|
47
|
+
siteSessionPath
|
|
48
|
+
};
|
|
49
|
+
//# sourceMappingURL=site.js.map
|
package/dist/site.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/dist/skills.d.ts
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/** Public shared Skill folder/history shapes; no runtime contracts dependency. */
|
|
2
|
+
export type SkillFile = {
|
|
3
|
+
path: string;
|
|
4
|
+
content: string;
|
|
5
|
+
};
|
|
6
|
+
export type SkillScope = "workspace" | "organization" | "user";
|
|
7
|
+
export type SkillRecord = {
|
|
8
|
+
removalOperationId?: string | null;
|
|
9
|
+
activationMode: "workspace_managed" | "session_selected";
|
|
10
|
+
pendingRevisionIds: string[];
|
|
11
|
+
id: string;
|
|
12
|
+
stableKey: string;
|
|
13
|
+
scope: SkillScope;
|
|
14
|
+
scopeVersion: number;
|
|
15
|
+
status: string;
|
|
16
|
+
activeRevisionId: string | null;
|
|
17
|
+
revisionId: string | null;
|
|
18
|
+
title: string | null;
|
|
19
|
+
description: string | null;
|
|
20
|
+
contentHash: string | null;
|
|
21
|
+
files: SkillFile[];
|
|
22
|
+
source: {
|
|
23
|
+
pluginId: string;
|
|
24
|
+
facetKey: string;
|
|
25
|
+
skillFacetId: string;
|
|
26
|
+
} | null;
|
|
27
|
+
};
|
|
28
|
+
export type SkillSummary = Omit<SkillRecord, "files">;
|
|
29
|
+
export type SkillWriteReceipt = {
|
|
30
|
+
removed?: boolean | undefined;
|
|
31
|
+
operationId: string;
|
|
32
|
+
skillId: string;
|
|
33
|
+
revisionId: string;
|
|
34
|
+
outcome: "applied" | "pending" | "preserved";
|
|
35
|
+
pendingReason?: "approval" | "source_finalization" | undefined;
|
|
36
|
+
replayed: boolean;
|
|
37
|
+
decision?: "rejected" | undefined;
|
|
38
|
+
skillReview?: import("./types.js").SkillReviewReference | undefined;
|
|
39
|
+
};
|
|
40
|
+
export type SkillPublicationReceipt = SkillWriteReceipt & {
|
|
41
|
+
sourceOperationId: string;
|
|
42
|
+
activationEventId: string | null;
|
|
43
|
+
};
|
|
44
|
+
export type SkillSourceReleaseReceipt = {
|
|
45
|
+
skillId: string;
|
|
46
|
+
revisionId: string | null;
|
|
47
|
+
disposition: "deactivated" | "preserved" | "inactive";
|
|
48
|
+
eventId: string | null;
|
|
49
|
+
warning: string | null;
|
|
50
|
+
};
|
|
51
|
+
export type SaveWorkspaceSkillRequest = {
|
|
52
|
+
operationId: string;
|
|
53
|
+
skillId: string;
|
|
54
|
+
expectedRevisionId: string | null;
|
|
55
|
+
expectedScopeVersion: number;
|
|
56
|
+
scope?: SkillScope;
|
|
57
|
+
stableKey: string;
|
|
58
|
+
files: SkillFile[];
|
|
59
|
+
deletions?: string[];
|
|
60
|
+
reason: string;
|
|
61
|
+
};
|
|
62
|
+
export type ApplyWorkspaceSkillRevisionRequest = {
|
|
63
|
+
removalOperationId?: string;
|
|
64
|
+
operationId: string;
|
|
65
|
+
revisionId: string;
|
|
66
|
+
expectedRevisionId: string | null;
|
|
67
|
+
expectedScopeVersion: number;
|
|
68
|
+
reason: string;
|
|
69
|
+
};
|
|
70
|
+
export type RemoveWorkspaceSkillRequest = {
|
|
71
|
+
operationId: string;
|
|
72
|
+
expectedRevisionId: string | null;
|
|
73
|
+
expectedScopeVersion: number;
|
|
74
|
+
reason: string;
|
|
75
|
+
};
|
package/dist/stream.d.ts
CHANGED
|
@@ -61,3 +61,5 @@ export declare function streamSessionEvents(transport: SessionEventStreamTranspo
|
|
|
61
61
|
export declare function runBeforeLive(beforeLive: (() => void | Promise<void>) | undefined, timeoutMs: number, signal: AbortSignal | undefined): Promise<void>;
|
|
62
62
|
export declare function jitteredDelay(delayMs: number, ratio: number): number;
|
|
63
63
|
export declare function withStreamInactivityTimeout(stream: ReadableStream<Uint8Array>, timeoutMs: number, signal: AbortSignal | undefined): ReadableStream<Uint8Array>;
|
|
64
|
+
/** Trusted SSE coverage attached non-enumerably to a streamed event. */
|
|
65
|
+
export declare function sessionEventStreamCoveredThrough(event: SessionEvent): number | null;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { OpenGeniEmbeddingClient } from "./embedding-client.js";
|
|
2
|
+
import type { Permission } from "./types.js";
|
|
3
|
+
export type WorkspaceIdTarget = {
|
|
4
|
+
/**
|
|
5
|
+
* Your tenant id. With user isolation and no tenant, the user gets one
|
|
6
|
+
* workspace of their own, independent of any tenant.
|
|
7
|
+
*/
|
|
8
|
+
tenant?: string | undefined;
|
|
9
|
+
user?: string | undefined;
|
|
10
|
+
/** External user identity source; defaults to the resolver's source. */
|
|
11
|
+
source?: string | undefined;
|
|
12
|
+
};
|
|
13
|
+
export type WorkspaceIdOptions = {
|
|
14
|
+
/**
|
|
15
|
+
* `tenant`: one workspace per tenant. `user`: a separate workspace for the
|
|
16
|
+
* user (per tenant when a tenant is given, otherwise one per user).
|
|
17
|
+
*/
|
|
18
|
+
isolation: "tenant" | "user";
|
|
19
|
+
};
|
|
20
|
+
export type WorkspaceIdResolverOptions = {
|
|
21
|
+
/** The organization id, or a lazy lookup (for example derived from the API key). */
|
|
22
|
+
organizationId: string | (() => Promise<string>);
|
|
23
|
+
source: string;
|
|
24
|
+
/** Workspace display name; receives the tenant id, or the user id for a per-user workspace. */
|
|
25
|
+
workspaceName?: ((tenant: string) => string) | undefined;
|
|
26
|
+
/**
|
|
27
|
+
* Per-user workspaces only (user isolation): permissions for the one member
|
|
28
|
+
* this resolver adds explicitly, its owner. Replaces the defaults: workspace
|
|
29
|
+
* read, session create/read/control (including sending messages), file
|
|
30
|
+
* upload/read, and attaching the host's per-session MCP servers. No admin
|
|
31
|
+
* permissions are granted by default. Tenant workspaces rely on the API,
|
|
32
|
+
* which adds a missing member with those defaults on their first request.
|
|
33
|
+
* Existing grants are never changed here; change them with
|
|
34
|
+
* `updateExternalWorkspaceMember`. The organization API key must also allow
|
|
35
|
+
* the selected permissions.
|
|
36
|
+
*/
|
|
37
|
+
memberPermissions?: readonly Permission[] | undefined;
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* Server-only workspace resolution using external workspace provisioning.
|
|
41
|
+
* Workspaces are created on first use and cached. A tenant workspace's members
|
|
42
|
+
* are added by the API on their first `asUser` request (the organization key
|
|
43
|
+
* needs `members:manage`). A per-user workspace stays single-user: the API
|
|
44
|
+
* never auto-admits anyone there, and this resolver adds its owner with a
|
|
45
|
+
* stable onboarding key, so retries never restore a revoked grant.
|
|
46
|
+
*/
|
|
47
|
+
export declare function createWorkspaceIdResolver(client: Pick<OpenGeniEmbeddingClient, "ensureWorkspace" | "addExternalWorkspaceMember">, options: WorkspaceIdResolverOptions): (target: WorkspaceIdTarget, resolution: WorkspaceIdOptions) => Promise<string>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Per-user credentials for a product's own MCP tool server.
|
|
3
|
+
*
|
|
4
|
+
* `createSessionProxyHandler({ toolServer })` mints a short-lived token for the
|
|
5
|
+
* user its `resolve` hook authenticated, attaches it to each session it creates,
|
|
6
|
+
* and refreshes it on every message, approval, and answer. The product's MCP
|
|
7
|
+
* endpoint calls {@link verifyToolRequest} on every request and scopes all data
|
|
8
|
+
* access to the returned identity, never to ids the model supplied.
|
|
9
|
+
*
|
|
10
|
+
* Wire format (for non-Node verifiers): an HS256 JWT in `Authorization: Bearer`,
|
|
11
|
+
* signed with the hex key from {@link deriveToolTokenKey} (`HMAC-SHA256(key =
|
|
12
|
+
* secret, message = "opengeni-tool-token:v1")`, where `secret` is
|
|
13
|
+
* `OPENGENI_API_KEY` unless configured). Give a non-Node verifier that derived
|
|
14
|
+
* key, never the organization key. Claims: `iss` = `"opengeni-session-proxy"`,
|
|
15
|
+
* `aud` = the tool server URL, `sub` = the external user id, `workspace_id`,
|
|
16
|
+
* `source`, optional `tenant`, `iat`, `exp`.
|
|
17
|
+
*/
|
|
18
|
+
/** `iss` of every tool token. */
|
|
19
|
+
export declare const TOOL_TOKEN_ISSUER = "opengeni-session-proxy";
|
|
20
|
+
/** HMAC message used to derive the signing key from the secret. */
|
|
21
|
+
export declare const TOOL_TOKEN_KEY_LABEL = "opengeni-tool-token:v1";
|
|
22
|
+
/** Default token lifetime: 24 hours, refreshed on every message, approval, and answer. */
|
|
23
|
+
export declare const TOOL_TOKEN_DEFAULT_TTL_SECONDS: number;
|
|
24
|
+
/** Default `toolServer.url` and `verifyToolRequest` audience. */
|
|
25
|
+
export declare const TOOL_SERVER_URL_ENV = "OPENGENI_TOOL_SERVER_URL";
|
|
26
|
+
/** The user a verified tool request acts for. */
|
|
27
|
+
export type ToolRequestIdentity = {
|
|
28
|
+
/** External user id the session proxy's `resolve` hook authenticated. */
|
|
29
|
+
user: string;
|
|
30
|
+
/** Tenant from `resolve`, when it returned one. */
|
|
31
|
+
tenant?: string | undefined;
|
|
32
|
+
workspaceId: string;
|
|
33
|
+
/** External identity source (same as the proxy's `asUser` source). */
|
|
34
|
+
source: string;
|
|
35
|
+
expiresAt: Date;
|
|
36
|
+
};
|
|
37
|
+
export type VerifyToolRequestOptions = {
|
|
38
|
+
/** Signing secret. Defaults to `OPENGENI_API_KEY`; must match the proxy's. */
|
|
39
|
+
secret?: string | undefined;
|
|
40
|
+
/**
|
|
41
|
+
* Exact tool server URL the token must be issued for (the proxy's
|
|
42
|
+
* `toolServer.url`). Defaults to `OPENGENI_TOOL_SERVER_URL`.
|
|
43
|
+
*/
|
|
44
|
+
audience?: string | undefined;
|
|
45
|
+
};
|
|
46
|
+
/** A Web `Request`, or a Node/Express request (`headers` plus `originalUrl`/`url`). */
|
|
47
|
+
export type ToolRequestLike = Request | {
|
|
48
|
+
headers: Record<string, string | string[] | undefined>;
|
|
49
|
+
originalUrl?: string | undefined;
|
|
50
|
+
url?: string | undefined;
|
|
51
|
+
};
|
|
52
|
+
/** Missing, expired, forged, or misdirected tool token. Respond with `status` (401). */
|
|
53
|
+
export declare class ToolRequestError extends Error {
|
|
54
|
+
readonly code: string;
|
|
55
|
+
readonly status = 401;
|
|
56
|
+
constructor(code: string);
|
|
57
|
+
/** A ready 401 response with a `WWW-Authenticate: Bearer` challenge. */
|
|
58
|
+
toResponse(): Response;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Verify the tool token on one MCP request and return who it acts for.
|
|
62
|
+
* Throws {@link ToolRequestError} (401) for every invalid token. Call it on
|
|
63
|
+
* every request, before any tool runs.
|
|
64
|
+
*
|
|
65
|
+
* ```ts
|
|
66
|
+
* const user = await verifyToolRequest(request); // { user, tenant, workspaceId }
|
|
67
|
+
* ```
|
|
68
|
+
*/
|
|
69
|
+
export declare function verifyToolRequest(request: ToolRequestLike, options?: VerifyToolRequestOptions): Promise<ToolRequestIdentity>;
|
|
70
|
+
/** Mint one tool token. The session proxy calls this; products rarely need to. */
|
|
71
|
+
export declare function mintToolToken(input: {
|
|
72
|
+
/** Tool server URL; becomes `aud`. */
|
|
73
|
+
audience: string;
|
|
74
|
+
user: string;
|
|
75
|
+
tenant?: string | undefined;
|
|
76
|
+
workspaceId: string;
|
|
77
|
+
source: string;
|
|
78
|
+
secret?: string | undefined;
|
|
79
|
+
ttlSeconds?: number | undefined;
|
|
80
|
+
}): Promise<string>;
|
|
81
|
+
/**
|
|
82
|
+
* The hex HS256 key tool tokens are signed with. Give this (not the
|
|
83
|
+
* organization key) to a tool server written in Python, Ruby, Go, and so on.
|
|
84
|
+
*/
|
|
85
|
+
export declare function deriveToolTokenKey(secret?: string): Promise<string>;
|
|
86
|
+
/** The configured secret, else `OPENGENI_API_KEY`. Throws when neither is set. */
|
|
87
|
+
export declare function resolveToolTokenSecret(secret: string | undefined): string;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import {
|
|
2
|
+
TOOL_SERVER_URL_ENV,
|
|
3
|
+
TOOL_TOKEN_DEFAULT_TTL_SECONDS,
|
|
4
|
+
TOOL_TOKEN_ISSUER,
|
|
5
|
+
TOOL_TOKEN_KEY_LABEL,
|
|
6
|
+
ToolRequestError,
|
|
7
|
+
deriveToolTokenKey,
|
|
8
|
+
mintToolToken,
|
|
9
|
+
resolveToolTokenSecret,
|
|
10
|
+
verifyToolRequest
|
|
11
|
+
} from "./chunk-U6CV2SXO.js";
|
|
12
|
+
export {
|
|
13
|
+
TOOL_SERVER_URL_ENV,
|
|
14
|
+
TOOL_TOKEN_DEFAULT_TTL_SECONDS,
|
|
15
|
+
TOOL_TOKEN_ISSUER,
|
|
16
|
+
TOOL_TOKEN_KEY_LABEL,
|
|
17
|
+
ToolRequestError,
|
|
18
|
+
deriveToolTokenKey,
|
|
19
|
+
mintToolToken,
|
|
20
|
+
resolveToolTokenSecret,
|
|
21
|
+
verifyToolRequest
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=tool-auth.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import {
|
|
2
|
+
OpenGeniToolCallError,
|
|
3
|
+
OpenGeniToolReapprovalRequiredError,
|
|
4
|
+
OpenGeniToolsClient
|
|
5
|
+
} from "./chunk-4SMEOV3P.js";
|
|
6
|
+
import "./chunk-V6GIY62B.js";
|
|
7
|
+
export {
|
|
8
|
+
OpenGeniToolCallError,
|
|
9
|
+
OpenGeniToolReapprovalRequiredError,
|
|
10
|
+
OpenGeniToolsClient
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=tools-FXBLUWAE.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/dist/tools.d.ts
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import type { ToolGatewayApprovalResponse, ToolGatewayCatalog, ToolGatewayDeclarationsResponse, ToolGatewayIdentity, ToolGatewayResult } from "./types.js";
|
|
2
|
+
export type OpenGeniToolCallOptions = {
|
|
3
|
+
operationId?: string;
|
|
4
|
+
signal?: AbortSignal;
|
|
5
|
+
refreshCatalog?: boolean;
|
|
6
|
+
/** Server-issued, single-use capability returned by `$approve`. */
|
|
7
|
+
approvalToken?: string;
|
|
8
|
+
};
|
|
9
|
+
export type OpenGeniToolFunction<TArguments extends Record<string, unknown> = Record<string, unknown>, TResult = unknown> = (argumentsValue?: TArguments, options?: OpenGeniToolCallOptions) => Promise<TResult>;
|
|
10
|
+
export interface OpenGeniDynamicToolNamespace {
|
|
11
|
+
readonly [key: string]: OpenGeniDynamicToolNode;
|
|
12
|
+
}
|
|
13
|
+
export type OpenGeniDynamicToolNode = OpenGeniDynamicToolNamespace & OpenGeniToolFunction;
|
|
14
|
+
/** Declaration-generation target for one exact workspace catalog. */
|
|
15
|
+
export interface OpenGeniGeneratedTools {
|
|
16
|
+
}
|
|
17
|
+
export type OpenGeniWorkspaceTools<TCatalog extends Pick<ToolGatewayCatalog, "version" | "generation" | "digest" | "createdAt" | "entries"> = ToolGatewayCatalog> = OpenGeniGeneratedTools & OpenGeniDynamicToolNamespace & {
|
|
18
|
+
readonly $catalog: (options?: {
|
|
19
|
+
refresh?: boolean;
|
|
20
|
+
signal?: AbortSignal;
|
|
21
|
+
}) => Promise<TCatalog>;
|
|
22
|
+
readonly $call: (identity: ToolGatewayIdentity, argumentsValue?: Record<string, unknown>, options?: OpenGeniToolCallOptions) => Promise<unknown>;
|
|
23
|
+
readonly $approve: (identity: ToolGatewayIdentity, argumentsValue?: Record<string, unknown>, options?: {
|
|
24
|
+
operationId?: string;
|
|
25
|
+
signal?: AbortSignal;
|
|
26
|
+
}) => Promise<ToolGatewayApprovalResponse>;
|
|
27
|
+
readonly $declarations: (options?: {
|
|
28
|
+
signal?: AbortSignal;
|
|
29
|
+
}) => Promise<ToolGatewayDeclarationsResponse>;
|
|
30
|
+
};
|
|
31
|
+
export interface OpenGeniToolTransport {
|
|
32
|
+
requestJson<T>(method: string, path: string, body?: unknown, query?: Record<string, string>, options?: {
|
|
33
|
+
signal?: AbortSignal;
|
|
34
|
+
timeoutMs?: number;
|
|
35
|
+
}): Promise<T>;
|
|
36
|
+
}
|
|
37
|
+
export interface OpenGeniToolsFacade {
|
|
38
|
+
forWorkspace(workspaceId: string): OpenGeniWorkspaceTools;
|
|
39
|
+
}
|
|
40
|
+
export declare class OpenGeniToolCallError extends Error {
|
|
41
|
+
readonly result: ToolGatewayResult;
|
|
42
|
+
readonly code: string;
|
|
43
|
+
readonly retryable: boolean;
|
|
44
|
+
readonly outcomeUnknown: boolean;
|
|
45
|
+
constructor(result: ToolGatewayResult);
|
|
46
|
+
}
|
|
47
|
+
/** A catalog refresh invalidated the single-use approval capability for this call. */
|
|
48
|
+
export declare class OpenGeniToolReapprovalRequiredError extends Error {
|
|
49
|
+
readonly operationId: string;
|
|
50
|
+
readonly previousCatalogDigest: string;
|
|
51
|
+
readonly catalogDigest: string;
|
|
52
|
+
readonly identity: ToolGatewayIdentity;
|
|
53
|
+
readonly code: "tool_reapproval_required";
|
|
54
|
+
readonly retryable = false;
|
|
55
|
+
constructor(operationId: string, previousCatalogDigest: string, catalogDigest: string, identity: ToolGatewayIdentity);
|
|
56
|
+
}
|
|
57
|
+
export declare class OpenGeniToolsClient implements OpenGeniToolsFacade {
|
|
58
|
+
private readonly transport;
|
|
59
|
+
constructor(transport: OpenGeniToolTransport);
|
|
60
|
+
forWorkspace(workspaceId: string): OpenGeniWorkspaceTools;
|
|
61
|
+
}
|