@opengeni/api-router 0.22.2 → 0.26.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.
Files changed (124) hide show
  1. package/dist/app.d.ts +2 -2
  2. package/dist/app.js +1 -1
  3. package/dist/auth/managed-auth.d.ts +0 -30
  4. package/dist/browser-controller-authority.d.ts +43 -0
  5. package/dist/browser-state-authority.d.ts +27 -0
  6. package/dist/{chunk-HWXJW5C7.js → chunk-JIKNR5YL.js} +27993 -14546
  7. package/dist/chunk-JIKNR5YL.js.map +1 -0
  8. package/dist/codemode.d.ts +23 -0
  9. package/dist/editable-artifact-live-hints.d.ts +11 -0
  10. package/dist/editable-artifact-native-kernel.d.ts +37 -0
  11. package/dist/editable-artifact-office-import.d.ts +22 -0
  12. package/dist/editable-artifact-production.d.ts +29 -0
  13. package/dist/editable-artifact-websocket.d.ts +49 -0
  14. package/dist/editable-artifact-workspace-files.d.ts +23 -0
  15. package/dist/github-browser-flow.d.ts +6 -0
  16. package/dist/http/cors.d.ts +1 -0
  17. package/dist/http/sse.d.ts +2 -0
  18. package/dist/index.d.ts +3 -2
  19. package/dist/index.js +1824 -30
  20. package/dist/index.js.map +1 -1
  21. package/dist/integrations/api-integrations.d.ts +24 -0
  22. package/dist/integrations/atlassian.d.ts +176 -0
  23. package/dist/integrations/github-skill-source.d.ts +5 -0
  24. package/dist/integrations/google-drive.d.ts +85 -0
  25. package/dist/integrations/oauth-client.d.ts +30 -1
  26. package/dist/integrations/provider-oauth.d.ts +19 -0
  27. package/dist/integrations/slack-bot.d.ts +4 -0
  28. package/dist/integrations/slack-interactions.d.ts +14 -2
  29. package/dist/integrations/social-api.d.ts +2 -1
  30. package/dist/mcp/editable-artifact-query-schema.d.ts +4 -0
  31. package/dist/mcp/editable-artifacts.d.ts +13 -0
  32. package/dist/mcp/receipts.d.ts +28 -0
  33. package/dist/mcp/scheduled-task-view.d.ts +518 -0
  34. package/dist/mcp/server.d.ts +14 -3
  35. package/dist/memory-slack-delivery.d.ts +9 -0
  36. package/dist/routes/api-integrations.d.ts +8 -0
  37. package/dist/routes/browser-identities.d.ts +5 -0
  38. package/dist/routes/browser-sessions.d.ts +6 -0
  39. package/dist/routes/company-profile.d.ts +3 -0
  40. package/dist/routes/computer-sessions.d.ts +6 -0
  41. package/dist/routes/editable-artifacts.d.ts +44 -0
  42. package/dist/routes/integration-features.d.ts +3 -0
  43. package/dist/routes/memory-slack-publications.d.ts +6 -0
  44. package/dist/routes/plugins.d.ts +8 -0
  45. package/dist/routes/sessions.d.ts +17 -2
  46. package/dist/routes/skills.d.ts +6 -0
  47. package/dist/routes/video-generation.d.ts +3 -0
  48. package/dist/sandbox/auth-callout.d.ts +2 -0
  49. package/dist/sandbox/channel-a.d.ts +59 -2
  50. package/dist/sandbox/metrics-ingestion.d.ts +6 -1
  51. package/dist/sandbox/viewer.d.ts +4 -2
  52. package/dist/temporal-schedule-cleanup.d.ts +26 -0
  53. package/package.json +19 -14
  54. package/src/app.ts +277 -41
  55. package/src/auth/managed-auth.ts +0 -16
  56. package/src/browser-controller-authority.ts +137 -0
  57. package/src/browser-state-authority.ts +236 -0
  58. package/src/codemode.ts +186 -0
  59. package/src/editable-artifact-live-hints.ts +64 -0
  60. package/src/editable-artifact-native-kernel.ts +659 -0
  61. package/src/editable-artifact-office-import.ts +230 -0
  62. package/src/editable-artifact-production.ts +419 -0
  63. package/src/editable-artifact-websocket.ts +311 -0
  64. package/src/editable-artifact-workspace-files.ts +186 -0
  65. package/src/github-browser-flow.ts +35 -6
  66. package/src/http/auth.ts +2 -0
  67. package/src/http/cors.ts +3 -0
  68. package/src/http/sse.ts +101 -6
  69. package/src/index.ts +147 -23
  70. package/src/integrations/api-integrations.ts +350 -0
  71. package/src/integrations/atlassian.ts +1621 -0
  72. package/src/integrations/github-skill-source.ts +142 -0
  73. package/src/integrations/google-drive.ts +1000 -64
  74. package/src/integrations/oauth-client.ts +159 -89
  75. package/src/integrations/provider-oauth.ts +777 -0
  76. package/src/integrations/slack-bot.ts +31 -2
  77. package/src/integrations/slack-interactions.ts +610 -42
  78. package/src/integrations/social-api.ts +11 -0
  79. package/src/mcp/documents.ts +74 -26
  80. package/src/mcp/editable-artifact-query-schema.ts +236 -0
  81. package/src/mcp/editable-artifacts.ts +448 -0
  82. package/src/mcp/receipts.ts +95 -0
  83. package/src/mcp/scheduled-task-view.ts +642 -0
  84. package/src/mcp/server.ts +1718 -310
  85. package/src/memory-slack-delivery.ts +209 -0
  86. package/src/observability.ts +3 -3
  87. package/src/routes/api-integrations.ts +407 -0
  88. package/src/routes/api-keys.ts +7 -1
  89. package/src/routes/browser-identities.ts +136 -0
  90. package/src/routes/browser-sessions.ts +2543 -0
  91. package/src/routes/codex.ts +7 -4
  92. package/src/routes/company-profile.ts +255 -0
  93. package/src/routes/computer-sessions.ts +1247 -0
  94. package/src/routes/connections.ts +358 -102
  95. package/src/routes/documents.ts +22 -3
  96. package/src/routes/editable-artifacts.ts +1159 -0
  97. package/src/routes/enrollments.ts +54 -12
  98. package/src/routes/environments.ts +60 -11
  99. package/src/routes/files.ts +277 -65
  100. package/src/routes/github.ts +18 -2
  101. package/src/routes/install.ts +38 -2
  102. package/src/routes/integration-features.ts +258 -0
  103. package/src/routes/machines.ts +1 -1
  104. package/src/routes/memory-slack-publications.ts +216 -0
  105. package/src/routes/packs.ts +437 -7
  106. package/src/routes/plugins.ts +751 -0
  107. package/src/routes/rigs.ts +77 -20
  108. package/src/routes/scheduled-tasks.ts +94 -42
  109. package/src/routes/sessions.ts +475 -234
  110. package/src/routes/skills.ts +174 -0
  111. package/src/routes/transcription-recordings.ts +65 -33
  112. package/src/routes/video-generation.ts +132 -0
  113. package/src/routes/workspaces.ts +46 -24
  114. package/src/sandbox/auth-callout.ts +16 -4
  115. package/src/sandbox/channel-a.ts +809 -85
  116. package/src/sandbox/enrollment.ts +13 -3
  117. package/src/sandbox/machines.ts +1 -1
  118. package/src/sandbox/metrics-ingestion.ts +121 -3
  119. package/src/sandbox/rematerialize.ts +35 -47
  120. package/src/sandbox/viewer.ts +58 -29
  121. package/src/temporal-schedule-cleanup.ts +135 -0
  122. package/dist/chunk-HWXJW5C7.js.map +0 -1
  123. package/dist/mcp/toolspace.d.ts +0 -62
  124. package/src/mcp/toolspace.ts +0 -1186
