@opengeni/contracts 2.6.0-canary.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.
Files changed (37) hide show
  1. package/dist/agent-authored-durable-text.d.ts +3 -0
  2. package/dist/agent-topology.d.ts +292 -0
  3. package/dist/atlassian.js +2 -1
  4. package/dist/chunk-4IVHBXRI.js +221 -0
  5. package/dist/chunk-4IVHBXRI.js.map +1 -0
  6. package/dist/{chunk-MJ3K6ICH.js → chunk-AWNGBY5I.js} +7153 -6946
  7. package/dist/chunk-AWNGBY5I.js.map +1 -0
  8. package/dist/company-profile.d.ts +275 -1
  9. package/dist/connection-authority.js +2 -1
  10. package/dist/connection-authority.js.map +1 -1
  11. package/dist/google-drive.js +2 -1
  12. package/dist/google-drive.js.map +1 -1
  13. package/dist/index.d.ts +273 -140
  14. package/dist/index.js +107 -5
  15. package/dist/managed-auth-session-sets.d.ts +19 -0
  16. package/dist/managed-auth-session-sets.js +12 -1
  17. package/dist/managed-auth-session-sets.js.map +1 -1
  18. package/dist/organization-membership-lifecycle.d.ts +3 -0
  19. package/dist/permissions.d.ts +1 -0
  20. package/dist/personal-github.js +2 -1
  21. package/dist/personal-github.js.map +1 -1
  22. package/dist/session-titles.d.ts +9 -0
  23. package/dist/session-titles.js +17 -0
  24. package/dist/session-titles.js.map +1 -0
  25. package/dist/session-topology-primitives.d.ts +22 -0
  26. package/dist/work-claims.d.ts +411 -0
  27. package/package.json +5 -1
  28. package/src/agent-authored-durable-text.ts +13 -6
  29. package/src/agent-topology.ts +69 -0
  30. package/src/company-profile.ts +46 -1
  31. package/src/index.ts +385 -249
  32. package/src/managed-auth-session-sets.ts +18 -0
  33. package/src/permissions.ts +1 -0
  34. package/src/session-titles.ts +12 -5
  35. package/src/session-topology-primitives.ts +21 -0
  36. package/src/work-claims.ts +266 -0
  37. package/dist/chunk-MJ3K6ICH.js.map +0 -1
package/src/index.ts CHANGED
@@ -13,6 +13,12 @@ import { ClientResumableVoiceInputConfig } from "./transcription-recordings";
13
13
  import { MediaGenerationResult } from "./video-generation";
14
14
  import { KnowledgeProviderCitation } from "./knowledge";
15
15
  import { XaiProviderAccountAuthoritySnapshotV1 } from "./xai-provider-account-authority";
16
+ import {
17
+ MAX_NESTED_AGENT_DEPTH,
18
+ NestedAgentDepthValue,
19
+ SessionGoalStatus,
20
+ SessionStatus,
21
+ } from "./session-topology-primitives";
16
22
 
17
23
  export * from "./slack-bot-scopes";
18
24
  export * from "./slack-task-policy";
@@ -31,6 +37,9 @@ export * from "./interaction";
31
37
  export * from "./sandbox-file-artifacts";
32
38
  export * from "./permissions";
33
39
  export * from "./session-titles";
40
+ export * from "./session-topology-primitives";
41
+ export * from "./agent-topology";
42
+ export * from "./work-claims";
34
43
 
