@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.
- package/dist/app.d.ts +3 -2
- package/dist/app.js +5 -3
- package/dist/auth/canonical-human-session-admission.d.ts +27 -0
- package/dist/browser-auth-broker.d.ts +20 -0
- package/dist/browser-controller-authority.d.ts +61 -0
- package/dist/browser-network-route.d.ts +8 -0
- package/dist/browser-state-authority.d.ts +27 -0
- package/dist/{chunk-T4T2PGU4.js → chunk-2PQMSRCB.js} +37891 -17463
- package/dist/chunk-2PQMSRCB.js.map +1 -0
- package/dist/codemode.d.ts +23 -0
- package/dist/controller-data-plane.d.ts +12 -0
- package/dist/editable-artifact-live-hints.d.ts +11 -0
- package/dist/editable-artifact-native-kernel.d.ts +37 -0
- package/dist/editable-artifact-office-import.d.ts +22 -0
- package/dist/editable-artifact-production.d.ts +29 -0
- package/dist/editable-artifact-websocket.d.ts +49 -0
- package/dist/editable-artifact-workspace-files.d.ts +23 -0
- package/dist/github-browser-flow.d.ts +6 -0
- package/dist/http/auth.d.ts +1 -1
- package/dist/http/cors.d.ts +1 -0
- package/dist/http/sse.d.ts +18 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.js +1796 -22
- package/dist/index.js.map +1 -1
- package/dist/integrations/api-integrations.d.ts +24 -0
- package/dist/integrations/atlassian.d.ts +176 -0
- package/dist/integrations/fiken.d.ts +233 -0
- package/dist/integrations/github-skill-source.d.ts +5 -0
- package/dist/integrations/google-drive.d.ts +85 -0
- package/dist/integrations/oauth-client.d.ts +22 -1
- package/dist/integrations/provider-oauth.d.ts +17 -0
- package/dist/integrations/slack-bot.d.ts +175 -1
- package/dist/integrations/slack-interactions.d.ts +24 -6
- package/dist/integrations/social-api.d.ts +2 -1
- package/dist/interaction-holder-heartbeat.d.ts +17 -0
- package/dist/interaction-metrics.d.ts +11 -0
- package/dist/mcp/editable-artifact-query-schema.d.ts +4 -0
- package/dist/mcp/editable-artifacts.d.ts +13 -0
- package/dist/mcp/scheduled-task-view.d.ts +168 -0
- package/dist/mcp/server.d.ts +16 -4
- package/dist/memory-slack-delivery.d.ts +9 -0
- package/dist/model-catalog.d.ts +1 -0
- package/dist/routes/api-integrations.d.ts +8 -0
- package/dist/routes/browser-identities.d.ts +5 -0
- package/dist/routes/browser-sessions.d.ts +6 -0
- package/dist/routes/canonical-human-identities.d.ts +3 -0
- package/dist/routes/channels.d.ts +3 -0
- package/dist/routes/company-profile.d.ts +3 -0
- package/dist/routes/computer-sessions.d.ts +6 -0
- package/dist/routes/editable-artifacts.d.ts +44 -0
- package/dist/routes/integration-facets.d.ts +3 -0
- package/dist/routes/interaction-resources.d.ts +5 -0
- package/dist/routes/memory-slack-publications.d.ts +6 -0
- package/dist/routes/organization-memberships.d.ts +3 -0
- package/dist/routes/plugins.d.ts +8 -0
- package/dist/routes/sessions.d.ts +18 -2
- package/dist/routes/skills.d.ts +6 -0
- package/dist/routes/slack-task-policy.d.ts +3 -0
- package/dist/routes/supergrok.d.ts +3 -0
- package/dist/routes/video-generation.d.ts +3 -0
- package/dist/sandbox/channel-a.d.ts +62 -2
- package/dist/sandbox/machines.d.ts +2 -2
- package/dist/sandbox/metrics-ingestion.d.ts +6 -1
- package/dist/sandbox/viewer.d.ts +7 -3
- package/dist/slack-reaction-files.d.ts +27 -0
- package/dist/temporal-schedule-cleanup.d.ts +26 -0
- package/dist/transcription/providers/xai-subscription.d.ts +8 -0
- package/dist/xai-realtime.d.ts +26 -0
- package/dist/xai-subscription-auth.d.ts +23 -0
- package/package.json +20 -14
- package/src/app.ts +604 -64
- package/src/auth/canonical-human-session-admission.ts +116 -0
- package/src/auth/managed-auth.ts +101 -0
- package/src/browser-auth-broker.ts +155 -0
- package/src/browser-controller-authority.ts +186 -0
- package/src/browser-network-route.ts +34 -0
- package/src/browser-state-authority.ts +236 -0
- package/src/codemode.ts +186 -0
- package/src/controller-data-plane.ts +35 -0
- package/src/editable-artifact-live-hints.ts +64 -0
- package/src/editable-artifact-native-kernel.ts +659 -0
- package/src/editable-artifact-office-import.ts +230 -0
- package/src/editable-artifact-production.ts +419 -0
- package/src/editable-artifact-websocket.ts +311 -0
- package/src/editable-artifact-workspace-files.ts +186 -0
- package/src/github-browser-flow.ts +35 -6
- package/src/http/auth.ts +29 -9
- package/src/http/cors.ts +3 -0
- package/src/http/sse.ts +229 -5
- package/src/index.ts +119 -20
- package/src/integrations/api-integrations.ts +365 -0
- package/src/integrations/atlassian.ts +1621 -0
- package/src/integrations/fiken.ts +1230 -0
- package/src/integrations/github-skill-source.ts +142 -0
- package/src/integrations/google-drive.ts +1005 -64
- package/src/integrations/oauth-client.ts +123 -33
- package/src/integrations/provider-oauth.ts +756 -0
- package/src/integrations/slack-bot.ts +669 -11
- package/src/integrations/slack-interactions.ts +2063 -93
- package/src/integrations/social-api.ts +11 -0
- package/src/interaction-holder-heartbeat.ts +95 -0
- package/src/interaction-metrics.ts +159 -0
- package/src/mcp/documents.ts +146 -6
- package/src/mcp/editable-artifact-query-schema.ts +236 -0
- package/src/mcp/editable-artifacts.ts +448 -0
- package/src/mcp/scheduled-task-view.ts +34 -0
- package/src/mcp/server.ts +1756 -355
- package/src/memory-slack-delivery.ts +209 -0
- package/src/model-catalog.ts +19 -6
- package/src/routes/api-integrations.ts +410 -0
- package/src/routes/browser-identities.ts +160 -0
- package/src/routes/browser-sessions.ts +4482 -0
- package/src/routes/canonical-human-identities.ts +156 -0
- package/src/routes/channels.ts +90 -0
- package/src/routes/company-profile.ts +255 -0
- package/src/routes/computer-sessions.ts +1602 -0
- package/src/routes/connections.ts +421 -99
- package/src/routes/documents.ts +22 -3
- package/src/routes/editable-artifacts.ts +1159 -0
- package/src/routes/files.ts +106 -4
- package/src/routes/github.ts +18 -2
- package/src/routes/install.ts +7 -1
- package/src/routes/integration-facets.ts +258 -0
- package/src/routes/interaction-resources.ts +595 -0
- package/src/routes/memory-slack-publications.ts +216 -0
- package/src/routes/organization-memberships.ts +53 -0
- package/src/routes/packs.ts +437 -7
- package/src/routes/plugins.ts +752 -0
- package/src/routes/rigs.ts +77 -20
- package/src/routes/scheduled-tasks.ts +67 -40
- package/src/routes/sessions.ts +830 -278
- package/src/routes/skills.ts +256 -0
- package/src/routes/slack-task-policy.ts +115 -0
- package/src/routes/supergrok.ts +717 -0
- package/src/routes/transcription-recordings.ts +9 -2
- package/src/routes/transcriptions.ts +2 -1
- package/src/routes/video-generation.ts +162 -0
- package/src/routes/workspaces.ts +68 -28
- package/src/sandbox/channel-a.ts +750 -116
- package/src/sandbox/machines.ts +5 -5
- package/src/sandbox/metrics-ingestion.ts +121 -3
- package/src/sandbox/rematerialize.ts +35 -47
- package/src/sandbox/viewer.ts +39 -12
- package/src/slack-reaction-files.ts +181 -0
- package/src/temporal-schedule-cleanup.ts +135 -0
- package/src/transcription/providers/xai-subscription.ts +110 -0
- package/src/transcription/service.ts +17 -2
- package/src/xai-realtime.ts +216 -0
- package/src/xai-subscription-auth.ts +132 -0
- package/dist/chunk-T4T2PGU4.js.map +0 -1
- package/dist/mcp/toolspace.d.ts +0 -71
- package/src/mcp/toolspace.ts +0 -1190
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { type AccessGrant, type AttemptToolCatalog, type CodemodeCallSubmission as CodemodeCallSubmissionValue, type CodemodeOperation } from "@opengeni/contracts";
|
|
2
|
+
import type { ApiRouteDeps } from "@opengeni/core";
|
|
3
|
+
export type CodemodeGrantAuthority = {
|
|
4
|
+
accountId: string;
|
|
5
|
+
workspaceId: string;
|
|
6
|
+
sessionId: string;
|
|
7
|
+
turnId: string;
|
|
8
|
+
attemptId: string;
|
|
9
|
+
executionGeneration: number;
|
|
10
|
+
subjectId: string;
|
|
11
|
+
};
|
|
12
|
+
export declare class CodemodeAuthorityError extends Error {
|
|
13
|
+
readonly code = "codemode_authority_invalid";
|
|
14
|
+
constructor();
|
|
15
|
+
}
|
|
16
|
+
export declare function codemodeAuthorityForGrant(grant: AccessGrant): CodemodeGrantAuthority | null;
|
|
17
|
+
export declare function isCodemodeGrant(grant: AccessGrant): boolean;
|
|
18
|
+
export declare function requireActiveCodemodeCatalog(deps: ApiRouteDeps, grant: AccessGrant): Promise<{
|
|
19
|
+
authority: CodemodeGrantAuthority;
|
|
20
|
+
catalog: AttemptToolCatalog;
|
|
21
|
+
}>;
|
|
22
|
+
export declare function submitAndDispatchCodemodeCall(deps: ApiRouteDeps, grant: AccessGrant, rawRequest: unknown): Promise<CodemodeCallSubmissionValue>;
|
|
23
|
+
export declare function readCodemodeOperation(deps: ApiRouteDeps, grant: AccessGrant, operationId: string): Promise<CodemodeOperation | null>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** Prefer a lease-fenced controller endpoint for the idempotent create path.
|
|
2
|
+
* Only a transport-class failure invalidates the cache and provisions once;
|
|
3
|
+
* semantic failures belong to the caller and must never be replayed. */
|
|
4
|
+
export declare function withCachedController<C, T>(options: {
|
|
5
|
+
cachedUrl: string | null;
|
|
6
|
+
createCachedClient: (url: string) => C;
|
|
7
|
+
prepareCachedClient?: (client: C) => Promise<void>;
|
|
8
|
+
invalidateCachedUrl: () => Promise<unknown>;
|
|
9
|
+
provisionClient: () => Promise<C>;
|
|
10
|
+
use: (client: C) => Promise<T>;
|
|
11
|
+
}): Promise<T>;
|
|
12
|
+
export declare function isRetryableControllerTransport(error: unknown): boolean;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type EditableArtifactLiveHintPort } from "@opengeni/core";
|
|
2
|
+
import type { EventBus } from "@opengeni/events";
|
|
3
|
+
/**
|
|
4
|
+
* Uses the API's existing resilient NATS connection. Hints carry no operation
|
|
5
|
+
* bytes; every callback causes a durable DB head read and contiguous gap-fill.
|
|
6
|
+
*/
|
|
7
|
+
export declare class EventBusEditableArtifactLiveHints implements EditableArtifactLiveHintPort {
|
|
8
|
+
private readonly bus;
|
|
9
|
+
constructor(bus: Pick<EventBus, "getOpStreamConnection">);
|
|
10
|
+
subscribe(input: Parameters<EditableArtifactLiveHintPort["subscribe"]>[0]): Promise<() => void>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { ArtifactKernelRuntime } from "@opengeni/artifact-tool/runtime";
|
|
2
|
+
import { type ConfiguredArtifactRuntimeLocation } from "@opengeni/artifact-tool/runtime/development";
|
|
3
|
+
import { type ApplyAuthoritativeEditableArtifactKernelRequest, type ApplyAuthoritativeEditableArtifactKernelResult, type AuthoritativeEditableArtifactCompactionKernelPort, type AuthoritativeEditableArtifactCompactionKernelResult, type AuthoritativeEditableArtifactGenesisKernelPort, type AuthoritativeEditableArtifactGenesisKernelResult, type AuthoritativeEditableArtifactKernelPort, type EditableArtifactAgentInspectionKernelPort, type EditableArtifactKernelState, type IsolatedEditableArtifactSnapshotKernelPort, type IsolatedEditableArtifactSnapshotKernelResult } from "@opengeni/core";
|
|
4
|
+
import type { BoundedObjectReadPort } from "@opengeni/storage";
|
|
5
|
+
type RuntimeFacadeModule = Readonly<{
|
|
6
|
+
getConfiguredArtifactRuntime?: () => unknown;
|
|
7
|
+
}> & Readonly<Record<string, unknown>>;
|
|
8
|
+
export type VerifiedNativeArtifactRuntimeBinding = Readonly<{
|
|
9
|
+
runtime: ArtifactKernelRuntime;
|
|
10
|
+
location: ConfiguredArtifactRuntimeLocation;
|
|
11
|
+
facade: RuntimeFacadeModule;
|
|
12
|
+
}>;
|
|
13
|
+
/** Loads only the manifest-pinned, byte-verified native runtime. */
|
|
14
|
+
export declare function loadVerifiedNativeArtifactRuntime(): Promise<ArtifactKernelRuntime>;
|
|
15
|
+
/** Same verified load plus the pinned package identity used by export profiles. */
|
|
16
|
+
export declare function loadVerifiedNativeArtifactRuntimeBinding(): Promise<VerifiedNativeArtifactRuntimeBinding>;
|
|
17
|
+
/** Exact native authority shared by mutation, genesis, and snapshot verification. */
|
|
18
|
+
export declare class NativeEditableArtifactKernelAdapter implements AuthoritativeEditableArtifactKernelPort, AuthoritativeEditableArtifactGenesisKernelPort, AuthoritativeEditableArtifactCompactionKernelPort, IsolatedEditableArtifactSnapshotKernelPort, EditableArtifactAgentInspectionKernelPort {
|
|
19
|
+
readonly runtime: ArtifactKernelRuntime;
|
|
20
|
+
private readonly objects;
|
|
21
|
+
constructor(runtime: ArtifactKernelRuntime, objects: BoundedObjectReadPort);
|
|
22
|
+
applyTransaction(request: ApplyAuthoritativeEditableArtifactKernelRequest): Promise<ApplyAuthoritativeEditableArtifactKernelResult>;
|
|
23
|
+
query(input: Parameters<EditableArtifactAgentInspectionKernelPort["query"]>[0]): ReturnType<EditableArtifactAgentInspectionKernelPort["query"]>;
|
|
24
|
+
private openCurrentState;
|
|
25
|
+
createCanonicalEmptySnapshot(input: {
|
|
26
|
+
scope: Parameters<AuthoritativeEditableArtifactGenesisKernelPort["createCanonicalEmptySnapshot"]>[0]["scope"];
|
|
27
|
+
artifactId: Parameters<AuthoritativeEditableArtifactGenesisKernelPort["createCanonicalEmptySnapshot"]>[0]["artifactId"];
|
|
28
|
+
modality: Parameters<AuthoritativeEditableArtifactGenesisKernelPort["createCanonicalEmptySnapshot"]>[0]["modality"];
|
|
29
|
+
signal?: AbortSignal;
|
|
30
|
+
}): Promise<AuthoritativeEditableArtifactGenesisKernelResult>;
|
|
31
|
+
createCanonicalSnapshot(input: {
|
|
32
|
+
state: EditableArtifactKernelState;
|
|
33
|
+
signal?: AbortSignal;
|
|
34
|
+
}): Promise<AuthoritativeEditableArtifactCompactionKernelResult>;
|
|
35
|
+
verifyAndReconstruct(input: Parameters<IsolatedEditableArtifactSnapshotKernelPort["verifyAndReconstruct"]>[0]): Promise<IsolatedEditableArtifactSnapshotKernelResult>;
|
|
36
|
+
}
|
|
37
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { prepareArtifactOfficeImport } from "@opengeni/artifact-tool/office-import";
|
|
2
|
+
import { type EditableArtifactOfficeImportPort } from "@opengeni/core/editable-artifacts";
|
|
3
|
+
import { getFile } from "@opengeni/db";
|
|
4
|
+
import { type BoundedImmutableObjectWritePort, type ObjectStorage } from "@opengeni/storage";
|
|
5
|
+
import type { Database } from "@opengeni/db";
|
|
6
|
+
import type { VerifiedNativeArtifactRuntimeBinding } from "./editable-artifact-native-kernel.js";
|
|
7
|
+
export type EditableArtifactOfficeImportAdapterDependencies = Readonly<{
|
|
8
|
+
db: Database;
|
|
9
|
+
objectStorage: ObjectStorage;
|
|
10
|
+
runtime: VerifiedNativeArtifactRuntimeBinding;
|
|
11
|
+
sourceObjects: BoundedImmutableObjectWritePort;
|
|
12
|
+
snapshotObjects: BoundedImmutableObjectWritePort;
|
|
13
|
+
readFile?: typeof getFile;
|
|
14
|
+
prepareOffice?: typeof prepareArtifactOfficeImport;
|
|
15
|
+
}>;
|
|
16
|
+
/** Trusted import boundary from one ready workspace file into native sequence-zero state. */
|
|
17
|
+
export declare class EditableArtifactOfficeImportAdapter implements EditableArtifactOfficeImportPort {
|
|
18
|
+
private readonly dependencies;
|
|
19
|
+
private readonly readFile;
|
|
20
|
+
constructor(dependencies: EditableArtifactOfficeImportAdapterDependencies);
|
|
21
|
+
prepare(input: Parameters<EditableArtifactOfficeImportPort["prepare"]>[0]): ReturnType<EditableArtifactOfficeImportPort["prepare"]>;
|
|
22
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { EditableArtifactDurableExportService, EditableArtifactAgentApplication, type EditableArtifactAuthorizationDecision, type EditableArtifactAuthorizationPort, type EditableArtifactAuthorizationRequest } from "@opengeni/core/editable-artifacts";
|
|
2
|
+
import { type EditableArtifactApplicationPort } from "@opengeni/core/editable-artifact-live";
|
|
3
|
+
import { type Database } from "@opengeni/db";
|
|
4
|
+
import type { EventBus } from "@opengeni/events";
|
|
5
|
+
import { type ObjectStorage } from "@opengeni/storage";
|
|
6
|
+
import { EditableArtifactOfficeImportAdapter } from "./editable-artifact-office-import.js";
|
|
7
|
+
export type StandaloneEditableArtifactApplication = Readonly<{
|
|
8
|
+
application: EditableArtifactApplicationPort;
|
|
9
|
+
durableExports: EditableArtifactDurableExportService;
|
|
10
|
+
agent: EditableArtifactAgentApplication;
|
|
11
|
+
officeImports: EditableArtifactOfficeImportAdapter;
|
|
12
|
+
kernelVersion: string;
|
|
13
|
+
close(): void;
|
|
14
|
+
}>;
|
|
15
|
+
/**
|
|
16
|
+
* Standalone production composition. Every authority is durable: PostgreSQL
|
|
17
|
+
* owns admission/authorization/history, object storage owns immutable model
|
|
18
|
+
* bytes, and NATS carries wake-up hints only.
|
|
19
|
+
*/
|
|
20
|
+
export declare function createStandaloneEditableArtifactApplication(input: {
|
|
21
|
+
db: Database;
|
|
22
|
+
bus: EventBus;
|
|
23
|
+
objectStorage: ObjectStorage;
|
|
24
|
+
}): Promise<StandaloneEditableArtifactApplication>;
|
|
25
|
+
export declare class PostgresEditableArtifactAuthorization implements EditableArtifactAuthorizationPort {
|
|
26
|
+
private readonly db;
|
|
27
|
+
constructor(db: Database);
|
|
28
|
+
authorize(request: EditableArtifactAuthorizationRequest): Promise<EditableArtifactAuthorizationDecision>;
|
|
29
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { type EditableArtifactApplicationPort, type EditableArtifactLiveClose, type EditableArtifactLiveServerFrame, type EditableArtifactLiveSinkPort } from "@opengeni/core";
|
|
2
|
+
export declare const EDITABLE_ARTIFACT_LIVE_WEBSOCKET_PATH = "/v1/editable-artifacts/live";
|
|
3
|
+
export declare const EDITABLE_ARTIFACT_LIVE_WEBSOCKET_PROTOCOL = "opengeni-artifact-v1";
|
|
4
|
+
export declare const EDITABLE_ARTIFACT_LIVE_WEBSOCKET_MAX_MESSAGE_BYTES: number;
|
|
5
|
+
export type EditableArtifactWebSocketLike = Readonly<{
|
|
6
|
+
data: EditableArtifactWebSocketConnection;
|
|
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
|
+
}>;
|
|
18
|
+
export type EditableArtifactWebSocketHandler = Readonly<{
|
|
19
|
+
open(socket: EditableArtifactWebSocketLike): void;
|
|
20
|
+
message(socket: EditableArtifactWebSocketLike, message: string | Uint8Array | ArrayBuffer): void;
|
|
21
|
+
close(socket: EditableArtifactWebSocketLike): void;
|
|
22
|
+
}>;
|
|
23
|
+
export declare class EditableArtifactWebSocketTransport {
|
|
24
|
+
private readonly application;
|
|
25
|
+
readonly websocket: EditableArtifactWebSocketHandler;
|
|
26
|
+
constructor(application: EditableArtifactApplicationPort | undefined);
|
|
27
|
+
handles(request: Request): boolean;
|
|
28
|
+
upgrade(request: Request, server: EditableArtifactWebSocketUpgradeServer): Response | undefined;
|
|
29
|
+
}
|
|
30
|
+
/** One socket, one consumed ticket, one stream epoch. */
|
|
31
|
+
export declare class EditableArtifactWebSocketConnection implements EditableArtifactLiveSinkPort {
|
|
32
|
+
private readonly application;
|
|
33
|
+
private socket;
|
|
34
|
+
private session;
|
|
35
|
+
private work;
|
|
36
|
+
private queuedMessages;
|
|
37
|
+
private queuedBytes;
|
|
38
|
+
private terminal;
|
|
39
|
+
constructor(application: EditableArtifactApplicationPort);
|
|
40
|
+
attach(socket: EditableArtifactWebSocketLike): void;
|
|
41
|
+
receive(message: string | Uint8Array | ArrayBuffer): void;
|
|
42
|
+
send(frame: EditableArtifactLiveServerFrame): Promise<void>;
|
|
43
|
+
bufferedBytes(): number;
|
|
44
|
+
close(close: EditableArtifactLiveClose): void;
|
|
45
|
+
transportClosed(): void;
|
|
46
|
+
private process;
|
|
47
|
+
private handleFailure;
|
|
48
|
+
private fail;
|
|
49
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { type EditableArtifactAgentWorkspaceFilePort, type EditableArtifactDurableExportService } from "@opengeni/core/editable-artifacts";
|
|
2
|
+
import { completeFileUpload, prepareGeneratedWorkspaceFile, type Database } from "@opengeni/db";
|
|
3
|
+
import type { ObjectStorage } from "@opengeni/storage";
|
|
4
|
+
export type EditableArtifactWorkspaceFileAdapterDependencies = Readonly<{
|
|
5
|
+
db: Database;
|
|
6
|
+
objectStorage: ObjectStorage;
|
|
7
|
+
durableExports: EditableArtifactDurableExportService;
|
|
8
|
+
now?: () => Date;
|
|
9
|
+
prepareFile?: typeof prepareGeneratedWorkspaceFile;
|
|
10
|
+
completeFile?: typeof completeFileUpload;
|
|
11
|
+
}>;
|
|
12
|
+
/**
|
|
13
|
+
* Promotes one immutable materialization into the normal workspace-file domain.
|
|
14
|
+
* The returned file ID is the only artifact export handle exposed to agents.
|
|
15
|
+
*/
|
|
16
|
+
export declare class EditableArtifactWorkspaceFileAdapter implements EditableArtifactAgentWorkspaceFilePort {
|
|
17
|
+
private readonly dependencies;
|
|
18
|
+
private readonly now;
|
|
19
|
+
private readonly prepareFile;
|
|
20
|
+
private readonly completeFile;
|
|
21
|
+
constructor(dependencies: EditableArtifactWorkspaceFileAdapterDependencies);
|
|
22
|
+
ensureMaterializationFile(input: Parameters<EditableArtifactAgentWorkspaceFilePort["ensureMaterializationFile"]>[0]): ReturnType<EditableArtifactAgentWorkspaceFilePort["ensureMaterializationFile"]>;
|
|
23
|
+
}
|
|
@@ -10,5 +10,11 @@ import type { GitHubSignedStatePayload } from "@opengeni/github";
|
|
|
10
10
|
export declare const githubBrowserGrantMaxAgeSeconds: number;
|
|
11
11
|
export declare function githubBrowserGrantClaims(settings: Pick<Settings, "productAccessMode">, grant: AccessGrant, nowSeconds?: number): Record<string, unknown>;
|
|
12
12
|
export declare function continuedGitHubBrowserGrantClaims(payload: GitHubSignedStatePayload): Record<string, unknown>;
|
|
13
|
+
/**
|
|
14
|
+
* GitHub may return only to the session that initiated setup. This rejects
|
|
15
|
+
* absolute/protocol-relative URLs and paths for another workspace before the
|
|
16
|
+
* value is signed into provider state.
|
|
17
|
+
*/
|
|
18
|
+
export declare function githubSessionReturnPath(value: string | undefined | null, workspaceId: string): string | null;
|
|
13
19
|
export declare function githubBrowserGrantFromState(settings: Pick<Settings, "productAccessMode">, payload: GitHubSignedStatePayload, workspaceId: string, nowSeconds?: number): AccessGrant | null;
|
|
14
20
|
export declare function githubBrowserBaseUrl(settings: Pick<Settings, "githubAppManifestBaseUrl" | "publicBaseUrl">, requestOrigin?: string | null): string;
|
package/dist/http/auth.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function allowedCorsOrigin(pattern: string, origin: string): boolean;
|
package/dist/http/sse.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type SessionEvent } from "@opengeni/contracts";
|
|
2
2
|
import { type Database } from "@opengeni/db";
|
|
3
3
|
import { type EventBus } from "@opengeni/events";
|
|
4
4
|
import type { Observability } from "@opengeni/observability";
|
|
@@ -58,6 +58,23 @@ export declare function createLatestWinsDelivery<T extends {
|
|
|
58
58
|
export declare function sseSessionStream(db: Database, bus: EventBus, workspaceId: string, sessionId: string, after: number, signal: AbortSignal, options?: SessionSseDeliveryOptions): Promise<Response>;
|
|
59
59
|
export declare function replaySessionEvents(loadPage: (after: number, limit: number) => Promise<SessionEvent[]>, send: (event: SessionEvent) => Promise<void>, after: number, pageSize?: number): Promise<void>;
|
|
60
60
|
export declare function sseWorkspaceControlStream(db: Database, bus: EventBus, workspaceId: string, after: number, signal: AbortSignal, options?: SseDeliveryOptions): Promise<Response>;
|
|
61
|
+
export type WorkspaceInteractionSseOptions = SseDeliveryOptions & {
|
|
62
|
+
pollIntervalMs?: number | undefined;
|
|
63
|
+
};
|
|
64
|
+
/**
|
|
65
|
+
* One HTTP connection for the two workspace-wide invalidation domains used by
|
|
66
|
+
* every visible OpenGeni surface. Keeping these as separate HTTP/1 streams
|
|
67
|
+
* consumes all six per-origin browser connections with only two windows and
|
|
68
|
+
* starves ordinary mutations/terminal grants. The durable cursors remain
|
|
69
|
+
* independent; this function only multiplexes their already-bounded SSE frames.
|
|
70
|
+
*/
|
|
71
|
+
export declare function sseWorkspaceLiveStream(db: Database, bus: EventBus, accountId: string, workspaceId: string, controlAfter: number, interactionAfter: number, signal: AbortSignal, options?: WorkspaceInteractionSseOptions): Promise<Response>;
|
|
72
|
+
/**
|
|
73
|
+
* Latest-wins interaction invalidation stream. The durable truth is one
|
|
74
|
+
* monotonic workspace row, not an ever-growing event log. Each poll reads only
|
|
75
|
+
* that row; reconnect immediately projects the newest revision after `after`.
|
|
76
|
+
*/
|
|
77
|
+
export declare function sseWorkspaceInteractionRevisionStream(db: Database, accountId: string, workspaceId: string, after: number, signal: AbortSignal, options?: WorkspaceInteractionSseOptions): Promise<Response>;
|
|
61
78
|
export type SseDeliveryOptions = {
|
|
62
79
|
maxQueuedBytes?: number;
|
|
63
80
|
stallTimeoutMs?: number;
|
package/dist/index.d.ts
CHANGED
|
@@ -3,14 +3,15 @@ import type { ScheduledTaskOverlapPolicy, ScheduledTaskScheduleSpec } from "@ope
|
|
|
3
3
|
import { type Database } from "@opengeni/db";
|
|
4
4
|
import { ScheduleOverlapPolicy } from "@temporalio/client";
|
|
5
5
|
import type { ScheduleSpec } from "@temporalio/client";
|
|
6
|
-
import { type DocumentIndexClient, type SessionWorkflowClient } from "./app";
|
|
6
|
+
import { type DocumentIndexClient, type SessionWorkflowClient } from "./app.js";
|
|
7
|
+
import { type EditableArtifactWebSocketConnection } from "./editable-artifact-websocket.js";
|
|
7
8
|
export declare function createTemporalWorkflowClient(settings: ReturnType<typeof getSettings>, db: Database): Promise<{
|
|
8
9
|
client: SessionWorkflowClient;
|
|
9
10
|
documentIndexer: DocumentIndexClient;
|
|
10
11
|
close: () => Promise<void>;
|
|
11
12
|
}>;
|
|
12
13
|
export declare function startApi(): Promise<{
|
|
13
|
-
server: Bun.Server<
|
|
14
|
+
server: Bun.Server<EditableArtifactWebSocketConnection>;
|
|
14
15
|
close: () => Promise<void>;
|
|
15
16
|
}>;
|
|
16
17
|
export declare function temporalOverlapPolicy(policy: ScheduledTaskOverlapPolicy): ScheduleOverlapPolicy;
|