@opengeni/sdk 3.5.1-canary.0 → 3.7.0-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.
Files changed (50) hide show
  1. package/README.md +65 -4
  2. package/dist/artifact-client.d.ts +2 -1
  3. package/dist/artifacts.js +4 -4
  4. package/dist/browser.d.ts +2 -0
  5. package/dist/browser.js +10 -2
  6. package/dist/{chunk-PPWKSUDS.js → chunk-2E2BFEEN.js} +2 -2
  7. package/dist/{chunk-HILHQEZD.js → chunk-3QDQTYOE.js} +3 -1
  8. package/dist/chunk-3QDQTYOE.js.map +1 -0
  9. package/dist/chunk-FMLDFJ2Q.js +246 -0
  10. package/dist/chunk-FMLDFJ2Q.js.map +1 -0
  11. package/dist/{chunk-GXC4RESV.js → chunk-IQTEPOI3.js} +66 -13
  12. package/dist/chunk-IQTEPOI3.js.map +1 -0
  13. package/dist/chunk-IRAEPLXG.js +350 -0
  14. package/dist/chunk-IRAEPLXG.js.map +1 -0
  15. package/dist/{chunk-3VIQGNRX.js → chunk-MPGVC7EO.js} +10 -2
  16. package/dist/chunk-MPGVC7EO.js.map +1 -0
  17. package/dist/client.d.ts +8 -7
  18. package/dist/core.d.ts +2 -0
  19. package/dist/core.js +11 -3
  20. package/dist/document-authority.js +3 -3
  21. package/dist/editable-artifacts.js +1 -1
  22. package/dist/index.d.ts +8 -2
  23. package/dist/index.js +42 -5
  24. package/dist/index.js.map +1 -1
  25. package/dist/model-context.d.ts +49 -0
  26. package/dist/proxy.d.ts +7 -5
  27. package/dist/site.d.ts +93 -0
  28. package/dist/site.js +35 -0
  29. package/dist/site.js.map +1 -0
  30. package/dist/tools-FSTY4FAY.js +12 -0
  31. package/dist/tools-FSTY4FAY.js.map +1 -0
  32. package/dist/tools.d.ts +61 -0
  33. package/dist/types.d.ts +110 -6
  34. package/dist/workspace-artifacts.d.ts +26 -1
  35. package/package.json +6 -2
  36. package/src/artifact-client.ts +14 -0
  37. package/src/browser.ts +13 -0
  38. package/src/client.ts +71 -7
  39. package/src/core.ts +13 -0
  40. package/src/index.ts +67 -0
  41. package/src/model-context.ts +69 -0
  42. package/src/proxy.ts +17 -6
  43. package/src/site.ts +544 -0
  44. package/src/tools.ts +396 -0
  45. package/src/types.ts +140 -6
  46. package/src/workspace-artifacts.ts +33 -2
  47. package/dist/chunk-3VIQGNRX.js.map +0 -1
  48. package/dist/chunk-GXC4RESV.js.map +0 -1
  49. package/dist/chunk-HILHQEZD.js.map +0 -1
  50. /package/dist/{chunk-PPWKSUDS.js.map → chunk-2E2BFEEN.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
- The initial web renderer supports semantic HTML, inline CSS, CSS-only
426
- interactions, and inline SVG. It removes JavaScript, event handlers, forms,
427
- embeds, external URLs, and other active or navigation-capable markup before
428
- rendering. Executable artifacts require a later, stronger isolation boundary.
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-3VIQGNRX.js";
4
- import "./chunk-PPWKSUDS.js";
5
- import "./chunk-GXC4RESV.js";
3
+ } from "./chunk-MPGVC7EO.js";
4
+ import "./chunk-2E2BFEEN.js";
5
+ import "./chunk-IQTEPOI3.js";
6
6
  import "./chunk-QTBAMHEF.js";
7
- import "./chunk-HILHQEZD.js";
7
+ import "./chunk-3QDQTYOE.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-GXC4RESV.js";
11
+ } from "./chunk-IQTEPOI3.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-HILHQEZD.js";
16
+ } from "./chunk-3QDQTYOE.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
  OpenGeniClient
3
- } from "./chunk-GXC4RESV.js";
3
+ } from "./chunk-IQTEPOI3.js";
4
4
 
5
5
  // src/document-authority-client.ts
6
6
  var OpenGeniDocumentAuthorityClient = class extends OpenGeniClient {
@@ -76,4 +76,4 @@ var OpenGeniDocumentAuthorityClient = class extends OpenGeniClient {
76
76
  export {
77
77
  OpenGeniDocumentAuthorityClient
78
78
  };
79
- //# sourceMappingURL=chunk-PPWKSUDS.js.map
79
+ //# sourceMappingURL=chunk-2E2BFEEN.js.map
@@ -52,6 +52,8 @@ var SESSION_EVENT_TYPES = [
52
52
  "sandbox.operation.failed",
53
53
  "session.command.backgrounded",
54
54
  "session.command.finished",
55
+ "session.wait.started",
56
+ "session.wait.finished",
55
57
  "sandbox.command.output.delta",
56
58
  "artifact.created",
57
59
  "goal.set",
@@ -236,4 +238,4 @@ export {
236
238
  GENERATED_VIDEO_MAX_BYTES,
237
239
  KNOWN_USAGE_EVENT_TYPES
238
240
  };
239
- //# sourceMappingURL=chunk-HILHQEZD.js.map
241
+ //# sourceMappingURL=chunk-3QDQTYOE.js.map