@alan-ai-hq/agent-manager-linux-arm64 0.1.198 → 0.1.200

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 (96) hide show
  1. package/alan-agent.cjs +12862 -7992
  2. package/alan-holder.cjs +8550 -4968
  3. package/alan-lease.cjs +808 -200
  4. package/builtin-skills/agent-desktop/SKILL.md +94 -0
  5. package/builtin-skills/alan-artifact/SKILL.md +128 -0
  6. package/builtin-skills/alan-artifact/examples/interactive-diagram.md +50 -0
  7. package/builtin-skills/alan-artifact/examples/prototype.md +53 -0
  8. package/builtin-skills/alan-artifact/examples/test-report.md +55 -0
  9. package/builtin-skills/alan-artifact/references/design.md +39 -0
  10. package/builtin-skills/alan-artifact/references/diagrams.md +20 -0
  11. package/builtin-skills/alan-deck/SKILL.md +189 -0
  12. package/builtin-skills/alan-diagrams/SKILL.md +105 -0
  13. package/builtin-skills/alan-diagrams/references/diagram-catalogue.md +847 -0
  14. package/builtin-skills/alan-docs/SKILL.md +143 -0
  15. package/builtin-skills/alan-docs/references/administration/members-and-teams.md +48 -0
  16. package/builtin-skills/alan-docs/references/administration/org-dashboard.md +19 -0
  17. package/builtin-skills/alan-docs/references/administration/organisation-settings.md +41 -0
  18. package/builtin-skills/alan-docs/references/agents-and-sessions/code-context.md +60 -0
  19. package/builtin-skills/alan-docs/references/agents-and-sessions/coding-agents-and-models.md +78 -0
  20. package/builtin-skills/alan-docs/references/agents-and-sessions/session-lifecycle.md +62 -0
  21. package/builtin-skills/alan-docs/references/agents-and-sessions/start-a-session.md +110 -0
  22. package/builtin-skills/alan-docs/references/automations/automation-runs.md +69 -0
  23. package/builtin-skills/alan-docs/references/automations/create-an-automation.md +143 -0
  24. package/builtin-skills/alan-docs/references/automations/overview.md +77 -0
  25. package/builtin-skills/alan-docs/references/cloud-and-local/cloud-images.md +64 -0
  26. package/builtin-skills/alan-docs/references/cloud-and-local/cloud-sessions-and-execution.md +89 -0
  27. package/builtin-skills/alan-docs/references/cloud-and-local/cloud-setup.md +128 -0
  28. package/builtin-skills/alan-docs/references/cloud-and-local/codex-cli-connector.md +92 -0
  29. package/builtin-skills/alan-docs/references/cloud-and-local/local-execution.md +213 -0
  30. package/builtin-skills/alan-docs/references/cloud-and-local/runtime-recovery.md +60 -0
  31. package/builtin-skills/alan-docs/references/cloud-and-local/sandboxes.md +74 -0
  32. package/builtin-skills/alan-docs/references/cloud-and-local/troubleshooting-and-faq.md +102 -0
  33. package/builtin-skills/alan-docs/references/get-started/connect-azure-devops.md +89 -0
  34. package/builtin-skills/alan-docs/references/get-started/connect-bitbucket.md +86 -0
  35. package/builtin-skills/alan-docs/references/get-started/connect-github.md +114 -0
  36. package/builtin-skills/alan-docs/references/get-started/join-a-team.md +114 -0
  37. package/builtin-skills/alan-docs/references/get-started/product-map.md +96 -0
  38. package/builtin-skills/alan-docs/references/get-started/quickstart.md +158 -0
  39. package/builtin-skills/alan-docs/references/get-started/set-up-your-team.md +200 -0
  40. package/builtin-skills/alan-docs/references/get-started/sign-in.md +104 -0
  41. package/builtin-skills/alan-docs/references/get-started/welcome.md +39 -0
  42. package/builtin-skills/alan-docs/references/integrations/connect-microsoft-teams.md +116 -0
  43. package/builtin-skills/alan-docs/references/integrations/connect-slack.md +164 -0
  44. package/builtin-skills/alan-docs/references/integrations/import-from-linear.md +172 -0
  45. package/builtin-skills/alan-docs/references/plans-and-billing/plans-and-limits.md +115 -0
  46. package/builtin-skills/alan-docs/references/plans-and-billing/usage-and-credits.md +47 -0
  47. package/builtin-skills/alan-docs/references/reference/documents-and-artifacts.md +52 -0
  48. package/builtin-skills/alan-docs/references/reference/faq.md +89 -0
  49. package/builtin-skills/alan-docs/references/reference/feature-catalog.md +89 -0
  50. package/builtin-skills/alan-docs/references/reference/glossary.md +96 -0
  51. package/builtin-skills/alan-docs/references/reference/links-and-ids.md +80 -0
  52. package/builtin-skills/alan-docs/references/reference/roles-and-permissions.md +64 -0
  53. package/builtin-skills/alan-docs/references/reference/statuses.md +86 -0
  54. package/builtin-skills/alan-docs/references/reviews-testing-deploys/deployments.md +28 -0
  55. package/builtin-skills/alan-docs/references/reviews-testing-deploys/pull-requests.md +85 -0
  56. package/builtin-skills/alan-docs/references/reviews-testing-deploys/review-work.md +55 -0
  57. package/builtin-skills/alan-docs/references/reviews-testing-deploys/testing-evidence.md +52 -0
  58. package/builtin-skills/alan-docs/references/skills/plugins-and-mcp.md +24 -0
  59. package/builtin-skills/alan-docs/references/skills/skills.md +103 -0
  60. package/builtin-skills/alan-docs/references/tasks/complete-a-task.md +79 -0
  61. package/builtin-skills/alan-docs/references/tasks/create-a-task.md +67 -0
  62. package/builtin-skills/alan-docs/references/tasks/subtasks-and-status.md +55 -0
  63. package/builtin-skills/alan-docs/references/tasks/task-artifacts.md +56 -0
  64. package/builtin-skills/alan-docs/references/tasks/task-detail.md +65 -0
  65. package/builtin-skills/alan-docs/references/teams-and-planning/cycles.md +93 -0
  66. package/builtin-skills/alan-docs/references/teams-and-planning/documents.md +66 -0
  67. package/builtin-skills/alan-docs/references/teams-and-planning/epics.md +95 -0
  68. package/builtin-skills/alan-docs/references/teams-and-planning/whiteboard.md +52 -0
  69. package/builtin-skills/alan-docs/references/troubleshooting/agent-blocked.md +38 -0
  70. package/builtin-skills/alan-docs/references/troubleshooting/common-problems.md +118 -0
  71. package/builtin-skills/alan-docs/references/troubleshooting/github-access.md +41 -0
  72. package/builtin-skills/alan-docs/references/troubleshooting/missing-artifact.md +47 -0
  73. package/builtin-skills/alan-docs/references/troubleshooting/report-an-issue.md +74 -0
  74. package/builtin-skills/alan-docs/references/troubleshooting/runtime-unavailable.md +49 -0
  75. package/builtin-skills/alan-docs/scripts/generate-references.mjs +363 -0
  76. package/builtin-skills/alan-environment-setup/SKILL.md +320 -0
  77. package/builtin-skills/alan-environment-setup/references/android.md +118 -0
  78. package/builtin-skills/alan-environment-setup/references/troubleshooting.md +33 -0
  79. package/builtin-skills/alan-skill-authoring/SKILL.md +83 -0
  80. package/builtin-skills/alan-tasks/SKILL.md +195 -0
  81. package/builtin-skills/alan-test-android/SKILL.md +224 -0
  82. package/builtin-skills/alan-test-android/scripts/android-up.sh +227 -0
  83. package/builtin-skills/alan-test-android/scripts/install-launch.sh +38 -0
  84. package/builtin-skills/alan-test-android/scripts/record.sh +64 -0
  85. package/builtin-skills/alan-test-android/scripts/ui.py +367 -0
  86. package/builtin-skills/alan-test-desktop/SKILL.md +107 -0
  87. package/builtin-skills/alan-test-desktop/references/linux-recording.md +31 -0
  88. package/builtin-skills/alan-test-feature/SKILL.md +243 -0
  89. package/builtin-skills/alan-test-mobile/SKILL.md +65 -0
  90. package/builtin-skills/alan-test-web/SKILL.md +113 -0
  91. package/builtin-skills/alan-walkthrough/SKILL.md +152 -0
  92. package/builtin-skills/alan-walkthrough/scripts/mark-changes.js +419 -0
  93. package/builtin-skills/alan-walkthrough/scripts/publish-capture.mjs +288 -0
  94. package/builtin-skills/alan-workflows/SKILL.md +235 -0
  95. package/builtin-skills/manifest.json +19 -0
  96. package/package.json +3 -2
package/alan-lease.cjs CHANGED
@@ -20744,7 +20744,7 @@ var init_files = __esm({
20744
20744
  });
20745
20745
 
20746
20746
  // ../shared/src/runtime-v2/workspace.ts
