@opengeni/api-router 0.23.1 → 0.30.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 (152) hide show
  1. package/dist/app.d.ts +3 -2
  2. package/dist/app.js +5 -3
  3. package/dist/auth/canonical-human-session-admission.d.ts +27 -0
  4. package/dist/browser-auth-broker.d.ts +20 -0
  5. package/dist/browser-controller-authority.d.ts +61 -0
  6. package/dist/browser-network-route.d.ts +8 -0
  7. package/dist/browser-state-authority.d.ts +27 -0
  8. package/dist/{chunk-T4T2PGU4.js → chunk-2PQMSRCB.js} +37891 -17463
  9. package/dist/chunk-2PQMSRCB.js.map +1 -0
  10. package/dist/codemode.d.ts +23 -0
  11. package/dist/controller-data-plane.d.ts +12 -0
  12. package/dist/editable-artifact-live-hints.d.ts +11 -0
  13. package/dist/editable-artifact-native-kernel.d.ts +37 -0
  14. package/dist/editable-artifact-office-import.d.ts +22 -0
  15. package/dist/editable-artifact-production.d.ts +29 -0
  16. package/dist/editable-artifact-websocket.d.ts +49 -0
  17. package/dist/editable-artifact-workspace-files.d.ts +23 -0
  18. package/dist/github-browser-flow.d.ts +6 -0
  19. package/dist/http/auth.d.ts +1 -1
  20. package/dist/http/cors.d.ts +1 -0
  21. package/dist/http/sse.d.ts +18 -1
  22. package/dist/index.d.ts +3 -2
  23. package/dist/index.js +1796 -22
  24. package/dist/index.js.map +1 -1
  25. package/dist/integrations/api-integrations.d.ts +24 -0
  26. package/dist/integrations/atlassian.d.ts +176 -0
  27. package/dist/integrations/fiken.d.ts +233 -0
  28. package/dist/integrations/github-skill-source.d.ts +5 -0
  29. package/dist/integrations/google-drive.d.ts +85 -0
  30. package/dist/integrations/oauth-client.d.ts +22 -1
  31. package/dist/integrations/provider-oauth.d.ts +17 -0
  32. package/dist/integrations/slack-bot.d.ts +175 -1
  33. package/dist/integrations/slack-interactions.d.ts +24 -6
  34. package/dist/integrations/social-api.d.ts +2 -1
  35. package/dist/interaction-holder-heartbeat.d.ts +17 -0
  36. package/dist/interaction-metrics.d.ts +11 -0
  37. package/dist/mcp/editable-artifact-query-schema.d.ts +4 -0
  38. package/dist/mcp/editable-artifacts.d.ts +13 -0
  39. package/dist/mcp/scheduled-task-view.d.ts +168 -0
  40. package/dist/mcp/server.d.ts +16 -4
  41. package/dist/memory-slack-delivery.d.ts +9 -0
  42. package/dist/model-catalog.d.ts +1 -0
  43. package/dist/routes/api-integrations.d.ts +8 -0
  44. package/dist/routes/browser-identities.d.ts +5 -0
  45. package/dist/routes/browser-sessions.d.ts +6 -0
  46. package/dist/routes/canonical-human-identities.d.ts +3 -0
  47. package/dist/routes/channels.d.ts +3 -0
  48. package/dist/routes/company-profile.d.ts +3 -0
  49. package/dist/routes/computer-sessions.d.ts +6 -0
  50. package/dist/routes/editable-artifacts.d.ts +44 -0
  51. package/dist/routes/integration-facets.d.ts +3 -0
  52. package/dist/routes/interaction-resources.d.ts +5 -0
  53. package/dist/routes/memory-slack-publications.d.ts +6 -0
  54. package/dist/routes/organization-memberships.d.ts +3 -0
  55. package/dist/routes/plugins.d.ts +8 -0
  56. package/dist/routes/sessions.d.ts +18 -2
  57. package/dist/routes/skills.d.ts +6 -0
  58. package/dist/routes/slack-task-policy.d.ts +3 -0
  59. package/dist/routes/supergrok.d.ts +3 -0
  60. package/dist/routes/video-generation.d.ts +3 -0
  61. package/dist/sandbox/channel-a.d.ts +62 -2
  62. package/dist/sandbox/machines.d.ts +2 -2
  63. package/dist/sandbox/metrics-ingestion.d.ts +6 -1
  64. package/dist/sandbox/viewer.d.ts +7 -3
  65. package/dist/slack-reaction-files.d.ts +27 -0
  66. package/dist/temporal-schedule-cleanup.d.ts +26 -0
  67. package/dist/transcription/providers/xai-subscription.d.ts +8 -0
  68. package/dist/xai-realtime.d.ts +26 -0
  69. package/dist/xai-subscription-auth.d.ts +23 -0
  70. package/package.json +20 -14
  71. package/src/app.ts +604 -64
  72. package/src/auth/canonical-human-session-admission.ts +116 -0
  73. package/src/auth/managed-auth.ts +101 -0
  74. package/src/browser-auth-broker.ts +155 -0
  75. package/src/browser-controller-authority.ts +186 -0
  76. package/src/browser-network-route.ts +34 -0
  77. package/src/browser-state-authority.ts +236 -0
  78. package/src/codemode.ts +186 -0
  79. package/src/controller-data-plane.ts +35 -0
  80. package/src/editable-artifact-live-hints.ts +64 -0
  81. package/src/editable-artifact-native-kernel.ts +659 -0
  82. package/src/editable-artifact-office-import.ts +230 -0
  83. package/src/editable-artifact-production.ts +419 -0
  84. package/src/editable-artifact-websocket.ts +311 -0
  85. package/src/editable-artifact-workspace-files.ts +186 -0
  86. package/src/github-browser-flow.ts +35 -6
  87. package/src/http/auth.ts +29 -9
  88. package/src/http/cors.ts +3 -0
  89. package/src/http/sse.ts +229 -5
  90. package/src/index.ts +119 -20
  91. package/src/integrations/api-integrations.ts +365 -0
  92. package/src/integrations/atlassian.ts +1621 -0
  93. package/src/integrations/fiken.ts +1230 -0
  94. package/src/integrations/github-skill-source.ts +142 -0
  95. package/src/integrations/google-drive.ts +1005 -64
  96. package/src/integrations/oauth-client.ts +123 -33
  97. package/src/integrations/provider-oauth.ts +756 -0
  98. package/src/integrations/slack-bot.ts +669 -11
  99. package/src/integrations/slack-interactions.ts +2063 -93
  100. package/src/integrations/social-api.ts +11 -0
  101. package/src/interaction-holder-heartbeat.ts +95 -0
  102. package/src/interaction-metrics.ts +159 -0
  103. package/src/mcp/documents.ts +146 -6
  104. package/src/mcp/editable-artifact-query-schema.ts +236 -0
  105. package/src/mcp/editable-artifacts.ts +448 -0
  106. package/src/mcp/scheduled-task-view.ts +34 -0
  107. package/src/mcp/server.ts +1756 -355
  108. package/src/memory-slack-delivery.ts +209 -0
  109. package/src/model-catalog.ts +19 -6
  110. package/src/routes/api-integrations.ts +410 -0
  111. package/src/routes/browser-identities.ts +160 -0
  112. package/src/routes/browser-sessions.ts +4482 -0
  113. package/src/routes/canonical-human-identities.ts +156 -0
  114. package/src/routes/channels.ts +90 -0
  115. package/src/routes/company-profile.ts +255 -0
  116. package/src/routes/computer-sessions.ts +1602 -0
  117. package/src/routes/connections.ts +421 -99
  118. package/src/routes/documents.ts +22 -3
  119. package/src/routes/editable-artifacts.ts +1159 -0
  120. package/src/routes/files.ts +106 -4
  121. package/src/routes/github.ts +18 -2
  122. package/src/routes/install.ts +7 -1
  123. package/src/routes/integration-facets.ts +258 -0
  124. package/src/routes/interaction-resources.ts +595 -0
  125. package/src/routes/memory-slack-publications.ts +216 -0
  126. package/src/routes/organization-memberships.ts +53 -0
  127. package/src/routes/packs.ts +437 -7
  128. package/src/routes/plugins.ts +752 -0
  129. package/src/routes/rigs.ts +77 -20
  130. package/src/routes/scheduled-tasks.ts +67 -40
  131. package/src/routes/sessions.ts +830 -278
  132. package/src/routes/skills.ts +256 -0
  133. package/src/routes/slack-task-policy.ts +115 -0
  134. package/src/routes/supergrok.ts +717 -0
  135. package/src/routes/transcription-recordings.ts +9 -2
  136. package/src/routes/transcriptions.ts +2 -1
  137. package/src/routes/video-generation.ts +162 -0
  138. package/src/routes/workspaces.ts +68 -28
  139. package/src/sandbox/channel-a.ts +750 -116
  140. package/src/sandbox/machines.ts +5 -5
  141. package/src/sandbox/metrics-ingestion.ts +121 -3
  142. package/src/sandbox/rematerialize.ts +35 -47
  143. package/src/sandbox/viewer.ts +39 -12
  144. package/src/slack-reaction-files.ts +181 -0
  145. package/src/temporal-schedule-cleanup.ts +135 -0
  146. package/src/transcription/providers/xai-subscription.ts +110 -0
  147. package/src/transcription/service.ts +17 -2
  148. package/src/xai-realtime.ts +216 -0
  149. package/src/xai-subscription-auth.ts +132 -0
  150. package/dist/chunk-T4T2PGU4.js.map +0 -1
  151. package/dist/mcp/toolspace.d.ts +0 -71
  152. package/src/mcp/toolspace.ts +0 -1190
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,7 @@ 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
+ export declare function workspaceActorContextExempt(method: string, pathname: string): boolean;
21
22
  export declare function httpStatusForError(error: unknown): number;
