@opengeni/contracts 0.21.0 → 0.23.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/index.js CHANGED
@@ -2638,6 +2638,60 @@ var DEFAULT_FIRST_PARTY_MCP_PERMISSIONS = [
2638
2638
  "rigs:use",
2639
2639
  "github:use"
2640
2640
  ];
2641
+ var FIRST_PARTY_MCP_TOOL_NAMES = [
2642
+ "set_session_title",
2643
+ "goal_set",
2644
+ "goal_update",
2645
+ "goal_complete",
2646
+ "goal_pause",
2647
+ "memory_search",
2648
+ "memory_save",
2649
+ "memory_correct",
2650
+ "sandboxes_list",
2651
+ "sandbox_attach",
2652
+ "sandbox_swap",
2653
+ "run_on",
2654
+ "sandbox_provision",
2655
+ "rig_list",
2656
+ "rig_get",
2657
+ "rig_propose_change",
2658
+ "rig_verify",
2659
+ "rig_promote",
2660
+ "sessions_list",
2661
+ "session_get",
2662
+ "session_events",
2663
+ "session_create",
2664
+ "session_send_message",
2665
+ "session_pause",
2666
+ "session_resume",
2667
+ "session_steer",
2668
+ "set_other_session_title",
2669
+ "variable_set_list",
2670
+ "environment_list",
2671
+ "variable_set_set_variable",
2672
+ "environment_set_variable",
2673
+ "github_connect_link",
2674
+ "github_token",
2675
+ "github_repositories_list",
2676
+ "social_connections_list",
2677
+ "social_posts_recent",
2678
+ "social_daily_analysis_context",
2679
+ "scheduled_tasks_list",
2680
+ "scheduled_tasks_get",
2681
+ "scheduled_tasks_create",
2682
+ "scheduled_tasks_update",
2683
+ "scheduled_tasks_pause",
2684
+ "scheduled_tasks_resume",
2685
+ "scheduled_tasks_trigger",
2686
+ "scheduled_tasks_delete",
2687
+ "scheduled_task_runs_list",
2688
+ "slack_bot_list_channels",
2689
+ "slack_bot_channel_history",
2690
+ "slack_bot_list_users",
2691
+ "slack_bot_post_message"
2692
+ ];
2693
+ var FirstPartyMcpToolName = z3.enum(FIRST_PARTY_MCP_TOOL_NAMES);
2694
+ var DEFAULT_FIRST_PARTY_MCP_TOOLS = FIRST_PARTY_MCP_TOOL_NAMES;
2641
2695
  function prefixedMcpToolName(registryId2, toolName) {
2642
2696
  return `${registryId2}__${toolName}`;
2643
2697
  }
