@opengeni/core 0.21.10 → 0.28.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/access/index.d.ts +1 -1
- package/dist/application/new-session-drafts.d.ts +1 -1
- package/dist/application/session-commands.d.ts +2 -2
- package/dist/billing/limits.d.ts +1 -1
- package/dist/canonical-human-identities.d.ts +12 -0
- package/dist/canonical-human-identities.js +23 -0
- package/dist/canonical-human-identities.js.map +1 -0
- package/dist/chunk-6WKPWE5S.js +2380 -0
- package/dist/chunk-6WKPWE5S.js.map +1 -0
- package/dist/chunk-IBOEYG6N.js +34 -0
- package/dist/chunk-IBOEYG6N.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 +30 -6
- package/dist/domain/capabilities.d.ts +28 -3
- package/dist/domain/company-profile-durable-learning-adapter.d.ts +39 -0
- package/dist/domain/conversation-integrations.d.ts +225 -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/fiken.d.ts +35 -0
- package/dist/domain/memory-slack-delivery.d.ts +19 -0
- 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 +2 -2
- package/dist/domain/session-tool-policy.d.ts +2 -2
- package/dist/domain/sessions.d.ts +24 -8
- 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 +10 -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 +37 -26
- package/dist/index.js +4145 -959
- package/dist/index.js.map +1 -1
- package/dist/managed-session.d.ts +6 -2
- package/dist/rigs/index.d.ts +1 -1
- package/dist/rigs/provider-images.d.ts +31 -0
- package/dist/sandbox/fleet.d.ts +8 -5
- package/dist/sandbox/routing.d.ts +1 -0
- package/dist/session-authorization.d.ts +4 -2
- package/dist/transcription.d.ts +5 -0
- package/dist/workflow-wake-contract.d.ts +7 -0
- package/package.json +22 -10
- package/src/access/index.ts +14 -2
- package/src/application/new-session-drafts.ts +2 -0
- package/src/application/session-commands.ts +188 -107
- package/src/canonical-human-identities.ts +27 -0
- package/src/dependencies.ts +34 -2
- package/src/domain/capabilities.ts +729 -408
- package/src/domain/company-profile-durable-learning-adapter.ts +221 -0
- package/src/domain/conversation-integrations.ts +1238 -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/fiken.ts +88 -0
- package/src/domain/insights.ts +163 -50
- package/src/domain/memory-slack-delivery.ts +204 -0
- package/src/domain/memory-slack-publication.ts +5 -2
- package/src/domain/packs.ts +266 -5
- package/src/domain/personal-connection-delegations.ts +97 -6
- package/src/domain/scheduled-tasks.ts +171 -29
- package/src/domain/session-tool-policy.ts +8 -2
- package/src/domain/sessions.ts +395 -148
- 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 +104 -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 +15 -0
- package/src/managed-session.ts +19 -2
- package/src/rigs/index.ts +26 -19
- package/src/rigs/provider-images.ts +110 -0
- package/src/sandbox/fleet.ts +72 -66
- package/src/sandbox/routing.ts +6 -3
- package/src/session-authorization.ts +187 -52
- package/src/transcription.ts +5 -0
- package/src/workflow-wake-contract.ts +8 -0
|
@@ -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, type XaiProviderAccountAuthoritySnapshotV1 } 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;
|
|
@@ -14,7 +14,10 @@ export declare class SessionSpawnDeniedError extends Error {
|
|
|
14
14
|
* child omission snapshots the parent's exact effective selection. Explicit
|
|
15
15
|
* [] is authoritative and must never widen.
|
|
16
16
|
*/
|
|
17
|
-
export declare function resolveFirstPartyMcpToolsForCreate(requested: FirstPartyMcpToolName[] | undefined, parentStored: FirstPartyMcpToolName[] | null | undefined
|
|
17
|
+
export declare function resolveFirstPartyMcpToolsForCreate(requested: FirstPartyMcpToolName[] | undefined, parentStored: FirstPartyMcpToolName[] | null | undefined, policy?: {
|
|
18
|
+
default: readonly FirstPartyMcpToolName[];
|
|
19
|
+
allowed: readonly FirstPartyMcpToolName[];
|
|
20
|
+
}): FirstPartyMcpToolName[];
|
|
18
21
|
export declare function sessionSpawnDenialEnvelope(error: SessionSpawnDeniedError): {
|
|
19
22
|
readonly error: {
|
|
20
23
|
readonly code: "nested_agent_depth_exceeded" | "nested_agent_depth_override_forbidden";
|
|
@@ -66,7 +69,10 @@ export declare function createAndStartSessionWithOutcome(input: {
|
|
|
66
69
|
requestedSessionId?: string;
|
|
67
70
|
db: Database;
|
|
68
71
|
bus: EventBus;
|
|
69
|
-
workflowClient: SessionWorkflowClient
|
|
72
|
+
workflowClient: Pick<SessionWorkflowClient, "wakeSessionWorkflow">;
|
|
73
|
+
/** Internal database-only composition seam. The exact session shell and this
|
|
74
|
+
* linkage commit together before its first event/turn can be initialized. */
|
|
75
|
+
beforeCreateCommit?: (tx: Database, sessionId: string) => Promise<void>;
|
|
70
76
|
accountId: string;
|
|
71
77
|
workspaceId: string;
|
|
72
78
|
initialMessage: string;
|
|
@@ -96,6 +102,7 @@ export declare function createAndStartSessionWithOutcome(input: {
|
|
|
96
102
|
} | null;
|
|
97
103
|
rigId?: string | null;
|
|
98
104
|
rigVersionId?: string | null;
|
|
105
|
+
channelId?: string | null;
|
|
99
106
|
goal?: GoalSpec | null;
|
|
100
107
|
instructions?: string | null;
|
|
101
108
|
policyRole?: string | null;
|
|
@@ -104,6 +111,7 @@ export declare function createAndStartSessionWithOutcome(input: {
|
|
|
104
111
|
mcpServers?: CreateSessionMcpServerInput[];
|
|
105
112
|
sessionMcpServers?: SessionMcpServerMetadata[];
|
|
106
113
|
personalConnectionDelegations?: McpPersonalConnectionDelegation[];
|
|
114
|
+
xaiProviderAccountAuthoritySnapshot?: XaiProviderAccountAuthoritySnapshotV1;
|
|
107
115
|
parentSessionId?: string | null;
|
|
108
116
|
createIdempotencyKey?: string | null;
|
|
109
117
|
sandboxGroupId?: string | null;
|
|
@@ -131,10 +139,10 @@ export declare function workflowIdForSession(sessionId: string): string;
|
|
|
131
139
|
* it cannot be resolved to a provider at run time, so we fail the request at
|
|
132
140
|
* the API edge with 422 rather than enqueuing a turn the worker can't honor.
|
|
133
141
|
*
|
|
134
|
-
* `model` is the
|
|
135
|
-
*
|
|
136
|
-
*
|
|
137
|
-
*
|
|
142
|
+
* `model` is the effective value selected by the caller's boundary. Top-level
|
|
143
|
+
* omission defaults to `settings.openaiModel`; child-session omission inherits
|
|
144
|
+
* the worker-signed calling turn before reaching this helper. Centralized here
|
|
145
|
+
* so every model-carrying choke point
|
|
138
146
|
* (create-session, user-message/turn-accept, queued-turn update, and
|
|
139
147
|
* scheduled-task agentConfig — a scheduled task is a session the worker runs
|
|
140
148
|
* later) and the MCP surfaces that share them validate identically and cannot
|
|
@@ -185,6 +193,7 @@ export declare function postUserMessageTurn(input: {
|
|
|
185
193
|
workspaceId: string;
|
|
186
194
|
sessionId: string;
|
|
187
195
|
text: string;
|
|
196
|
+
annotations?: TimelineAnnotation[];
|
|
188
197
|
turnInstructions?: string | null;
|
|
189
198
|
resources: ResourceRef[];
|
|
190
199
|
model?: string | null;
|
|
@@ -202,9 +211,12 @@ export declare function postUserMessageTurn(input: {
|
|
|
202
211
|
expectedDraftRevision?: number | null;
|
|
203
212
|
reasoningEffortFallback?: Settings["openaiReasoningEffort"];
|
|
204
213
|
turnExecutionPolicy: TurnExecutionPolicyV1;
|
|
214
|
+
recordAgentRunUsage?: boolean;
|
|
215
|
+
schedulePostCommit?: (task: () => Promise<void>) => void;
|
|
205
216
|
}): Promise<{
|
|
206
217
|
accepted: SessionEvent;
|
|
207
218
|
turn: SessionTurn;
|
|
219
|
+
interruptionCount: number;
|
|
208
220
|
replay: boolean;
|
|
209
221
|
}>;
|
|
210
222
|
/**
|
|
@@ -230,6 +242,7 @@ export declare function createSessionForRequest(deps: ApiRouteDeps, grant: Acces
|
|
|
230
242
|
*/
|
|
231
243
|
export declare function acceptSessionUserMessageWithOutcome(deps: AcceptSessionUserMessageDependencies, grant: AccessGrant, workspaceId: string, sessionId: string, input: {
|
|
232
244
|
text: string;
|
|
245
|
+
annotations?: SubmittedTimelineAnnotation[];
|
|
233
246
|
turnInstructions?: string | null;
|
|
234
247
|
resources?: ResourceRef[];
|
|
235
248
|
model?: string | null;
|
|
@@ -244,12 +257,15 @@ export declare function acceptSessionUserMessageWithOutcome(deps: AcceptSessionU
|
|
|
244
257
|
}): Promise<{
|
|
245
258
|
accepted: SessionEvent;
|
|
246
259
|
turn: SessionTurn;
|
|
260
|
+
interruptionCount: number;
|
|
247
261
|
replay: boolean;
|
|
248
262
|
}>;
|
|
249
263
|
/** Backward-compatible entity-returning path used by existing REST callers. */
|
|
250
264
|
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<{
|
|
251
265
|
accepted: SessionEvent;
|
|
252
266
|
turn: SessionTurn;
|
|
267
|
+
interruptionCount: number;
|
|
268
|
+
replay: boolean;
|
|
253
269
|
}>;
|
|
254
270
|
/**
|
|
255
271
|
* 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,10 @@
|
|
|
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 videoGenerationModelSupportsFundingSource(modelId: string, fundingSource: VideoGenerationPolicyType["fundingSource"]): boolean;
|
|
5
|
+
export declare function defaultVideoGenerationPolicy(): VideoGenerationPolicyType;
|
|
6
|
+
export declare function videoGenerationCapabilitiesForPolicy(input: {
|
|
7
|
+
policy: VideoGenerationPolicyType;
|
|
8
|
+
credentialVersion: number;
|
|
9
|
+
}): VideoGenerationCapabilities;
|
|
10
|
+
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
|
+
}>;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import type { EditableArtifactAuthorizationPort } from "../domain/editable-artifacts/ports.js";
|
|
2
|
+
import type { EditableArtifactService } from "../domain/editable-artifacts/service.js";
|
|
3
|
+
import { type EditableArtifactActor, type EditableArtifactId, type EditableArtifactModality, type EditableArtifactRequestHash, type EditableArtifactScope } from "../domain/editable-artifacts/types.js";
|
|
4
|
+
import type { EditableArtifactLiveAuthorizationInvalidationPort, EditableArtifactLiveClockPort, EditableArtifactLiveHintPort, EditableArtifactLiveReadPort, EditableArtifactLiveSchedulerPort, EditableArtifactLiveServerDependencies, EditableArtifactLiveSinkPort, EditableArtifactLiveTicketStorePort, EditableArtifactLiveTokenPort } from "./ports.js";
|
|
5
|
+
import { type EditableArtifactLiveAppliedClientFrame, type EditableArtifactLiveClose, type EditableArtifactLiveCloseReason, type EditableArtifactLiveMutationReceipt, type EditableArtifactLiveResume, type EditableArtifactLiveTicket } from "./types.js";
|
|
6
|
+
export type EditableArtifactLiveServerOptions = Readonly<{
|
|
7
|
+
protocolVersion?: number;
|
|
8
|
+
ticketTtlMs?: number;
|
|
9
|
+
maxClientFrameBytes?: number;
|
|
10
|
+
maxOutboundFrameBytes?: number;
|
|
11
|
+
maxSnapshotBytes?: number;
|
|
12
|
+
snapshotChunkBytes?: number;
|
|
13
|
+
maxInFlightTransactions?: number;
|
|
14
|
+
maxInFlightBytes?: number;
|
|
15
|
+
replayPageTransactions?: number;
|
|
16
|
+
replayPageBytes?: number;
|
|
17
|
+
maxSocketBufferedBytes?: number;
|
|
18
|
+
maxInboundQueueFrames?: number;
|
|
19
|
+
maxInboundQueueBytes?: number;
|
|
20
|
+
reconcileIntervalMs?: number;
|
|
21
|
+
reauthorizeIntervalMs?: number;
|
|
22
|
+
ackTimeoutMs?: number;
|
|
23
|
+
sendTimeoutMs?: number;
|
|
24
|
+
}>;
|
|
25
|
+
export type OpenEditableArtifactLiveInput = Readonly<{
|
|
26
|
+
token: string;
|
|
27
|
+
artifactId: EditableArtifactId;
|
|
28
|
+
protocolVersion: number;
|
|
29
|
+
resume: EditableArtifactLiveResume;
|
|
30
|
+
sink: EditableArtifactLiveSinkPort;
|
|
31
|
+
signal?: AbortSignal;
|
|
32
|
+
}>;
|
|
33
|
+
export interface EditableArtifactLiveSession {
|
|
34
|
+
readonly artifactId: EditableArtifactId;
|
|
35
|
+
readonly modality: EditableArtifactModality;
|
|
36
|
+
readonly streamEpoch: string;
|
|
37
|
+
readonly closed: Promise<EditableArtifactLiveClose>;
|
|
38
|
+
receive(bytes: Uint8Array): Promise<void>;
|
|
39
|
+
acknowledge(frame: EditableArtifactLiveAppliedClientFrame): Promise<void>;
|
|
40
|
+
submitIntent(input: Readonly<{
|
|
41
|
+
protocolVersion: number;
|
|
42
|
+
artifactId: EditableArtifactId;
|
|
43
|
+
streamEpoch: string;
|
|
44
|
+
requestHash: EditableArtifactRequestHash;
|
|
45
|
+
intentBytes: Uint8Array;
|
|
46
|
+
}>): Promise<EditableArtifactLiveMutationReceipt>;
|
|
47
|
+
reconcileNow(): Promise<void>;
|
|
48
|
+
reauthorizeNow(): Promise<void>;
|
|
49
|
+
close(reason?: EditableArtifactLiveCloseReason): Promise<void>;
|
|
50
|
+
}
|
|
51
|
+
export declare class EditableArtifactLiveServer {
|
|
52
|
+
private readonly dependencies;
|
|
53
|
+
private readonly options;
|
|
54
|
+
private readonly ticketAuthority;
|
|
55
|
+
constructor(dependencies: EditableArtifactLiveServerDependencies, options?: EditableArtifactLiveServerOptions);
|
|
56
|
+
mintTicket(input: Readonly<{
|
|
57
|
+
scope: EditableArtifactScope;
|
|
58
|
+
artifactId: EditableArtifactId;
|
|
59
|
+
modality: EditableArtifactModality;
|
|
60
|
+
actor: EditableArtifactActor;
|
|
61
|
+
allowEdit: boolean;
|
|
62
|
+
}>): Promise<EditableArtifactLiveTicket>;
|
|
63
|
+
openLive(input: OpenEditableArtifactLiveInput): Promise<EditableArtifactLiveSession>;
|
|
64
|
+
}
|
|
65
|
+
export declare class SystemEditableArtifactLiveClock implements EditableArtifactLiveClockPort {
|
|
66
|
+
now(): Date;
|
|
67
|
+
}
|
|
68
|
+
export declare class SystemEditableArtifactLiveScheduler implements EditableArtifactLiveSchedulerPort {
|
|
69
|
+
sleep(milliseconds: number, signal: AbortSignal): Promise<void>;
|
|
70
|
+
}
|
|
71
|
+
export type { EditableArtifactAuthorizationPort, EditableArtifactService, EditableArtifactLiveAuthorizationInvalidationPort, EditableArtifactLiveHintPort, EditableArtifactLiveReadPort, EditableArtifactLiveSchedulerPort, EditableArtifactLiveSinkPort, EditableArtifactLiveTicketStorePort, EditableArtifactLiveTokenPort, };
|