@opengeni/api-router 0.30.3 → 2.2.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.
- package/dist/api-websocket.d.ts +18 -0
- package/dist/app.js +1 -1
- package/dist/auth/managed-auth.d.ts +6 -0
- package/dist/{chunk-WCXHI3FF.js → chunk-3TP54PPX.js} +26692 -15389
- package/dist/chunk-3TP54PPX.js.map +1 -0
- package/dist/codemode.d.ts +8 -1
- package/dist/company-brain-okf.d.ts +24 -0
- package/dist/connected-machine-computer-access.d.ts +11 -0
- package/dist/connection-authority-owner.d.ts +59 -0
- package/dist/connection-ownership.d.ts +47 -0
- package/dist/controller-data-plane.d.ts +16 -0
- package/dist/editable-artifact-websocket.d.ts +5 -15
- package/dist/editable-artifact-workspace-files.d.ts +1 -1
- package/dist/http/api-error.d.ts +10 -0
- package/dist/http/cors.d.ts +5 -0
- package/dist/http/interaction-control-error.d.ts +13 -0
- package/dist/http/sse.d.ts +2 -3
- package/dist/index.d.ts +5 -2
- package/dist/index.js +326 -82
- package/dist/index.js.map +1 -1
- package/dist/integrations/atlassian.d.ts +17 -0
- package/dist/integrations/fiken.d.ts +7 -2
- package/dist/integrations/google-drive.d.ts +18 -0
- package/dist/integrations/oauth-client.d.ts +22 -3
- package/dist/integrations/oauth-profiles.d.ts +195 -0
- package/dist/integrations/personal-github-repositories.d.ts +45 -0
- package/dist/integrations/personal-github.d.ts +40 -0
- package/dist/integrations/pr-review-provider.d.ts +22 -0
- package/dist/integrations/provider-oauth.d.ts +8 -0
- package/dist/integrations/slack-app-home.d.ts +24 -0
- package/dist/integrations/slack-bot.d.ts +157 -9
- package/dist/integrations/slack-interactions.d.ts +39 -5
- package/dist/integrations/slack-routing.d.ts +120 -0
- package/dist/integrations/social-oauth.d.ts +5 -0
- package/dist/interaction-frame-proxy.d.ts +68 -0
- package/dist/mcp/company-brain-governed-writes.d.ts +26 -0
- package/dist/mcp/company-profile-agent-admin.d.ts +44 -0
- package/dist/mcp/documents.d.ts +1 -0
- package/dist/mcp/remember.d.ts +28 -0
- package/dist/mcp/request-abort.d.ts +19 -0
- package/dist/mcp/scheduled-task-view.d.ts +4 -4
- package/dist/mcp/server.d.ts +15 -2
- package/dist/mcp/session-view.d.ts +4 -0
- package/dist/mcp/session-wait.d.ts +137 -0
- package/dist/routes/automations.d.ts +4 -0
- package/dist/routes/billing.d.ts +5 -0
- package/dist/routes/browser-sessions.d.ts +4 -1
- package/dist/routes/company-brain.d.ts +3 -0
- package/dist/routes/company-profile.d.ts +2 -1
- package/dist/routes/connection-authorities.d.ts +3 -0
- package/dist/routes/personal-github-git-broker.d.ts +29 -0
- package/dist/routes/personal-github.d.ts +3 -0
- package/dist/routes/pr-review.d.ts +3 -0
- package/dist/routes/sessions.d.ts +1 -0
- package/dist/routes/user-resource-authorities.d.ts +3 -0
- package/dist/routes/workspace-capture.d.ts +10 -2
- package/dist/routes/workspace-learning.d.ts +3 -0
- package/dist/routes/workspaces.d.ts +19 -0
- package/dist/sandbox/channel-a.d.ts +11 -1
- package/dist/sandbox/connection-authority.d.ts +3 -0
- package/dist/sandbox/enrollment.d.ts +2 -0
- package/dist/sandbox/machines.d.ts +2 -2
- package/dist/sandbox/metrics-ingestion.d.ts +10 -20
- package/dist/sandbox/viewer.d.ts +24 -1
- package/dist/sandbox-file-artifacts.d.ts +11 -0
- package/dist/scheduled-task-deletion.d.ts +14 -0
- package/dist/slack-reaction-files.d.ts +1 -1
- package/dist/temporal-schedule-cleanup.d.ts +1 -0
- package/package.json +20 -18
- package/src/api-websocket.ts +23 -0
- package/src/app.ts +161 -23
- package/src/auth/managed-auth.ts +25 -3
- package/src/codemode.ts +53 -23
- package/src/codex-realtime.ts +8 -2
- package/src/company-brain-okf.ts +340 -0
- package/src/connected-machine-computer-access.ts +33 -0
- package/src/connection-authority-owner.ts +61 -0
- package/src/connection-ownership.ts +180 -0
- package/src/controller-data-plane.ts +47 -0
- package/src/editable-artifact-native-kernel.ts +26 -15
- package/src/editable-artifact-office-import.ts +28 -3
- package/src/editable-artifact-production.ts +13 -7
- package/src/editable-artifact-websocket.ts +11 -18
- package/src/editable-artifact-workspace-files.ts +31 -6
- package/src/http/api-error.ts +28 -0
- package/src/http/auth.ts +4 -0
- package/src/http/cors.ts +35 -0
- package/src/http/interaction-control-error.ts +164 -0
- package/src/http/sse.ts +112 -66
- package/src/index.ts +46 -6
- package/src/integrations/atlassian.ts +146 -35
- package/src/integrations/fiken.ts +102 -22
- package/src/integrations/google-drive.ts +301 -92
- package/src/integrations/oauth-client.ts +272 -143
- package/src/integrations/oauth-profiles.ts +477 -0
- package/src/integrations/personal-github-repositories.ts +445 -0
- package/src/integrations/personal-github.ts +705 -0
- package/src/integrations/pr-review-provider.ts +246 -0
- package/src/integrations/provider-oauth.ts +121 -5
- package/src/integrations/slack-app-home.ts +300 -0
- package/src/integrations/slack-bot.ts +342 -57
- package/src/integrations/slack-interactions.ts +1898 -259
- package/src/integrations/slack-routing.ts +337 -0
- package/src/integrations/social-oauth.ts +25 -0
- package/src/interaction-frame-proxy.ts +409 -0
- package/src/mcp/company-brain-governed-writes.ts +262 -0
- package/src/mcp/company-profile-agent-admin.ts +205 -0
- package/src/mcp/documents.ts +37 -6
- package/src/mcp/files.ts +16 -1
- package/src/mcp/remember.ts +181 -0
- package/src/mcp/request-abort.ts +44 -0
- package/src/mcp/scheduled-task-view.ts +1 -0
- package/src/mcp/server.ts +719 -369
- package/src/mcp/session-view.ts +54 -0
- package/src/mcp/session-wait.ts +554 -0
- package/src/model-catalog.ts +20 -12
- package/src/routes/api-integrations.ts +4 -0
- package/src/routes/api-keys.ts +1 -0
- package/src/routes/automations.ts +534 -0
- package/src/routes/billing.ts +57 -1
- package/src/routes/browser-sessions.ts +329 -79
- package/src/routes/channels.ts +17 -1
- package/src/routes/codex.ts +50 -0
- package/src/routes/company-brain.ts +367 -0
- package/src/routes/company-profile.ts +1 -1
- package/src/routes/computer-sessions.ts +320 -93
- package/src/routes/connection-authorities.ts +139 -0
- package/src/routes/connections.ts +144 -34
- package/src/routes/documents.ts +353 -4
- package/src/routes/editable-artifacts.ts +11 -3
- package/src/routes/enrollments.ts +116 -26
- package/src/routes/environments.ts +127 -55
- package/src/routes/files.ts +72 -11
- package/src/routes/install.ts +82 -28
- package/src/routes/integration-facets.ts +29 -0
- package/src/routes/interaction-resources.ts +20 -2
- package/src/routes/machines.ts +275 -13
- package/src/routes/organization-memberships.ts +717 -28
- package/src/routes/packs.ts +4 -3
- package/src/routes/personal-github-git-broker.ts +785 -0
- package/src/routes/personal-github.ts +319 -0
- package/src/routes/pr-review.ts +531 -0
- package/src/routes/rigs.ts +104 -39
- package/src/routes/scheduled-tasks.ts +19 -21
- package/src/routes/sessions.ts +775 -38
- package/src/routes/social.ts +14 -2
- package/src/routes/supergrok.ts +23 -4
- package/src/routes/transcription-recordings.ts +8 -2
- package/src/routes/user-resource-authorities.ts +138 -0
- package/src/routes/workspace-artifacts.ts +4 -1
- package/src/routes/workspace-capture.ts +21 -0
- package/src/routes/workspace-learning.ts +228 -0
- package/src/routes/workspaces.ts +59 -6
- package/src/sandbox/auth-callout.ts +38 -12
- package/src/sandbox/channel-a.ts +242 -19
- package/src/sandbox/connection-authority.ts +3 -0
- package/src/sandbox/enrollment.ts +15 -3
- package/src/sandbox/machines.ts +186 -64
- package/src/sandbox/metrics-ingestion.ts +220 -58
- package/src/sandbox/viewer.ts +243 -19
- package/src/sandbox-file-artifacts.ts +329 -0
- package/src/scheduled-task-deletion.ts +127 -0
- package/src/slack-reaction-files.ts +16 -5
- package/src/temporal-schedule-cleanup.ts +13 -0
- package/dist/chunk-WCXHI3FF.js.map +0 -1
package/dist/codemode.d.ts
CHANGED
|
@@ -9,12 +9,19 @@ export type CodemodeGrantAuthority = {
|
|
|
9
9
|
executionGeneration: number;
|
|
10
10
|
subjectId: string;
|
|
11
11
|
};
|
|
12
|
+
export type CodemodeAuthorityFailureReason = "invalid_grant" | "inactive_attempt" | "catalog_mismatch";
|
|
12
13
|
export declare class CodemodeAuthorityError extends Error {
|
|
13
|
-
readonly
|
|
14
|
+
readonly reason: CodemodeAuthorityFailureReason;
|
|
15
|
+
readonly code: `codemode_${CodemodeAuthorityFailureReason}`;
|
|
16
|
+
constructor(reason: CodemodeAuthorityFailureReason);
|
|
17
|
+
}
|
|
18
|
+
export declare class CodemodeCatalogNotReadyError extends Error {
|
|
19
|
+
readonly code = "codemode_catalog_not_ready";
|
|
14
20
|
constructor();
|
|
15
21
|
}
|
|
16
22
|
export declare function codemodeAuthorityForGrant(grant: AccessGrant): CodemodeGrantAuthority | null;
|
|
17
23
|
export declare function isCodemodeGrant(grant: AccessGrant): boolean;
|
|
24
|
+
export declare function requireMatchingCodemodeCatalog(authority: CodemodeGrantAuthority, catalog: AttemptToolCatalog | null): AttemptToolCatalog;
|
|
18
25
|
export declare function requireActiveCodemodeCatalog(deps: ApiRouteDeps, grant: AccessGrant): Promise<{
|
|
19
26
|
authority: CodemodeGrantAuthority;
|
|
20
27
|
catalog: AttemptToolCatalog;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type CompanyBrainGuidanceEntry, type CompanyBrainOkfPackage as CompanyBrainOkfPackageType, type CompanyProfileListResponse, type WorkspaceInstructionPolicyListResponse, type WorkspaceInstructionPolicyRevision, type WorkspaceStateKnowledge } from "@opengeni/contracts";
|
|
2
|
+
import type { CompanyBrainPreferenceGuidancePage } from "@opengeni/db";
|
|
3
|
+
export declare function boundCompanyBrainGuidanceEntries(entries: CompanyBrainGuidanceEntry[]): {
|
|
4
|
+
entries: CompanyBrainGuidanceEntry[];
|
|
5
|
+
itemCountTruncated: boolean;
|
|
6
|
+
contentBytesTruncated: boolean;
|
|
7
|
+
};
|
|
8
|
+
export declare function createCompanyBrainOkfPackage(input: {
|
|
9
|
+
workspaceId: string;
|
|
10
|
+
generatedAt: string;
|
|
11
|
+
companyProfile: CompanyProfileListResponse;
|
|
12
|
+
instructionPolicies: WorkspaceInstructionPolicyListResponse;
|
|
13
|
+
activeInstructionPolicyRevisions: WorkspaceInstructionPolicyRevision[];
|
|
14
|
+
activatedInstructionPolicyRevisionIds: string[];
|
|
15
|
+
preferences: CompanyBrainPreferenceGuidancePage;
|
|
16
|
+
knowledge: WorkspaceStateKnowledge;
|
|
17
|
+
}): CompanyBrainOkfPackageType;
|
|
18
|
+
/**
|
|
19
|
+
* JSON is a strict subset of YAML 1.2. Keeping the payload in one fenced YAML
|
|
20
|
+
* block gives humans a readable Markdown package while making arbitrary
|
|
21
|
+
* guidance Markdown structurally inert and exactly round-trippable.
|
|
22
|
+
*/
|
|
23
|
+
export declare function serializeCompanyBrainOkf(value: CompanyBrainOkfPackageType): string;
|
|
24
|
+
export declare function parseCompanyBrainOkf(markdown: string): CompanyBrainOkfPackageType;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export type ConnectedMachineComputerAccessState = {
|
|
2
|
+
hasDisplay: boolean;
|
|
3
|
+
desktopUnavailableReason: string | null;
|
|
4
|
+
allowScreenControl: boolean;
|
|
5
|
+
};
|
|
6
|
+
export type ConnectedMachineComputerAccessError = {
|
|
7
|
+
status: 403 | 409;
|
|
8
|
+
message: string;
|
|
9
|
+
};
|
|
10
|
+
/** Keep passive desktop viewing separate from input consent. */
|
|
11
|
+
export declare function connectedMachineComputerAccessError(state: ConnectedMachineComputerAccessState, requiresControl: boolean): ConnectedMachineComputerAccessError | null;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { AccessGrantAuthorization } from "@opengeni/core";
|
|
2
|
+
import type { UserResourceAuthoritySummary } from "@opengeni/db";
|
|
3
|
+
import { type IssueConnectionUseGrantRequest as IssueConnectionUseGrantRequestValue } from "@opengeni/contracts/connection-authority";
|
|
4
|
+
/**
|
|
5
|
+
* Personal connection authority is available only to the exact authenticated
|
|
6
|
+
* human. API keys, delegated bearers, services, and agent attempts cannot name
|
|
7
|
+
* or substitute a personal owner.
|
|
8
|
+
*/
|
|
9
|
+
export declare function requireConnectionAuthorityOwner(access: AccessGrantAuthorization): string;
|
|
10
|
+
/** Removes generic resource kind and refuses non-connection grant actions. */
|
|
11
|
+
export declare function projectSelfConnectionAuthorities(page: {
|
|
12
|
+
authorities: UserResourceAuthoritySummary[];
|
|
13
|
+
nextCursor: string | null;
|
|
14
|
+
}): {
|
|
15
|
+
scope: "user";
|
|
16
|
+
authorities: {
|
|
17
|
+
authorityId: string;
|
|
18
|
+
resourceId: string;
|
|
19
|
+
originWorkspaceId: string | null;
|
|
20
|
+
generation: number;
|
|
21
|
+
status: "active" | "retained" | "revoked";
|
|
22
|
+
grants: {
|
|
23
|
+
grantId: string;
|
|
24
|
+
targetWorkspaceId: string;
|
|
25
|
+
targetSessionId: string | null;
|
|
26
|
+
mode: "always" | "once" | "session";
|
|
27
|
+
context: "user_private" | "workspace_shared";
|
|
28
|
+
authorityEpoch: number | null;
|
|
29
|
+
generation: number;
|
|
30
|
+
status: "active" | "consumed" | "expired" | "revoked";
|
|
31
|
+
expiresAt: string | null;
|
|
32
|
+
delegation: {
|
|
33
|
+
authorityId: string;
|
|
34
|
+
grantId: string;
|
|
35
|
+
organizationId: string;
|
|
36
|
+
workspaceId: string;
|
|
37
|
+
sessionId: string | null;
|
|
38
|
+
action: string;
|
|
39
|
+
mode: "always" | "once" | "session";
|
|
40
|
+
context: "user_private" | "workspace_shared";
|
|
41
|
+
authorityEpoch: number | null;
|
|
42
|
+
authorityGeneration: number;
|
|
43
|
+
grantGeneration: number;
|
|
44
|
+
resourceVersionId?: string | null | undefined;
|
|
45
|
+
};
|
|
46
|
+
action: "connection.use";
|
|
47
|
+
}[];
|
|
48
|
+
}[];
|
|
49
|
+
nextCursor: string | null;
|
|
50
|
+
};
|
|
51
|
+
/** The API owns the action; callers supply neither action nor owner identity. */
|
|
52
|
+
export declare function connectionUseGrantLifecycleInput(input: unknown): {
|
|
53
|
+
action: "connection.use";
|
|
54
|
+
mode: IssueConnectionUseGrantRequestValue["mode"];
|
|
55
|
+
context: IssueConnectionUseGrantRequestValue["context"];
|
|
56
|
+
sessionId: string | null;
|
|
57
|
+
expectedAuthorityEpoch: number | null;
|
|
58
|
+
workspaceSharedAcknowledged: boolean;
|
|
59
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { ConnectionOwnership } from "@opengeni/contracts";
|
|
2
|
+
import type { AccessGrantAuthorization } from "@opengeni/core";
|
|
3
|
+
/** True only for an exact authenticated managed human. Unknown provenance fails closed. */
|
|
4
|
+
export declare function isPersonalConnectionOwnerPrincipal(access: AccessGrantAuthorization): boolean;
|
|
5
|
+
/** Rejects an OpenGeni-minted machine subject; see the namespace list's rationale. */
|
|
6
|
+
export declare function isPersonalConnectionOwnerSubject(subjectId: string): boolean;
|
|
7
|
+
export declare const PERSONAL_CONNECTION_PRINCIPAL_MESSAGE: string;
|
|
8
|
+
/** Personal-only connectors cannot degrade to workspace ownership, so they say so exactly. */
|
|
9
|
+
export declare function personalOnlyConnectionPrincipalMessage(label: string): string;
|
|
10
|
+
/**
|
|
11
|
+
* Rejects a non-human principal before a personal Connection is created.
|
|
12
|
+
* `label` names a personal-only connector, whose message must not suggest a
|
|
13
|
+
* workspace-owned alternative that its provider profile forbids.
|
|
14
|
+
*
|
|
15
|
+
* This shares that helper's core caller-integrity checks, then additionally
|
|
16
|
+
* rejects every reserved machine-subject namespace as defence-in-depth. The
|
|
17
|
+
* sibling guards a self-service authority surface where the caller claims to
|
|
18
|
+
* *be* the owner (403 "not you"), while this one rejects an ownership *value*
|
|
19
|
+
* that is unavailable to the caller, alongside `assertOwnershipAllowed`'s
|
|
20
|
+
* existing 422 convention.
|
|
21
|
+
*/
|
|
22
|
+
export declare function assertPersonalConnectionOwnerPrincipal(access: AccessGrantAuthorization, label?: string): void;
|
|
23
|
+
/** The same fence expressed for a flow that resolves ownership after admission. */
|
|
24
|
+
export declare function assertConnectionOwnershipAllowedForPrincipal(ownership: ConnectionOwnership, personalOwnershipAllowed: boolean): void;
|
|
25
|
+
/**
|
|
26
|
+
* The claim a start path mints into its HMAC-signed OAuth state when it has
|
|
27
|
+
* verified the live principal may own a personal Connection.
|
|
28
|
+
*
|
|
29
|
+
* An OAuth callback carries signed state, not a live principal, so it cannot
|
|
30
|
+
* re-evaluate `principalKind`. Requiring this claim makes the callback enforce
|
|
31
|
+
* exactly what the start path decided with the full signal, instead of guessing
|
|
32
|
+
* from the subject's shape. A state minted before this claim existed simply
|
|
33
|
+
* lacks it and fails closed for personal ownership - which is precisely the
|
|
34
|
+
* in-flight rolling-deploy window these fences exist to close.
|
|
35
|
+
*/
|
|
36
|
+
export declare const PERSONAL_OWNER_VERIFIED_STATE_CLAIM: "personalOwnerVerified";
|
|
37
|
+
/** True only for an explicit boolean `true` claim; absent or malformed fails closed. */
|
|
38
|
+
export declare function personalOwnerVerifiedInState(payload: Record<string, unknown>): boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Callback-side fence for every path that persists a personal owner. Requires
|
|
41
|
+
* both the signed start-time verification and a non-machine subject.
|
|
42
|
+
*/
|
|
43
|
+
export declare function personalOwnerStateAccepted(state: {
|
|
44
|
+
ownership: ConnectionOwnership;
|
|
45
|
+
subjectId: string;
|
|
46
|
+
personalOwnerVerified: boolean;
|
|
47
|
+
}): boolean;
|
|
@@ -1,3 +1,19 @@
|
|
|
1
|
+
/** Modal/Daytona/Blaxel tunnels serve browserd at `/`, so a cached
|
|
2
|
+
* controller-only session can host-fetch JSON. OpenSandbox's lifecycle proxy
|
|
3
|
+
* prefixes `/v1/sandboxes/<id>/proxy/<port>` and rewrites Authorization; JSON
|
|
4
|
+
* must stay on an exec-capable in-box curl session. OSEP-0011 signed URIs are
|
|
5
|
+
* Authorization-preserving and host-fetch like a native tunnel, but they are
|
|
6
|
+
* not durable cache keys. */
|
|
7
|
+
export declare function controllerCacheAllowsHostFetch(url: string): boolean;
|
|
8
|
+
export declare function isOpenSandboxSignedControllerUrl(url: string): boolean;
|
|
9
|
+
/** Signed Channel B URLs expire. Do not treat a lease-cached signed URI as an
|
|
10
|
+
* infinite controller endpoint. Unsigned native `/` tunnels stay cacheable. */
|
|
11
|
+
export declare function controllerCachedUrlIsUsable(url: string, nowMs?: number): boolean;
|
|
12
|
+
export declare function shouldPersistControllerDataPlaneUrl(input: {
|
|
13
|
+
backend: string | null | undefined;
|
|
14
|
+
signedEndpoints: boolean;
|
|
15
|
+
url: string;
|
|
16
|
+
}): boolean;
|
|
1
17
|
/** Prefer a lease-fenced controller endpoint for the idempotent create path.
|
|
2
18
|
* Only a transport-class failure invalidates the cache and provisions once;
|
|
3
19
|
* semantic failures belong to the caller and must never be replayed. */
|
|
@@ -1,20 +1,10 @@
|
|
|
1
1
|
import { type EditableArtifactApplicationPort, type EditableArtifactLiveClose, type EditableArtifactLiveServerFrame, type EditableArtifactLiveSinkPort } from "@opengeni/core";
|
|
2
|
+
import type { ApiWebSocketConnection, ApiWebSocketLike, ApiWebSocketUpgradeServer } from "./api-websocket.js";
|
|
2
3
|
export declare const EDITABLE_ARTIFACT_LIVE_WEBSOCKET_PATH = "/v1/editable-artifacts/live";
|
|
3
|
-
export declare const EDITABLE_ARTIFACT_LIVE_WEBSOCKET_PROTOCOL = "opengeni-artifact-
|
|
4
|
+
export declare const EDITABLE_ARTIFACT_LIVE_WEBSOCKET_PROTOCOL = "opengeni-artifact-v2";
|
|
4
5
|
export declare const EDITABLE_ARTIFACT_LIVE_WEBSOCKET_MAX_MESSAGE_BYTES: number;
|
|
5
|
-
export type EditableArtifactWebSocketLike =
|
|
6
|
-
|
|
7
|
-
send(data: Uint8Array, compress?: boolean): number;
|
|
8
|
-
close(code?: number, reason?: string): void;
|
|
9
|
-
readonly bufferedAmount?: number;
|
|
10
|
-
getBufferedAmount?(): number;
|
|
11
|
-
}>;
|
|
12
|
-
export type EditableArtifactWebSocketUpgradeServer = Readonly<{
|
|
13
|
-
upgrade(request: Request, options: Readonly<{
|
|
14
|
-
data: EditableArtifactWebSocketConnection;
|
|
15
|
-
headers: HeadersInit;
|
|
16
|
-
}>): boolean;
|
|
17
|
-
}>;
|
|
6
|
+
export type EditableArtifactWebSocketLike = ApiWebSocketLike;
|
|
7
|
+
export type EditableArtifactWebSocketUpgradeServer = ApiWebSocketUpgradeServer;
|
|
18
8
|
export type EditableArtifactWebSocketHandler = Readonly<{
|
|
19
9
|
open(socket: EditableArtifactWebSocketLike): void;
|
|
20
10
|
message(socket: EditableArtifactWebSocketLike, message: string | Uint8Array | ArrayBuffer): void;
|
|
@@ -28,7 +18,7 @@ export declare class EditableArtifactWebSocketTransport {
|
|
|
28
18
|
upgrade(request: Request, server: EditableArtifactWebSocketUpgradeServer): Response | undefined;
|
|
29
19
|
}
|
|
30
20
|
/** One socket, one consumed ticket, one stream epoch. */
|
|
31
|
-
export declare class EditableArtifactWebSocketConnection implements EditableArtifactLiveSinkPort {
|
|
21
|
+
export declare class EditableArtifactWebSocketConnection implements EditableArtifactLiveSinkPort, ApiWebSocketConnection {
|
|
32
22
|
private readonly application;
|
|
33
23
|
private socket;
|
|
34
24
|
private session;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type EditableArtifactAgentWorkspaceFilePort, type EditableArtifactDurableExportService } from "@opengeni/core/editable-artifacts";
|
|
2
2
|
import { completeFileUpload, prepareGeneratedWorkspaceFile, type Database } from "@opengeni/db";
|
|
3
|
-
import type
|
|
3
|
+
import { type ObjectStorage } from "@opengeni/storage";
|
|
4
4
|
export type EditableArtifactWorkspaceFileAdapterDependencies = Readonly<{
|
|
5
5
|
db: Database;
|
|
6
6
|
objectStorage: ObjectStorage;
|
package/dist/http/api-error.d.ts
CHANGED
|
@@ -4,13 +4,23 @@ type ApiHttpErrorOptions = {
|
|
|
4
4
|
code: ErrorCode;
|
|
5
5
|
message: string;
|
|
6
6
|
retryable?: boolean;
|
|
7
|
+
outcomeUnknown?: boolean;
|
|
7
8
|
details?: Record<string, unknown>;
|
|
8
9
|
};
|
|
9
10
|
/** A public, structured API failure whose message and details are safe for clients. */
|
|
10
11
|
export declare class ApiHttpError extends HTTPException {
|
|
11
12
|
readonly code: ErrorCode;
|
|
12
13
|
readonly retryable: boolean | undefined;
|
|
14
|
+
readonly outcomeUnknown: boolean | undefined;
|
|
13
15
|
readonly details: Record<string, unknown> | undefined;
|
|
14
16
|
constructor(status: number, options: ApiHttpErrorOptions);
|
|
15
17
|
}
|
|
18
|
+
/**
|
|
19
|
+
* A request-scoped session/workspace mutation could not enter the workspace
|
|
20
|
+
* control prefix within its bounded wait. The transaction rolled back before
|
|
21
|
+
* any write, so the outcome is known and the client may retry. `app.onError`
|
|
22
|
+
* applies this once for every route; Slack interactions keep the raw typed
|
|
23
|
+
* error so their retry classifier treats it as transient.
|
|
24
|
+
*/
|
|
25
|
+
export declare function workspaceControlBusyHttpError(error: unknown): ApiHttpError | null;
|
|
16
26
|
export {};
|
package/dist/http/cors.d.ts
CHANGED
|
@@ -1 +1,6 @@
|
|
|
1
1
|
export declare function allowedCorsOrigin(pattern: string, origin: string): boolean;
|
|
2
|
+
export declare function validateInteractionRequestOrigin(value: string | undefined, input: {
|
|
3
|
+
corsAllowOriginRegex: string;
|
|
4
|
+
publicBaseUrl?: string | undefined;
|
|
5
|
+
webBaseUrl?: string | undefined;
|
|
6
|
+
}): string | null;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ErrorCode as AgentErrorCode } from "@opengeni/agent-proto";
|
|
2
|
+
import { type InteractionControlFailureCode } from "@opengeni/contracts";
|
|
3
|
+
import { ApiHttpError } from "./api-error.js";
|
|
4
|
+
export type InteractionControlSurface = "browser" | "computer";
|
|
5
|
+
/**
|
|
6
|
+
* Projects an internal connected-machine control fault into the public API
|
|
7
|
+
* vocabulary. This is deliberately an allowlist: the agent's free-form message
|
|
8
|
+
* and detail map may contain paths, process output, or provider diagnostics and
|
|
9
|
+
* never cross this boundary. The exact inner request id is safe opaque
|
|
10
|
+
* correlation and links API logs back to the machine operation.
|
|
11
|
+
*/
|
|
12
|
+
export declare function interactionControlApiError(error: unknown, surface: InteractionControlSurface): ApiHttpError | null;
|
|
13
|
+
export declare function publicControlFailureCode(code: AgentErrorCode): InteractionControlFailureCode;
|
package/dist/http/sse.d.ts
CHANGED
|
@@ -81,9 +81,8 @@ export type SseDeliveryOptions = {
|
|
|
81
81
|
heartbeatIntervalMs?: number;
|
|
82
82
|
observability?: Observability | undefined;
|
|
83
83
|
onObservation?: ((observation: SseDeliveryBoundObservation) => void) | undefined;
|
|
84
|
-
|
|
85
|
-
export type SessionSseDeliveryOptions = SseDeliveryOptions & {
|
|
86
|
-
/** Host ACL re-check, run even while the event stream is otherwise idle. */
|
|
84
|
+
/** Current ACL re-check, run even while the event stream is idle. */
|
|
87
85
|
reauthorize?: (() => Promise<void>) | undefined;
|
|
88
86
|
reauthorizeAfterMs?: number | undefined;
|
|
89
87
|
};
|
|
88
|
+
export type SessionSseDeliveryOptions = SseDeliveryOptions;
|
package/dist/index.d.ts
CHANGED
|
@@ -4,14 +4,17 @@ import { type Database } from "@opengeni/db";
|
|
|
4
4
|
import { ScheduleOverlapPolicy } from "@temporalio/client";
|
|
5
5
|
import type { ScheduleSpec } from "@temporalio/client";
|
|
6
6
|
import { type DocumentIndexClient, type SessionWorkflowClient } from "./app.js";
|
|
7
|
-
import { type EditableArtifactWebSocketConnection } from "./editable-artifact-websocket.js";
|
|
8
7
|
export declare function createTemporalWorkflowClient(settings: ReturnType<typeof getSettings>, db: Database): Promise<{
|
|
9
8
|
client: SessionWorkflowClient;
|
|
10
9
|
documentIndexer: DocumentIndexClient;
|
|
11
10
|
close: () => Promise<void>;
|
|
12
11
|
}>;
|
|
13
12
|
export declare function startApi(): Promise<{
|
|
14
|
-
server: Bun.Server<
|
|
13
|
+
server: Bun.Server<Readonly<{
|
|
14
|
+
attach(socket: import("./api-websocket.js").ApiWebSocketLike): void;
|
|
15
|
+
receive(message: string | Uint8Array | ArrayBuffer): void;
|
|
16
|
+
transportClosed(): void;
|
|
17
|
+
}>>;
|
|
15
18
|
close: () => Promise<void>;
|
|
16
19
|
}>;
|
|
17
20
|
export declare function temporalOverlapPolicy(policy: ScheduledTaskOverlapPolicy): ScheduleOverlapPolicy;
|