@alan-ai-hq/agent-manager-linux-arm64 0.1.173 → 0.1.175

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 +17012 -14353
  2. package/alan-holder.cjs +14509 -12497
  3. package/alan-lease.cjs +503 -316
  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();
@@ -20615,6 +20615,11 @@ var init_activity_lease = __esm({
20615
20615
  mainThreadLagMs: external_exports.number().int().nonnegative(),
20616
20616
  runs: external_exports.array(leasedRunSchema),
20617
20617
  holders: external_exports.array(leasedHolderSchema),
20618
+ /**
20619
+ * Desired runs not started because their conversation is still running an earlier turn.
20620
+ * Absent from older runtimes.
20621
+ */
20622
+ busyRunIds: external_exports.array(runIdSchema).max(200).optional(),
20618
20623
  vm: leasedVmPressureSchema.nullable()
20619
20624
  });
20620
20625
  activityLeaseAckSchema = external_exports.object({
@@ -20627,27 +20632,114 @@ var init_activity_lease = __esm({
20627
20632
  }
20628
20633
  });
20629
20634
 
20630
- // ../shared/dist/constants/cloud-repositories.js
20635
+ // ../shared/src/constants/cloud-repositories.ts
20631
20636
  var MAX_CLOUD_REPOSITORIES, CLOUD_REPOSITORY_LIMIT_MESSAGE;
20632
20637
  var init_cloud_repositories = __esm({
20633
- "../shared/dist/constants/cloud-repositories.js"() {
20638
+ "../shared/src/constants/cloud-repositories.ts"() {
20634
20639
  "use strict";
20635
20640
  MAX_CLOUD_REPOSITORIES = 64;
20636
20641
  CLOUD_REPOSITORY_LIMIT_MESSAGE = `Select at most ${MAX_CLOUD_REPOSITORIES} repositories for one cloud session`;
20637
20642
  }
20638
20643
  });
20639
20644
 
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"() {
20645
+ // ../shared/src/runtime-v2/machine-path.ts
20646
+ var UNSAFE_LINE, CONTROL_CHARACTERS, machinePathSchema;
20647
+ var init_machine_path = __esm({
20648
+ "../shared/src/runtime-v2/machine-path.ts"() {
20644
20649
  "use strict";
20645
20650
  init_zod();
20646
20651
  UNSAFE_LINE = /[\0\r\n]/;
20647
20652
  CONTROL_CHARACTERS = /[\x00-\x1f\x7f]/;
20648
20653
  machinePathSchema = external_exports.string().min(1).max(4096).refine((value) => !UNSAFE_LINE.test(value), "path contains unsafe characters");
20654
+ }
20655
+ });
20656
+
20657
+ // ../shared/src/runtime-v2/files.ts
20658
+ 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;
20659
+ var init_files = __esm({
20660
+ "../shared/src/runtime-v2/files.ts"() {
20661
+ "use strict";
20662
+ init_zod();
20663
+ init_machine_path();
20664
+ FILES_ROOTS_MAX = 16;
20665
+ FILES_DIRS_MAX = 64;
20666
+ FILES_READ_MAX_BYTES = 2 * 1024 * 1024;
20667
+ FILES_WATCH_MAX_TTL_MS = 5 * 6e4;
20668
+ filesDirSchema = external_exports.string().min(1).max(4096).refine(
20669
+ (value) => !value.startsWith("/") && !CONTROL_CHARACTERS.test(value) && !value.split("/").some((segment) => segment === ".." || segment === ""),
20670
+ "not a folder inside the repository"
20671
+ );
20672
+ filesTreeRequestSchema = external_exports.object({
20673
+ method: external_exports.literal("files.tree"),
20674
+ roots: external_exports.array(machinePathSchema).min(1).max(FILES_ROOTS_MAX),
20675
+ /** Read the folders again even when a watched copy is current. */
20676
+ fresh: external_exports.boolean().optional()
20677
+ });
20678
+ filesListDirsRequestSchema = external_exports.object({
20679
+ method: external_exports.literal("files.list_dirs"),
20680
+ root: machinePathSchema,
20681
+ /** `""` asks for the root's direct files only; any other folder is listed with its subtree. */
20682
+ dirs: external_exports.array(external_exports.union([external_exports.literal(""), filesDirSchema])).min(1).max(FILES_DIRS_MAX)
20683
+ });
20684
+ filesReadRequestSchema = external_exports.object({
20685
+ method: external_exports.literal("files.read"),
20686
+ path: machinePathSchema,
20687
+ maxBytes: external_exports.number().int().positive().max(8 * 1024 * 1024).default(FILES_READ_MAX_BYTES)
20688
+ });
20689
+ filesWatchRequestSchema = external_exports.object({
20690
+ method: external_exports.literal("files.watch"),
20691
+ roots: external_exports.array(machinePathSchema).max(FILES_ROOTS_MAX),
20692
+ ttlMs: external_exports.number().int().nonnegative().max(FILES_WATCH_MAX_TTL_MS)
20693
+ });
20694
+ filesTreeValueSchema = external_exports.object({
20695
+ repos: external_exports.array(
20696
+ external_exports.object({
20697
+ root: machinePathSchema,
20698
+ /** Paths relative to `root`: tracked and untracked, never ignored. */
20699
+ files: external_exports.array(external_exports.string()),
20700
+ /** Not a Git checkout, or its listing hit the cap: `files` is what a bounded walk found. */
20701
+ source: external_exports.enum(["git", "walk"]),
20702
+ truncated: external_exports.boolean()
20703
+ })
20704
+ )
20705
+ });
20706
+ filesListDirsValueSchema = external_exports.object({ files: external_exports.array(external_exports.string()) });
20707
+ filesReadValueSchema = external_exports.discriminatedUnion("kind", [
20708
+ external_exports.object({ kind: external_exports.literal("text"), content: external_exports.string(), size: external_exports.number().int().nonnegative() }),
20709
+ external_exports.object({ kind: external_exports.literal("not_file") }),
20710
+ external_exports.object({ kind: external_exports.literal("too_large"), size: external_exports.number().int().nonnegative() }),
20711
+ external_exports.object({ kind: external_exports.literal("binary"), size: external_exports.number().int().nonnegative() })
20712
+ ]);
20713
+ filesWatchValueSchema = external_exports.object({
20714
+ /** Folders under watch across the named repositories. */
20715
+ dirs: external_exports.number().int().nonnegative(),
20716
+ /** The runtime hit its folder cap: changes in unwatched folders are not reported. */
20717
+ limited: external_exports.boolean()
20718
+ });
20719
+ workspaceChangedSchema = external_exports.object({
20720
+ root: machinePathSchema,
20721
+ /** Folders, relative to `root`, whose files were created or removed; `""` is the root. */
20722
+ dirs: external_exports.array(external_exports.string().max(4096)).max(FILES_DIRS_MAX),
20723
+ truncated: external_exports.boolean(),
20724
+ /** Counts this runtime's events for `root`, starting at 1 for each new watch. */
20725
+ seq: external_exports.number().int().positive()
20726
+ });
20727
+ }
20728
+ });
20729
+
20730
+ // ../shared/src/runtime-v2/workspace.ts
20731
+ 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;
20732
+ var init_workspace = __esm({
20733
+ "../shared/src/runtime-v2/workspace.ts"() {
20734
+ "use strict";
20735
+ init_zod();
20736
+ init_files();
20737
+ init_machine_path();
20649
20738
  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");
20739
+ gitBranchSchema = external_exports.string().min(1).max(255).refine(
20740
+ (value) => !value.startsWith("-") && !value.startsWith("+") && !value.includes("..") && !value.includes("@{") && !value.endsWith(".lock") && !/[\s~^:?*[\\]/.test(value) && !CONTROL_CHARACTERS.test(value),
20741
+ "not a safe Git branch name"
20742
+ );
20651
20743
  gitRemoteNameSchema = external_exports.string().regex(/^[A-Za-z0-9][A-Za-z0-9._-]{0,99}$/, "not a safe Git remote name");
20652
20744
  gitRemoteUrlSchema = external_exports.string().min(1).max(2048).refine((value) => !UNSAFE_LINE.test(value), "remote URL contains unsafe characters");
20653
20745
  statusFingerprintSchema = external_exports.string().regex(/^[0-9a-f]{64}$/, "not a status fingerprint");
@@ -20717,7 +20809,11 @@ var init_workspace = __esm({
20717
20809
  gitCheckpointRequestSchema,
20718
20810
  gitPushRequestSchema,
20719
20811
  gitPrepareCheckoutRequestSchema,
20720
- gitVerifyHeadRequestSchema
20812
+ gitVerifyHeadRequestSchema,
20813
+ filesTreeRequestSchema,
20814
+ filesListDirsRequestSchema,
20815
+ filesReadRequestSchema,
20816
+ filesWatchRequestSchema
20721
20817
  ]);
20722
20818
  WORKSPACE_QUERY_METHODS = [
20723
20819
  "workspace.status",
@@ -20725,7 +20821,11 @@ var init_workspace = __esm({
20725
20821
  "git.checkpoint",
20726
20822
  "git.push",
20727
20823
  "git.prepare_checkout",
20728
- "git.verify_head"
20824
+ "git.verify_head",
20825
+ "files.tree",
20826
+ "files.list_dirs",
20827
+ "files.read",
20828
+ "files.watch"
20729
20829
  ];
20730
20830
  workspaceQueryMethodSchema = external_exports.enum(WORKSPACE_QUERY_METHODS);
20731
20831
  workspaceStatusValueSchema = external_exports.object({
@@ -20831,10 +20931,10 @@ var init_workspace = __esm({
20831
20931
  }
20832
20932
  });
20833
20933
 
20834
- // ../shared/dist/runtime-v2/agent-context.js
20934
+ // ../shared/src/runtime-v2/agent-context.ts
20835
20935
  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
20936
  var init_agent_context = __esm({
20837
- "../shared/dist/runtime-v2/agent-context.js"() {
20937
+ "../shared/src/runtime-v2/agent-context.ts"() {
20838
20938
  "use strict";
20839
20939
  init_zod();
20840
20940
  init_cloud_repositories();
@@ -20968,10 +21068,10 @@ var init_agent_context = __esm({
20968
21068
  }
20969
21069
  });
20970
21070
 
20971
- // ../shared/dist/skills/domain.js
21071
+ // ../shared/src/skills/domain.ts
20972
21072
  var SKILLS_PROTOCOL_VERSION, SKILL_PACKAGE_LIMITS;
20973
21073
  var init_domain = __esm({
20974
- "../shared/dist/skills/domain.js"() {
21074
+ "../shared/src/skills/domain.ts"() {
20975
21075
  "use strict";
20976
21076
  SKILLS_PROTOCOL_VERSION = 1;
20977
21077
  SKILL_PACKAGE_LIMITS = {
@@ -20987,7 +21087,7 @@ var init_domain = __esm({
20987
21087
  }
20988
21088
  });
20989
21089
 
20990
- // ../shared/dist/skills/contracts.js
21090
+ // ../shared/src/skills/contracts.ts
20991
21091
  function defineWireSchema() {
20992
21092
  return (schema) => schema;
20993
21093
  }
@@ -20996,7 +21096,7 @@ function skillInvocationIdentity(invocation) {
20996
21096
  }
20997
21097
  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
21098
  var init_contracts = __esm({
20999
- "../shared/dist/skills/contracts.js"() {
21099
+ "../shared/src/skills/contracts.ts"() {
21000
21100
  "use strict";
21001
21101
  init_zod();
21002
21102
  init_domain();
@@ -21008,31 +21108,35 @@ var init_contracts = __esm({
21008
21108
  runtimeIdSchema = external_exports.uuid().transform((value) => value);
21009
21109
  skillPreviewIdSchema = external_exports.uuid().transform((value) => value);
21010
21110
  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
- }),
21111
+ skillPackageFileSchema = defineWireSchema()(
21027
21112
  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()
21113
+ path: external_exports.string().min(1),
21114
+ kind: external_exports.enum(["instructions", "script", "reference", "asset", "license", "other"]),
21115
+ size: external_exports.number().int().nonnegative(),
21116
+ mode: external_exports.union([external_exports.literal(420), external_exports.literal(493)]),
21117
+ sha256: sha256Schema,
21118
+ preview: external_exports.enum(["markdown", "text", "code", "image", "binary"])
21034
21119
  })
21035
- ]));
21120
+ );
21121
+ skillInvocationSchema = defineWireSchema()(
21122
+ external_exports.discriminatedUnion("kind", [
21123
+ external_exports.object({
21124
+ kind: external_exports.literal("skill_version"),
21125
+ skillId: skillIdSchema,
21126
+ versionId: skillVersionIdSchema,
21127
+ displayName: external_exports.string().trim().min(1).max(128),
21128
+ textOffset: external_exports.number().int().nonnegative().optional()
21129
+ }),
21130
+ external_exports.object({
21131
+ kind: external_exports.literal("local_skill"),
21132
+ runtimeId: runtimeIdSchema,
21133
+ localKey: external_exports.string().min(1).max(256),
21134
+ contentHash: sha256Schema,
21135
+ displayName: external_exports.string().trim().min(1).max(128),
21136
+ textOffset: external_exports.number().int().nonnegative().optional()
21137
+ })
21138
+ ])
21139
+ );
21036
21140
  MAX_SKILL_INVOCATIONS_PER_MESSAGE = 8;
21037
21141
  skillInvocationsSchema = external_exports.array(skillInvocationSchema).max(MAX_SKILL_INVOCATIONS_PER_MESSAGE).superRefine((invocations, ctx) => {
21038
21142
  const identities = /* @__PURE__ */ new Set();
@@ -21055,13 +21159,15 @@ var init_contracts = __esm({
21055
21159
  expiresAt: external_exports.iso.datetime(),
21056
21160
  maxBytes: external_exports.number().int().positive().max(SKILL_PACKAGE_LIMITS.maxArchiveBytes)
21057
21161
  });
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
- }));
21162
+ publishSkillInputSchema = defineWireSchema()(
21163
+ external_exports.object({
21164
+ commandId: skillCommandIdSchema,
21165
+ previewId: skillPreviewIdSchema,
21166
+ localKey: external_exports.string().min(1).max(256),
21167
+ expectedContentHash: sha256Schema,
21168
+ uploadGrant: runtimeUploadGrantSchema
21169
+ })
21170
+ );
21065
21171
  skillFrontmatterAdmissionSchema = external_exports.looseObject({
21066
21172
  name: external_exports.string().min(1).max(64).regex(SKILL_NAME_PATTERN, "Invalid"),
21067
21173
  description: external_exports.string().trim().min(1).max(1024)
@@ -21072,32 +21178,36 @@ var init_contracts = __esm({
21072
21178
  message: external_exports.string().max(2048),
21073
21179
  path: external_exports.string().max(240).optional()
21074
21180
  });
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
- }));
21181
+ scanSkillsInputSchema = defineWireSchema()(
21182
+ external_exports.object({
21183
+ mode: external_exports.enum(["incremental", "audit"]),
21184
+ reason: external_exports.enum(["startup", "interval", "refresh", "before_publish", "repository_change"]),
21185
+ enabledProviderKinds: external_exports.array(external_exports.string().trim().min(1).max(64)).max(20).optional(),
21186
+ roots: external_exports.array(
21187
+ external_exports.discriminatedUnion("kind", [
21188
+ external_exports.object({
21189
+ kind: external_exports.literal("configured"),
21190
+ declarationId: external_exports.string().min(1).max(128),
21191
+ path: external_exports.string().min(1),
21192
+ label: external_exports.string().min(1).max(128),
21193
+ precedence: external_exports.number().int().nonnegative()
21194
+ }),
21195
+ external_exports.object({
21196
+ kind: external_exports.literal("repository"),
21197
+ repositoryId: external_exports.string().min(1).max(128),
21198
+ path: external_exports.string().min(1),
21199
+ label: external_exports.string().min(1).max(128)
21200
+ }),
21201
+ external_exports.object({
21202
+ kind: external_exports.literal("drafts"),
21203
+ path: external_exports.string().min(1),
21204
+ label: external_exports.literal("Alan drafts")
21205
+ })
21206
+ ])
21207
+ ),
21208
+ ignoredPaths: external_exports.array(external_exports.string().min(1).max(240)).max(100).optional()
21209
+ })
21210
+ );
21101
21211
  skillDiagnosticSchema = external_exports.object({
21102
21212
  code: external_exports.string().min(1).max(128),
21103
21213
  message: external_exports.string().min(1).max(2048),
@@ -21122,27 +21232,29 @@ var init_contracts = __esm({
21122
21232
  ]),
21123
21233
  diagnostics: external_exports.array(skillPackageDiagnosticSchema).max(100)
21124
21234
  });
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
- ]));
21235
+ skillScanOutcomeSchema = defineWireSchema()(
21236
+ external_exports.discriminatedUnion("status", [
21237
+ external_exports.object({
21238
+ status: external_exports.literal("complete"),
21239
+ attemptId: external_exports.string().min(1).max(128),
21240
+ inventoryRevision: sha256Schema,
21241
+ candidates: external_exports.array(discoveredSkillCandidateSchema).max(2e3),
21242
+ diagnostics: external_exports.array(skillDiagnosticSchema).max(100)
21243
+ }),
21244
+ external_exports.object({
21245
+ status: external_exports.literal("partial"),
21246
+ attemptId: external_exports.string().min(1).max(128),
21247
+ retainedInventoryRevision: sha256Schema.nullable(),
21248
+ diagnostics: external_exports.array(skillDiagnosticSchema).max(100)
21249
+ }),
21250
+ external_exports.object({
21251
+ status: external_exports.literal("failed"),
21252
+ attemptId: external_exports.string().min(1).max(128),
21253
+ retainedInventoryRevision: sha256Schema.nullable(),
21254
+ diagnostics: external_exports.array(skillDiagnosticSchema).max(100)
21255
+ })
21256
+ ])
21257
+ );
21146
21258
  desiredSkillManifestEntrySchema = external_exports.object({
21147
21259
  skillId: skillIdSchema,
21148
21260
  versionId: skillVersionIdSchema,
@@ -21167,32 +21279,34 @@ var init_contracts = __esm({
21167
21279
  }),
21168
21280
  external_exports.object({ kind: external_exports.literal("overwrite_local") })
21169
21281
  ]);
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
- });
21282
+ desiredSkillManifestSchema = defineWireSchema()(
21283
+ external_exports.object({
21284
+ protocolVersion: external_exports.literal(SKILLS_PROTOCOL_VERSION),
21285
+ revision: sha256Schema,
21286
+ skills: external_exports.array(desiredSkillManifestEntrySchema).max(2e3)
21287
+ }).superRefine((manifest, context) => {
21288
+ const runtimeDirectories = /* @__PURE__ */ new Set();
21289
+ const skillIds = /* @__PURE__ */ new Set();
21290
+ for (const [index, skill] of manifest.skills.entries()) {
21291
+ if (runtimeDirectories.has(skill.runtimeDirectory)) {
21292
+ context.addIssue({
21293
+ code: external_exports.ZodIssueCode.custom,
21294
+ message: `duplicate runtimeDirectory: ${skill.runtimeDirectory}`,
21295
+ path: ["skills", index, "runtimeDirectory"]
21296
+ });
21297
+ }
21298
+ if (skillIds.has(skill.skillId)) {
21299
+ context.addIssue({
21300
+ code: external_exports.ZodIssueCode.custom,
21301
+ message: `duplicate skillId: ${skill.skillId}`,
21302
+ path: ["skills", index, "skillId"]
21303
+ });
21304
+ }
21305
+ runtimeDirectories.add(skill.runtimeDirectory);
21306
+ skillIds.add(skill.skillId);
21191
21307
  }
21192
- runtimeDirectories.add(skill.runtimeDirectory);
21193
- skillIds.add(skill.skillId);
21194
- }
21195
- }));
21308
+ })
21309
+ );
21196
21310
  reconcileSkillResultSchema = external_exports.object({
21197
21311
  skillId: skillIdSchema,
21198
21312
  versionId: skillVersionIdSchema,
@@ -21203,111 +21317,145 @@ var init_contracts = __esm({
21203
21317
  errorMessage: external_exports.string().max(2048).optional(),
21204
21318
  conflict: skillInstallConflictSchema.optional()
21205
21319
  });
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", [
21320
+ reconcileSkillsResultSchema = defineWireSchema()(
21212
21321
  external_exports.object({
21213
- kind: external_exports.literal("scan"),
21214
- commandId: skillCommandIdSchema,
21215
- input: scanSkillsInputSchema
21216
- }),
21322
+ attemptId: external_exports.string().min(1).max(128),
21323
+ desiredRevision: sha256Schema,
21324
+ skills: external_exports.array(reconcileSkillResultSchema).max(2e3)
21325
+ })
21326
+ );
21327
+ runtimeSkillCommandSchema = defineWireSchema()(
21328
+ external_exports.discriminatedUnion("kind", [
21329
+ external_exports.object({
21330
+ kind: external_exports.literal("scan"),
21331
+ commandId: skillCommandIdSchema,
21332
+ input: scanSkillsInputSchema
21333
+ }),
21334
+ external_exports.object({
21335
+ kind: external_exports.literal("reconcile"),
21336
+ commandId: skillCommandIdSchema,
21337
+ manifest: desiredSkillManifestSchema
21338
+ }),
21339
+ external_exports.object({
21340
+ kind: external_exports.literal("prepare_preview"),
21341
+ commandId: skillCommandIdSchema,
21342
+ previewId: skillPreviewIdSchema,
21343
+ localKey: external_exports.string().min(1).max(256),
21344
+ expectedContentHash: sha256Schema,
21345
+ uploadGrant: runtimeUploadGrantSchema
21346
+ }),
21347
+ external_exports.object({
21348
+ kind: external_exports.literal("resolve_conflict"),
21349
+ commandId: skillCommandIdSchema,
21350
+ manifest: desiredSkillManifestSchema,
21351
+ skillId: skillIdSchema,
21352
+ versionId: skillVersionIdSchema,
21353
+ expectedConflict: skillInstallConflictSchema,
21354
+ resolution: skillConflictResolutionSchema
21355
+ })
21356
+ ])
21357
+ );
21358
+ skillConflictResolutionResultSchema = defineWireSchema()(
21217
21359
  external_exports.object({
21218
- kind: external_exports.literal("reconcile"),
21219
21360
  commandId: skillCommandIdSchema,
21220
- manifest: desiredSkillManifestSchema
21221
- }),
21361
+ skillId: skillIdSchema,
21362
+ versionId: skillVersionIdSchema,
21363
+ state: external_exports.enum(["applied", "stale", "failed"]),
21364
+ errorCode: external_exports.string().max(128).optional(),
21365
+ errorMessage: external_exports.string().max(2048).optional()
21366
+ })
21367
+ );
21368
+ publishSkillResultSchema = defineWireSchema()(
21222
21369
  external_exports.object({
21223
- kind: external_exports.literal("prepare_preview"),
21224
21370
  commandId: skillCommandIdSchema,
21225
21371
  previewId: skillPreviewIdSchema,
21226
21372
  localKey: external_exports.string().min(1).max(256),
21227
- expectedContentHash: sha256Schema,
21228
- uploadGrant: runtimeUploadGrantSchema
21229
- }),
21373
+ contentHash: sha256Schema,
21374
+ archiveHash: sha256Schema,
21375
+ compressedBytes: external_exports.number().int().positive().max(SKILL_PACKAGE_LIMITS.maxArchiveBytes),
21376
+ state: external_exports.literal("uploaded")
21377
+ })
21378
+ );
21379
+ runtimeSkillSyncRequestSchema = defineWireSchema()(
21230
21380
  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
21381
+ protocolVersion: external_exports.literal(SKILLS_PROTOCOL_VERSION),
21382
+ scanRequest: external_exports.object({
21383
+ mode: external_exports.enum(["incremental", "audit"]),
21384
+ reason: external_exports.enum(["startup", "interval", "refresh", "before_publish", "repository_change"])
21385
+ }).optional(),
21386
+ knownDesiredRevision: sha256Schema.optional(),
21387
+ inventoryAttempt: skillScanOutcomeSchema.optional(),
21388
+ appliedResult: reconcileSkillsResultSchema.optional(),
21389
+ publishedPreviews: external_exports.array(publishSkillResultSchema).max(100).optional(),
21390
+ resolvedConflicts: external_exports.array(skillConflictResolutionResultSchema).max(100).optional(),
21391
+ completedCommandIds: external_exports.array(skillCommandIdSchema).max(100).optional()
21238
21392
  })
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
- }));
21393
+ );
21394
+ runtimeSkillSyncResponseSchema = defineWireSchema()(
21395
+ external_exports.object({
21396
+ acceptedAttemptIds: external_exports.array(external_exports.string().min(1).max(128)).max(100),
21397
+ desired: external_exports.discriminatedUnion("state", [
21398
+ external_exports.object({ state: external_exports.literal("unchanged"), revision: sha256Schema }),
21399
+ external_exports.object({ state: external_exports.literal("replace"), manifest: desiredSkillManifestSchema })
21400
+ ]),
21401
+ commands: external_exports.array(runtimeSkillCommandSchema).max(100)
21402
+ })
21403
+ );
21278
21404
  }
