@opengeni/db 0.14.3 → 0.16.2
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/{chunk-ELMUCYZF.js → chunk-4RUK5CON.js} +183 -42
- package/dist/chunk-4RUK5CON.js.map +1 -0
- package/dist/chunk-HZD7KVAR.js +4648 -0
- package/dist/chunk-HZD7KVAR.js.map +1 -0
- package/dist/{chunk-Y5WZZVQK.js → chunk-SK7YYHBI.js} +5 -2
- package/dist/chunk-SK7YYHBI.js.map +1 -0
- package/dist/codex-token-resolver.d.ts +64 -0
- package/dist/connection-token-resolver.d.ts +90 -0
- package/dist/environment-crypto.d.ts +11 -0
- package/dist/event-payload-sanitizer.d.ts +32 -0
- package/dist/index.d.ts +6217 -10
- package/dist/index.js +6930 -2708
- package/dist/index.js.map +1 -1
- package/dist/insights.d.ts +157 -0
- package/dist/memory-domain.d.ts +44 -0
- package/dist/migrate.d.ts +5 -7
- package/dist/migrate.js +1 -1
- package/dist/new-session-drafts.d.ts +49 -0
- package/dist/persistence-errors.d.ts +69 -0
- package/dist/preference-registry-schema.d.ts +1147 -0
- package/dist/preference-registry.d.ts +878 -0
- package/dist/provision-roles.d.ts +4 -6489
- package/dist/provision-roles.js +1 -1
- package/dist/role-relationships.d.ts +35 -0
- package/dist/runtime-posture-cli.d.ts +1 -0
- package/dist/runtime-posture.d.ts +103 -0
- package/dist/schema.d.ts +23533 -3
- package/dist/schema.js +17 -1
- package/dist/session-control.d.ts +331 -0
- package/dist/session-queue-commands.d.ts +186 -0
- package/dist/session-tool-call-settlement.d.ts +32 -0
- package/dist/turn-initiator.d.ts +28 -0
- package/dist/workspace-instruction-policies-schema.d.ts +735 -0
- package/dist/workspace-instruction-policies.d.ts +64 -0
- package/drizzle/0136_unified_session_tool_policy.sql +1 -1
- package/drizzle/0137_preference_registry.sql +1347 -0
- package/drizzle/0138_sandbox_checkpoint_artifacts_and_deadlines.sql +1074 -0
- package/drizzle/0139_codex_provider_artifact_invalidations.sql +51 -0
- package/drizzle/0140_sandbox_restore_and_reaper_fences.sql +276 -0
- package/drizzle/0142_sandbox_archive_capture_gate.sql +80 -0
- package/drizzle/0143_session_codex_compaction_mode.sql +20 -0
- package/drizzle/0144_sandbox_viewer_force_drain_gate.sql +95 -0
- package/drizzle/0145_model_call_facts.sql +96 -0
- package/drizzle/0146_slack_bot_delete_idempotency.sql +105 -0
- package/drizzle/0147_draft_latency_mode.sql +12 -0
- package/drizzle/0148_session_turn_latency_mode.sql +12 -0
- package/package.json +6 -6
- package/src/index.ts +4995 -421
- package/src/insights.ts +837 -0
- package/src/migrate.ts +9 -1
- package/src/new-session-drafts.ts +4 -0
- package/src/preference-registry-schema.ts +170 -0
- package/src/preference-registry.ts +1220 -0
- package/src/provision-roles.ts +95 -22
- package/src/role-relationships.ts +132 -0
- package/src/runtime-posture.ts +28 -26
- package/src/schema.ts +478 -5
- package/src/session-queue-commands.ts +39 -6
- package/dist/chunk-DW24CKCT.js +0 -4046
- package/dist/chunk-DW24CKCT.js.map +0 -1
- package/dist/chunk-ELMUCYZF.js.map +0 -1
- package/dist/chunk-Y5WZZVQK.js.map +0 -1
- package/dist/schema-DhkRhcuQ.d.ts +0 -22666
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
metadataWithTurnExecutionPolicyV1,
|
|
3
3
|
mergeResourceRefs,
|
|
4
|
+
ResourceRef,
|
|
5
|
+
resourceMountPath,
|
|
6
|
+
stableJson,
|
|
4
7
|
turnExecutionPolicyAuditMetadata,
|
|
8
|
+
type LatencyMode,
|
|
5
9
|
type ReasoningEffort,
|
|
6
|
-
type ResourceRef,
|
|
7
10
|
type TurnExecutionPolicyV1,
|
|
8
11
|
} from "@opengeni/contracts";
|
|
9
12
|
import { and, asc, eq, inArray, sql } from "drizzle-orm";
|
|
@@ -367,6 +370,27 @@ function draftIsNonEmpty(draft: ComposerDraftRow): boolean {
|
|
|
367
370
|
return draft.text.length > 0 || draft.resources.length > 0 || draft.sourceTurnId !== null;
|
|
368
371
|
}
|
|
369
372
|
|
|
373
|
+
function withCanonicalResourceMountPaths(resources: readonly unknown[]): unknown[] {
|
|
374
|
+
const seen = new Set<string>();
|
|
375
|
+
const canonical: unknown[] = [];
|
|
376
|
+
for (const value of resources) {
|
|
377
|
+
const parsed = ResourceRef.safeParse(value);
|
|
378
|
+
if (!parsed.success) {
|
|
379
|
+
canonical.push(value);
|
|
380
|
+
continue;
|
|
381
|
+
}
|
|
382
|
+
const normalized = {
|
|
383
|
+
...(value as Record<string, unknown>),
|
|
384
|
+
mountPath: resourceMountPath(parsed.data),
|
|
385
|
+
};
|
|
386
|
+
const key = stableJson(normalized);
|
|
387
|
+
if (seen.has(key)) continue;
|
|
388
|
+
seen.add(key);
|
|
389
|
+
canonical.push(normalized);
|
|
390
|
+
}
|
|
391
|
+
return canonical;
|
|
392
|
+
}
|
|
393
|
+
|
|
370
394
|
export async function getComposerDraftInTransaction(
|
|
371
395
|
db: Database,
|
|
372
396
|
input: {
|
|
@@ -403,6 +427,7 @@ export async function saveComposerDraftInTransaction(
|
|
|
403
427
|
resources: ResourceRef[];
|
|
404
428
|
model: string;
|
|
405
429
|
reasoningEffort: ReasoningEffort;
|
|
430
|
+
latencyMode?: LatencyMode;
|
|
406
431
|
},
|
|
407
432
|
): Promise<ComposerDraftRow> {
|
|
408
433
|
await lockWorkspaceInferenceControl(db, input.workspaceId, "share");
|
|
@@ -430,11 +455,12 @@ export async function saveComposerDraftInTransaction(
|
|
|
430
455
|
subjectId: input.subjectId,
|
|
431
456
|
revision,
|
|
432
457
|
text: input.text,
|
|
433
|
-
resources: input.resources,
|
|
458
|
+
resources: withCanonicalResourceMountPaths(input.resources),
|
|
434
459
|
tools: [],
|
|
435
460
|
toolsProvided: false,
|
|
436
461
|
model: input.model,
|
|
437
462
|
reasoningEffort: input.reasoningEffort,
|
|
463
|
+
latencyMode: input.latencyMode ?? "standard",
|
|
438
464
|
// A queue edit is still the same accepted work item. Preserve its frozen
|
|
439
465
|
// initiator through arbitrary draft saves; only a genuinely new compose or
|
|
440
466
|
// Steer captures the submitting actor.
|
|
@@ -802,11 +828,12 @@ export async function editQueuedTurnInTransaction(
|
|
|
802
828
|
subjectId: input.subjectId,
|
|
803
829
|
revision: nextDraftRevision,
|
|
804
830
|
text: turn.prompt,
|
|
805
|
-
resources: turn.resources,
|
|
831
|
+
resources: withCanonicalResourceMountPaths(turn.resources),
|
|
806
832
|
tools: [],
|
|
807
833
|
toolsProvided: false,
|
|
808
834
|
model: turn.model,
|
|
809
835
|
reasoningEffort: turn.reasoningEffort,
|
|
836
|
+
latencyMode: turn.latencyMode,
|
|
810
837
|
sourceTurnId: turn.id,
|
|
811
838
|
sourceTurnVersion: turn.version,
|
|
812
839
|
updatedAt: new Date(),
|
|
@@ -1122,6 +1149,7 @@ export async function submitHumanPromptInTransaction(
|
|
|
1122
1149
|
resources: ResourceRef[];
|
|
1123
1150
|
model?: string | null;
|
|
1124
1151
|
reasoningEffort?: ReasoningEffort | null;
|
|
1152
|
+
latencyMode?: LatencyMode | null;
|
|
1125
1153
|
reasoningEffortFallback: ReasoningEffort;
|
|
1126
1154
|
/** Trusted API/core admission snapshot. Omitted only by legacy low-level callers. */
|
|
1127
1155
|
turnExecutionPolicy?: TurnExecutionPolicyV1;
|
|
@@ -1149,9 +1177,10 @@ export async function submitHumanPromptInTransaction(
|
|
|
1149
1177
|
expectedDraftRevision: input.expectedDraftRevision ?? null,
|
|
1150
1178
|
text: input.text,
|
|
1151
1179
|
turnInstructions: input.turnInstructions ?? null,
|
|
1152
|
-
resources: input.resources,
|
|
1180
|
+
resources: withCanonicalResourceMountPaths(input.resources),
|
|
1153
1181
|
model: input.model ?? null,
|
|
1154
1182
|
reasoningEffort: input.reasoningEffort ?? null,
|
|
1183
|
+
latencyMode: input.latencyMode ?? null,
|
|
1155
1184
|
source: input.source,
|
|
1156
1185
|
mcpCredentialUpdates: input.mcpCredentialUpdates ?? [],
|
|
1157
1186
|
...(input.actor.type === "service"
|
|
@@ -1256,15 +1285,17 @@ export async function submitHumanPromptInTransaction(
|
|
|
1256
1285
|
draft &&
|
|
1257
1286
|
canonicalSessionCommandHash({
|
|
1258
1287
|
text: draft.text,
|
|
1259
|
-
resources: draft.resources,
|
|
1288
|
+
resources: withCanonicalResourceMountPaths(draft.resources),
|
|
1260
1289
|
model: draft.model,
|
|
1261
1290
|
reasoningEffort: draft.reasoningEffort,
|
|
1291
|
+
latencyMode: draft.latencyMode,
|
|
1262
1292
|
}) !==
|
|
1263
1293
|
canonicalSessionCommandHash({
|
|
1264
1294
|
text: input.text,
|
|
1265
|
-
resources: input.resources,
|
|
1295
|
+
resources: withCanonicalResourceMountPaths(input.resources),
|
|
1266
1296
|
model: input.model ?? session.model,
|
|
1267
1297
|
reasoningEffort: input.reasoningEffort ?? input.reasoningEffortFallback,
|
|
1298
|
+
latencyMode: input.turnExecutionPolicy?.latencyMode ?? input.latencyMode ?? "standard",
|
|
1268
1299
|
})
|
|
1269
1300
|
) {
|
|
1270
1301
|
throw new QueueCommandConflictError(
|
|
@@ -1384,6 +1415,7 @@ export async function submitHumanPromptInTransaction(
|
|
|
1384
1415
|
...(input.resources.length ? { resources: input.resources } : {}),
|
|
1385
1416
|
...(input.model ? { model: input.model } : {}),
|
|
1386
1417
|
...(input.reasoningEffort ? { reasoningEffort: input.reasoningEffort } : {}),
|
|
1418
|
+
...(input.latencyMode ? { latencyMode: input.latencyMode } : {}),
|
|
1387
1419
|
delivery: input.delivery,
|
|
1388
1420
|
initiator: frozenInitiator.initiator,
|
|
1389
1421
|
}),
|
|
@@ -1413,6 +1445,7 @@ export async function submitHumanPromptInTransaction(
|
|
|
1413
1445
|
toolsProvided: false,
|
|
1414
1446
|
model: input.model ?? session.model,
|
|
1415
1447
|
reasoningEffort: input.reasoningEffort ?? input.reasoningEffortFallback,
|
|
1448
|
+
latencyMode: input.turnExecutionPolicy?.latencyMode ?? input.latencyMode ?? "standard",
|
|
1416
1449
|
sandboxBackend: session.sandboxBackend,
|
|
1417
1450
|
metadata: input.turnExecutionPolicy
|
|
1418
1451
|
? metadataWithTurnExecutionPolicyV1({}, input.turnExecutionPolicy)
|