@opengeni/db 3.5.2-canary.0 → 3.7.3-canary.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.
Files changed (88) hide show
  1. package/dist/canonical-human-identities.js +3 -3
  2. package/dist/{chunk-PERPE2UY.js → chunk-4NAR7FBA.js} +122 -6
  3. package/dist/chunk-4NAR7FBA.js.map +1 -0
  4. package/dist/{chunk-ORKVXHL2.js → chunk-5NNCGFQY.js} +2 -2
  5. package/dist/{chunk-TRCYF26N.js → chunk-DZCYW2WT.js} +2 -2
  6. package/dist/{chunk-X6T2P3L3.js → chunk-F6PBS6WE.js} +5 -7
  7. package/dist/chunk-F6PBS6WE.js.map +1 -0
  8. package/dist/{chunk-6NYKC5DD.js → chunk-O56DM5GZ.js} +5062 -4661
  9. package/dist/chunk-O56DM5GZ.js.map +1 -0
  10. package/dist/{chunk-FJHEWYV5.js → chunk-S3TDDCS2.js} +3 -3
  11. package/dist/{chunk-Y44FKTYU.js → chunk-SZAWDXQC.js} +3 -3
  12. package/dist/{chunk-U7NKCX5E.js → chunk-U4WPPEBH.js} +2 -2
  13. package/dist/{chunk-NRGUX3M5.js → chunk-US4IS6IV.js} +2 -2
  14. package/dist/codex-token-resolver.d.ts +12 -1
  15. package/dist/company-profile-agent-admin.d.ts +4 -2
  16. package/dist/company-profile-agent-policy.d.ts +20 -0
  17. package/dist/company-profile-schema.d.ts +573 -0
  18. package/dist/editable-artifact-durable-export.js +2 -2
  19. package/dist/editable-artifacts.js +3 -3
  20. package/dist/index.d.ts +404 -20
  21. package/dist/index.js +5433 -2309
  22. package/dist/index.js.map +1 -1
  23. package/dist/managed-auth-session-sets.js +3 -3
  24. package/dist/managed-human-provisioning.d.ts +3 -3
  25. package/dist/memory-domain.d.ts +5 -3
  26. package/dist/provision-roles.js +1 -1
  27. package/dist/runtime-posture.d.ts +7 -6
  28. package/dist/schema.d.ts +732 -10
  29. package/dist/schema.js +19 -1
  30. package/dist/session-background-commands.js +3 -3
  31. package/dist/session-control.d.ts +40 -5
  32. package/dist/session-queue-commands.d.ts +2 -0
  33. package/dist/session-tenancy.js +3 -3
  34. package/dist/user-resource-authority.d.ts +8 -0
  35. package/dist/video-generation.js +3 -3
  36. package/dist/work-claims-schema.d.ts +975 -0
  37. package/dist/work-claims.d.ts +83 -0
  38. package/drizzle/0365_permission_scoped_work_claims.sql +1306 -0
  39. package/drizzle/0366_session_discovery_title_search_index.sql +5 -0
  40. package/drizzle/0367_session_discovery_goal_search_index.sql +5 -0
  41. package/drizzle/0368_session_discovery_claim_search_index.sql +6 -0
  42. package/drizzle/0369_local_human_personal_authority.sql +350 -0
  43. package/drizzle/0370_workspace_member_management_scope.sql +98 -0
  44. package/drizzle/0371_workspace_member_candidate_inventory.sql +128 -0
  45. package/drizzle/0372_ordered_variable_set_runtime_authority.sql +287 -0
  46. package/drizzle/0373_sandbox_shared_preparation.sql +59 -0
  47. package/drizzle/0374_session_event_cursors.sql +315 -0
  48. package/drizzle/0375_session_recovery_observability.sql +73 -0
  49. package/drizzle/0376_organization_workspace_inventory.sql +88 -0
  50. package/drizzle/0377_scoped_rig_health_projection.sql +80 -0
  51. package/drizzle/0378_scoped_rig_health_audit_timestamp.sql +77 -0
  52. package/drizzle/0379_session_event_raw_lane_activation.sql +518 -0
  53. package/drizzle/0380_autonomous_company_profile_agent_policy.sql +829 -0
  54. package/drizzle/0381_organization_codex_subscription_inheritance.sql +720 -0
  55. package/drizzle/0382_organization_api_key_provenance.sql +91 -0
  56. package/drizzle/0383_codex_cooldown_reconciliation.sql +51 -0
  57. package/drizzle/0384_codex_cooldown_revision_guard_privileges.sql +6 -0
  58. package/drizzle/0385_connected_machine_legacy_tilde_workdirs.sql +25 -0
  59. package/drizzle/0386_local_organization_administration.sql +157 -0
  60. package/package.json +6 -6
  61. package/src/codex-token-resolver.ts +26 -1
  62. package/src/company-brain-governed-writes.ts +30 -1
  63. package/src/company-profile-agent-admin.ts +68 -1
  64. package/src/company-profile-agent-policy.ts +126 -0
  65. package/src/company-profile-schema.ts +115 -1
  66. package/src/database.ts +3 -5
  67. package/src/index.ts +4677 -786
  68. package/src/managed-human-provisioning.ts +3 -3
  69. package/src/memory-domain.ts +9 -4
  70. package/src/organization-membership-lifecycle.ts +0 -1
  71. package/src/provision-roles.ts +101 -4
  72. package/src/runtime-posture.ts +34 -0
  73. package/src/schema.ts +162 -8
  74. package/src/session-control.ts +177 -59
  75. package/src/session-queue-commands.ts +146 -40
  76. package/src/session-tool-call-settlement.ts +34 -7
  77. package/src/user-resource-authority.ts +56 -0
  78. package/src/work-claims-schema.ts +148 -0
  79. package/src/work-claims.ts +200 -0
  80. package/dist/chunk-6NYKC5DD.js.map +0 -1
  81. package/dist/chunk-PERPE2UY.js.map +0 -1
  82. package/dist/chunk-X6T2P3L3.js.map +0 -1
  83. /package/dist/{chunk-ORKVXHL2.js.map → chunk-5NNCGFQY.js.map} +0 -0
  84. /package/dist/{chunk-TRCYF26N.js.map → chunk-DZCYW2WT.js.map} +0 -0
  85. /package/dist/{chunk-FJHEWYV5.js.map → chunk-S3TDDCS2.js.map} +0 -0
  86. /package/dist/{chunk-Y44FKTYU.js.map → chunk-SZAWDXQC.js.map} +0 -0
  87. /package/dist/{chunk-U7NKCX5E.js.map → chunk-U4WPPEBH.js.map} +0 -0
  88. /package/dist/{chunk-NRGUX3M5.js.map → chunk-US4IS6IV.js.map} +0 -0
