@alan-ai-hq/agent-manager-linux-arm64 0.1.172 → 0.1.174

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 (4) hide show
  1. package/alan-agent.cjs +17925 -15510
  2. package/alan-holder.cjs +15178 -13340
  3. package/alan-lease.cjs +474 -314
  4. package/package.json +1 -1
package/alan-lease.cjs CHANGED
@@ -20563,10 +20563,10 @@ var init_zod = __esm({
20563
20563
  }
20564
20564
  });
20565
20565
 
20566
- // ../shared/dist/runtime-v2/ids.js
20566
+ // ../shared/src/runtime-v2/ids.ts
20567
20567
  var machineIdSchema, runIdSchema, steerIdSchema, conversationIdSchema, byteOffsetSchema;
20568
20568
  var init_ids = __esm({
20569
- "../shared/dist/runtime-v2/ids.js"() {
20569
+ "../shared/src/runtime-v2/ids.ts"() {
20570
20570
  "use strict";
20571
20571
  init_zod();
20572
20572
  machineIdSchema = external_exports.guid().brand();
@@ -20577,10 +20577,10 @@ var init_ids = __esm({
20577
20577
  }
20578
20578
  });
20579
20579
 
20580
- // ../shared/dist/runtime-v2/activity-lease.js
20580
+ // ../shared/src/runtime-v2/activity-lease.ts
20581
20581
  var ACTIVITY_LEASE_PATH, leasedRunStateSchema, leasedRunSchema, leasedHolderSchema, leasedVmPressureSchema, activityLeaseSchema, activityLeaseAckSchema;
20582
20582
  var init_activity_lease = __esm({
20583
- "../shared/dist/runtime-v2/activity-lease.js"() {
20583
+ "../shared/src/runtime-v2/activity-lease.ts"() {
20584
20584
  "use strict";
20585
20585
  init_zod();
20586
20586
  init_ids();
@@ -20627,27 +20627,114 @@ var init_activity_lease = __esm({
20627
20627
  }
20628
20628
  });
20629
20629
 
20630
- // ../shared/dist/constants/cloud-repositories.js
20630
+ // ../shared/src/constants/cloud-repositories.ts
20631
20631
  var MAX_CLOUD_REPOSITORIES, CLOUD_REPOSITORY_LIMIT_MESSAGE;
20632
20632
  var init_cloud_repositories = __esm({
20633
- "../shared/dist/constants/cloud-repositories.js"() {
20633
+ "../shared/src/constants/cloud-repositories.ts"() {
20634
20634
  "use strict";
20635
20635
  MAX_CLOUD_REPOSITORIES = 64;
20636
20636
  CLOUD_REPOSITORY_LIMIT_MESSAGE = `Select at most ${MAX_CLOUD_REPOSITORIES} repositories for one cloud session`;
20637
20637
  }
20638
20638
  });
20639
20639
 
20640
- // ../shared/dist/runtime-v2/workspace.js
20641
- var UNSAFE_LINE, CONTROL_CHARACTERS, machinePathSchema, 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;
20642
- var init_workspace = __esm({
20643
- "../shared/dist/runtime-v2/workspace.js"() {
20640
+ // ../shared/src/runtime-v2/machine-path.ts
20641
+ var UNSAFE_LINE, CONTROL_CHARACTERS, machinePathSchema;
20642
+ var init_machine_path = __esm({
20643
+ "../shared/src/runtime-v2/machine-path.ts"() {
20644
20644
  "use strict";
20645
20645
  init_zod();
20646
20646
  UNSAFE_LINE = /[\0\r\n]/;
20647
20647
  CONTROL_CHARACTERS = /[\x00-\x1f\x7f]/;
20648
20648
  machinePathSchema = external_exports.string().min(1).max(4096).refine((value) => !UNSAFE_LINE.test(value), "path contains unsafe characters");
20649
+ }
20650
+ });
20651
+
20652
+ // ../shared/src/runtime-v2/files.ts
20653
+ var FILES_ROOTS_MAX, FILES_DIRS_MAX, FILES_READ_MAX_BYTES, FILES_WATCH_MAX_TTL_MS, filesDirSchema, filesTreeRequestSchema, filesListDirsRequestSchema, filesReadRequestSchema, filesWatchRequestSchema, filesTreeValueSchema, filesListDirsValueSchema, filesReadValueSchema, filesWatchValueSchema, workspaceChangedSchema;
20654
+ var init_files = __esm({
20655
+ "../shared/src/runtime-v2/files.ts"() {
20656
+ "use strict";
20657
+ init_zod();
20658
+ init_machine_path();
20659
+ FILES_ROOTS_MAX = 16;
20660
+ FILES_DIRS_MAX = 64;
20661
+ FILES_READ_MAX_BYTES = 2 * 1024 * 1024;
20662
+ FILES_WATCH_MAX_TTL_MS = 5 * 6e4;
20663
+ filesDirSchema = external_exports.string().min(1).max(4096).refine(
20664
+ (value) => !value.startsWith("/") && !CONTROL_CHARACTERS.test(value) && !value.split("/").some((segment) => segment === ".." || segment === ""),
20665
+ "not a folder inside the repository"
20666
+ );
20667
+ filesTreeRequestSchema = external_exports.object({
20668
+ method: external_exports.literal("files.tree"),
20669
+ roots: external_exports.array(machinePathSchema).min(1).max(FILES_ROOTS_MAX),
20670
+ /** Read the folders again even when a watched copy is current. */
20671
+ fresh: external_exports.boolean().optional()
20672
+ });
20673
+ filesListDirsRequestSchema = external_exports.object({
20674
+ method: external_exports.literal("files.list_dirs"),
20675
+ root: machinePathSchema,
20676
+ /** `""` asks for the root's direct files only; any other folder is listed with its subtree. */
20677
+ dirs: external_exports.array(external_exports.union([external_exports.literal(""), filesDirSchema])).min(1).max(FILES_DIRS_MAX)
20678
+ });
20679
+ filesReadRequestSchema = external_exports.object({
20680
+ method: external_exports.literal("files.read"),
20681
+ path: machinePathSchema,
20682
+ maxBytes: external_exports.number().int().positive().max(8 * 1024 * 1024).default(FILES_READ_MAX_BYTES)
20683
+ });
20684
+ filesWatchRequestSchema = external_exports.object({
20685
+ method: external_exports.literal("files.watch"),
20686
+ roots: external_exports.array(machinePathSchema).max(FILES_ROOTS_MAX),
20687
+ ttlMs: external_exports.number().int().nonnegative().max(FILES_WATCH_MAX_TTL_MS)
20688
+ });
20689
+ filesTreeValueSchema = external_exports.object({
20690
+ repos: external_exports.array(
20691
+ external_exports.object({
20692
+ root: machinePathSchema,
20693
+ /** Paths relative to `root`: tracked and untracked, never ignored. */
20694
+ files: external_exports.array(external_exports.string()),
20695
+ /** Not a Git checkout, or its listing hit the cap: `files` is what a bounded walk found. */
20696
+ source: external_exports.enum(["git", "walk"]),
20697
+ truncated: external_exports.boolean()
20698
+ })
20699
+ )
20700
+ });
20701
+ filesListDirsValueSchema = external_exports.object({ files: external_exports.array(external_exports.string()) });
20702
+ filesReadValueSchema = external_exports.discriminatedUnion("kind", [
20703
+ external_exports.object({ kind: external_exports.literal("text"), content: external_exports.string(), size: external_exports.number().int().nonnegative() }),
20704
+ external_exports.object({ kind: external_exports.literal("not_file") }),
20705
+ external_exports.object({ kind: external_exports.literal("too_large"), size: external_exports.number().int().nonnegative() }),
20706
+ external_exports.object({ kind: external_exports.literal("binary"), size: external_exports.number().int().nonnegative() })
20707
+ ]);
20708
+ filesWatchValueSchema = external_exports.object({
20709
+ /** Folders under watch across the named repositories. */
20710
+ dirs: external_exports.number().int().nonnegative(),
20711
+ /** The runtime hit its folder cap: changes in unwatched folders are not reported. */
20712
+ limited: external_exports.boolean()
20713
+ });
20714
+ workspaceChangedSchema = external_exports.object({
20715
+ root: machinePathSchema,
20716
+ /** Folders, relative to `root`, whose files were created or removed; `""` is the root. */
20717
+ dirs: external_exports.array(external_exports.string().max(4096)).max(FILES_DIRS_MAX),
20718
+ truncated: external_exports.boolean(),
20719
+ /** Counts this runtime's events for `root`, starting at 1 for each new watch. */
20720
+ seq: external_exports.number().int().positive()
20721
+ });
20722
+ }
20723
+ });
20724
+
20725
+ // ../shared/src/runtime-v2/workspace.ts
20726
+ 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;
20727
+ var init_workspace = __esm({
20728
+ "../shared/src/runtime-v2/workspace.ts"() {
20729
+ "use strict";
20730
+ init_zod();
20731
+ init_files();
20732
+ init_machine_path();
20649
20733
  gitShaSchema = external_exports.string().regex(/^[0-9a-f]{40}(?:[0-9a-f]{24})?$/, "not a Git SHA");
20650
- gitBranchSchema = external_exports.string().min(1).max(255).refine((value) => !value.startsWith("-") && !value.startsWith("+") && !value.includes("..") && !value.includes("@{") && !value.endsWith(".lock") && !/[\s~^:?*[\\]/.test(value) && !CONTROL_CHARACTERS.test(value), "not a safe Git branch name");
20734
+ gitBranchSchema = external_exports.string().min(1).max(255).refine(
20735
+ (value) => !value.startsWith("-") && !value.startsWith("+") && !value.includes("..") && !value.includes("@{") && !value.endsWith(".lock") && !/[\s~^:?*[\\]/.test(value) && !CONTROL_CHARACTERS.test(value),
20736
+ "not a safe Git branch name"
20737
+ );
20651
20738
  gitRemoteNameSchema = external_exports.string().regex(/^[A-Za-z0-9][A-Za-z0-9._-]{0,99}$/, "not a safe Git remote name");
20652
20739
  gitRemoteUrlSchema = external_exports.string().min(1).max(2048).refine((value) => !UNSAFE_LINE.test(value), "remote URL contains unsafe characters");
20653
20740
  statusFingerprintSchema = external_exports.string().regex(/^[0-9a-f]{64}$/, "not a status fingerprint");
@@ -20717,7 +20804,11 @@ var init_workspace = __esm({
20717
20804
  gitCheckpointRequestSchema,
20718
20805
  gitPushRequestSchema,
20719
20806
  gitPrepareCheckoutRequestSchema,
20720
- gitVerifyHeadRequestSchema
20807
+ gitVerifyHeadRequestSchema,
20808
+ filesTreeRequestSchema,
20809
+ filesListDirsRequestSchema,
20810
+ filesReadRequestSchema,
20811
+ filesWatchRequestSchema
20721
20812
  ]);
20722
20813
  WORKSPACE_QUERY_METHODS = [
20723
20814
  "workspace.status",
@@ -20725,7 +20816,11 @@ var init_workspace = __esm({
20725
20816
  "git.checkpoint",
20726
20817
  "git.push",
20727
20818
  "git.prepare_checkout",
20728
- "git.verify_head"
20819
+ "git.verify_head",
20820
+ "files.tree",
20821
+ "files.list_dirs",
20822
+ "files.read",
20823
+ "files.watch"
20729
20824
  ];
20730
20825
  workspaceQueryMethodSchema = external_exports.enum(WORKSPACE_QUERY_METHODS);
20731
20826
  workspaceStatusValueSchema = external_exports.object({
@@ -20831,10 +20926,10 @@ var init_workspace = __esm({
20831
20926
  }
20832
20927
  });
20833
20928
 
20834
- // ../shared/dist/runtime-v2/agent-context.js
20929
+ // ../shared/src/runtime-v2/agent-context.ts
20835
20930
  var AGENT_TEAM_INSTRUCTIONS_MAX_CHARS, agentSessionKindSchema, agentTurnTriggerSchema, agentBranchSourceSchema, agentContextRepositorySchema, agentContextBuildSchema, agentContextEnvironmentSchema, agentContextPullRequestSchema, agentSurfaceAudienceSchema, agentParticipantStandingSchema, agentContextParticipantSchema, agentContextTeamSchema, agentContextHarnessSchema, agentRepoReasonSchema, agentRepoHintSourceSchema, agentRepoHintSchema, agentRepoResolutionSchema, agentContextSurfaceSchema, agentContextSchema;
20836
20931
  var init_agent_context = __esm({
20837
- "../shared/dist/runtime-v2/agent-context.js"() {
20932
+ "../shared/src/runtime-v2/agent-context.ts"() {
20838
20933
  "use strict";
20839
20934
  init_zod();
20840
20935
  init_cloud_repositories();
@@ -20968,10 +21063,10 @@ var init_agent_context = __esm({
20968
21063
  }
20969
21064
  });
20970
21065
 
20971
- // ../shared/dist/skills/domain.js
21066
+ // ../shared/src/skills/domain.ts
20972
21067
  var SKILLS_PROTOCOL_VERSION, SKILL_PACKAGE_LIMITS;
20973
21068
  var init_domain = __esm({
20974
- "../shared/dist/skills/domain.js"() {
21069
+ "../shared/src/skills/domain.ts"() {
20975
21070
  "use strict";
20976
21071
  SKILLS_PROTOCOL_VERSION = 1;
20977
21072
  SKILL_PACKAGE_LIMITS = {
@@ -20987,7 +21082,7 @@ var init_domain = __esm({
20987
21082
  }
20988
21083
  });
20989
21084
 
20990
- // ../shared/dist/skills/contracts.js
21085
+ // ../shared/src/skills/contracts.ts
20991
21086
  function defineWireSchema() {
20992
21087
  return (schema) => schema;
20993
21088
  }
@@ -20996,7 +21091,7 @@ function skillInvocationIdentity(invocation) {
20996
21091
  }
20997
21092
  var SKILL_NAME_PATTERN, SHA256_PATTERN, sha256Schema, skillIdSchema, skillVersionIdSchema, runtimeIdSchema, skillPreviewIdSchema, skillCommandIdSchema, skillPackageFileSchema, skillInvocationSchema, MAX_SKILL_INVOCATIONS_PER_MESSAGE, skillInvocationsSchema, runtimeUploadGrantSchema, publishSkillInputSchema, skillFrontmatterAdmissionSchema, skillPackageDiagnosticSchema, scanSkillsInputSchema, skillDiagnosticSchema, discoveredSkillCandidateSchema, skillScanOutcomeSchema, desiredSkillManifestEntrySchema, skillInstallConflictSchema, skillConflictResolutionSchema, desiredSkillManifestSchema, reconcileSkillResultSchema, reconcileSkillsResultSchema, runtimeSkillCommandSchema, skillConflictResolutionResultSchema, publishSkillResultSchema, runtimeSkillSyncRequestSchema, runtimeSkillSyncResponseSchema;
20998
21093
  var init_contracts = __esm({
20999
- "../shared/dist/skills/contracts.js"() {
21094
+ "../shared/src/skills/contracts.ts"() {
21000
21095
  "use strict";
21001
21096
  init_zod();
21002
21097
  init_domain();
@@ -21008,31 +21103,35 @@ var init_contracts = __esm({
21008
21103
  runtimeIdSchema = external_exports.uuid().transform((value) => value);
21009
21104
  skillPreviewIdSchema = external_exports.uuid().transform((value) => value);
21010
21105
  skillCommandIdSchema = external_exports.uuid().transform((value) => value);
21011
- skillPackageFileSchema = defineWireSchema()(external_exports.object({
21012
- path: external_exports.string().min(1),
21013
- kind: external_exports.enum(["instructions", "script", "reference", "asset", "license", "other"]),
21014
- size: external_exports.number().int().nonnegative(),
21015
- mode: external_exports.union([external_exports.literal(420), external_exports.literal(493)]),
21016
- sha256: sha256Schema,
21017
- preview: external_exports.enum(["markdown", "text", "code", "image", "binary"])
21018
- }));
21019
- skillInvocationSchema = defineWireSchema()(external_exports.discriminatedUnion("kind", [
21020
- external_exports.object({
21021
- kind: external_exports.literal("skill_version"),
21022
- skillId: skillIdSchema,
21023
- versionId: skillVersionIdSchema,
21024
- displayName: external_exports.string().trim().min(1).max(128),
21025
- textOffset: external_exports.number().int().nonnegative().optional()
21026
- }),
21106
+ skillPackageFileSchema = defineWireSchema()(
21027
21107
  external_exports.object({
21028
- kind: external_exports.literal("local_skill"),
21029
- runtimeId: runtimeIdSchema,
21030
- localKey: external_exports.string().min(1).max(256),
21031
- contentHash: sha256Schema,
21032
- displayName: external_exports.string().trim().min(1).max(128),
21033
- textOffset: external_exports.number().int().nonnegative().optional()
21108
+ path: external_exports.string().min(1),
21109
+ kind: external_exports.enum(["instructions", "script", "reference", "asset", "license", "other"]),
21110
+ size: external_exports.number().int().nonnegative(),
21111
+ mode: external_exports.union([external_exports.literal(420), external_exports.literal(493)]),
21112
+ sha256: sha256Schema,
21113
+ preview: external_exports.enum(["markdown", "text", "code", "image", "binary"])
21034
21114
  })
21035
- ]));
21115
+ );
21116
+ skillInvocationSchema = defineWireSchema()(
21117
+ external_exports.discriminatedUnion("kind", [
21118
+ external_exports.object({
21119
+ kind: external_exports.literal("skill_version"),
21120
+ skillId: skillIdSchema,
21121
+ versionId: skillVersionIdSchema,
21122
+ displayName: external_exports.string().trim().min(1).max(128),
21123
+ textOffset: external_exports.number().int().nonnegative().optional()
21124
+ }),
21125
+ external_exports.object({
21126
+ kind: external_exports.literal("local_skill"),
21127
+ runtimeId: runtimeIdSchema,
21128
+ localKey: external_exports.string().min(1).max(256),
21129
+ contentHash: sha256Schema,
21130
+ displayName: external_exports.string().trim().min(1).max(128),
21131
+ textOffset: external_exports.number().int().nonnegative().optional()
21132
+ })
21133
+ ])
21134
+ );
21036
21135
  MAX_SKILL_INVOCATIONS_PER_MESSAGE = 8;
21037
21136
  skillInvocationsSchema = external_exports.array(skillInvocationSchema).max(MAX_SKILL_INVOCATIONS_PER_MESSAGE).superRefine((invocations, ctx) => {
21038
21137
  const identities = /* @__PURE__ */ new Set();
@@ -21055,13 +21154,15 @@ var init_contracts = __esm({
21055
21154
  expiresAt: external_exports.iso.datetime(),
21056
21155
  maxBytes: external_exports.number().int().positive().max(SKILL_PACKAGE_LIMITS.maxArchiveBytes)
21057
21156
  });
21058
- publishSkillInputSchema = defineWireSchema()(external_exports.object({
21059
- commandId: skillCommandIdSchema,
21060
- previewId: skillPreviewIdSchema,
21061
- localKey: external_exports.string().min(1).max(256),
21062
- expectedContentHash: sha256Schema,
21063
- uploadGrant: runtimeUploadGrantSchema
21064
- }));
21157
+ publishSkillInputSchema = defineWireSchema()(
21158
+ external_exports.object({
21159
+ commandId: skillCommandIdSchema,
21160
+ previewId: skillPreviewIdSchema,
21161
+ localKey: external_exports.string().min(1).max(256),
21162
+ expectedContentHash: sha256Schema,
21163
+ uploadGrant: runtimeUploadGrantSchema
21164
+ })
21165
+ );
21065
21166
  skillFrontmatterAdmissionSchema = external_exports.looseObject({
21066
21167
  name: external_exports.string().min(1).max(64).regex(SKILL_NAME_PATTERN, "Invalid"),
21067
21168
  description: external_exports.string().trim().min(1).max(1024)
@@ -21072,32 +21173,36 @@ var init_contracts = __esm({
21072
21173
  message: external_exports.string().max(2048),
21073
21174
  path: external_exports.string().max(240).optional()
21074
21175
  });
21075
- scanSkillsInputSchema = defineWireSchema()(external_exports.object({
21076
- mode: external_exports.enum(["incremental", "audit"]),
21077
- reason: external_exports.enum(["startup", "interval", "refresh", "before_publish", "repository_change"]),
21078
- enabledProviderKinds: external_exports.array(external_exports.string().trim().min(1).max(64)).max(20).optional(),
21079
- roots: external_exports.array(external_exports.discriminatedUnion("kind", [
21080
- external_exports.object({
21081
- kind: external_exports.literal("configured"),
21082
- declarationId: external_exports.string().min(1).max(128),
21083
- path: external_exports.string().min(1),
21084
- label: external_exports.string().min(1).max(128),
21085
- precedence: external_exports.number().int().nonnegative()
21086
- }),
21087
- external_exports.object({
21088
- kind: external_exports.literal("repository"),
21089
- repositoryId: external_exports.string().min(1).max(128),
21090
- path: external_exports.string().min(1),
21091
- label: external_exports.string().min(1).max(128)
21092
- }),
21093
- external_exports.object({
21094
- kind: external_exports.literal("drafts"),
21095
- path: external_exports.string().min(1),
21096
- label: external_exports.literal("Alan drafts")
21097
- })
21098
- ])),
21099
- ignoredPaths: external_exports.array(external_exports.string().min(1).max(240)).max(100).optional()
21100
- }));
21176
+ scanSkillsInputSchema = defineWireSchema()(
21177
+ external_exports.object({
21178
+ mode: external_exports.enum(["incremental", "audit"]),
21179
+ reason: external_exports.enum(["startup", "interval", "refresh", "before_publish", "repository_change"]),
21180
+ enabledProviderKinds: external_exports.array(external_exports.string().trim().min(1).max(64)).max(20).optional(),
21181
+ roots: external_exports.array(
21182
+ external_exports.discriminatedUnion("kind", [
21183
+ external_exports.object({
21184
+ kind: external_exports.literal("configured"),
21185
+ declarationId: external_exports.string().min(1).max(128),
21186
+ path: external_exports.string().min(1),
21187
+ label: external_exports.string().min(1).max(128),
21188
+ precedence: external_exports.number().int().nonnegative()
21189
+ }),
21190
+ external_exports.object({
21191
+ kind: external_exports.literal("repository"),
21192
+ repositoryId: external_exports.string().min(1).max(128),
21193
+ path: external_exports.string().min(1),
21194
+ label: external_exports.string().min(1).max(128)
21195
+ }),
21196
+ external_exports.object({
21197
+ kind: external_exports.literal("drafts"),
21198
+ path: external_exports.string().min(1),
21199
+ label: external_exports.literal("Alan drafts")
21200
+ })
21201
+ ])
21202
+ ),
21203
+ ignoredPaths: external_exports.array(external_exports.string().min(1).max(240)).max(100).optional()
21204
+ })
21205
+ );
21101
21206
  skillDiagnosticSchema = external_exports.object({
21102
21207
  code: external_exports.string().min(1).max(128),
21103
21208
  message: external_exports.string().min(1).max(2048),
@@ -21122,27 +21227,29 @@ var init_contracts = __esm({
21122
21227
  ]),
21123
21228
  diagnostics: external_exports.array(skillPackageDiagnosticSchema).max(100)
21124
21229
  });
21125
- skillScanOutcomeSchema = defineWireSchema()(external_exports.discriminatedUnion("status", [
21126
- external_exports.object({
21127
- status: external_exports.literal("complete"),
21128
- attemptId: external_exports.string().min(1).max(128),
21129
- inventoryRevision: sha256Schema,
21130
- candidates: external_exports.array(discoveredSkillCandidateSchema).max(2e3),
21131
- diagnostics: external_exports.array(skillDiagnosticSchema).max(100)
21132
- }),
21133
- external_exports.object({
21134
- status: external_exports.literal("partial"),
21135
- attemptId: external_exports.string().min(1).max(128),
21136
- retainedInventoryRevision: sha256Schema.nullable(),
21137
- diagnostics: external_exports.array(skillDiagnosticSchema).max(100)
21138
- }),
21139
- external_exports.object({
21140
- status: external_exports.literal("failed"),
21141
- attemptId: external_exports.string().min(1).max(128),
21142
- retainedInventoryRevision: sha256Schema.nullable(),
21143
- diagnostics: external_exports.array(skillDiagnosticSchema).max(100)
21144
- })
21145
- ]));
21230
+ skillScanOutcomeSchema = defineWireSchema()(
21231
+ external_exports.discriminatedUnion("status", [
21232
+ external_exports.object({
21233
+ status: external_exports.literal("complete"),
21234
+ attemptId: external_exports.string().min(1).max(128),
21235
+ inventoryRevision: sha256Schema,
21236
+ candidates: external_exports.array(discoveredSkillCandidateSchema).max(2e3),
21237
+ diagnostics: external_exports.array(skillDiagnosticSchema).max(100)
21238
+ }),
21239
+ external_exports.object({
21240
+ status: external_exports.literal("partial"),
21241
+ attemptId: external_exports.string().min(1).max(128),
21242
+ retainedInventoryRevision: sha256Schema.nullable(),
21243
+ diagnostics: external_exports.array(skillDiagnosticSchema).max(100)
21244
+ }),
21245
+ external_exports.object({
21246
+ status: external_exports.literal("failed"),
21247
+ attemptId: external_exports.string().min(1).max(128),
21248
+ retainedInventoryRevision: sha256Schema.nullable(),
21249
+ diagnostics: external_exports.array(skillDiagnosticSchema).max(100)
21250
+ })
21251
+ ])
21252
+ );
21146
21253
  desiredSkillManifestEntrySchema = external_exports.object({
21147
21254
  skillId: skillIdSchema,
21148
21255
  versionId: skillVersionIdSchema,
@@ -21167,32 +21274,34 @@ var init_contracts = __esm({
21167
21274
  }),
21168
21275
  external_exports.object({ kind: external_exports.literal("overwrite_local") })
21169
21276
  ]);
21170
- desiredSkillManifestSchema = defineWireSchema()(external_exports.object({
21171
- protocolVersion: external_exports.literal(SKILLS_PROTOCOL_VERSION),
21172
- revision: sha256Schema,
21173
- skills: external_exports.array(desiredSkillManifestEntrySchema).max(2e3)
21174
- }).superRefine((manifest, context) => {
21175
- const runtimeDirectories = /* @__PURE__ */ new Set();
21176
- const skillIds = /* @__PURE__ */ new Set();
21177
- for (const [index, skill] of manifest.skills.entries()) {
21178
- if (runtimeDirectories.has(skill.runtimeDirectory)) {
21179
- context.addIssue({
21180
- code: external_exports.ZodIssueCode.custom,
21181
- message: `duplicate runtimeDirectory: ${skill.runtimeDirectory}`,
21182
- path: ["skills", index, "runtimeDirectory"]
21183
- });
21184
- }
21185
- if (skillIds.has(skill.skillId)) {
21186
- context.addIssue({
21187
- code: external_exports.ZodIssueCode.custom,
21188
- message: `duplicate skillId: ${skill.skillId}`,
21189
- path: ["skills", index, "skillId"]
21190
- });
21277
+ desiredSkillManifestSchema = defineWireSchema()(
21278
+ external_exports.object({
21279
+ protocolVersion: external_exports.literal(SKILLS_PROTOCOL_VERSION),
21280
+ revision: sha256Schema,
21281
+ skills: external_exports.array(desiredSkillManifestEntrySchema).max(2e3)
21282
+ }).superRefine((manifest, context) => {
21283
+ const runtimeDirectories = /* @__PURE__ */ new Set();
21284
+ const skillIds = /* @__PURE__ */ new Set();
21285
+ for (const [index, skill] of manifest.skills.entries()) {
21286
+ if (runtimeDirectories.has(skill.runtimeDirectory)) {
21287
+ context.addIssue({
21288
+ code: external_exports.ZodIssueCode.custom,
21289
+ message: `duplicate runtimeDirectory: ${skill.runtimeDirectory}`,
21290
+ path: ["skills", index, "runtimeDirectory"]
21291
+ });
21292
+ }
21293
+ if (skillIds.has(skill.skillId)) {
21294
+ context.addIssue({
21295
+ code: external_exports.ZodIssueCode.custom,
21296
+ message: `duplicate skillId: ${skill.skillId}`,
21297
+ path: ["skills", index, "skillId"]
21298
+ });
21299
+ }
21300
+ runtimeDirectories.add(skill.runtimeDirectory);
21301
+ skillIds.add(skill.skillId);
21191
21302
  }
21192
- runtimeDirectories.add(skill.runtimeDirectory);
21193
- skillIds.add(skill.skillId);
21194
- }
21195
- }));
21303
+ })
21304
+ );
21196
21305
  reconcileSkillResultSchema = external_exports.object({
21197
21306
  skillId: skillIdSchema,
21198
21307
  versionId: skillVersionIdSchema,
@@ -21203,111 +21312,129 @@ var init_contracts = __esm({
21203
21312
  errorMessage: external_exports.string().max(2048).optional(),
21204
21313
  conflict: skillInstallConflictSchema.optional()
21205
21314
  });
21206
- reconcileSkillsResultSchema = defineWireSchema()(external_exports.object({
21207
- attemptId: external_exports.string().min(1).max(128),
21208
- desiredRevision: sha256Schema,
21209
- skills: external_exports.array(reconcileSkillResultSchema).max(2e3)
21210
- }));
21211
- runtimeSkillCommandSchema = defineWireSchema()(external_exports.discriminatedUnion("kind", [
21315
+ reconcileSkillsResultSchema = defineWireSchema()(
21212
21316
  external_exports.object({
21213
- kind: external_exports.literal("scan"),
21214
- commandId: skillCommandIdSchema,
21215
- input: scanSkillsInputSchema
21216
- }),
21317
+ attemptId: external_exports.string().min(1).max(128),
21318
+ desiredRevision: sha256Schema,
21319
+ skills: external_exports.array(reconcileSkillResultSchema).max(2e3)
21320
+ })
21321
+ );
21322
+ runtimeSkillCommandSchema = defineWireSchema()(
21323
+ external_exports.discriminatedUnion("kind", [
21324
+ external_exports.object({
21325
+ kind: external_exports.literal("scan"),
21326
+ commandId: skillCommandIdSchema,
21327
+ input: scanSkillsInputSchema
21328
+ }),
21329
+ external_exports.object({
21330
+ kind: external_exports.literal("reconcile"),
21331
+ commandId: skillCommandIdSchema,
21332
+ manifest: desiredSkillManifestSchema
21333
+ }),
21334
+ external_exports.object({
21335
+ kind: external_exports.literal("prepare_preview"),
21336
+ commandId: skillCommandIdSchema,
21337
+ previewId: skillPreviewIdSchema,
21338
+ localKey: external_exports.string().min(1).max(256),
21339
+ expectedContentHash: sha256Schema,
21340
+ uploadGrant: runtimeUploadGrantSchema
21341
+ }),
21342
+ external_exports.object({
21343
+ kind: external_exports.literal("resolve_conflict"),
21344
+ commandId: skillCommandIdSchema,
21345
+ manifest: desiredSkillManifestSchema,
21346
+ skillId: skillIdSchema,
21347
+ versionId: skillVersionIdSchema,
21348
+ expectedConflict: skillInstallConflictSchema,
21349
+ resolution: skillConflictResolutionSchema
21350
+ })
21351
+ ])
21352
+ );
21353
+ skillConflictResolutionResultSchema = defineWireSchema()(
21217
21354
  external_exports.object({
21218
- kind: external_exports.literal("reconcile"),
21219
21355
  commandId: skillCommandIdSchema,
21220
- manifest: desiredSkillManifestSchema
21221
- }),
21356
+ skillId: skillIdSchema,
21357
+ versionId: skillVersionIdSchema,
21358
+ state: external_exports.enum(["applied", "stale", "failed"]),
21359
+ errorCode: external_exports.string().max(128).optional(),
21360
+ errorMessage: external_exports.string().max(2048).optional()
21361
+ })
21362
+ );
21363
+ publishSkillResultSchema = defineWireSchema()(
21222
21364
  external_exports.object({
21223
- kind: external_exports.literal("prepare_preview"),
21224
21365
  commandId: skillCommandIdSchema,
21225
21366
  previewId: skillPreviewIdSchema,
21226
21367
  localKey: external_exports.string().min(1).max(256),
21227
- expectedContentHash: sha256Schema,
21228
- uploadGrant: runtimeUploadGrantSchema
21229
- }),
21368
+ contentHash: sha256Schema,
21369
+ archiveHash: sha256Schema,
21370
+ compressedBytes: external_exports.number().int().positive().max(SKILL_PACKAGE_LIMITS.maxArchiveBytes),
21371
+ state: external_exports.literal("uploaded")
21372
+ })
21373
+ );
21374
+ runtimeSkillSyncRequestSchema = defineWireSchema()(
21230
21375
  external_exports.object({
21231
- kind: external_exports.literal("resolve_conflict"),
21232
- commandId: skillCommandIdSchema,
21233
- manifest: desiredSkillManifestSchema,
21234
- skillId: skillIdSchema,
21235
- versionId: skillVersionIdSchema,
21236
- expectedConflict: skillInstallConflictSchema,
21237
- resolution: skillConflictResolutionSchema
21376
+ protocolVersion: external_exports.literal(SKILLS_PROTOCOL_VERSION),
21377
+ scanRequest: external_exports.object({
21378
+ mode: external_exports.enum(["incremental", "audit"]),
21379
+ reason: external_exports.enum(["startup", "interval", "refresh", "before_publish", "repository_change"])
21380
+ }).optional(),
21381
+ knownDesiredRevision: sha256Schema.optional(),
21382
+ inventoryAttempt: skillScanOutcomeSchema.optional(),
21383
+ appliedResult: reconcileSkillsResultSchema.optional(),
21384
+ publishedPreviews: external_exports.array(publishSkillResultSchema).max(100).optional(),
21385
+ resolvedConflicts: external_exports.array(skillConflictResolutionResultSchema).max(100).optional(),
21386
+ completedCommandIds: external_exports.array(skillCommandIdSchema).max(100).optional()
21238
21387
  })
21239
- ]));
21240
- skillConflictResolutionResultSchema = defineWireSchema()(external_exports.object({
21241
- commandId: skillCommandIdSchema,
21242
- skillId: skillIdSchema,
21243
- versionId: skillVersionIdSchema,
21244
- state: external_exports.enum(["applied", "stale", "failed"]),
21245
- errorCode: external_exports.string().max(128).optional(),
21246
- errorMessage: external_exports.string().max(2048).optional()
21247
- }));
21248
- publishSkillResultSchema = defineWireSchema()(external_exports.object({
21249
- commandId: skillCommandIdSchema,
21250
- previewId: skillPreviewIdSchema,
21251
- localKey: external_exports.string().min(1).max(256),
21252
- contentHash: sha256Schema,
21253
- archiveHash: sha256Schema,
21254
- compressedBytes: external_exports.number().int().positive().max(SKILL_PACKAGE_LIMITS.maxArchiveBytes),
21255
- state: external_exports.literal("uploaded")
21256
- }));
21257
- runtimeSkillSyncRequestSchema = defineWireSchema()(external_exports.object({
21258
- protocolVersion: external_exports.literal(SKILLS_PROTOCOL_VERSION),
21259
- scanRequest: external_exports.object({
21260
- mode: external_exports.enum(["incremental", "audit"]),
21261
- reason: external_exports.enum(["startup", "interval", "refresh", "before_publish", "repository_change"])
21262
- }).optional(),
21263
- knownDesiredRevision: sha256Schema.optional(),
21264
- inventoryAttempt: skillScanOutcomeSchema.optional(),
21265
- appliedResult: reconcileSkillsResultSchema.optional(),
21266
- publishedPreviews: external_exports.array(publishSkillResultSchema).max(100).optional(),
21267
- resolvedConflicts: external_exports.array(skillConflictResolutionResultSchema).max(100).optional(),
21268
- completedCommandIds: external_exports.array(skillCommandIdSchema).max(100).optional()
21269
- }));
21270
- runtimeSkillSyncResponseSchema = defineWireSchema()(external_exports.object({
21271
- acceptedAttemptIds: external_exports.array(external_exports.string().min(1).max(128)).max(100),
21272
- desired: external_exports.discriminatedUnion("state", [
21273
- external_exports.object({ state: external_exports.literal("unchanged"), revision: sha256Schema }),
21274
- external_exports.object({ state: external_exports.literal("replace"), manifest: desiredSkillManifestSchema })
21275
- ]),
21276
- commands: external_exports.array(runtimeSkillCommandSchema).max(100)
21277
- }));
21388
+ );
21389
+ runtimeSkillSyncResponseSchema = defineWireSchema()(
21390
+ external_exports.object({
21391
+ acceptedAttemptIds: external_exports.array(external_exports.string().min(1).max(128)).max(100),
21392
+ desired: external_exports.discriminatedUnion("state", [
21393
+ external_exports.object({ state: external_exports.literal("unchanged"), revision: sha256Schema }),
21394
+ external_exports.object({ state: external_exports.literal("replace"), manifest: desiredSkillManifestSchema })
21395
+ ]),
21396
+ commands: external_exports.array(runtimeSkillCommandSchema).max(100)
21397
+ })
21398
+ );
21278
21399
  }
21279
21400
  });
21280
21401
 
21281
- // ../shared/dist/runtime-v2/run-context.js
21402
+ // ../shared/src/runtime-v2/run-context.ts
21282
21403
  function wire() {
21283
21404
  return (schema) => schema;
21284
21405
  }
21285
21406
  var canonicalUserMessageSchema, canonicalAssistantMessageSchema, externalMcpServerSchema, runAttachmentSchema, parsedAttachmentSchema, taskMetaSchema, pullRequestMetaSchema, agentUserIdentitySchema, workflowToolRefSchema, runPromptContextSchema;
21286
21407
  var init_run_context = __esm({
21287
- "../shared/dist/runtime-v2/run-context.js"() {
21408
+ "../shared/src/runtime-v2/run-context.ts"() {
21288
21409
  "use strict";
21289
21410
  init_zod();
21290
- canonicalUserMessageSchema = wire()(external_exports.object({
21291
- id: external_exports.string().min(1),
21292
- content: external_exports.string(),
21293
- turnOrdinal: external_exports.number().int().nullable(),
21294
- createdAt: external_exports.string().min(1),
21295
- clientMessageId: external_exports.string().min(1).optional(),
21296
- attachmentIds: external_exports.array(external_exports.string().min(1)).optional()
21297
- }));
21298
- canonicalAssistantMessageSchema = wire()(external_exports.object({
21299
- id: external_exports.string().min(1),
21300
- turnOrdinal: external_exports.number().int().nullable(),
21301
- createdAt: external_exports.string().min(1)
21302
- }));
21303
- externalMcpServerSchema = wire()(external_exports.object({
21304
- type: external_exports.enum(["http", "sse", "stdio"]).optional(),
21305
- url: external_exports.string().min(1).optional(),
21306
- headers: external_exports.record(external_exports.string(), external_exports.string()).optional(),
21307
- command: external_exports.string().min(1).optional(),
21308
- args: external_exports.array(external_exports.string()).optional(),
21309
- env: external_exports.record(external_exports.string(), external_exports.string()).optional()
21310
- }));
21411
+ canonicalUserMessageSchema = wire()(
21412
+ external_exports.object({
21413
+ id: external_exports.string().min(1),
21414
+ content: external_exports.string(),
21415
+ turnOrdinal: external_exports.number().int().nullable(),
21416
+ createdAt: external_exports.string().min(1),
21417
+ clientMessageId: external_exports.string().min(1).optional(),
21418
+ attachmentIds: external_exports.array(external_exports.string().min(1)).optional()
21419
+ })
21420
+ );
21421
+ canonicalAssistantMessageSchema = wire()(
21422
+ external_exports.object({
21423
+ id: external_exports.string().min(1),
21424
+ turnOrdinal: external_exports.number().int().nullable(),
21425
+ createdAt: external_exports.string().min(1)
21426
+ })
21427
+ );
21428
+ externalMcpServerSchema = wire()(
21429
+ external_exports.object({
21430
+ type: external_exports.enum(["http", "sse", "stdio"]).optional(),
21431
+ url: external_exports.string().min(1).optional(),
21432
+ headers: external_exports.record(external_exports.string(), external_exports.string()).optional(),
21433
+ command: external_exports.string().min(1).optional(),
21434
+ args: external_exports.array(external_exports.string()).optional(),
21435
+ env: external_exports.record(external_exports.string(), external_exports.string()).optional()
21436
+ })
21437
+ );
21311
21438
  runAttachmentSchema = external_exports.object({
21312
21439
  id: external_exports.string().min(1),
21313
21440
  kind: external_exports.enum(["image", "file"]),
@@ -21322,94 +21449,112 @@ var init_run_context = __esm({
21322
21449
  /** Kept in the session workspace for later turns instead of the run's temporary folder. */
21323
21450
  persist: external_exports.boolean().optional()
21324
21451
  });
21325
- parsedAttachmentSchema = wire()(external_exports.object({
21326
- id: external_exports.string().min(1),
21327
- filename: external_exports.string().min(1),
21328
- mimeType: external_exports.string().min(1),
21329
- kind: external_exports.enum(["pdf", "text", "other"]),
21330
- status: external_exports.enum(["extracted", "partial", "needs_ocr", "unsupported", "too_large", "failed"]),
21331
- content: external_exports.string().nullable(),
21332
- contentTruncated: external_exports.boolean(),
21333
- pageCount: external_exports.number().int().nonnegative().optional(),
21334
- pdfType: external_exports.string().optional(),
21335
- pagesNeedingOcr: external_exports.array(external_exports.number().int()).optional(),
21336
- hasEncodingIssues: external_exports.boolean().optional(),
21337
- errorCode: external_exports.enum([
21338
- "invalid_pdf",
21339
- "encrypted_pdf",
21340
- "native_unavailable",
21341
- "decode_failed",
21342
- "download_failed"
21343
- ]).optional()
21344
- }));
21345
- taskMetaSchema = wire()(external_exports.object({
21346
- id: external_exports.string().min(1),
21347
- title: external_exports.string(),
21348
- description: external_exports.string().nullable(),
21349
- status: external_exports.string(),
21350
- priority: external_exports.string(),
21351
- labels: external_exports.array(external_exports.string()).nullable(),
21352
- assignees: external_exports.array(external_exports.object({ name: external_exports.string().nullable(), email: external_exports.string() })),
21353
- statusOptions: external_exports.array(external_exports.object({
21452
+ parsedAttachmentSchema = wire()(
21453
+ external_exports.object({
21354
21454
  id: external_exports.string().min(1),
21355
- label: external_exports.string(),
21356
- group: external_exports.enum(["not_started", "active", "done", "closed"])
21357
- })).optional(),
21358
- descriptionAttachmentIds: external_exports.array(external_exports.object({ id: external_exports.string().min(1), filename: external_exports.string() })).optional(),
21359
- linkedResources: external_exports.array(external_exports.object({
21455
+ filename: external_exports.string().min(1),
21456
+ mimeType: external_exports.string().min(1),
21457
+ kind: external_exports.enum(["pdf", "text", "other"]),
21458
+ status: external_exports.enum(["extracted", "partial", "needs_ocr", "unsupported", "too_large", "failed"]),
21459
+ content: external_exports.string().nullable(),
21460
+ contentTruncated: external_exports.boolean(),
21461
+ pageCount: external_exports.number().int().nonnegative().optional(),
21462
+ pdfType: external_exports.string().optional(),
21463
+ pagesNeedingOcr: external_exports.array(external_exports.number().int()).optional(),
21464
+ hasEncodingIssues: external_exports.boolean().optional(),
21465
+ errorCode: external_exports.enum([
21466
+ "invalid_pdf",
21467
+ "encrypted_pdf",
21468
+ "native_unavailable",
21469
+ "decode_failed",
21470
+ "download_failed"
21471
+ ]).optional()
21472
+ })
21473
+ );
21474
+ taskMetaSchema = wire()(
21475
+ external_exports.object({
21360
21476
  id: external_exports.string().min(1),
21361
- type: external_exports.enum(["document", "whiteboard", "url"]),
21362
21477
  title: external_exports.string(),
21363
- url: external_exports.string().optional()
21364
- })).optional()
21365
- }));
21366
- pullRequestMetaSchema = wire()(external_exports.object({
21367
- prNumber: external_exports.number().int().positive(),
21368
- owner: external_exports.string().min(1),
21369
- repo: external_exports.string().min(1),
21370
- title: external_exports.string(),
21371
- body: external_exports.string().optional(),
21372
- baseBranch: external_exports.string(),
21373
- headBranch: external_exports.string(),
21374
- author: external_exports.string().optional(),
21375
- state: external_exports.enum(["open", "closed", "merged"]),
21376
- mergeable: external_exports.boolean().nullable().optional(),
21377
- labels: external_exports.array(external_exports.string()),
21378
- changedFilesCount: external_exports.number().int().nonnegative().optional(),
21379
- additions: external_exports.number().int().nonnegative().optional(),
21380
- deletions: external_exports.number().int().nonnegative().optional(),
21381
- changedFiles: external_exports.array(external_exports.object({
21382
- path: external_exports.string(),
21478
+ description: external_exports.string().nullable(),
21383
21479
  status: external_exports.string(),
21384
- additions: external_exports.number().int(),
21385
- deletions: external_exports.number().int()
21386
- })).optional(),
21387
- linkedTaskReadableId: external_exports.string().nullable().optional(),
21388
- linkedTaskId: external_exports.string().nullable().optional(),
21389
- linkedTaskNumber: external_exports.number().int().nullable().optional(),
21390
- htmlUrl: external_exports.string().optional()
21391
- }));
21392
- agentUserIdentitySchema = wire()(external_exports.object({ id: external_exports.string().min(1), name: external_exports.string().nullable(), email: external_exports.string() }));
21393
- workflowToolRefSchema = wire()(external_exports.object({ type: external_exports.string().min(1), id: external_exports.string().min(1) }));
21480
+ priority: external_exports.string(),
21481
+ labels: external_exports.array(external_exports.string()).nullable(),
21482
+ assignees: external_exports.array(external_exports.object({ name: external_exports.string().nullable(), email: external_exports.string() })),
21483
+ statusOptions: external_exports.array(
21484
+ external_exports.object({
21485
+ id: external_exports.string().min(1),
21486
+ label: external_exports.string(),
21487
+ group: external_exports.enum(["not_started", "active", "done", "closed"])
21488
+ })
21489
+ ).optional(),
21490
+ descriptionAttachmentIds: external_exports.array(external_exports.object({ id: external_exports.string().min(1), filename: external_exports.string() })).optional(),
21491
+ linkedResources: external_exports.array(
21492
+ external_exports.object({
21493
+ id: external_exports.string().min(1),
21494
+ type: external_exports.enum(["document", "whiteboard", "url"]),
21495
+ title: external_exports.string(),
21496
+ url: external_exports.string().optional()
21497
+ })
21498
+ ).optional()
21499
+ })
21500
+ );
21501
+ pullRequestMetaSchema = wire()(
21502
+ external_exports.object({
21503
+ prNumber: external_exports.number().int().positive(),
21504
+ owner: external_exports.string().min(1),
21505
+ repo: external_exports.string().min(1),
21506
+ title: external_exports.string(),
21507
+ body: external_exports.string().optional(),
21508
+ baseBranch: external_exports.string(),
21509
+ headBranch: external_exports.string(),
21510
+ author: external_exports.string().optional(),
21511
+ state: external_exports.enum(["open", "closed", "merged"]),
21512
+ mergeable: external_exports.boolean().nullable().optional(),
21513
+ labels: external_exports.array(external_exports.string()),
21514
+ changedFilesCount: external_exports.number().int().nonnegative().optional(),
21515
+ additions: external_exports.number().int().nonnegative().optional(),
21516
+ deletions: external_exports.number().int().nonnegative().optional(),
21517
+ changedFiles: external_exports.array(
21518
+ external_exports.object({
21519
+ path: external_exports.string(),
21520
+ status: external_exports.string(),
21521
+ additions: external_exports.number().int(),
21522
+ deletions: external_exports.number().int()
21523
+ })
21524
+ ).optional(),
21525
+ linkedTaskReadableId: external_exports.string().nullable().optional(),
21526
+ linkedTaskId: external_exports.string().nullable().optional(),
21527
+ linkedTaskNumber: external_exports.number().int().nullable().optional(),
21528
+ htmlUrl: external_exports.string().optional()
21529
+ })
21530
+ );
21531
+ agentUserIdentitySchema = wire()(
21532
+ external_exports.object({ id: external_exports.string().min(1), name: external_exports.string().nullable(), email: external_exports.string() })
21533
+ );
21534
+ workflowToolRefSchema = wire()(
21535
+ external_exports.object({ type: external_exports.string().min(1), id: external_exports.string().min(1) })
21536
+ );
21394
21537
  runPromptContextSchema = external_exports.object({
21395
21538
  taskMeta: taskMetaSchema.optional(),
21396
21539
  prMeta: pullRequestMetaSchema.optional(),
21397
21540
  currentUser: agentUserIdentitySchema.optional(),
21398
21541
  sessionVisibility: external_exports.enum(["private", "team"]).nullable().optional(),
21399
21542
  workflowTools: external_exports.array(workflowToolRefSchema).optional(),
21400
- availableSkills: external_exports.array(external_exports.object({
21401
- name: external_exports.string().min(1),
21402
- description: external_exports.string(),
21403
- packageDirectory: external_exports.string().min(1)
21404
- })).max(2e3).optional()
21543
+ availableSkills: external_exports.array(
21544
+ external_exports.object({
21545
+ name: external_exports.string().min(1),
21546
+ description: external_exports.string(),
21547
+ packageDirectory: external_exports.string().min(1)
21548
+ })
21549
+ ).max(2e3).optional()
21405
21550
  });
21406
21551
  }
21407
21552
  });
21408
21553
 
21409
- // ../shared/dist/runtime-v2/desired-state.js
21410
- var repoLocalPathSchema, requestedCheckoutSchema, runSpecSchema, desiredRunSchema, pendingUploadSchema, desiredStateSchema;
21554
+ // ../shared/src/runtime-v2/desired-state.ts
21555
+ var repoLocalPathSchema, requestedCheckoutSchema, runSpecSchema, desiredRunSchema, pendingUploadSchema, STOP_RUN_IDS_LIMIT, desiredStateSchema;
21411
21556
  var init_desired_state = __esm({
21412
- "../shared/dist/runtime-v2/desired-state.js"() {
21557
+ "../shared/src/runtime-v2/desired-state.ts"() {
21413
21558
  "use strict";
21414
21559
  init_zod();
21415
21560
  init_cloud_repositories();
@@ -21483,20 +21628,26 @@ var init_desired_state = __esm({
21483
21628
  conversationId: conversationIdSchema,
21484
21629
  admittedOffset: external_exports.number().int().nonnegative()
21485
21630
  });
21631
+ STOP_RUN_IDS_LIMIT = 200;
21486
21632
  desiredStateSchema = external_exports.object({
21487
21633
  runs: external_exports.array(desiredRunSchema),
21488
21634
  /** The machine's saved workspaces; replaces the previous server list on every read. */
21489
21635
  approvedWorkspacePaths: external_exports.array(machinePathSchema).max(2e3).optional(),
21490
21636
  /** Absent from an older server: the runtime then uploads only on its own doorbell. */
21491
- pendingUploads: external_exports.array(pendingUploadSchema).optional()
21637
+ pendingUploads: external_exports.array(pendingUploadSchema).optional(),
21638
+ /**
21639
+ * Runs the server ended on its own (stall ceiling, lost VM) that this machine may still hold.
21640
+ * The runtime stops any it holds unended; absence from `runs` alone never stops a run.
21641
+ */
21642
+ stopRunIds: external_exports.array(runIdSchema).max(STOP_RUN_IDS_LIMIT).optional()
21492
21643
  });
21493
21644
  }
21494
21645
  });
21495
21646
 
21496
- // ../shared/dist/runtime-v2/machine-identity.js
21647
+ // ../shared/src/runtime-v2/machine-identity.ts
21497
21648
  var machineEndpointsSchema, machineCredentialGrantSchema, MACHINE_PATHS, machinePlatformSchema, machineRegisterRequestSchema, machineEnrollRequestSchema, machineRenewRequestSchema, machineRenewReusedSchema, deviceAuthorizationSchema, machineDeviceAuthorizationRequestSchema, machineDeviceTokenRequestSchema, machineDeviceTokenSchema, DEVICE_TOKEN_ERRORS, machineDeviceTokenErrorSchema, machineMcpCredentialRequestSchema, machineMcpCredentialSchema, runtimeReleaseSchema, machineSiblingSchema, MACHINE_SIBLINGS_LIMIT, machineSiblingsResponseSchema, runCodexCredentialSchema, runCodexCredentialRefreshRequestSchema, runProviderCredentialSchema;
21498
21649
  var init_machine_identity = __esm({
21499
- "../shared/dist/runtime-v2/machine-identity.js"() {
21650
+ "../shared/src/runtime-v2/machine-identity.ts"() {
21500
21651
  "use strict";
21501
21652
  init_zod();
21502
21653
  init_ids();
@@ -21629,7 +21780,7 @@ var init_machine_identity = __esm({
21629
21780
  }
21630
21781
  });
21631
21782
 
21632
- // ../shared/dist/runtime-v2/link.js
21783
+ // ../shared/src/runtime-v2/link.ts
21633
21784
  function queryResultSchema(value) {
21634
21785
  return external_exports.discriminatedUnion("ok", [
21635
21786
  external_exports.object({ ok: external_exports.literal(true), value }),
@@ -21638,7 +21789,7 @@ function queryResultSchema(value) {
21638
21789
  }
21639
21790
  var LINK_PROTOCOL, linkHandshakeSchema, linkAuthSchema, heldRunStateSchema, heldRunSchema, helloSchema, helloAckSchema, pokeReasonSchema, prewarmPokeSchema, pokeSchema, queryErrorSchema, RUN_ANSWER_MAX_LENGTH, toolCallIdSchema, runAnswerSchema, runRespondRequestSchema, runRespondStatusSchema, runRespondResultSchema, runSteerRequestSchema, runSteerStatusSchema, runSteerResultSchema, backgroundTaskIdSchema, runStopTaskRequestSchema, backgroundTaskStopResultSchema, runStopTaskResultSchema, LINK_CONNECT_ERROR_CODES, linkConnectErrorSchema, LINK_FAILURE_REASONS;
21640
21791
  var init_link = __esm({
21641
- "../shared/dist/runtime-v2/link.js"() {
21792
+ "../shared/src/runtime-v2/link.ts"() {
21642
21793
  "use strict";
21643
21794
  init_zod();
21644
21795
  init_desired_state();
@@ -21702,7 +21853,9 @@ var init_link = __esm({
21702
21853
  answer: runAnswerSchema
21703
21854
  });
21704
21855
  runRespondStatusSchema = external_exports.enum(["delivered", "not_waiting", "unknown_run"]);
21705
- runRespondResultSchema = queryResultSchema(external_exports.object({ status: runRespondStatusSchema }));
21856
+ runRespondResultSchema = queryResultSchema(
21857
+ external_exports.object({ status: runRespondStatusSchema })
21858
+ );
21706
21859
  runSteerRequestSchema = external_exports.object({
21707
21860
  runId: runIdSchema,
21708
21861
  steerId: steerIdSchema,
@@ -21764,10 +21917,10 @@ var init_link = __esm({
21764
21917
  }
21765
21918
  });
21766
21919
 
21767
- // ../shared/dist/runtime-v2/capabilities.js
21920
+ // ../shared/src/runtime-v2/capabilities.ts
21768
21921
  var PROVIDER_MODELS_MAX, providerAuthStateSchema, PROVIDER_MODEL_VARIANTS_MAX, providerModelVariantSchema, providerModelBillingSchema, providerModelSchema, providerModelsSourceSchema, providerCapabilitySchema, machineFactsSchema, machineCapabilitiesSchema, modelsScanRequestSchema, modelsScanResultSchema, capabilitiesAckSchema;
21769
21922
  var init_capabilities = __esm({
21770
- "../shared/dist/runtime-v2/capabilities.js"() {
21923
+ "../shared/src/runtime-v2/capabilities.ts"() {
21771
21924
  "use strict";
21772
21925
  init_zod();
21773
21926
  init_link();
@@ -21816,6 +21969,11 @@ var init_capabilities = __esm({
21816
21969
  machineCapabilitiesSchema = external_exports.object({
21817
21970
  providers: external_exports.array(providerCapabilitySchema).max(64),
21818
21971
  hasGit: external_exports.boolean(),
21972
+ /**
21973
+ * The runtime answers `files.*` workspace queries and pushes `workspace.changed`. Absent: an
21974
+ * older runtime; the server lists and reads files through the sandbox provider instead.
21975
+ */
21976
+ workspaceFiles: external_exports.boolean().optional(),
21819
21977
  machine: machineFactsSchema,
21820
21978
  scannedAt: external_exports.number().int().nonnegative()
21821
21979
  });
@@ -21825,10 +21983,10 @@ var init_capabilities = __esm({
21825
21983
  }
21826
21984
  });
21827
21985
 
21828
- // ../shared/dist/runtime-v2/git-capability.js
21986
+ // ../shared/src/runtime-v2/git-capability.ts
21829
21987
  var machineGitCapabilityRequestSchema, machineGitCapabilityWarningSchema, machineGitCapabilitySchema, machineGitCapabilityRefusalSchema;
21830
21988
  var init_git_capability = __esm({
21831
- "../shared/dist/runtime-v2/git-capability.js"() {
21989
+ "../shared/src/runtime-v2/git-capability.ts"() {
21832
21990
  "use strict";
21833
21991
  init_zod();
21834
21992
  machineGitCapabilityRequestSchema = external_exports.object({
@@ -21852,10 +22010,10 @@ var init_git_capability = __esm({
21852
22010
  }
21853
22011
  });
21854
22012
 
21855
- // ../shared/dist/runtime-v2/github-proxy.js
22013
+ // ../shared/src/runtime-v2/github-proxy.ts
21856
22014
  var GITHUB_PROXY_UPSTREAMS, gitHubProxyUpstreamSchema, GITHUB_PROXY_REFUSAL_CODES, gitHubProxyErrorSchema;
21857
22015
  var init_github_proxy = __esm({
21858
- "../shared/dist/runtime-v2/github-proxy.js"() {
22016
+ "../shared/src/runtime-v2/github-proxy.ts"() {
21859
22017
  "use strict";
21860
22018
  init_zod();
21861
22019
  GITHUB_PROXY_UPSTREAMS = [
@@ -21867,7 +22025,8 @@ var init_github_proxy = __esm({
21867
22025
  GITHUB_PROXY_REFUSAL_CODES = [
21868
22026
  "host_not_proxied",
21869
22027
  "machine_not_allowed",
21870
- "github_not_connected"
22028
+ "github_not_connected",
22029
+ "github_installation_unavailable"
21871
22030
  ];
21872
22031
  gitHubProxyErrorSchema = external_exports.object({
21873
22032
  message: external_exports.string().min(1),
@@ -21878,10 +22037,10 @@ var init_github_proxy = __esm({
21878
22037
  }
21879
22038
  });
21880
22039
 
21881
- // ../shared/dist/agent/problem.js
22040
+ // ../shared/src/agent/problem.ts
21882
22041
  var ALAN_PROBLEM_SEVERITIES, ALAN_PROBLEM_RECOVERY_MODES, AGENT_CLI_PROBLEM_PHASES, AGENT_CLI_PROBLEM_FINALITIES, AGENT_CLI_OUTCOME_CERTAINTIES, AGENT_CLI_RETRY_OWNERS, APPLICATION_PROBLEM_PHASES, APPLICATION_PROBLEM_TRANSPORT_KINDS, AGENT_CLI_PROBLEM_CODES, APPLICATION_PROBLEM_CODES, alanProblemScopeSchema, alanProblemRecoverySchema, alanProblemBaseShape, agentCliProblemOriginSchema, agentCliProblemLifecycleSchema, agentCliProblemNativeSchema, agentCliProblemV1Schema, applicationProblemOriginSchema, applicationProblemTransportSchema, applicationProblemV1Schema, alanProblemV1Schema;
21883
22042
  var init_problem = __esm({
21884
- "../shared/dist/agent/problem.js"() {
22043
+ "../shared/src/agent/problem.ts"() {
21885
22044
  "use strict";
21886
22045
  init_zod();
21887
22046
  ALAN_PROBLEM_SEVERITIES = ["notice", "recoverable", "terminal"];
@@ -22049,10 +22208,10 @@ var init_problem = __esm({
22049
22208
  }
22050
22209
  });
22051
22210
 
22052
- // ../shared/dist/cli-usage.js
22211
+ // ../shared/src/cli-usage.ts
22053
22212
  var usagePercentSchema, usageTimestampSchema, usageAmountSchema, usageObservationShape, cliUsageWindowPatchSchema, cliUsageWindowSchema, cliUsageSpendPatchSchema, cliUsageSpendSchema, cliUsageCreditsPatchSchema, cliUsageCreditsSchema, cliUsageBucketSchema, cliUsageSnapshotSchema;
22054
22213
  var init_cli_usage = __esm({
22055
- "../shared/dist/cli-usage.js"() {
22214
+ "../shared/src/cli-usage.ts"() {
22056
22215
  "use strict";
22057
22216
  init_zod();
22058
22217
  usagePercentSchema = external_exports.number().min(0).max(100);
@@ -22116,10 +22275,10 @@ var init_cli_usage = __esm({
22116
22275
  }
22117
22276
  });
22118
22277
 
22119
- // ../shared/dist/runtime-v2/run-log.js
22278
+ // ../shared/src/runtime-v2/run-log.ts
22120
22279
  var RUN_LOG_PROTOCOL, RUN_LOG_PROTOCOL_HEADER, RUN_STEERS_MAX, runAcceptedUpdateSchema, runStartedUpdateSchema, runCodexRateLimitsUpdateSchema, runWorkspaceRelocatedUpdateSchema, runOutcomeSchema, runRejectionCodeSchema, runEndedUpdateSchema, runLifecycleUpdateSchema, runLogRecordSchema;
22121
22280
  var init_run_log = __esm({
22122
- "../shared/dist/runtime-v2/run-log.js"() {
22281
+ "../shared/src/runtime-v2/run-log.ts"() {
22123
22282
  "use strict";
22124
22283
  init_zod();
22125
22284
  init_problem();
@@ -22199,10 +22358,10 @@ var init_run_log = __esm({
22199
22358
  }
22200
22359
  });
22201
22360
 
22202
- // ../shared/dist/runtime-v2/holder-protocol.js
22361
+ // ../shared/src/runtime-v2/holder-protocol.ts
22203
22362
  var HOLDER_PROTOCOL, holderAbortOutcomeSchema, holderRequestSchema, holderStateSchema, holderSessionFactsSchema, holderMessageSchema, holderLaunchSchema, holderStatusSchema;
22204
22363
  var init_holder_protocol = __esm({
22205
- "../shared/dist/runtime-v2/holder-protocol.js"() {
22364
+ "../shared/src/runtime-v2/holder-protocol.ts"() {
22206
22365
  "use strict";
22207
22366
  init_zod();
22208
22367
  init_desired_state();
@@ -22311,20 +22470,20 @@ var init_holder_protocol = __esm({
22311
22470
  }
22312
22471
  });
22313
22472
 
22314
- // ../shared/dist/runtime-v2/mcp.js
22473
+ // ../shared/src/runtime-v2/mcp.ts
22315
22474
  var init_mcp = __esm({
22316
- "../shared/dist/runtime-v2/mcp.js"() {
22475
+ "../shared/src/runtime-v2/mcp.ts"() {
22317
22476
  "use strict";
22318
22477
  }
22319
22478
  });
22320
22479
 
22321
- // ../shared/dist/runtime-v2/run-log-upload.js
22480
+ // ../shared/src/runtime-v2/run-log-upload.ts
22322
22481
  function runLogUploadPath(conversationId) {
22323
22482
  return `/public/conversations/${encodeURIComponent(conversationId)}/transcript`;
22324
22483
  }
22325
22484
  var DESIRED_STATE_PATH, RUN_LOG_UPLOAD_HEADERS, offsetSchema, runLogUploadReceiptSchema, runLogUploadResponseSchema;
22326
22485
  var init_run_log_upload = __esm({
22327
- "../shared/dist/runtime-v2/run-log-upload.js"() {
22486
+ "../shared/src/runtime-v2/run-log-upload.ts"() {
22328
22487
  "use strict";
22329
22488
  init_zod();
22330
22489
  DESIRED_STATE_PATH = "/public/machines/me/desired";
@@ -22348,10 +22507,10 @@ var init_run_log_upload = __esm({
22348
22507
  }
22349
22508
  });
22350
22509
 
22351
- // ../shared/dist/runtime-v2/run-media.js
22510
+ // ../shared/src/runtime-v2/run-media.ts
22352
22511
  var INT4_MAX, runMediaSourceSchema, runMediaUploadRequestSchema, runMediaUploadTargetSchema, runMediaUploadResponseSchema, runMediaCompleteResponseSchema;
22353
22512
  var init_run_media = __esm({
22354
- "../shared/dist/runtime-v2/run-media.js"() {
22513
+ "../shared/src/runtime-v2/run-media.ts"() {
22355
22514
  "use strict";
22356
22515
  init_zod();
22357
22516
  INT4_MAX = 2147483647;
@@ -22392,10 +22551,10 @@ var init_run_media = __esm({
22392
22551
  }
22393
22552
  });
22394
22553
 
22395
- // ../shared/dist/runtime-v2/skills.js
22554
+ // ../shared/src/runtime-v2/skills.ts
22396
22555
  var MAX_MACHINE_SKILLS, installedMachineSkillSchema, MAX_SKILL_UPLOADS, machineSkillScanRepositorySchema, machineSkillScanContextSchema, machineLocalSkillsReportSchema, machineSkillUploadSchema, machineSkillsSyncRequestSchema, desiredMachineSkillSchema, machineSkillDownloadSchema, machineSkillsSyncResponseSchema;
22397
22556
  var init_skills = __esm({
22398
- "../shared/dist/runtime-v2/skills.js"() {
22557
+ "../shared/src/runtime-v2/skills.ts"() {
22399
22558
  "use strict";
22400
22559
  init_zod();
22401
22560
  init_contracts();
@@ -22498,14 +22657,15 @@ var init_skills = __esm({
22498
22657
  }
22499
22658
  });
22500
22659
 
22501
- // ../shared/dist/runtime-v2/index.js
22660
+ // ../shared/src/runtime-v2/index.ts
22502
22661
  var init_runtime_v2 = __esm({
22503
- "../shared/dist/runtime-v2/index.js"() {
22662
+ "../shared/src/runtime-v2/index.ts"() {
22504
22663
  "use strict";
22505
22664
  init_activity_lease();
22506
22665
  init_agent_context();
22507
22666
  init_capabilities();
22508
22667
  init_desired_state();
22668
+ init_files();
22509
22669
  init_git_capability();
22510
22670
  init_github_proxy();
22511
22671
  init_holder_protocol();
@@ -22748,8 +22908,8 @@ function readBody(incoming, url2, maxBytes) {
22748
22908
  incoming.on("end", () => resolve(Buffer.concat(chunks)));
22749
22909
  });
22750
22910
  }
22751
- function isConnectionReset(error62) {
22752
- return error62 instanceof Error && "code" in error62 && (error62.code === "ECONNRESET" || error62.code === "EPIPE");
22911
+ function isRetryableConnectionError(error62) {
22912
+ return error62 instanceof Error && "code" in error62 && (error62.code === "ECONNABORTED" || error62.code === "ECONNRESET" || error62.code === "EPIPE");
22753
22913
  }
22754
22914
  function exchange(request, agents, attempt = 0) {
22755
22915
  const { signal, url: url2 } = request;
@@ -22777,7 +22937,7 @@ function exchange(request, agents, attempt = 0) {
22777
22937
  };
22778
22938
  let responded = false;
22779
22939
  const onError = (error62) => {
22780
- const stale = outgoing.reusedSocket && !responded && isConnectionReset(error62);
22940
+ const stale = outgoing.reusedSocket && !responded && isRetryableConnectionError(error62);
22781
22941
  if (stale && attempt < STALE_SOCKET_RETRIES && !signal.aborted) {
22782
22942
  settle2();
22783
22943
  resolve(exchange(request, agents, attempt + 1));