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