21279
21405
  });
21280
21406
 
21281
- // ../shared/dist/runtime-v2/run-context.js
21407
+ // ../shared/src/runtime-v2/commit-attribution.ts
21408
+ var TRAILER_VALUE, gitCoAuthorSchema, FOREIGN_ATTRIBUTION_PATTERN, FOREIGN_ATTRIBUTION;
21409
+ var init_commit_attribution = __esm({
21410
+ "../shared/src/runtime-v2/commit-attribution.ts"() {
21411
+ "use strict";
21412
+ init_zod();
21413
+ TRAILER_VALUE = /^[^\r\n<>]+$/;
21414
+ gitCoAuthorSchema = external_exports.object({
21415
+ name: external_exports.string().min(1).max(256).regex(TRAILER_VALUE),
21416
+ email: external_exports.string().min(3).max(320).regex(/^[^\s<>]+@[^\s<>]+$/)
21417
+ });
21418
+ FOREIGN_ATTRIBUTION_PATTERN = "^[ ]*((co-authored-by|assisted-by|generated-by|made-with):|(\u{1F916}[ ]*)?generated (with|by) )";
21419
+ FOREIGN_ATTRIBUTION = new RegExp(FOREIGN_ATTRIBUTION_PATTERN, "iu");
21420
+ }
21421
+ });
21422
+
21423
+ // ../shared/src/runtime-v2/run-context.ts
21282
21424
  function wire() {
21283
21425
  return (schema) => schema;
21284
21426
  }