package/dist/app.d.ts CHANGED
@@ -1,10 +1,11 @@
1
1
  import { type ErrorCode } from "@opengeni/contracts";
2
2
  import { Hono } from "hono";
3
3
  import type { ApiRouteDeps, AppDependencies } from "@opengeni/core";
4
+ export { allowedCorsOrigin } from "./http/cors.js";
4
5
  export type { ApiRouteDeps, AppDependencies, DocumentIndexClient, ObjectStorageDependency, SessionWorkflowClient, } from "@opengeni/core";
5
6
  export { mergeResourceRefs, mergeToolRefs, normalizeResources, validateFileResources, validateGitHubRepositorySelection, validateGitHubRepositorySelectionShape, validateGitHubRepositorySelectionShapes, validateToolRefs, withDefaultEnabledCapabilityMcpTools, } from "@opengeni/core";
6
7
  export { workflowIdForSession } from "@opengeni/core";
7
- export { replaySessionEvents, sseSessionStream, sseWorkspaceControlStream } from "./http/sse";
8
+ export { replaySessionEvents, sseSessionStream, sseWorkspaceControlStream } from "./http/sse.js";
8
9
  export declare const API_MAX_REQUEST_BODY_BYTES: number;
9
10
  /** Effective Hono bodyLimit — API JSON ceiling or voice multipart + multipart overhead. */