35
44
  export {
36
45
  CreateWorkspaceArtifactRequest,
@@ -149,18 +158,6 @@ export {
149
158
  type ModalCheckpointProviderBinding,
150
159
  } from "./checkpoint-provider-bindings";
151
160
 
152
- export const SessionStatus = z.enum([
153
- "queued",
154
- "running",
155
- "idle",
156
- "requires_action",
157
- "recovering",
158
- "waiting_capacity",
159
- "failed",
160
- "cancelled",
161
- ]);
162
- export type SessionStatus = z.infer<typeof SessionStatus>;
163
-
164
161
  // 12 backends; 3-way enum parity (contracts / sdk / deployment) is pinned by
165
162
  // `packages/sdk/test/contract-parity.test.ts`. Every member is ADDITIVE AT THE
166
163
  // END (the parity test pins positions): the original four, then the six cloud
@@ -680,10 +677,6 @@ export const ErrorEnvelope = z.object({
680
677
  });
681
678
  export type ErrorEnvelope = z.infer<typeof ErrorEnvelope>;
682
679
 
683
- /** Physical ceiling of the PostgreSQL integer columns that persist depth policy. */
684
- export const MAX_NESTED_AGENT_DEPTH = 2_147_483_647;
685
- export const NestedAgentDepthValue = z.number().int().nonnegative().max(MAX_NESTED_AGENT_DEPTH);
686
- export type NestedAgentDepthValue = z.infer<typeof NestedAgentDepthValue>;
687
680
  /** A denied child can be one greater than the persisted PostgreSQL int ceiling. */
688
681
  export const NestedAgentDepthAttemptValue = z
689
682
  .number()
@@ -779,6 +772,8 @@ export const FIRST_PARTY_MCP_TOOL_NAMES = [
779
772
  "task_note_save",
780
773
  "task_note_archive",
781
774
  "task_note_replace",
775
+ "work_claim_upsert",
776
+ "work_claim_release",
782
777
  "knowledge_propose",
783
778
  "knowledge_correct",
784
779
  "task_note_promote_knowledge",
@@ -947,15 +942,8 @@ const FIRST_PARTY_IN_PROCESS_TOOL_NAME_SET = new Set<FirstPartyMcpToolName>(
947
942
  * trustworthy logical-delivery identity. Server-owned Slack delivery paths
948
943
  * call the internal client directly with their own durable operation IDs.
949
944
  */
950
- // Names kept so previously written data still parses - immutable scheduled-task
951
- // execution snapshots recorded the tool set that was default at the time, and
952
- // they are strictly re-parsed on replay. Retiring a tool must not strand an
953
- // accepted occurrence. These are never registered, never default, and never
954
- // authorized; they exist so history stays readable.
955
945
  const FIRST_PARTY_COMPATIBILITY_ONLY_TOOL_NAMES = [
956
946
  "slack_bot_post_message",
957
- "memory_save",
958
- "memory_correct",
959
947
  ] as const satisfies readonly FirstPartyMcpToolName[];
960
948
 
961
949
  const FIRST_PARTY_COMPATIBILITY_ONLY_TOOL_NAME_SET = new Set<FirstPartyMcpToolName>(
@@ -988,10 +976,6 @@ export const EDITABLE_ARTIFACT_MCP_CODEMODE_PATHS = {
988
976
  */
989
977
  export const DEFAULT_FIRST_PARTY_MCP_TOOLS = FIRST_PARTY_MCP_TOOL_NAMES.filter(
990
978
  (name) =>
991
- // Memory V1 writes are retired entirely; `remember` and task-note
992
- // promotion own durable agent writes.
993
- name !== "memory_save" &&
994
- name !== "memory_correct" &&
995
979
  !name.startsWith("social_") &&
996
980
  !name.startsWith("x_") &&
997
981
  !name.startsWith("reddit_") &&
@@ -2965,6 +2949,28 @@ export const CreateWorkspaceRequest = z.object({
2965
2949
  });
2966
2950
  export type CreateWorkspaceRequest = z.infer<typeof CreateWorkspaceRequest>;
2967
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
+
2968
2974
  export const UpdateWorkspaceRequest = z
2969
2975
  .object({
2970
2976
  name: z.string().min(1).optional(),
@@ -3007,6 +3013,15 @@ export const CreateApiKeyResponse = z.object({
3007
3013
  });
3008
3014
  export type CreateApiKeyResponse = z.infer<typeof CreateApiKeyResponse>;
3009
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
+
3010
3025
  // A person (or API key) with access to a workspace: one workspace_memberships
3011
3026
  // row. `subjectId` is `user:<betterAuthUserId>` or `api_key:<id>`; the People
3012
3027
  // surface lists the `user:` subjects (api_key subjects belong to API keys).
@@ -3024,10 +3039,26 @@ export const ListWorkspaceMembersResponse = z.object({
3024
3039
  });
3025
3040
  export type ListWorkspaceMembersResponse = z.infer<typeof ListWorkspaceMembersResponse>;
3026
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
+
3027
3058
  export const AddWorkspaceMemberRequest = z.object({
3028
- // Resolved against the managed (Better Auth) users; email invites for
3029
- // not-yet-registered users are deferred, so an unknown email returns 404.
3030
- 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(),
3031
3062
  role: z.string().min(1).optional(),
3032
3063
  permissions: z.array(Permission),
3033
3064
  });
@@ -5563,9 +5594,6 @@ export type SessionControlState = z.infer<typeof SessionControlState>;
5563
5594
  export const WorkspaceInferenceState = z.enum(["active", "paused"]);
5564
5595
  export type WorkspaceInferenceState = z.infer<typeof WorkspaceInferenceState>;
5565
5596
 
5566
- export const SessionGoalStatus = z.enum(["active", "paused", "completed"]);
5567
- export type SessionGoalStatus = z.infer<typeof SessionGoalStatus>;
5568
-
5569
5597
  export const SessionGoalCreatedBy = z.enum(["api", "agent", "scheduled_task"]);
5570
5598
  export type SessionGoalCreatedBy = z.infer<typeof SessionGoalCreatedBy>;
5571
5599
 
@@ -7633,17 +7661,74 @@ export function renderSessionSystemUpdateBatch(
7633
7661
  ].join("\n");
7634
7662
  }
7635
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
+
7636
7717
  export function sessionSystemUpdateBatchHistoryItem(
7637
7718
  updates: Parameters<typeof renderSessionSystemUpdateBatch>[0],
7638
7719
  goalSnapshot?: SessionGoalSnapshot,
7639
- ): { type: "message"; role: "system"; content: string } {
7720
+ options: { promoteScheduledOccurrenceToUser?: boolean } = {},
7721
+ ): { type: "message"; role: "system" | "user"; content: string } {
7640
7722
  const goalContext = renderSessionGoalContext(goalSnapshot);
7723
+ const scheduledTask = options.promoteScheduledOccurrenceToUser
7724
+ ? renderScheduledOccurrenceTaskBatch(updates)
7725
+ : null;
7641
7726
  return {
7642
7727
  type: "message",
7643
- role: "system",
7728
+ role: scheduledTask ? "user" : "system",
7644
7729
  content: [
7645
7730
  ...(goalContext ? [`${SESSION_GOAL_CONTEXT_LABEL}\n${goalContext}`] : []),
7646
- renderSessionSystemUpdateBatch(updates),
7731
+ scheduledTask ?? renderSessionSystemUpdateBatch(updates),
7647
7732
  ].join("\n\n"),
7648
7733
  };
7649
7734
  }
@@ -7654,6 +7739,48 @@ export const VariableSetVariableName = z
7654
7739
  .max(128);
7655
7740
  export type VariableSetVariableName = z.infer<typeof VariableSetVariableName>;
7656
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
+
7657
7784
  function withVariableSetIdAlias<T extends z.ZodRawShape>(
7658
7785
  shape: T,
7659
7786
  options: { rejectKeys?: readonly string[] } = {},
@@ -8491,17 +8618,24 @@ function scheduledTaskBoundedString(maxBytes: number, label: string) {
8491
8618
  }
8492
8619
 
8493
8620
  /** Ingress-bounded task name for create/update requests. */
8494
- export const ScheduledTaskNameInput = /* @__PURE__ */ scheduledTaskBoundedString(
8495
- SCHEDULED_TASK_NAME_MAX_BYTES,
8496
- "scheduled task name",
8497
- );
8621
+ export const ScheduledTaskNameInput =
8622
+ /* @__PURE__ */ scheduledTaskBoundedString(SCHEDULED_TASK_NAME_MAX_BYTES, "scheduled task name");
8498
8623
  /** Ingress-bounded task metadata for create/update requests. */
8499
- export const ScheduledTaskMetadataInput = /* @__PURE__ */ scheduledTaskBoundedJsonObject(
8500
- SCHEDULED_TASK_METADATA_MAX_BYTES,
8501
- "scheduled task metadata",
8502
- );
8624
+ export const ScheduledTaskMetadataInput =
8625
+ /* @__PURE__ */ scheduledTaskBoundedJsonObject(
8626
+ SCHEDULED_TASK_METADATA_MAX_BYTES,
8627
+ "scheduled task metadata",
8628
+ );
8503
8629
 
8504
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();
8505
8639
  return {
8506
8640
  prompt: bounded
8507
8641
  ? scheduledTaskBoundedString(SCHEDULED_TASK_PROMPT_MAX_BYTES, "scheduled task prompt")
@@ -8527,6 +8661,10 @@ function scheduledTaskAgentConfigShape(bounded: boolean) {
8527
8661
  : z.string().min(1).optional(),
8528
8662
  reasoningEffort: ReasoningEffort.optional(),
8529
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(),
8530
8668
  goal: GoalSpec.optional(),
8531
8669
  // Incident telemetry is the only special execution class. Omission keeps
8532
8670
  // every existing task on the byte-compatible ordinary dispatch path.
@@ -8568,6 +8706,20 @@ export type ScheduledTaskAgentConfig = z.infer<typeof ScheduledTaskAgentConfig>;
8568
8706
  export const ScheduledTaskAgentConfigInput = /* @__PURE__ */ z
8569
8707
  .object(scheduledTaskAgentConfigShape(true))
8570
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
+ }
8571
8723
  if (scheduledTaskJsonUtf8Bytes(value) > SCHEDULED_TASK_AGENT_CONFIG_MAX_BYTES) {
8572
8724
  context.addIssue({
8573
8725
  code: "custom",
@@ -8892,6 +9044,13 @@ const CreateAgentScheduledTaskRequest = /* @__PURE__ */ withVariableSetIdAlias({
8892
9044
  message: "agentConfig.goal cannot be used with an existing-session target",
8893
9045
  });
8894
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
+ }
8895
9054
  });
8896
9055
 
8897
9056
  const CreateKnowledgeSourceSyncScheduledTaskRequest = /* @__PURE__ */ z
@@ -8926,48 +9085,59 @@ export const CreateScheduledTaskRequest = /* @__PURE__ */ z.union([
8926
9085
  ]);
8927
9086
  export type CreateScheduledTaskRequest = z.infer<typeof CreateScheduledTaskRequest>;
8928
9087
 
8929
- export const UpdateScheduledTaskRequest = /* @__PURE__ */ withVariableSetIdAlias({
8930
- name: ScheduledTaskNameInput.optional(),
8931
- schedule: ScheduledTaskScheduleSpec.optional(),
8932
- runMode: ScheduledTaskRunMode.optional(),
8933
- overlapPolicy: ScheduledTaskOverlapPolicy.optional(),
8934
- action: ScheduledTaskAction.optional(),
8935
- targetSessionId: z.string().uuid().nullable().optional(),
8936
- connectionAuthorities: McpConnectionAuthoritySelections.optional(),
8937
- agentConfig: ScheduledTaskAgentConfigInput.optional(),
8938
- status: ScheduledTaskStatus.optional(),
8939
- variableSetId: z.string().uuid().nullable().optional(),
8940
- environmentId: z.string().uuid().nullable().optional(),
8941
- // The rig each run binds to (M3); null clears it. Its active version is
8942
- // resolved per fire, so an update takes effect on the next dispatch.
8943
- rigId: z.string().uuid().nullable().optional(),
8944
- metadata: z.record(z.string(), z.unknown()).optional(),
8945
- }).superRefine((value, context) => {
8946
- if (value.targetSessionId && value.runMode && value.runMode !== "existing_session") {
8947
- context.addIssue({
8948
- code: "custom",
8949
- path: ["targetSessionId"],
8950
- message: "targetSessionId requires runMode=existing_session",
8951
- });
8952
- }
8953
- if (value.runMode === "existing_session" && value.targetSessionId === null) {
8954
- context.addIssue({
8955
- code: "custom",
8956
- path: ["targetSessionId"],
8957
- message: "targetSessionId cannot be null when runMode=existing_session",
8958
- });
8959
- }
8960
- if (
8961
- value.agentConfig?.goal &&
8962
- (value.runMode === "existing_session" || Boolean(value.targetSessionId))
8963
- ) {
8964
- context.addIssue({
8965
- code: "custom",
8966
- path: ["agentConfig", "goal"],
8967
- message: "agentConfig.goal cannot be used with an existing-session target",
8968
- });
8969
- }
8970
- });
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
+ });
8971
9141
  export type UpdateScheduledTaskRequest = z.infer<typeof UpdateScheduledTaskRequest>;
8972
9142
 
8973
9143
  /**
@@ -11672,8 +11842,11 @@ export const Session = z.object({
11672
11842
  queuedDescendants: z.number().int().nonnegative(),
11673
11843
  attentionDescendants: z.number().int().nonnegative(),
11674
11844
  pausedDescendants: z.number().int().nonnegative(),
11845
+ /** Historical failed lifecycle states, including already-reviewed failures. */
11675
11846
  failedDescendants: z.number().int().nonnegative(),
11676
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(),
11677
11850
  activelyWorkingDescendants: z.number().int().nonnegative().optional(),
11678
11851
  /**
11679
11852
  * Earliest moment one of the counted `attentionDescendants` entered
@@ -11725,57 +11898,6 @@ export const SessionListResponse = z.object({
11725
11898
  });
11726
11899
  export type SessionListResponse = z.infer<typeof SessionListResponse>;
11727
11900
 
11728
- /** Compact, bounded session projection for workspace agent-topology browsers. */
11729
- export const AgentTopologySession = z.object({
11730
- id: z.string().uuid(),
11731
- title: z.string().nullable(),
11732
- titleTruncated: z.boolean(),
11733
- parentSessionId: z.string().uuid().nullable(),
11734
- rootSessionId: z.string().uuid(),
11735
- nestedAgentDepth: NestedAgentDepthValue,
11736
- ancestorPath: z.array(
11737
- z.object({
11738
- id: z.string().uuid(),
11739
- title: z.string().nullable(),
11740
- titleTruncated: z.boolean(),
11741
- }),
11742
- ),
11743
- status: SessionStatus,
11744
- pause: z.object({
11745
- state: z.enum(["active", "paused"]),
11746
- additionalBlockerCount: z.number().int().nonnegative(),
11747
- source: z
11748
- .object({
11749
- kind: z.enum(["session", "workspace"]),
11750
- sessionId: z.string().uuid().optional(),
11751
- displayName: z.string(),
11752
- displayNameTruncated: z.boolean(),
11753
- })
11754
- .nullable(),
11755
- }),
11756
- children: z.object({
11757
- directChildren: z.number().int().nonnegative(),
11758
- totalDescendants: z.number().int().nonnegative(),
11759
- runningDescendants: z.number().int().nonnegative(),
11760
- queuedDescendants: z.number().int().nonnegative(),
11761
- attentionDescendants: z.number().int().nonnegative(),
11762
- pausedDescendants: z.number().int().nonnegative(),
11763
- failedDescendants: z.number().int().nonnegative(),
11764
- truncated: z.boolean(),
11765
- }),
11766
- createdAt: z.string(),
11767
- updatedAt: z.string(),
11768
- });
11769
- export type AgentTopologySession = z.infer<typeof AgentTopologySession>;
11770
-
11771
- export const AgentTopologyPageResponse = z.object({
11772
- sessions: z.array(AgentTopologySession),
11773
- total: z.number().int().nonnegative(),
11774
- hasMore: z.boolean(),
11775
- nextCursor: z.string().nullable(),
11776
- });
11777
- export type AgentTopologyPageResponse = z.infer<typeof AgentTopologyPageResponse>;
11778
-
11779
11901
  // Recursive: the TS type is declared first so the schema annotation can carry
11780
11902
  // the FULL recursive shape (a shallow annotation loses type information for
11781
11903
  // contracts consumers after one level of nesting).
@@ -14557,6 +14679,10 @@ export const ClientAuthConfig = z.discriminatedUnion("mode", [
14557
14679
  mode: z.literal("managedSession"),
14558
14680
  session: z.literal("cookie"),
14559
14681
  emailVerificationRequired: z.boolean().default(true),
14682
+ socialProviders: z
14683
+ .array(z.enum(["google", "github"]))
14684
+ .max(2)
14685
+ .default([]),
14560
14686
  }),
14561
14687
  ]);
14562
14688
  export type ClientAuthConfig = z.infer<typeof ClientAuthConfig>;
@@ -14655,10 +14781,10 @@ export const SessionCapabilities = z.object({
14655
14781
  codecs: z.array(z.enum(["h264-mp4", "vp9-webm"])),
14656
14782
  reason: CapabilityUnavailableReason.nullable(),
14657
14783
  }),
14658
- // The AGENT drives the SAME :0 (xdotool/XTEST + scrot) the human watches; the
14659
- // human viewer plane is read-only by default (§6). `available` == desktop-
14660
- // capable backend && computerUseEnabled; `readOnly` reports whether the agent
14661
- // 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.
14662
14788
  ComputerUse: z.object({
14663
14789
  available: z.boolean(),
14664
14790
  readOnly: z.boolean(),
@@ -15338,9 +15464,8 @@ function defineModelContractSchema<Schema>(factory: () => Schema): Schema {
15338
15464
  return factory();
15339
15465
  }
15340
15466
 
15341
- export const ModelCapabilitySupportV1 = /* @__PURE__ */ defineModelContractSchema(() =>
15342
- z.enum(["supported", "unsupported", "unknown"]),
15343
- );
15467
+ export const ModelCapabilitySupportV1 =
15468
+ /* @__PURE__ */ defineModelContractSchema(() => z.enum(["supported", "unsupported", "unknown"]));
15344
15469
  export type ModelCapabilitySupportV1 = z.infer<typeof ModelCapabilitySupportV1>;
15345
15470
 
15346
15471
  export const ModelCapabilityStateV1 = /* @__PURE__ */ defineModelContractSchema(() =>
@@ -15388,28 +15513,29 @@ export const ModelCapabilitiesV1 = /* @__PURE__ */ defineModelContractSchema(()
15388
15513
  );
15389
15514
  export type ModelCapabilitiesV1 = z.infer<typeof ModelCapabilitiesV1>;
15390
15515
 
15391
- export const ModelCredentialSourceV1 = /* @__PURE__ */ defineModelContractSchema(() =>
15392
- z.union([
15393
- z
15394
- .object({
15395
- kind: z.literal("deployment"),
15396
- mechanism: z.enum(["api_key", "azure_ad_bearer"]),
15397
- })
15398
- .strict(),
15399
- z
15400
- .object({
15401
- kind: z.literal("connected_subscription"),
15402
- provider: z.enum(["codex", "xai"]),
15403
- })
15404
- .strict(),
15405
- z
15406
- .object({
15407
- kind: z.literal("workspace_connection"),
15408
- mechanism: z.literal("api_key"),
15409
- })
15410
- .strict(),
15411
- ]),
15412
- );
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
+ );
15413
15539
  export type ModelCredentialSourceV1 = z.infer<typeof ModelCredentialSourceV1>;
15414
15540
 
15415
15541
  const TurnExecutionCredentialSourceV1 = z.union([
@@ -15422,31 +15548,35 @@ const TurnExecutionCredentialSourceV1 = z.union([
15422
15548
  .strict(),
15423
15549
  ]);
15424
15550
 
15425
- export const ModelBillingAttributionV1 = /* @__PURE__ */ defineModelContractSchema(() =>
15426
- z
15427
- .object({
15428
- upstreamPayer: z.enum(["deployment", "workspace", "connected_subscription"]),
15429
- metering: z.enum(["opengeni_credits", "external"]),
15430
- })
15431
- .strict(),
15432
- );
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
+ );
15433
15560
  export type ModelBillingAttributionV1 = z.infer<typeof ModelBillingAttributionV1>;
15434
15561
 
15435
15562
  export const TURN_EXECUTION_POLICY_METADATA_KEY = "turnExecutionPolicyV1" as const;
15436
15563
 
15437
- export const TurnExecutionModelSourceV1 = /* @__PURE__ */ defineModelContractSchema(() =>
15438
- z.enum(["explicit", "session", "deployment", "continuation"]),
15439
- );
15564
+ export const TurnExecutionModelSourceV1 =
15565
+ /* @__PURE__ */ defineModelContractSchema(() =>
15566
+ z.enum(["explicit", "session", "deployment", "continuation"]),
15567
+ );
15440
15568
  export type TurnExecutionModelSourceV1 = z.infer<typeof TurnExecutionModelSourceV1>;
15441
15569
 
15442
- export const TurnExecutionReasoningSourceV1 = /* @__PURE__ */ defineModelContractSchema(() =>
15443
- z.enum(["explicit", "session", "deployment", "continuation"]),
15444
- );
15570
+ export const TurnExecutionReasoningSourceV1 =
15571
+ /* @__PURE__ */ defineModelContractSchema(() =>
15572
+ z.enum(["explicit", "session", "deployment", "continuation"]),
15573
+ );
15445
15574
  export type TurnExecutionReasoningSourceV1 = z.infer<typeof TurnExecutionReasoningSourceV1>;
15446
15575
 
15447
- export const TurnExecutionLatencyModeSourceV1 = /* @__PURE__ */ defineModelContractSchema(() =>
15448
- z.enum(["explicit", "session", "deployment", "continuation"]),
15449
- );
15576
+ export const TurnExecutionLatencyModeSourceV1 =
15577
+ /* @__PURE__ */ defineModelContractSchema(() =>
15578
+ z.enum(["explicit", "session", "deployment", "continuation"]),
15579
+ );
15450
15580
  export type TurnExecutionLatencyModeSourceV1 = z.infer<typeof TurnExecutionLatencyModeSourceV1>;
15451
15581
 
15452
15582
  /**
@@ -15648,59 +15778,60 @@ export const ClientModel = /* @__PURE__ */ defineModelContractSchema(() =>
15648
15778
  );
15649
15779
  export type ClientModel = z.infer<typeof ClientModel>;
15650
15780
 
15651
- export const ModelCredentialReadinessV1 = /* @__PURE__ */ defineModelContractSchema(() =>
15652
- z
15653
- .object({
15654
- status: z.enum(["ready", "not_ready", "error"]),
15655
- reason: z
15656
- .enum([
15657
- "missing_credential",
15658
- "needs_reauth",
15659
- "prerequisites_missing",
15660
- "resolver_error",
15661
- "observation_stale",
15662
- ])
15663
- .nullable(),
15664
- basis: z.enum(["configuration", "connection", "resolver"]),
15665
- checkedAt: z.string().datetime().nullable(),
15666
- })
15667
- .strict()
15668
- .superRefine((readiness, context) => {
15669
- if ((readiness.status === "ready") !== (readiness.reason === null)) {
15670
- context.addIssue({
15671
- code: "custom",
15672
- path: ["reason"],
15673
- message: "ready credential state requires no reason; non-ready state requires a reason",
15674
- });
15675
- }
15676
- if ((readiness.status === "error") !== (readiness.reason === "resolver_error")) {
15677
- context.addIssue({
15678
- code: "custom",
15679
- path: ["reason"],
15680
- message:
15681
- "credential errors require resolver_error and resolver_error requires error status",
15682
- });
15683
- }
15684
- if (
15685
- readiness.basis === "resolver" &&
15686
- readiness.status === "ready" &&
15687
- readiness.checkedAt === null
15688
- ) {
15689
- context.addIssue({
15690
- code: "custom",
15691
- path: ["checkedAt"],
15692
- message: "resolver readiness requires an observation timestamp",
15693
- });
15694
- }
15695
- if (readiness.reason === "observation_stale" && readiness.checkedAt === null) {
15696
- context.addIssue({
15697
- code: "custom",
15698
- path: ["checkedAt"],
15699
- message: "a stale observation requires its observation timestamp",
15700
- });
15701
- }
15702
- }),
15703
- );
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
+ );
15704
15835
  export type ModelCredentialReadinessV1 = z.infer<typeof ModelCredentialReadinessV1>;
15705
15836
 
15706
15837
  export const ModelAvailabilityV1 = /* @__PURE__ */ defineModelContractSchema(() =>
@@ -15723,21 +15854,23 @@ export const ModelAvailabilityV1 = /* @__PURE__ */ defineModelContractSchema(()
15723
15854
  );
15724
15855
  export type ModelAvailabilityV1 = z.infer<typeof ModelAvailabilityV1>;
15725
15856
 
15726
- export const WorkspaceModelCatalogModel = /* @__PURE__ */ defineModelContractSchema(() =>
15727
- ClientModel.extend({
15728
- credentialReadiness: ModelCredentialReadinessV1,
15729
- /** Exact workspace-policy verdict without exposing provider identity. */
15730
- policyAllowed: z.boolean().optional(),
15731
- availability: ModelAvailabilityV1,
15732
- }),
15733
- );
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
+ );
15734
15866
  export type WorkspaceModelCatalogModel = z.infer<typeof WorkspaceModelCatalogModel>;
15735
15867
 
15736
- export const WorkspaceModelCatalogResponse = /* @__PURE__ */ defineModelContractSchema(() =>
15737
- z.object({
15738
- models: z.array(WorkspaceModelCatalogModel),
15739
- }),
15740
- );
15868
+ export const WorkspaceModelCatalogResponse =
15869
+ /* @__PURE__ */ defineModelContractSchema(() =>
15870
+ z.object({
15871
+ models: z.array(WorkspaceModelCatalogModel),
15872
+ }),
15873
+ );
15741
15874
  export type WorkspaceModelCatalogResponse = z.infer<typeof WorkspaceModelCatalogResponse>;
15742
15875
 
15743
15876
  /**
@@ -15768,6 +15901,9 @@ export const ClientConfig = /* @__PURE__ */ defineModelContractSchema(() =>
15768
15901
  models: z.array(ClientModel).default([]),
15769
15902
  defaultReasoningEffort: ReasoningEffort,
15770
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"),
15771
15907
  mcpServers: z
15772
15908
  .array(
15773
15909
  z.object({