21285
21427
  var canonicalUserMessageSchema, canonicalAssistantMessageSchema, externalMcpServerSchema, runAttachmentSchema, parsedAttachmentSchema, taskMetaSchema, pullRequestMetaSchema, agentUserIdentitySchema, workflowToolRefSchema, runPromptContextSchema;
21286
21428
  var init_run_context = __esm({
21287
- "../shared/dist/runtime-v2/run-context.js"() {
21429
+ "../shared/src/runtime-v2/run-context.ts"() {
21288
21430
  "use strict";
21289
21431
  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
- }));
21432
+ canonicalUserMessageSchema = wire()(
21433
+ external_exports.object({
21434
+ id: external_exports.string().min(1),
21435
+ content: external_exports.string(),
21436
+ turnOrdinal: external_exports.number().int().nullable(),
21437
+ createdAt: external_exports.string().min(1),
21438
+ clientMessageId: external_exports.string().min(1).optional(),
21439
+ attachmentIds: external_exports.array(external_exports.string().min(1)).optional()
21440
+ })
21441
+ );
21442
+ canonicalAssistantMessageSchema = wire()(
21443
+ external_exports.object({
21444
+ id: external_exports.string().min(1),
21445
+ turnOrdinal: external_exports.number().int().nullable(),
21446
+ createdAt: external_exports.string().min(1)
21447
+ })
21448
+ );
21449
+ externalMcpServerSchema = wire()(
21450
+ external_exports.object({
21451
+ type: external_exports.enum(["http", "sse", "stdio"]).optional(),
21452
+ url: external_exports.string().min(1).optional(),
21453
+ headers: external_exports.record(external_exports.string(), external_exports.string()).optional(),
21454
+ command: external_exports.string().min(1).optional(),
21455
+ args: external_exports.array(external_exports.string()).optional(),
21456
+ env: external_exports.record(external_exports.string(), external_exports.string()).optional()
21457
+ })
21458
+ );
21311
21459
  runAttachmentSchema = external_exports.object({
21312
21460
  id: external_exports.string().min(1),
21313
21461
  kind: external_exports.enum(["image", "file"]),
@@ -21322,99 +21470,118 @@ var init_run_context = __esm({
21322
21470
  /** Kept in the session workspace for later turns instead of the run's temporary folder. */
21323
21471
  persist: external_exports.boolean().optional()
21324
21472
  });
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({
21473
+ parsedAttachmentSchema = wire()(
21474
+ external_exports.object({
21354
21475
  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({
21476
+ filename: external_exports.string().min(1),
21477
+ mimeType: external_exports.string().min(1),
21478
+ kind: external_exports.enum(["pdf", "text", "other"]),
21479
+ status: external_exports.enum(["extracted", "partial", "needs_ocr", "unsupported", "too_large", "failed"]),
21480
+ content: external_exports.string().nullable(),
21481
+ contentTruncated: external_exports.boolean(),
21482
+ pageCount: external_exports.number().int().nonnegative().optional(),
21483
+ pdfType: external_exports.string().optional(),
21484
+ pagesNeedingOcr: external_exports.array(external_exports.number().int()).optional(),
21485
+ hasEncodingIssues: external_exports.boolean().optional(),
21486
+ errorCode: external_exports.enum([
21487
+ "invalid_pdf",
21488
+ "encrypted_pdf",
21489
+ "native_unavailable",
21490
+ "decode_failed",
21491
+ "download_failed"
21492
+ ]).optional()
21493
+ })
21494
+ );
21495
+ taskMetaSchema = wire()(
21496
+ external_exports.object({
21360
21497
  id: external_exports.string().min(1),
21361
- type: external_exports.enum(["document", "whiteboard", "url"]),
21362
21498
  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(),
21499
+ description: external_exports.string().nullable(),
21383
21500
  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) }));
21501
+ priority: external_exports.string(),
21502
+ labels: external_exports.array(external_exports.string()).nullable(),
21503
+ assignees: external_exports.array(external_exports.object({ name: external_exports.string().nullable(), email: external_exports.string() })),
21504
+ statusOptions: external_exports.array(
21505
+ external_exports.object({
21506
+ id: external_exports.string().min(1),
21507
+ label: external_exports.string(),
21508
+ group: external_exports.enum(["not_started", "active", "done", "closed"])
21509
+ })
21510
+ ).optional(),
21511
+ descriptionAttachmentIds: external_exports.array(external_exports.object({ id: external_exports.string().min(1), filename: external_exports.string() })).optional(),
21512
+ linkedResources: external_exports.array(
21513
+ external_exports.object({
21514
+ id: external_exports.string().min(1),
21515
+ type: external_exports.enum(["document", "whiteboard", "url"]),
21516
+ title: external_exports.string(),
21517
+ url: external_exports.string().optional()
21518
+ })
21519
+ ).optional()
21520
+ })
21521
+ );
21522
+ pullRequestMetaSchema = wire()(
21523
+ external_exports.object({
21524
+ prNumber: external_exports.number().int().positive(),
21525
+ owner: external_exports.string().min(1),
21526
+ repo: external_exports.string().min(1),
21527
+ title: external_exports.string(),
21528
+ body: external_exports.string().optional(),
21529
+ baseBranch: external_exports.string(),
21530
+ headBranch: external_exports.string(),
21531
+ author: external_exports.string().optional(),
21532
+ state: external_exports.enum(["open", "closed", "merged"]),
21533
+ mergeable: external_exports.boolean().nullable().optional(),
21534
+ labels: external_exports.array(external_exports.string()),
21535
+ changedFilesCount: external_exports.number().int().nonnegative().optional(),
21536
+ additions: external_exports.number().int().nonnegative().optional(),
21537
+ deletions: external_exports.number().int().nonnegative().optional(),
21538
+ changedFiles: external_exports.array(
21539
+ external_exports.object({
21540
+ path: external_exports.string(),
21541
+ status: external_exports.string(),
21542
+ additions: external_exports.number().int(),
21543
+ deletions: external_exports.number().int()
21544
+ })
21545
+ ).optional(),
21546
+ linkedTaskReadableId: external_exports.string().nullable().optional(),
21547
+ linkedTaskId: external_exports.string().nullable().optional(),
21548
+ linkedTaskNumber: external_exports.number().int().nullable().optional(),
21549
+ htmlUrl: external_exports.string().optional()
21550
+ })
21551
+ );
21552
+ agentUserIdentitySchema = wire()(
21553
+ external_exports.object({ id: external_exports.string().min(1), name: external_exports.string().nullable(), email: external_exports.string() })
21554
+ );
21555
+ workflowToolRefSchema = wire()(
21556
+ external_exports.object({ type: external_exports.string().min(1), id: external_exports.string().min(1) })
21557
+ );
21394
21558
  runPromptContextSchema = external_exports.object({
21395
21559
  taskMeta: taskMetaSchema.optional(),
21396
21560
  prMeta: pullRequestMetaSchema.optional(),
21397
21561
  currentUser: agentUserIdentitySchema.optional(),
21398
21562
  sessionVisibility: external_exports.enum(["private", "team"]).nullable().optional(),
21399
21563
  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()
21564
+ availableSkills: external_exports.array(
21565
+ external_exports.object({
21566
+ name: external_exports.string().min(1),
21567
+ description: external_exports.string(),
21568
+ packageDirectory: external_exports.string().min(1)
21569
+ })
21570
+ ).max(2e3).optional()
21405
21571
  });
21406
21572
  }
21407
21573
  });
