@opengeni/contracts 2.7.0 → 2.9.2-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.
package/src/index.ts CHANGED
@@ -942,15 +942,8 @@ const FIRST_PARTY_IN_PROCESS_TOOL_NAME_SET = new Set<FirstPartyMcpToolName>(
942
942
  * trustworthy logical-delivery identity. Server-owned Slack delivery paths
943
943
  * call the internal client directly with their own durable operation IDs.
944
944
  */
945
- // Names kept so previously written data still parses - immutable scheduled-task
946
- // execution snapshots recorded the tool set that was default at the time, and
947
- // they are strictly re-parsed on replay. Retiring a tool must not strand an
948
- // accepted occurrence. These are never registered, never default, and never
949
- // authorized; they exist so history stays readable.
950
945
  const FIRST_PARTY_COMPATIBILITY_ONLY_TOOL_NAMES = [
951
946
  "slack_bot_post_message",
952
- "memory_save",
953
- "memory_correct",
954
947
  ] as const satisfies readonly FirstPartyMcpToolName[];
955
948
 
956
949
  const FIRST_PARTY_COMPATIBILITY_ONLY_TOOL_NAME_SET = new Set<FirstPartyMcpToolName>(
@@ -983,10 +976,6 @@ export const EDITABLE_ARTIFACT_MCP_CODEMODE_PATHS = {
983
976
  */
984
977
  export const DEFAULT_FIRST_PARTY_MCP_TOOLS = FIRST_PARTY_MCP_TOOL_NAMES.filter(
985
978
  (name) =>
986
- // Memory V1 writes are retired entirely; `remember` and task-note
987
- // promotion own durable agent writes.
988
- name !== "memory_save" &&
989
- name !== "memory_correct" &&
990
979
  !name.startsWith("social_") &&
991
980
  !name.startsWith("x_") &&
992
981
  !name.startsWith("reddit_") &&
@@ -2960,6 +2949,28 @@ export const CreateWorkspaceRequest = z.object({
2960
2949
  });
2961
2950
  export type CreateWorkspaceRequest = z.infer<typeof CreateWorkspaceRequest>;
2962
2951
 
2952
+ export const EnsureWorkspaceRequest = z
2953
+ .object({
2954
+ accountId: z.string().uuid(),
2955
+ externalSource: z.string().trim().min(1).max(200),
2956
+ externalId: z.string().trim().min(1).max(1024),
2957
+ name: z.string().trim().min(1).max(200),
2958
+ slug: z.string().trim().min(1).max(200).optional(),
2959
+ // White-label persona override for this workspace's agent. null/omitted uses
2960
+ // the deployment default template.
2961
+ agentInstructions: z.string().min(1).nullable().optional(),
2962
+ })
2963
+ .strict();
2964
+ export type EnsureWorkspaceRequest = z.infer<typeof EnsureWorkspaceRequest>;
2965
+
2966
+ export const EnsureWorkspaceResponse = z
2967
+ .object({
2968
+ workspace: Workspace,
2969
+ created: z.boolean(),
2970
+ })
2971
+ .strict();
2972
+ export type EnsureWorkspaceResponse = z.infer<typeof EnsureWorkspaceResponse>;
2973
+
2963
2974
  export const UpdateWorkspaceRequest = z
2964
2975
  .object({
2965
2976
  name: z.string().min(1).optional(),
@@ -3002,6 +3013,15 @@ export const CreateApiKeyResponse = z.object({
3002
3013
  });
3003
3014
  export type CreateApiKeyResponse = z.infer<typeof CreateApiKeyResponse>;
3004
3015
 
3016
+ export const CreateOrganizationApiKeyRequest = z
3017
+ .object({
3018
+ name: z.string().trim().min(1).max(200),
3019
+ description: z.string().trim().min(1).max(500).optional(),
3020
+ expiresAt: z.string().datetime({ offset: true }).optional(),
3021
+ })
3022
+ .strict();
3023
+ export type CreateOrganizationApiKeyRequest = z.infer<typeof CreateOrganizationApiKeyRequest>;
3024
+
3005
3025
  // A person (or API key) with access to a workspace: one workspace_memberships
3006
3026
  // row. `subjectId` is `user:<betterAuthUserId>` or `api_key:<id>`; the People
3007
3027
  // surface lists the `user:` subjects (api_key subjects belong to API keys).
@@ -3019,10 +3039,26 @@ export const ListWorkspaceMembersResponse = z.object({
3019
3039
  });
3020
3040
  export type ListWorkspaceMembersResponse = z.infer<typeof ListWorkspaceMembersResponse>;
3021
3041
 
3042
+ export const WorkspaceMemberCandidate = z.object({
3043
+ organizationMembershipId: z.string().uuid(),
3044
+ subjectId: z.string().min(1),
3045
+ name: z.string().min(1).max(1024).nullable(),
3046
+ email: z.string().email().max(320).nullable(),
3047
+ organizationRole: z.enum(["owner", "admin", "member"]),
3048
+ });
3049
+ export type WorkspaceMemberCandidate = z.infer<typeof WorkspaceMemberCandidate>;
3050
+
3051
+ export const ListWorkspaceMemberCandidatesResponse = z.object({
3052
+ members: z.array(WorkspaceMemberCandidate).max(1000),
3053
+ });
3054
+ export type ListWorkspaceMemberCandidatesResponse = z.infer<
3055
+ typeof ListWorkspaceMemberCandidatesResponse
3056
+ >;
3057
+
3022
3058
  export const AddWorkspaceMemberRequest = z.object({
3023
- // Resolved against the managed (Better Auth) users; email invites for
3024
- // not-yet-registered users are deferred, so an unknown email returns 404.
3025
- email: z.string().email(),
3059
+ // The candidate inventory exposes this opaque organization-local identifier.
3060
+ // Organization invitations stay in the organization-admin lifecycle.
3061
+ organizationMembershipId: z.string().uuid(),
3026
3062
  role: z.string().min(1).optional(),
3027
3063
  permissions: z.array(Permission),
3028
3064
  });
@@ -7625,17 +7661,74 @@ export function renderSessionSystemUpdateBatch(
7625
7661
  ].join("\n");
7626
7662
  }
7627
7663
 
7664
+ export const SCHEDULED_OCCURRENCE_TASK_LABEL = "[OpenGeni scheduled task occurrence]" as const;
7665
+
7666
+ /**
7667
+ * A pure scheduled-occurrence batch is a new task boundary for the model, not
7668
+ * merely background context. The user role here is conversational only: the
7669
+ * owning turn retains its immutable scheduler/service initiator and frozen
7670
+ * execution authority in the database.
7671
+ *
7672
+ * Malformed or mixed legacy batches fall back to the generic system envelope
7673
+ * so this renderer never invents task identity from inconsistent payloads.
7674
+ */
7675
+ function renderScheduledOccurrenceTaskBatch(
7676
+ updates: Parameters<typeof renderSessionSystemUpdateBatch>[0],
7677
+ ): string | null {
7678
+ if (updates.length === 0 || updates.some((update) => update.kind !== "scheduled_occurrence")) {
7679
+ return null;
7680
+ }
7681
+ const occurrences = updates.map((update) => {
7682
+ const parsed = SessionSystemUpdatePayload.safeParse(update.payload);
7683
+ if (
7684
+ !parsed.success ||
7685
+ parsed.data.type !== "scheduled_occurrence" ||
7686
+ parsed.data.scheduledTaskRunId !== update.sourceId
7687
+ ) {
7688
+ return null;
7689
+ }
7690
+ return { update, payload: parsed.data };
7691
+ });
7692
+ if (occurrences.some((occurrence) => occurrence === null)) return null;
7693
+
7694
+ const introduction =
7695
+ occurrences.length === 1
7696
+ ? "A new scheduled occurrence has started. Execute the instructions below for this occurrence now."
7697
+ : `${occurrences.length} new scheduled occurrences have started. Execute every instruction set below for this turn now.`;
7698
+ return [
7699
+ SCHEDULED_OCCURRENCE_TASK_LABEL,
7700
+ introduction,
7701
+ "The scheduled instructions below are the task for this turn. Earlier completed goals, occurrences, conversation, and tool outputs are historical context and do not complete this occurrence. When the task depends on mutable external state, query that state during this occurrence instead of reusing an earlier result.",
7702
+ ...occurrences.flatMap((occurrence, index) => {
7703
+ if (!occurrence) return [];
7704
+ return [
7705
+ "",
7706
+ ...(occurrences.length > 1 ? [`Occurrence ${index + 1}:`] : []),
7707
+ `Scheduled task ID: ${occurrence.payload.scheduledTaskId}`,
7708
+ `Scheduled task run ID: ${occurrence.payload.scheduledTaskRunId}`,
7709
+ `Update ID: ${occurrence.update.id}`,
7710
+ "Instructions:",
7711
+ occurrence.payload.text,
7712
+ ];
7713
+ }),
7714
+ ].join("\n");
7715
+ }
7716
+
7628
7717
  export function sessionSystemUpdateBatchHistoryItem(
7629
7718
  updates: Parameters<typeof renderSessionSystemUpdateBatch>[0],
7630
7719
  goalSnapshot?: SessionGoalSnapshot,
7631
- ): { type: "message"; role: "system"; content: string } {
7720
+ options: { promoteScheduledOccurrenceToUser?: boolean } = {},
7721
+ ): { type: "message"; role: "system" | "user"; content: string } {
7632
7722
  const goalContext = renderSessionGoalContext(goalSnapshot);
7723
+ const scheduledTask = options.promoteScheduledOccurrenceToUser
7724
+ ? renderScheduledOccurrenceTaskBatch(updates)
7725
+ : null;
7633
7726
  return {
7634
7727
  type: "message",
7635
- role: "system",
7728
+ role: scheduledTask ? "user" : "system",
7636
7729
  content: [
7637
7730
  ...(goalContext ? [`${SESSION_GOAL_CONTEXT_LABEL}\n${goalContext}`] : []),
7638
- renderSessionSystemUpdateBatch(updates),
7731
+ scheduledTask ?? renderSessionSystemUpdateBatch(updates),
7639
7732
  ].join("\n\n"),
7640
7733
  };
7641
7734
  }
@@ -7646,6 +7739,48 @@ export const VariableSetVariableName = z
7646
7739
  .max(128);
7647
7740
  export type VariableSetVariableName = z.infer<typeof VariableSetVariableName>;
7648
7741
 
7742
+ export const VARIABLE_SET_RESERVED_EXACT_NAMES = [
7743
+ "HOME",
7744
+ "PATH",
7745
+ "SHELL",
7746
+ "USER",
7747
+ "LOGNAME",
7748
+ "TMPDIR",
7749
+ "IFS",
7750
+ "ENV",
7751
+ "BASH_ENV",
7752
+ "NODE_OPTIONS",
7753
+ "PYTHONPATH",
7754
+ "PYTHONSTARTUP",
7755
+ "PERL5OPT",
7756
+ "PERL5LIB",
7757
+ "GH_TOKEN",
7758
+ "GITHUB_TOKEN",
7759
+ "GITLAB_TOKEN",
7760
+ "AZURE_DEVOPS_EXT_PAT",
7761
+ "GIT_ASKPASS",
7762
+ "GIT_TERMINAL_PROMPT",
7763
+ ] as const;
7764
+
7765
+ export const VARIABLE_SET_RESERVED_PREFIXES = [
7766
+ "OPENGENI_",
7767
+ "GIT_CONFIG_",
7768
+ "GIT_AUTHOR_",
7769
+ "GIT_COMMITTER_",
7770
+ "LD_",
7771
+ "DYLD_",
7772
+ ] as const;
7773
+
7774
+ export function variableSetVariableNameReservation(
7775
+ name: string,
7776
+ ): { kind: "exact" | "prefix"; value: string } | null {
7777
+ if ((VARIABLE_SET_RESERVED_EXACT_NAMES as readonly string[]).includes(name)) {
7778
+ return { kind: "exact", value: name };
7779
+ }
7780
+ const prefix = VARIABLE_SET_RESERVED_PREFIXES.find((candidate) => name.startsWith(candidate));
7781
+ return prefix ? { kind: "prefix", value: prefix } : null;
7782
+ }
7783
+
7649
7784
  function withVariableSetIdAlias<T extends z.ZodRawShape>(
7650
7785
  shape: T,
7651
7786
  options: { rejectKeys?: readonly string[] } = {},
@@ -8483,17 +8618,24 @@ function scheduledTaskBoundedString(maxBytes: number, label: string) {
8483
8618
  }
8484
8619
 
8485
8620
  /** Ingress-bounded task name for create/update requests. */
8486
- export const ScheduledTaskNameInput = /* @__PURE__ */ scheduledTaskBoundedString(
8487
- SCHEDULED_TASK_NAME_MAX_BYTES,
8488
- "scheduled task name",
8489
- );
8621
+ export const ScheduledTaskNameInput =
8622
+ /* @__PURE__ */ scheduledTaskBoundedString(SCHEDULED_TASK_NAME_MAX_BYTES, "scheduled task name");
8490
8623
  /** Ingress-bounded task metadata for create/update requests. */
8491
- export const ScheduledTaskMetadataInput = /* @__PURE__ */ scheduledTaskBoundedJsonObject(
8492
- SCHEDULED_TASK_METADATA_MAX_BYTES,
8493
- "scheduled task metadata",
8494
- );
8624
+ export const ScheduledTaskMetadataInput =
8625
+ /* @__PURE__ */ scheduledTaskBoundedJsonObject(
8626
+ SCHEDULED_TASK_METADATA_MAX_BYTES,
8627
+ "scheduled task metadata",
8628
+ );
8495
8629
 
8496
8630
  function scheduledTaskAgentConfigShape(bounded: boolean) {
8631
+ const machineTarget = z
8632
+ .object({
8633
+ targetSandboxId: z.string().uuid(),
8634
+ workingDir: bounded
8635
+ ? z.string().trim().min(1).max(4096).optional()
8636
+ : z.string().min(1).optional(),
8637
+ })
8638
+ .strict();
8497
8639
  return {
8498
8640
  prompt: bounded
8499
8641
  ? scheduledTaskBoundedString(SCHEDULED_TASK_PROMPT_MAX_BYTES, "scheduled task prompt")
@@ -8519,6 +8661,10 @@ function scheduledTaskAgentConfigShape(bounded: boolean) {
8519
8661
  : z.string().min(1).optional(),
8520
8662
  reasoningEffort: ReasoningEffort.optional(),
8521
8663
  sandboxBackend: SandboxBackend.optional(),
8664
+ // Connected Machines are a concrete execution target, not a generic
8665
+ // sandbox backend. Persist the exact machine + optional cwd so every
8666
+ // generated session can seed its active route before its first turn.
8667
+ machineTarget: machineTarget.optional(),
8522
8668
  goal: GoalSpec.optional(),
8523
8669
  // Incident telemetry is the only special execution class. Omission keeps
8524
8670
  // every existing task on the byte-compatible ordinary dispatch path.
@@ -8560,6 +8706,20 @@ export type ScheduledTaskAgentConfig = z.infer<typeof ScheduledTaskAgentConfig>;
8560
8706
  export const ScheduledTaskAgentConfigInput = /* @__PURE__ */ z
8561
8707
  .object(scheduledTaskAgentConfigShape(true))
8562
8708
  .superRefine((value, context) => {
8709
+ if (value.machineTarget && value.sandboxBackend !== undefined) {
8710
+ context.addIssue({
8711
+ code: "custom",
8712
+ path: ["machineTarget"],
8713
+ message: "machineTarget cannot be combined with sandboxBackend",
8714
+ });
8715
+ }
8716
+ if (value.sandboxBackend === "selfhosted") {
8717
+ context.addIssue({
8718
+ code: "custom",
8719
+ path: ["sandboxBackend"],
8720
+ message: "selfhosted scheduled tasks require machineTarget",
8721
+ });
8722
+ }
8563
8723
  if (scheduledTaskJsonUtf8Bytes(value) > SCHEDULED_TASK_AGENT_CONFIG_MAX_BYTES) {
8564
8724
  context.addIssue({
8565
8725
  code: "custom",
@@ -8884,6 +9044,13 @@ const CreateAgentScheduledTaskRequest = /* @__PURE__ */ withVariableSetIdAlias({
8884
9044
  message: "agentConfig.goal cannot be used with an existing-session target",
8885
9045
  });
8886
9046
  }
9047
+ if (value.runMode === "existing_session" && value.agentConfig.machineTarget) {
9048
+ context.addIssue({
9049
+ code: "custom",
9050
+ path: ["agentConfig", "machineTarget"],
9051
+ message: "machineTarget cannot be used with an existing-session target",
9052
+ });
9053
+ }
8887
9054
  });
8888
9055
 
8889
9056
  const CreateKnowledgeSourceSyncScheduledTaskRequest = /* @__PURE__ */ z
@@ -8918,48 +9085,59 @@ export const CreateScheduledTaskRequest = /* @__PURE__ */ z.union([
8918
9085
  ]);
8919
9086
  export type CreateScheduledTaskRequest = z.infer<typeof CreateScheduledTaskRequest>;
8920
9087
 
8921
- export const UpdateScheduledTaskRequest = /* @__PURE__ */ withVariableSetIdAlias({
8922
- name: ScheduledTaskNameInput.optional(),
8923
- schedule: ScheduledTaskScheduleSpec.optional(),
8924
- runMode: ScheduledTaskRunMode.optional(),
8925
- overlapPolicy: ScheduledTaskOverlapPolicy.optional(),
8926
- action: ScheduledTaskAction.optional(),
8927
- targetSessionId: z.string().uuid().nullable().optional(),
8928
- connectionAuthorities: McpConnectionAuthoritySelections.optional(),
8929
- agentConfig: ScheduledTaskAgentConfigInput.optional(),
8930
- status: ScheduledTaskStatus.optional(),
8931
- variableSetId: z.string().uuid().nullable().optional(),
8932
- environmentId: z.string().uuid().nullable().optional(),
8933
- // The rig each run binds to (M3); null clears it. Its active version is
8934
- // resolved per fire, so an update takes effect on the next dispatch.
8935
- rigId: z.string().uuid().nullable().optional(),
8936
- metadata: z.record(z.string(), z.unknown()).optional(),
8937
- }).superRefine((value, context) => {
8938
- if (value.targetSessionId && value.runMode && value.runMode !== "existing_session") {
8939
- context.addIssue({
8940
- code: "custom",
8941
- path: ["targetSessionId"],
8942
- message: "targetSessionId requires runMode=existing_session",
8943
- });
8944
- }
8945
- if (value.runMode === "existing_session" && value.targetSessionId === null) {
8946
- context.addIssue({
8947
- code: "custom",
8948
- path: ["targetSessionId"],
8949
- message: "targetSessionId cannot be null when runMode=existing_session",
8950
- });
8951
- }
8952
- if (
8953
- value.agentConfig?.goal &&
8954
- (value.runMode === "existing_session" || Boolean(value.targetSessionId))
8955
- ) {
8956
- context.addIssue({
8957
- code: "custom",
8958
- path: ["agentConfig", "goal"],
8959
- message: "agentConfig.goal cannot be used with an existing-session target",
8960
- });
8961
- }
8962
- });
9088
+ export const UpdateScheduledTaskRequest =
9089
+ /* @__PURE__ */ withVariableSetIdAlias({
9090
+ name: ScheduledTaskNameInput.optional(),
9091
+ schedule: ScheduledTaskScheduleSpec.optional(),
9092
+ runMode: ScheduledTaskRunMode.optional(),
9093
+ overlapPolicy: ScheduledTaskOverlapPolicy.optional(),
9094
+ action: ScheduledTaskAction.optional(),
9095
+ targetSessionId: z.string().uuid().nullable().optional(),
9096
+ connectionAuthorities: McpConnectionAuthoritySelections.optional(),
9097
+ agentConfig: ScheduledTaskAgentConfigInput.optional(),
9098
+ status: ScheduledTaskStatus.optional(),
9099
+ variableSetId: z.string().uuid().nullable().optional(),
9100
+ environmentId: z.string().uuid().nullable().optional(),
9101
+ // The rig each run binds to (M3); null clears it. Its active version is
9102
+ // resolved per fire, so an update takes effect on the next dispatch.
9103
+ rigId: z.string().uuid().nullable().optional(),
9104
+ metadata: z.record(z.string(), z.unknown()).optional(),
9105
+ }).superRefine((value, context) => {
9106
+ if (value.targetSessionId && value.runMode && value.runMode !== "existing_session") {
9107
+ context.addIssue({
9108
+ code: "custom",
9109
+ path: ["targetSessionId"],
9110
+ message: "targetSessionId requires runMode=existing_session",
9111
+ });
9112
+ }
9113
+ if (value.runMode === "existing_session" && value.targetSessionId === null) {
9114
+ context.addIssue({
9115
+ code: "custom",
9116
+ path: ["targetSessionId"],
9117
+ message: "targetSessionId cannot be null when runMode=existing_session",
9118
+ });
9119
+ }
9120
+ if (
9121
+ value.agentConfig?.goal &&
9122
+ (value.runMode === "existing_session" || Boolean(value.targetSessionId))
9123
+ ) {
9124
+ context.addIssue({
9125
+ code: "custom",
9126
+ path: ["agentConfig", "goal"],
9127
+ message: "agentConfig.goal cannot be used with an existing-session target",
9128
+ });
9129
+ }
9130
+ if (
9131
+ value.agentConfig?.machineTarget &&
9132
+ (value.runMode === "existing_session" || Boolean(value.targetSessionId))
9133
+ ) {
9134
+ context.addIssue({
9135
+ code: "custom",
9136
+ path: ["agentConfig", "machineTarget"],
9137
+ message: "machineTarget cannot be used with an existing-session target",
9138
+ });
9139
+ }
9140
+ });
8963
9141
  export type UpdateScheduledTaskRequest = z.infer<typeof UpdateScheduledTaskRequest>;
8964
9142
 
8965
9143
  /**
@@ -11664,8 +11842,11 @@ export const Session = z.object({
11664
11842
  queuedDescendants: z.number().int().nonnegative(),
11665
11843
  attentionDescendants: z.number().int().nonnegative(),
11666
11844
  pausedDescendants: z.number().int().nonnegative(),
11845
+ /** Historical failed lifecycle states, including already-reviewed failures. */
11667
11846
  failedDescendants: z.number().int().nonnegative(),
11668
11847
  unreadDescendants: z.number().int().nonnegative().optional(),
11848
+ /** Failed descendants whose latest durable event this viewer has not acknowledged. */
11849
+ unreadFailedDescendants: z.number().int().nonnegative().optional(),
11669
11850
  activelyWorkingDescendants: z.number().int().nonnegative().optional(),
11670
11851
  /**
11671
11852
  * Earliest moment one of the counted `attentionDescendants` entered
@@ -14498,6 +14679,10 @@ export const ClientAuthConfig = z.discriminatedUnion("mode", [
14498
14679
  mode: z.literal("managedSession"),
14499
14680
  session: z.literal("cookie"),
14500
14681
  emailVerificationRequired: z.boolean().default(true),
14682
+ socialProviders: z
14683
+ .array(z.enum(["google", "github"]))
14684
+ .max(2)
14685
+ .default([]),
14501
14686
  }),
14502
14687
  ]);
14503
14688
  export type ClientAuthConfig = z.infer<typeof ClientAuthConfig>;
@@ -14596,10 +14781,10 @@ export const SessionCapabilities = z.object({
14596
14781
  codecs: z.array(z.enum(["h264-mp4", "vp9-webm"])),
14597
14782
  reason: CapabilityUnavailableReason.nullable(),
14598
14783
  }),
14599
- // The AGENT drives the SAME :0 (xdotool/XTEST + scrot) the human watches; the
14600
- // human viewer plane is read-only by default (§6). `available` == desktop-
14601
- // capable backend && computerUseEnabled; `readOnly` reports whether the agent
14602
- // driver itself is gated to no-op input (v1 default false — the agent clicks).
14784
+ // Deprecated compatibility cell for clients that predate managed
14785
+ // ComputerSession interaction tools. Newly negotiated documents report this
14786
+ // unavailable/read-only with `disabled_by_policy`; the shape remains so older
14787
+ // clients and persisted payloads still parse.
14603
14788
  ComputerUse: z.object({
14604
14789
  available: z.boolean(),
14605
14790
  readOnly: z.boolean(),
@@ -15279,9 +15464,8 @@ function defineModelContractSchema<Schema>(factory: () => Schema): Schema {
15279
15464
  return factory();
15280
15465
  }
15281
15466
 
15282
- export const ModelCapabilitySupportV1 = /* @__PURE__ */ defineModelContractSchema(() =>
15283
- z.enum(["supported", "unsupported", "unknown"]),
15284
- );
15467
+ export const ModelCapabilitySupportV1 =
15468
+ /* @__PURE__ */ defineModelContractSchema(() => z.enum(["supported", "unsupported", "unknown"]));
15285
15469
  export type ModelCapabilitySupportV1 = z.infer<typeof ModelCapabilitySupportV1>;
15286
15470
 
15287
15471
  export const ModelCapabilityStateV1 = /* @__PURE__ */ defineModelContractSchema(() =>
@@ -15329,28 +15513,29 @@ export const ModelCapabilitiesV1 = /* @__PURE__ */ defineModelContractSchema(()
15329
15513
  );
15330
15514
  export type ModelCapabilitiesV1 = z.infer<typeof ModelCapabilitiesV1>;
15331
15515
 
15332
- export const ModelCredentialSourceV1 = /* @__PURE__ */ defineModelContractSchema(() =>
15333
- z.union([
15334
- z
15335
- .object({
15336
- kind: z.literal("deployment"),
15337
- mechanism: z.enum(["api_key", "azure_ad_bearer"]),
15338
- })
15339
- .strict(),
15340
- z
15341
- .object({
15342
- kind: z.literal("connected_subscription"),
15343
- provider: z.enum(["codex", "xai"]),
15344
- })
15345
- .strict(),
15346
- z
15347
- .object({
15348
- kind: z.literal("workspace_connection"),
15349
- mechanism: z.literal("api_key"),
15350
- })
15351
- .strict(),
15352
- ]),
15353
- );
15516
+ export const ModelCredentialSourceV1 =
15517
+ /* @__PURE__ */ defineModelContractSchema(() =>
15518
+ z.union([
15519
+ z
15520
+ .object({
15521
+ kind: z.literal("deployment"),
15522
+ mechanism: z.enum(["api_key", "azure_ad_bearer"]),
15523
+ })
15524
+ .strict(),
15525
+ z
15526
+ .object({
15527
+ kind: z.literal("connected_subscription"),
15528
+ provider: z.enum(["codex", "xai"]),
15529
+ })
15530
+ .strict(),
15531
+ z
15532
+ .object({
15533
+ kind: z.literal("workspace_connection"),
15534
+ mechanism: z.literal("api_key"),
15535
+ })
15536
+ .strict(),
15537
+ ]),
15538
+ );
15354
15539
  export type ModelCredentialSourceV1 = z.infer<typeof ModelCredentialSourceV1>;
15355
15540
 
15356
15541
  const TurnExecutionCredentialSourceV1 = z.union([
@@ -15363,31 +15548,35 @@ const TurnExecutionCredentialSourceV1 = z.union([
15363
15548
  .strict(),
15364
15549
  ]);
15365
15550
 
15366
- export const ModelBillingAttributionV1 = /* @__PURE__ */ defineModelContractSchema(() =>
15367
- z
15368
- .object({
15369
- upstreamPayer: z.enum(["deployment", "workspace", "connected_subscription"]),
15370
- metering: z.enum(["opengeni_credits", "external"]),
15371
- })
15372
- .strict(),
15373
- );
15551
+ export const ModelBillingAttributionV1 =
15552
+ /* @__PURE__ */ defineModelContractSchema(() =>
15553
+ z
15554
+ .object({
15555
+ upstreamPayer: z.enum(["deployment", "workspace", "connected_subscription"]),
15556
+ metering: z.enum(["opengeni_credits", "external"]),
15557
+ })
15558
+ .strict(),
15559
+ );
15374
15560
  export type ModelBillingAttributionV1 = z.infer<typeof ModelBillingAttributionV1>;
15375
15561
 
15376
15562
  export const TURN_EXECUTION_POLICY_METADATA_KEY = "turnExecutionPolicyV1" as const;
15377
15563
 
15378
- export const TurnExecutionModelSourceV1 = /* @__PURE__ */ defineModelContractSchema(() =>
15379
- z.enum(["explicit", "session", "deployment", "continuation"]),
15380
- );
15564
+ export const TurnExecutionModelSourceV1 =
15565
+ /* @__PURE__ */ defineModelContractSchema(() =>
15566
+ z.enum(["explicit", "session", "deployment", "continuation"]),
15567
+ );
15381
15568
  export type TurnExecutionModelSourceV1 = z.infer<typeof TurnExecutionModelSourceV1>;
15382
15569
 
15383
- export const TurnExecutionReasoningSourceV1 = /* @__PURE__ */ defineModelContractSchema(() =>
15384
- z.enum(["explicit", "session", "deployment", "continuation"]),
15385
- );
15570
+ export const TurnExecutionReasoningSourceV1 =
15571
+ /* @__PURE__ */ defineModelContractSchema(() =>
15572
+ z.enum(["explicit", "session", "deployment", "continuation"]),
15573
+ );
15386
15574
  export type TurnExecutionReasoningSourceV1 = z.infer<typeof TurnExecutionReasoningSourceV1>;
15387
15575
 
15388
- export const TurnExecutionLatencyModeSourceV1 = /* @__PURE__ */ defineModelContractSchema(() =>
15389
- z.enum(["explicit", "session", "deployment", "continuation"]),
15390
- );
15576
+ export const TurnExecutionLatencyModeSourceV1 =
15577
+ /* @__PURE__ */ defineModelContractSchema(() =>
15578
+ z.enum(["explicit", "session", "deployment", "continuation"]),
15579
+ );
15391
15580
  export type TurnExecutionLatencyModeSourceV1 = z.infer<typeof TurnExecutionLatencyModeSourceV1>;
15392
15581
 
15393
15582
  /**
@@ -15589,59 +15778,60 @@ export const ClientModel = /* @__PURE__ */ defineModelContractSchema(() =>
15589
15778
  );
15590
15779
  export type ClientModel = z.infer<typeof ClientModel>;
15591
15780
 
15592
- export const ModelCredentialReadinessV1 = /* @__PURE__ */ defineModelContractSchema(() =>
15593
- z
15594
- .object({
15595
- status: z.enum(["ready", "not_ready", "error"]),
15596
- reason: z
15597
- .enum([
15598
- "missing_credential",
15599
- "needs_reauth",
15600
- "prerequisites_missing",
15601
- "resolver_error",
15602
- "observation_stale",
15603
- ])
15604
- .nullable(),
15605
- basis: z.enum(["configuration", "connection", "resolver"]),
15606
- checkedAt: z.string().datetime().nullable(),
15607
- })
15608
- .strict()
15609
- .superRefine((readiness, context) => {
15610
- if ((readiness.status === "ready") !== (readiness.reason === null)) {
15611
- context.addIssue({
15612
- code: "custom",
15613
- path: ["reason"],
15614
- message: "ready credential state requires no reason; non-ready state requires a reason",
15615
- });
15616
- }
15617
- if ((readiness.status === "error") !== (readiness.reason === "resolver_error")) {
15618
- context.addIssue({
15619
- code: "custom",
15620
- path: ["reason"],
15621
- message:
15622
- "credential errors require resolver_error and resolver_error requires error status",
15623
- });
15624
- }
15625
- if (
15626
- readiness.basis === "resolver" &&
15627
- readiness.status === "ready" &&
15628
- readiness.checkedAt === null
15629
- ) {
15630
- context.addIssue({
15631
- code: "custom",
15632
- path: ["checkedAt"],
15633
- message: "resolver readiness requires an observation timestamp",
15634
- });
15635
- }
15636
- if (readiness.reason === "observation_stale" && readiness.checkedAt === null) {
15637
- context.addIssue({
15638
- code: "custom",
15639
- path: ["checkedAt"],
15640
- message: "a stale observation requires its observation timestamp",
15641
- });
15642
- }
15643
- }),
15644
- );
15781
+ export const ModelCredentialReadinessV1 =
15782
+ /* @__PURE__ */ defineModelContractSchema(() =>
15783
+ z
15784
+ .object({
15785
+ status: z.enum(["ready", "not_ready", "error"]),
15786
+ reason: z
15787
+ .enum([
15788
+ "missing_credential",
15789
+ "needs_reauth",
15790
+ "prerequisites_missing",
15791
+ "resolver_error",
15792
+ "observation_stale",
15793
+ ])
15794
+ .nullable(),
15795
+ basis: z.enum(["configuration", "connection", "resolver"]),
15796
+ checkedAt: z.string().datetime().nullable(),
15797
+ })
15798
+ .strict()
15799
+ .superRefine((readiness, context) => {
15800
+ if ((readiness.status === "ready") !== (readiness.reason === null)) {
15801
+ context.addIssue({
15802
+ code: "custom",
15803
+ path: ["reason"],
15804
+ message: "ready credential state requires no reason; non-ready state requires a reason",
15805
+ });
15806
+ }
15807
+ if ((readiness.status === "error") !== (readiness.reason === "resolver_error")) {
15808
+ context.addIssue({
15809
+ code: "custom",
15810
+ path: ["reason"],
15811
+ message:
15812
+ "credential errors require resolver_error and resolver_error requires error status",
15813
+ });
15814
+ }
15815
+ if (
15816
+ readiness.basis === "resolver" &&
15817
+ readiness.status === "ready" &&
15818
+ readiness.checkedAt === null
15819
+ ) {
15820
+ context.addIssue({
15821
+ code: "custom",
15822
+ path: ["checkedAt"],
15823
+ message: "resolver readiness requires an observation timestamp",
15824
+ });
15825
+ }
15826
+ if (readiness.reason === "observation_stale" && readiness.checkedAt === null) {
15827
+ context.addIssue({
15828
+ code: "custom",
15829
+ path: ["checkedAt"],
15830
+ message: "a stale observation requires its observation timestamp",
15831
+ });
15832
+ }
15833
+ }),
15834
+ );
15645
15835
  export type ModelCredentialReadinessV1 = z.infer<typeof ModelCredentialReadinessV1>;
15646
15836
 
15647
15837
  export const ModelAvailabilityV1 = /* @__PURE__ */ defineModelContractSchema(() =>
@@ -15664,21 +15854,23 @@ export const ModelAvailabilityV1 = /* @__PURE__ */ defineModelContractSchema(()
15664
15854
  );
15665
15855
  export type ModelAvailabilityV1 = z.infer<typeof ModelAvailabilityV1>;
15666
15856
 
15667
- export const WorkspaceModelCatalogModel = /* @__PURE__ */ defineModelContractSchema(() =>
15668
- ClientModel.extend({
15669
- credentialReadiness: ModelCredentialReadinessV1,
15670
- /** Exact workspace-policy verdict without exposing provider identity. */
15671
- policyAllowed: z.boolean().optional(),
15672
- availability: ModelAvailabilityV1,
15673
- }),
15674
- );
15857
+ export const WorkspaceModelCatalogModel =
15858
+ /* @__PURE__ */ defineModelContractSchema(() =>
15859
+ ClientModel.extend({
15860
+ credentialReadiness: ModelCredentialReadinessV1,
15861
+ /** Exact workspace-policy verdict without exposing provider identity. */
15862
+ policyAllowed: z.boolean().optional(),
15863
+ availability: ModelAvailabilityV1,
15864
+ }),
15865
+ );
15675
15866
  export type WorkspaceModelCatalogModel = z.infer<typeof WorkspaceModelCatalogModel>;
15676
15867
 
15677
- export const WorkspaceModelCatalogResponse = /* @__PURE__ */ defineModelContractSchema(() =>
15678
- z.object({
15679
- models: z.array(WorkspaceModelCatalogModel),
15680
- }),
15681
- );
15868
+ export const WorkspaceModelCatalogResponse =
15869
+ /* @__PURE__ */ defineModelContractSchema(() =>
15870
+ z.object({
15871
+ models: z.array(WorkspaceModelCatalogModel),
15872
+ }),
15873
+ );
15682
15874
  export type WorkspaceModelCatalogResponse = z.infer<typeof WorkspaceModelCatalogResponse>;
15683
15875
 
15684
15876
  /**
@@ -15709,6 +15901,9 @@ export const ClientConfig = /* @__PURE__ */ defineModelContractSchema(() =>
15709
15901
  models: z.array(ClientModel).default([]),
15710
15902
  defaultReasoningEffort: ReasoningEffort,
15711
15903
  allowedReasoningEfforts: z.array(ReasoningEffort).min(1),
15904
+ // Client-safe execution default. The schedule editor uses this to avoid
15905
+ // presenting a targetless "managed" choice on self-hosted deployments.
15906
+ defaultSandboxBackend: SandboxBackend.default("modal"),
15712
15907
  mcpServers: z
15713
15908
  .array(
15714
15909
  z.object({