@opengeni/contracts 0.20.1 → 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) => {
@@ -5006,6 +5121,29 @@ var CapabilityPackSkill = z3.object({
5006
5121
  });
5007
5122
  }
5008
5123
  });
5124
+ var SessionSkill = CapabilityPackSkill;
5125
+ var SessionSkills = z3.array(SessionSkill).max(32).transform((skills, ctx) => {
5126
+ const selected = /* @__PURE__ */ new Map();
5127
+ for (const skill of skills) {
5128
+ const key = skill.name.toLowerCase();
5129
+ const fingerprint2 = JSON.stringify({
5130
+ description: skill.description ?? null,
5131
+ files: [...skill.files].sort((left, right) => left.path.localeCompare(right.path)).map(({ path, content }) => ({ path, content }))
5132
+ });
5133
+ const existing = selected.get(key);
5134
+ if (!existing) {
5135
+ selected.set(key, { fingerprint: fingerprint2, skill });
5136
+ continue;
5137
+ }
5138
+ if (existing.fingerprint !== fingerprint2) {
5139
+ ctx.addIssue({
5140
+ code: "custom",
5141
+ message: `conflicting session skill definitions: ${skill.name}`
5142
+ });
5143
+ }
5144
+ }
5145
+ return [...selected.values()].map(({ skill }) => skill);
5146
+ });
5009
5147
  function isSafePackSkillRelativePath(path) {
5010
5148
  if (path.startsWith("/") || path.includes("\\")) {
5011
5149
  return false;
@@ -5220,10 +5358,13 @@ var CreateConnectionRequest = z3.object({
5220
5358
  expiresAt: z3.string().datetime({ offset: true }).nullable().optional(),
5221
5359
  metadata: z3.record(z3.string(), z3.unknown()).default({})
5222
5360
  });
5223
- var ConnectOpenGeniSlackBotRequest = z3.object({
5224
- token: z3.string().trim().startsWith("xoxb-").max(8192),
5361
+ var OpenGeniSlackBotInstallRequest = z3.object({
5225
5362
  connectionId: z3.string().uuid().optional()
5226
5363
  });
5364
+ var OpenGeniSlackBotInstallStart = z3.object({
5365
+ authorizationUrl: z3.string().url(),
5366
+ expiresAt: z3.string().datetime({ offset: true })
5367
+ });
5227
5368
  var UpdateConnectionRequest = z3.object({
5228
5369
  providerDomain: z3.string().min(1).optional(),
5229
5370
  subjectId: z3.string().min(1).nullable().optional(),
@@ -5340,14 +5481,14 @@ var CapabilityCatalogItem = z3.object({
5340
5481
  runtime: CapabilityRuntime.default({ available: false, notes: null }),
5341
5482
  enabled: z3.boolean().default(false),
5342
5483
  enabledReason: z3.string().nullable().default(null),
5343
- // The connection backing this enabled installation, when the enable-time
5344
- // connectionRef resolved to one (null for header/credential-free items
5345
- // that means "no connection involved", not "broken"). Lets the UI match
5346
- // connection health by id instead of guessing from providerDomain alone.
5484
+ // The non-secret connection binding stored with an enabled installation.
5485
+ // Workspace refs retain an exact row id. Subject refs deliberately omit it:
5486
+ // each caller resolves their own visible row by provider/kind at runtime.
5347
5487
  connectionRef: z3.object({
5348
- connectionId: z3.string().min(1),
5488
+ connectionId: z3.string().min(1).optional(),
5349
5489
  providerDomain: z3.string().min(1),
5350
- kind: z3.string().min(1)
5490
+ kind: z3.string().min(1),
5491
+ subjectScope: z3.enum(["workspace", "subject"]).optional()
5351
5492
  }).nullable().default(null),
5352
5493
  metadata: z3.record(z3.string(), z3.unknown()).default({}),
5353
5494
  createdAt: z3.string().optional(),
@@ -5434,6 +5575,7 @@ var Session = z3.object({
5434
5575
  // null when the session carried none.
5435
5576
  instructions: z3.string().nullable(),
5436
5577
  resources: z3.array(ResourceRef),
5578
+ skills: SessionSkills.default([]),
5437
5579
  tools: z3.array(ToolRef),
5438
5580
  // Origin of the persisted tool allow-list. Optional for rolling client
5439
5581
  // compatibility; current servers emit it and legacy rows map to `legacy`.
@@ -5478,6 +5620,9 @@ var Session = z3.object({
5478
5620
  // Non-default first-party MCP token permissions (manager-style sessions);
5479
5621
  // null means the fixed worker default set.
5480
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),
5481
5626
  // Per-session third-party MCP servers, metadata only. Credential values are
5482
5627
  // write-only and never appear here.
5483
5628
  mcpServers: z3.array(SessionMcpServerMetadata).default([]),
@@ -5617,6 +5762,9 @@ var SessionEventType = z3.enum([
5617
5762
  "goal.continuation",
5618
5763
  "system.update.pending",
5619
5764
  "system.update.delivered",
5765
+ "system.update.superseded",
5766
+ "system.update.cancelled",
5767
+ "system.update.settled",
5620
5768
  "session.control.paused",
5621
5769
  "session.control.resumed",
5622
5770
  "session.control.steer_requested",
@@ -5805,6 +5953,9 @@ var SESSION_EVENT_SEMANTIC_CLASS_TYPES = {
5805
5953
  "goal.continuation",
5806
5954
  "system.update.pending",
5807
5955
  "system.update.delivered",
5956
+ "system.update.superseded",
5957
+ "system.update.cancelled",
5958
+ "system.update.settled",
5808
5959
  "session.control.paused",
5809
5960
  "session.control.resumed",
5810
5961
  "session.control.steer_requested",
@@ -7112,6 +7263,9 @@ var CreateSessionRequest = withVariableSetIdAlias({
7112
7263
  // authoritative. Top-level omission remains []. Presence is resolved from
7113
7264
  // the raw request because this Zod default erases absent-vs-empty.
7114
7265
  resources: z3.array(ResourceRef).default([]),
7266
+ // Inline skills are fixed onto the session. Child omission inherits the
7267
+ // trusted parent's selection; an explicit array, including [], wins.
7268
+ skills: SessionSkills.default([]),
7115
7269
  // The same child omission rule applies to selected MCP tool refs. Top-level
7116
7270
  // omission still applies workspace-default capability MCP tools; explicit []
7117
7271
  // suppresses those defaults (the first-party OpenGeni server remains added).
@@ -7164,6 +7318,10 @@ var CreateSessionRequest = withVariableSetIdAlias({
7164
7318
  // A goal-bearing session whose explicit/effective set omits goals:manage is
7165
7319
  // rejected; creation never silently expands a child beyond that set.
7166
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(),
7167
7325
  // Third-party MCP servers attached only to this session. For an agent-created
7168
7326
  // child, omission snapshots its trusted immediate parent's server definitions,
7169
7327
  // policies, connection refs, and encrypted credentials. Explicit arrays,
@@ -8204,7 +8362,6 @@ export {
8204
8362
  CompactSessionContextResult,
8205
8363
  CompleteFileUploadResponse,
8206
8364
  ComposerDraft,
8207
- ConnectOpenGeniSlackBotRequest,
8208
8365
  ConnectionCredentialBundle,
8209
8366
  ConnectionKind,
8210
8367
  ConnectionMetadata,
@@ -8234,6 +8391,7 @@ export {
8234
8391
  CredentialAuthNeededPayload,
8235
8392
  DEFAULT_CODEX_FLEET_POLICY_V1,
8236
8393
  DEFAULT_FIRST_PARTY_MCP_PERMISSIONS,
8394
+ DEFAULT_FIRST_PARTY_MCP_TOOLS,
8237
8395
  DESKTOP_STREAM_PORT,
8238
8396
  DelegatedAccessTokenPayload,
8239
8397
  DeleteSessionQueueItemRequest,
@@ -8279,11 +8437,13 @@ export {
8279
8437
  EntitlementsMode,
8280
8438
  ErrorCode,
8281
8439
  ErrorEnvelope,
8440
+ FIRST_PARTY_MCP_TOOL_NAMES,
8282
8441
  FileAsset,
8283
8442
  FileDownloadUrlResponse,
8284
8443
  FileResourceRef,
8285
8444
  FileStatus,
8286
8445
  FileUploadStatus,
8446
+ FirstPartyMcpToolName,
8287
8447
  FsChangeKind,
8288
8448
  FsChangedPayload,
8289
8449
  FsDeleteRequest,
@@ -8403,6 +8563,8 @@ export {
8403
8563
  OPENGENI_SLACK_BOT_REQUIRED_SCOPES,
8404
8564
  OPENGENI_SLACK_BOT_SESSION_METADATA_KEY,
8405
8565
  OpenGeniSlackBotConnectionMetadata,
8566
+ OpenGeniSlackBotInstallRequest,
8567
+ OpenGeniSlackBotInstallStart,
8406
8568
  PackInstallation,
8407
8569
  PackInstallationStatus,
8408
8570
  Permission,
@@ -8520,8 +8682,11 @@ export {
8520
8682
  SessionMcpServerId,
8521
8683
  SessionMcpServerInput,
8522
8684
  SessionMcpServerMetadata,
8685
+ SessionPendingInputPreview,
8523
8686
  SessionQueueMutationResponse,
8524
8687
  SessionQueueSnapshot,
8688
+ SessionSkill,
8689
+ SessionSkills,
8525
8690
  SessionSpawnDenial,
8526
8691
  SessionStatus,
8527
8692
  SessionStructuredCapabilities,
@@ -8689,6 +8854,7 @@ export {
8689
8854
  redactSensitiveKey,
8690
8855
  redactSensitiveText,
8691
8856
  redactSerializedJson,
8857
+ renderSessionSystemUpdateBatch,
8692
8858
  replayCodexFleetDecisionV1,
8693
8859
  resolveRetainedOutputRange,
8694
8860
  resolveSessionEventTypeFilters,
@@ -8703,6 +8869,7 @@ export {
8703
8869
  sessionEventMediaPreview,
8704
8870
  sessionEventMediaPreviewFromDataUrl,
8705
8871
  sessionEventPayloadTruncation,
8872
+ sessionSystemUpdateBatchHistoryItem,
8706
8873
  signDelegatedAccessToken,
8707
8874
  signEnrollToken,
8708
8875
  signEnrollmentBearer,