@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
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
declare const conversationProviderNamespaceBrand: unique symbol;
|
|
2
|
+
declare const conversationProviderOpaqueValueBrand: unique symbol;
|
|
3
|
+
declare const conversationEventIdentityBrand: unique symbol;
|
|
4
|
+
declare const conversationRouteIdentityBrand: unique symbol;
|
|
5
|
+
declare const conversationActorIdentityBrand: unique symbol;
|
|
6
|
+
declare const conversationOperationIdentityBrand: unique symbol;
|
|
7
|
+
declare const conversationRequestDigestBrand: unique symbol;
|
|
8
|
+
export declare const CONVERSATION_INTEGRATION_SCHEMA_VERSION: 1;
|
|
9
|
+
export declare const CONVERSATION_PROVIDER_NAMESPACE_MAX_UTF8_BYTES = 128;
|
|
10
|
+
export declare const CONVERSATION_PROVIDER_OPAQUE_ID_MAX_UTF8_BYTES = 512;
|
|
11
|
+
export declare const CONVERSATION_TEXT_MAX_UTF8_BYTES: number;
|
|
12
|
+
export declare const CONVERSATION_ATTACHMENT_MAX_COUNT = 16;
|
|
13
|
+
export declare const CONVERSATION_ATTACHMENT_NAME_MAX_UTF8_BYTES = 1024;
|
|
14
|
+
export declare const CONVERSATION_ATTACHMENT_MEDIA_TYPE_MAX_UTF8_BYTES = 128;
|
|
15
|
+
export declare const CONVERSATION_OPERATION_KEY_MAX_UTF8_BYTES = 512;
|
|
16
|
+
export declare const CONVERSATION_OUTCOME_CODE_MAX_UTF8_BYTES = 128;
|
|
17
|
+
export type ConversationProviderNamespace = string & {
|
|
18
|
+
readonly [conversationProviderNamespaceBrand]: true;
|
|
19
|
+
};
|
|
20
|
+
export type ConversationProviderOpaqueValue = string & {
|
|
21
|
+
readonly [conversationProviderOpaqueValueBrand]: true;
|
|
22
|
+
};
|
|
23
|
+
export type ConversationProviderOpaqueIdKind = "installation" | "actor" | "conversation" | "thread" | "event" | "message" | "attachment" | "receipt";
|
|
24
|
+
export type ConversationProviderOpaqueId<TKind extends ConversationProviderOpaqueIdKind = ConversationProviderOpaqueIdKind> = Readonly<{
|
|
25
|
+
provider: ConversationProviderNamespace;
|
|
26
|
+
kind: TKind;
|
|
27
|
+
value: ConversationProviderOpaqueValue;
|
|
28
|
+
}>;
|
|
29
|
+
export type ConversationInstallationIdentity = ConversationProviderOpaqueId<"installation">;
|
|
30
|
+
export type ConversationEventIdentity = `ciev1_${string}` & {
|
|
31
|
+
readonly [conversationEventIdentityBrand]: true;
|
|
32
|
+
};
|
|
33
|
+
export type ConversationRouteIdentity = `cirt1_${string}` & {
|
|
34
|
+
readonly [conversationRouteIdentityBrand]: true;
|
|
35
|
+
};
|
|
36
|
+
export type ConversationActorIdentity = `ciac1_${string}` & {
|
|
37
|
+
readonly [conversationActorIdentityBrand]: true;
|
|
38
|
+
};
|
|
39
|
+
export type ConversationOperationIdentity = `ciop1_${string}` & {
|
|
40
|
+
readonly [conversationOperationIdentityBrand]: true;
|
|
41
|
+
};
|
|
42
|
+
export type ConversationRequestDigest = `sha256:${string}` & {
|
|
43
|
+
readonly [conversationRequestDigestBrand]: true;
|
|
44
|
+
};
|
|
45
|
+
export type ConversationActorKind = "human" | "bot" | "system";
|
|
46
|
+
export type ConversationActorInput = Readonly<{
|
|
47
|
+
providerActorId: string;
|
|
48
|
+
kind: ConversationActorKind;
|
|
49
|
+
}>;
|
|
50
|
+
export type ConversationActor = Readonly<{
|
|
51
|
+
installation: ConversationInstallationIdentity;
|
|
52
|
+
providerActorId: ConversationProviderOpaqueId<"actor">;
|
|
53
|
+
kind: ConversationActorKind;
|
|
54
|
+
identity: ConversationActorIdentity;
|
|
55
|
+
}>;
|
|
56
|
+
export type ConversationRoute = Readonly<{
|
|
57
|
+
installation: ConversationInstallationIdentity;
|
|
58
|
+
providerConversationId: ConversationProviderOpaqueId<"conversation">;
|
|
59
|
+
providerThreadId: ConversationProviderOpaqueId<"thread"> | null;
|
|
60
|
+
identity: ConversationRouteIdentity;
|
|
61
|
+
}>;
|
|
62
|
+
export type ConversationRouteInput = Readonly<{
|
|
63
|
+
providerConversationId: string;
|
|
64
|
+
providerThreadId?: string | null;
|
|
65
|
+
}>;
|
|
66
|
+
export type ConversationStartSignal = Readonly<{
|
|
67
|
+
kind: "start";
|
|
68
|
+
}>;
|
|
69
|
+
export type ConversationContinueSignal = Readonly<{
|
|
70
|
+
kind: "continue";
|
|
71
|
+
}>;
|
|
72
|
+
export type ConversationControlSignal = Readonly<{
|
|
73
|
+
kind: "control";
|
|
74
|
+
control: "stop" | "resume";
|
|
75
|
+
}>;
|
|
76
|
+
export type ConversationSignal = ConversationStartSignal | ConversationContinueSignal | ConversationControlSignal;
|
|
77
|
+
export type ConversationAttachmentReference = Readonly<{
|
|
78
|
+
providerAttachmentId: ConversationProviderOpaqueId<"attachment">;
|
|
79
|
+
fileName: string | null;
|
|
80
|
+
mediaType: string | null;
|
|
81
|
+
byteSize: number | null;
|
|
82
|
+
contentSha256: string | null;
|
|
83
|
+
}>;
|
|
84
|
+
export type ConversationAttachmentReferenceInput = Readonly<{
|
|
85
|
+
providerAttachmentId: string;
|
|
86
|
+
fileName?: string | null;
|
|
87
|
+
mediaType?: string | null;
|
|
88
|
+
byteSize?: number | null;
|
|
89
|
+
contentSha256?: string | null;
|
|
90
|
+
}>;
|
|
91
|
+
export type ConversationInboundEnvelope = Readonly<{
|
|
92
|
+
schemaVersion: typeof CONVERSATION_INTEGRATION_SCHEMA_VERSION;
|
|
93
|
+
installation: ConversationInstallationIdentity;
|
|
94
|
+
actor: ConversationActor;
|
|
95
|
+
route: ConversationRoute;
|
|
96
|
+
providerEventId: ConversationProviderOpaqueId<"event">;
|
|
97
|
+
providerMessageId: ConversationProviderOpaqueId<"message">;
|
|
98
|
+
eventIdentity: ConversationEventIdentity;
|
|
99
|
+
occurredAt: string;
|
|
100
|
+
signal: ConversationSignal;
|
|
101
|
+
text: string;
|
|
102
|
+
attachments: readonly ConversationAttachmentReference[];
|
|
103
|
+
}>;
|
|
104
|
+
export type ConversationInboundEnvelopeInput = Readonly<{
|
|
105
|
+
provider: string;
|
|
106
|
+
installationId: string;
|
|
107
|
+
actor: ConversationActorInput;
|
|
108
|
+
route: ConversationRouteInput;
|
|
109
|
+
providerEventId: string;
|
|
110
|
+
providerMessageId: string;
|
|
111
|
+
occurredAt: string;
|
|
112
|
+
signal: ConversationSignal;
|
|
113
|
+
text: string;
|
|
114
|
+
attachments?: readonly ConversationAttachmentReferenceInput[];
|
|
115
|
+
}>;
|
|
116
|
+
type ConversationDeliveryCommandBase = Readonly<{
|
|
117
|
+
schemaVersion: typeof CONVERSATION_INTEGRATION_SCHEMA_VERSION;
|
|
118
|
+
operationId: ConversationOperationIdentity;
|
|
119
|
+
logicalOperationKey: string;
|
|
120
|
+
requestDigest: ConversationRequestDigest;
|
|
121
|
+
installation: ConversationInstallationIdentity;
|
|
122
|
+
route: ConversationRoute;
|
|
123
|
+
}>;
|
|
124
|
+
export type ConversationPostCommand = ConversationDeliveryCommandBase & Readonly<{
|
|
125
|
+
kind: "post";
|
|
126
|
+
targetProviderMessageId: null;
|
|
127
|
+
text: string;
|
|
128
|
+
}>;
|
|
129
|
+
export type ConversationUpdateCommand = ConversationDeliveryCommandBase & Readonly<{
|
|
130
|
+
kind: "update";
|
|
131
|
+
targetProviderMessageId: ConversationProviderOpaqueId<"message">;
|
|
132
|
+
text: string;
|
|
133
|
+
}>;
|
|
134
|
+
export type ConversationDeleteCommand = ConversationDeliveryCommandBase & Readonly<{
|
|
135
|
+
kind: "delete";
|
|
136
|
+
targetProviderMessageId: ConversationProviderOpaqueId<"message">;
|
|
137
|
+
text: null;
|
|
138
|
+
}>;
|
|
139
|
+
export type ConversationDeliveryCommand = ConversationPostCommand | ConversationUpdateCommand | ConversationDeleteCommand;
|
|
140
|
+
export type ConversationDeliveryCommandInput = Readonly<{
|
|
141
|
+
kind: "post";
|
|
142
|
+
logicalOperationKey: string;
|
|
143
|
+
installation: ConversationInstallationIdentity;
|
|
144
|
+
route: ConversationRoute;
|
|
145
|
+
text: string;
|
|
146
|
+
}> | Readonly<{
|
|
147
|
+
kind: "update";
|
|
148
|
+
logicalOperationKey: string;
|
|
149
|
+
installation: ConversationInstallationIdentity;
|
|
150
|
+
route: ConversationRoute;
|
|
151
|
+
targetProviderMessageId: string;
|
|
152
|
+
text: string;
|
|
153
|
+
}> | Readonly<{
|
|
154
|
+
kind: "delete";
|
|
155
|
+
logicalOperationKey: string;
|
|
156
|
+
installation: ConversationInstallationIdentity;
|
|
157
|
+
route: ConversationRoute;
|
|
158
|
+
targetProviderMessageId: string;
|
|
159
|
+
}>;
|
|
160
|
+
export type ConversationProviderReceipt = Readonly<{
|
|
161
|
+
schemaVersion: typeof CONVERSATION_INTEGRATION_SCHEMA_VERSION;
|
|
162
|
+
operationId: ConversationOperationIdentity;
|
|
163
|
+
requestDigest: ConversationRequestDigest;
|
|
164
|
+
installation: ConversationInstallationIdentity;
|
|
165
|
+
providerMessageId: ConversationProviderOpaqueId<"message">;
|
|
166
|
+
providerReceiptId: ConversationProviderOpaqueId<"receipt"> | null;
|
|
167
|
+
observedAt: string;
|
|
168
|
+
}>;
|
|
169
|
+
export type ConversationProviderReceiptInput = Readonly<{
|
|
170
|
+
command: ConversationDeliveryCommand;
|
|
171
|
+
providerMessageId: string;
|
|
172
|
+
providerReceiptId?: string | null;
|
|
173
|
+
observedAt: string;
|
|
174
|
+
}>;
|
|
175
|
+
export type ConversationDeliveryNotStarted = Readonly<{
|
|
176
|
+
status: "not_started";
|
|
177
|
+
code: string;
|
|
178
|
+
}>;
|
|
179
|
+
export type ConversationDeliveryUnknown = Readonly<{
|
|
180
|
+
status: "unknown";
|
|
181
|
+
code: string;
|
|
182
|
+
}>;
|
|
183
|
+
export type ConversationDeliveryRetryableFailure = Readonly<{
|
|
184
|
+
status: "retryable_failure";
|
|
185
|
+
code: string;
|
|
186
|
+
retryAfterMs: number | null;
|
|
187
|
+
}>;
|
|
188
|
+
export type ConversationDeliveryPermanentFailure = Readonly<{
|
|
189
|
+
status: "permanent_failure";
|
|
190
|
+
code: string;
|
|
191
|
+
}>;
|
|
192
|
+
export type ConversationDeliverySuccess = Readonly<{
|
|
193
|
+
status: "success";
|
|
194
|
+
receipt: ConversationProviderReceipt;
|
|
195
|
+
}>;
|
|
196
|
+
export type ConversationDeliveryOutcome = ConversationDeliveryNotStarted | ConversationDeliveryUnknown | ConversationDeliveryRetryableFailure | ConversationDeliveryPermanentFailure | ConversationDeliverySuccess;
|
|
197
|
+
export type ConversationDeliveryOutcomeInput = ConversationDeliveryNotStarted | ConversationDeliveryUnknown | Readonly<{
|
|
198
|
+
status: "retryable_failure";
|
|
199
|
+
code: string;
|
|
200
|
+
retryAfterMs?: number | null;
|
|
201
|
+
}> | ConversationDeliveryPermanentFailure | ConversationDeliverySuccess;
|
|
202
|
+
export type ConversationDeliveryNextAction = "retry_same_operation" | "reconcile" | "stop" | "complete";
|
|
203
|
+
export declare function normalizeConversationInboundEnvelope(input: ConversationInboundEnvelopeInput): ConversationInboundEnvelope;
|
|
204
|
+
export declare function normalizeConversationProviderNamespace(value: string): ConversationProviderNamespace;
|
|
205
|
+
export declare function normalizeConversationInstallationIdentity(input: {
|
|
206
|
+
provider: string | ConversationProviderNamespace;
|
|
207
|
+
providerInstallationId: string;
|
|
208
|
+
}): ConversationInstallationIdentity;
|
|
209
|
+
export declare function normalizeConversationActor(installation: ConversationInstallationIdentity, input: ConversationActorInput): ConversationActor;
|
|
210
|
+
export declare function normalizeConversationRoute(installation: ConversationInstallationIdentity, input: ConversationRouteInput): ConversationRoute;
|
|
211
|
+
export declare function normalizeConversationDeliveryCommand(input: ConversationDeliveryCommandInput): ConversationDeliveryCommand;
|
|
212
|
+
export declare function normalizeConversationProviderReceipt(input: ConversationProviderReceiptInput): ConversationProviderReceipt;
|
|
213
|
+
export declare function normalizeConversationDeliveryOutcome(input: ConversationDeliveryOutcomeInput): ConversationDeliveryOutcome;
|
|
214
|
+
export declare function conversationDeliveryNextAction(outcome: ConversationDeliveryOutcome): ConversationDeliveryNextAction;
|
|
215
|
+
export declare function assertConversationDeliveryMayRetry(outcome: ConversationDeliveryOutcome): asserts outcome is ConversationDeliveryNotStarted | ConversationDeliveryRetryableFailure;
|
|
216
|
+
export declare function assertConversationDeliveryCommandMatches(expected: ConversationDeliveryCommand, candidate: ConversationDeliveryCommand): void;
|
|
217
|
+
export declare function assertConversationInboundEnvelope(value: unknown): asserts value is ConversationInboundEnvelope;
|
|
218
|
+
export declare function assertConversationDeliveryCommand(value: unknown): asserts value is ConversationDeliveryCommand;
|
|
219
|
+
export declare function assertConversationProviderReceipt(value: unknown): asserts value is ConversationProviderReceipt;
|
|
220
|
+
export declare function assertConversationDeliveryOutcome(value: unknown): asserts value is ConversationDeliveryOutcome;
|
|
221
|
+
export declare function canonicalConversationInboundEnvelopeJson(envelope: ConversationInboundEnvelope): string;
|
|
222
|
+
export declare function canonicalConversationDeliveryCommandJson(command: ConversationDeliveryCommand): string;
|
|
223
|
+
export declare function canonicalConversationProviderReceiptJson(receipt: ConversationProviderReceipt): string;
|
|
224
|
+
export declare function canonicalConversationDeliveryOutcomeJson(outcome: ConversationDeliveryOutcome): string;
|
|
225
|
+
export {};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { type Database, type EnqueueMemorySlackPublicationResult } from "@opengeni/db";
|
|
2
|
+
/**
|
|
3
|
+
* Narrow post-persistence port for the immutable durable-learning v1 attempt/receipt contract.
|
|
4
|
+
* The router owns validation, authority, routing, and persistence. This adapter
|
|
5
|
+
* consumes only the fields required to create a bounded notification projection.
|
|
6
|
+
*/
|
|
7
|
+
export type DurableLearningSlackOutcome = {
|
|
8
|
+
attempt: {
|
|
9
|
+
id: string;
|
|
10
|
+
accountId: string;
|
|
11
|
+
workspaceId: string;
|
|
12
|
+
inputHash: string;
|
|
13
|
+
actor: {
|
|
14
|
+
kind: "human" | "agent" | "service";
|
|
15
|
+
subjectId: string;
|
|
16
|
+
};
|
|
17
|
+
initiatingHumanSubjectId: string | null;
|
|
18
|
+
sessionId: string | null;
|
|
19
|
+
request: {
|
|
20
|
+
operation: "write";
|
|
21
|
+
subject: {
|
|
22
|
+
kind: string;
|
|
23
|
+
summary: string | null;
|
|
24
|
+
};
|
|
25
|
+
evidence: Array<{
|
|
26
|
+
kind: string;
|
|
27
|
+
}>;
|
|
28
|
+
} | {
|
|
29
|
+
operation: "rollback";
|
|
30
|
+
targetAttemptId: string;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
receipt: {
|
|
34
|
+
attemptId: string;
|
|
35
|
+
inputHash: string;
|
|
36
|
+
outcome: "applied" | "proposed" | "evidence_recorded" | "noop" | "clarification_required" | "rejected" | "rolled_back" | "failed";
|
|
37
|
+
decision: {
|
|
38
|
+
code: string;
|
|
39
|
+
destination: string | null;
|
|
40
|
+
scope: {
|
|
41
|
+
kind: string;
|
|
42
|
+
} | null;
|
|
43
|
+
authority: string | null;
|
|
44
|
+
};
|
|
45
|
+
resource: {
|
|
46
|
+
surface: string;
|
|
47
|
+
id: string;
|
|
48
|
+
version: string | null;
|
|
49
|
+
status: string;
|
|
50
|
+
} | null;
|
|
51
|
+
createdAt: string;
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
export type DurableLearningSlackPublicationResult = {
|
|
55
|
+
kind: "contract_mismatch" | "not_workspace_scoped" | "connector_evidence_untrusted" | "summary_required" | "policy_quiet";
|
|
56
|
+
enqueue: null;
|
|
57
|
+
} | {
|
|
58
|
+
kind: "enqueued";
|
|
59
|
+
enqueue: EnqueueMemorySlackPublicationResult;
|
|
60
|
+
};
|
|
61
|
+
export type DurableLearningSlackProjection = {
|
|
62
|
+
summary: string;
|
|
63
|
+
outcome: DurableLearningSlackOutcome["receipt"]["outcome"];
|
|
64
|
+
decisionCode: string;
|
|
65
|
+
destination: string | null;
|
|
66
|
+
authority: string | null;
|
|
67
|
+
resource: DurableLearningSlackOutcome["receipt"]["resource"];
|
|
68
|
+
occurredAt: string;
|
|
69
|
+
};
|
|
70
|
+
export declare function publishDurableLearningOutcomeToSlack(db: Database, outcome: DurableLearningSlackOutcome): Promise<DurableLearningSlackPublicationResult>;
|
|
71
|
+
export declare function durableLearningImportance(outcome: DurableLearningSlackOutcome): "major" | "normal" | "minor";
|
|
72
|
+
export declare function durableLearningSlackProjection(outcome: DurableLearningSlackOutcome): DurableLearningSlackProjection | null;
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
import { type DocumentArtifactCommand, type DocumentArtifactQuery, type PresentationArtifactCommand, type PresentationArtifactQuery, type SpreadsheetArtifactCommand, type SpreadsheetArtifactKernelQuery } from "@opengeni/contracts/editable-artifacts";
|
|
2
|
+
import type { EditableArtifactDurableExportService, EditableArtifactMaterializationFormat, EditableArtifactMaterializationJob } from "./durable-export.js";
|
|
3
|
+
import type { EditableArtifactService } from "./service.js";
|
|
4
|
+
import { type EditableArtifact, type EditableArtifactActor, type EditableArtifactClientTransactionId, type EditableArtifactId, type EditableArtifactModality, type EditableArtifactOriginalImport, type EditableArtifactScope, type ImportEditableArtifactRequest } from "./types.js";
|
|
5
|
+
import type { EditableArtifactKernelState } from "./ports.js";
|
|
6
|
+
export type EditableArtifactAgentCommandBatch = Readonly<{
|
|
7
|
+
modality: "spreadsheet";
|
|
8
|
+
commands: readonly SpreadsheetArtifactCommand[];
|
|
9
|
+
}> | Readonly<{
|
|
10
|
+
modality: "document";
|
|
11
|
+
commands: readonly DocumentArtifactCommand[];
|
|
12
|
+
}> | Readonly<{
|
|
13
|
+
modality: "presentation";
|
|
14
|
+
commands: readonly PresentationArtifactCommand[];
|
|
15
|
+
}>;
|
|
16
|
+
export type EditableArtifactAgentQuery = Readonly<{
|
|
17
|
+
modality: "spreadsheet";
|
|
18
|
+
query: SpreadsheetArtifactKernelQuery;
|
|
19
|
+
}> | Readonly<{
|
|
20
|
+
modality: "document";
|
|
21
|
+
query: DocumentArtifactQuery;
|
|
22
|
+
}> | Readonly<{
|
|
23
|
+
modality: "presentation";
|
|
24
|
+
query: PresentationArtifactQuery;
|
|
25
|
+
}>;
|
|
26
|
+
export type EditableArtifactAgentContext = Readonly<{
|
|
27
|
+
scope: EditableArtifactScope;
|
|
28
|
+
actor: EditableArtifactActor;
|
|
29
|
+
sessionId: string;
|
|
30
|
+
}>;
|
|
31
|
+
export type EditableArtifactAgentMetadata = Readonly<{
|
|
32
|
+
id: string;
|
|
33
|
+
modality: EditableArtifactModality;
|
|
34
|
+
title: string;
|
|
35
|
+
lifecycle: EditableArtifact["lifecycle"];
|
|
36
|
+
headSequence: number;
|
|
37
|
+
stateHash: string;
|
|
38
|
+
createdAt: string;
|
|
39
|
+
updatedAt: string;
|
|
40
|
+
}>;
|
|
41
|
+
export type EditableArtifactAgentMutationReceipt = Readonly<{
|
|
42
|
+
artifact: EditableArtifactAgentMetadata;
|
|
43
|
+
transaction: Readonly<{
|
|
44
|
+
id: string;
|
|
45
|
+
clientTransactionId: string;
|
|
46
|
+
sequenceStart: number;
|
|
47
|
+
sequenceEnd: number;
|
|
48
|
+
stateHash: string;
|
|
49
|
+
committedAt: string;
|
|
50
|
+
replayed: boolean;
|
|
51
|
+
}>;
|
|
52
|
+
}>;
|
|
53
|
+
export type EditableArtifactAgentExportReceipt = Readonly<{
|
|
54
|
+
fileId: string;
|
|
55
|
+
filename: string;
|
|
56
|
+
contentType: string;
|
|
57
|
+
sizeBytes: number;
|
|
58
|
+
sha256: string;
|
|
59
|
+
artifactId: string;
|
|
60
|
+
versionId: string;
|
|
61
|
+
materializationJobId: string;
|
|
62
|
+
sourceHeadSequence: number;
|
|
63
|
+
sourceStateHash: string;
|
|
64
|
+
}>;
|
|
65
|
+
export type PreparedEditableArtifactImport = Readonly<{
|
|
66
|
+
originalImport: EditableArtifactOriginalImport;
|
|
67
|
+
snapshot: ImportEditableArtifactRequest["snapshot"];
|
|
68
|
+
}>;
|
|
69
|
+
export type EditableArtifactOfficeImportErrorCode = "invalid_source" | "source_changed" | "unsupported_content";
|
|
70
|
+
export declare class EditableArtifactOfficeImportError extends Error {
|
|
71
|
+
readonly code: EditableArtifactOfficeImportErrorCode;
|
|
72
|
+
constructor(code: EditableArtifactOfficeImportErrorCode);
|
|
73
|
+
}
|
|
74
|
+
export interface EditableArtifactAgentAssociationPort {
|
|
75
|
+
listArtifactIds(input: {
|
|
76
|
+
scope: EditableArtifactScope;
|
|
77
|
+
sessionId: string;
|
|
78
|
+
limit: number;
|
|
79
|
+
}): Promise<readonly EditableArtifactId[]>;
|
|
80
|
+
touch(input: {
|
|
81
|
+
scope: EditableArtifactScope;
|
|
82
|
+
sessionId: string;
|
|
83
|
+
artifactId: EditableArtifactId;
|
|
84
|
+
}): Promise<void>;
|
|
85
|
+
}
|
|
86
|
+
export interface EditableArtifactAgentInspectionKernelPort {
|
|
87
|
+
query(input: {
|
|
88
|
+
state: EditableArtifactKernelState;
|
|
89
|
+
queryBytes: Uint8Array;
|
|
90
|
+
}): Promise<Uint8Array>;
|
|
91
|
+
}
|
|
92
|
+
export interface EditableArtifactOfficeImportPort {
|
|
93
|
+
prepare(input: {
|
|
94
|
+
scope: EditableArtifactScope;
|
|
95
|
+
actor: EditableArtifactActor;
|
|
96
|
+
fileId: string;
|
|
97
|
+
modality: EditableArtifactModality;
|
|
98
|
+
signal?: AbortSignal;
|
|
99
|
+
}): Promise<PreparedEditableArtifactImport>;
|
|
100
|
+
}
|
|
101
|
+
export interface EditableArtifactAgentWorkspaceFilePort {
|
|
102
|
+
ensureMaterializationFile(input: {
|
|
103
|
+
scope: EditableArtifactScope;
|
|
104
|
+
actor: EditableArtifactActor;
|
|
105
|
+
artifact: EditableArtifact;
|
|
106
|
+
versionId: string;
|
|
107
|
+
jobId: string;
|
|
108
|
+
filename: string;
|
|
109
|
+
sourceHeadSequence: number;
|
|
110
|
+
sourceStateHash: string;
|
|
111
|
+
signal?: AbortSignal;
|
|
112
|
+
}): Promise<EditableArtifactAgentExportReceipt>;
|
|
113
|
+
}
|
|
114
|
+
export type EditableArtifactAgentApplicationDependencies = Readonly<{
|
|
115
|
+
domain: EditableArtifactService;
|
|
116
|
+
exports: EditableArtifactDurableExportService;
|
|
117
|
+
associations: EditableArtifactAgentAssociationPort;
|
|
118
|
+
inspector: EditableArtifactAgentInspectionKernelPort;
|
|
119
|
+
officeImports: EditableArtifactOfficeImportPort;
|
|
120
|
+
workspaceFiles: EditableArtifactAgentWorkspaceFilePort;
|
|
121
|
+
}>;
|
|
122
|
+
/**
|
|
123
|
+
* Attempt-neutral use cases shared by direct model tools and Codemode. This is
|
|
124
|
+
* not another artifact engine: every mutation terminates at EditableArtifactService.
|
|
125
|
+
*/
|
|
126
|
+
export declare class EditableArtifactAgentApplication {
|
|
127
|
+
private readonly dependencies;
|
|
128
|
+
constructor(dependencies: EditableArtifactAgentApplicationDependencies);
|
|
129
|
+
list(input: EditableArtifactAgentContext & Readonly<{
|
|
130
|
+
limit?: number;
|
|
131
|
+
}>): Promise<readonly EditableArtifactAgentMetadata[]>;
|
|
132
|
+
create(input: EditableArtifactAgentContext & Readonly<{
|
|
133
|
+
idempotencyKey: EditableArtifactClientTransactionId;
|
|
134
|
+
modality: EditableArtifactModality;
|
|
135
|
+
title: string;
|
|
136
|
+
signal?: AbortSignal;
|
|
137
|
+
}>): Promise<EditableArtifactAgentMetadata>;
|
|
138
|
+
import(input: EditableArtifactAgentContext & Readonly<{
|
|
139
|
+
idempotencyKey: EditableArtifactClientTransactionId;
|
|
140
|
+
fileId: string;
|
|
141
|
+
modality: EditableArtifactModality;
|
|
142
|
+
title: string;
|
|
143
|
+
signal?: AbortSignal;
|
|
144
|
+
}>): Promise<EditableArtifactAgentMetadata>;
|
|
145
|
+
get(input: EditableArtifactAgentContext & Readonly<{
|
|
146
|
+
artifactId: EditableArtifactId;
|
|
147
|
+
}>): Promise<EditableArtifactAgentMetadata>;
|
|
148
|
+
inspect(input: EditableArtifactAgentContext & Readonly<{
|
|
149
|
+
artifactId: EditableArtifactId;
|
|
150
|
+
request: EditableArtifactAgentQuery;
|
|
151
|
+
}>): Promise<Readonly<{
|
|
152
|
+
artifact: EditableArtifactAgentMetadata;
|
|
153
|
+
projection: unknown;
|
|
154
|
+
}>>;
|
|
155
|
+
apply(input: EditableArtifactAgentContext & Readonly<{
|
|
156
|
+
artifactId: EditableArtifactId;
|
|
157
|
+
clientTransactionId: EditableArtifactClientTransactionId;
|
|
158
|
+
expectedHeadSequence: number;
|
|
159
|
+
expectedStateHash: string;
|
|
160
|
+
batch: EditableArtifactAgentCommandBatch;
|
|
161
|
+
}>): Promise<EditableArtifactAgentMutationReceipt>;
|
|
162
|
+
startExport(input: EditableArtifactAgentContext & Readonly<{
|
|
163
|
+
artifactId: EditableArtifactId;
|
|
164
|
+
idempotencyKey: string;
|
|
165
|
+
format: EditableArtifactMaterializationFormat;
|
|
166
|
+
options?: Readonly<Record<string, unknown>>;
|
|
167
|
+
signal?: AbortSignal;
|
|
168
|
+
}>): Promise<Readonly<{
|
|
169
|
+
artifact: EditableArtifactAgentMetadata;
|
|
170
|
+
versionId: string;
|
|
171
|
+
jobId: string;
|
|
172
|
+
sourceHeadSequence: number;
|
|
173
|
+
sourceStateHash: string;
|
|
174
|
+
state: EditableArtifactMaterializationJob["state"];
|
|
175
|
+
}>>;
|
|
176
|
+
exportStatus(input: EditableArtifactAgentContext & Readonly<{
|
|
177
|
+
artifactId: EditableArtifactId;
|
|
178
|
+
versionId: string;
|
|
179
|
+
jobId: string;
|
|
180
|
+
signal?: AbortSignal;
|
|
181
|
+
}>): Promise<Readonly<{
|
|
182
|
+
artifact: EditableArtifactAgentMetadata;
|
|
183
|
+
versionId: string;
|
|
184
|
+
jobId: string;
|
|
185
|
+
sourceHeadSequence: number;
|
|
186
|
+
sourceStateHash: string;
|
|
187
|
+
state: EditableArtifactMaterializationJob["state"];
|
|
188
|
+
errorCode: string | null;
|
|
189
|
+
file: EditableArtifactAgentExportReceipt | null;
|
|
190
|
+
}>>;
|
|
191
|
+
private touch;
|
|
192
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type PostgresEditableArtifactDurableExportStore } from "@opengeni/db/editable-artifact-durable-export";
|
|
2
|
+
import { type EditableArtifactDurableExportStorePort } from "./durable-export.js";
|
|
3
|
+
/** One-way adapter keeps @opengeni/db free of the core package cycle. */
|
|
4
|
+
export declare function editableArtifactDurableExportStorePortFromPostgres(store: PostgresEditableArtifactDurableExportStore): EditableArtifactDurableExportStorePort;
|