10
11
  export declare function apiRequestBodyLimitBytes(settings: {
@@ -17,7 +18,6 @@ export declare function createAppComposition(deps: AppDependencies): {
17
18
  routeDeps: ApiRouteDeps;
18
19
  };
19
20
  export declare function appendVary(current: string | null, value: string): string;
20
- export declare function allowedCorsOrigin(pattern: string, origin: string): boolean;
21
21
  export declare function httpStatusForError(error: unknown): number;
22
22
  export declare function errorCodeForStatus(status: number): ErrorCode;
23
23
  export declare function routeLabel(pathname: string): string;
package/dist/app.js CHANGED
@@ -22,7 +22,7 @@ import {
22
22
  validateToolRefs,
23
23
  withDefaultEnabledCapabilityMcpTools,
24
24
  workflowIdForSession
25
- } from "./chunk-HWXJW5C7.js";
25
+ } from "./chunk-JIKNR5YL.js";
26
26
  export {
27
27
  API_MAX_REQUEST_BODY_BYTES,
28
28
  allowedCorsOrigin,
@@ -3,33 +3,3 @@ import { type ManagedAuth } from "@opengeni/core";
3
3
  import type { Database } from "@opengeni/db";
4
4
  export type { ManagedAuth };
5
5
  export declare function createManagedAuth(settings: Settings, db: Database): ManagedAuth | null;
6
- export declare function managedSessionAccessContext(auth: ManagedAuth, db: Database, headers: Headers): Promise<{
7
- mode: "configured" | "local" | "managed";
8
- subjectId: string;
9
- subjectLabel?: string | undefined;
10
- accountGrants: {
11
- accountId: string;
12
- subjectId: string;
13
- subjectLabel?: string | undefined;
14
- role?: "admin" | "member" | "owner" | undefined;
15
- permissions: ("account:admin" | "account:read" | "api_keys:manage" | "artifacts:publish" | "artifacts:read" | "billing:manage" | "billing:read" | "connections:read" | "connections:write" | "documents:manage" | "documents:search" | "enrollments:manage" | "enrollments:read" | "environments:manage" | "environments:use" | "files:read" | "files:upload" | "files:write" | "github:manage" | "github:use" | "goals:manage" | "mcp_servers:attach" | "members:manage" | "rigs:manage" | "rigs:use" | "scheduled_tasks:manage" | "scheduled_tasks:run" | "sessions:control" | "sessions:create" | "sessions:read" | "stream:acknowledge" | "stream:control" | "stream:view" | "terminal:attach" | "toolspace:call" | "variable-sets:manage" | "variable-sets:use" | "workspace:admin" | "workspace:create" | "workspace:read")[];
16
- metadata?: Record<string, unknown> | undefined;
17
- }[];
18
- workspaceGrants: {
19
- workspaceId: string;
20
- accountId: string;
21
- subjectId: string;
22
- subjectLabel?: string | undefined;
23
- permissions: ("account:admin" | "account:read" | "api_keys:manage" | "artifacts:publish" | "artifacts:read" | "billing:manage" | "billing:read" | "connections:read" | "connections:write" | "documents:manage" | "documents:search" | "enrollments:manage" | "enrollments:read" | "environments:manage" | "environments:use" | "files:read" | "files:upload" | "files:write" | "github:manage" | "github:use" | "goals:manage" | "mcp_servers:attach" | "members:manage" | "rigs:manage" | "rigs:use" | "scheduled_tasks:manage" | "scheduled_tasks:run" | "sessions:control" | "sessions:create" | "sessions:read" | "stream:acknowledge" | "stream:control" | "stream:view" | "terminal:attach" | "toolspace:call" | "variable-sets:manage" | "variable-sets:use" | "workspace:admin" | "workspace:create" | "workspace:read")[];
24
- principalKind?: "agent_attempt" | "api_key" | "configured_key" | "human_session" | "service" | undefined;
25
- metadata?: Record<string, unknown> | undefined;
26
- serviceInitiator?: {
27
- kind: "service";
28
- subjectId: string;
29
- label?: string | undefined;
30
- } | undefined;
31
- serviceInitiatorContext?: Record<string, unknown> | undefined;
32
- }[];
33
- defaultAccountId: string | null;
34
- defaultWorkspaceId: string | null;
35
- } | null>;
@@ -0,0 +1,43 @@
1
+ import type { InteractionPlacement } from "@opengeni/contracts";
2
+ type BrowserControllerAuthorityScope = {
3
+ rootSecret: string;
4
+ accountId: string;
5
+ workspaceId: string;
6
+ placement: InteractionPlacement;
7
+ placementInstanceId: string;
8
+ };
9
+ type BrowserSessionAuthorityScope = BrowserControllerAuthorityScope & {
10
+ browserSessionId: string;
11
+ controllerGeneration: string;
12
+ tokenGeneration: number;
13
+ };
14
+ type ComputerSessionAuthorityScope = BrowserControllerAuthorityScope & {
15
+ computerSessionId: string;
16
+ controllerGeneration: string;
17
+ tokenGeneration: number;
18
+ };
19
+ /** Stable placement-admin authority. This token is installed owner-only inside
20
+ * the exact placement and is never persisted or returned by the public API. */
21
+ export declare function deriveBrowserControllerAdminToken(scope: BrowserControllerAuthorityScope): string;
22
+ /** Deterministic controller credentials. The durable generations are the only
23
+ * stored authority; plaintext tokens can be reconstructed only by API replicas
24
+ * holding the deployment HMAC root. */
25
+ export declare function deriveBrowserSessionControllerTokens(scope: BrowserSessionAuthorityScope): {
26
+ controlToken: string;
27
+ viewToken: string;
28
+ };
29
+ export declare function deriveBrowserViewGrantToken(scope: BrowserSessionAuthorityScope & {
30
+ grantId: string;
31
+ expiresAt: string;
32
+ }): string;
33
+ /** ComputerSession credentials share the placement controller root while using
34
+ * resource-specific domains. Browser and computer authority cannot collide. */
35
+ export declare function deriveComputerSessionControllerTokens(scope: ComputerSessionAuthorityScope): {
36
+ controlToken: string;
37
+ viewToken: string;
38
+ };
39
+ export declare function deriveComputerViewGrantToken(scope: ComputerSessionAuthorityScope & {
40
+ grantId: string;
41
+ expiresAt: string;
42
+ }): string;
43
+ export {};
@@ -0,0 +1,27 @@
1
+ export type BrowserStateOperationScope = {
2
+ accountId: string;
3
+ workspaceId: string;
4
+ browserSessionId: string;
5
+ operationId: string;
6
+ objectKey: string;
7
+ };
8
+ export type BrowserStateArtifactScope = {
9
+ accountId: string;
10
+ workspaceId: string;
11
+ objectKey: string;
12
+ artifactDigest: string;
13
+ contentDigest: string;
14
+ };
15
+ /** Deterministic only within one idempotent publication operation. This lets a
16
+ * control-plane retry present browserd with exactly the same secret authority
17
+ * without storing a plaintext key or placing it in an operation row. */
18
+ export declare function deriveBrowserStateDataKey(rootKey: Uint8Array, scopeInput: BrowserStateOperationScope): Buffer;
19
+ /** Associated data for the encrypted profile object. It is reproducible from
20
+ * durable non-secret artifact authority during restore. */
21
+ export declare function browserStateArtifactAad(scopeInput: Pick<BrowserStateArtifactScope, "accountId" | "workspaceId" | "objectKey">): Buffer;
22
+ /** Wrap a 32-byte artifact data key under the operator-held root key. The
23
+ * ciphertext is bound to workspace, object, and both integrity digests. */
24
+ export declare function wrapBrowserStateDataKey(rootKey: Uint8Array, dataKeyInput: Uint8Array, scopeInput: BrowserStateArtifactScope): string;
25
+ export declare function unwrapBrowserStateDataKey(rootKey: Uint8Array, wrapped: string, scopeInput: BrowserStateArtifactScope): Buffer;
26
+ export declare function browserStateObjectKey(workspaceIdInput: string, operationIdInput: string): string;
27
+ export declare function browserStateManifestDigest(manifest: unknown): string;