@aspectlylabs/mikka 0.0.63 → 0.0.65

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/login.js CHANGED
@@ -264,14 +264,14 @@ var require_semver = __commonJS({
264
264
  if (!m[4]) {
265
265
  this.prerelease = [];
266
266
  } else {
267
- this.prerelease = m[4].split(".").map((id3) => {
268
- if (/^[0-9]+$/.test(id3)) {
269
- const num = +id3;
267
+ this.prerelease = m[4].split(".").map((id4) => {
268
+ if (/^[0-9]+$/.test(id4)) {
269
+ const num = +id4;
270
270
  if (num >= 0 && num < MAX_SAFE_INTEGER) {
271
271
  return num;
272
272
  }
273
273
  }
274
- return id3;
274
+ return id4;
275
275
  });
276
276
  }
277
277
  this.build = m[5] ? m[5].split(".") : [];
@@ -1140,23 +1140,23 @@ var require_range = __commonJS({
1140
1140
  debug("stars", comp);
1141
1141
  return comp;
1142
1142
  };
1143
- var isX = (id3) => !id3 || id3.toLowerCase() === "x" || id3 === "*";
1143
+ var isX = (id4) => !id4 || id4.toLowerCase() === "x" || id4 === "*";
1144
1144
  var invalidXRangeOrder = (M, m, p) => isX(M) && !isX(m) || isX(m) && p && !isX(p);
1145
1145
  var replaceTildes = (comp, options) => {
1146
1146
  return comp.trim().split(/\s+/).map((c) => replaceTilde(c, options)).join(" ");
1147
1147
  };
1148
1148
  var replaceTilde = (comp, options) => {
1149
1149
  const r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE];
1150
- const z27 = options.includePrerelease ? "-0" : "";
1150
+ const z28 = options.includePrerelease ? "-0" : "";
1151
1151
  return comp.replace(r, (_, M, m, p, pr) => {
1152
1152
  debug("tilde", comp, _, M, m, p, pr);
1153
1153
  let ret;
1154
1154
  if (isX(M)) {
1155
1155
  ret = "";
1156
1156
  } else if (isX(m)) {
1157
- ret = `>=${M}.0.0${z27} <${+M + 1}.0.0-0`;
1157
+ ret = `>=${M}.0.0${z28} <${+M + 1}.0.0-0`;
1158
1158
  } else if (isX(p)) {
1159
- ret = `>=${M}.${m}.0${z27} <${M}.${+m + 1}.0-0`;
1159
+ ret = `>=${M}.${m}.0${z28} <${M}.${+m + 1}.0-0`;
1160
1160
  } else if (pr) {
1161
1161
  debug("replaceTilde pr", pr);
1162
1162
  ret = `>=${M}.${m}.${p}-${pr} <${M}.${+m + 1}.0-0`;
@@ -1173,19 +1173,19 @@ var require_range = __commonJS({
1173
1173
  var replaceCaret = (comp, options) => {
1174
1174
  debug("caret", comp, options);
1175
1175
  const r = options.loose ? re[t.CARETLOOSE] : re[t.CARET];
1176
- const z27 = options.includePrerelease ? "-0" : "";
1176
+ const z28 = options.includePrerelease ? "-0" : "";
1177
1177
  return comp.replace(r, (_, M, m, p, pr) => {
1178
1178
  debug("caret", comp, _, M, m, p, pr);
1179
1179
  let ret;
1180
1180
  if (isX(M)) {
1181
1181
  ret = "";
1182
1182
  } else if (isX(m)) {
1183
- ret = `>=${M}.0.0${z27} <${+M + 1}.0.0-0`;
1183
+ ret = `>=${M}.0.0${z28} <${+M + 1}.0.0-0`;
1184
1184
  } else if (isX(p)) {
1185
1185
  if (M === "0") {
1186
- ret = `>=${M}.${m}.0${z27} <${M}.${+m + 1}.0-0`;
1186
+ ret = `>=${M}.${m}.0${z28} <${M}.${+m + 1}.0-0`;
1187
1187
  } else {
1188
- ret = `>=${M}.${m}.0${z27} <${+M + 1}.0.0-0`;
1188
+ ret = `>=${M}.${m}.0${z28} <${+M + 1}.0.0-0`;
1189
1189
  }
1190
1190
  } else if (pr) {
1191
1191
  debug("replaceCaret pr", pr);
@@ -2723,35 +2723,77 @@ var daemonRpc = {
2723
2723
  };
2724
2724
 
2725
2725
  // ../protocol/src/device.ts
2726
- import { z as z13 } from "zod";
2726
+ import { z as z14 } from "zod";
2727
+
2728
+ // ../protocol/src/policy-snapshot.ts
2729
+ import { z as z11 } from "zod";
2730
+ var POLICY_SNAPSHOT_TTL_MS = 5 * 6e4;
2731
+ var id = z11.string().min(1).max(128);
2732
+ var digest = z11.string().regex(/^[a-f0-9]{64}$/);
2733
+ var policyScopeSchema = z11.strictObject({
2734
+ workspaceIds: z11.array(id).max(2),
2735
+ hierarchy: z11.strictObject({ workspaceId: z11.uuid(), teamId: z11.uuid(), projectId: z11.uuid().nullable() }).nullable()
2736
+ });
2737
+ var policySnapshotPayloadSchema = z11.strictObject({
2738
+ version: z11.literal(1),
2739
+ issuer: z11.url().max(1e3),
2740
+ ownerId: id,
2741
+ deviceId: id,
2742
+ runId: id,
2743
+ revision: digest,
2744
+ policyHash: digest,
2745
+ scope: policyScopeSchema,
2746
+ policy: runPolicySchema,
2747
+ issuedAt: z11.number().int().nonnegative(),
2748
+ expiresAt: z11.number().int().nonnegative()
2749
+ });
2750
+ var signedPolicySnapshotSchema = z11.strictObject({
2751
+ algorithm: z11.literal("Ed25519"),
2752
+ keyId: digest,
2753
+ payload: policySnapshotPayloadSchema,
2754
+ signature: z11.string().regex(/^[A-Za-z0-9_-]{86}$/)
2755
+ });
2756
+ var policyDistributionContextSchema = z11.strictObject({
2757
+ version: z11.literal(1),
2758
+ algorithm: z11.literal("Ed25519"),
2759
+ keyId: digest,
2760
+ publicKey: z11.string().regex(/^[A-Za-z0-9_-]{59}$/),
2761
+ issuer: z11.url().max(1e3),
2762
+ ownerId: id,
2763
+ deviceId: id,
2764
+ runId: id,
2765
+ revision: digest,
2766
+ scope: policyScopeSchema,
2767
+ required: z11.boolean()
2768
+ });
2727
2769
 
2728
2770
  // ../protocol/src/skill.ts
2729
- import { z as z12 } from "zod";
2771
+ import { z as z13 } from "zod";
2730
2772
 
2731
2773
  // ../protocol/src/skill-artifact.ts
2732
- import { z as z11 } from "zod";
2733
- var skillArtifactRefSchema = z11.object({
2734
- schemaVersion: z11.literal(1),
2735
- registryId: z11.enum(["mikka-builtin", "mikka-team"]),
2736
- skillId: z11.uuid(),
2737
- versionId: z11.uuid(),
2738
- format: z11.literal("single-skill-md-v1"),
2739
- sha256: z11.string().regex(/^[a-f0-9]{64}$/)
2774
+ import { z as z12 } from "zod";
2775
+ var skillArtifactRefSchema = z12.object({
2776
+ schemaVersion: z12.literal(1),
2777
+ registryId: z12.enum(["mikka-builtin", "mikka-team"]),
2778
+ skillId: z12.uuid(),
2779
+ versionId: z12.uuid(),
2780
+ format: z12.literal("single-skill-md-v1"),
2781
+ sha256: z12.string().regex(/^[a-f0-9]{64}$/)
2740
2782
  }).strict();
2741
- var skillAssignmentReceiptSchema = z11.object({
2742
- id: z11.uuid(),
2743
- runId: z11.uuid(),
2744
- issueId: z11.uuid(),
2745
- agentId: z11.uuid(),
2746
- repoId: z11.uuid(),
2747
- deviceId: z11.uuid(),
2748
- leaseExpiresAt: z11.iso.datetime(),
2749
- assignedAt: z11.iso.datetime(),
2783
+ var skillAssignmentReceiptSchema = z12.object({
2784
+ id: z12.uuid(),
2785
+ runId: z12.uuid(),
2786
+ issueId: z12.uuid(),
2787
+ agentId: z12.uuid(),
2788
+ repoId: z12.uuid(),
2789
+ deviceId: z12.uuid(),
2790
+ leaseExpiresAt: z12.iso.datetime(),
2791
+ assignedAt: z12.iso.datetime(),
2750
2792
  artifact: skillArtifactRefSchema
2751
2793
  }).strict();
2752
- var skillReceiptRevalidationSchema = z11.object({
2794
+ var skillReceiptRevalidationSchema = z12.object({
2753
2795
  skillReceipt: skillAssignmentReceiptSchema,
2754
- leaseExpiresAt: z11.iso.datetime()
2796
+ leaseExpiresAt: z12.iso.datetime()
2755
2797
  }).strict();
2756
2798
 
2757
2799
  // ../protocol/src/skill.ts
@@ -2762,43 +2804,43 @@ var MAX_SKILL_INSTRUCTIONS_LENGTH = 2e4;
2762
2804
  var MAX_SKILL_FILES = 20;
2763
2805
  var MAX_SKILL_FILE_PATH_LENGTH = 200;
2764
2806
  var MAX_SKILL_FILE_CONTENT_LENGTH = 1e5;
2765
- var skillFilePathSchema = z12.string().min(1).max(MAX_SKILL_FILE_PATH_LENGTH).refine(
2807
+ var skillFilePathSchema = z13.string().min(1).max(MAX_SKILL_FILE_PATH_LENGTH).refine(
2766
2808
  (path) => !path.startsWith("/") && !path.includes("\\") && !path.split("/").some((segment) => segment === ".." || segment === ""),
2767
2809
  { message: "A skill file path must be relative and stay inside the skill." }
2768
2810
  );
2769
- var skillFileSchema = z12.object({
2811
+ var skillFileSchema = z13.object({
2770
2812
  path: skillFilePathSchema,
2771
- content: z12.string().max(MAX_SKILL_FILE_CONTENT_LENGTH)
2772
- });
2773
- var skillFilesSchema = z12.array(skillFileSchema).max(MAX_SKILL_FILES);
2774
- var skillNameSchema = z12.string().trim().min(1).max(MAX_SKILL_NAME_LENGTH);
2775
- var skillDescriptionSchema = z12.string().trim().max(MAX_SKILL_DESCRIPTION_LENGTH);
2776
- var skillInstructionsSchema = z12.string().trim().min(1).max(MAX_SKILL_INSTRUCTIONS_LENGTH);
2777
- var runSkillSchema = z12.object({
2778
- id: z12.uuid(),
2813
+ content: z13.string().max(MAX_SKILL_FILE_CONTENT_LENGTH)
2814
+ });
2815
+ var skillFilesSchema = z13.array(skillFileSchema).max(MAX_SKILL_FILES);
2816
+ var skillNameSchema = z13.string().trim().min(1).max(MAX_SKILL_NAME_LENGTH);
2817
+ var skillDescriptionSchema = z13.string().trim().max(MAX_SKILL_DESCRIPTION_LENGTH);
2818
+ var skillInstructionsSchema = z13.string().trim().min(1).max(MAX_SKILL_INSTRUCTIONS_LENGTH);
2819
+ var runSkillSchema = z13.object({
2820
+ id: z13.uuid(),
2779
2821
  name: skillNameSchema,
2780
- description: z12.string().nullable(),
2822
+ description: z13.string().nullable(),
2781
2823
  instructions: skillInstructionsSchema,
2782
2824
  files: skillFilesSchema
2783
2825
  });
2784
- var runSkillRefSchema = z12.object({
2785
- id: z12.uuid(),
2826
+ var runSkillRefSchema = z13.object({
2827
+ id: z13.uuid(),
2786
2828
  name: skillNameSchema
2787
2829
  });
2788
2830
 
2789
2831
  // ../protocol/src/device.ts
2790
- var id = z13.string().min(1).max(64);
2791
- var isoTime = z13.iso.datetime({ offset: true });
2792
- var deviceComputerCapability = z13.object({ installed: z13.boolean(), version: z13.string().max(100).nullable() }).strict();
2793
- var deviceRegistration = z13.object({
2794
- deviceType: z13.enum(["laptop", "server"]).optional(),
2795
- name: z13.string().trim().min(1).max(200),
2796
- hostname: z13.string().max(255).nullable().optional(),
2797
- platform: z13.string().max(50),
2798
- arch: z13.string().max(50),
2799
- daemonVersion: z13.string().max(50),
2800
- protocolVersion: z13.number().int(),
2801
- harnesses: z13.array(harnessInfoSchema).max(20),
2832
+ var id2 = z14.string().min(1).max(64);
2833
+ var isoTime = z14.iso.datetime({ offset: true });
2834
+ var deviceComputerCapability = z14.object({ installed: z14.boolean(), version: z14.string().max(100).nullable() }).strict();
2835
+ var deviceRegistration = z14.object({
2836
+ deviceType: z14.enum(["laptop", "server"]).optional(),
2837
+ name: z14.string().trim().min(1).max(200),
2838
+ hostname: z14.string().max(255).nullable().optional(),
2839
+ platform: z14.string().max(50),
2840
+ arch: z14.string().max(50),
2841
+ daemonVersion: z14.string().max(50),
2842
+ protocolVersion: z14.number().int(),
2843
+ harnesses: z14.array(harnessInfoSchema).max(20),
2802
2844
  computerUse: deviceComputerCapability.optional(),
2803
2845
  /**
2804
2846
  * This machine's one device id, the same in every workspace (ADR ORV-284).
@@ -2806,104 +2848,104 @@ var deviceRegistration = z13.object({
2806
2848
  * An id the server does not know yet becomes the new device's id; another
2807
2849
  * person's id registers a new device.
2808
2850
  */
2809
- deviceId: id.optional(),
2851
+ deviceId: id2.optional(),
2810
2852
  /** Needed only when the user belongs to more than one workspace. */
2811
- workspaceId: z13.uuid().optional()
2853
+ workspaceId: z14.uuid().optional()
2812
2854
  });
2813
- var deviceRegistered = z13.object({
2814
- deviceId: id,
2815
- workspaceId: z13.uuid()
2855
+ var deviceRegistered = z14.object({
2856
+ deviceId: id2,
2857
+ workspaceId: z14.uuid()
2816
2858
  });
2817
- var heartbeatRunSchema = z13.object({
2818
- runId: id,
2859
+ var heartbeatRunSchema = z14.object({
2860
+ runId: id2,
2819
2861
  /** Last tool call, turn boundary or file change (not raw output). */
2820
2862
  lastProgressAt: isoTime
2821
2863
  });
2822
- var deviceManagementCommand = z13.object({ id: z13.uuid(), kind: z13.enum(["redetect", "restart", "update", "uninstall"]) });
2823
- var deviceHeartbeatSchema = z13.object({
2824
- completedDeviceCommands: z13.array(z13.uuid()).max(100).optional(),
2825
- failedDeviceCommands: z13.array(z13.object({ id: z13.uuid(), error: z13.string().max(500) })).max(100).optional(),
2826
- harnesses: z13.array(harnessInfoSchema).max(20),
2864
+ var deviceManagementCommand = z14.object({ id: z14.uuid(), kind: z14.enum(["redetect", "restart", "update", "uninstall"]) });
2865
+ var deviceHeartbeatSchema = z14.object({
2866
+ completedDeviceCommands: z14.array(z14.uuid()).max(100).optional(),
2867
+ failedDeviceCommands: z14.array(z14.object({ id: z14.uuid(), error: z14.string().max(500) })).max(100).optional(),
2868
+ harnesses: z14.array(harnessInfoSchema).max(20),
2827
2869
  computerUse: deviceComputerCapability.optional(),
2828
- deviceType: z13.enum(["laptop", "server"]).optional(),
2829
- runs: z13.array(heartbeatRunSchema).max(500),
2830
- worktreeDiskBytes: z13.number().int().nonnegative(),
2870
+ deviceType: z14.enum(["laptop", "server"]).optional(),
2871
+ runs: z14.array(heartbeatRunSchema).max(500),
2872
+ worktreeDiskBytes: z14.number().int().nonnegative(),
2831
2873
  /**
2832
2874
  * Subscription windows read on this device. Absent when the daemon is not
2833
2875
  * polling. Numbers only, never a vendor credential (ADR 0027).
2834
2876
  */
2835
- quotas: z13.array(quotaSnapshotSchema).max(6).optional()
2877
+ quotas: z14.array(quotaSnapshotSchema).max(6).optional()
2836
2878
  });
2837
- var heartbeatResultSchema = z13.object({
2838
- deviceCommands: z13.array(deviceManagementCommand).max(1).optional(),
2879
+ var heartbeatResultSchema = z14.object({
2880
+ deviceCommands: z14.array(deviceManagementCommand).max(1).optional(),
2839
2881
  /** Renewed lease expiry per run id; a run missing here is not renewed. */
2840
- leases: z13.record(z13.string(), isoTime),
2882
+ leases: z14.record(z14.string(), isoTime),
2841
2883
  /**
2842
2884
  * Runs the device reported that it no longer holds: they ended on the
2843
2885
  * server, or went to another attempt after the lease ran out. The daemon
2844
2886
  * stops them now instead of when their lease runs out.
2845
2887
  */
2846
- revoked: z13.array(id).max(500).optional(),
2888
+ revoked: z14.array(id2).max(500).optional(),
2847
2889
  /** Short-lived cloud device token, returned only over its authenticated link. */
2848
- cloudCredential: z13.string().regex(/^orv_[A-Za-z0-9_-]{43}$/).optional()
2890
+ cloudCredential: z14.string().regex(/^orv_[A-Za-z0-9_-]{43}$/).optional()
2849
2891
  });
2850
2892
  var RUN_CHECKPOINT_MAX_BYTES = 8 * 1024 * 1024;
2851
2893
  var RUN_CHECKPOINT_RECOVERY_MAX_AGE_MS = 30 * 6e4;
2852
- var runCheckpointSchema = z13.object({
2894
+ var runCheckpointSchema = z14.object({
2853
2895
  /** The commit the run's worktree started from. */
2854
- baseCommit: z13.string().regex(/^[0-9a-f]{40,64}$/),
2896
+ baseCommit: z14.string().regex(/^[0-9a-f]{40,64}$/),
2855
2897
  /**
2856
2898
  * `git diff --binary` from `baseCommit` to the whole worktree (tracked
2857
2899
  * and untracked files, ignored ones left out, the agent's own commits
2858
2900
  * included), gzipped, base64.
2859
2901
  */
2860
- patch: z13.string().max(Math.ceil(RUN_CHECKPOINT_MAX_BYTES * 4 / 3) + 4),
2902
+ patch: z14.string().max(Math.ceil(RUN_CHECKPOINT_MAX_BYTES * 4 / 3) + 4),
2861
2903
  /** Files the patch touches. */
2862
- files: z13.number().int().nonnegative(),
2904
+ files: z14.number().int().nonnegative(),
2863
2905
  takenAt: isoTime,
2864
2906
  /** The latest tree could not be checkpointed; it supersedes older patches. */
2865
- unavailableReason: z13.literal("too_large").optional()
2907
+ unavailableReason: z14.literal("too_large").optional()
2866
2908
  });
2867
- var setupRecipeSchema = z13.object({
2909
+ var setupRecipeSchema = z14.object({
2868
2910
  /** Paths relative to the main checkout copied into each new worktree. */
2869
- copyFiles: z13.array(z13.string().max(1e3)).max(200),
2911
+ copyFiles: z14.array(z14.string().max(1e3)).max(200),
2870
2912
  /** Shell command run in the worktree, e.g. `bun install`. */
2871
- command: z13.string().max(2e3).optional(),
2913
+ command: z14.string().max(2e3).optional(),
2872
2914
  /** Approved once per repo by the user; unapproved recipes never run. */
2873
- approved: z13.boolean()
2915
+ approved: z14.boolean()
2874
2916
  });
2875
- var deviceRepoSchema = z13.object({
2876
- repoId: id,
2877
- name: z13.string().max(500),
2917
+ var deviceRepoSchema = z14.object({
2918
+ repoId: id2,
2919
+ name: z14.string().max(500),
2878
2920
  /** Logical repository key; only trusted cloud runtimes use an absolute path. */
2879
- path: z13.string().min(1).max(4e3),
2880
- remoteUrl: z13.string().max(2e3).nullable().optional(),
2921
+ path: z14.string().min(1).max(4e3),
2922
+ remoteUrl: z14.string().max(2e3).nullable().optional(),
2881
2923
  setup: setupRecipeSchema.optional(),
2882
2924
  /** Domains agents may reach in this repo, on top of the harness's own. */
2883
- networkAllow: z13.array(z13.string().min(1).max(253)).max(200).optional(),
2925
+ networkAllow: z14.array(z14.string().min(1).max(253)).max(200).optional(),
2884
2926
  /** Push run branches after a verified hand-in ("always for this repo"). */
2885
- push: z13.object({
2886
- approved: z13.boolean(),
2887
- remote: z13.string().min(1).max(200).optional()
2927
+ push: z14.object({
2928
+ approved: z14.boolean(),
2929
+ remote: z14.string().min(1).max(200).optional()
2888
2930
  }).optional()
2889
2931
  });
2890
- var deviceReposResponse = z13.object({
2891
- repos: z13.array(deviceRepoSchema)
2932
+ var deviceReposResponse = z14.object({
2933
+ repos: z14.array(deviceRepoSchema)
2892
2934
  });
2893
- var pendingRunsResponse = z13.object({ runIds: z13.array(id) });
2935
+ var pendingRunsResponse = z14.object({ runIds: z14.array(id2) });
2894
2936
  var RUN_KINDS = ["implement", "acceptance", "fix", "plan"];
2895
- var runAssignmentSchema = z13.object({
2896
- runId: id,
2897
- issueId: id,
2898
- deviceId: id,
2899
- repoId: id,
2937
+ var runAssignmentSchema = z14.object({
2938
+ runId: id2,
2939
+ issueId: id2,
2940
+ deviceId: id2,
2941
+ repoId: id2,
2900
2942
  /** Clone URL for local runs; hosted computer assignments keep their isolated workspace. */
2901
- remoteUrl: z13.string().min(1).max(4e3).optional(),
2943
+ remoteUrl: z14.string().min(1).max(4e3).optional(),
2902
2944
  /** Absent means origin/HEAD after fetch. */
2903
- baseBranch: z13.string().min(1).max(500).optional(),
2904
- expectedRepoRemote: z13.string().max(2e3).optional(),
2945
+ baseBranch: z14.string().min(1).max(500).optional(),
2946
+ expectedRepoRemote: z14.string().max(2e3).optional(),
2905
2947
  harness: harnessSchema,
2906
- prompt: z13.string().max(1e5),
2948
+ prompt: z14.string().max(1e5),
2907
2949
  /**
2908
2950
  * The model the harness's CLI is asked to run, from the per-harness
2909
2951
  * preference of the person this run works for (ADR 0060). Absent: the
@@ -2912,42 +2954,42 @@ var runAssignmentSchema = z13.object({
2912
2954
  */
2913
2955
  model: modelNameSchema.optional(),
2914
2956
  /** Owner-bound selection only; no subscription credential enters the assignment. */
2915
- subscriptionBinding: z13.object({
2916
- bindingId: z13.uuid(),
2917
- ownerId: z13.string().min(1).max(128),
2918
- workspaceId: z13.uuid(),
2919
- consumerId: z13.uuid(),
2920
- route: z13.enum(["codex_cli", "claude_code_cli"])
2957
+ subscriptionBinding: z14.object({
2958
+ bindingId: z14.uuid(),
2959
+ ownerId: z14.string().min(1).max(128),
2960
+ workspaceId: z14.uuid(),
2961
+ consumerId: z14.uuid(),
2962
+ route: z14.enum(["codex_cli", "claude_code_cli"])
2921
2963
  }).strict().optional(),
2922
2964
  /** Local host authority comes only from the server's owner-bound Bot run. */
2923
- localComputer: z13.object({
2924
- botId: z13.uuid(),
2925
- ownerId: z13.string().min(1).max(128),
2926
- workspaceId: z13.uuid(),
2927
- policyVersion: z13.number().int().nonnegative().max(2147483647),
2928
- permission: z13.enum(["allow", "ask"])
2965
+ localComputer: z14.object({
2966
+ botId: z14.uuid(),
2967
+ ownerId: z14.string().min(1).max(128),
2968
+ workspaceId: z14.uuid(),
2969
+ policyVersion: z14.number().int().nonnegative().max(2147483647),
2970
+ permission: z14.enum(["allow", "ask"])
2929
2971
  }).strict().optional(),
2930
2972
  /** Trusted server assignment; the model cannot choose a Bot or display. */
2931
- computer: z13.object({
2932
- botId: z13.uuid(),
2933
- ownerId: z13.string().min(1).max(128),
2934
- display: z13.string().regex(/^:[1-9][0-9]{0,2}$/),
2935
- policyVersion: z13.number().int().nonnegative().max(2147483647)
2973
+ computer: z14.object({
2974
+ botId: z14.uuid(),
2975
+ ownerId: z14.string().min(1).max(128),
2976
+ display: z14.string().regex(/^:[1-9][0-9]{0,2}$/),
2977
+ policyVersion: z14.number().int().nonnegative().max(2147483647)
2936
2978
  }).strict().optional(),
2937
2979
  /**
2938
2980
  * 4e3: the task's explicit user variables (workspace + matching repository secrets/env, NAME -> value).
2939
2981
  * Cloud workers only. Passed into the task container through its own channel, never into the worker's
2940
2982
  * env, and never written to the run journal.
2941
2983
  */
2942
- taskEnv: z13.record(z13.string().regex(/^[A-Za-z_][A-Za-z0-9_]{0,127}$/), z13.string().max(65536)).optional(),
2984
+ taskEnv: z14.record(z14.string().regex(/^[A-Za-z_][A-Za-z0-9_]{0,127}$/), z14.string().max(65536)).optional(),
2943
2985
  /**
2944
2986
  * Names in `taskEnv` that are secrets (kind 'secret'; env vars are not listed). The daemon masks
2945
2987
  * their values (raw + standard base64) in run output before anything is uploaded; the server
2946
2988
  * masks again. Older daemons strip this field and rely on server-side masking only.
2947
2989
  */
2948
- taskSecretNames: z13.array(z13.string().regex(/^[A-Za-z_][A-Za-z0-9_]{0,127}$/)).max(500).optional(),
2990
+ taskSecretNames: z14.array(z14.string().regex(/^[A-Za-z_][A-Za-z0-9_]{0,127}$/)).max(500).optional(),
2949
2991
  /** Mock harness only: fixture name under `packages/daemon/fixtures`. */
2950
- fixture: z13.string().max(200).optional(),
2992
+ fixture: z14.string().max(200).optional(),
2951
2993
  /**
2952
2994
  * The issue's branch (`mikka/<team>-<number>`, ADR 0024): every run of
2953
2995
  * the issue pushes its verified commit here, so one pull request follows
@@ -2955,9 +2997,9 @@ var runAssignmentSchema = z13.object({
2955
2997
  * this branch from the remote when it exists. Without it the daemon
2956
2998
  * pushes the run's own branch.
2957
2999
  */
2958
- pushBranch: z13.string().min(1).max(250).optional(),
3000
+ pushBranch: z14.string().min(1).max(250).optional(),
2959
3001
  /** Run by the daemon in the worktree after the agent submits. */
2960
- verifyCommand: z13.string().max(2e3).optional(),
3002
+ verifyCommand: z14.string().max(2e3).optional(),
2961
3003
  /** Run lease; renewed through the device heartbeat. */
2962
3004
  leaseExpiresAt: isoTime.optional(),
2963
3005
  /**
@@ -2966,27 +3008,27 @@ var runAssignmentSchema = z13.object({
2966
3008
  * it stops working when the run ends. Absent: the server could not issue
2967
3009
  * one, and the run goes ahead without it.
2968
3010
  */
2969
- mcp: z13.object({ url: z13.url(), token: z13.string().min(1).max(200), mailbox: z13.literal(true).optional() }).optional(),
3011
+ mcp: z14.object({ url: z14.url(), token: z14.string().min(1).max(200), mailbox: z14.literal(true).optional() }).optional(),
2970
3012
  /** Agent-owned GitHub delivery; the same run token exchanges short-lived credentials. */
2971
- github: z13.object({
2972
- endpoint: z13.url(),
2973
- repository: z13.string().regex(/^[a-z0-9_.-]+\/[a-z0-9_.-]+$/),
2974
- branch: z13.string().regex(/^mikka\/[a-z0-9-]+-[1-9][0-9]*$/)
3013
+ github: z14.object({
3014
+ endpoint: z14.url(),
3015
+ repository: z14.string().regex(/^[a-z0-9_.-]+\/[a-z0-9_.-]+$/),
3016
+ branch: z14.string().regex(/^mikka\/[a-z0-9-]+-[1-9][0-9]*$/)
2975
3017
  }).strict().optional(),
2976
3018
  /** Question continuation must not silently open a different session. */
2977
3019
  /**
2978
3020
  * What the orchestrator dispatched this run for (ADR 0023). `plan` writes a
2979
3021
  * spec and proposes a split instead of changing code (ADR ORV-205).
2980
3022
  */
2981
- kind: z13.enum(RUN_KINDS).optional(),
3023
+ kind: z14.enum(RUN_KINDS).optional(),
2982
3024
  /**
2983
3025
  * The earlier run this one continues (continue, fix, answer, a person's
2984
3026
  * message): the daemon works on in that run's worktree, on this run's
2985
3027
  * branch, so nothing the earlier run left uncommitted is lost.
2986
3028
  */
2987
- continuesRunId: id.optional(),
3029
+ continuesRunId: id2.optional(),
2988
3030
  /** A same-device retry with no usable snapshot must reuse its real worktree. */
2989
- requireWorktreeContinuation: z13.literal(true).optional(),
3031
+ requireWorktreeContinuation: z14.literal(true).optional(),
2990
3032
  /**
2991
3033
  * The latest checkpoint of the attempt this run takes over after its
2992
3034
  * machine went offline. Used only for a new worktree (another machine, or
@@ -2999,37 +3041,40 @@ var runAssignmentSchema = z13.object({
2999
3041
  * The harness session to continue. A daemon that cannot resume starts a
3000
3042
  * new session with `prompt`, which always carries the full brief.
3001
3043
  */
3002
- resumeSessionId: z13.string().max(500).optional(),
3003
- requireSessionResume: z13.boolean().optional(),
3004
- preserveQuestionWorktree: z13.boolean().optional(),
3005
- questionId: z13.uuid().optional(),
3044
+ resumeSessionId: z14.string().max(500).optional(),
3045
+ requireSessionResume: z14.boolean().optional(),
3046
+ preserveQuestionWorktree: z14.boolean().optional(),
3047
+ questionId: z14.uuid().optional(),
3006
3048
  /**
3007
3049
  * What this run adds on top of the brief (a person's message, an answer,
3008
3050
  * a fix request). A resumed session gets only this as its next message;
3009
3051
  * a new session gets `prompt`, which already includes it.
3010
3052
  */
3011
- followUp: z13.string().max(1e5).optional(),
3053
+ followUp: z14.string().max(1e5).optional(),
3012
3054
  /**
3013
3055
  * The workspace's agent permissions and network allow-list (ADR 0028).
3014
3056
  * Absent from an older server: the daemon applies the ADR 0009 defaults.
3015
3057
  */
3016
3058
  policy: runPolicySchema.optional(),
3017
3059
  /** Trusted server revision for the exact run policy; older servers omit it. */
3018
- policyRevision: z13.string().regex(/^[a-f0-9]{64}$/).optional(),
3060
+ policyRevision: z14.string().regex(/^[a-f0-9]{64}$/).optional(),
3061
+ /** Only a trusted server context can make a snapshot required. */
3062
+ policySnapshotRequired: z14.boolean().optional(),
3063
+ policySnapshot: signedPolicySnapshotSchema.optional(),
3019
3064
  /**
3020
3065
  * The skills mounted on this run's agent and still enabled, resolved at
3021
3066
  * claim time the way `policy` is. The daemon inlines them into the agent's
3022
3067
  * brief and writes them under the run's directory. Absent from an older
3023
3068
  * server: the run simply has none.
3024
3069
  */
3025
- skills: z13.array(runSkillSchema).max(MAX_SKILLS_PER_RUN).optional(),
3070
+ skills: z14.array(runSkillSchema).max(MAX_SKILLS_PER_RUN).optional(),
3026
3071
  /** Server-minted assignment provenance; does not grant any policy permission. */
3027
3072
  skillReceipt: skillAssignmentReceiptSchema.optional(),
3028
3073
  /** Frozen by the server benchmark ledger; never extracted from model output. */
3029
3074
  benchmark: runBenchmarkContext.optional()
3030
3075
  });
3031
- var runPatchSchema = z13.object({
3032
- state: z13.enum([
3076
+ var runPatchSchema = z14.object({
3077
+ state: z14.enum([
3033
3078
  "queued",
3034
3079
  "preparing",
3035
3080
  "running",
@@ -3040,69 +3085,69 @@ var runPatchSchema = z13.object({
3040
3085
  "failed",
3041
3086
  "cancelled"
3042
3087
  ]),
3043
- sessionId: z13.string().max(500).nullable().optional(),
3044
- worktree: z13.string().max(4e3).nullable().optional(),
3045
- error: z13.string().max(1e4).nullable().optional(),
3088
+ sessionId: z14.string().max(500).nullable().optional(),
3089
+ worktree: z14.string().max(4e3).nullable().optional(),
3090
+ error: z14.string().max(1e4).nullable().optional(),
3046
3091
  /** Set on every terminal state. */
3047
3092
  stopReason: runStopReason.optional()
3048
3093
  });
3049
- var runEventBatchSchema = z13.object({
3050
- fromSeq: z13.number().int().min(1),
3051
- chunks: z13.array(z13.looseObject({ type: z13.string() })).min(1).max(1e3)
3094
+ var runEventBatchSchema = z14.object({
3095
+ fromSeq: z14.number().int().min(1),
3096
+ chunks: z14.array(z14.looseObject({ type: z14.string() })).min(1).max(1e3)
3052
3097
  });
3053
- var runEventsAccepted = z13.object({
3098
+ var runEventsAccepted = z14.object({
3054
3099
  /** Producer seq of the last chunk the server holds for this run. */
3055
- offset: z13.string()
3056
- });
3057
- var runCommandSchema = z13.discriminatedUnion("kind", [
3058
- z13.object({
3059
- kind: z13.literal("input"),
3060
- runId: id,
3061
- messageId: z13.uuid(),
3062
- text: z13.string().min(1).max(1e5)
3100
+ offset: z14.string()
3101
+ });
3102
+ var runCommandSchema = z14.discriminatedUnion("kind", [
3103
+ z14.object({
3104
+ kind: z14.literal("input"),
3105
+ runId: id2,
3106
+ messageId: z14.uuid(),
3107
+ text: z14.string().min(1).max(1e5)
3063
3108
  }),
3064
- z13.object({ kind: z13.literal("stop"), runId: id })
3109
+ z14.object({ kind: z14.literal("stop"), runId: id2 })
3065
3110
  ]);
3066
- var runCommandsResponse = z13.object({
3067
- commands: z13.array(runCommandSchema).max(500)
3111
+ var runCommandsResponse = z14.object({
3112
+ commands: z14.array(runCommandSchema).max(500)
3068
3113
  });
3069
- var runCommandsAck = z13.object({
3070
- delivered: z13.array(z13.uuid()).max(500)
3114
+ var runCommandsAck = z14.object({
3115
+ delivered: z14.array(z14.uuid()).max(500)
3071
3116
  });
3072
3117
  var FS_MAX_ENTRIES = 500;
3073
- var fsBrowseRequest = z13.object({
3118
+ var fsBrowseRequest = z14.object({
3074
3119
  /** Absolute path on the device; omitted: the device's home folder. */
3075
- path: z13.string().trim().min(1).max(4e3).optional(),
3076
- showHidden: z13.boolean().optional()
3120
+ path: z14.string().trim().min(1).max(4e3).optional(),
3121
+ showHidden: z14.boolean().optional()
3077
3122
  });
3078
- var fsPendingRequest = fsBrowseRequest.extend({ id: z13.uuid() });
3079
- var fsRequestsResponse = z13.object({
3080
- requests: z13.array(fsPendingRequest).max(50)
3123
+ var fsPendingRequest = fsBrowseRequest.extend({ id: z14.uuid() });
3124
+ var fsRequestsResponse = z14.object({
3125
+ requests: z14.array(fsPendingRequest).max(50)
3081
3126
  });
3082
- var fsEntry = z13.object({
3083
- name: z13.string().max(1e3),
3084
- path: z13.string().max(4e3),
3127
+ var fsEntry = z14.object({
3128
+ name: z14.string().max(1e3),
3129
+ path: z14.string().max(4e3),
3085
3130
  /** The folder is the top level of a git repo (it has a `.git`). */
3086
- isRepo: z13.boolean()
3131
+ isRepo: z14.boolean()
3087
3132
  });
3088
- var fsListing = z13.object({
3089
- ok: z13.literal(true),
3090
- path: z13.string().max(4e3),
3133
+ var fsListing = z14.object({
3134
+ ok: z14.literal(true),
3135
+ path: z14.string().max(4e3),
3091
3136
  /** Null at the filesystem root. */
3092
- parent: z13.string().max(4e3).nullable(),
3093
- home: z13.string().max(4e3),
3137
+ parent: z14.string().max(4e3).nullable(),
3138
+ home: z14.string().max(4e3),
3094
3139
  /** `darwin`, `linux`, `win32`: for path separators and wording. */
3095
- platform: z13.string().max(50),
3096
- entries: z13.array(fsEntry).max(FS_MAX_ENTRIES),
3140
+ platform: z14.string().max(50),
3141
+ entries: z14.array(fsEntry).max(FS_MAX_ENTRIES),
3097
3142
  /** More folders existed than `FS_MAX_ENTRIES`. */
3098
- truncated: z13.boolean(),
3143
+ truncated: z14.boolean(),
3099
3144
  /**
3100
3145
  * The git repo `path` is in, if any: its top level and `origin` (or the
3101
3146
  * first remote). This is what `device.addRepo` should be given.
3102
3147
  */
3103
- repo: z13.object({
3104
- path: z13.string().max(4e3),
3105
- remoteUrl: z13.string().max(2e3).nullable()
3148
+ repo: z14.object({
3149
+ path: z14.string().max(4e3),
3150
+ remoteUrl: z14.string().max(2e3).nullable()
3106
3151
  }).nullable()
3107
3152
  });
3108
3153
  var FS_ERROR_CODES = [
@@ -3111,46 +3156,46 @@ var FS_ERROR_CODES = [
3111
3156
  "denied",
3112
3157
  "failed"
3113
3158
  ];
3114
- var fsFailure = z13.object({
3115
- ok: z13.literal(false),
3116
- code: z13.enum(FS_ERROR_CODES),
3117
- message: z13.string().max(1e3)
3159
+ var fsFailure = z14.object({
3160
+ ok: z14.literal(false),
3161
+ code: z14.enum(FS_ERROR_CODES),
3162
+ message: z14.string().max(1e3)
3118
3163
  });
3119
- var fsResult = z13.discriminatedUnion("ok", [fsListing, fsFailure]);
3164
+ var fsResult = z14.discriminatedUnion("ok", [fsListing, fsFailure]);
3120
3165
 
3121
3166
  // ../protocol/src/orchestrator.ts
3122
- import { z as z14 } from "zod";
3167
+ import { z as z15 } from "zod";
3123
3168
  var minutes = (n) => n * 6e4;
3124
- var orchestratorSettingsSchema = z14.object({
3169
+ var orchestratorSettingsSchema = z15.object({
3125
3170
  /** "Continue" prompts after a turn ended without a submit. */
3126
- maxContinuations: z14.number().int().min(0).max(20).default(3),
3171
+ maxContinuations: z15.number().int().min(0).max(20).default(3),
3127
3172
  /** Resumes after the CLI crashed, before one fresh session. */
3128
- maxCrashRetries: z14.number().int().min(0).max(20).default(3),
3173
+ maxCrashRetries: z15.number().int().min(0).max(20).default(3),
3129
3174
  /** Fix rounds after the daemon's verify failed. */
3130
- maxFixAttempts: z14.number().int().min(0).max(20).default(3),
3175
+ maxFixAttempts: z15.number().int().min(0).max(20).default(3),
3131
3176
  /** "You seem stuck" prompts after a run stalled. */
3132
- maxStallRecoveries: z14.number().int().min(0).max(20).default(2),
3177
+ maxStallRecoveries: z15.number().int().min(0).max(20).default(2),
3133
3178
  /** No progress for this long while the lease is fresh = stalled. */
3134
- stalledAfterMs: z14.number().int().min(minutes(1)).default(minutes(10)),
3179
+ stalledAfterMs: z15.number().int().min(minutes(1)).default(minutes(10)),
3135
3180
  /** A device offline this long is handed to a person (no auto switch). */
3136
- deviceOfflineEscalateMs: z14.number().int().min(0).default(minutes(30)),
3181
+ deviceOfflineEscalateMs: z15.number().int().min(0).default(minutes(30)),
3137
3182
  /** An unanswered question frees its concurrency slot after this. */
3138
- questionSlotReleaseMs: z14.number().int().min(0).default(minutes(24 * 60)),
3183
+ questionSlotReleaseMs: z15.number().int().min(0).default(minutes(24 * 60)),
3139
3184
  /** Automatic dispatches per issue per hour before a person looks. */
3140
- maxDispatchesPerHour: z14.number().int().min(1).max(100).default(6),
3185
+ maxDispatchesPerHour: z15.number().int().min(1).max(100).default(6),
3141
3186
  /** Wait before resuming a run that hit its quota (no reset time known). */
3142
- quotaBackoffMs: z14.number().int().min(0).default(minutes(15)),
3187
+ quotaBackoffMs: z15.number().int().min(0).default(minutes(15)),
3143
3188
  /**
3144
3189
  * How often an issue waiting on its pull request or CI asks GitHub again
3145
3190
  * when no webhook arrived (ADR 0024).
3146
3191
  */
3147
- ciRecheckMs: z14.number().int().min(3e4).default(minutes(2)),
3192
+ ciRecheckMs: z15.number().int().min(3e4).default(minutes(2)),
3148
3193
  /** A pushed commit with no checks after this long has no CI: it passes. */
3149
- ciNoChecksMs: z14.number().int().min(0).default(minutes(5)),
3194
+ ciNoChecksMs: z15.number().int().min(0).default(minutes(5)),
3150
3195
  /** CI still running after this long goes to a person. */
3151
- ciTimeoutMs: z14.number().int().min(minutes(5)).default(minutes(120)),
3196
+ ciTimeoutMs: z15.number().int().min(minutes(5)).default(minutes(120)),
3152
3197
  /** Remote URL of the repo this project's issues run in. */
3153
- repoUrl: z14.string().max(2e3).optional()
3198
+ repoUrl: z15.string().max(2e3).optional()
3154
3199
  });
3155
3200
  var CRASH_BACKOFF_MS = [1e4, 6e4, minutes(5)];
3156
3201
  var UPSTREAM_RECHECK_MS = minutes(5);
@@ -3194,30 +3239,30 @@ var WAIT_DETAIL_CODES = [
3194
3239
  ...PERSON_WAIT_DETAIL_CODES,
3195
3240
  ...EXTERNAL_WAIT_DETAIL_CODES
3196
3241
  ];
3197
- var waitDetailSchema = z14.object({
3198
- code: z14.enum(WAIT_DETAIL_CODES),
3199
- params: z14.record(
3200
- z14.string(),
3201
- z14.union([
3202
- z14.string(),
3203
- z14.number(),
3204
- z14.array(z14.string()),
3242
+ var waitDetailSchema = z15.object({
3243
+ code: z15.enum(WAIT_DETAIL_CODES),
3244
+ params: z15.record(
3245
+ z15.string(),
3246
+ z15.union([
3247
+ z15.string(),
3248
+ z15.number(),
3249
+ z15.array(z15.string()),
3205
3250
  // `repo_ambiguous`: the repos a person can pick from.
3206
- z14.array(z14.record(z14.string(), z14.string()))
3251
+ z15.array(z15.record(z15.string(), z15.string()))
3207
3252
  ])
3208
3253
  ).optional()
3209
3254
  });
3210
- var prChecksSchema = z14.object({
3211
- state: z14.enum(["pending", "success", "failure", "none"]),
3255
+ var prChecksSchema = z15.object({
3256
+ state: z15.enum(["pending", "success", "failure", "none"]),
3212
3257
  /** Failed checks, for the fix round's brief and the issue page. */
3213
- failing: z14.array(
3214
- z14.object({
3215
- name: z14.string().max(500),
3216
- summary: z14.string().max(4e3).optional(),
3217
- url: z14.string().max(2e3).optional()
3258
+ failing: z15.array(
3259
+ z15.object({
3260
+ name: z15.string().max(500),
3261
+ summary: z15.string().max(4e3).optional(),
3262
+ url: z15.string().max(2e3).optional()
3218
3263
  })
3219
3264
  ).max(50),
3220
- total: z14.number().int().min(0)
3265
+ total: z15.number().int().min(0)
3221
3266
  });
3222
3267
  var DEFAULT_BRANCH_TEMPLATE = "mikka/{team}-{number}";
3223
3268
  var BRANCH_FORBIDDEN = /[\s~^:?*[\\]|\.\.|@\{|\/\/|^\/|\/$/;
@@ -3226,29 +3271,29 @@ var hasControlCharacter = (value) => [...value].some((char) => {
3226
3271
  const code = char.charCodeAt(0);
3227
3272
  return code < 32 || code === 127;
3228
3273
  });
3229
- var branchTemplateSchema = z14.string().trim().min(1).max(200).refine((value) => value.includes("{number}"), {
3274
+ var branchTemplateSchema = z15.string().trim().min(1).max(200).refine((value) => value.includes("{number}"), {
3230
3275
  message: "The template must contain {number}."
3231
3276
  }).refine(
3232
3277
  (value) => !BRANCH_FORBIDDEN.test(value) && !hasControlCharacter(value),
3233
3278
  { message: BRANCH_FORBIDDEN_HINT }
3234
3279
  );
3235
- var prBodyTemplateSchema = z14.string().max(2e4).nullable().optional();
3280
+ var prBodyTemplateSchema = z15.string().max(2e4).nullable().optional();
3236
3281
  var REVIEW_CHECK_HARNESSES = [
3237
3282
  "claude_code",
3238
3283
  "codex",
3239
3284
  "cursor"
3240
3285
  ];
3241
- var reviewRuleSchema = z14.object({
3286
+ var reviewRuleSchema = z15.object({
3242
3287
  /** In Review needs an open pull request for the issue's branch (ADR 0024). */
3243
- requirePullRequest: z14.boolean().default(true),
3288
+ requirePullRequest: z15.boolean().default(true),
3244
3289
  /** ... and green CI on it. Ignored when no pull request is required. */
3245
- requireCi: z14.boolean().default(true),
3290
+ requireCi: z15.boolean().default(true),
3246
3291
  /**
3247
3292
  * The harness that must run the read-only check (ADR 0046). Null: any
3248
3293
  * second agent on the device. A configured harness the device does not run
3249
3294
  * means no check runs, exactly as if the device had no second agent.
3250
3295
  */
3251
- checkHarness: z14.enum(REVIEW_CHECK_HARNESSES).nullable().default(null),
3296
+ checkHarness: z15.enum(REVIEW_CHECK_HARNESSES).nullable().default(null),
3252
3297
  branchTemplate: branchTemplateSchema.default(DEFAULT_BRANCH_TEMPLATE),
3253
3298
  /** `{key}`, `{title}` and `{summary}`; null keeps Mikka's default text. */
3254
3299
  prBodyTemplate: prBodyTemplateSchema.default(null)
@@ -3273,9 +3318,9 @@ var WEB_PLATFORM = Object.freeze({
3273
3318
  });
3274
3319
 
3275
3320
  // ../protocol/src/preview.ts
3276
- import { z as z15 } from "zod";
3321
+ import { z as z16 } from "zod";
3277
3322
  var PREVIEW_MAX_LENGTH = 5 * 1024 * 1024;
3278
- var previewHtml = z15.string().max(PREVIEW_MAX_LENGTH);
3323
+ var previewHtml = z16.string().max(PREVIEW_MAX_LENGTH);
3279
3324
  var DIRECTIVES = [
3280
3325
  "default-src 'none'",
3281
3326
  "script-src 'unsafe-inline'",
@@ -3292,13 +3337,13 @@ var PREVIEW_CSP_HEADER = ["sandbox allow-scripts", ...DIRECTIVES].join(
3292
3337
  var META = `<meta http-equiv="Content-Security-Policy" content="${DIRECTIVES.join("; ")}">`;
3293
3338
 
3294
3339
  // ../protocol/src/profile.ts
3295
- import { z as z16 } from "zod";
3296
- var usernameSchema = z16.string().trim().min(3, "At least 3 characters.").max(32, "At most 32 characters.").regex(
3340
+ import { z as z17 } from "zod";
3341
+ var usernameSchema = z17.string().trim().min(3, "At least 3 characters.").max(32, "At most 32 characters.").regex(
3297
3342
  /^[a-z0-9][a-z0-9_-]*$/,
3298
3343
  "Start with a letter or digit; lowercase letters, digits, - and _ only."
3299
3344
  );
3300
- var displayNameSchema = z16.string().trim().min(1, "A name is required.").max(80, "At most 80 characters.");
3301
- var avatarUrlSchema = z16.url().max(2048).refine((value) => /^https?:\/\//.test(value), "Use an http(s) URL.");
3345
+ var displayNameSchema = z17.string().trim().min(1, "A name is required.").max(80, "At most 80 characters.");
3346
+ var avatarUrlSchema = z17.url().max(2048).refine((value) => /^https?:\/\//.test(value), "Use an http(s) URL.");
3302
3347
  var AVATAR_MAX_BYTES = 5 * 1024 * 1024;
3303
3348
  var AVATAR_CONTENT_TYPES = [
3304
3349
  "image/png",
@@ -3306,16 +3351,16 @@ var AVATAR_CONTENT_TYPES = [
3306
3351
  "image/webp",
3307
3352
  "image/gif"
3308
3353
  ];
3309
- var avatarPresignRequest = z16.object({
3310
- contentType: z16.enum(AVATAR_CONTENT_TYPES),
3354
+ var avatarPresignRequest = z17.object({
3355
+ contentType: z17.enum(AVATAR_CONTENT_TYPES),
3311
3356
  /** Bytes, checked against AVATAR_MAX_BYTES. */
3312
- size: z16.number().int().positive()
3357
+ size: z17.number().int().positive()
3313
3358
  });
3314
- var avatarPresignResponse = z16.object({
3315
- uploadUrl: z16.url(),
3359
+ var avatarPresignResponse = z17.object({
3360
+ uploadUrl: z17.url(),
3316
3361
  /** What to store in `user.image` once the PUT has succeeded. */
3317
3362
  publicUrl: avatarUrlSchema,
3318
- expiresIn: z16.number().int().positive()
3363
+ expiresIn: z17.number().int().positive()
3319
3364
  });
3320
3365
 
3321
3366
  // ../protocol/src/relay.ts
@@ -3324,31 +3369,31 @@ import {
3324
3369
  safeValidateUIMessages,
3325
3370
  uiMessageChunkSchema
3326
3371
  } from "ai";
3327
- import { z as z17 } from "zod";
3372
+ import { z as z18 } from "zod";
3328
3373
  var RELAY_PROTOCOL_VERSION = 1;
3329
3374
  var MAX_INPUT_LENGTH = 2e4;
3330
- var uuid = z17.uuid();
3331
- var runEvent = z17.discriminatedUnion("kind", [
3375
+ var uuid = z18.uuid();
3376
+ var runEvent = z18.discriminatedUnion("kind", [
3332
3377
  /** One streaming chunk of the unfinished message `messageId`. */
3333
- z17.object({
3334
- kind: z17.literal("chunk"),
3378
+ z18.object({
3379
+ kind: z18.literal("chunk"),
3335
3380
  messageId: uuid,
3336
- chunk: z17.looseObject({ type: z17.string() })
3381
+ chunk: z18.looseObject({ type: z18.string() })
3337
3382
  }),
3338
3383
  /** A finished message; persisted as a `message` row, then fanned out. */
3339
- z17.object({
3340
- kind: z17.literal("message.final"),
3384
+ z18.object({
3385
+ kind: z18.literal("message.final"),
3341
3386
  /** Order of the message within the run. */
3342
- seq: z17.number().int().min(0),
3343
- message: z17.looseObject({
3387
+ seq: z18.number().int().min(0),
3388
+ message: z18.looseObject({
3344
3389
  id: uuid,
3345
- role: z17.enum(["system", "user", "assistant"]),
3346
- parts: z17.array(z17.looseObject({ type: z17.string() }))
3390
+ role: z18.enum(["system", "user", "assistant"]),
3391
+ parts: z18.array(z18.looseObject({ type: z18.string() }))
3347
3392
  })
3348
3393
  }),
3349
- z17.object({
3350
- kind: z17.literal("run.status"),
3351
- status: z17.enum([
3394
+ z18.object({
3395
+ kind: z18.literal("run.status"),
3396
+ status: z18.enum([
3352
3397
  "queued",
3353
3398
  "preparing",
3354
3399
  "running",
@@ -3361,48 +3406,48 @@ var runEvent = z17.discriminatedUnion("kind", [
3361
3406
  })
3362
3407
  ]);
3363
3408
  var chunkSchema = asSchema(uiMessageChunkSchema);
3364
- var v = z17.literal(RELAY_PROTOCOL_VERSION);
3365
- var presenceView = z17.discriminatedUnion("type", [
3366
- z17.object({ type: z17.literal("issue"), id: uuid }),
3367
- z17.object({ type: z17.literal("project"), id: uuid })
3409
+ var v = z18.literal(RELAY_PROTOCOL_VERSION);
3410
+ var presenceView = z18.discriminatedUnion("type", [
3411
+ z18.object({ type: z18.literal("issue"), id: uuid }),
3412
+ z18.object({ type: z18.literal("project"), id: uuid })
3368
3413
  ]);
3369
- var relayClientMessage = z17.discriminatedUnion("type", [
3370
- z17.object({
3414
+ var relayClientMessage = z18.discriminatedUnion("type", [
3415
+ z18.object({
3371
3416
  v,
3372
- type: z17.literal("subscribe"),
3417
+ type: z18.literal("subscribe"),
3373
3418
  runId: uuid,
3374
3419
  /** Resume after this seq; omitted = everything still buffered. */
3375
- after: z17.number().int().min(0).optional()
3420
+ after: z18.number().int().min(0).optional()
3376
3421
  }),
3377
- z17.object({ v, type: z17.literal("unsubscribe"), runId: uuid }),
3378
- z17.object({ v, type: z17.literal("publish"), runId: uuid, event: runEvent }),
3422
+ z18.object({ v, type: z18.literal("unsubscribe"), runId: uuid }),
3423
+ z18.object({ v, type: z18.literal("publish"), runId: uuid, event: runEvent }),
3379
3424
  /**
3380
3425
  * A person's message to the running agent (ADR 0018). Saved as a `user`
3381
3426
  * message row with this id (a re-send with the same id is applied once),
3382
3427
  * then handed to the run's daemon, which marks it delivered.
3383
3428
  */
3384
- z17.object({
3429
+ z18.object({
3385
3430
  v,
3386
- type: z17.literal("send"),
3431
+ type: z18.literal("send"),
3387
3432
  runId: uuid,
3388
3433
  messageId: uuid,
3389
- text: z17.string().trim().min(1).max(MAX_INPUT_LENGTH)
3434
+ text: z18.string().trim().min(1).max(MAX_INPUT_LENGTH)
3390
3435
  }),
3391
3436
  /** A person stops the run; the daemon cancels the agent's session. */
3392
- z17.object({ v, type: z17.literal("stop"), runId: uuid }),
3437
+ z18.object({ v, type: z18.literal("stop"), runId: uuid }),
3393
3438
  /**
3394
3439
  * Says where this connection is looking, in one workspace (ADR 0049). Sent
3395
3440
  * once when a page opens and again every `PRESENCE_HEARTBEAT_MS`; `view`
3396
3441
  * null keeps the member online without naming a page. Never persisted.
3397
3442
  */
3398
- z17.object({
3443
+ z18.object({
3399
3444
  v,
3400
- type: z17.literal("presence"),
3445
+ type: z18.literal("presence"),
3401
3446
  workspaceId: uuid,
3402
3447
  view: presenceView.nullable()
3403
3448
  }),
3404
3449
  /** Stops announcing in a workspace; the member leaves its viewer list. */
3405
- z17.object({ v, type: z17.literal("presence.leave"), workspaceId: uuid })
3450
+ z18.object({ v, type: z18.literal("presence.leave"), workspaceId: uuid })
3406
3451
  ]);
3407
3452
  var RELAY_ERROR_CODES = [
3408
3453
  "bad_message",
@@ -3416,217 +3461,217 @@ var RELAY_ERROR_CODES = [
3416
3461
  /** `presence` for a workspace the caller is not a member of (ADR 0049). */
3417
3462
  "not_a_member"
3418
3463
  ];
3419
- var relayErrorCode = z17.enum(RELAY_ERROR_CODES);
3420
- var relayServerMessage = z17.discriminatedUnion("type", [
3421
- z17.object({
3464
+ var relayErrorCode = z18.enum(RELAY_ERROR_CODES);
3465
+ var relayServerMessage = z18.discriminatedUnion("type", [
3466
+ z18.object({
3422
3467
  v,
3423
- type: z17.literal("subscribed"),
3468
+ type: z18.literal("subscribed"),
3424
3469
  runId: uuid,
3425
- latestSeq: z17.number().int().min(0)
3470
+ latestSeq: z18.number().int().min(0)
3426
3471
  }),
3427
- z17.object({
3472
+ z18.object({
3428
3473
  v,
3429
- type: z17.literal("event"),
3474
+ type: z18.literal("event"),
3430
3475
  runId: uuid,
3431
- seq: z17.number().int().min(1),
3476
+ seq: z18.number().int().min(1),
3432
3477
  event: runEvent
3433
3478
  }),
3434
3479
  /**
3435
3480
  * `send` / `stop` was saved and is on its way to the run's device.
3436
3481
  * `messageId` is set for `send`.
3437
3482
  */
3438
- z17.object({
3483
+ z18.object({
3439
3484
  v,
3440
- type: z17.literal("accepted"),
3485
+ type: z18.literal("accepted"),
3441
3486
  runId: uuid,
3442
- request: z17.enum(["send", "stop"]),
3487
+ request: z18.enum(["send", "stop"]),
3443
3488
  messageId: uuid.optional()
3444
3489
  }),
3445
3490
  /** Publisher acknowledgment with the seq the hub assigned. */
3446
- z17.object({
3491
+ z18.object({
3447
3492
  v,
3448
- type: z17.literal("ack"),
3493
+ type: z18.literal("ack"),
3449
3494
  runId: uuid,
3450
- seq: z17.number().int().min(1)
3495
+ seq: z18.number().int().min(1)
3451
3496
  }),
3452
3497
  /**
3453
3498
  * Everyone the server sees online in this workspace, and where each is
3454
3499
  * looking (ADR 0049). A snapshot after every change, so a client never has
3455
3500
  * to merge deltas; `lastSeenAt` is the server's clock.
3456
3501
  */
3457
- z17.object({
3502
+ z18.object({
3458
3503
  v,
3459
- type: z17.literal("presence"),
3504
+ type: z18.literal("presence"),
3460
3505
  workspaceId: uuid,
3461
- members: z17.array(
3462
- z17.object({
3506
+ members: z18.array(
3507
+ z18.object({
3463
3508
  userId: uuid,
3464
3509
  view: presenceView.nullable(),
3465
- lastSeenAt: z17.number().int()
3510
+ lastSeenAt: z18.number().int()
3466
3511
  })
3467
3512
  )
3468
3513
  }),
3469
- z17.object({
3514
+ z18.object({
3470
3515
  v,
3471
- type: z17.literal("error"),
3516
+ type: z18.literal("error"),
3472
3517
  code: relayErrorCode,
3473
- message: z17.string(),
3518
+ message: z18.string(),
3474
3519
  runId: uuid.optional(),
3475
- minVersion: z17.string().optional()
3520
+ minVersion: z18.string().optional()
3476
3521
  })
3477
3522
  ]);
3478
3523
 
3479
3524
  // ../protocol/src/version.ts
3480
3525
  var import_semver = __toESM(require_semver2(), 1);
3481
- import { z as z18 } from "zod";
3526
+ import { z as z19 } from "zod";
3482
3527
  var CLIENT_VERSION_HEADER = "x-mikka-client-version";
3483
3528
  var CLIENT_KINDS = ["desktop", "mobile"];
3484
- var clientKind = z18.enum(CLIENT_KINDS);
3485
- var updateRequiredError = z18.object({
3486
- error: z18.literal("update_required"),
3487
- minVersion: z18.string(),
3488
- message: z18.string()
3529
+ var clientKind = z19.enum(CLIENT_KINDS);
3530
+ var updateRequiredError = z19.object({
3531
+ error: z19.literal("update_required"),
3532
+ minVersion: z19.string(),
3533
+ message: z19.string()
3489
3534
  });
3490
3535
 
3491
3536
  // ../protocol/src/coordinator.ts
3492
- import { z as z19 } from "zod";
3493
- var coordinatorRuntimeSchema = z19.discriminatedUnion("harness", [
3494
- z19.object({ harness: z19.literal("ai_sdk") }).strict(),
3495
- z19.object({ harness: z19.enum(["claude_code", "codex"]), deviceId: z19.uuid(), model: z19.string().trim().min(1).max(120).optional() }).strict()
3537
+ import { z as z20 } from "zod";
3538
+ var coordinatorRuntimeSchema = z20.discriminatedUnion("harness", [
3539
+ z20.object({ harness: z20.literal("ai_sdk") }).strict(),
3540
+ z20.object({ harness: z20.enum(["claude_code", "codex"]), deviceId: z20.uuid(), model: z20.string().trim().min(1).max(120).optional() }).strict()
3496
3541
  ]);
3497
- var coordinatorToolSpecSchema = z19.object({
3498
- name: z19.string().regex(/^[A-Za-z][A-Za-z0-9_]{0,63}$/),
3499
- description: z19.string().max(2e4),
3500
- inputSchema: z19.record(z19.string(), z19.unknown())
3501
- });
3502
- var nativeCoordinatorJobSchema = z19.object({
3503
- id: z19.uuid(),
3504
- harness: z19.enum(["claude_code", "codex"]),
3505
- model: z19.string().optional(),
3506
- instructions: z19.string().min(1).max(2e5),
3507
- context: z19.string().min(1).max(5e5),
3508
- tools: z19.array(coordinatorToolSpecSchema).max(100),
3509
- expiresAt: z19.iso.datetime()
3510
- });
3511
- var nativeCoordinatorClaimSchema = z19.object({ job: nativeCoordinatorJobSchema.nullable() });
3512
- var nativeCoordinatorCommandSchema = z19.discriminatedUnion("type", [
3513
- z19.object({ type: z19.literal("tool"), callId: z19.string().min(1).max(200), name: z19.string().min(1).max(64), input: z19.record(z19.string(), z19.unknown()) }).strict(),
3514
- z19.object({ type: z19.literal("complete"), text: z19.string().min(1).max(2e5).refine((value) => value.trim().length > 0) }).strict(),
3515
- z19.object({ type: z19.literal("failed") }).strict()
3542
+ var coordinatorToolSpecSchema = z20.object({
3543
+ name: z20.string().regex(/^[A-Za-z][A-Za-z0-9_]{0,63}$/),
3544
+ description: z20.string().max(2e4),
3545
+ inputSchema: z20.record(z20.string(), z20.unknown())
3546
+ });
3547
+ var nativeCoordinatorJobSchema = z20.object({
3548
+ id: z20.uuid(),
3549
+ harness: z20.enum(["claude_code", "codex"]),
3550
+ model: z20.string().optional(),
3551
+ instructions: z20.string().min(1).max(2e5),
3552
+ context: z20.string().min(1).max(5e5),
3553
+ tools: z20.array(coordinatorToolSpecSchema).max(100),
3554
+ expiresAt: z20.iso.datetime()
3555
+ });
3556
+ var nativeCoordinatorClaimSchema = z20.object({ job: nativeCoordinatorJobSchema.nullable() });
3557
+ var nativeCoordinatorCommandSchema = z20.discriminatedUnion("type", [
3558
+ z20.object({ type: z20.literal("tool"), callId: z20.string().min(1).max(200), name: z20.string().min(1).max(64), input: z20.record(z20.string(), z20.unknown()) }).strict(),
3559
+ z20.object({ type: z20.literal("complete"), text: z20.string().min(1).max(2e5).refine((value) => value.trim().length > 0) }).strict(),
3560
+ z20.object({ type: z20.literal("failed") }).strict()
3516
3561
  ]);
3517
- var nativeCoordinatorToolResultSchema = z19.discriminatedUnion("status", [
3518
- z19.object({ status: z19.literal("pending") }),
3519
- z19.object({ status: z19.literal("done"), output: z19.unknown() })
3562
+ var nativeCoordinatorToolResultSchema = z20.discriminatedUnion("status", [
3563
+ z20.object({ status: z20.literal("pending") }),
3564
+ z20.object({ status: z20.literal("done"), output: z20.unknown() })
3520
3565
  ]);
3521
3566
 
3522
3567
  // ../protocol/src/computer.ts
3523
- import { z as z20 } from "zod";
3524
- var machineStateSchema = z20.enum(["sleeping", "waking", "running", "error"]);
3525
- var controlStateSchema = z20.enum(["agent", "user", "idle"]);
3526
- var computerToolSchema = z20.enum(["click", "type", "key", "scroll", "screenshot"]);
3527
- var screenRectSchema = z20.object({ x: z20.number(), y: z20.number(), w: z20.number().nonnegative(), h: z20.number().nonnegative() });
3528
- var computerActionSchema = z20.object({ tool: computerToolSchema, x: z20.number().optional(), y: z20.number().optional(), text: z20.string().optional(), rect: screenRectSchema.optional() });
3529
- var lastActionSchema = computerActionSchema.omit({ text: true }).extend({ at: z20.iso.datetime() });
3530
- var approvalViewSchema = z20.object({
3531
- id: z20.string(),
3532
- digest: z20.string(),
3533
- runId: z20.string(),
3534
- botId: z20.string(),
3568
+ import { z as z21 } from "zod";
3569
+ var machineStateSchema = z21.enum(["sleeping", "waking", "running", "error"]);
3570
+ var controlStateSchema = z21.enum(["agent", "user", "idle"]);
3571
+ var computerToolSchema = z21.enum(["click", "type", "key", "scroll", "screenshot"]);
3572
+ var screenRectSchema = z21.object({ x: z21.number(), y: z21.number(), w: z21.number().nonnegative(), h: z21.number().nonnegative() });
3573
+ var computerActionSchema = z21.object({ tool: computerToolSchema, x: z21.number().optional(), y: z21.number().optional(), text: z21.string().optional(), rect: screenRectSchema.optional() });
3574
+ var lastActionSchema = computerActionSchema.omit({ text: true }).extend({ at: z21.iso.datetime() });
3575
+ var approvalViewSchema = z21.object({
3576
+ id: z21.string(),
3577
+ digest: z21.string(),
3578
+ runId: z21.string(),
3579
+ botId: z21.string(),
3535
3580
  action: computerActionSchema,
3536
- summary: z20.string(),
3537
- expiresAt: z20.iso.datetime()
3581
+ summary: z21.string(),
3582
+ expiresAt: z21.iso.datetime()
3538
3583
  });
3539
- var computerStateSchema = z20.object({
3584
+ var computerStateSchema = z21.object({
3540
3585
  machine: machineStateSchema,
3541
3586
  control: controlStateSchema,
3542
- controlledBy: z20.object({ userId: z20.string() }).optional(),
3587
+ controlledBy: z21.object({ userId: z21.string() }).optional(),
3543
3588
  lastAction: lastActionSchema.optional(),
3544
3589
  pendingApproval: approvalViewSchema.optional()
3545
3590
  });
3546
- var viewerModeSchema = z20.enum(["view", "control"]);
3547
- var viewerRequestSchema = z20.object({ mode: viewerModeSchema }).strict();
3548
- var viewerGrantSchema = z20.object({ url: z20.url({ protocol: /^wss$/ }), expiresAt: z20.iso.datetime() });
3549
- var createBotSchema = z20.object({ name: z20.string().trim().min(1).max(120) }).strict();
3550
- var botViewSchema = z20.object({ id: z20.uuid(), name: z20.string().min(1).max(120) });
3551
- var approvalDecisionSchema = z20.object({ digest: z20.string(), decision: z20.enum(["approve", "deny"]), scope: z20.enum(["once", "run"]) }).strict();
3552
- var computerTaskStateSchema = z20.enum(["working", "approval", "done", "failed"]);
3553
- var computerTaskSchema = z20.object({ botId: z20.string(), runId: z20.string(), task: z20.string(), state: computerTaskStateSchema, approvalId: z20.string().optional() });
3554
- var computerEventSchema = z20.discriminatedUnion("type", [
3555
- z20.object({ type: z20.literal("computer.machine"), state: machineStateSchema }),
3556
- z20.object({ type: z20.literal("computer.control"), botId: z20.string(), control: controlStateSchema, controlledBy: z20.object({ userId: z20.string() }).optional() }),
3557
- z20.object({ type: z20.literal("computer.action"), botId: z20.string(), lastAction: lastActionSchema }),
3558
- z20.object({ type: z20.literal("computer.approval"), botId: z20.string(), approval: approvalViewSchema.nullable() })
3591
+ var viewerModeSchema = z21.enum(["view", "control"]);
3592
+ var viewerRequestSchema = z21.object({ mode: viewerModeSchema }).strict();
3593
+ var viewerGrantSchema = z21.object({ url: z21.url({ protocol: /^wss$/ }), expiresAt: z21.iso.datetime() });
3594
+ var createBotSchema = z21.object({ name: z21.string().trim().min(1).max(120) }).strict();
3595
+ var botViewSchema = z21.object({ id: z21.uuid(), name: z21.string().min(1).max(120) });
3596
+ var approvalDecisionSchema = z21.object({ digest: z21.string(), decision: z21.enum(["approve", "deny"]), scope: z21.enum(["once", "run"]) }).strict();
3597
+ var computerTaskStateSchema = z21.enum(["working", "approval", "done", "failed"]);
3598
+ var computerTaskSchema = z21.object({ botId: z21.string(), runId: z21.string(), task: z21.string(), state: computerTaskStateSchema, approvalId: z21.string().optional() });
3599
+ var computerEventSchema = z21.discriminatedUnion("type", [
3600
+ z21.object({ type: z21.literal("computer.machine"), state: machineStateSchema }),
3601
+ z21.object({ type: z21.literal("computer.control"), botId: z21.string(), control: controlStateSchema, controlledBy: z21.object({ userId: z21.string() }).optional() }),
3602
+ z21.object({ type: z21.literal("computer.action"), botId: z21.string(), lastAction: lastActionSchema }),
3603
+ z21.object({ type: z21.literal("computer.approval"), botId: z21.string(), approval: approvalViewSchema.nullable() })
3559
3604
  ]);
3560
- var reviewDigestSchema = z20.string().regex(/^[a-f0-9]{64}$/);
3561
- var localComputerCall = z20.discriminatedUnion("name", [
3562
- z20.object({ name: z20.literal("get_desktop_state"), arguments: z20.object({}).strict() }).strict(),
3563
- z20.object({ name: z20.literal("click"), arguments: z20.object({ x: z20.number().int().min(0).max(1e5), y: z20.number().int().min(0).max(1e5) }).strict() }).strict(),
3564
- z20.object({ name: z20.literal("type_text"), arguments: z20.object({ text: z20.string().min(1).max(8e3) }).strict() }).strict(),
3565
- z20.object({ name: z20.literal("press_key"), arguments: z20.object({
3566
- key: z20.string().regex(/^(?:[\x20-\x7e]|enter|return|tab|escape|space|backspace|delete|insert|home|end|pageup|pagedown|up|down|left|right|f(?:[1-9]|1[0-2]))$/),
3567
- modifiers: z20.array(z20.enum(["ctrl", "shift", "alt", "super"])).max(4).refine((items) => new Set(items).size === items.length).optional()
3605
+ var reviewDigestSchema = z21.string().regex(/^[a-f0-9]{64}$/);
3606
+ var localComputerCall = z21.discriminatedUnion("name", [
3607
+ z21.object({ name: z21.literal("get_desktop_state"), arguments: z21.object({}).strict() }).strict(),
3608
+ z21.object({ name: z21.literal("click"), arguments: z21.object({ x: z21.number().int().min(0).max(1e5), y: z21.number().int().min(0).max(1e5) }).strict() }).strict(),
3609
+ z21.object({ name: z21.literal("type_text"), arguments: z21.object({ text: z21.string().min(1).max(8e3) }).strict() }).strict(),
3610
+ z21.object({ name: z21.literal("press_key"), arguments: z21.object({
3611
+ key: z21.string().regex(/^(?:[\x20-\x7e]|enter|return|tab|escape|space|backspace|delete|insert|home|end|pageup|pagedown|up|down|left|right|f(?:[1-9]|1[0-2]))$/),
3612
+ modifiers: z21.array(z21.enum(["ctrl", "shift", "alt", "super"])).max(4).refine((items) => new Set(items).size === items.length).optional()
3568
3613
  }).strict() }).strict(),
3569
- z20.object({ name: z20.literal("scroll"), arguments: z20.object({ direction: z20.enum(["up", "down", "left", "right"]), amount: z20.number().int().min(1).max(50), x: z20.number().int().min(0).max(1e5), y: z20.number().int().min(0).max(1e5) }).strict() }).strict()
3614
+ z21.object({ name: z21.literal("scroll"), arguments: z21.object({ direction: z21.enum(["up", "down", "left", "right"]), amount: z21.number().int().min(1).max(50), x: z21.number().int().min(0).max(1e5), y: z21.number().int().min(0).max(1e5) }).strict() }).strict()
3570
3615
  ]);
3571
- var localComputerRequest = z20.object({
3572
- id: z20.uuid(),
3573
- runId: z20.uuid(),
3616
+ var localComputerRequest = z21.object({
3617
+ id: z21.uuid(),
3618
+ runId: z21.uuid(),
3574
3619
  target: reviewDigestSchema,
3575
- display: z20.string().regex(/^:[1-9][0-9]{0,2}$/).optional(),
3620
+ display: z21.string().regex(/^:[1-9][0-9]{0,2}$/).optional(),
3576
3621
  call: localComputerCall,
3577
- expiresAt: z20.number().int().positive(),
3622
+ expiresAt: z21.number().int().positive(),
3578
3623
  digest: reviewDigestSchema
3579
3624
  }).strict();
3580
- var localComputerDecision = z20.object({ id: z20.uuid(), digest: reviewDigestSchema, approve: z20.boolean() }).strict();
3581
- var computerSyncBody = z20.object({ requests: z20.array(localComputerRequest).max(20) }).strict();
3582
- var computerSyncResponse = z20.object({ decisions: z20.array(localComputerDecision).max(20) }).strict();
3625
+ var localComputerDecision = z21.object({ id: z21.uuid(), digest: reviewDigestSchema, approve: z21.boolean() }).strict();
3626
+ var computerSyncBody = z21.object({ requests: z21.array(localComputerRequest).max(20) }).strict();
3627
+ var computerSyncResponse = z21.object({ decisions: z21.array(localComputerDecision).max(20) }).strict();
3583
3628
 
3584
3629
  // ../protocol/src/subscription.ts
3585
- import { z as z21 } from "zod";
3586
- var id2 = z21.string().min(1).max(128);
3587
- var subscriptionRouteSchema = z21.enum([
3630
+ import { z as z22 } from "zod";
3631
+ var id3 = z22.string().min(1).max(128);
3632
+ var subscriptionRouteSchema = z22.enum([
3588
3633
  "codex_cli",
3589
3634
  "claude_code_cli",
3590
3635
  "codex_cpa",
3591
3636
  "claude_cpa",
3592
3637
  "openai_siwc"
3593
3638
  ]);
3594
- var subscriptionConnectionSchema = z21.object({
3595
- id: id2,
3596
- ownerId: id2,
3597
- workspaceId: id2,
3598
- provider: z21.enum(["openai", "anthropic"]),
3599
- state: z21.enum([
3639
+ var subscriptionConnectionSchema = z22.object({
3640
+ id: id3,
3641
+ ownerId: id3,
3642
+ workspaceId: id3,
3643
+ provider: z22.enum(["openai", "anthropic"]),
3644
+ state: z22.enum([
3600
3645
  "pending",
3601
3646
  "connected",
3602
3647
  "reconnect_required",
3603
3648
  "disconnected"
3604
3649
  ]),
3605
3650
  // Increment on reconnect/disconnect. Old bindings cannot become valid again.
3606
- revision: z21.number().int().positive(),
3651
+ revision: z22.number().int().positive(),
3607
3652
  quota: quotaSnapshotSchema
3608
3653
  }).strict();
3609
- var subscriptionBindingSchema = z21.object({
3610
- id: id2,
3611
- ownerId: id2,
3612
- workspaceId: id2,
3654
+ var subscriptionBindingSchema = z22.object({
3655
+ id: id3,
3656
+ ownerId: id3,
3657
+ workspaceId: id3,
3613
3658
  // An agent or assistant session selected explicitly by the owner.
3614
- consumerId: id2,
3615
- connectionId: id2,
3616
- connectionRevision: z21.number().int().positive(),
3659
+ consumerId: id3,
3660
+ connectionId: id3,
3661
+ connectionRevision: z22.number().int().positive(),
3617
3662
  route: subscriptionRouteSchema
3618
3663
  }).strict();
3619
- var nativeBrokerContextSchema = z21.object({
3620
- route: z21.enum(["codex_cli", "claude_code_cli"]),
3621
- modelId: z21.string().min(1).max(128),
3622
- revision: z21.number().int().positive(),
3623
- accountId: z21.string().min(1).max(512),
3624
- plan: z21.string().max(40).optional(),
3625
- expiresAt: z21.iso.datetime()
3664
+ var nativeBrokerContextSchema = z22.object({
3665
+ route: z22.enum(["codex_cli", "claude_code_cli"]),
3666
+ modelId: z22.string().min(1).max(128),
3667
+ revision: z22.number().int().positive(),
3668
+ accountId: z22.string().min(1).max(512),
3669
+ plan: z22.string().max(40).optional(),
3670
+ expiresAt: z22.iso.datetime()
3626
3671
  }).strict();
3627
3672
 
3628
3673
  // src/login.ts
3629
- import { z as z26 } from "zod";
3674
+ import { z as z27 } from "zod";
3630
3675
 
3631
3676
  // src/errors.ts
3632
3677
  var DaemonError = class extends Error {
@@ -3649,7 +3694,7 @@ var ServerUnreachableError = class extends DaemonError {
3649
3694
  // package.json
3650
3695
  var package_default = {
3651
3696
  name: "@mikka/daemon",
3652
- version: "0.0.63",
3697
+ version: "0.0.65",
3653
3698
  description: "Local Mikka daemon: runs agents through the user's own CLIs",
3654
3699
  type: "module",
3655
3700
  private: true,
@@ -3708,17 +3753,17 @@ var package_default = {
3708
3753
  engines: {
3709
3754
  node: ">=24"
3710
3755
  },
3711
- gitHead: "9840b8254863c60220d8d9f8b81382c7c3bb76bf"
3756
+ gitHead: "f566198f5cee77ff3a0ba56f6923a0cf0b005b0e"
3712
3757
  };
3713
3758
 
3714
3759
  // src/paths.ts
3715
3760
  var DAEMON_VERSION = package_default.version;
3716
3761
 
3717
3762
  // src/server-link-http.ts
3718
- import { z as z25 } from "zod";
3763
+ import { z as z26 } from "zod";
3719
3764
 
3720
3765
  // ../protocol/src/capture.ts
3721
- import { z as z22 } from "zod";
3766
+ import { z as z23 } from "zod";
3722
3767
  var CAPTURE_CONTENT_TYPES = [
3723
3768
  "image/png",
3724
3769
  "image/jpeg",
@@ -3734,69 +3779,69 @@ var CAPTURE_MAX_BYTES = {
3734
3779
  };
3735
3780
  var RECORDING_MAX_SECONDS = 300;
3736
3781
  var CAPTURE_TITLE_MAX = 200;
3737
- var sha256 = z22.string().regex(/^[a-f0-9]{64}$/);
3738
- var title = z22.string().trim().min(1).max(CAPTURE_TITLE_MAX);
3739
- var captureUploadRequest = z22.object({
3782
+ var sha256 = z23.string().regex(/^[a-f0-9]{64}$/);
3783
+ var title = z23.string().trim().min(1).max(CAPTURE_TITLE_MAX);
3784
+ var captureUploadRequest = z23.object({
3740
3785
  /** Stable client id, persisted before the first network attempt. */
3741
- captureId: z22.uuid().optional(),
3786
+ captureId: z23.uuid().optional(),
3742
3787
  title,
3743
- contentType: z22.enum(CAPTURE_CONTENT_TYPES),
3744
- size: z22.number().int().min(1).max(CAPTURE_MAX_BYTES.video),
3788
+ contentType: z23.enum(CAPTURE_CONTENT_TYPES),
3789
+ size: z23.number().int().min(1).max(CAPTURE_MAX_BYTES.video),
3745
3790
  sha256
3746
3791
  }).strict();
3747
- var captureUploadTarget = z22.discriminatedUnion("target", [
3748
- z22.object({ target: z22.literal("storage"), url: z22.url({ protocol: /^https$/ }), headers: z22.record(z22.string(), z22.string()) }),
3749
- z22.object({ target: z22.literal("server") })
3792
+ var captureUploadTarget = z23.discriminatedUnion("target", [
3793
+ z23.object({ target: z23.literal("storage"), url: z23.url({ protocol: /^https$/ }), headers: z23.record(z23.string(), z23.string()) }),
3794
+ z23.object({ target: z23.literal("server") })
3750
3795
  ]);
3751
- var captureUploadResponse = z22.object({
3752
- captureId: z22.uuid(),
3796
+ var captureUploadResponse = z23.object({
3797
+ captureId: z23.uuid(),
3753
3798
  upload: captureUploadTarget
3754
3799
  });
3755
- var captureView = z22.object({
3756
- id: z22.uuid(),
3757
- kind: z22.enum(CAPTURE_KINDS),
3758
- contentType: z22.enum(CAPTURE_CONTENT_TYPES),
3759
- title: z22.string(),
3760
- size: z22.number().int().nonnegative(),
3761
- durationMs: z22.number().int().nonnegative().nullable(),
3762
- source: z22.enum(CAPTURE_SOURCES),
3763
- createdAt: z22.iso.datetime()
3764
- });
3765
- var captureCompleteResponse = z22.object({ capture: captureView });
3766
- var screenCaptureRequest = z22.discriminatedUnion("action", [
3767
- z22.object({ action: z22.literal("screenshot"), title }).strict(),
3768
- z22.object({ action: z22.literal("start_recording"), title, maxSeconds: z22.number().int().min(5).max(RECORDING_MAX_SECONDS).optional() }).strict(),
3769
- z22.object({ action: z22.literal("stop_recording") }).strict()
3800
+ var captureView = z23.object({
3801
+ id: z23.uuid(),
3802
+ kind: z23.enum(CAPTURE_KINDS),
3803
+ contentType: z23.enum(CAPTURE_CONTENT_TYPES),
3804
+ title: z23.string(),
3805
+ size: z23.number().int().nonnegative(),
3806
+ durationMs: z23.number().int().nonnegative().nullable(),
3807
+ source: z23.enum(CAPTURE_SOURCES),
3808
+ createdAt: z23.iso.datetime()
3809
+ });
3810
+ var captureCompleteResponse = z23.object({ capture: captureView });
3811
+ var screenCaptureRequest = z23.discriminatedUnion("action", [
3812
+ z23.object({ action: z23.literal("screenshot"), title }).strict(),
3813
+ z23.object({ action: z23.literal("start_recording"), title, maxSeconds: z23.number().int().min(5).max(RECORDING_MAX_SECONDS).optional() }).strict(),
3814
+ z23.object({ action: z23.literal("stop_recording") }).strict()
3770
3815
  ]);
3771
- var screenCaptureResponse = z22.discriminatedUnion("action", [
3772
- z22.object({ action: z22.literal("screenshot"), capture: captureView }),
3773
- z22.object({ action: z22.literal("start_recording"), recordingId: z22.uuid(), stopsAt: z22.iso.datetime() }),
3774
- z22.object({ action: z22.literal("stop_recording"), capture: captureView })
3816
+ var screenCaptureResponse = z23.discriminatedUnion("action", [
3817
+ z23.object({ action: z23.literal("screenshot"), capture: captureView }),
3818
+ z23.object({ action: z23.literal("start_recording"), recordingId: z23.uuid(), stopsAt: z23.iso.datetime() }),
3819
+ z23.object({ action: z23.literal("stop_recording"), capture: captureView })
3775
3820
  ]);
3776
3821
 
3777
3822
  // src/run-mailbox.ts
3778
- import { z as z24 } from "zod";
3823
+ import { z as z25 } from "zod";
3779
3824
 
3780
3825
  // ../protocol/src/mailbox.ts
3781
- import { z as z23 } from "zod";
3782
- var mailboxSend = z23.object({ to: z23.uuid(), key: z23.uuid().describe("Stable idempotency key; reuse only to retry this exact envelope."), text: z23.string().trim().min(1).max(4e3), replyTo: z23.uuid().optional() }).strict();
3783
- var mailboxAck = z23.object({ ids: z23.array(z23.uuid()).max(50) }).strict();
3826
+ import { z as z24 } from "zod";
3827
+ var mailboxSend = z24.object({ to: z24.uuid(), key: z24.uuid().describe("Stable idempotency key; reuse only to retry this exact envelope."), text: z24.string().trim().min(1).max(4e3), replyTo: z24.uuid().optional() }).strict();
3828
+ var mailboxAck = z24.object({ ids: z24.array(z24.uuid()).max(50) }).strict();
3784
3829
  var mailboxInputs = {
3785
- mailbox_recipients: z23.object({}).strict(),
3830
+ mailbox_recipients: z24.object({}).strict(),
3786
3831
  mailbox_send: mailboxSend,
3787
- mailbox_inbox: z23.object({}).strict(),
3832
+ mailbox_inbox: z24.object({}).strict(),
3788
3833
  mailbox_ack: mailboxAck,
3789
- mailbox_sent: z23.object({}).strict()
3834
+ mailbox_sent: z24.object({}).strict()
3790
3835
  };
3791
3836
 
3792
3837
  // src/run-mailbox.ts
3793
- var requestSchema = z24.union([
3794
- z24.object({ operation: z24.literal("list") }).strict(),
3795
- z24.object({ operation: z24.literal("call"), name: z24.enum(Object.keys(mailboxInputs)), arguments: z24.unknown() }).strict()
3838
+ var requestSchema = z25.union([
3839
+ z25.object({ operation: z25.literal("list") }).strict(),
3840
+ z25.object({ operation: z25.literal("call"), name: z25.enum(Object.keys(mailboxInputs)), arguments: z25.unknown() }).strict()
3796
3841
  ]);
3797
3842
 
3798
3843
  // src/server-link-http.ts
3799
- var deviceSessionRejection = z25.object({ error: z25.enum(["Unauthorized", "authRequired"]) }).strict();
3844
+ var deviceSessionRejection = z26.object({ error: z26.enum(["Unauthorized", "authRequired"]) }).strict();
3800
3845
  function serverUrl(base, path) {
3801
3846
  return new URL(`${base.replace(/\/+$/, "")}${path}`);
3802
3847
  }
@@ -3805,16 +3850,16 @@ function serverUrl(base, path) {
3805
3850
  var DEVICE_CODE_PATH = `${AUTH_BASE_PATH}/device/code`;
3806
3851
  var DEVICE_TOKEN_PATH = `${AUTH_BASE_PATH}/device/token`;
3807
3852
  var DEVICE_GRANT_TYPE = "urn:ietf:params:oauth:grant-type:device_code";
3808
- var deviceCodeResponse = z26.object({
3809
- device_code: z26.string().min(1),
3810
- user_code: z26.string().min(1),
3811
- verification_uri: z26.string(),
3812
- verification_uri_complete: z26.string().optional(),
3813
- expires_in: z26.number().positive(),
3814
- interval: z26.number().positive().default(5)
3815
- });
3816
- var tokenResponse = z26.object({ access_token: z26.string().regex(/^orv_[A-Za-z0-9_-]{43}$/) });
3817
- var errorResponse = z26.object({ error: z26.string() });
3853
+ var deviceCodeResponse = z27.object({
3854
+ device_code: z27.string().min(1),
3855
+ user_code: z27.string().min(1),
3856
+ verification_uri: z27.string(),
3857
+ verification_uri_complete: z27.string().optional(),
3858
+ expires_in: z27.number().positive(),
3859
+ interval: z27.number().positive().default(5)
3860
+ });
3861
+ var tokenResponse = z27.object({ access_token: z27.string().regex(/^orv_[A-Za-z0-9_-]{43}$/) });
3862
+ var errorResponse = z27.object({ error: z27.string() });
3818
3863
  var LoginError = class extends DaemonError {
3819
3864
  constructor(reason, message) {
3820
3865
  super(4003, message);