21408
21574
 
21409
- // ../shared/dist/runtime-v2/desired-state.js
21410
- var repoLocalPathSchema, requestedCheckoutSchema, runSpecSchema, desiredRunSchema, pendingUploadSchema, desiredStateSchema;
21575
+ // ../shared/src/runtime-v2/desired-state.ts
21576
+ var repoLocalPathSchema, requestedCheckoutSchema, runSpecSchema, desiredRunSchema, pendingUploadSchema, STOP_RUN_IDS_LIMIT, desiredStateSchema;
21411
21577
  var init_desired_state = __esm({
21412
- "../shared/dist/runtime-v2/desired-state.js"() {
21578
+ "../shared/src/runtime-v2/desired-state.ts"() {
21413
21579
  "use strict";
21414
21580
  init_zod();
21415
21581
  init_cloud_repositories();
21416
21582
  init_contracts();
21417
21583
  init_agent_context();
21584
+ init_commit_attribution();
21418
21585
  init_ids();
21419
21586
  init_run_context();
21420
21587
  init_workspace();
@@ -21469,7 +21636,9 @@ var init_desired_state = __esm({
21469
21636
  contextGraphEnabled: external_exports.boolean().optional(),
21470
21637
  cloudEnvironmentId: external_exports.guid().optional(),
21471
21638
  sandboxId: external_exports.string().min(1).optional(),
21472
- localRepoUrls: external_exports.array(external_exports.string().min(1)).optional()
21639
+ localRepoUrls: external_exports.array(external_exports.string().min(1)).optional(),
21640
+ /** The deployed GitHub App's bot, credited on every commit the turn makes; absent from older servers. */
21641
+ gitCoAuthor: gitCoAuthorSchema.optional()
21473
21642
  // Never here: the provider API key. The holder fetches it per run (RUN_PROVIDER_CREDENTIAL_PATH).
21474
21643
  });
21475
21644
  desiredRunSchema = external_exports.object({
@@ -21483,20 +21652,26 @@ var init_desired_state = __esm({
21483
21652
  conversationId: conversationIdSchema,
21484
21653
  admittedOffset: external_exports.number().int().nonnegative()
21485
21654
  });
21655
+ STOP_RUN_IDS_LIMIT = 200;
21486
21656
  desiredStateSchema = external_exports.object({
21487
21657
  runs: external_exports.array(desiredRunSchema),
21488
21658
  /** The machine's saved workspaces; replaces the previous server list on every read. */
21489
21659
  approvedWorkspacePaths: external_exports.array(machinePathSchema).max(2e3).optional(),
21490
21660
  /** Absent from an older server: the runtime then uploads only on its own doorbell. */
21491
- pendingUploads: external_exports.array(pendingUploadSchema).optional()
21661
+ pendingUploads: external_exports.array(pendingUploadSchema).optional(),
21662
+ /**
21663
+ * Runs the server ended on its own (stall ceiling, lost VM) that this machine may still hold.
21664
+ * The runtime stops any it holds unended; absence from `runs` alone never stops a run.
21665
+ */
21666
+ stopRunIds: external_exports.array(runIdSchema).max(STOP_RUN_IDS_LIMIT).optional()
21492
21667
  });
21493
21668
  }
21494
21669
  });
21495
21670
 
21496
- // ../shared/dist/runtime-v2/machine-identity.js
21671
+ // ../shared/src/runtime-v2/machine-identity.ts
21497
21672
  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
21673
  var init_machine_identity = __esm({
21499
- "../shared/dist/runtime-v2/machine-identity.js"() {
21674
+ "../shared/src/runtime-v2/machine-identity.ts"() {
21500
21675
  "use strict";
21501
21676
  init_zod();
21502
21677
  init_ids();
@@ -21629,7 +21804,7 @@ var init_machine_identity = __esm({
21629
21804
  }
21630
21805
  });
21631
21806
 
21632
- // ../shared/dist/runtime-v2/link.js
21807
+ // ../shared/src/runtime-v2/link.ts
21633
21808
  function queryResultSchema(value) {
21634
21809
  return external_exports.discriminatedUnion("ok", [
21635
21810
  external_exports.object({ ok: external_exports.literal(true), value }),
@@ -21638,7 +21813,7 @@ function queryResultSchema(value) {
21638
21813
  }
21639
21814
  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
21815
  var init_link = __esm({
21641
- "../shared/dist/runtime-v2/link.js"() {
21816
+ "../shared/src/runtime-v2/link.ts"() {
21642
21817
  "use strict";
21643
21818
  init_zod();
21644
21819
  init_desired_state();
@@ -21702,7 +21877,9 @@ var init_link = __esm({
21702
21877
  answer: runAnswerSchema
21703
21878
  });
21704
21879
  runRespondStatusSchema = external_exports.enum(["delivered", "not_waiting", "unknown_run"]);
21705
- runRespondResultSchema = queryResultSchema(external_exports.object({ status: runRespondStatusSchema }));
21880
+ runRespondResultSchema = queryResultSchema(
21881
+ external_exports.object({ status: runRespondStatusSchema })
21882
+ );
21706
21883
  runSteerRequestSchema = external_exports.object({
21707
21884
  runId: runIdSchema,
21708
21885
  steerId: steerIdSchema,
@@ -21764,10 +21941,10 @@ var init_link = __esm({
21764
21941
  }
21765
21942
  });
21766
21943
 
21767
- // ../shared/dist/runtime-v2/capabilities.js
21944
+ // ../shared/src/runtime-v2/capabilities.ts
21768
21945
  var PROVIDER_MODELS_MAX, providerAuthStateSchema, PROVIDER_MODEL_VARIANTS_MAX, providerModelVariantSchema, providerModelBillingSchema, providerModelSchema, providerModelsSourceSchema, providerCapabilitySchema, machineFactsSchema, machineCapabilitiesSchema, modelsScanRequestSchema, modelsScanResultSchema, capabilitiesAckSchema;
21769
21946
  var init_capabilities = __esm({
21770
- "../shared/dist/runtime-v2/capabilities.js"() {
21947
+ "../shared/src/runtime-v2/capabilities.ts"() {
21771
21948
  "use strict";
21772
21949
  init_zod();
21773
21950
  init_link();
@@ -21816,6 +21993,11 @@ var init_capabilities = __esm({
21816
21993
  machineCapabilitiesSchema = external_exports.object({
21817
21994
  providers: external_exports.array(providerCapabilitySchema).max(64),
21818
21995
  hasGit: external_exports.boolean(),
21996
+ /**
21997
+ * The runtime answers `files.*` workspace queries and pushes `workspace.changed`. Absent: an
21998
+ * older runtime; the server lists and reads files through the sandbox provider instead.
21999
+ */
22000
+ workspaceFiles: external_exports.boolean().optional(),
21819
22001
  machine: machineFactsSchema,
21820
22002
  scannedAt: external_exports.number().int().nonnegative()
21821
22003
  });
@@ -21825,10 +22007,10 @@ var init_capabilities = __esm({
21825
22007
  }
21826
22008
  });
21827
22009
 
21828
- // ../shared/dist/runtime-v2/git-capability.js
22010
+ // ../shared/src/runtime-v2/git-capability.ts
21829
22011
  var machineGitCapabilityRequestSchema, machineGitCapabilityWarningSchema, machineGitCapabilitySchema, machineGitCapabilityRefusalSchema;
21830
22012
  var init_git_capability = __esm({
21831
- "../shared/dist/runtime-v2/git-capability.js"() {
22013
+ "../shared/src/runtime-v2/git-capability.ts"() {
21832
22014
  "use strict";
21833
22015
  init_zod();
21834
22016
  machineGitCapabilityRequestSchema = external_exports.object({
@@ -21852,10 +22034,10 @@ var init_git_capability = __esm({
21852
22034
  }
21853
22035
  });
21854
22036
 
21855
- // ../shared/dist/runtime-v2/github-proxy.js
22037
+ // ../shared/src/runtime-v2/github-proxy.ts
21856
22038
  var GITHUB_PROXY_UPSTREAMS, gitHubProxyUpstreamSchema, GITHUB_PROXY_REFUSAL_CODES, gitHubProxyErrorSchema;
21857
22039
  var init_github_proxy = __esm({
21858
- "../shared/dist/runtime-v2/github-proxy.js"() {
22040
+ "../shared/src/runtime-v2/github-proxy.ts"() {
21859
22041
  "use strict";
21860
22042
  init_zod();
21861
22043
  GITHUB_PROXY_UPSTREAMS = [
@@ -21879,10 +22061,10 @@ var init_github_proxy = __esm({
21879
22061
  }
21880
22062
  });
21881
22063
 
21882
- // ../shared/dist/agent/problem.js
22064
+ // ../shared/src/agent/problem.ts
21883
22065
  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;
21884
22066
  var init_problem = __esm({
21885
- "../shared/dist/agent/problem.js"() {
22067
+ "../shared/src/agent/problem.ts"() {
21886
22068
  "use strict";
21887
22069
  init_zod();
21888
22070
  ALAN_PROBLEM_SEVERITIES = ["notice", "recoverable", "terminal"];
@@ -22050,10 +22232,10 @@ var init_problem = __esm({
22050
22232
  }
22051
22233
  });
22052
22234
 
22053
- // ../shared/dist/cli-usage.js
22235
+ // ../shared/src/cli-usage.ts
22054
22236
  var usagePercentSchema, usageTimestampSchema, usageAmountSchema, usageObservationShape, cliUsageWindowPatchSchema, cliUsageWindowSchema, cliUsageSpendPatchSchema, cliUsageSpendSchema, cliUsageCreditsPatchSchema, cliUsageCreditsSchema, cliUsageBucketSchema, cliUsageSnapshotSchema;
22055
22237
  var init_cli_usage = __esm({
22056
- "../shared/dist/cli-usage.js"() {
22238
+ "../shared/src/cli-usage.ts"() {
22057
22239
  "use strict";
22058
22240
  init_zod();
22059
22241
  usagePercentSchema = external_exports.number().min(0).max(100);
@@ -22117,10 +22299,10 @@ var init_cli_usage = __esm({
22117
22299
  }
22118
22300
  });
22119
22301
 
22120
- // ../shared/dist/runtime-v2/run-log.js
22302
+ // ../shared/src/runtime-v2/run-log.ts
22121
22303
  var RUN_LOG_PROTOCOL, RUN_LOG_PROTOCOL_HEADER, RUN_STEERS_MAX, runAcceptedUpdateSchema, runStartedUpdateSchema, runCodexRateLimitsUpdateSchema, runWorkspaceRelocatedUpdateSchema, runOutcomeSchema, runRejectionCodeSchema, runEndedUpdateSchema, runLifecycleUpdateSchema, runLogRecordSchema;
22122
22304
  var init_run_log = __esm({
22123
- "../shared/dist/runtime-v2/run-log.js"() {
22305
+ "../shared/src/runtime-v2/run-log.ts"() {
22124
22306
  "use strict";
22125
22307
  init_zod();
22126
22308
  init_problem();
@@ -22200,10 +22382,10 @@ var init_run_log = __esm({
22200
22382
  }
22201
22383
  });
22202
22384
 
22203
- // ../shared/dist/runtime-v2/holder-protocol.js
22385
+ // ../shared/src/runtime-v2/holder-protocol.ts
22204
22386
  var HOLDER_PROTOCOL, holderAbortOutcomeSchema, holderRequestSchema, holderStateSchema, holderSessionFactsSchema, holderMessageSchema, holderLaunchSchema, holderStatusSchema;
22205
22387
  var init_holder_protocol = __esm({
22206
- "../shared/dist/runtime-v2/holder-protocol.js"() {
22388
+ "../shared/src/runtime-v2/holder-protocol.ts"() {
22207
22389
  "use strict";
22208
22390
  init_zod();
22209
22391
  init_desired_state();
@@ -22312,20 +22494,20 @@ var init_holder_protocol = __esm({
22312
22494
  }
22313
22495
  });
22314
22496
 
22315
- // ../shared/dist/runtime-v2/mcp.js
22497
+ // ../shared/src/runtime-v2/mcp.ts
22316
22498
  var init_mcp = __esm({
22317
- "../shared/dist/runtime-v2/mcp.js"() {
22499
+ "../shared/src/runtime-v2/mcp.ts"() {
22318
22500
  "use strict";
22319
22501
  }
22320
22502
  });
22321
22503
 
22322
- // ../shared/dist/runtime-v2/run-log-upload.js
22504
+ // ../shared/src/runtime-v2/run-log-upload.ts
22323
22505
  function runLogUploadPath(conversationId) {
22324
22506
  return `/public/conversations/${encodeURIComponent(conversationId)}/transcript`;
22325
22507
  }
22326
22508
  var DESIRED_STATE_PATH, RUN_LOG_UPLOAD_HEADERS, offsetSchema, runLogUploadReceiptSchema, runLogUploadResponseSchema;
22327
22509
  var init_run_log_upload = __esm({
22328
- "../shared/dist/runtime-v2/run-log-upload.js"() {
22510
+ "../shared/src/runtime-v2/run-log-upload.ts"() {
22329
22511
  "use strict";
22330
22512
  init_zod();
22331
22513
  DESIRED_STATE_PATH = "/public/machines/me/desired";
@@ -22349,10 +22531,10 @@ var init_run_log_upload = __esm({
22349
22531
  }
22350
22532
  });
22351
22533
 
22352
- // ../shared/dist/runtime-v2/run-media.js
22534
+ // ../shared/src/runtime-v2/run-media.ts
22353
22535
  var INT4_MAX, runMediaSourceSchema, runMediaUploadRequestSchema, runMediaUploadTargetSchema, runMediaUploadResponseSchema, runMediaCompleteResponseSchema;
22354
22536
  var init_run_media = __esm({
22355
- "../shared/dist/runtime-v2/run-media.js"() {
22537
+ "../shared/src/runtime-v2/run-media.ts"() {
22356
22538
  "use strict";
22357
22539
  init_zod();
22358
22540
  INT4_MAX = 2147483647;
@@ -22393,10 +22575,10 @@ var init_run_media = __esm({
22393
22575
  }
22394
22576
  });
22395
22577
 
22396
- // ../shared/dist/runtime-v2/skills.js
22578
+ // ../shared/src/runtime-v2/skills.ts
22397
22579
  var MAX_MACHINE_SKILLS, installedMachineSkillSchema, MAX_SKILL_UPLOADS, machineSkillScanRepositorySchema, machineSkillScanContextSchema, machineLocalSkillsReportSchema, machineSkillUploadSchema, machineSkillsSyncRequestSchema, desiredMachineSkillSchema, machineSkillDownloadSchema, machineSkillsSyncResponseSchema;
22398
22580
  var init_skills = __esm({
22399
- "../shared/dist/runtime-v2/skills.js"() {
22581
+ "../shared/src/runtime-v2/skills.ts"() {
22400
22582
  "use strict";
22401
22583
  init_zod();
22402
22584
  init_contracts();
@@ -22499,14 +22681,16 @@ var init_skills = __esm({
22499
22681
  }
22500
22682
  });
22501
22683
 
22502
- // ../shared/dist/runtime-v2/index.js
22684
+ // ../shared/src/runtime-v2/index.ts
22503
22685
  var init_runtime_v2 = __esm({
22504
- "../shared/dist/runtime-v2/index.js"() {
22686
+ "../shared/src/runtime-v2/index.ts"() {
22505
22687
  "use strict";
22506
22688
  init_activity_lease();
22507
22689
  init_agent_context();
22508
22690
  init_capabilities();
22691
+ init_commit_attribution();
22509
22692
  init_desired_state();
22693
+ init_files();
22510
22694
  init_git_capability();
22511
22695
  init_github_proxy();
22512
22696
  init_holder_protocol();
@@ -23169,8 +23353,9 @@ function runDirectory(runsDir, runId) {
23169
23353
  }
23170
23354
 
23171
23355
  // src/cli/commands/activity-lease-producer.ts
23172
- function runsKey(runs) {
23173
- return runs.map((run) => `${run.runId}:${run.state}`).sort().join(",");
23356
+ function snapshotKey(snapshot) {
23357
+ const runs = snapshot.runs.map((run) => `${run.runId}:${run.state}`).sort();
23358
+ return `${runs.join(",")}|${[...snapshot.busyRunIds].sort().join(",")}`;
23174
23359
  }
23175
23360
  function delta(current, previous) {
23176
23361
  return previous === void 0 ? 0 : Math.max(0, Math.round(current - previous));
@@ -23257,7 +23442,8 @@ function createLeaseProducer(deps) {
23257
23442
  mainThreadLagMs: Math.max(0, Math.round(deps.mainThreadLagMs())),
23258
23443
  runs: await runs(activities),
23259
23444
  holders: await holders(activities),
23260
- vm: await vmPressure()
23445
+ vm: await vmPressure(),
23446
+ busyRunIds: state.snapshot?.busyRunIds ?? []
23261
23447
  };
23262
23448
  state.sequence += 1;
23263
23449
  return lease;
@@ -23270,7 +23456,7 @@ function createLeaseProducer(deps) {
23270
23456
  };
23271
23457
  return {
23272
23458
  update: (snapshot) => {
23273
- const changed = state.snapshot === null || runsKey(snapshot.runs) !== runsKey(state.snapshot.runs);
23459
+ const changed = state.snapshot === null || snapshotKey(snapshot) !== snapshotKey(state.snapshot);
23274
23460
  state.snapshot = snapshot;
23275
23461
  return changed;
23276
23462
  },
@@ -23331,7 +23517,8 @@ var snapshotRunSchema = external_exports.object({
23331
23517
  var leaseSnapshotSchema = external_exports.object({
23332
23518
  type: external_exports.literal("snapshot"),
23333
23519
  accessToken: external_exports.string().min(1),
23334
- runs: external_exports.array(snapshotRunSchema)
23520
+ runs: external_exports.array(snapshotRunSchema),
23521
+ busyRunIds: external_exports.array(runIdSchema)
23335
23522
  });
23336
23523
  var leaseWorkerMessageSchema = external_exports.object({
23337
23524
  type: external_exports.literal("unauthorized")