@opengeni/db 4.0.0-canary.0 → 4.0.0-canary.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.
Files changed (81) hide show
  1. package/dist/canonical-human-identities.js +3 -3
  2. package/dist/{chunk-2XEZK4LF.js → chunk-7YZP2CSL.js} +23 -1
  3. package/dist/chunk-7YZP2CSL.js.map +1 -0
  4. package/dist/{chunk-P6NSEG2S.js → chunk-B5Y3TCSP.js} +2 -2
  5. package/dist/{chunk-CJROYHSC.js → chunk-CQF6G4IF.js} +3 -3
  6. package/dist/chunk-DUB3LUVM.js +4145 -0
  7. package/dist/chunk-DUB3LUVM.js.map +1 -0
  8. package/dist/{chunk-3RI33YQN.js → chunk-FRIYCNK2.js} +3 -1
  9. package/dist/{chunk-3RI33YQN.js.map → chunk-FRIYCNK2.js.map} +1 -1
  10. package/dist/{chunk-RZNOSEMC.js → chunk-L2QFSPFP.js} +2 -2
  11. package/dist/{chunk-NLFHMPUB.js → chunk-NPKBYGAK.js} +2 -2
  12. package/dist/{chunk-QM6YOWHZ.js → chunk-PWJJKCTF.js} +85 -4
  13. package/dist/chunk-PWJJKCTF.js.map +1 -0
  14. package/dist/{chunk-MX6V5F65.js → chunk-VU2IK37Y.js} +2 -2
  15. package/dist/{chunk-UFAMOUWL.js → chunk-XIYAXH47.js} +2 -2
  16. package/dist/editable-artifact-durable-export.js +2 -2
  17. package/dist/editable-artifacts.js +3 -3
  18. package/dist/index.d.ts +113 -7
  19. package/dist/index.js +9392 -11506
  20. package/dist/index.js.map +1 -1
  21. package/dist/managed-auth-session-sets.js +3 -3
  22. package/dist/migrate.d.ts +6 -0
  23. package/dist/migrate.js +3 -1
  24. package/dist/migration-runner-settings.d.ts +10 -0
  25. package/dist/new-session-drafts.d.ts +2 -0
  26. package/dist/provision-roles.js +1 -1
  27. package/dist/runtime-posture.d.ts +2 -2
  28. package/dist/schema.d.ts +270 -9
  29. package/dist/schema.js +3 -1
  30. package/dist/session-background-commands.d.ts +83 -0
  31. package/dist/session-background-commands.js +18 -3
  32. package/dist/session-command-output.d.ts +17 -0
  33. package/dist/session-command-output.js +130 -0
  34. package/dist/session-command-output.js.map +1 -0
  35. package/dist/session-event-slices.d.ts +28 -0
  36. package/dist/session-event-slices.js +225 -0
  37. package/dist/session-event-slices.js.map +1 -0
  38. package/dist/session-mcp-progress.d.ts +12 -0
  39. package/dist/session-tenancy.js +3 -3
  40. package/dist/site-publication-request.d.ts +18 -0
  41. package/dist/video-generation.js +3 -3
  42. package/dist/workspace-artifacts.d.ts +34 -4
  43. package/dist/xai-subscription.d.ts +2 -0
  44. package/drizzle/0407_connected_command_tracking_retirement.sql +245 -0
  45. package/drizzle/0408_scheduled_session_target_index.sql +4 -0
  46. package/drizzle/0409_new_session_draft_project_provenance.sql +321 -0
  47. package/drizzle/0410_new_session_draft_project_provenance_index.sql +5 -0
  48. package/drizzle/0411_new_session_draft_project_provenance_backfill.sql +53 -0
  49. package/drizzle/0412_new_session_draft_project_provenance_validation.sql +30 -0
  50. package/drizzle/0413_session_filter_activity.sql +96 -0
  51. package/drizzle/0414_scheduled_generated_producer_materialization.sql +287 -0
  52. package/drizzle/0415_command_completion_observation.sql +9 -0
  53. package/drizzle/0416_scheduled_inherited_tool_admission.sql +27 -0
  54. package/drizzle/0417_command_runner_failure_metadata.sql +17 -0
  55. package/drizzle/0418_site_direct_uploads.sql +151 -0
  56. package/drizzle/0419_background_command_launch_authority.sql +56 -0
  57. package/package.json +14 -6
  58. package/src/index.ts +1691 -217
  59. package/src/migrate.ts +10 -2
  60. package/src/migration-runner-settings.ts +21 -0
  61. package/src/new-session-drafts.ts +105 -1
  62. package/src/runtime-posture.ts +2 -0
  63. package/src/schema.ts +97 -3
  64. package/src/session-background-commands.ts +320 -4
  65. package/src/session-command-output.ts +158 -0
  66. package/src/session-control.ts +53 -21
  67. package/src/session-event-slices.ts +310 -0
  68. package/src/session-mcp-progress.ts +67 -0
  69. package/src/site-publication-request.ts +32 -0
  70. package/src/workspace-artifacts.ts +95 -96
  71. package/src/xai-subscription.ts +8 -0
  72. package/dist/chunk-2XEZK4LF.js.map +0 -1
  73. package/dist/chunk-N5VXJ4I2.js +0 -589
  74. package/dist/chunk-N5VXJ4I2.js.map +0 -1
  75. package/dist/chunk-QM6YOWHZ.js.map +0 -1
  76. /package/dist/{chunk-P6NSEG2S.js.map → chunk-B5Y3TCSP.js.map} +0 -0
  77. /package/dist/{chunk-CJROYHSC.js.map → chunk-CQF6G4IF.js.map} +0 -0
  78. /package/dist/{chunk-RZNOSEMC.js.map → chunk-L2QFSPFP.js.map} +0 -0
  79. /package/dist/{chunk-NLFHMPUB.js.map → chunk-NPKBYGAK.js.map} +0 -0
  80. /package/dist/{chunk-MX6V5F65.js.map → chunk-VU2IK37Y.js.map} +0 -0
  81. /package/dist/{chunk-UFAMOUWL.js.map → chunk-XIYAXH47.js.map} +0 -0
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  rawRows,
3
3
  withRlsContext