20747
- var gitShaSchema, gitBranchSchema, gitRemoteNameSchema, gitRemoteUrlSchema, statusFingerprintSchema, singleLineSchema, operationIdSchema, repoTargetShape, trustedRepoTargetShape, workspaceStatusRequestSchema, gitStatusRequestSchema, gitCheckpointRequestSchema, gitPushRequestSchema, gitPrepareCheckoutRequestSchema, gitVerifyHeadRequestSchema, workspaceQueryRequestSchema, WORKSPACE_QUERY_METHODS, workspaceQueryMethodSchema, workspaceStatusValueSchema, gitStatusValueSchema, gitCheckpointValueSchema, gitPushValueSchema, gitPrepareCheckoutValueSchema, gitVerifyHeadValueSchema, WORKSPACE_QUERY_ERROR_CODES, workspaceQueryErrorCodeSchema, publishedGitReceiptSchema, workspaceQueryErrorSchema, resultEnvelopeSchema;
20747
+ var gitShaSchema, gitBranchSchema, gitRemoteNameSchema, gitRemoteUrlSchema, statusFingerprintSchema, singleLineSchema, operationIdSchema, repoTargetShape, trustedRepoTargetShape, workspaceStatusRequestSchema, gitStatusRequestSchema, gitCheckpointRequestSchema, gitPushRequestSchema, gitPrepareCheckoutRequestSchema, gitVerifyHeadRequestSchema, workspaceQueryRequestSchema, workspaceStatusValueSchema, gitStatusValueSchema, gitCheckpointValueSchema, gitPushValueSchema, gitPrepareCheckoutValueSchema, gitVerifyHeadValueSchema, WORKSPACE_QUERY_ERROR_CODES, workspaceQueryErrorCodeSchema, publishedGitReceiptSchema, workspaceQueryErrorSchema, resultEnvelopeSchema;
20748
20748
  var init_workspace = __esm({
20749
20749
  "../shared/src/runtime-v2/workspace.ts"() {
20750
20750
  "use strict";
@@ -20831,19 +20831,6 @@ var init_workspace = __esm({
20831
20831
  filesReadRequestSchema,
20832
20832
  filesWatchRequestSchema
20833
20833
  ]);
20834
- WORKSPACE_QUERY_METHODS = [
20835
- "workspace.status",
20836
- "git.status",
20837
- "git.checkpoint",
20838
- "git.push",
20839
- "git.prepare_checkout",
20840
- "git.verify_head",
20841
- "files.tree",
20842
- "files.list_dirs",
20843
- "files.read",
20844
- "files.watch"
20845
- ];
20846
- workspaceQueryMethodSchema = external_exports.enum(WORKSPACE_QUERY_METHODS);
20847
20834
  workspaceStatusValueSchema = external_exports.object({
20848
20835
  repoRoot: machinePathSchema,
20849
20836
  /** null: detached HEAD. */
@@ -20948,7 +20935,7 @@ var init_workspace = __esm({
20948
20935
  });
20949
20936
 
20950
20937
  // ../shared/src/runtime-v2/agent-context.ts
20951
- var AGENT_TEAM_INSTRUCTIONS_MAX_CHARS, agentSessionKindSchema, agentTurnTriggerSchema, agentBranchSourceSchema, agentContextRepositorySchema, agentContextBuildSchema, agentContextEnvironmentSchema, agentContextPullRequestSchema, agentSurfaceAudienceSchema, agentParticipantStandingSchema, agentContextParticipantSchema, agentContextTeamSchema, agentContextHarnessSchema, agentRepoReasonSchema, agentRepoHintSourceSchema, agentRepoHintSchema, agentRepoResolutionSchema, agentContextSurfaceSchema, agentContextSchema;
20938
+ var AGENT_TEAM_INSTRUCTIONS_MAX_CHARS, agentSessionKindSchema, agentTurnTriggerSchema, agentBranchSourceSchema, agentContextRepositorySchema, agentContextBuildSchema, agentContextKnowledgeSchema, agentContextEnvironmentSchema, agentContextPullRequestSchema, agentSurfaceAudienceSchema, agentParticipantStandingSchema, agentContextParticipantSchema, agentContextTeamSchema, agentContextHarnessSchema, agentRepoReasonSchema, agentRepoHintSourceSchema, agentRepoHintSchema, agentRepoResolutionSchema, agentContextSurfaceSchema, agentContextSchema;
20952
20939
  var init_agent_context = __esm({
20953
20940
  "../shared/src/runtime-v2/agent-context.ts"() {
20954
20941
  "use strict";
@@ -20976,7 +20963,12 @@ var init_agent_context = __esm({
20976
20963
  agentContextBuildSchema = external_exports.object({
20977
20964
  id: external_exports.guid(),
20978
20965
  status: external_exports.enum(["queued", "running", "succeeded", "failed", "cancelled", "superseded"]),
20979
- trigger: external_exports.enum(["agent", "base_bumped", "preview", "manual", "push"])
20966
+ trigger: external_exports.enum(["agent", "base_bumped", "preview", "manual", "push"]),
20967
+ failure: external_exports.object({ code: external_exports.string().max(100), message: external_exports.string().max(300) }).nullable().optional()
20968
+ });
20969
+ agentContextKnowledgeSchema = external_exports.object({
20970
+ name: external_exports.string().min(1).max(200),
20971
+ contents: external_exports.string().max(4e3)
20980
20972
  });
20981
20973
  agentContextEnvironmentSchema = external_exports.object({
20982
20974
  id: external_exports.guid(),
@@ -20984,14 +20976,14 @@ var init_agent_context = __esm({
20984
20976
  installCommand: external_exports.string().max(8192).nullable(),
20985
20977
  startCommand: external_exports.string().max(8192).nullable(),
20986
20978
  imageBuildId: external_exports.guid().nullable(),
20987
- /** The repository whose `.alan/` the image build reads; a branch build swaps only its branch. */
20988
20979
  primaryRepository: machinePathSchema.optional(),
20989
20980
  /** Where install steps and the start command run: the repository, or the workspace with several. */
20990
20981
  setupDirectory: machinePathSchema.optional(),
20991
20982
  /** The newest build when it is not the one sessions boot from. */
20992
20983
  pendingBuild: agentContextBuildSchema.optional(),
20993
20984
  /** Saved variable names; values never leave the API. */
20994
- variables: external_exports.array(external_exports.string().min(1).max(200)).max(200)
20985
+ variables: external_exports.array(external_exports.string().min(1).max(200)).max(200),
20986
+ knowledge: external_exports.array(agentContextKnowledgeSchema).max(32).optional()
20995
20987
  });
20996
20988
  agentContextPullRequestSchema = external_exports.object({
20997
20989
  number: external_exports.number().int().positive(),
@@ -21093,6 +21085,473 @@ var init_agent_context = __esm({
21093
21085
  }
21094
21086
  });
21095
21087
 
21088
+ // ../shared/src/harness/models.ts
21089
+ var HARNESS_MAX_OUTPUT_TOKENS, HARNESS_MODEL_SEEDS, DEFAULT_HARNESS_MODEL_ID, HARNESS_REASONING_LEVELS, RETIRED_MODEL_IDS, ROSTER_ROUTING;
21090
+ var init_models = __esm({
21091
+ "../shared/src/harness/models.ts"() {
21092
+ "use strict";
21093
+ HARNESS_MAX_OUTPUT_TOKENS = 32768;
21094
+ HARNESS_MODEL_SEEDS = [
21095
+ {
21096
+ // The picker id stays the DeepSeek Flash alias; the upstream names the exact
21097
+ // build it serves so the pin is auditable and does not drift with the alias.
21098
+ id: "deepseek/deepseek-v4.1-flash",
21099
+ name: "DeepSeek V4.1 Flash",
21100
+ description: "Fast, cheap all-rounder for routine edits and light agent work.",
21101
+ enabled: true,
21102
+ isDefault: true,
21103
+ sortOrder: 10,
21104
+ upstreamModelId: "deepseek/deepseek-v4.1-flash-1017",
21105
+ contextWindow: 1048576,
21106
+ maxOutputTokens: HARNESS_MAX_OUTPUT_TOKENS,
21107
+ inputPriceMicroUsdPerMtok: 15e4,
21108
+ outputPriceMicroUsdPerMtok: 6e5,
21109
+ cacheReadPriceMicroUsdPerMtok: 3e3,
21110
+ reasoning: true,
21111
+ // quirk: the upstream rejects `medium` and `xhigh` outright (AL-5279), so the session effort clamps into this list.
21112
+ reasoningEfforts: ["off", "low", "high", "max"],
21113
+ routing: { tier: "workhorse", priority: 5, strengths: ["speed", "cost", "general"] }
21114
+ },
21115
+ {
21116
+ id: "xiaomi/mimo-v2.6-flash",
21117
+ name: "MiMo-V2.6-Flash",
21118
+ description: "Cheap open-weight workhorse with image input for everyday agent turns.",
21119
+ enabled: true,
21120
+ isDefault: false,
21121
+ sortOrder: 12,
21122
+ upstreamModelId: "xiaomi/mimo-v2.6-flash",
21123
+ contextWindow: 1048576,
21124
+ maxOutputTokens: HARNESS_MAX_OUTPUT_TOKENS,
21125
+ inputPriceMicroUsdPerMtok: 14e4,
21126
+ outputPriceMicroUsdPerMtok: 28e4,
21127
+ cacheReadPriceMicroUsdPerMtok: 2800,
21128
+ reasoning: true,
21129
+ routing: { tier: "workhorse", priority: 10, strengths: ["speed", "cost", "general"] }
21130
+ },
21131
+ {
21132
+ id: "xiaomi/mimo-v2.6-pro",
21133
+ name: "MiMo-V2.6-Pro",
21134
+ description: "Open-weight step-up for UI, debugging and high-stakes agent work.",
21135
+ enabled: true,
21136
+ isDefault: false,
21137
+ sortOrder: 14,
21138
+ upstreamModelId: "xiaomi/mimo-v2.6-pro",
21139
+ contextWindow: 1048576,
21140
+ maxOutputTokens: HARNESS_MAX_OUTPUT_TOKENS,
21141
+ inputPriceMicroUsdPerMtok: 435e3,
21142
+ outputPriceMicroUsdPerMtok: 87e4,
21143
+ cacheReadPriceMicroUsdPerMtok: 3600,
21144
+ reasoning: true,
21145
+ routing: {
21146
+ tier: "strong",
21147
+ priority: 10,
21148
+ strengths: ["architecture", "ui_design", "debugging", "high_stakes"]
21149
+ }
21150
+ },
21151
+ {
21152
+ id: "mistralai/mistral-large-4-0",
21153
+ name: "Mistral Large 4",
21154
+ description: "Open-weight large model with image input; retired from Alan's roster.",
21155
+ enabled: false,
21156
+ isDefault: false,
21157
+ sortOrder: 16,
21158
+ upstreamModelId: "mistralai/mistral-large-4-0",
21159
+ contextWindow: 1048576,
21160
+ maxOutputTokens: HARNESS_MAX_OUTPUT_TOKENS,
21161
+ inputPriceMicroUsdPerMtok: 7e5,
21162
+ outputPriceMicroUsdPerMtok: 21e5,
21163
+ cacheReadPriceMicroUsdPerMtok: 7e4,
21164
+ reasoning: true
21165
+ },
21166
+ {
21167
+ id: "deepseek/deepseek-v4-pro",
21168
+ name: "DeepSeek V4 Pro",
21169
+ description: "Legacy text-only reasoning model; prefer V4.1 Flash for coding.",
21170
+ enabled: false,
21171
+ isDefault: false,
21172
+ sortOrder: 20,
21173
+ upstreamModelId: "deepseek/deepseek-v4-pro",
21174
+ contextWindow: 1048576,
21175
+ maxOutputTokens: HARNESS_MAX_OUTPUT_TOKENS,
21176
+ inputPriceMicroUsdPerMtok: 816234,
21177
+ outputPriceMicroUsdPerMtok: 1632468,
21178
+ cacheReadPriceMicroUsdPerMtok: 68020,
21179
+ reasoning: true
21180
+ },
21181
+ {
21182
+ id: "particle-ai/particle-1",
21183
+ name: "Particle-1",
21184
+ description: "Token-efficient coder: near DeepSeek Flash accuracy at ~45% fewer tokens.",
21185
+ enabled: false,
21186
+ isDefault: false,
21187
+ sortOrder: 25,
21188
+ upstreamModelId: "particle-ai/particle-1",
21189
+ contextWindow: 1048576,
21190
+ maxOutputTokens: HARNESS_MAX_OUTPUT_TOKENS,
21191
+ inputPriceMicroUsdPerMtok: 25e4,
21192
+ outputPriceMicroUsdPerMtok: 1e6,
21193
+ cacheReadPriceMicroUsdPerMtok: 3e3,
21194
+ reasoning: true
21195
+ },
21196
+ {
21197
+ id: "z-ai/glm-5.3",
21198
+ name: "GLM 5.3",
21199
+ description: "Strong open coding agent for terminal work, security and multi-file refactors.",
21200
+ enabled: false,
21201
+ isDefault: false,
21202
+ sortOrder: 30,
21203
+ upstreamModelId: "z-ai/glm-5.3",
21204
+ contextWindow: 1048576,
21205
+ maxOutputTokens: HARNESS_MAX_OUTPUT_TOKENS,
21206
+ inputPriceMicroUsdPerMtok: 8e4,
21207
+ outputPriceMicroUsdPerMtok: 36e5,
21208
+ cacheReadPriceMicroUsdPerMtok: 76e3,
21209
+ reasoning: true
21210
+ },
21211
+ {
21212
+ id: "z-ai/glm-5.3-flash",
21213
+ name: "GLM 5.3 Flash",
21214
+ description: "Cheap multimodal GLM; strong default for routine and UI-heavy coding.",
21215
+ enabled: false,
21216
+ isDefault: false,
21217
+ sortOrder: 40,
21218
+ upstreamModelId: "z-ai/glm-5.3-flash",
21219
+ contextWindow: 1048576,
21220
+ maxOutputTokens: HARNESS_MAX_OUTPUT_TOKENS,
21221
+ inputPriceMicroUsdPerMtok: 15e4,
21222
+ outputPriceMicroUsdPerMtok: 5e5,
21223
+ cacheReadPriceMicroUsdPerMtok: 3e4,
21224
+ reasoning: true
21225
+ },
21226
+ {
21227
+ id: "z-ai/glm-5.3-flashx",
21228
+ name: "GLM 5.3 FlashX",
21229
+ description: "GLM Flash at ~200 tok/s; pay extra when interactive latency matters.",
21230
+ enabled: false,
21231
+ isDefault: false,
21232
+ sortOrder: 50,
21233
+ upstreamModelId: "z-ai/glm-5.3-flashx",
21234
+ contextWindow: 1048576,
21235
+ maxOutputTokens: HARNESS_MAX_OUTPUT_TOKENS,
21236
+ inputPriceMicroUsdPerMtok: 37e4,
21237
+ outputPriceMicroUsdPerMtok: 125e4,
21238
+ cacheReadPriceMicroUsdPerMtok: 9e4,
21239
+ reasoning: true
21240
+ },
21241
+ {
21242
+ id: "z-ai/glm-5.3-prime",
21243
+ name: "GLM 5.3 Prime",
21244
+ description: "GLM 5.3 served faster for long interactive agent sessions; 2x price.",
21245
+ enabled: false,
21246
+ isDefault: false,
21247
+ sortOrder: 60,
21248
+ upstreamModelId: "z-ai/glm-5.3-prime",
21249
+ contextWindow: 1e6,
21250
+ maxOutputTokens: HARNESS_MAX_OUTPUT_TOKENS,
21251
+ inputPriceMicroUsdPerMtok: 28e5,
21252
+ outputPriceMicroUsdPerMtok: 88e5,
21253
+ cacheReadPriceMicroUsdPerMtok: 56e4,
21254
+ reasoning: true
21255
+ },
21256
+ {
21257
+ id: "qwen/qwen3.8-27b",
21258
+ name: "Qwen3.8 27B",
21259
+ description: "Small local-friendly coder; runs on a 24GB Mac, best for offline or light work.",
21260
+ enabled: false,
21261
+ isDefault: false,
21262
+ sortOrder: 70,
21263
+ upstreamModelId: "qwen/qwen3.8-27b",
21264
+ contextWindow: 1e6,
21265
+ maxOutputTokens: HARNESS_MAX_OUTPUT_TOKENS,
21266
+ inputPriceMicroUsdPerMtok: 15e4,
21267
+ outputPriceMicroUsdPerMtok: 1875e3,
21268
+ cacheReadPriceMicroUsdPerMtok: 37500,
21269
+ reasoning: true
21270
+ // Picker-only: Auto Router excludes the qwen/ family (see task-router.service.ts).
21271
+ },
21272
+ {
21273
+ id: "qwen/qwen3.8-max-prime",
21274
+ name: "Qwen3.8 Max Prime",
21275
+ description: "Qwen's flagship for complex agentic and multimodal work, served at high throughput.",
21276
+ enabled: false,
21277
+ isDefault: false,
21278
+ sortOrder: 80,
21279
+ upstreamModelId: "qwen/qwen3.8-max-prime",
21280
+ contextWindow: 1e6,
21281
+ maxOutputTokens: HARNESS_MAX_OUTPUT_TOKENS,
21282
+ inputPriceMicroUsdPerMtok: 4e6,
21283
+ outputPriceMicroUsdPerMtok: 12e6,
21284
+ cacheReadPriceMicroUsdPerMtok: 5e5,
21285
+ reasoning: true
21286
+ // Picker-only: Auto Router excludes the qwen/ family (see task-router.service.ts).
21287
+ },
21288
+ {
21289
+ id: "moonshotai/kimi-k3",
21290
+ name: "Kimi K3",
21291
+ description: "Long-horizon repo specialist with image and video input; slower and pricier.",
21292
+ enabled: false,
21293
+ isDefault: false,
21294
+ sortOrder: 90,
21295
+ upstreamModelId: "moonshotai/kimi-k3",
21296
+ contextWindow: 1048576,
21297
+ maxOutputTokens: HARNESS_MAX_OUTPUT_TOKENS,
21298
+ inputPriceMicroUsdPerMtok: 192e3,
21299
+ outputPriceMicroUsdPerMtok: 15e6,
21300
+ cacheReadPriceMicroUsdPerMtok: 182e3,
21301
+ reasoning: true
21302
+ },
21303
+ {
21304
+ id: "moonshotai/kimi-k3.1-pro",
21305
+ name: "Kimi K3.1 Pro",
21306
+ description: "Best open Chinese model; top-tier long-horizon coding and terminal work.",
21307
+ enabled: true,
21308
+ isDefault: false,
21309
+ sortOrder: 100,
21310
+ upstreamModelId: "moonshotai/kimi-k3.1-pro",
21311
+ contextWindow: 1048576,
21312
+ maxOutputTokens: HARNESS_MAX_OUTPUT_TOKENS,
21313
+ inputPriceMicroUsdPerMtok: 2e6,
21314
+ outputPriceMicroUsdPerMtok: 1e7,
21315
+ cacheReadPriceMicroUsdPerMtok: 2e5,
21316
+ reasoning: true,
21317
+ routing: {
21318
+ tier: "strong",
21319
+ priority: 5,
21320
+ strengths: ["architecture", "ui_design", "debugging", "high_stakes"]
21321
+ }
21322
+ },
21323
+ {
21324
+ id: "minimax/minimax-m3.1-flash",
21325
+ name: "MiniMax M3.1 Flash",
21326
+ description: "Cheap, capable coder for agentic, UI and high-volume work.",
21327
+ enabled: false,
21328
+ isDefault: false,
21329
+ sortOrder: 110,
21330
+ upstreamModelId: "minimax/minimax-m3.1-flash",
21331
+ contextWindow: 1048576,
21332
+ maxOutputTokens: HARNESS_MAX_OUTPUT_TOKENS,
21333
+ inputPriceMicroUsdPerMtok: 15e4,
21334
+ outputPriceMicroUsdPerMtok: 6e5,
21335
+ cacheReadPriceMicroUsdPerMtok: 15e3,
21336
+ reasoning: true
21337
+ },
21338
+ {
21339
+ id: "minimax/minimax-m3",
21340
+ name: "MiniMax M3",
21341
+ description: "Open multimodal agent model; strong tool use and computer control, older than M3.1 Flash.",
21342
+ enabled: false,
21343
+ isDefault: false,
21344
+ sortOrder: 120,
21345
+ upstreamModelId: "minimax/minimax-m3",
21346
+ contextWindow: 1048576,
21347
+ maxOutputTokens: HARNESS_MAX_OUTPUT_TOKENS,
21348
+ inputPriceMicroUsdPerMtok: 3e5,
21349
+ outputPriceMicroUsdPerMtok: 12e5,
21350
+ cacheReadPriceMicroUsdPerMtok: 6e4,
21351
+ reasoning: true
21352
+ },
21353
+ {
21354
+ id: "nvidia/nemotron-3.5-lightning",
21355
+ name: "Nemotron 3.5 Lightning",
21356
+ description: "Tiny, fast text model for high-volume tool calls and simple edits.",
21357
+ enabled: false,
21358
+ isDefault: false,
21359
+ sortOrder: 130,
21360
+ upstreamModelId: "nvidia/nemotron-3.5-lightning",
21361
+ contextWindow: 262144,
21362
+ maxOutputTokens: HARNESS_MAX_OUTPUT_TOKENS,
21363
+ inputPriceMicroUsdPerMtok: 7e4,
21364
+ outputPriceMicroUsdPerMtok: 2e5,
21365
+ cacheReadPriceMicroUsdPerMtok: 4e4,
21366
+ reasoning: true
21367
+ },
21368
+ {
21369
+ id: "nvidia/nemotron-3.5-super-vl",
21370
+ name: "Nemotron 3.5 Super VL",
21371
+ description: "Efficient multimodal agent; strong SWE-bench Pro and long-context work.",
21372
+ enabled: false,
21373
+ isDefault: false,
21374
+ sortOrder: 140,
21375
+ upstreamModelId: "nvidia/nemotron-3.5-super-vl",
21376
+ contextWindow: 1048576,
21377
+ maxOutputTokens: HARNESS_MAX_OUTPUT_TOKENS,
21378
+ inputPriceMicroUsdPerMtok: 15e4,
21379
+ outputPriceMicroUsdPerMtok: 5e5,
21380
+ cacheReadPriceMicroUsdPerMtok: 2e4,
21381
+ reasoning: true
21382
+ },
21383
+ {
21384
+ id: "nvidia/nemotron-3-nano-30b-a3b",
21385
+ name: "Nemotron 3 Nano",
21386
+ description: "Small, fast Nemotron for cheap routine coding.",
21387
+ enabled: false,
21388
+ isDefault: false,
21389
+ sortOrder: 150,
21390
+ upstreamModelId: "nvidia/nemotron-3-nano-30b-a3b",
21391
+ contextWindow: 262144,
21392
+ maxOutputTokens: HARNESS_MAX_OUTPUT_TOKENS,
21393
+ inputPriceMicroUsdPerMtok: 6e4,
21394
+ outputPriceMicroUsdPerMtok: 24e4,
21395
+ cacheReadPriceMicroUsdPerMtok: 12e3,
21396
+ reasoning: true
21397
+ },
21398
+ {
21399
+ id: "nvidia/nemotron-3-super-120b-a12b",
21400
+ name: "Nemotron 3 Super",
21401
+ description: "Mid-size general Nemotron; solid, but 3.5 Super is the better pick.",
21402
+ enabled: false,
21403
+ isDefault: false,
21404
+ sortOrder: 160,
21405
+ upstreamModelId: "nvidia/nemotron-3-super-120b-a12b",
21406
+ contextWindow: 1048576,
21407
+ maxOutputTokens: HARNESS_MAX_OUTPUT_TOKENS,
21408
+ inputPriceMicroUsdPerMtok: 3e5,
21409
+ outputPriceMicroUsdPerMtok: 24e5,
21410
+ cacheReadPriceMicroUsdPerMtok: 15e4,
21411
+ reasoning: true
21412
+ },
21413
+ {
21414
+ id: "nvidia/nemotron-3-ultra-550b-a55b",
21415
+ name: "Nemotron 3 Ultra",
21416
+ description: "Largest Nemotron; deep architecture work, though 3.5 Super is more efficient.",
21417
+ enabled: false,
21418
+ isDefault: false,
21419
+ sortOrder: 170,
21420
+ upstreamModelId: "nvidia/nemotron-3-ultra-550b-a55b",
21421
+ contextWindow: 262144,
21422
+ maxOutputTokens: HARNESS_MAX_OUTPUT_TOKENS,
21423
+ inputPriceMicroUsdPerMtok: 6e5,
21424
+ outputPriceMicroUsdPerMtok: 24e5,
21425
+ cacheReadPriceMicroUsdPerMtok: 12e4,
21426
+ reasoning: true
21427
+ },
21428
+ {
21429
+ id: "meta/muse-spark-1.3-contributor",
21430
+ name: "Muse Spark 1.3 Contributor",
21431
+ description: "Discounted Muse Spark that trains on your data; good for public, non-sensitive work.",
21432
+ enabled: false,
21433
+ isDefault: false,
21434
+ sortOrder: 180,
21435
+ upstreamModelId: "meta/muse-spark-1.3-contributor",
21436
+ contextWindow: 1048576,
21437
+ maxOutputTokens: HARNESS_MAX_OUTPUT_TOKENS,
21438
+ inputPriceMicroUsdPerMtok: 1e5,
21439
+ outputPriceMicroUsdPerMtok: 2e5,
21440
+ cacheReadPriceMicroUsdPerMtok: 2e3,
21441
+ reasoning: true
21442
+ },
21443
+ {
21444
+ id: "meta/muse-spark-1.3",
21445
+ name: "Muse Spark 1.3",
21446
+ description: "Long-context agentic coder with excellent 1M retrieval; real-world reports are mixed.",
21447
+ enabled: false,
21448
+ isDefault: false,
21449
+ sortOrder: 190,
21450
+ upstreamModelId: "meta/muse-spark-1.3",
21451
+ contextWindow: 1048576,
21452
+ maxOutputTokens: HARNESS_MAX_OUTPUT_TOKENS,
21453
+ inputPriceMicroUsdPerMtok: 125e4,
21454
+ outputPriceMicroUsdPerMtok: 425e4,
21455
+ cacheReadPriceMicroUsdPerMtok: 15e4,
21456
+ reasoning: true
21457
+ },
21458
+ {
21459
+ id: "meta/muse-spark-open",
21460
+ name: "Muse Spark Open",
21461
+ description: "Open-weight Muse Spark; self-hostable coding agent for frontend and general work.",
21462
+ enabled: false,
21463
+ isDefault: false,
21464
+ sortOrder: 200,
21465
+ upstreamModelId: "meta/muse-spark-open",
21466
+ contextWindow: 1048576,
21467
+ maxOutputTokens: HARNESS_MAX_OUTPUT_TOKENS,
21468
+ inputPriceMicroUsdPerMtok: 125e4,
21469
+ outputPriceMicroUsdPerMtok: 425e4,
21470
+ cacheReadPriceMicroUsdPerMtok: 15e4,
21471
+ reasoning: true
21472
+ },
21473
+ {
21474
+ id: "meta/muse-wonder",
21475
+ name: "Muse Wonder",
21476
+ description: "Frontier agentic coder for long repo work; expensive and slow, weaker factual recall.",
21477
+ enabled: false,
21478
+ isDefault: false,
21479
+ sortOrder: 210,
21480
+ upstreamModelId: "meta/muse-wonder",
21481
+ contextWindow: 1048576,
21482
+ maxOutputTokens: HARNESS_MAX_OUTPUT_TOKENS,
21483
+ inputPriceMicroUsdPerMtok: 4e6,
21484
+ outputPriceMicroUsdPerMtok: 2e7,
21485
+ cacheReadPriceMicroUsdPerMtok: 2e5,
21486
+ reasoning: true
21487
+ },
21488
+ {
21489
+ id: "meta/muse-spark-1.2-contributor",
21490
+ name: "Muse Spark 1.2 Contributor",
21491
+ description: "Previous Muse Spark contributor tier; prefer 1.3.",
21492
+ enabled: false,
21493
+ isDefault: false,
21494
+ sortOrder: 220,
21495
+ upstreamModelId: "meta/muse-spark-1.2-contributor",
21496
+ contextWindow: 1048576,
21497
+ maxOutputTokens: HARNESS_MAX_OUTPUT_TOKENS,
21498
+ inputPriceMicroUsdPerMtok: 1e5,
21499
+ outputPriceMicroUsdPerMtok: 2e5,
21500
+ cacheReadPriceMicroUsdPerMtok: 2e3,
21501
+ reasoning: true
21502
+ },
21503
+ {
21504
+ id: "x-ai/grok-4.7",
21505
+ name: "Grok 4.7",
21506
+ description: "Frontier agentic coder and planner; strong reviews, but token-hungry.",
21507
+ enabled: false,
21508
+ isDefault: false,
21509
+ sortOrder: 230,
21510
+ upstreamModelId: "x-ai/grok-4.7",
21511
+ contextWindow: 5e5,
21512
+ maxOutputTokens: HARNESS_MAX_OUTPUT_TOKENS,
21513
+ inputPriceMicroUsdPerMtok: 2e6,
21514
+ outputPriceMicroUsdPerMtok: 6e6,
21515
+ cacheReadPriceMicroUsdPerMtok: 5e5,
21516
+ reasoning: true
21517
+ },
21518
+ {
21519
+ id: "google/gemini-4-argon",
21520
+ name: "Gemini 4 Argon",
21521
+ description: "Top reasoning and web-design model; excellent architecture and UI, expensive per task.",
21522
+ enabled: false,
21523
+ isDefault: false,
21524
+ sortOrder: 240,
21525
+ upstreamModelId: "google/gemini-4-argon",
21526
+ contextWindow: 1048576,
21527
+ maxOutputTokens: HARNESS_MAX_OUTPUT_TOKENS,
21528
+ inputPriceMicroUsdPerMtok: 2e6,
21529
+ outputPriceMicroUsdPerMtok: 1e7,
21530
+ cacheReadPriceMicroUsdPerMtok: 1e5,
21531
+ reasoning: true
21532
+ }
21533
+ ];
21534
+ DEFAULT_HARNESS_MODEL_ID = HARNESS_MODEL_SEEDS.find((model) => model.isDefault)?.id ?? HARNESS_MODEL_SEEDS[0].id;
21535
+ HARNESS_REASONING_LEVELS = [
21536
+ "off",
21537
+ "minimal",
21538
+ "low",
21539
+ "medium",
21540
+ "high",
21541
+ "xhigh",
21542
+ "max"
21543
+ ];
21544
+ RETIRED_MODEL_IDS = new Set(
21545
+ HARNESS_MODEL_SEEDS.filter((seed) => !seed.enabled).map((seed) => seed.id)
21546
+ );
21547
+ ROSTER_ROUTING = new Map(
21548
+ HARNESS_MODEL_SEEDS.flatMap(
21549
+ (seed) => seed.enabled && seed.routing ? [[seed.id, seed.routing]] : []
21550
+ )
21551
+ );
21552
+ }
21553
+ });
21554
+
21096
21555
  // ../shared/src/session-owned-execution.ts
21097
21556
  var EXECUTION_OWNERS;
21098
21557
  var init_session_owned_execution = __esm({
@@ -21481,6 +21940,43 @@ var init_delegation = __esm({
21481
21940
  }
21482
21941
  });
21483
21942
 
21943
+ // ../shared/src/runtime-v2/dependency-drift.ts
21944
+ function isDependencyFileName(name) {
21945
+ return DEPENDENCY_FILE_NAMES.has(name) || REQUIREMENTS_FILE.test(name);
21946
+ }
21947
+ var DEPENDENCY_FILE_NAMES, REQUIREMENTS_FILE, DEPENDENCY_DRIFT_LIMIT, driftedLockfileSchema, dependencyDriftSchema;
21948
+ var init_dependency_drift = __esm({
21949
+ "../shared/src/runtime-v2/dependency-drift.ts"() {
21950
+ "use strict";
21951
+ init_zod();
21952
+ init_machine_path();
21953
+ DEPENDENCY_FILE_NAMES = /* @__PURE__ */ new Set([
21954
+ "package-lock.json",
21955
+ "pnpm-lock.yaml",
21956
+ "yarn.lock",
21957
+ "bun.lockb",
21958
+ "package.json",
21959
+ "poetry.lock",
21960
+ "Pipfile.lock",
21961
+ "uv.lock",
21962
+ "Gemfile.lock",
21963
+ "go.sum",
21964
+ "go.mod",
21965
+ "Cargo.lock",
21966
+ "composer.lock"
21967
+ ]);
21968
+ REQUIREMENTS_FILE = /^requirements.*\.txt$/;
21969
+ DEPENDENCY_DRIFT_LIMIT = 100;
21970
+ driftedLockfileSchema = external_exports.object({
21971
+ repositoryPath: machinePathSchema,
21972
+ lockfile: external_exports.string().min(1).max(255).refine(isDependencyFileName, "not a dependency file")
21973
+ });
21974
+ dependencyDriftSchema = driftedLockfileSchema.extend({
21975
+ digest: external_exports.string().regex(/^[a-f0-9]{64}$/)
21976
+ });
21977
+ }
21978
+ });
21979
+
21484
21980
  // ../shared/src/runtime-v2/run-context.ts
21485
21981
  function wire() {
21486
21982
  return (schema) => schema;
@@ -21711,17 +22207,19 @@ var init_session_operation = __esm({
21711
22207
  });
21712
22208
 
21713
22209
  // ../shared/src/runtime-v2/desired-state.ts
21714
- var repoLocalPathSchema, requestedCheckoutSchema, runSpecSchema, desiredRunSchema, pendingUploadSchema, STOP_RUN_IDS_LIMIT, desiredStateSchema;
22210
+ var repoLocalPathSchema, requestedCheckoutSchema, runHarnessModelSchema, runSpecSchema, desiredRunSchema, pendingUploadSchema, STOP_RUN_IDS_LIMIT, ENVIRONMENT_IMAGE_REASONS_LIMIT, environmentImageStateSchema, desiredStateSchema;
21715
22211
  var init_desired_state = __esm({
21716
22212
  "../shared/src/runtime-v2/desired-state.ts"() {
21717
22213
  "use strict";
21718
22214
  init_zod();
21719
22215
  init_cloud_repositories();
22216
+ init_models();
21720
22217
  init_session_owned_execution();
21721
22218
  init_contracts();
21722
22219
  init_agent_context();
21723
22220
  init_commit_attribution();
21724
22221
  init_delegation();
22222
+ init_dependency_drift();
21725
22223
  init_ids();
21726
22224
  init_run_context();
21727
22225
  init_session_interaction();
@@ -21738,6 +22236,11 @@ var init_desired_state = __esm({
21738
22236
  repoUrl: gitRemoteUrlSchema,
21739
22237
  branch: gitBranchSchema
21740
22238
  });
22239
+ runHarnessModelSchema = external_exports.object({
22240
+ id: external_exports.string().min(1).max(512),
22241
+ inputModalities: external_exports.array(external_exports.enum(["text", "image", "audio", "video", "pdf"])).max(5),
22242
+ reasoningEfforts: external_exports.array(external_exports.enum(HARNESS_REASONING_LEVELS)).max(HARNESS_REASONING_LEVELS.length)
22243
+ });
21741
22244
  runSpecSchema = external_exports.object({
21742
22245
  runId: runIdSchema,
21743
22246
  conversationId: conversationIdSchema,
@@ -21789,7 +22292,8 @@ var init_desired_state = __esm({
21789
22292
  sandboxId: external_exports.string().min(1).optional(),
21790
22293
  localRepoUrls: external_exports.array(external_exports.string().min(1)).optional(),
21791
22294
  /** The deployed GitHub App's bot, credited on every commit the turn makes; absent from older servers. */
21792
- gitCoAuthor: gitCoAuthorSchema.optional()
22295
+ gitCoAuthor: gitCoAuthorSchema.optional(),
22296
+ harnessModels: external_exports.array(runHarnessModelSchema).max(500).optional()
21793
22297
  // Never here: the provider API key. The holder fetches it per run (RUN_PROVIDER_CREDENTIAL_PATH).
21794
22298
  });
21795
22299
  desiredRunSchema = external_exports.object({
@@ -21805,6 +22309,13 @@ var init_desired_state = __esm({
21805
22309
  admittedOffset: external_exports.number().int().nonnegative()
21806
22310
  });
21807
22311
  STOP_RUN_IDS_LIMIT = 200;
22312
+ ENVIRONMENT_IMAGE_REASONS_LIMIT = 8;
22313
+ environmentImageStateSchema = external_exports.object({
22314
+ current: external_exports.object({ imageId: external_exports.guid(), generation: external_exports.number().int().nonnegative() }),
22315
+ booted: external_exports.object({ imageId: external_exports.guid() }),
22316
+ reasons: external_exports.array(external_exports.string().min(1).max(200)).max(ENVIRONMENT_IMAGE_REASONS_LIMIT),
22317
+ dependencyDrift: external_exports.array(driftedLockfileSchema).max(DEPENDENCY_DRIFT_LIMIT).optional()
22318
+ });
21808
22319
  desiredStateSchema = external_exports.object({
21809
22320
  runs: external_exports.array(desiredRunSchema),
21810
22321
  blockedRuns: external_exports.array(
@@ -21827,7 +22338,8 @@ var init_desired_state = __esm({
21827
22338
  * Runs the server ended on its own (stall ceiling, lost VM) that this machine may still hold.
21828
22339
  * The runtime stops any it holds unended; absence from `runs` alone never stops a run.
21829
22340
  */
21830
- stopRunIds: external_exports.array(runIdSchema).max(STOP_RUN_IDS_LIMIT).optional()
22341
+ stopRunIds: external_exports.array(runIdSchema).max(STOP_RUN_IDS_LIMIT).optional(),
22342
+ environmentImage: environmentImageStateSchema.optional()
21831
22343
  });
21832
22344
  }
21833
22345
  });
@@ -21990,7 +22502,7 @@ var init_query_result = __esm({
21990
22502
  });
21991
22503
 
21992
22504
  // ../shared/src/runtime-v2/link.ts
21993
- var LINK_PROTOCOL, linkHandshakeSchema, linkAuthSchema, heldRunStateSchema, heldRunSchema, PROJECT_PATH_FALLBACK_FEATURE, helloSchema, helloAckSchema, pokeReasonSchema, prewarmPokeSchema, desiredPokeSchema, pokeSchema, RUN_ANSWER_MAX_LENGTH, toolCallIdSchema, runAnswerSchema, runRespondRequestSchema, runRespondStatusSchema, runRespondResultSchema, runSteerRequestSchema, runSteerStatusSchema, runSteerResultSchema, backgroundTaskIdSchema, runStopTaskRequestSchema, backgroundTaskStopResultSchema, runStopTaskResultSchema, LINK_CONNECT_ERROR_CODES, linkConnectErrorSchema, LINK_FAILURE_REASONS;
22505
+ var LINK_PROTOCOL, linkHandshakeSchema, linkAuthSchema, linkEnrollmentAuthSchema, heldRunStateSchema, heldRunSchema, PROJECT_PATH_FALLBACK_FEATURE, helloSchema, helloAckSchema, handshakeHelloAckSchema, pokeReasonSchema, prewarmPokeSchema, desiredPokeSchema, pokeSchema, runAcceptedSchema, RUN_ANSWER_MAX_LENGTH, toolCallIdSchema, runAnswerSchema, runRespondRequestSchema, runRespondStatusSchema, runRespondResultSchema, runSteerRequestSchema, runSteerStatusSchema, runSteerResultSchema, backgroundTaskIdSchema, runStopTaskRequestSchema, backgroundTaskStopResultSchema, runStopTaskResultSchema, LINK_CONNECT_ERROR_CODES, linkConnectErrorSchema, LINK_FAILURE_REASONS;
21994
22506
  var init_link = __esm({
21995
22507
  "../shared/src/runtime-v2/link.ts"() {
21996
22508
  "use strict";
@@ -22009,6 +22521,11 @@ var init_link = __esm({
22009
22521
  runtimeVersion: external_exports.string().min(1)
22010
22522
  });
22011
22523
  linkAuthSchema = linkHandshakeSchema.extend({ token: external_exports.string().min(1) });
22524
+ linkEnrollmentAuthSchema = external_exports.object({
22525
+ protocol: external_exports.literal(LINK_PROTOCOL),
22526
+ runtimeVersion: external_exports.string().min(1),
22527
+ enrollmentCode: external_exports.string().min(1)
22528
+ });
22012
22529
  heldRunStateSchema = external_exports.enum(["starting", "running", "ended"]);
22013
22530
  heldRunSchema = external_exports.object({
22014
22531
  runId: runIdSchema,
@@ -22034,7 +22551,12 @@ var init_link = __esm({
22034
22551
  * The environment's runtime pin, as `GET /public/runtime/releases/v1/current` serves it;
22035
22552
  * null when nothing is pinned. Absent: an older server; the runtime keeps its periodic check.
22036
22553
  */
22037
- release: runtimeReleaseSchema.nullable().optional()
22554
+ release: runtimeReleaseSchema.nullable().optional(),
22555
+ linkFeatures: external_exports.array(external_exports.string().min(1)).max(16).optional()
22556
+ });
22557
+ handshakeHelloAckSchema = external_exports.object({
22558
+ epoch: external_exports.number().int().positive(),
22559
+ ack: helloAckSchema
22038
22560
  });
22039
22561
  pokeReasonSchema = external_exports.enum([
22040
22562
  "desired_changed",
@@ -22057,6 +22579,12 @@ var init_link = __esm({
22057
22579
  external_exports.object({ reason: pokeReasonSchema }),
22058
22580
  prewarmPokeSchema
22059
22581
  ]);
22582
+ runAcceptedSchema = external_exports.object({
22583
+ runId: runIdSchema,
22584
+ acceptedAt: external_exports.number().int().nonnegative(),
22585
+ doorbellAt: external_exports.number().int().nonnegative().optional(),
22586
+ viaPush: external_exports.boolean().optional()
22587
+ });
22060
22588
  RUN_ANSWER_MAX_LENGTH = 1e5;
22061
22589
  toolCallIdSchema = external_exports.string().min(1).max(1e3);
22062
22590
  runAnswerSchema = external_exports.string().max(RUN_ANSWER_MAX_LENGTH);
@@ -22108,13 +22636,16 @@ var init_link = __esm({
22108
22636
  "credential_revoked",
22109
22637
  "machine_disabled",
22110
22638
  "runtime_update_required",
22111
- "protocol_unsupported"
22639
+ "protocol_unsupported",
22640
+ "enrollment_invalid",
22641
+ "enrollment_not_ready"
22112
22642
  ];
22113
22643
  linkConnectErrorSchema = external_exports.object({
22114
22644
  code: external_exports.enum(LINK_CONNECT_ERROR_CODES),
22115
22645
  message: external_exports.string(),
22116
22646
  /** With runtime_update_required: the version the server needs. */
22117
- minimumVersion: external_exports.string().min(1).optional()
22647
+ minimumVersion: external_exports.string().min(1).optional(),
22648
+ retryAfterMs: external_exports.number().int().positive().max(6e4).optional()
22118
22649
  });
22119
22650
  LINK_FAILURE_REASONS = [
22120
22651
  "dns",
@@ -22501,7 +23032,7 @@ var init_agent_runs_contracts = __esm({
22501
23032
  });
22502
23033
 
22503
23034
  // ../shared/src/runtime-v2/run-log.ts
22504
- var RUN_LOG_PROTOCOL, RUN_LOG_PROTOCOL_HEADER, RUN_STEERS_MAX, runAcceptedUpdateSchema, runStartedUpdateSchema, runCodexRateLimitsUpdateSchema, runWorkspaceRelocatedUpdateSchema, gitShaSchema2, gitRefNameSchema, runGitRepositoryStateSchema, RUN_GIT_STATE_MAX_REPOSITORIES, runGitStateUpdateSchema, epochMsSchema, runSessionStartSchema, runTimingUpdateSchema, runOutcomeSchema, runRejectionCodeSchema, runEndedUpdateSchema, runLifecycleUpdateSchema, runLogRecordSchema;
23035
+ var RUN_LOG_PROTOCOL, RUN_LOG_PROTOCOL_HEADER, RUN_STEERS_MAX, runAcceptedUpdateSchema, runStartedUpdateSchema, runCodexRateLimitsUpdateSchema, runWorkspaceRelocatedUpdateSchema, gitShaSchema2, gitRefNameSchema, runGitRepositoryStateSchema, RUN_GIT_STATE_MAX_REPOSITORIES, runGitStateUpdateSchema, epochMsSchema, durationMsSchema, runSessionStartSchema, runTimingUpdateSchema, runModelTimingUpdateSchema, runOutcomeSchema, runRejectionCodeSchema, runEndedUpdateSchema, runLifecycleUpdateSchema, runLogRecordSchema;
22505
23036
  var init_run_log = __esm({
22506
23037
  "../shared/src/runtime-v2/run-log.ts"() {
22507
23038
  "use strict";
@@ -22565,6 +23096,7 @@ var init_run_log = __esm({
22565
23096
  repositories: external_exports.array(runGitRepositoryStateSchema).max(RUN_GIT_STATE_MAX_REPOSITORIES)
22566
23097
  });
22567
23098
  epochMsSchema = external_exports.number().int().nonnegative();
23099
+ durationMsSchema = external_exports.number().int().nonnegative();
22568
23100
  runSessionStartSchema = external_exports.enum(["reused", "opened", "respawned"]);
22569
23101
  runTimingUpdateSchema = external_exports.object({
22570
23102
  sessionUpdate: external_exports.literal("_alan/run.timing"),
@@ -22574,8 +23106,15 @@ var init_run_log = __esm({
22574
23106
  inputsReadyAt: epochMsSchema,
22575
23107
  sessionReadyAt: epochMsSchema,
22576
23108
  contextReadyAt: epochMsSchema,
23109
+ checkoutMs: durationMsSchema.optional(),
23110
+ engineOpenMs: external_exports.record(external_exports.string().min(1).max(40), durationMsSchema).optional(),
22577
23111
  turnSentAt: epochMsSchema
22578
23112
  });
23113
+ runModelTimingUpdateSchema = external_exports.object({
23114
+ sessionUpdate: external_exports.literal("_alan/run.model_timing"),
23115
+ promptToRequestMs: durationMsSchema,
23116
+ requestToResponseMs: durationMsSchema
23117
+ });
22579
23118
  runOutcomeSchema = external_exports.enum(agentRunOutcomeEnum);
22580
23119
  runRejectionCodeSchema = external_exports.enum([
22581
23120
  "capacity",
@@ -23151,6 +23690,134 @@ var init_github_proxy = __esm({
23151
23690
  }
23152
23691
  });
23153
23692
 
23693
+ // ../shared/src/runtime-v2/skills.ts
23694
+ var MAX_MACHINE_SKILLS, installedMachineSkillSchema, MAX_SKILL_UPLOADS, machineSkillScanRepositorySchema, machineSkillScanContextSchema, machineLocalSkillsReportSchema, machineSkillUploadSchema, machineSkillsSyncRequestSchema, desiredMachineSkillSchema, machineSkillDownloadSchema, machineSkillsSyncResponseSchema;
23695
+ var init_skills = __esm({
23696
+ "../shared/src/runtime-v2/skills.ts"() {
23697
+ "use strict";
23698
+ init_zod();
23699
+ init_contracts();
23700
+ init_domain();
23701
+ MAX_MACHINE_SKILLS = 2e3;
23702
+ installedMachineSkillSchema = external_exports.object({
23703
+ skillId: skillIdSchema,
23704
+ versionId: skillVersionIdSchema,
23705
+ contentHash: sha256Schema
23706
+ });
23707
+ MAX_SKILL_UPLOADS = 100;
23708
+ machineSkillScanRepositorySchema = external_exports.object({
23709
+ repositoryId: external_exports.string().min(1).max(128),
23710
+ path: external_exports.string().min(1).max(4096),
23711
+ label: external_exports.string().min(1).max(128)
23712
+ });
23713
+ machineSkillScanContextSchema = external_exports.object({
23714
+ revision: sha256Schema,
23715
+ enabledProviderKinds: external_exports.array(external_exports.string().trim().min(1).max(64)).max(20),
23716
+ repositories: external_exports.array(machineSkillScanRepositorySchema).max(500)
23717
+ });
23718
+ machineLocalSkillsReportSchema = external_exports.object({
23719
+ scanContextRevision: sha256Schema.nullable(),
23720
+ inventory: skillScanOutcomeSchema
23721
+ });
23722
+ machineSkillUploadSchema = external_exports.object({
23723
+ commandId: skillCommandIdSchema,
23724
+ previewId: external_exports.guid().transform((value) => value),
23725
+ localKey: external_exports.string().min(1).max(256),
23726
+ expectedContentHash: sha256Schema,
23727
+ uploadGrant: runtimeUploadGrantSchema
23728
+ });
23729
+ machineSkillsSyncRequestSchema = external_exports.object({
23730
+ installed: external_exports.array(installedMachineSkillSchema).max(MAX_MACHINE_SKILLS),
23731
+ /** Sent when the scan differs from what the server last acknowledged. */
23732
+ local: machineLocalSkillsReportSchema.optional(),
23733
+ /** Uploads finished since the last exchange. */
23734
+ uploaded: external_exports.array(publishSkillResultSchema).max(MAX_SKILL_UPLOADS).optional()
23735
+ });
23736
+ desiredMachineSkillSchema = external_exports.object({
23737
+ skillId: skillIdSchema,
23738
+ versionId: skillVersionIdSchema,
23739
+ slug: external_exports.string().min(1).max(64).regex(SKILL_NAME_PATTERN),
23740
+ contentHash: sha256Schema
23741
+ });
23742
+ machineSkillDownloadSchema = external_exports.object({
23743
+ skillId: skillIdSchema,
23744
+ versionId: skillVersionIdSchema,
23745
+ archiveHash: sha256Schema,
23746
+ compressedBytes: external_exports.number().int().positive().max(SKILL_PACKAGE_LIMITS.maxArchiveBytes),
23747
+ url: external_exports.url(),
23748
+ expiresAt: external_exports.iso.datetime()
23749
+ });
23750
+ machineSkillsSyncResponseSchema = external_exports.object({
23751
+ revision: sha256Schema,
23752
+ /** The complete desired set: anything installed and not listed here is removed. */
23753
+ skills: external_exports.array(desiredMachineSkillSchema).max(MAX_MACHINE_SKILLS),
23754
+ /** Only the desired versions the machine reported missing or different. */
23755
+ downloads: external_exports.array(machineSkillDownloadSchema).max(MAX_MACHINE_SKILLS),
23756
+ removals: external_exports.array(skillIdSchema).max(MAX_MACHINE_SKILLS),
23757
+ /** Absent from an API that predates local skills; the machine then reports none. */
23758
+ scanContext: machineSkillScanContextSchema.optional(),
23759
+ /** The local inventory revision the server holds; the machine re-reports when it differs. */
23760
+ localInventoryRevision: sha256Schema.nullable().optional(),
23761
+ uploads: external_exports.array(machineSkillUploadSchema).max(MAX_SKILL_UPLOADS).optional()
23762
+ }).superRefine((response, context) => {
23763
+ const desired = /* @__PURE__ */ new Map();
23764
+ const slugs = /* @__PURE__ */ new Set();
23765
+ for (const [index, skill] of response.skills.entries()) {
23766
+ if (desired.has(skill.skillId) || slugs.has(skill.slug)) {
23767
+ context.addIssue({
23768
+ code: "custom",
23769
+ message: "each desired skill id and slug appears once",
23770
+ path: ["skills", index]
23771
+ });
23772
+ }
23773
+ desired.set(skill.skillId, skill.versionId);
23774
+ slugs.add(skill.slug);
23775
+ }
23776
+ for (const [index, download] of response.downloads.entries()) {
23777
+ if (desired.get(download.skillId) !== download.versionId) {
23778
+ context.addIssue({
23779
+ code: "custom",
23780
+ message: "a download must name a desired skill version",
23781
+ path: ["downloads", index]
23782
+ });
23783
+ }
23784
+ }
23785
+ for (const [index, skillId] of response.removals.entries()) {
23786
+ if (desired.has(skillId)) {
23787
+ context.addIssue({
23788
+ code: "custom",
23789
+ message: "a desired skill cannot be removed",
23790
+ path: ["removals", index]
23791
+ });
23792
+ }
23793
+ }
23794
+ });
23795
+ }
23796
+ });
23797
+
23798
+ // ../shared/src/runtime-v2/pending-run.ts
23799
+ var SHA256_HEX, pendingRunHintSchema;
23800
+ var init_pending_run = __esm({
23801
+ "../shared/src/runtime-v2/pending-run.ts"() {
23802
+ "use strict";
23803
+ init_zod();
23804
+ init_ids();
23805
+ init_skills();
23806
+ SHA256_HEX = /^[0-9a-f]{64}$/;
23807
+ pendingRunHintSchema = external_exports.object({
23808
+ runId: runIdSchema,
23809
+ conversationId: conversationIdSchema,
23810
+ backendKind: external_exports.string().min(1),
23811
+ model: external_exports.string().min(1).optional(),
23812
+ engineKind: external_exports.string().min(1).optional(),
23813
+ projectPath: external_exports.string().min(1),
23814
+ pluginSetVersion: external_exports.string().min(1).optional(),
23815
+ skills: external_exports.array(desiredMachineSkillSchema).max(64).optional(),
23816
+ specDigest: external_exports.string().regex(SHA256_HEX)
23817
+ });
23818
+ }
23819
+ });
23820
+
23154
23821
  // ../shared/src/runtime-v2/session-preparation.ts
23155
23822
  var modalitySchema, modalitiesSchema, sessionModelDescriptorSchema, sessionModelCatalogSchema, sessionBindingReferenceSchema, sessionMcpDescriptorSchema, sessionPreparationSchema;
23156
23823
  var init_session_preparation = __esm({
@@ -23359,6 +24026,7 @@ var init_holder_protocol = __esm({
23359
24026
  init_ids();
23360
24027
  init_link();
23361
24028
  init_local_sessions();
24029
+ init_pending_run();
23362
24030
  init_run_log();
23363
24031
  init_session_preparation();
23364
24032
  init_session_reads();
@@ -23523,7 +24191,8 @@ var init_holder_protocol = __esm({
23523
24191
  endpoint: external_exports.string().min(1),
23524
24192
  token: external_exports.string().min(32),
23525
24193
  runsDir: external_exports.string().min(1),
23526
- statusPath: external_exports.string().min(1)
24194
+ statusPath: external_exports.string().min(1),
24195
+ preopen: pendingRunHintSchema.optional()
23527
24196
  });
23528
24197
  holderStatusSchema = external_exports.object({
23529
24198
  protocol: external_exports.number().int().positive(),
@@ -23884,111 +24553,6 @@ var init_session_request_display = __esm({
23884
24553
  }
23885
24554
  });
23886
24555
 
23887
- // ../shared/src/runtime-v2/skills.ts
23888
- var MAX_MACHINE_SKILLS, installedMachineSkillSchema, MAX_SKILL_UPLOADS, machineSkillScanRepositorySchema, machineSkillScanContextSchema, machineLocalSkillsReportSchema, machineSkillUploadSchema, machineSkillsSyncRequestSchema, desiredMachineSkillSchema, machineSkillDownloadSchema, machineSkillsSyncResponseSchema;
23889
- var init_skills = __esm({
23890
- "../shared/src/runtime-v2/skills.ts"() {
23891
- "use strict";
23892
- init_zod();
23893
- init_contracts();
23894
- init_domain();
23895
- MAX_MACHINE_SKILLS = 2e3;
23896
- installedMachineSkillSchema = external_exports.object({
23897
- skillId: skillIdSchema,
23898
- versionId: skillVersionIdSchema,
23899
- contentHash: sha256Schema
23900
- });
23901
- MAX_SKILL_UPLOADS = 100;
23902
- machineSkillScanRepositorySchema = external_exports.object({
23903
- repositoryId: external_exports.string().min(1).max(128),
23904
- path: external_exports.string().min(1).max(4096),
23905
- label: external_exports.string().min(1).max(128)
23906
- });
23907
- machineSkillScanContextSchema = external_exports.object({
23908
- revision: sha256Schema,
23909
- enabledProviderKinds: external_exports.array(external_exports.string().trim().min(1).max(64)).max(20),
23910
- repositories: external_exports.array(machineSkillScanRepositorySchema).max(500)
23911
- });
23912
- machineLocalSkillsReportSchema = external_exports.object({
23913
- scanContextRevision: sha256Schema.nullable(),
23914
- inventory: skillScanOutcomeSchema
23915
- });
23916
- machineSkillUploadSchema = external_exports.object({
23917
- commandId: skillCommandIdSchema,
23918
- previewId: external_exports.guid().transform((value) => value),
23919
- localKey: external_exports.string().min(1).max(256),
23920
- expectedContentHash: sha256Schema,
23921
- uploadGrant: runtimeUploadGrantSchema
23922
- });
23923
- machineSkillsSyncRequestSchema = external_exports.object({
23924
- installed: external_exports.array(installedMachineSkillSchema).max(MAX_MACHINE_SKILLS),
23925
- /** Sent when the scan differs from what the server last acknowledged. */
23926
- local: machineLocalSkillsReportSchema.optional(),
23927
- /** Uploads finished since the last exchange. */
23928
- uploaded: external_exports.array(publishSkillResultSchema).max(MAX_SKILL_UPLOADS).optional()
23929
- });
23930
- desiredMachineSkillSchema = external_exports.object({
23931
- skillId: skillIdSchema,
23932
- versionId: skillVersionIdSchema,
23933
- slug: external_exports.string().min(1).max(64).regex(SKILL_NAME_PATTERN),
23934
- contentHash: sha256Schema
23935
- });
23936
- machineSkillDownloadSchema = external_exports.object({
23937
- skillId: skillIdSchema,
23938
- versionId: skillVersionIdSchema,
23939
- archiveHash: sha256Schema,
23940
- compressedBytes: external_exports.number().int().positive().max(SKILL_PACKAGE_LIMITS.maxArchiveBytes),
23941
- url: external_exports.url(),
23942
- expiresAt: external_exports.iso.datetime()
23943
- });
23944
- machineSkillsSyncResponseSchema = external_exports.object({
23945
- revision: sha256Schema,
23946
- /** The complete desired set: anything installed and not listed here is removed. */
23947
- skills: external_exports.array(desiredMachineSkillSchema).max(MAX_MACHINE_SKILLS),
23948
- /** Only the desired versions the machine reported missing or different. */
23949
- downloads: external_exports.array(machineSkillDownloadSchema).max(MAX_MACHINE_SKILLS),
23950
- removals: external_exports.array(skillIdSchema).max(MAX_MACHINE_SKILLS),
23951
- /** Absent from an API that predates local skills; the machine then reports none. */
23952
- scanContext: machineSkillScanContextSchema.optional(),
23953
- /** The local inventory revision the server holds; the machine re-reports when it differs. */
23954
- localInventoryRevision: sha256Schema.nullable().optional(),
23955
- uploads: external_exports.array(machineSkillUploadSchema).max(MAX_SKILL_UPLOADS).optional()
23956
- }).superRefine((response, context) => {
23957
- const desired = /* @__PURE__ */ new Map();
23958
- const slugs = /* @__PURE__ */ new Set();
23959
- for (const [index, skill] of response.skills.entries()) {
23960
- if (desired.has(skill.skillId) || slugs.has(skill.slug)) {
23961
- context.addIssue({
23962
- code: "custom",
23963
- message: "each desired skill id and slug appears once",
23964
- path: ["skills", index]
23965
- });
23966
- }
23967
- desired.set(skill.skillId, skill.versionId);
23968
- slugs.add(skill.slug);
23969
- }
23970
- for (const [index, download] of response.downloads.entries()) {
23971
- if (desired.get(download.skillId) !== download.versionId) {
23972
- context.addIssue({
23973
- code: "custom",
23974
- message: "a download must name a desired skill version",
23975
- path: ["downloads", index]
23976
- });
23977
- }
23978
- }
23979
- for (const [index, skillId] of response.removals.entries()) {
23980
- if (desired.has(skillId)) {
23981
- context.addIssue({
23982
- code: "custom",
23983
- message: "a desired skill cannot be removed",
23984
- path: ["removals", index]
23985
- });
23986
- }
23987
- }
23988
- });
23989
- }
23990
- });
23991
-
23992
24556
  // ../shared/src/runtime-v2/index.ts
23993
24557
  var init_runtime_v2 = __esm({
23994
24558
  "../shared/src/runtime-v2/index.ts"() {
@@ -24000,6 +24564,7 @@ var init_runtime_v2 = __esm({
24000
24564
  init_cloud_sessions();
24001
24565
  init_commit_attribution();
24002
24566
  init_delegation();
24567
+ init_dependency_drift();
24003
24568
  init_desired_state();
24004
24569
  init_files();
24005
24570
  init_git_capability();
@@ -24011,6 +24576,7 @@ var init_runtime_v2 = __esm({
24011
24576
  init_machine_identity();
24012
24577
  init_machine_local_sessions();
24013
24578
  init_mcp();
24579
+ init_pending_run();
24014
24580
  init_run_context();
24015
24581
  init_run_log();
24016
24582
  init_run_log_upload();
@@ -24465,9 +25031,6 @@ var import_node_worker_threads = require("node:worker_threads");
24465
25031
  var import_node_fs2 = require("node:fs");
24466
25032
 
24467
25033
  // src/api-client/index.ts
24468
- var import_node_crypto = require("node:crypto");
24469
- var import_node_util = require("node:util");
24470
- var import_node_zlib = require("node:zlib");
24471
25034
  init_runtime_v2();
24472
25035
  init_kernel();
24473
25036
 
@@ -24499,6 +25062,13 @@ function headerValue(response, name) {
24499
25062
  if (value === void 0) return null;
24500
25063
  return Array.isArray(value) ? value.join(", ") : value;
24501
25064
  }
25065
+ function retryAfterMs(response, now) {
25066
+ const hint = headerValue(response, "retry-after")?.trim();
25067
+ if (!hint) return void 0;
25068
+ const seconds = Number(hint);
25069
+ const delay2 = Number.isFinite(seconds) && seconds >= 0 ? seconds * 1e3 : Date.parse(hint) - now;
25070
+ return Number.isFinite(delay2) ? Math.max(0, delay2) : void 0;
25071
+ }
24502
25072
  function tooLarge(url2, maxBytes) {
24503
25073
  return new RuntimeFault("invalid_file", `${url2.href} is larger than ${maxBytes} bytes`);
24504
25074
  }
@@ -24646,7 +25216,12 @@ function createHttpTransport(options = {}) {
24646
25216
  };
24647
25217
  }
24648
25218
 
24649
- // src/api-client/index.ts
25219
+ // src/api-client/run-log-uploads.ts
25220
+ var import_node_crypto = require("node:crypto");
25221
+ var import_node_util = require("node:util");
25222
+ var import_node_zlib = require("node:zlib");
25223
+ init_runtime_v2();
25224
+ init_kernel();
24650
25225
  var gzipAsync = (0, import_node_util.promisify)(import_node_zlib.gzip);
24651
25226
  var GZIP_MIN_BYTES = 1024;
24652
25227
  async function encodedChunk(bytes) {
@@ -24667,14 +25242,6 @@ async function chunkUpload(headers, bytes) {
24667
25242
  body: encoded.body
24668
25243
  };
24669
25244
  }
24670
- var CENTRAL_SESSION_FEATURES = [
24671
- SESSION_INTERACTION_FEATURE,
24672
- SESSION_OPERATIONS_FEATURE,
24673
- SESSION_SELECTION_FEATURE,
24674
- BOUNDED_DELEGATION_FEATURE,
24675
- PROJECT_PATH_FALLBACK_FEATURE
24676
- ];
24677
- var REQUEST_TIMEOUT_MS = 3e4;
24678
25245
  function isRetryableStatus(status) {
24679
25246
  return status === 408 || status === 425 || status === 429 || status >= 500;
24680
25247
  }
@@ -24683,8 +25250,24 @@ function uploadErrorCode(response) {
24683
25250
  if (body === null || typeof body !== "object" || !("code" in body)) return void 0;
24684
25251
  return typeof body.code === "string" ? body.code : void 0;
24685
25252
  }
25253
+ async function answeredOrRetry(exchange2, signal) {
25254
+ try {
25255
+ return await exchange2;
25256
+ } catch (error62) {
25257
+ const timedOut = error62 instanceof DOMException && error62.name === "TimeoutError";
25258
+ if (signal.aborted || !(error62 instanceof TypeError || timedOut)) throw error62;
25259
+ return { kind: "retry", status: 0 };
25260
+ }
25261
+ }
24686
25262
  function uploadFailure(response) {
24687
- if (isRetryableStatus(response.status)) return { kind: "retry", status: response.status };
25263
+ if (isRetryableStatus(response.status)) {
25264
+ const hinted = retryAfterMs(response, Date.now());
25265
+ return {
25266
+ kind: "retry",
25267
+ status: response.status,
25268
+ ...hinted === void 0 ? {} : { retryAfterMs: hinted }
25269
+ };
25270
+ }
24688
25271
  if (isOk(response)) return null;
24689
25272
  const code = uploadErrorCode(response);
24690
25273
  return {
@@ -24694,6 +25277,85 @@ function uploadFailure(response) {
24694
25277
  ...code === void 0 ? {} : { code }
24695
25278
  };
24696
25279
  }
25280
+ function uploadHeaders(target, offset) {
25281
+ return {
25282
+ [RUN_LOG_UPLOAD_HEADERS.runId]: target.runId,
25283
+ [RUN_LOG_UPLOAD_HEADERS.offset]: String(offset),
25284
+ [RUN_LOG_UPLOAD_HEADERS.revision]: "0",
25285
+ [RUN_LOG_PROTOCOL_HEADER]: String(RUN_LOG_PROTOCOL)
25286
+ };
25287
+ }
25288
+ function toOutcome(response) {
25289
+ if ("kind" in response) return response;
25290
+ if (response.status === 409) {
25291
+ const code = uploadErrorCode(response);
25292
+ return { kind: "offset_conflict", ...code === void 0 ? {} : { code } };
25293
+ }
25294
+ const failure2 = uploadFailure(response);
25295
+ if (failure2 !== null) return failure2;
25296
+ const parsed = runLogUploadResponseSchema.safeParse(jsonBody(response));
25297
+ if (!parsed.success || parsed.data.receipt === null) {
25298
+ throw new RuntimeFault("invalid_file", "Upload response carried no receipt");
25299
+ }
25300
+ return { kind: "accepted", receipt: parsed.data.receipt };
25301
+ }
25302
+ function createRunLogUploads(request) {
25303
+ return {
25304
+ readReceipt: async (target, signal) => {
25305
+ const response = await answeredOrRetry(
25306
+ request(
25307
+ runLogUploadPath(target.conversationId),
25308
+ { method: "GET", headers: { [RUN_LOG_UPLOAD_HEADERS.runId]: target.runId } },
25309
+ signal
25310
+ ),
25311
+ signal
25312
+ );
25313
+ if ("kind" in response) return response;
25314
+ const failure2 = uploadFailure(response);
25315
+ if (failure2 !== null) return failure2;
25316
+ return {
25317
+ kind: "read",
25318
+ receipt: runLogUploadResponseSchema.parse(jsonBody(response)).receipt
25319
+ };
25320
+ },
25321
+ uploadChunk: async (target, offset, bytes, signal) => toOutcome(
25322
+ await answeredOrRetry(
25323
+ request(
25324
+ runLogUploadPath(target.conversationId),
25325
+ await chunkUpload(uploadHeaders(target, offset), bytes),
25326
+ signal
25327
+ ),
25328
+ signal
25329
+ )
25330
+ ),
25331
+ seal: async (target, offset, signal) => {
25332
+ const sealing = request(
25333
+ runLogUploadPath(target.conversationId),
25334
+ {
25335
+ method: "POST",
25336
+ headers: {
25337
+ ...uploadHeaders(target, offset),
25338
+ "content-type": "application/octet-stream",
25339
+ [RUN_LOG_UPLOAD_HEADERS.final]: "1"
25340
+ },
25341
+ body: new Uint8Array()
25342
+ },
25343
+ signal
25344
+ );
25345
+ return toOutcome(await answeredOrRetry(sealing, signal));
25346
+ }
25347
+ };
25348
+ }
25349
+
25350
+ // src/api-client/index.ts
25351
+ var CENTRAL_SESSION_FEATURES = [
25352
+ SESSION_INTERACTION_FEATURE,
25353
+ SESSION_OPERATIONS_FEATURE,
25354
+ SESSION_SELECTION_FEATURE,
25355
+ BOUNDED_DELEGATION_FEATURE,
25356
+ PROJECT_PATH_FALLBACK_FEATURE
25357
+ ];
25358
+ var REQUEST_TIMEOUT_MS = 3e4;
24697
25359
  function createApiClient({
24698
25360
  apiUrl,
24699
25361
  accessToken,
@@ -24705,26 +25367,8 @@ function createApiClient({
24705
25367
  headers: { authorization: `Bearer ${accessToken()}`, ...init.headers },
24706
25368
  signal: AbortSignal.any([signal, AbortSignal.timeout(REQUEST_TIMEOUT_MS)])
24707
25369
  });
24708
- const uploadHeaders = (target, offset) => ({
24709
- [RUN_LOG_UPLOAD_HEADERS.runId]: target.runId,
24710
- [RUN_LOG_UPLOAD_HEADERS.offset]: String(offset),
24711
- [RUN_LOG_UPLOAD_HEADERS.revision]: "0",
24712
- [RUN_LOG_PROTOCOL_HEADER]: String(RUN_LOG_PROTOCOL)
24713
- });
24714
- const toOutcome = (response) => {
24715
- if (response.status === 409) {
24716
- const code = uploadErrorCode(response);
24717
- return { kind: "offset_conflict", ...code === void 0 ? {} : { code } };
24718
- }
24719
- const failure2 = uploadFailure(response);
24720
- if (failure2 !== null) return failure2;
24721
- const parsed = runLogUploadResponseSchema.safeParse(jsonBody(response));
24722
- if (!parsed.success || parsed.data.receipt === null) {
24723
- throw new RuntimeFault("invalid_file", "Upload response carried no receipt");
24724
- }
24725
- return { kind: "accepted", receipt: parsed.data.receipt };
24726
- };
24727
25370
  return {
25371
+ ...createRunLogUploads(request),
24728
25372
  mintGitCapability: async (gatewayUrl, signal) => {
24729
25373
  const response = await request(
24730
25374
  MACHINE_PATHS.gitCapability,
@@ -24811,42 +25455,6 @@ function createApiClient({
24811
25455
  }
24812
25456
  const desired = desiredStateSchema.parse(jsonBody(response));
24813
25457
  return { kind: "changed", desired, etag: headerValue(response, "etag") };
24814
- },
24815
- readReceipt: async (target, signal) => {
24816
- const response = await request(
24817
- runLogUploadPath(target.conversationId),
24818
- { method: "GET", headers: { [RUN_LOG_UPLOAD_HEADERS.runId]: target.runId } },
24819
- signal
24820
- );
24821
- const failure2 = uploadFailure(response);
24822
- if (failure2 !== null) return failure2;
24823
- return {
24824
- kind: "read",
24825
- receipt: runLogUploadResponseSchema.parse(jsonBody(response)).receipt
24826
- };
24827
- },
24828
- uploadChunk: async (target, offset, bytes, signal) => toOutcome(
24829
- await request(
24830
- runLogUploadPath(target.conversationId),
24831
- await chunkUpload(uploadHeaders(target, offset), bytes),
24832
- signal
24833
- )
24834
- ),
24835
- seal: async (target, offset, signal) => {
24836
- const response = await request(
24837
- runLogUploadPath(target.conversationId),
24838
- {
24839
- method: "POST",
24840
- headers: {
24841
- ...uploadHeaders(target, offset),
24842
- "content-type": "application/octet-stream",
24843
- [RUN_LOG_UPLOAD_HEADERS.final]: "1"
24844
- },
24845
- body: new Uint8Array()
24846
- },
24847
- signal
24848
- );
24849
- return toOutcome(response);
24850
25458
  }
24851
25459
  };
24852
25460
  }