@@ -3021,6 +3075,9 @@ var DelegatedAccessTokenPayload = z3.object({
3021
3075
  // Worker-asserted session scope for first-party MCP calls (HMAC-signed, not
3022
3076
  // agent-controlled); enables session-scoped tools such as goal management.
3023
3077
  sessionId: z3.string().uuid().optional(),
3078
+ // Model-visible first-party tool selection for a worker-bound session.
3079
+ // This is visibility only; permissions remain the authorization boundary.
3080
+ firstPartyMcpTools: z3.array(FirstPartyMcpToolName).optional(),
3024
3081
  // The turn making the call (the caller's identity), HMAC-signed by the worker
3025
3082
  // at turn setup. Lets a tool classify WHO is calling from the token itself,
3026
3083
  // instead of racily re-reading the session's live active_turn_id — e.g. the
@@ -3863,7 +3920,7 @@ var ToolRef = z3.object({
3863
3920
  var registryId = /^[A-Za-z0-9_-]+$/;
3864
3921
  var SessionMcpServerId = z3.string().min(1).regex(registryId);
3865
3922
  var SessionToolPolicy = z3.object({
3866
- mode: z3.enum(["workspace_default", "explicit", "inherited", "legacy"]),
3923
+ mode: z3.enum(["workspace_default", "explicit", "inherited"]),
3867
3924
  inheritedFromSessionId: z3.string().uuid().nullable()
3868
3925
  });
3869
3926
  var SESSION_EFFECTIVE_TOOL_POLICY_ID_LIMIT = 64;
@@ -3871,7 +3928,7 @@ var SESSION_EFFECTIVE_TOOL_POLICY_ID_MAX_LENGTH = 200;
3871
3928
  var SessionEffectiveToolPolicyId = z3.string().min(1).max(SESSION_EFFECTIVE_TOOL_POLICY_ID_MAX_LENGTH).regex(registryId);
3872
3929
  var SessionEffectiveToolPolicyIds = z3.array(SessionEffectiveToolPolicyId).max(SESSION_EFFECTIVE_TOOL_POLICY_ID_LIMIT);
3873
3930
  var SessionEffectiveToolPolicy = z3.object({
3874
- mode: z3.enum(["workspace_default", "explicit", "inherited", "legacy"]),
3931
+ mode: z3.enum(["workspace_default", "explicit", "inherited"]),
3875
3932
  inheritedFromSessionId: z3.string().uuid().nullable(),
3876
3933
  selectedIds: SessionEffectiveToolPolicyIds,
3877
3934
  effectiveIds: SessionEffectiveToolPolicyIds,
@@ -4153,8 +4210,9 @@ var UpdateSessionToolPolicyRequest = z3.union([
4153
4210
  expectedVersion: z3.number().int().positive()
4154
4211
  }).strict(),
4155
4212
  z3.object({
4156
- mode: z3.literal("explicit").optional(),
4213
+ mode: z3.literal("explicit"),
4157
4214
  tools: z3.array(ToolRef).max(64),
4215
+ firstPartyMcpTools: z3.array(FirstPartyMcpToolName),
4158
4216
  expectedVersion: z3.number().int().positive()
4159
4217
  }).strict()
4160
4218
  ]);
@@ -4377,29 +4435,12 @@ var ComposerDraft = z3.object({
4377
4435
  revision: z3.number().int().nonnegative(),
4378
4436
  text: z3.string(),
4379
4437
  resources: z3.array(ResourceRef),
4380
- tools: z3.array(ToolRef),
4381
- // False means the draft inherits the session policy. True preserves an
4382
- // explicit array, including [], across autosave/reload and queue checkout.
4383
- toolsProvided: z3.boolean().default(false),
4384
4438
  model: z3.string().min(1),
4385
4439
  reasoningEffort: ReasoningEffort,
4386
4440
  sourceTurnId: z3.string().uuid().nullable(),
4387
4441
  sourceTurnVersion: z3.number().int().positive().nullable(),
4388
4442
  updatedAt: z3.string().nullable()
4389
4443
  });
4390
- var SessionQueueSnapshot = z3.object({
4391
- version: z3.number().int().nonnegative(),
4392
- effectiveControl: EffectiveSessionControl,
4393
- /**
4394
- * True while the latest attempt is interrupted but has not durably proved
4395
- * quiescence: no more inference, user-visible output, or workspace-persistence
4396
- * authority. Temporal cancellation/terminalization is not that proof. This is
4397
- * distinct from ordinary capacity queueing, remains accurate with an empty
4398
- * visible queue, and is independent of Steer-row metadata or withdrawal.
4399
- */
4400
- stoppingPreviousAttempt: z3.boolean(),
4401
- items: z3.array(SessionTurn)
4402
- });
4403
4444
  var MoveSessionQueueItemRequest = z3.object({
4404
4445
  clientEventId: SessionOperationKey,
4405
4446
  expectedQueueVersion: z3.number().int().nonnegative(),
@@ -4424,8 +4465,6 @@ var DeleteSessionQueueItemRequest = z3.object({
4424
4465
  var SaveComposerDraftRequest = ComposerDraft.pick({
4425
4466
  text: true,
4426
4467
  resources: true,
4427
- tools: true,
4428
- toolsProvided: true,
4429
4468
  model: true,
4430
4469
  reasoningEffort: true
4431
4470
  }).extend({ expectedRevision: z3.number().int().nonnegative() });
@@ -4436,7 +4475,8 @@ var NewSessionDraftOptions = z3.object({
4436
4475
  variableSetId: z3.string().uuid().optional(),
4437
4476
  rigId: z3.string().uuid().optional(),
4438
4477
  goal: GoalSpec.optional(),
4439
- firstPartyMcpPermissions: z3.array(Permission).optional()
4478
+ firstPartyMcpPermissions: z3.array(Permission).optional(),
4479
+ firstPartyMcpTools: z3.array(FirstPartyMcpToolName).optional()
4440
4480
  });
4441
4481
  var NewSessionDraft = z3.object({
4442
4482
  revision: z3.number().int().nonnegative(),
@@ -4658,7 +4698,6 @@ var SessionSystemUpdatePayload = z3.discriminatedUnion("type", [
4658
4698
  ]);
4659
4699
  var SessionSystemUpdateState = z3.enum([
4660
4700
  "pending",
4661
- "deferred",
4662
4701
  "delivered",
4663
4702
  "cancelled",
4664
4703
  "superseded",
@@ -4676,9 +4715,75 @@ var SessionSystemUpdate = z3.object({
4676
4715
  lineage: z3.record(z3.string(), z3.unknown()),
4677
4716
  state: SessionSystemUpdateState,
4678
4717
  deliveredTurnId: z3.string().uuid().nullable(),
4718
+ /**
4719
+ * The exact durable model-memory row containing the coalesced batch that
4720
+ * delivered this update. Null until claim; every member of one batch shares
4721
+ * the same id.
4722
+ */
4723
+ deliveredHistoryItemId: z3.string().uuid().nullable(),
4679
4724
  deliveredAt: z3.string().nullable(),
4680
4725
  createdAt: z3.string()
4681
4726
  });
4727
+ var SessionPendingInputPreview = SessionSystemUpdate.pick({
4728
+ id: true,
4729
+ sessionId: true,
4730
+ kind: true,
4731
+ classification: true,
4732
+ sourceId: true,
4733
+ summary: true,
4734
+ createdAt: true
4735
+ });
4736
+ var SessionQueueSnapshot = z3.object({
4737
+ version: z3.number().int().nonnegative(),
4738
+ effectiveControl: EffectiveSessionControl,
4739
+ /**
4740
+ * True while the latest attempt is interrupted but has not durably proved
4741
+ * quiescence: no more inference, user-visible output, or workspace-persistence
4742
+ * authority. Temporal cancellation/terminalization is not that proof. This is
4743
+ * distinct from ordinary capacity queueing, remains accurate with an empty
4744
+ * visible queue, and is independent of Steer-row metadata or withdrawal.
4745
+ */
4746
+ stoppingPreviousAttempt: z3.boolean(),
4747
+ items: z3.array(SessionTurn),
4748
+ /** Canonical bounded previews; never reconstructed from session events. */
4749
+ pendingInputs: z3.array(SessionPendingInputPreview),
4750
+ /**
4751
+ * Exact members of the next bounded machine-input batch that will join an
4752
+ * already-waiting human/API prompt. Null means the next machine-input claim
4753
+ * is standalone. This is a projection of canonical rows, not queue state.
4754
+ */
4755
+ pendingInputAttachment: z3.object({
4756
+ turnId: z3.string().uuid(),
4757
+ inputIds: z3.array(z3.string().uuid()).min(1)
4758
+ }).nullable()
4759
+ });
4760
+ function renderSessionSystemUpdateBatch(updates) {
4761
+ if (updates.length === 0) {
4762
+ throw new TypeError("A durable machine-input batch requires at least one update");
4763
+ }
4764
+ return [
4765
+ "[OpenGeni internal updates]",
4766
+ "These platform updates were delivered together for this inference. They are not human prompts.",
4767
+ JSON.stringify({
4768
+ updates: updates.map((update) => ({
4769
+ id: update.id,
4770
+ kind: update.kind,
4771
+ classification: update.classification,
4772
+ sourceId: update.sourceId,
4773
+ summary: update.summary,
4774
+ payload: update.payload,
4775
+ lineage: update.lineage
4776
+ }))
4777
+ })
4778
+ ].join("\n");
4779
+ }
4780
+ function sessionSystemUpdateBatchHistoryItem(updates) {
4781
+ return {
4782
+ type: "message",
4783
+ role: "system",
4784
+ content: renderSessionSystemUpdateBatch(updates)
4785
+ };
4786
+ }
4682
4787
  var VariableSetVariableName = z3.string().regex(/^[A-Z][A-Z0-9_]*$/).max(128);
4683
4788
  function withVariableSetIdAlias(shape) {
4684
4789
  return z3.preprocess((input) => {
@@ -5462,13 +5567,9 @@ var Session = z3.object({
5462
5567
  resources: z3.array(ResourceRef),
5463
5568
  skills: SessionSkills.default([]),
5464
5569
  tools: z3.array(ToolRef),
5465
- // Origin of the persisted tool allow-list. Optional for rolling client
5466
- // compatibility; current servers emit it and legacy rows map to `legacy`.
5467
- toolPolicy: SessionToolPolicy.optional(),
5468
- // Optimistic-concurrency fence for durable policy mutations. Optional for
5469
- // older clients/fixtures; current servers always emit the authoritative
5470
- // value.
5471
- toolPolicyVersion: z3.number().int().positive().optional(),
5570
+ // Origin and optimistic-concurrency fence for the durable session policy.
5571
+ toolPolicy: SessionToolPolicy,
5572
+ toolPolicyVersion: z3.number().int().positive(),
5472
5573
  // Secret-safe current resolution, computed at an API/read or execution
5473
5574
  // boundary from IDs only. Optional because internal DB readers need not load
5474
5575
  // the workspace runtime registry.
@@ -5505,6 +5606,9 @@ var Session = z3.object({
5505
5606
  // Non-default first-party MCP token permissions (manager-style sessions);
5506
5607
  // null means the fixed worker default set.
5507
5608
  firstPartyMcpPermissions: z3.array(Permission).nullable(),
5609
+ // Exact model-visible OpenGeni selection. All catalogued tools are selected
5610
+ // by default; [] intentionally selects none.
5611
+ firstPartyMcpTools: z3.array(FirstPartyMcpToolName),
5508
5612
  // Per-session third-party MCP servers, metadata only. Credential values are
5509
5613
  // write-only and never appear here.
5510
5614
  mcpServers: z3.array(SessionMcpServerMetadata).default([]),
@@ -5644,6 +5748,9 @@ var SessionEventType = z3.enum([
5644
5748
  "goal.continuation",
5645
5749
  "system.update.pending",
5646
5750
  "system.update.delivered",
5751
+ "system.update.superseded",
5752
+ "system.update.cancelled",
5753
+ "system.update.settled",
5647
5754
  "session.control.paused",
5648
5755
  "session.control.resumed",
5649
5756
  "session.control.steer_requested",
@@ -5832,6 +5939,9 @@ var SESSION_EVENT_SEMANTIC_CLASS_TYPES = {
5832
5939
  "goal.continuation",
5833
5940
  "system.update.pending",
5834
5941
  "system.update.delivered",
5942
+ "system.update.superseded",
5943
+ "system.update.cancelled",
5944
+ "system.update.settled",
5835
5945
  "session.control.paused",
5836
5946
  "session.control.resumed",
5837
5947
  "session.control.steer_requested",
@@ -7194,6 +7304,10 @@ var CreateSessionRequest = withVariableSetIdAlias({
7194
7304
  // A goal-bearing session whose explicit/effective set omits goals:manage is
7195
7305
  // rejected; creation never silently expands a child beyond that set.
7196
7306
  firstPartyMcpPermissions: z3.array(Permission).optional(),
7307
+ // Exact model-visible selection from the broad first-party OpenGeni MCP
7308
+ // catalog. Omission selects the full catalog; [] intentionally exposes none.
7309
+ // This does not grant authority: every registered tool is permission-gated.
7310
+ firstPartyMcpTools: z3.array(FirstPartyMcpToolName).optional(),
7197
7311
  // Third-party MCP servers attached only to this session. For an agent-created
7198
7312
  // child, omission snapshots its trusted immediate parent's server definitions,
7199
7313
  // policies, connection refs, and encrypted credentials. Explicit arrays,
@@ -7357,7 +7471,6 @@ var ClientSessionEvent = z3.discriminatedUnion("type", [
7357
7471
  // turn for retry/recovery, never copied into the visible user message.
7358
7472
  turnInstructions: z3.string().trim().min(1).max(32768).optional(),
7359
7473
  resources: z3.array(ResourceRef).default([]),
7360
- tools: z3.array(ToolRef).default([]),
7361
7474
  model: z3.string().min(1).optional(),
7362
7475
  reasoningEffort: ReasoningEffort.optional(),
7363
7476
  controlEtag: z3.string().min(1).optional(),
@@ -7365,7 +7478,7 @@ var ClientSessionEvent = z3.discriminatedUnion("type", [
7365
7478
  // Header-value rotation only. URL/name/tool settings are immutable after
7366
7479
  // session create; persisted events expose metadata, never header values.
7367
7480
  mcpCredentialUpdates: z3.array(SessionMcpCredentialUpdateInput).optional()
7368
- })
7481
+ }).strict()
7369
7482
  }),
7370
7483
  z3.object({
7371
7484
  type: z3.literal("user.approvalDecision"),
@@ -7390,14 +7503,13 @@ var SteerSessionMessageRequest = z3.object({
7390
7503
  // Same per-turn system-level context as a queued user.message.
7391
7504
  turnInstructions: z3.string().trim().min(1).max(32768).optional(),
7392
7505
  resources: z3.array(ResourceRef).default([]),
7393
- tools: z3.array(ToolRef).default([]),
7394
7506
  model: z3.string().min(1).optional(),
7395
7507
  reasoningEffort: ReasoningEffort.optional(),
7396
7508
  clientEventId: SessionOperationKey.optional(),
7397
7509
  controlEtag: z3.string().min(1).optional(),
7398
7510
  expectedDraftRevision: z3.number().int().nonnegative().optional(),
7399
7511
  mcpCredentialUpdates: z3.array(SessionMcpCredentialUpdateInput).optional()
7400
- });
7512
+ }).strict();
7401
7513
  var SteerSessionMessageResponse = z3.object({
7402
7514
  accepted: SessionEvent,
7403
7515
  turn: SessionTurn
@@ -7427,6 +7539,7 @@ var GitHubRepository = z3.object({
7427
7539
  });
7428
7540
  var GitHubRepositoryScope = z3.enum(["all", "selected"]);
7429
7541
  var GitHubBindingStatus = z3.enum(["disabled", "unbound", "bound"]);
7542
+ var GitHubAppSetupMode = z3.enum(["platform", "operator"]);
7430
7543
  var GitHubInstallationLifecycle = z3.enum(["active", "suspended", "deleted", "unverified"]);
7431
7544
  var GitHubInstallationBinding = z3.object({
7432
7545
  installationId: z3.number().int().positive(),
@@ -7436,12 +7549,14 @@ var GitHubInstallationBinding = z3.object({
7436
7549
  lifecycle: GitHubInstallationLifecycle,
7437
7550
  repositoryScope: GitHubRepositoryScope,
7438
7551
  repositoryCount: z3.number().int().nonnegative(),
7552
+ configureUrl: z3.string().url().nullable(),
7439
7553
  createdAt: z3.string(),
7440
7554
  updatedAt: z3.string()
7441
7555
  });
7442
7556
  var GitHubAppInfo = z3.object({
7443
7557
  configured: z3.boolean(),
7444
7558
  status: GitHubBindingStatus,
7559
+ setupMode: GitHubAppSetupMode,
7445
7560
  appId: z3.string().nullable(),
7446
7561
  clientId: z3.string().nullable(),
7447
7562
  appSlug: z3.string().nullable(),
@@ -8263,6 +8378,7 @@ export {
8263
8378
  CredentialAuthNeededPayload,
8264
8379
  DEFAULT_CODEX_FLEET_POLICY_V1,
8265
8380
  DEFAULT_FIRST_PARTY_MCP_PERMISSIONS,
8381
+ DEFAULT_FIRST_PARTY_MCP_TOOLS,
8266
8382
  DESKTOP_STREAM_PORT,
8267
8383
  DelegatedAccessTokenPayload,
8268
8384
  DeleteSessionQueueItemRequest,
@@ -8308,11 +8424,13 @@ export {
8308
8424
  EntitlementsMode,
8309
8425
  ErrorCode,
8310
8426
  ErrorEnvelope,
8427
+ FIRST_PARTY_MCP_TOOL_NAMES,
8311
8428
  FileAsset,
8312
8429
  FileDownloadUrlResponse,
8313
8430
  FileResourceRef,
8314
8431
  FileStatus,
8315
8432
  FileUploadStatus,
8433
+ FirstPartyMcpToolName,
8316
8434
  FsChangeKind,
8317
8435
  FsChangedPayload,
8318
8436
  FsDeleteRequest,
@@ -8347,6 +8465,7 @@ export {
8347
8465
  GitFileStatusCode,
8348
8466
  GitHubAppInfo,
8349
8467
  GitHubAppManifestCreate,
8468
+ GitHubAppSetupMode,
8350
8469
  GitHubBindingStatus,
8351
8470
  GitHubInstallationBinding,
8352
8471
  GitHubInstallationLifecycle,
@@ -8551,6 +8670,7 @@ export {
8551
8670
  SessionMcpServerId,
8552
8671
  SessionMcpServerInput,
8553
8672
  SessionMcpServerMetadata,
8673
+ SessionPendingInputPreview,
8554
8674
  SessionQueueMutationResponse,
8555
8675
  SessionQueueSnapshot,
8556
8676
  SessionSkill,
@@ -8722,6 +8842,7 @@ export {
8722
8842
  redactSensitiveKey,
8723
8843
  redactSensitiveText,
8724
8844
  redactSerializedJson,
8845
+ renderSessionSystemUpdateBatch,
8725
8846
  replayCodexFleetDecisionV1,
8726
8847
  resolveRetainedOutputRange,
8727
8848
  resolveSessionEventTypeFilters,
@@ -8736,6 +8857,7 @@ export {
8736
8857
  sessionEventMediaPreview,
8737
8858
  sessionEventMediaPreviewFromDataUrl,
8738
8859
  sessionEventPayloadTruncation,
8860
+ sessionSystemUpdateBatchHistoryItem,
8739
8861
  signDelegatedAccessToken,
8740
8862
  signEnrollToken,
8741
8863
  signEnrollmentBearer,