package/dist/schema.js CHANGED
@@ -46,6 +46,7 @@ import {
46
46
  companyBrainContextSelectionReceipts,
47
47
  companyBrainTurnContextSnapshots,
48
48
  companyProfileActivationEvents,
49
+ companyProfileAgentAutomaticActivationReceipts,
49
50
  companyProfileAgentConfirmationReceipts,
50
51
  companyProfileAgentProposalReceipts,
51
52
  companyProfileHeads,
@@ -160,6 +161,9 @@ import {
160
161
  nestedAgentDepthConfiguration,
161
162
  networkRoutes,
162
163
  newSessionDrafts,
164
+ organizationCodexRotationSettings,
165
+ organizationCompanyProfileAgentPolicies,
166
+ organizationCompanyProfileAgentPolicyEvents,
163
167
  organizationInvitationBindingEvents,
164
168
  organizationMembershipInvitations,
165
169
  organizationMembershipLifecycleEvents,
@@ -224,6 +228,7 @@ import {
224
228
  sessionAttemptToolCatalogs,
225
229
  sessionBackgroundCommands,
226
230
  sessionCommandReceipts,
231
+ sessionEventCursors,
227
232
  sessionEvents,
228
233
  sessionGoalRevisions,
229
234
  sessionGoals,
@@ -249,6 +254,9 @@ import {
249
254
  sessionTurnStartupMilestones,
250
255
  sessionTurns,
251
256
  sessionVariableSetAttachments,
257
+ sessionWorkClaimRevisions,
258
+ sessionWorkClaimWriteCapabilities,
259
+ sessionWorkClaims,
252
260
  sessionWorkflowWakeOutbox,
253
261
  sessions,
254
262
  siteAuthConnections,
@@ -300,6 +308,7 @@ import {
300
308
  workspaceArtifactVersions,
301
309
  workspaceArtifacts,
302
310
  workspaceCaptures,
311
+ workspaceCodexSubscriptionPreferences,
303
312
  workspaceControlEvents,
304
313
  workspaceInferenceControls,
305
314
  workspaceInstructionPolicyActivationEvents,
@@ -328,7 +337,7 @@ import {
328
337
  xaiRotationSettings,
329
338
  xaiSessionAccountPins,
330
339
  xaiSubscriptionCredentials
331
- } from "./chunk-6NYKC5DD.js";
340
+ } from "./chunk-O56DM5GZ.js";
332
341
  import "./chunk-PZ5AY32C.js";
333
342
  export {
334
343
  agentRunStates,
@@ -378,6 +387,7 @@ export {
378
387
  companyBrainContextSelectionReceipts,
379
388
  companyBrainTurnContextSnapshots,
380
389
  companyProfileActivationEvents,
390
+ companyProfileAgentAutomaticActivationReceipts,
381
391
  companyProfileAgentConfirmationReceipts,
382
392
  companyProfileAgentProposalReceipts,
383
393
  companyProfileHeads,
@@ -492,6 +502,9 @@ export {
492
502
  nestedAgentDepthConfiguration,
493
503
  networkRoutes,
494
504
  newSessionDrafts,
505
+ organizationCodexRotationSettings,
506
+ organizationCompanyProfileAgentPolicies,
507
+ organizationCompanyProfileAgentPolicyEvents,
495
508
  organizationInvitationBindingEvents,
496
509
  organizationMembershipInvitations,
497
510
  organizationMembershipLifecycleEvents,
@@ -556,6 +569,7 @@ export {
556
569
  sessionAttemptToolCatalogs,
557
570
  sessionBackgroundCommands,
558
571
  sessionCommandReceipts,
572
+ sessionEventCursors,
559
573
  sessionEvents,
560
574
  sessionGoalRevisions,
561
575
  sessionGoals,
@@ -581,6 +595,9 @@ export {
581
595
  sessionTurnStartupMilestones,
582
596
  sessionTurns,
583
597
  sessionVariableSetAttachments,
598
+ sessionWorkClaimRevisions,
599
+ sessionWorkClaimWriteCapabilities,
600
+ sessionWorkClaims,
584
601
  sessionWorkflowWakeOutbox,
585
602
  sessions,
586
603
  siteAuthConnections,
@@ -632,6 +649,7 @@ export {
632
649
  workspaceArtifactVersions,
633
650
  workspaceArtifacts,
634
651
  workspaceCaptures,
652
+ workspaceCodexSubscriptionPreferences,
635
653
  workspaceControlEvents,
636
654
  workspaceInferenceControls,
637
655
  workspaceInstructionPolicyActivationEvents,
@@ -12,9 +12,9 @@ import {
12
12
  settleClaimedConnectedMachineBackgroundCommand,
13
13
  settleConnectedMachineSessionBackgroundCommand,
14
14
  settleSessionBackgroundCommandForRetainedProcess
15
- } from "./chunk-FJHEWYV5.js";
16
- import "./chunk-X6T2P3L3.js";
17
- import "./chunk-6NYKC5DD.js";
15
+ } from "./chunk-S3TDDCS2.js";
16
+ import "./chunk-F6PBS6WE.js";
17
+ import "./chunk-O56DM5GZ.js";
18
18
  import "./chunk-PZ5AY32C.js";
19
19
  export {
20
20
  backgroundCommandActivityForSessions,
@@ -60,6 +60,17 @@ export type EffectiveSessionControl = {
60
60
  commandCount: number;
61
61
  } | null;
62
62
  };
63
+ /**
64
+ * The bounded control projection required by a locked activity-write fence.
65
+ * Settlement and background-command summaries are read-model concerns and must
66
+ * not extend the session-event critical section when admission only needs the
67
+ * effective run state and blocker scope.
68
+ */
69
+ export type SessionWriteAdmissionControl = {
70
+ state: EffectiveControlState;
71
+ controlVersion: number;
72
+ primaryBlockerKind: EffectiveControlBlocker["kind"] | null;
73
+ };
63
74
  export declare const SESSION_DISCOVERY_CONTROL_TITLE_MAX_CHARS = 200;
64
75
  export declare const SESSION_DISCOVERY_CONTROL_TARGET_LIMIT = 100;
65
76
  /**
@@ -272,6 +283,13 @@ export type SessionEventWriteLockInput = {
272
283
  controlLock: WorkspaceControlLockMode | "already_locked" | "none";
273
284
  /** Used only when a staged caller already established the workspace prefix. */
274
285
  workspaceLock?: "key_share" | "already_locked";
286
+ /**
287
+ * Semantic writers retain FOR NO KEY UPDATE. Cursor-authoritative raw-only
288
+ * appends need only the FK-compatible identity hold; KEY SHARE is compatible
289
+ * with semantic NO KEY UPDATE and therefore removes the wide session row as
290
+ * their serialization mutex without inverting the rolling lock order.
291
+ */
292
+ sessionLock?: "no_key_update" | "key_share";
275
293
  sessionIds?: string[];
276
294
  turnIds?: string[];
277
295
  attemptIds?: string[];
@@ -280,6 +298,7 @@ export type SessionEventWriteLocks = {
280
298
  control: WorkspaceControlRow | null;
281
299
  workspace: typeof schema.workspaces.$inferSelect | null;
282
300
  sessions: Array<typeof schema.sessions.$inferSelect>;
301
+ cursors: Array<typeof schema.sessionEventCursors.$inferSelect>;
283
302
  turns: Array<typeof schema.sessionTurns.$inferSelect>;
284
303
  attempts: Array<typeof schema.sessionTurnAttempts.$inferSelect>;
285
304
  };
@@ -289,7 +308,8 @@ export type SessionEventWriteLocks = {
289
308
  * workspace-control advisory lock + workspace_inference_controls row
290
309
  * (when control-aware; see `lockWorkspaceInferenceControl`)
291
310
  * -> actual workspaces row FOR KEY SHARE
292
- * -> session rows FOR NO KEY UPDATE, UUID ordered
311
+ * -> session rows FOR NO KEY UPDATE (semantic) or KEY SHARE (raw), UUID ordered
312
+ * -> session event cursor rows FOR UPDATE, UUID ordered
293
313
  * -> exact turn rows FOR UPDATE, UUID ordered
294
314
  * -> exact attempt rows FOR UPDATE, UUID ordered
295
315
  *
@@ -304,10 +324,12 @@ export type SessionEventWriteLocks = {
304
324
  * `FOR UPDATE` lock serialized unrelated sessions and inverted the activity
305
325
  * path's session -> implicit workspace-FK edge.
306
326
  *
307
- * `FOR NO KEY UPDATE` is equally deliberate for sessions. Session primary and
308
- * composite identity keys are immutable, so writers need to exclude only concurrent
309
- * non-key mutation. Keeping FK `FOR KEY SHARE` checks compatible prevents the
310
- * activity finalizer's workspace counter from participating in a lock cycle.
327
+ * `FOR NO KEY UPDATE` is equally deliberate for semantic session writers.
328
+ * Cursor-authoritative raw-only writers use `FOR KEY SHARE`: it preserves the
329
+ * session identity against deletion while remaining compatible with semantic
330
+ * `FOR NO KEY UPDATE`. Keeping this rolling session-before-cursor order avoids
331
+ * an inversion with old binaries and quiescent cascade deletion; the compact
332
+ * cursor row, not the wide session row, is the raw ordering mutex.
311
333
  *
312
334
  * Complex lifecycle transactions may acquire allocator/control locks before
313
335
  * this helper and may discover exact turn IDs only after locking the session.
@@ -379,6 +401,19 @@ export declare function evaluateSessionControls(db: Database, workspaceId: strin
379
401
  /** Reuse a control row already locked before workspace/session/turn rows. */
380
402
  workspaceControl?: WorkspaceControlRow | undefined;
381
403
  }): Promise<Map<string, EffectiveSessionControl>>;
404
+ /**
405
+ * Evaluate only the control facts needed to admit an already locked session
406
+ * write. The workspace-control row must be reused when the caller established
407
+ * the canonical prefix before session/turn/attempt locks.
408
+ *
409
+ * Deliberately omit settlementAttemptCounts and
410
+ * stoppingBackgroundCommandCounts: those recursive summaries do not affect
411
+ * effective pause state and their results are discarded by the write fence.
412
+ */
413
+ export declare function evaluateSessionWriteAdmissionControl(db: Database, workspaceId: string, sessionId: string, options?: {
414
+ lock?: WorkspaceControlLockMode;
415
+ workspaceControl?: WorkspaceControlRow | undefined;
416
+ }): Promise<SessionWriteAdmissionControl>;
382
417
  /**
383
418
  * Return one compact aggregate row per target for `sessions_list`.
384
419
  *
@@ -67,8 +67,10 @@ export type AgentInternalUpdateCommandResult = {
67
67
  };
68
68
  type SteerSupersessionResult = {
69
69
  interruptionCount: number;
70
+ steerTargetTurn: typeof schema.sessionTurns.$inferSelect | null;
70
71
  replacedTurn: typeof schema.sessionTurns.$inferSelect | null;
71
72
  liveCurrentTurnId: string | null;
73
+ deferredUntilCompaction: boolean;
72
74
  lastSequence: number;
73
75
  };
74
76
  /**
@@ -14,9 +14,9 @@ import {
14
14
  replayAppliedSessionFork,
15
15
  sessionTenancyProductActivated,
16
16
  transitionSessionVisibility
17
- } from "./chunk-ORKVXHL2.js";
18
- import "./chunk-X6T2P3L3.js";
19
- import "./chunk-6NYKC5DD.js";
17
+ } from "./chunk-5NNCGFQY.js";
18
+ import "./chunk-F6PBS6WE.js";
19
+ import "./chunk-O56DM5GZ.js";
20
20
  import "./chunk-PZ5AY32C.js";
21
21
  export {
22
22
  SessionTenancyAccessError,
@@ -71,6 +71,14 @@ export declare function issueSelfUserResourceGrant(db: Database, input: {
71
71
  expectedAuthorityEpoch?: number | null;
72
72
  workspaceSharedAcknowledged: boolean;
73
73
  }): Promise<UserResourceAuthorityGrant>;
74
+ export declare function issueSelfLocalConnectionUseGrant(db: Database, input: {
75
+ accountId: string;
76
+ workspaceId: string;
77
+ subjectId: string;
78
+ authorityId: string;
79
+ context: "user_private" | "workspace_shared";
80
+ workspaceSharedAcknowledged: boolean;
81
+ }): Promise<UserResourceAuthorityGrant>;
74
82
  export declare function revokeSelfUserResourceGrant(db: Database, input: {
75
83
  accountId: string;
76
84
  workspaceId: string;
@@ -29,9 +29,9 @@ import {
29
29
  settleVideoGenerationFailure,
30
30
  settleVideoGenerationReady,
31
31
  updateWorkspaceVideoGenerationPolicy
32
- } from "./chunk-Y44FKTYU.js";
33
- import "./chunk-X6T2P3L3.js";
34
- import "./chunk-6NYKC5DD.js";
32
+ } from "./chunk-SZAWDXQC.js";
33
+ import "./chunk-F6PBS6WE.js";
34
+ import "./chunk-O56DM5GZ.js";
35
35
  import "./chunk-PZ5AY32C.js";
36
36
  export {
37
37
  ACTIVE_VIDEO_GENERATION_STATUSES,