@opengeni/core 0.21.2 → 0.24.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.
- package/dist/access/index.d.ts +9 -1
- package/dist/application/new-session-drafts.d.ts +1 -1
- package/dist/application/session-commands.d.ts +9 -4
- package/dist/billing/limits.d.ts +1 -1
- package/dist/chunk-6WKPWE5S.js +2380 -0
- package/dist/chunk-6WKPWE5S.js.map +1 -0
- package/dist/chunk-JJU6I5XD.js +2713 -0
- package/dist/chunk-JJU6I5XD.js.map +1 -0
- package/dist/chunk-NYPMQ7NO.js +2270 -0
- package/dist/chunk-NYPMQ7NO.js.map +1 -0
- package/dist/dependencies.d.ts +26 -6
- package/dist/domain/capabilities.d.ts +35 -3
- package/dist/domain/company-profile-durable-learning-adapter.d.ts +39 -0
- package/dist/domain/durable-learning-slack-publication.d.ts +72 -0
- package/dist/domain/editable-artifacts/agent-application.d.ts +192 -0
- package/dist/domain/editable-artifacts/durable-export-postgres.d.ts +4 -0
- package/dist/domain/editable-artifacts/durable-export.d.ts +212 -0
- package/dist/domain/editable-artifacts/errors.d.ts +47 -0
- package/dist/domain/editable-artifacts/hash.d.ts +11 -0
- package/dist/domain/editable-artifacts/in-memory.d.ts +99 -0
- package/dist/domain/editable-artifacts/index.d.ts +14 -0
- package/dist/domain/editable-artifacts/ports.d.ts +341 -0
- package/dist/domain/editable-artifacts/postgres-adapters.d.ts +13 -0
- package/dist/domain/editable-artifacts/service.d.ts +105 -0
- package/dist/domain/editable-artifacts/snapshot-compaction.d.ts +44 -0
- package/dist/domain/editable-artifacts/snapshot-verifier-genesis.d.ts +50 -0
- package/dist/domain/editable-artifacts/snapshot-verifier-materialization.d.ts +21 -0
- package/dist/domain/editable-artifacts/snapshot-verifier.d.ts +118 -0
- package/dist/domain/editable-artifacts/types.d.ts +410 -0
- package/dist/domain/memory-slack-delivery.d.ts +19 -0
- package/dist/domain/memory-slack-publication.d.ts +0 -2
- package/dist/domain/packs.d.ts +29 -1
- package/dist/domain/personal-connection-delegations.d.ts +9 -1
- package/dist/domain/scheduled-tasks.d.ts +27 -3
- package/dist/domain/session-tool-policy.d.ts +2 -2
- package/dist/domain/sessions.d.ts +44 -10
- package/dist/domain/skill-imports.d.ts +32 -0
- package/dist/domain/slack-publication-secret-safety.d.ts +8 -0
- package/dist/domain/timeline-annotations.d.ts +5 -0
- package/dist/domain/video-generation-capabilities.d.ts +9 -0
- package/dist/domain/video-generation.d.ts +47 -0
- package/dist/editable-artifact-live/application.d.ts +69 -0
- package/dist/editable-artifact-live/errors.d.ts +1 -0
- package/dist/editable-artifact-live/index.d.ts +8 -0
- package/dist/editable-artifact-live/outbox-dispatcher.d.ts +162 -0
- package/dist/editable-artifact-live/ports.d.ts +100 -0
- package/dist/editable-artifact-live/server.d.ts +71 -0
- package/dist/editable-artifact-live/ticket.d.ts +40 -0
- package/dist/editable-artifact-live/types.d.ts +213 -0
- package/dist/editable-artifact-live/wire.d.ts +34 -0
- package/dist/editable-artifact-live.d.ts +2 -0
- package/dist/editable-artifact-live.js +58 -0
- package/dist/editable-artifact-live.js.map +1 -0
- package/dist/editable-artifacts.d.ts +2 -0
- package/dist/editable-artifacts.js +179 -0
- package/dist/editable-artifacts.js.map +1 -0
- package/dist/index.d.ts +35 -25
- package/dist/index.js +3184 -652
- package/dist/index.js.map +1 -1
- package/dist/managed-session.d.ts +53 -0
- package/dist/rigs/index.d.ts +1 -1
- package/dist/rigs/provider-images.d.ts +31 -0
- package/dist/sandbox/fleet.d.ts +9 -1
- package/dist/sandbox/routing.d.ts +1 -0
- package/dist/session-authorization.d.ts +10 -1
- package/dist/workflow-wake-contract.d.ts +7 -0
- package/package.json +18 -10
- package/src/access/index.ts +43 -3
- package/src/application/new-session-drafts.ts +2 -0
- package/src/application/session-commands.ts +217 -116
- package/src/dependencies.ts +30 -2
- package/src/domain/capabilities.ts +672 -218
- package/src/domain/company-profile-durable-learning-adapter.ts +221 -0
- package/src/domain/durable-learning-slack-publication.ts +202 -0
- package/src/domain/editable-artifacts/agent-application.ts +687 -0
- package/src/domain/editable-artifacts/durable-export-postgres.ts +139 -0
- package/src/domain/editable-artifacts/durable-export.ts +734 -0
- package/src/domain/editable-artifacts/errors.ts +115 -0
- package/src/domain/editable-artifacts/hash.ts +131 -0
- package/src/domain/editable-artifacts/in-memory.ts +1662 -0
- package/src/domain/editable-artifacts/index.ts +14 -0
- package/src/domain/editable-artifacts/ports.ts +462 -0
- package/src/domain/editable-artifacts/postgres-adapters.ts +49 -0
- package/src/domain/editable-artifacts/service.ts +2402 -0
- package/src/domain/editable-artifacts/snapshot-compaction.ts +246 -0
- package/src/domain/editable-artifacts/snapshot-verifier-genesis.ts +235 -0
- package/src/domain/editable-artifacts/snapshot-verifier-materialization.ts +74 -0
- package/src/domain/editable-artifacts/snapshot-verifier.ts +687 -0
- package/src/domain/editable-artifacts/types.ts +835 -0
- package/src/domain/insights.ts +136 -33
- package/src/domain/memory-slack-delivery.ts +204 -0
- package/src/domain/memory-slack-publication.ts +10 -19
- package/src/domain/packs.ts +266 -5
- package/src/domain/personal-connection-delegations.ts +97 -6
- package/src/domain/resources.ts +10 -20
- package/src/domain/scheduled-tasks.ts +365 -25
- package/src/domain/session-tool-policy.ts +8 -2
- package/src/domain/sessions.ts +388 -155
- package/src/domain/skill-imports.ts +350 -0
- package/src/domain/slack-publication-secret-safety.ts +42 -0
- package/src/domain/timeline-annotations.ts +204 -0
- package/src/domain/video-generation-capabilities.ts +69 -0
- package/src/domain/video-generation.ts +249 -0
- package/src/editable-artifact-live/application.ts +182 -0
- package/src/editable-artifact-live/errors.ts +4 -0
- package/src/editable-artifact-live/index.ts +8 -0
- package/src/editable-artifact-live/outbox-dispatcher.ts +916 -0
- package/src/editable-artifact-live/ports.ts +139 -0
- package/src/editable-artifact-live/server.ts +1707 -0
- package/src/editable-artifact-live/ticket.ts +217 -0
- package/src/editable-artifact-live/types.ts +286 -0
- package/src/editable-artifact-live/wire.ts +95 -0
- package/src/editable-artifact-live.ts +2 -0
- package/src/editable-artifacts.ts +2 -0
- package/src/index.ts +14 -0
- package/src/managed-auth-type.ts +4 -3
- package/src/managed-session.ts +36 -0
- package/src/rigs/index.ts +26 -19
- package/src/rigs/provider-images.ts +110 -0
- package/src/sandbox/fleet.ts +56 -1
- package/src/sandbox/routing.ts +32 -3
- package/src/session-authorization.ts +20 -0
- package/src/workflow-wake-contract.ts +8 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { Settings } from "@opengeni/config";
|
|
2
|
-
import type { AccessGrant, McpPersonalConnectionDelegation, ScheduledTask, CreateScheduledTaskRequest as CreateScheduledTaskPayload, UpdateScheduledTaskRequest as UpdateScheduledTaskPayload } from "@opengeni/contracts";
|
|
2
|
+
import type { AccessGrant, McpPersonalConnectionDelegation, ScheduledTask, ScheduledTaskAgentConfig, Session, SessionAuthorizationPort, SessionAuthorizationSurface, CreateScheduledTaskRequest as CreateScheduledTaskPayload, UpdateScheduledTaskRequest as UpdateScheduledTaskPayload } from "@opengeni/contracts";
|
|
3
3
|
import { type Database, type UpdateScheduledTaskInput } from "@opengeni/db";
|
|
4
|
-
import type { SessionWorkflowClient } from "../dependencies";
|
|
5
|
-
import type { ObjectStorageDependency } from "../dependencies";
|
|
4
|
+
import type { SessionWorkflowClient } from "../dependencies.js";
|
|
5
|
+
import type { ObjectStorageDependency } from "../dependencies.js";
|
|
6
6
|
/**
|
|
7
7
|
* Whether a raw scheduled-task payload explicitly set agentConfig.tools.
|
|
8
8
|
* Zod's `.default([])` erases the distinction between "absent" and
|
|
@@ -20,7 +20,25 @@ export declare function createValidatedScheduledTask(input: {
|
|
|
20
20
|
payload: CreateScheduledTaskPayload;
|
|
21
21
|
toolsProvided?: boolean;
|
|
22
22
|
variableSetPreauthorized?: boolean;
|
|
23
|
+
sessionAuthorization?: SessionAuthorizationPort | null | undefined;
|
|
24
|
+
authorizationSurface?: SessionAuthorizationSurface | undefined;
|
|
23
25
|
}): Promise<ScheduledTask>;
|
|
26
|
+
export declare function validateScheduledTaskTarget(input: {
|
|
27
|
+
db: Database;
|
|
28
|
+
sessionAuthorization?: SessionAuthorizationPort | null | undefined;
|
|
29
|
+
authorizationSurface?: SessionAuthorizationSurface | undefined;
|
|
30
|
+
grant: AccessGrant;
|
|
31
|
+
targetSessionId: string | null | undefined;
|
|
32
|
+
runMode: ScheduledTask["runMode"];
|
|
33
|
+
variableSetId: string | null | undefined;
|
|
34
|
+
rigId: string | null | undefined;
|
|
35
|
+
agentConfig: ScheduledTaskAgentConfig;
|
|
36
|
+
missingTargetStatus?: 404 | 422;
|
|
37
|
+
}): Promise<Session | null>;
|
|
38
|
+
export declare function scheduledTaskForGrant(task: ScheduledTask, grant: AccessGrant): ScheduledTask;
|
|
39
|
+
export declare function scheduledTaskRunForGrant<T extends {
|
|
40
|
+
sessionId: string | null;
|
|
41
|
+
}>(run: T, grant: AccessGrant): T;
|
|
24
42
|
export declare function validatedScheduledTaskUpdate(input: {
|
|
25
43
|
settings: Settings;
|
|
26
44
|
db: Database;
|
|
@@ -30,6 +48,8 @@ export declare function validatedScheduledTaskUpdate(input: {
|
|
|
30
48
|
payload: UpdateScheduledTaskPayload;
|
|
31
49
|
/** See createValidatedScheduledTask; only consulted when agentConfig is updated. */
|
|
32
50
|
toolsProvided?: boolean;
|
|
51
|
+
sessionAuthorization?: SessionAuthorizationPort | null | undefined;
|
|
52
|
+
authorizationSurface?: SessionAuthorizationSurface | undefined;
|
|
33
53
|
}): Promise<UpdateScheduledTaskInput>;
|
|
34
54
|
export declare function requireScheduledTaskForApi(db: Database, workspaceId: string, taskId: string): Promise<ScheduledTask>;
|
|
35
55
|
export type ScheduledTaskRestoreState = {
|
|
@@ -38,6 +58,10 @@ export type ScheduledTaskRestoreState = {
|
|
|
38
58
|
};
|
|
39
59
|
export declare function captureScheduledTaskRestoreState(db: Database, task: ScheduledTask): Promise<ScheduledTaskRestoreState>;
|
|
40
60
|
export declare function restoreScheduledTask(db: Database, previous: ScheduledTaskRestoreState): Promise<ScheduledTask>;
|
|
61
|
+
export declare class ScheduledTaskSyncError extends Error {
|
|
62
|
+
readonly persistenceRestored: boolean;
|
|
63
|
+
constructor(cause: unknown, persistenceRestored: boolean);
|
|
64
|
+
}
|
|
41
65
|
export declare function syncCreatedScheduledTask(input: {
|
|
42
66
|
db: Database;
|
|
43
67
|
workflowClient: SessionWorkflowClient;
|
|
@@ -24,8 +24,8 @@ export declare function defaultSessionMcpServerIds(servers: Iterable<{
|
|
|
24
24
|
*/
|
|
25
25
|
export declare function resolveSessionToolPolicy(input: SessionToolPolicyInput): ResolvedSessionToolPolicy;
|
|
26
26
|
/** Current full runtime registry IDs, including configured static servers. */
|
|
27
|
-
export declare function workspaceSessionToolPolicyServerIds(db: Database, workspaceId: string, settings: Settings): Promise<string[]>;
|
|
27
|
+
export declare function workspaceSessionToolPolicyServerIds(db: Database, workspaceId: string, settings: Settings, subjectId?: string): Promise<string[]>;
|
|
28
28
|
/** Current omitted-tools defaults: every configured runtime MCP is on. */
|
|
29
|
-
export declare function workspaceSessionToolPolicyDefaultServerIds(db: Database, workspaceId: string, settings: Settings): Promise<string[]>;
|
|
29
|
+
export declare function workspaceSessionToolPolicyDefaultServerIds(db: Database, workspaceId: string, settings: Settings, subjectId?: string): Promise<string[]>;
|
|
30
30
|
/** Add a bounded, secret-safe effective projection to a session response. */
|
|
31
31
|
export declare function sessionWithEffectiveToolPolicy(session: Session, workspaceServerIds: Iterable<string>, workspaceDefaultServerIds?: Iterable<string>): Session;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { type Settings } from "@opengeni/config";
|
|
2
|
-
import { SessionSpawnDenial, type AccessGrant, type CreateSessionResponse, type GoalSpec, type FirstPartyMcpToolName, type McpPersonalConnectionDelegation, type Permission, type ReasoningEffort, type ResourceRef, type Session, type SessionSkill, type SessionEvent, SessionMcpApprovalPolicy, type SessionMcpCredentialUpdateInput, type SessionMcpServerMetadata, type UpdateSessionMcpApprovalPolicyResponse, type UpdateSessionToolPolicyRequest, type SessionAuthorizationPort, type SessionToolPolicy, type SessionTurn, type ToolRef, type TurnInitiator, type TurnInitiatorContext, type TurnExecutionPolicyV1 } from "@opengeni/contracts";
|
|
2
|
+
import { SessionSpawnDenial, type AccessGrant, type CreateSessionResponse, type GoalSpec, type FirstPartyMcpToolName, type McpPersonalConnectionDelegation, type Permission, type ReasoningEffort, type ResourceRef, type Session, type SessionSkill, type SessionEvent, SessionMcpApprovalPolicy, type SessionMcpCredentialUpdateInput, type SessionMcpServerMetadata, type SubmittedTimelineAnnotation, type TimelineAnnotation, type UpdateSessionMcpApprovalPolicyResponse, type UpdateSessionToolPolicyRequest, type SessionAuthorizationPort, type SessionToolPolicy, type SessionTurn, type ToolRef, type TurnInitiator, type TurnInitiatorContext, type TurnExecutionPolicyV1 } from "@opengeni/contracts";
|
|
3
3
|
import { type CreateSessionMcpServerInput, type Database, type UpdateSessionMcpServerCredentialsInput, type SessionCommandActor } from "@opengeni/db";
|
|
4
4
|
import { type EventBus } from "@opengeni/events";
|
|
5
|
-
import type { AcceptSessionUserMessageDependencies, ApiRouteDeps, SessionWorkflowClient } from "../dependencies";
|
|
5
|
+
import type { AcceptSessionUserMessageDependencies, ApiRouteDeps, SessionWorkflowClient } from "../dependencies.js";
|
|
6
6
|
/** Transport-neutral typed denial raised only after its audit row committed. */
|
|
7
7
|
export declare class SessionSpawnDeniedError extends Error {
|
|
8
8
|
readonly denial: SessionSpawnDenial;
|
|
@@ -49,7 +49,20 @@ export type FrozenCreationInitiator = {
|
|
|
49
49
|
};
|
|
50
50
|
export declare function creationInitiatorForGrant(grant: AccessGrant): FrozenCreationInitiator;
|
|
51
51
|
export declare function settingsWithSessionMcpServerMetadata(settings: Settings, servers: SessionMcpServerMetadata[]): Settings;
|
|
52
|
-
export
|
|
52
|
+
export type CreateSessionOutcome = {
|
|
53
|
+
session: CreateSessionResponse;
|
|
54
|
+
/** The committed create/start effect represented by this request. */
|
|
55
|
+
outcome: "created" | "repaired" | "replayed";
|
|
56
|
+
/** Backward-compatible replay flag for existing entity-oriented callers. */
|
|
57
|
+
replay: boolean;
|
|
58
|
+
/** True when the request created/repaired start state or committed a new wake revision. */
|
|
59
|
+
changed: boolean;
|
|
60
|
+
};
|
|
61
|
+
export type CreateSessionRequestOutcome = CreateSessionOutcome & {
|
|
62
|
+
/** Billing telemetry is recorded after the committed session start. */
|
|
63
|
+
usageRecording: "recorded" | "failed";
|
|
64
|
+
};
|
|
65
|
+
export declare function createAndStartSessionWithOutcome(input: {
|
|
53
66
|
requestedSessionId?: string;
|
|
54
67
|
db: Database;
|
|
55
68
|
bus: EventBus;
|
|
@@ -107,7 +120,9 @@ export declare function createAndStartSession(input: {
|
|
|
107
120
|
maxNestedAgentDepthOverride?: number | null;
|
|
108
121
|
allowNestedAgentDepthIncrease?: boolean;
|
|
109
122
|
subjectId?: string | null;
|
|
110
|
-
}): Promise<
|
|
123
|
+
}): Promise<CreateSessionOutcome>;
|
|
124
|
+
/** Backward-compatible entity-returning create path used by existing callers. */
|
|
125
|
+
export declare function createAndStartSession(input: Parameters<typeof createAndStartSessionWithOutcome>[0]): Promise<CreateSessionResponse>;
|
|
111
126
|
export declare function workflowIdForSession(sessionId: string): string;
|
|
112
127
|
/**
|
|
113
128
|
* Reject an explicit model that the host does not expose. The set of usable
|
|
@@ -116,10 +131,10 @@ export declare function workflowIdForSession(sessionId: string): string;
|
|
|
116
131
|
* it cannot be resolved to a provider at run time, so we fail the request at
|
|
117
132
|
* the API edge with 422 rather than enqueuing a turn the worker can't honor.
|
|
118
133
|
*
|
|
119
|
-
* `model` is the
|
|
120
|
-
*
|
|
121
|
-
*
|
|
122
|
-
*
|
|
134
|
+
* `model` is the effective value selected by the caller's boundary. Top-level
|
|
135
|
+
* omission defaults to `settings.openaiModel`; child-session omission inherits
|
|
136
|
+
* the worker-signed calling turn before reaching this helper. Centralized here
|
|
137
|
+
* so every model-carrying choke point
|
|
123
138
|
* (create-session, user-message/turn-accept, queued-turn update, and
|
|
124
139
|
* scheduled-task agentConfig — a scheduled task is a session the worker runs
|
|
125
140
|
* later) and the MCP surfaces that share them validate identically and cannot
|
|
@@ -170,6 +185,7 @@ export declare function postUserMessageTurn(input: {
|
|
|
170
185
|
workspaceId: string;
|
|
171
186
|
sessionId: string;
|
|
172
187
|
text: string;
|
|
188
|
+
annotations?: TimelineAnnotation[];
|
|
173
189
|
turnInstructions?: string | null;
|
|
174
190
|
resources: ResourceRef[];
|
|
175
191
|
model?: string | null;
|
|
@@ -187,9 +203,13 @@ export declare function postUserMessageTurn(input: {
|
|
|
187
203
|
expectedDraftRevision?: number | null;
|
|
188
204
|
reasoningEffortFallback?: Settings["openaiReasoningEffort"];
|
|
189
205
|
turnExecutionPolicy: TurnExecutionPolicyV1;
|
|
206
|
+
recordAgentRunUsage?: boolean;
|
|
207
|
+
schedulePostCommit?: (task: () => Promise<void>) => void;
|
|
190
208
|
}): Promise<{
|
|
191
209
|
accepted: SessionEvent;
|
|
192
210
|
turn: SessionTurn;
|
|
211
|
+
interruptionCount: number;
|
|
212
|
+
replay: boolean;
|
|
193
213
|
}>;
|
|
194
214
|
/**
|
|
195
215
|
* Full create-session flow shared by `POST /sessions` and the first-party MCP
|
|
@@ -200,7 +220,11 @@ export declare function postUserMessageTurn(input: {
|
|
|
200
220
|
* trusted immediate parent, while explicit arrays (including []) win. A
|
|
201
221
|
* top-level create with omitted tools applies workspace-default capability MCPs.
|
|
202
222
|
*/
|
|
203
|
-
export declare function
|
|
223
|
+
export declare function createSessionForRequestWithOutcome(deps: ApiRouteDeps, grant: AccessGrant, workspaceId: string, rawPayload: unknown): Promise<CreateSessionRequestOutcome>;
|
|
224
|
+
/** @internal Fixed public projection; the committed session outcome remains authoritative. */
|
|
225
|
+
export declare function reportSessionUsageRecordingFailure(_error: unknown): void;
|
|
226
|
+
/** Backward-compatible entity-returning request path for REST and core callers. */
|
|
227
|
+
export declare function createSessionForRequest(deps: ApiRouteDeps, grant: AccessGrant, workspaceId: string, rawPayload: unknown): Promise<CreateSessionResponse>;
|
|
204
228
|
/**
|
|
205
229
|
* Full accept-user-message flow shared by the `user.message` branch of
|
|
206
230
|
* `POST /sessions/:id/events` and the first-party MCP `session_send_message`
|
|
@@ -208,8 +232,9 @@ export declare function createSessionForRequest(deps: ApiRouteDeps, grant: Acces
|
|
|
208
232
|
* enqueue, and usage recording. `toolsProvided: false` durably preserves an
|
|
209
233
|
* Tool selection is durable session state and never rides a follow-up prompt.
|
|
210
234
|
*/
|
|
211
|
-
export declare function
|
|
235
|
+
export declare function acceptSessionUserMessageWithOutcome(deps: AcceptSessionUserMessageDependencies, grant: AccessGrant, workspaceId: string, sessionId: string, input: {
|
|
212
236
|
text: string;
|
|
237
|
+
annotations?: SubmittedTimelineAnnotation[];
|
|
213
238
|
turnInstructions?: string | null;
|
|
214
239
|
resources?: ResourceRef[];
|
|
215
240
|
model?: string | null;
|
|
@@ -224,6 +249,15 @@ export declare function acceptSessionUserMessage(deps: AcceptSessionUserMessageD
|
|
|
224
249
|
}): Promise<{
|
|
225
250
|
accepted: SessionEvent;
|
|
226
251
|
turn: SessionTurn;
|
|
252
|
+
interruptionCount: number;
|
|
253
|
+
replay: boolean;
|
|
254
|
+
}>;
|
|
255
|
+
/** Backward-compatible entity-returning path used by existing REST callers. */
|
|
256
|
+
export declare function acceptSessionUserMessage(deps: Parameters<typeof acceptSessionUserMessageWithOutcome>[0], grant: Parameters<typeof acceptSessionUserMessageWithOutcome>[1], workspaceId: Parameters<typeof acceptSessionUserMessageWithOutcome>[2], sessionId: Parameters<typeof acceptSessionUserMessageWithOutcome>[3], input: Parameters<typeof acceptSessionUserMessageWithOutcome>[4]): Promise<{
|
|
257
|
+
accepted: SessionEvent;
|
|
258
|
+
turn: SessionTurn;
|
|
259
|
+
interruptionCount: number;
|
|
260
|
+
replay: boolean;
|
|
227
261
|
}>;
|
|
228
262
|
/**
|
|
229
263
|
* Shared title-write path for the manual rename route AND both MCP tools
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { SkillImportPreview, SkillImportSource } from "@opengeni/contracts";
|
|
2
|
+
import { type SkillLibraryFile } from "@opengeni/runtime/skill-library";
|
|
3
|
+
export type GitHubSkillTreeEntry = Readonly<{
|
|
4
|
+
path: string;
|
|
5
|
+
type: "blob" | "tree" | "commit";
|
|
6
|
+
mode: string;
|
|
7
|
+
sha: string;
|
|
8
|
+
size: number | null;
|
|
9
|
+
}>;
|
|
10
|
+
export type GitHubSkillSourceClient = Readonly<{
|
|
11
|
+
resolveCommit(owner: string, repository: string, ref: string): Promise<string>;
|
|
12
|
+
listTree(owner: string, repository: string, commit: string): Promise<readonly GitHubSkillTreeEntry[]>;
|
|
13
|
+
readBlob(owner: string, repository: string, sha: string): Promise<Uint8Array>;
|
|
14
|
+
}>;
|
|
15
|
+
export type ResolvedSkillImport = Readonly<{
|
|
16
|
+
preview: SkillImportPreview;
|
|
17
|
+
files: readonly SkillLibraryFile[];
|
|
18
|
+
}>;
|
|
19
|
+
type ParsedSkillSource = Readonly<{
|
|
20
|
+
source: SkillImportSource;
|
|
21
|
+
owner: string;
|
|
22
|
+
repository: string;
|
|
23
|
+
ref: string;
|
|
24
|
+
requestedPath: string | null;
|
|
25
|
+
skillSlug: string | null;
|
|
26
|
+
inputUrl: string;
|
|
27
|
+
}>;
|
|
28
|
+
export declare function resolveSkillImport(rawUrl: string, client: GitHubSkillSourceClient): Promise<ResolvedSkillImport>;
|
|
29
|
+
export declare function portableSkillPluginKey(source: Pick<SkillImportPreview, "owner" | "repository" | "sourcePath">): string;
|
|
30
|
+
export declare function portableSkillCapabilityId(source: Pick<SkillImportPreview, "name" | "owner" | "repository" | "sourcePath">): string;
|
|
31
|
+
export declare function parseSkillSource(rawUrl: string): ParsedSkillSource;
|
|
32
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const SLACK_PUBLICATION_CREDENTIAL_OMISSION = "[credential omitted]";
|
|
2
|
+
/**
|
|
3
|
+
* Deterministic, sink-local protection for text that is about to be persisted
|
|
4
|
+
* as a Slack publication projection or rendered to Slack. It intentionally
|
|
5
|
+
* does not scan or mutate canonical Memory, durable-learning receipts, model
|
|
6
|
+
* context, history, events, or any other internal OpenGeni content path.
|
|
7
|
+
*/
|
|
8
|
+
export declare function sanitizeSlackPublicationText(value: string): string;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type DraftTimelineAnnotation, type SessionEvent, type SubmittedTimelineAnnotation, type TimelineAnnotation } from "@opengeni/contracts";
|
|
2
|
+
import { type Database } from "@opengeni/db";
|
|
3
|
+
export declare function timelineAnnotationSourceText(event: SessionEvent): string | null;
|
|
4
|
+
export declare function validateDraftTimelineAnnotations(db: Database, workspaceId: string, sessionId: string, annotations: readonly DraftTimelineAnnotation[]): Promise<DraftTimelineAnnotation[]>;
|
|
5
|
+
export declare function validateSubmittedTimelineAnnotations(db: Database, workspaceId: string, sessionId: string, annotations: readonly SubmittedTimelineAnnotation[]): Promise<TimelineAnnotation[]>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { VideoGenerationCapabilities, type VideoGenerationModelCapability, type VideoGenerationPolicy as VideoGenerationPolicyType } from "@opengeni/contracts";
|
|
2
|
+
/** Reviewed executable catalog. Dynamic workspace policy never mutates tool schemas. */
|
|
3
|
+
export declare const VIDEO_GENERATION_MODEL_CATALOG: readonly VideoGenerationModelCapability[];
|
|
4
|
+
export declare function defaultVideoGenerationPolicy(): VideoGenerationPolicyType;
|
|
5
|
+
export declare function videoGenerationCapabilitiesForPolicy(input: {
|
|
6
|
+
policy: VideoGenerationPolicyType;
|
|
7
|
+
credentialVersion: number;
|
|
8
|
+
}): VideoGenerationCapabilities;
|
|
9
|
+
export declare function assertKnownVideoGenerationModelIds(modelIds: readonly string[]): void;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { VideoGenerationAspectRatio, VideoGenerationResolution, VideoGenerationSourceMode, type GenerateVideoToolInput as GenerateVideoToolInputType, type VideoGenerationFundingSource, type VideoGenerationModelCapability } from "@opengeni/contracts";
|
|
2
|
+
export declare const VIDEO_GENERATION_ADAPTER_VERSION: "gateway-video-v4/1";
|
|
3
|
+
export type SealedVideoReferenceRole = "first_frame" | "last_frame" | "image_reference" | "video_reference";
|
|
4
|
+
export type SealedVideoReference = Readonly<{
|
|
5
|
+
role: SealedVideoReferenceRole;
|
|
6
|
+
contentSha256: string;
|
|
7
|
+
contentType: string;
|
|
8
|
+
byteSize: number;
|
|
9
|
+
}>;
|
|
10
|
+
export type CanonicalVideoGenerationRequest = Readonly<{
|
|
11
|
+
schemaVersion: 1;
|
|
12
|
+
modelId: string;
|
|
13
|
+
prompt: string;
|
|
14
|
+
sourceMode: VideoGenerationSourceMode;
|
|
15
|
+
references: readonly SealedVideoReference[];
|
|
16
|
+
durationSeconds: number;
|
|
17
|
+
aspectRatio: VideoGenerationAspectRatio;
|
|
18
|
+
resolution: VideoGenerationResolution;
|
|
19
|
+
generateAudio: boolean;
|
|
20
|
+
}>;
|
|
21
|
+
export type VideoGenerationOperationState = "preparing" | "prepared" | "accepted" | "submission_uncertain" | "provider_started" | "retaining" | "completed" | "provider_failed" | "cancelled_before_submit" | "outcome_unknown" | "retention_failed";
|
|
22
|
+
export declare function normalizeVideoGenerationRequest(input: {
|
|
23
|
+
toolInput: GenerateVideoToolInputType;
|
|
24
|
+
model: VideoGenerationModelCapability;
|
|
25
|
+
sealedReferences: readonly SealedVideoReference[];
|
|
26
|
+
}): CanonicalVideoGenerationRequest;
|
|
27
|
+
export declare function canonicalVideoGenerationRequestJson(request: CanonicalVideoGenerationRequest): string;
|
|
28
|
+
export declare function videoGenerationRequestDigest(request: CanonicalVideoGenerationRequest): string;
|
|
29
|
+
/** Stable only for one logical tool call; intentional identical calls remain distinct. */
|
|
30
|
+
export declare function videoGenerationAdmissionKey(input: {
|
|
31
|
+
workspaceId: string;
|
|
32
|
+
sessionId: string;
|
|
33
|
+
turnId: string;
|
|
34
|
+
toolCallId: string;
|
|
35
|
+
}): string;
|
|
36
|
+
export declare function videoGenerationProviderIdempotencyKey(input: {
|
|
37
|
+
operationId: string;
|
|
38
|
+
requestDigest: string;
|
|
39
|
+
}): string;
|
|
40
|
+
export declare function videoGenerationCapabilityRevision(input: {
|
|
41
|
+
policyRevision: number;
|
|
42
|
+
fundingSource: VideoGenerationFundingSource;
|
|
43
|
+
credentialVersion: number;
|
|
44
|
+
modelIds: readonly string[];
|
|
45
|
+
}): string;
|
|
46
|
+
export declare function assertVideoGenerationTransition(from: VideoGenerationOperationState, to: VideoGenerationOperationState): void;
|
|
47
|
+
export declare function isTerminalVideoGenerationState(state: VideoGenerationOperationState): boolean;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import type { EditableArtifactService } from "../domain/editable-artifacts/service.js";
|
|
2
|
+
import { type EditableArtifact, type EditableArtifactActor, type EditableArtifactClientTransactionId, type EditableArtifactId, type EditableArtifactModality, type EditableArtifactOriginalImport, type EditableArtifactScope, type ImportEditableArtifactRequest } from "../domain/editable-artifacts/types.js";
|
|
3
|
+
import type { EditableArtifactLiveSession, EditableArtifactLiveServer, OpenEditableArtifactLiveInput } from "./server.js";
|
|
4
|
+
import type { EditableArtifactLiveTicket } from "./types.js";
|
|
5
|
+
export type EditableArtifactLiveCompatibilityRequest = Readonly<{
|
|
6
|
+
artifact: EditableArtifact;
|
|
7
|
+
protocolVersion: number;
|
|
8
|
+
kernelVersion: string;
|
|
9
|
+
modelSchemaVersion: number;
|
|
10
|
+
}>;
|
|
11
|
+
/** A client/runtime protocol tuple cannot be served by the loaded kernel. */
|
|
12
|
+
export declare class EditableArtifactCompatibilityError extends Error {
|
|
13
|
+
readonly code: "unsupported_protocol";
|
|
14
|
+
constructor(message?: string);
|
|
15
|
+
}
|
|
16
|
+
/** Local runtime compatibility; unsupported native/WASM assets fail closed. */
|
|
17
|
+
export interface EditableArtifactLiveCompatibilityPort {
|
|
18
|
+
assertCompatible(input: EditableArtifactLiveCompatibilityRequest): Promise<void> | void;
|
|
19
|
+
}
|
|
20
|
+
export type CreateEditableArtifactApplicationInput = Readonly<{
|
|
21
|
+
scope: EditableArtifactScope;
|
|
22
|
+
actor: EditableArtifactActor;
|
|
23
|
+
idempotencyKey: EditableArtifactClientTransactionId;
|
|
24
|
+
modality: EditableArtifactModality;
|
|
25
|
+
title: string;
|
|
26
|
+
signal?: AbortSignal;
|
|
27
|
+
}>;
|
|
28
|
+
export type ImportEditableArtifactApplicationInput = Readonly<{
|
|
29
|
+
scope: EditableArtifactScope;
|
|
30
|
+
actor: EditableArtifactActor;
|
|
31
|
+
idempotencyKey: EditableArtifactClientTransactionId;
|
|
32
|
+
modality: EditableArtifactModality;
|
|
33
|
+
title: string;
|
|
34
|
+
originalImport: EditableArtifactOriginalImport;
|
|
35
|
+
snapshot: ImportEditableArtifactRequest["snapshot"];
|
|
36
|
+
signal?: AbortSignal;
|
|
37
|
+
}>;
|
|
38
|
+
export type ReadEditableArtifactApplicationInput = Readonly<{
|
|
39
|
+
scope: EditableArtifactScope;
|
|
40
|
+
actor: EditableArtifactActor;
|
|
41
|
+
artifactId: EditableArtifactId;
|
|
42
|
+
}>;
|
|
43
|
+
export type MintEditableArtifactApplicationTicketInput = ReadEditableArtifactApplicationInput & Readonly<{
|
|
44
|
+
protocolVersion: number;
|
|
45
|
+
kernelVersion: string;
|
|
46
|
+
modelSchemaVersion: number;
|
|
47
|
+
allowEdit: boolean;
|
|
48
|
+
}>;
|
|
49
|
+
/** Exact application seam used by standalone API and embedding hosts. */
|
|
50
|
+
export interface EditableArtifactApplicationPort {
|
|
51
|
+
createArtifact(input: CreateEditableArtifactApplicationInput): Promise<EditableArtifact>;
|
|
52
|
+
importArtifact(input: ImportEditableArtifactApplicationInput): Promise<EditableArtifact>;
|
|
53
|
+
readArtifact(input: ReadEditableArtifactApplicationInput): Promise<EditableArtifact>;
|
|
54
|
+
mintLiveTicket(input: MintEditableArtifactApplicationTicketInput): Promise<EditableArtifactLiveTicket>;
|
|
55
|
+
openLive(input: OpenEditableArtifactLiveInput): Promise<EditableArtifactLiveSession>;
|
|
56
|
+
}
|
|
57
|
+
export declare class EditableArtifactApplication implements EditableArtifactApplicationPort {
|
|
58
|
+
private readonly dependencies;
|
|
59
|
+
constructor(dependencies: Readonly<{
|
|
60
|
+
domain: EditableArtifactService;
|
|
61
|
+
live: EditableArtifactLiveServer;
|
|
62
|
+
compatibility: EditableArtifactLiveCompatibilityPort;
|
|
63
|
+
}>);
|
|
64
|
+
createArtifact(input: CreateEditableArtifactApplicationInput): Promise<EditableArtifact>;
|
|
65
|
+
importArtifact(input: ImportEditableArtifactApplicationInput): Promise<EditableArtifact>;
|
|
66
|
+
readArtifact(input: ReadEditableArtifactApplicationInput): Promise<EditableArtifact>;
|
|
67
|
+
mintLiveTicket(input: MintEditableArtifactApplicationTicketInput): Promise<EditableArtifactLiveTicket>;
|
|
68
|
+
openLive(input: OpenEditableArtifactLiveInput): Promise<EditableArtifactLiveSession>;
|
|
69
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { EditableArtifactLiveError, type EditableArtifactLiveErrorCode, } from "@opengeni/contracts/editable-artifact-live";
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import { type EditableArtifactLiveOutboxRecord, type EditableArtifactModality, type EditableArtifactOutboxId, type EditableArtifactScope } from "../domain/editable-artifacts/types.js";
|
|
2
|
+
import type { EditableArtifactLiveClockPort, EditableArtifactLiveSchedulerPort } from "./ports.js";
|
|
3
|
+
export declare const EDITABLE_ARTIFACT_HINT_MAX_BYTES: number;
|
|
4
|
+
export declare const EDITABLE_ARTIFACT_HINT_SUBJECT_PREFIX = "editable_artifacts.v1";
|
|
5
|
+
type EditableArtifactBrokerHeadHintCommon = Readonly<{
|
|
6
|
+
kind: "head_advanced";
|
|
7
|
+
schemaVersion: 1;
|
|
8
|
+
scope: EditableArtifactScope;
|
|
9
|
+
artifactId: string;
|
|
10
|
+
modality: EditableArtifactModality;
|
|
11
|
+
headSequence: number;
|
|
12
|
+
stateHash: string;
|
|
13
|
+
}>;
|
|
14
|
+
type EditableArtifactBrokerSnapshotHintCommon = Readonly<{
|
|
15
|
+
kind: "snapshot_available";
|
|
16
|
+
schemaVersion: 1;
|
|
17
|
+
scope: EditableArtifactScope;
|
|
18
|
+
artifactId: string;
|
|
19
|
+
modality: EditableArtifactModality;
|
|
20
|
+
headSequence: number;
|
|
21
|
+
stateHash: string;
|
|
22
|
+
snapshotId: string;
|
|
23
|
+
}>;
|
|
24
|
+
export type EditableArtifactBrokerHint = (EditableArtifactBrokerHeadHintCommon & Readonly<{
|
|
25
|
+
modality: "spreadsheet";
|
|
26
|
+
operationProtocolVersion: number;
|
|
27
|
+
}>) | (EditableArtifactBrokerHeadHintCommon & Readonly<{
|
|
28
|
+
modality: "document" | "presentation";
|
|
29
|
+
commitProtocolVersion: number;
|
|
30
|
+
}>) | (EditableArtifactBrokerSnapshotHintCommon & Readonly<{
|
|
31
|
+
modality: "spreadsheet";
|
|
32
|
+
operationProtocolVersion: number;
|
|
33
|
+
}>) | (EditableArtifactBrokerSnapshotHintCommon & Readonly<{
|
|
34
|
+
modality: "document" | "presentation";
|
|
35
|
+
}>);
|
|
36
|
+
export type EditableArtifactEncodedBrokerHint = Readonly<{
|
|
37
|
+
subject: string;
|
|
38
|
+
payload: Uint8Array;
|
|
39
|
+
hint: EditableArtifactBrokerHint;
|
|
40
|
+
}>;
|
|
41
|
+
export interface EditableArtifactOutboxDispatcherStorePort {
|
|
42
|
+
claimLiveOutbox(input: {
|
|
43
|
+
owner: string;
|
|
44
|
+
leaseDurationMs: number;
|
|
45
|
+
limit: number;
|
|
46
|
+
}): Promise<readonly EditableArtifactLiveOutboxRecord[]>;
|
|
47
|
+
renewLiveOutbox(input: {
|
|
48
|
+
outboxId: EditableArtifactOutboxId;
|
|
49
|
+
owner: string;
|
|
50
|
+
attemptCount: number;
|
|
51
|
+
leaseDurationMs: number;
|
|
52
|
+
}): Promise<void>;
|
|
53
|
+
markLiveOutboxPublished(input: {
|
|
54
|
+
outboxId: EditableArtifactOutboxId;
|
|
55
|
+
owner: string;
|
|
56
|
+
attemptCount: number;
|
|
57
|
+
}): Promise<void>;
|
|
58
|
+
retryLiveOutbox(input: {
|
|
59
|
+
outboxId: EditableArtifactOutboxId;
|
|
60
|
+
owner: string;
|
|
61
|
+
attemptCount: number;
|
|
62
|
+
retryDelayMs: number;
|
|
63
|
+
errorCode: EditableArtifactOutboxRetryErrorCode;
|
|
64
|
+
}): Promise<void>;
|
|
65
|
+
deadLetterLiveOutbox(input: {
|
|
66
|
+
outboxId: EditableArtifactOutboxId;
|
|
67
|
+
owner: string;
|
|
68
|
+
attemptCount: number;
|
|
69
|
+
errorCode: EditableArtifactOutboxDeadLetterErrorCode;
|
|
70
|
+
}): Promise<void>;
|
|
71
|
+
}
|
|
72
|
+
/** Resolves only after the broker has acknowledged every preceding publish. */
|
|
73
|
+
export interface EditableArtifactHintBrokerPort {
|
|
74
|
+
publish(input: Readonly<{
|
|
75
|
+
subject: string;
|
|
76
|
+
payload: Uint8Array;
|
|
77
|
+
signal: AbortSignal;
|
|
78
|
+
}>): Promise<void>;
|
|
79
|
+
}
|
|
80
|
+
export interface EditableArtifactOutboxRandomPort {
|
|
81
|
+
unit(): number;
|
|
82
|
+
}
|
|
83
|
+
export type EditableArtifactOutboxMetricOutcome = "claimed" | "published" | "retried" | "dead_lettered" | "lease_lost" | "claim_failed" | "mark_failed" | "retry_store_failed" | "dead_letter_store_failed";
|
|
84
|
+
/** Labels are closed unions; artifact/workspace identities must never become metric labels. */
|
|
85
|
+
export interface EditableArtifactOutboxMetricsPort {
|
|
86
|
+
increment(outcome: EditableArtifactOutboxMetricOutcome, count?: number): void;
|
|
87
|
+
observePublishSeconds(outcome: "acked" | "failed" | "timed_out", seconds: number): void;
|
|
88
|
+
}
|
|
89
|
+
export interface EditableArtifactOutboxLoggerPort {
|
|
90
|
+
warn(message: string, attributes: Readonly<Record<string, unknown>>): void;
|
|
91
|
+
}
|
|
92
|
+
export type EditableArtifactOutboxRetryErrorCode = "broker_unavailable" | "broker_backpressure" | "publish_timeout";
|
|
93
|
+
export type EditableArtifactOutboxDeadLetterErrorCode = "invalid_hint" | "oversized_hint";
|
|
94
|
+
export type EditableArtifactOutboxDispatcherOptions = Readonly<{
|
|
95
|
+
owner: string;
|
|
96
|
+
batchSize?: number;
|
|
97
|
+
concurrency?: number;
|
|
98
|
+
leaseDurationMs?: number;
|
|
99
|
+
leaseRenewIntervalMs?: number;
|
|
100
|
+
pollIntervalMs?: number;
|
|
101
|
+
publishTimeoutMs?: number;
|
|
102
|
+
retryBaseMs?: number;
|
|
103
|
+
retryMaxMs?: number;
|
|
104
|
+
retryJitterRatio?: number;
|
|
105
|
+
claimBackoffBaseMs?: number;
|
|
106
|
+
claimBackoffMaxMs?: number;
|
|
107
|
+
maxHintBytes?: number;
|
|
108
|
+
}>;
|
|
109
|
+
export type EditableArtifactOutboxDispatcherDependencies = Readonly<{
|
|
110
|
+
store: EditableArtifactOutboxDispatcherStorePort;
|
|
111
|
+
broker: EditableArtifactHintBrokerPort;
|
|
112
|
+
clock: EditableArtifactLiveClockPort;
|
|
113
|
+
scheduler: EditableArtifactLiveSchedulerPort;
|
|
114
|
+
random: EditableArtifactOutboxRandomPort;
|
|
115
|
+
metrics?: EditableArtifactOutboxMetricsPort;
|
|
116
|
+
logger?: EditableArtifactOutboxLoggerPort;
|
|
117
|
+
}>;
|
|
118
|
+
export type EditableArtifactOutboxDispatchSummary = Readonly<{
|
|
119
|
+
claimed: number;
|
|
120
|
+
published: number;
|
|
121
|
+
retried: number;
|
|
122
|
+
deadLettered: number;
|
|
123
|
+
leaseLost: number;
|
|
124
|
+
markFailed: number;
|
|
125
|
+
claimFailed: boolean;
|
|
126
|
+
}>;
|
|
127
|
+
export declare class EditableArtifactLiveOutboxDispatcher {
|
|
128
|
+
private readonly dependencies;
|
|
129
|
+
private readonly options;
|
|
130
|
+
private activeDispatch;
|
|
131
|
+
constructor(dependencies: EditableArtifactOutboxDispatcherDependencies, options: EditableArtifactOutboxDispatcherOptions);
|
|
132
|
+
/**
|
|
133
|
+
* Long-running resilient loop. Abort stops new claims; an already-claimed
|
|
134
|
+
* bounded batch drains before this promise resolves.
|
|
135
|
+
*/
|
|
136
|
+
run(signal: AbortSignal): Promise<void>;
|
|
137
|
+
/** Concurrent callers share one bounded claim/dispatch pass. */
|
|
138
|
+
dispatchOnce(): Promise<EditableArtifactOutboxDispatchSummary>;
|
|
139
|
+
drain(): Promise<void>;
|
|
140
|
+
private dispatchBatch;
|
|
141
|
+
private dispatchRecord;
|
|
142
|
+
private renewWhilePublishing;
|
|
143
|
+
private retry;
|
|
144
|
+
private deadLetter;
|
|
145
|
+
private metric;
|
|
146
|
+
private observePublish;
|
|
147
|
+
private warn;
|
|
148
|
+
}
|
|
149
|
+
export declare class EditableArtifactHintEncodingError extends Error {
|
|
150
|
+
readonly code: EditableArtifactOutboxDeadLetterErrorCode;
|
|
151
|
+
constructor(code: EditableArtifactOutboxDeadLetterErrorCode, message: string);
|
|
152
|
+
}
|
|
153
|
+
export declare function encodeEditableArtifactBrokerHint(record: EditableArtifactLiveOutboxRecord, maxBytes?: number): EditableArtifactEncodedBrokerHint;
|
|
154
|
+
export declare function editableArtifactLiveHintSubject(scope: EditableArtifactScope, artifactIdInput: string): string;
|
|
155
|
+
export declare function decodeEditableArtifactBrokerHint(payload: Uint8Array, expected: Readonly<{
|
|
156
|
+
scope: EditableArtifactScope;
|
|
157
|
+
artifactId: string;
|
|
158
|
+
}>, maxBytes?: number): EditableArtifactBrokerHint;
|
|
159
|
+
export declare class MathEditableArtifactOutboxRandom implements EditableArtifactOutboxRandomPort {
|
|
160
|
+
unit(): number;
|
|
161
|
+
}
|
|
162
|
+
export {};
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import type { EditableArtifactAuthorizationPort } from "../domain/editable-artifacts/ports.js";
|
|
2
|
+
import type { EditableArtifactService } from "../domain/editable-artifacts/service.js";
|
|
3
|
+
import type { EditableArtifactActor, EditableArtifactId, EditableArtifactScope, EditableArtifactStateHash, EditableArtifactTransactionId } from "../domain/editable-artifacts/types.js";
|
|
4
|
+
import type { EditableArtifactLiveBootstrap, EditableArtifactLiveClose, EditableArtifactLiveCommittedTransaction, EditableArtifactLiveHead, EditableArtifactLiveResume, EditableArtifactLiveServerFrame, EditableArtifactLiveTicketRecord } from "./types.js";
|
|
5
|
+
export interface EditableArtifactLiveTicketStorePort {
|
|
6
|
+
put(record: EditableArtifactLiveTicketRecord): Promise<void>;
|
|
7
|
+
/** Atomic take. A token can establish at most one live connection. */
|
|
8
|
+
consume(tokenDigest: string): Promise<EditableArtifactLiveTicketRecord | null>;
|
|
9
|
+
}
|
|
10
|
+
export interface EditableArtifactLiveTokenPort {
|
|
11
|
+
randomOpaqueToken(): string;
|
|
12
|
+
digestOpaqueToken(token: string): Promise<string>;
|
|
13
|
+
}
|
|
14
|
+
export interface EditableArtifactLiveClockPort {
|
|
15
|
+
now(): Date;
|
|
16
|
+
}
|
|
17
|
+
export interface EditableArtifactLiveSchedulerPort {
|
|
18
|
+
sleep(milliseconds: number, signal: AbortSignal): Promise<void>;
|
|
19
|
+
}
|
|
20
|
+
export type EditableArtifactLiveBootstrapRead = Readonly<{
|
|
21
|
+
scope: EditableArtifactScope;
|
|
22
|
+
artifactId: EditableArtifactId;
|
|
23
|
+
resume: EditableArtifactLiveResume;
|
|
24
|
+
protocolVersion: number;
|
|
25
|
+
}>;
|
|
26
|
+
export type EditableArtifactLiveTransactionPage = Readonly<{
|
|
27
|
+
transactions: readonly EditableArtifactLiveCommittedTransaction[];
|
|
28
|
+
headSequence: number;
|
|
29
|
+
minimumReplaySequence: number;
|
|
30
|
+
}>;
|
|
31
|
+
/** Canonical PostgreSQL/object-store read side. Fanout data is never accepted here. */
|
|
32
|
+
export interface EditableArtifactLiveReadPort {
|
|
33
|
+
/**
|
|
34
|
+
* Verifies any proposed resume sequence/hash/frontier against durable truth.
|
|
35
|
+
* Snapshot bytes must already have passed digest/size/object-identity checks.
|
|
36
|
+
*/
|
|
37
|
+
readBootstrap(input: EditableArtifactLiveBootstrapRead): Promise<EditableArtifactLiveBootstrap>;
|
|
38
|
+
readHead(scope: EditableArtifactScope, artifactId: EditableArtifactId): Promise<EditableArtifactLiveHead>;
|
|
39
|
+
readTransactions(input: Readonly<{
|
|
40
|
+
scope: EditableArtifactScope;
|
|
41
|
+
artifactId: EditableArtifactId;
|
|
42
|
+
after: number;
|
|
43
|
+
through: number;
|
|
44
|
+
maxCount: number;
|
|
45
|
+
maxBytes: number;
|
|
46
|
+
}>): Promise<EditableArtifactLiveTransactionPage>;
|
|
47
|
+
readCommittedTransaction(input: Readonly<{
|
|
48
|
+
scope: EditableArtifactScope;
|
|
49
|
+
artifactId: EditableArtifactId;
|
|
50
|
+
transactionId: EditableArtifactTransactionId;
|
|
51
|
+
}>): Promise<EditableArtifactLiveCommittedTransaction | null>;
|
|
52
|
+
/** Advances retention authority only after a verified client apply ACK. */
|
|
53
|
+
acknowledgeReplica(input: Readonly<{
|
|
54
|
+
scope: EditableArtifactScope;
|
|
55
|
+
artifactId: EditableArtifactId;
|
|
56
|
+
replicaId: string;
|
|
57
|
+
actorKey: string;
|
|
58
|
+
streamEpoch: string;
|
|
59
|
+
sequence: number;
|
|
60
|
+
stateHash: EditableArtifactStateHash;
|
|
61
|
+
}>): Promise<void>;
|
|
62
|
+
}
|
|
63
|
+
export type EditableArtifactLiveHint = Readonly<{
|
|
64
|
+
artifactId: EditableArtifactId;
|
|
65
|
+
headSequence: number;
|
|
66
|
+
}>;
|
|
67
|
+
export interface EditableArtifactLiveHintPort {
|
|
68
|
+
/** Resolves only after the underlying subscription/flush barrier is active. */
|
|
69
|
+
subscribe(input: Readonly<{
|
|
70
|
+
scope: EditableArtifactScope;
|
|
71
|
+
artifactId: EditableArtifactId;
|
|
72
|
+
onHint: (hint: EditableArtifactLiveHint) => void;
|
|
73
|
+
onReconnect: () => void;
|
|
74
|
+
}>): Promise<() => void>;
|
|
75
|
+
}
|
|
76
|
+
export interface EditableArtifactLiveAuthorizationInvalidationPort {
|
|
77
|
+
subscribe(input: Readonly<{
|
|
78
|
+
scope: EditableArtifactScope;
|
|
79
|
+
artifactId: EditableArtifactId;
|
|
80
|
+
actor: EditableArtifactActor;
|
|
81
|
+
onInvalidated: () => void;
|
|
82
|
+
}>): Promise<() => void>;
|
|
83
|
+
}
|
|
84
|
+
/** Adapter-owned socket writer. `send` resolves when the adapter accepts the frame. */
|
|
85
|
+
export interface EditableArtifactLiveSinkPort {
|
|
86
|
+
send(frame: EditableArtifactLiveServerFrame): Promise<void>;
|
|
87
|
+
bufferedBytes(): number;
|
|
88
|
+
close(close: EditableArtifactLiveClose): void;
|
|
89
|
+
}
|
|
90
|
+
export type EditableArtifactLiveServerDependencies = Readonly<{
|
|
91
|
+
authorization: EditableArtifactAuthorizationPort;
|
|
92
|
+
domain: EditableArtifactService;
|
|
93
|
+
tickets: EditableArtifactLiveTicketStorePort;
|
|
94
|
+
tokens: EditableArtifactLiveTokenPort;
|
|
95
|
+
clock: EditableArtifactLiveClockPort;
|
|
96
|
+
scheduler: EditableArtifactLiveSchedulerPort;
|
|
97
|
+
read: EditableArtifactLiveReadPort;
|
|
98
|
+
hints: EditableArtifactLiveHintPort;
|
|
99
|
+
invalidations: EditableArtifactLiveAuthorizationInvalidationPort;
|
|
100
|
+
}>;
|