4
- } from "./chunk-UFAMOUWL.js";
4
+ } from "./chunk-XIYAXH47.js";
5
5
 
6
6
  // src/editable-artifacts.ts
7
7
  import { createHash } from "crypto";
@@ -3540,4 +3540,4 @@ export {
3540
3540
  PostgresEditableArtifactStore,
3541
3541
  PostgresEditableArtifactLiveReadStore
3542
3542
  };
3543
- //# sourceMappingURL=chunk-RZNOSEMC.js.map
3543
+ //# sourceMappingURL=chunk-L2QFSPFP.js.map
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  nestedPostgresSqlState,
3
3
  rawRows
4
- } from "./chunk-UFAMOUWL.js";
4
+ } from "./chunk-XIYAXH47.js";
5
5
 
6
6
  // src/canonical-human-identities.ts
7
7
  import { createHash } from "crypto";
@@ -309,4 +309,4 @@ export {
309
309
  getCanonicalHumanIdentityProjection,
310
310
  applyCanonicalHumanIdentityOperation
311
311
  };
312
- //# sourceMappingURL=chunk-NLFHMPUB.js.map
312
+ //# sourceMappingURL=chunk-NPKBYGAK.js.map
@@ -322,6 +322,7 @@ __export(schema_exports, {
322
322
  videoGenerationOperations: () => videoGenerationOperations,
323
323
  videoGenerationReferences: () => videoGenerationReferences,
324
324
  workspaceArtifactEvents: () => workspaceArtifactEvents,
325
+ workspaceArtifactUploads: () => workspaceArtifactUploads,
325
326
  workspaceArtifactVersions: () => workspaceArtifactVersions,
326
327
  workspaceArtifacts: () => workspaceArtifacts,
327
328
  workspaceCaptures: () => workspaceCaptures,
@@ -397,6 +398,7 @@ function withLosslessContentWriteVersion(value, contentKey, versionKey) {
397
398
  };
398
399
  return Array.isArray(value) ? value.map(stamp) : stamp(value);
399
400
  }
401
+ var LOSSLESS_JSON_STRING_PREFIX = JSON_STRING_PREFIX;
400
402
  var LOSSLESS_TEXT_PREFIX = TEXT_PREFIX;
401
403
  var UnsupportedCanonicalValueError = class extends TypeError {
402
404
  name = "UnsupportedCanonicalValueError";
@@ -6475,6 +6477,28 @@ var workspaceArtifacts = pgTable19(
6475
6477
  )
6476
6478
  })
6477
6479
  );
