@opengeni/contracts 0.21.0 → 0.22.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,66 @@ 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 = [
2695
+ "set_session_title",
2696
+ "goal_set",
2697
+ "goal_update",
2698
+ "goal_complete",
2699
+ "goal_pause"
2700
+ ];
2641
2701
  function prefixedMcpToolName(registryId2, toolName) {
2642
2702
  return `${registryId2}__${toolName}`;
2643
2703
  }
@@ -3021,6 +3081,9 @@ var DelegatedAccessTokenPayload = z3.object({
3021
3081
  // Worker-asserted session scope for first-party MCP calls (HMAC-signed, not
3022
3082
  // agent-controlled); enables session-scoped tools such as goal management.
3023
3083
  sessionId: z3.string().uuid().optional(),
3084
+ // Model-visible first-party tool selection for a worker-bound session.
3085
+ // This is visibility only; permissions remain the authorization boundary.
3086
+ firstPartyMcpTools: z3.array(FirstPartyMcpToolName).optional(),
3024
3087
  // The turn making the call (the caller's identity), HMAC-signed by the worker
3025
3088
  // at turn setup. Lets a tool classify WHO is calling from the token itself,
3026
3089
  // instead of racily re-reading the session's live active_turn_id — e.g. the
@@ -4387,19 +4450,6 @@ var ComposerDraft = z3.object({
4387
4450
  sourceTurnVersion: z3.number().int().positive().nullable(),
4388
4451
  updatedAt: z3.string().nullable()
4389
4452
  });
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
4453
  var MoveSessionQueueItemRequest = z3.object({
4404
4454
  clientEventId: SessionOperationKey,
4405
4455
  expectedQueueVersion: z3.number().int().nonnegative(),
@@ -4658,7 +4708,6 @@ var SessionSystemUpdatePayload = z3.discriminatedUnion("type", [
4658
4708
  ]);
4659
4709
  var SessionSystemUpdateState = z3.enum([
4660
4710
  "pending",
4661
- "deferred",
4662
4711
  "delivered",
4663
4712
  "cancelled",
4664
4713
  "superseded",
@@ -4676,9 +4725,75 @@ var SessionSystemUpdate = z3.object({
4676
4725
  lineage: z3.record(z3.string(), z3.unknown()),
4677
4726
  state: SessionSystemUpdateState,
4678
4727
  deliveredTurnId: z3.string().uuid().nullable(),
4728
+ /**
4729
+ * The exact durable model-memory row containing the coalesced batch that
4730
+ * delivered this update. Null until claim; every member of one batch shares
4731
+ * the same id.
4732
+ */
4733
+ deliveredHistoryItemId: z3.string().uuid().nullable(),
4679
4734
  deliveredAt: z3.string().nullable(),
4680
4735
  createdAt: z3.string()
4681
4736
  });
4737
+ var SessionPendingInputPreview = SessionSystemUpdate.pick({
4738
+ id: true,
4739
+ sessionId: true,
4740
+ kind: true,
4741
+ classification: true,
4742
+ sourceId: true,
4743
+ summary: true,
4744
+ createdAt: true
4745
+ });
4746
+ var SessionQueueSnapshot = z3.object({
4747
+ version: z3.number().int().nonnegative(),
4748
+ effectiveControl: EffectiveSessionControl,
4749
+ /**
4750
+ * True while the latest attempt is interrupted but has not durably proved
4751
+ * quiescence: no more inference, user-visible output, or workspace-persistence
4752
+ * authority. Temporal cancellation/terminalization is not that proof. This is
4753
+ * distinct from ordinary capacity queueing, remains accurate with an empty
4754
+ * visible queue, and is independent of Steer-row metadata or withdrawal.
4755
+ */
4756
+ stoppingPreviousAttempt: z3.boolean(),
4757
+ items: z3.array(SessionTurn),
4758
+ /** Canonical bounded previews; never reconstructed from session events. */
4759
+ pendingInputs: z3.array(SessionPendingInputPreview),
4760
+ /**
4761
+ * Exact members of the next bounded machine-input batch that will join an
4762
+ * already-waiting human/API prompt. Null means the next machine-input claim
4763
+ * is standalone. This is a projection of canonical rows, not queue state.
4764
+ */
4765
+ pendingInputAttachment: z3.object({
4766
+ turnId: z3.string().uuid(),
4767
+ inputIds: z3.array(z3.string().uuid()).min(1)
4768
+ }).nullable()
4769
+ });
4770
+ function renderSessionSystemUpdateBatch(updates) {
4771
+ if (updates.length === 0) {
4772
+ throw new TypeError("A durable machine-input batch requires at least one update");
4773
+ }
4774
+ return [
4775
+ "[OpenGeni internal updates]",
4776
+ "These platform updates were delivered together for this inference. They are not human prompts.",
4777
+ JSON.stringify({
4778
+ updates: updates.map((update) => ({
4779
+ id: update.id,
4780
+ kind: update.kind,
4781
+ classification: update.classification,
4782
+ sourceId: update.sourceId,
4783
+ summary: update.summary,
4784
+ payload: update.payload,
4785
+ lineage: update.lineage
4786
+ }))
4787
+ })
4788
+ ].join("\n");
4789
+ }
4790
+ function sessionSystemUpdateBatchHistoryItem(updates) {
4791
+ return {
4792
+ type: "message",
4793
+ role: "system",
4794
+ content: renderSessionSystemUpdateBatch(updates)
4795
+ };
4796
+ }
4682
4797
  var VariableSetVariableName = z3.string().regex(/^[A-Z][A-Z0-9_]*$/).max(128);
4683
4798
  function withVariableSetIdAlias(shape) {
4684
4799
  return z3.preprocess((input) => {
@@ -5505,6 +5620,9 @@ var Session = z3.object({
5505
5620
  // Non-default first-party MCP token permissions (manager-style sessions);
5506
5621
  // null means the fixed worker default set.
5507
5622
  firstPartyMcpPermissions: z3.array(Permission).nullable(),
5623
+ // null means the fixed minimal worker-visible default. An explicit array,
5624
+ // including [], is the exact model-visible first-party selection.
5625
+ firstPartyMcpTools: z3.array(FirstPartyMcpToolName).nullable().default(null),
5508
5626
  // Per-session third-party MCP servers, metadata only. Credential values are
5509
5627
  // write-only and never appear here.
5510
5628
  mcpServers: z3.array(SessionMcpServerMetadata).default([]),
@@ -5644,6 +5762,9 @@ var SessionEventType = z3.enum([
5644
5762
  "goal.continuation",
5645
5763
  "system.update.pending",
5646
5764
  "system.update.delivered",
5765
+ "system.update.superseded",
5766
+ "system.update.cancelled",
5767
+ "system.update.settled",
5647
5768
  "session.control.paused",
5648
5769
  "session.control.resumed",
5649
5770
  "session.control.steer_requested",
@@ -5832,6 +5953,9 @@ var SESSION_EVENT_SEMANTIC_CLASS_TYPES = {
5832
5953
  "goal.continuation",
5833
5954
  "system.update.pending",
5834
5955
  "system.update.delivered",
5956
+ "system.update.superseded",
5957
+ "system.update.cancelled",
5958
+ "system.update.settled",
5835
5959
  "session.control.paused",
5836
5960
  "session.control.resumed",
5837
5961
  "session.control.steer_requested",
@@ -7194,6 +7318,10 @@ var CreateSessionRequest = withVariableSetIdAlias({
7194
7318
  // A goal-bearing session whose explicit/effective set omits goals:manage is
7195
7319
  // rejected; creation never silently expands a child beyond that set.
7196
7320
  firstPartyMcpPermissions: z3.array(Permission).optional(),
7321
+ // Exact model-visible selection from the broad first-party OpenGeni MCP
7322
+ // catalog. Omit for the minimal default; [] intentionally exposes none.
7323
+ // This does not grant authority: every registered tool is permission-gated.
7324
+ firstPartyMcpTools: z3.array(FirstPartyMcpToolName).optional(),
7197
7325
  // Third-party MCP servers attached only to this session. For an agent-created
7198
7326
  // child, omission snapshots its trusted immediate parent's server definitions,
7199
7327
  // policies, connection refs, and encrypted credentials. Explicit arrays,
@@ -8263,6 +8391,7 @@ export {
8263
8391
  CredentialAuthNeededPayload,
8264
8392
  DEFAULT_CODEX_FLEET_POLICY_V1,
8265
8393
  DEFAULT_FIRST_PARTY_MCP_PERMISSIONS,
8394
+ DEFAULT_FIRST_PARTY_MCP_TOOLS,
8266
8395
  DESKTOP_STREAM_PORT,
8267
8396
  DelegatedAccessTokenPayload,
8268
8397
  DeleteSessionQueueItemRequest,
@@ -8308,11 +8437,13 @@ export {
8308
8437
  EntitlementsMode,
8309
8438
  ErrorCode,
8310
8439
  ErrorEnvelope,
8440
+ FIRST_PARTY_MCP_TOOL_NAMES,
8311
8441
  FileAsset,
8312
8442
  FileDownloadUrlResponse,
8313
8443
  FileResourceRef,
8314
8444
  FileStatus,
8315
8445
  FileUploadStatus,
8446
+ FirstPartyMcpToolName,
8316
8447
  FsChangeKind,
8317
8448
  FsChangedPayload,
8318
8449
  FsDeleteRequest,
@@ -8551,6 +8682,7 @@ export {
8551
8682
  SessionMcpServerId,
8552
8683
  SessionMcpServerInput,
8553
8684
  SessionMcpServerMetadata,
8685
+ SessionPendingInputPreview,
8554
8686
  SessionQueueMutationResponse,
8555
8687
  SessionQueueSnapshot,
8556
8688
  SessionSkill,
@@ -8722,6 +8854,7 @@ export {
8722
8854
  redactSensitiveKey,
8723
8855
  redactSensitiveText,
8724
8856
  redactSerializedJson,
8857
+ renderSessionSystemUpdateBatch,
8725
8858
  replayCodexFleetDecisionV1,
8726
8859
  resolveRetainedOutputRange,
8727
8860
  resolveSessionEventTypeFilters,
@@ -8736,6 +8869,7 @@ export {
8736
8869
  sessionEventMediaPreview,
8737
8870
  sessionEventMediaPreviewFromDataUrl,
8738
8871
  sessionEventPayloadTruncation,
8872
+ sessionSystemUpdateBatchHistoryItem,
8739
8873
  signDelegatedAccessToken,
8740
8874
  signEnrollToken,
8741
8875
  signEnrollmentBearer,