22
23
  export declare function errorCodeForStatus(status: number): ErrorCode;
23
24
  export declare function routeLabel(pathname: string): string;
package/dist/app.js CHANGED
@@ -21,8 +21,9 @@ import {
21
21
  validateGitHubRepositorySelectionShapes,
22
22
  validateToolRefs,
23
23
  withDefaultEnabledCapabilityMcpTools,
24
- workflowIdForSession
25
- } from "./chunk-T4T2PGU4.js";
24
+ workflowIdForSession,
25
+ workspaceActorContextExempt
26
+ } from "./chunk-2PQMSRCB.js";
26
27
  export {
27
28
  API_MAX_REQUEST_BODY_BYTES,
28
29
  allowedCorsOrigin,
@@ -46,6 +47,7 @@ export {
46
47
  validateGitHubRepositorySelectionShapes,
47
48
  validateToolRefs,
48
49
  withDefaultEnabledCapabilityMcpTools,
49
- workflowIdForSession
50
+ workflowIdForSession,
51
+ workspaceActorContextExempt
50
52
  };
51
53
  //# sourceMappingURL=app.js.map
@@ -0,0 +1,27 @@
1
+ import type { CanonicalHumanIdentityStatus, CanonicalHumanLoginBindingStatus, CanonicalHumanRecoveryState } from "@opengeni/contracts/canonical-human-identities";
2
+ export type CanonicalHumanSessionAdmissionIntent = "ordinary_session" | "binding_synchronization" | "recovery_completion";
3
+ export type CanonicalHumanIdentityAdmissionSnapshot = {
4
+ readonly id: string;
5
+ readonly status: CanonicalHumanIdentityStatus;
6
+ readonly recoveryState: CanonicalHumanRecoveryState;
7
+ readonly activeLoginBindingId: string | null;
8
+ };
9
+ export type CanonicalHumanLoginBindingAdmissionSnapshot = {
10
+ readonly id: string;
11
+ readonly identityId: string;
12
+ readonly status: CanonicalHumanLoginBindingStatus;
13
+ };
14
+ export type CanonicalHumanSessionAdmissionDenialCode = "identity_binding_mismatch" | "ordinary_identity_not_active" | "ordinary_identity_not_ready" | "ordinary_binding_missing" | "ordinary_binding_not_active" | "ordinary_active_binding_missing" | "recovery_identity_not_required" | "recovery_state_not_required" | "recovery_active_binding_present" | "recovery_binding_missing" | "recovery_binding_not_pending";
15
+ export type CanonicalHumanSessionAdmissionDecision = {
16
+ allowed: true;
17
+ intent: CanonicalHumanSessionAdmissionIntent;
18
+ } | {
19
+ allowed: false;
20
+ intent: CanonicalHumanSessionAdmissionIntent;
21
+ code: CanonicalHumanSessionAdmissionDenialCode;
22
+ };
23
+ export declare function decideCanonicalHumanSessionAdmission(input: {
24
+ intent: CanonicalHumanSessionAdmissionIntent;
25
+ identity: CanonicalHumanIdentityAdmissionSnapshot;
26
+ binding: CanonicalHumanLoginBindingAdmissionSnapshot | null;
27
+ }): CanonicalHumanSessionAdmissionDecision;
@@ -0,0 +1,20 @@
1
+ import type { BrowserProtectedAuthFieldValue, ProtectedAuthField, SiteAuthAuthority } from "@opengeni/contracts";
2
+ type ConnectionFieldsAuthority = Extract<SiteAuthAuthority, {
3
+ kind: "connection_fields";
4
+ }>;
5
+ export declare class BrowserAuthCredentialError extends Error {
6
+ readonly name = "BrowserAuthCredentialError";
7
+ }
8
+ export declare function resolveProtectedAuthFieldValues(input: {
9
+ authority: ConnectionFieldsAuthority;
10
+ requestedFields: readonly ProtectedAuthField[];
11
+ credential: Readonly<Record<string, unknown>>;
12
+ nowMs?: number;
13
+ }): BrowserProtectedAuthFieldValue[];
14
+ export declare function totpCode(secretValue: string, options?: {
15
+ digits?: number;
16
+ periodSeconds?: number;
17
+ algorithm?: "sha1" | "sha256" | "sha512";
18
+ nowMs?: number;
19
+ }): string;
20
+ export {};
@@ -0,0 +1,61 @@
1
+ import type { InteractionPlacement, NetworkRouteConfiguration, NetworkRouteConsistency } 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
+ /** Secret-safe durable identity for one exact route launch. The digest binds
30
+ * the route snapshot and proxy credential without making a password-verifier
31
+ * hash available to database readers. */
32
+ export declare function deriveBrowserNetworkRouteAuthorityDigest(scope: {
33
+ rootSecret: string;
34
+ accountId: string;
35
+ workspaceId: string;
36
+ browserSessionId: string;
37
+ routeId: string;
38
+ routeVersion: number;
39
+ credentialVersion: number | null;
40
+ configuration: NetworkRouteConfiguration;
41
+ consistency: NetworkRouteConsistency;
42
+ proxyCredential: {
43
+ username: string;
44
+ password: string;
45
+ } | null;
46
+ }): string;
47
+ export declare function deriveBrowserViewGrantToken(scope: BrowserSessionAuthorityScope & {
48
+ grantId: string;
49
+ expiresAt: string;
50
+ }): string;
51
+ /** ComputerSession credentials share the placement controller root while using
52
+ * resource-specific domains. Browser and computer authority cannot collide. */
53
+ export declare function deriveComputerSessionControllerTokens(scope: ComputerSessionAuthorityScope): {
54
+ controlToken: string;
55
+ viewToken: string;
56
+ };
57
+ export declare function deriveComputerViewGrantToken(scope: ComputerSessionAuthorityScope & {
58
+ grantId: string;
59
+ expiresAt: string;
60
+ }): string;
61
+ export {};
@@ -0,0 +1,8 @@
1
+ import type { InteractionPlacement, NetworkRouteConfiguration, NetworkRouteConsistency } from "@opengeni/contracts";
2
+ import type { PlacementBrowserNetworkRoute } from "@opengeni/runtime/sandbox";
3
+ /** Resolve one provider-neutral managed route into the exact private selector
4
+ * accepted by the chosen external browser placement. Unsupported guarantees
5
+ * fail before lifecycle dispatch; no provider API key enters this value. */
6
+ export declare function managedNetworkRouteForPlacement(configuration: Extract<NetworkRouteConfiguration, {
7
+ kind: "managed";
8
+ }>, consistency: NetworkRouteConsistency, placement: InteractionPlacement): NonNullable<PlacementBrowserNetworkRoute["providerRoute"]>;
@@ -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;