6480
+ var workspaceArtifactUploads = pgTable19(
6481
+ "workspace_artifact_uploads",
6482
+ {
6483
+ id: uuid19("id").primaryKey().defaultRandom(),
6484
+ accountId: uuid19("account_id").notNull().references(() => managedAccounts.id, { onDelete: "cascade" }),
6485
+ workspaceId: uuid19("workspace_id").notNull().references(() => workspaces.id, { onDelete: "cascade" }),
6486
+ ownerId: text19("owner_id").notNull(),
6487
+ expiresAt: timestamp19("expires_at", { withTimezone: true }).notNull(),
6488
+ status: text19("status").$type().notNull().default("pending")
6489
+ },
6490
+ (table) => [
6491
+ foreignKey({
6492
+ columns: [table.workspaceId, table.accountId],
6493
+ foreignColumns: [workspaces.id, workspaces.accountId]
6494
+ }).onDelete("cascade"),
6495
+ index19("workspace_artifact_uploads_expiry_idx").on(table.workspaceId, table.expiresAt).where(sql16`${table.status} <> 'published'`),
6496
+ check11(
6497
+ "workspace_artifact_uploads_status_check",
6498
+ sql16`${table.status} in ('pending', 'published', 'expired')`
6499
+ )
6500
+ ]
6501
+ );
6478
6502
  var workspaceArtifactVersions = pgTable19(
6479
6503
  "workspace_artifact_versions",
6480
6504
  {
@@ -6485,11 +6509,11 @@ var workspaceArtifactVersions = pgTable19(
6485
6509
  revision: integer18("revision").notNull(),
6486
6510
  contentKey: text19("content_key").notNull(),
6487
6511
  contentType: text19("content_type").$type().notNull().default("text/html"),
6488
- contentSha256: text19("content_sha256").notNull(),
6489
- sizeBytes: integer18("size_bytes").notNull(),
6512
+ contentSha256: text19("content_sha256"),
6513
+ sizeBytes: bigint14("size_bytes", { mode: "number" }).notNull(),
6490
6514
  sourceKey: text19("source_key"),
6491
6515
  sourceSha256: text19("source_sha256"),
6492
- sourceSizeBytes: integer18("source_size_bytes"),
6516
+ sourceSizeBytes: bigint14("source_size_bytes", { mode: "number" }),
6493
6517
  requestedTools: jsonb15("requested_tools").$type().notNull().default([]),
6494
6518
  operationKey: text19("operation_key").notNull(),
6495
6519
  sourceSessionId: uuid19("source_session_id"),
@@ -6551,6 +6575,7 @@ var workspaceArtifactEvents = pgTable19(
6551
6575
  toVersionId: uuid19("to_version_id").notNull(),
6552
6576
  operationKey: text19("operation_key").notNull(),
6553
6577
  requestDigest: text19("request_digest"),
6578
+ requestInput: jsonb15("request_input").$type(),
6554
6579
  sourceSessionId: uuid19("source_session_id"),
6555
6580
  sourceTurnId: uuid19("source_turn_id"),
6556
6581
  sourceAttemptId: uuid19("source_attempt_id"),
@@ -9955,6 +9980,13 @@ var sessions = pgTable19(
9955
9980
  table.updatedAt.desc(),
9956
9981
  table.id.desc()
9957
9982
  ),
9983
+ workspaceCreatorUpdatedId: index19("sessions_workspace_creator_updated_id_idx").on(
9984
+ table.workspaceId,
9985
+ table.createdByKind,
9986
+ table.createdBySubjectId,
9987
+ table.updatedAt.desc(),
9988
+ table.id.desc()
9989
+ ),
9958
9990
  workspaceActivityRevision: index19("sessions_workspace_activity_revision_idx").on(
9959
9991
  table.workspaceId,
9960
9992
  table.activityRevision.desc(),
@@ -12928,6 +12960,12 @@ var newSessionDrafts = pgTable19(
12928
12960
  reasoningEffort: text19("reasoning_effort").notNull(),
12929
12961
  latencyMode: text19("latency_mode").notNull().default("standard"),
12930
12962
  sessionOptions: jsonb15("session_options").$type().notNull().default({}),
12963
+ // Project provenance is schema-owned so rolling old Drizzle binaries do
12964
+ // not select or overwrite it while updating the public draft columns.
12965
+ // A null snapshot means absent/unknown; a non-null snapshot plus a null
12966
+ // channel means explicit Default provenance.
12967
+ selectedProjectChannelId: uuid19("selected_project_channel_id"),
12968
+ selectedProjectComputeSnapshot: jsonb15("selected_project_compute_snapshot").$type(),
12931
12969
  createdAt: timestamp19("created_at", { withTimezone: true }).notNull().defaultNow(),
12932
12970
  updatedAt: timestamp19("updated_at", { withTimezone: true }).notNull().defaultNow()
12933
12971
  },
@@ -12949,6 +12987,10 @@ var newSessionDrafts = pgTable19(
12949
12987
  latencyModeValid: check11(
12950
12988
  "new_session_drafts_latency_mode_check",
12951
12989
  sql16`${table.latencyMode} in ('standard', 'priority', 'fast')`
12990
+ ),
12991
+ projectProvenanceValid: check11(
12992
+ "new_session_drafts_project_provenance_check",
12993
+ sql16`(${table.selectedProjectComputeSnapshot} is null and ${table.selectedProjectChannelId} is null) or jsonb_typeof(${table.selectedProjectComputeSnapshot}) = 'object'`
12952
12994
  )
12953
12995
  })
12954
12996
  );
@@ -13511,6 +13553,12 @@ var sessionEvents = pgTable19(
13511
13553
  table.sequence
13512
13554
  ),
13513
13555
  workspaceTurnType: index19("session_events_workspace_turn_type_idx").on(table.workspaceId, table.turnId, table.type).where(sql16`${table.turnId} is not null`),
13556
+ commandOutputPage: index19("session_events_command_output_page_idx").on(
13557
+ table.workspaceId,
13558
+ table.sessionId,
13559
+ sql16`(${table.payload} ->> 'commandId')`,
13560
+ table.sequence
13561
+ ).where(sql16`${table.type} = 'sandbox.command.output.delta'`),
13514
13562
  monitoringTail: index19("session_events_workspace_session_monitoring_tail_idx").on(table.workspaceId, table.sessionId, table.sequence).where(
13515
13563
  sql16`${table.type} not in ('agent.message.delta', 'agent.reasoning.delta', 'sandbox.command.output.delta', 'terminal.pty.output.delta')`
13516
13564
  ),
@@ -14696,6 +14744,10 @@ var sessionBackgroundCommands = pgTable19(
14696
14744
  }).notNull(),
14697
14745
  state: text19("state", { enum: ["running", "stopping", "exited", "lost"] }).notNull().default("running"),
14698
14746
  retainedProcessId: uuid19("retained_process_id"),
14747
+ // Exact launch receipt, never inferred from a later turn or session owner.
14748
+ launchTurnId: uuid19("launch_turn_id"),
14749
+ launchAttemptId: uuid19("launch_attempt_id"),
14750
+ launchExecutionGeneration: integer18("launch_execution_generation"),
14699
14751
  controlWorkspaceId: uuid19("control_workspace_id"),
14700
14752
  enrollmentId: uuid19("enrollment_id"),
14701
14753
  connectionInstanceId: text19("connection_instance_id"),
@@ -14705,8 +14757,10 @@ var sessionBackgroundCommands = pgTable19(
14705
14757
  cancelRequestedBy: text19("cancel_requested_by"),
14706
14758
  exitCode: integer18("exit_code"),
14707
14759
  settlementReason: text19("settlement_reason"),
14760
+ runnerFailure: jsonb15("runner_failure").$type(),
14708
14761
  startedAt: timestamp19("started_at", { withTimezone: true }).notNull().defaultNow(),
14709
14762
  settledAt: timestamp19("settled_at", { withTimezone: true }),
14763
+ completionObservedAt: timestamp19("completion_observed_at", { withTimezone: true }),
14710
14764
  reconcileAfter: timestamp19("reconcile_after", { withTimezone: true }).notNull().defaultNow(),
14711
14765
  reconcileClaimId: uuid19("reconcile_claim_id"),
14712
14766
  reconcileClaimedAt: timestamp19("reconcile_claimed_at", {
@@ -14730,6 +14784,20 @@ var sessionBackgroundCommands = pgTable19(
14730
14784
  columns: [table.workspaceId, table.accountId],
14731
14785
  foreignColumns: [workspaces.id, workspaces.accountId]
14732
14786
  }).onDelete("cascade"),
14787
+ runnerFailureCheck: check11(
14788
+ "session_background_commands_runner_failure_check",
14789
+ sql16`
14790
+ ${table.runnerFailure} IS NULL OR (
14791
+ ${table.provider} = 'connected_machine'
14792
+ AND jsonb_typeof(${table.runnerFailure}) = 'object'
14793
+ AND octet_length(${table.runnerFailure}::text) <= 8192
14794
+ AND ${table.runnerFailure} ?& ARRAY['code', 'retryable']
14795
+ AND jsonb_typeof(${table.runnerFailure} -> 'code') = 'string'
14796
+ AND (${table.runnerFailure} ->> 'code') ~ '^[A-Za-z0-9_-]{1,128}$'
14797
+ AND ${table.runnerFailure} -> 'retryable' = 'false'::jsonb
14798
+ AND (NOT (${table.runnerFailure} ? 'detail') OR jsonb_typeof(${table.runnerFailure} -> 'detail') = 'object')
14799
+ )`
14800
+ ),
14733
14801
  workspaceSession: foreignKey({
14734
14802
  name: "session_background_commands_session_fk",
14735
14803
  columns: [table.workspaceId, table.sessionId],
@@ -14749,6 +14817,12 @@ var sessionBackgroundCommands = pgTable19(
14749
14817
  connectedOp: uniqueIndex19("session_background_commands_connected_op_uq").on(table.controlWorkspaceId, table.enrollmentId, table.connectionInstanceId, table.opId).where(sql16`${table.provider} = 'connected_machine'`),
14750
14818
  activeSession: index19("session_background_commands_active_session_idx").on(table.workspaceId, table.sessionId, table.state, table.startedAt, table.id).where(sql16`${table.state} in ('running', 'stopping')`),
14751
14819
  stopping: index19("session_background_commands_stopping_idx").on(table.reconcileAfter, table.cancelRequestedAt, table.id).where(sql16`${table.state} in ('running', 'stopping')`),
14820
+ launchIdentityValid: check11(
14821
+ "session_background_commands_launch_identity_check",
14822
+ sql16`(${table.launchTurnId} is null and ${table.launchAttemptId} is null and ${table.launchExecutionGeneration} is null)
14823
+ or (${table.launchTurnId} is not null and ${table.launchAttemptId} is not null
14824
+ and ${table.launchExecutionGeneration} is not null and ${table.launchExecutionGeneration} > 0)`
14825
+ ),
14752
14826
  providerValid: check11(
14753
14827
  "session_background_commands_provider_check",
14754
14828
  sql16`${table.provider} in ('managed', 'connected_machine')`
@@ -14757,6 +14831,10 @@ var sessionBackgroundCommands = pgTable19(
14757
14831
  "session_background_commands_state_check",
14758
14832
  sql16`${table.state} in ('running', 'stopping', 'exited', 'lost')`
14759
14833
  ),
14834
+ observationValid: check11(
14835
+ "session_background_commands_observation_check",
14836
+ sql16`${table.completionObservedAt} is null or ${table.state} in ('exited', 'lost')`
14837
+ ),
14760
14838
  providerIdentityValid: check11(
14761
14839
  "session_background_commands_provider_identity_check",
14762
14840
  sql16`(
@@ -15462,6 +15540,7 @@ var scheduledTasks = pgTable19(
15462
15540
  table.workspaceId,
15463
15541
  table.temporalScheduleId
15464
15542
  ),
15543
+ sessionTarget: index19("scheduled_tasks_workspace_session_target_idx").on(table.workspaceId, table.reusableSessionId).where(sql16`${table.deletedAt} is null`),
15465
15544
  status: index19("scheduled_tasks_workspace_status_idx").on(table.workspaceId, table.status),
15466
15545
  variableSet: index19("scheduled_tasks_variable_set_idx").on(
15467
15546
  table.workspaceId,
@@ -17736,6 +17815,7 @@ export {
17736
17815
  LOSSLESS_CONTENT_CODEC_VERSION,
17737
17816
  LOSSLESS_CONTENT_WRITER_APPLICATION_NAME,
17738
17817
  withLosslessContentWriteVersion,
17818
+ LOSSLESS_JSON_STRING_PREFIX,
17739
17819
  LOSSLESS_TEXT_PREFIX,
17740
17820
  fromPostgresLosslessJson,
17741
17821
  toPostgresLosslessText,
@@ -17870,6 +17950,7 @@ export {
17870
17950
  managedAccounts,
17871
17951
  workspaces,
17872
17952
  workspaceArtifacts,
17953
+ workspaceArtifactUploads,
17873
17954
  workspaceArtifactVersions,
17874
17955
  workspaceArtifactEvents,
17875
17956
  nestedAgentDepthConfiguration,
@@ -18092,4 +18173,4 @@ export {
18092
18173
  organizationModelProviderCustomModels,
18093
18174
  schema_exports
18094
18175
  };
18095
- //# sourceMappingURL=chunk-QM6YOWHZ.js.map
18176
+ //# sourceMappingURL=chunk-PWJJKCTF.js.map