replicas-engine 0.1.1057 → 0.1.1058

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.
@@ -8,12 +8,12 @@ import {
8
8
  listRunningCodexModels,
9
9
  restartCodexAspHost,
10
10
  restartCodexAspHostIfRunning
11
- } from "./chunk-4NQ6T6MU.js";
12
- import "./chunk-TUZZRDKQ.js";
13
- import "./chunk-HBLXTK7E.js";
14
- import "./chunk-PIZUFR3F.js";
11
+ } from "./chunk-6UJXFBYZ.js";
12
+ import "./chunk-EGH2TCYM.js";
13
+ import "./chunk-UHTZM2RY.js";
14
+ import "./chunk-LWVG6G7V.js";
15
15
  import "./chunk-UZSNFLDQ.js";
16
- import "./chunk-E4ON2EVA.js";
16
+ import "./chunk-3LW5WKNJ.js";
17
17
  import "./chunk-VEQXQN22.js";
18
18
  export {
19
19
  CODEX_ULTRAFAST_SERVICE_TIER,
@@ -2869,58 +2869,9 @@ function subagentChatId(message2) {
2869
2869
  return chatIdFrom(message2.output);
2870
2870
  }
2871
2871
 
2872
- // ../shared/src/learned-skills.ts
2873
- import { z as z10 } from "zod";
2874
-
2875
- // ../shared/src/frontmatter.ts
2876
- import { parse as parseYaml } from "yaml";
2877
- function parseFrontmatter(content) {
2878
- const match = content.match(/^---\r?\n([\s\S]*?)\r?\n---(?:\r?\n|$)/);
2879
- if (!match) return {};
2880
- try {
2881
- const parsed = parseYaml(match[1]);
2882
- if (typeof parsed !== "object" || parsed === null) return {};
2883
- return {
2884
- ..."name" in parsed && typeof parsed.name === "string" ? { name: parsed.name.trim() } : {},
2885
- ..."description" in parsed && typeof parsed.description === "string" ? { description: parsed.description.trim() } : {}
2886
- };
2887
- } catch {
2888
- return {};
2889
- }
2890
- }
2891
-
2892
- // ../shared/src/learned-skills.ts
2893
- var LEARNED_SKILLS_ROOT = `${SANDBOX_PATHS.REPLICAS_DIR}/learned-skills`;
2894
- var LEARNED_SKILLS_MANIFEST_PATH = `${LEARNED_SKILLS_ROOT}/manifest.json`;
2895
- var LEARNED_SKILL_DIR_PREFIX = "replicas-learned__";
2896
- var learnedSkillsManifestSchema = z10.object({
2897
- skills: z10.array(z10.object({ name: z10.string(), sha256: z10.string() }))
2898
- });
2899
- var dreamVerdictChecksSchema = z10.object({
2900
- repeatable: z10.boolean(),
2901
- realInstruction: z10.boolean(),
2902
- noContradiction: z10.boolean(),
2903
- formatExact: z10.boolean(),
2904
- humanOnly: z10.boolean(),
2905
- actionable: z10.boolean(),
2906
- durable: z10.boolean()
2907
- });
2908
- var DREAM_VERDICT_CHECKS = dreamVerdictChecksSchema.keyof().options;
2909
- var dreamVerdictSchema = dreamVerdictChecksSchema.extend({ approve: z10.boolean(), reason: z10.string() });
2910
- var learnedSkillFormatInstruction = (speaker) => `Write a SKILL.md whose frontmatter has a kebab-case \`name\` and a short \`description\` that starts with "Use when" and names the situations it applies to; the body records only what ${speaker} actually said, restated as a direct instruction, usually one to three lines. Every line of a learning is loaded into future sessions, so leave out anything an agent could infer on its own: no headings, explanations, rules, or examples unless ${speaker} stated those specifics themselves. For "from now on, use Conventional Commits", the body is just "Use Conventional Commits for every commit message and PR title."`;
2911
-
2912
- // ../shared/src/replicas-mcp.ts
2872
+ // ../shared/src/multitask-events.ts
2913
2873
  import { z as z15 } from "zod";
2914
2874
 
2915
- // ../shared/src/automations/trigger-schemas.ts
2916
- import { z as z11 } from "zod";
2917
-
2918
- // ../shared/src/uuid.ts
2919
- function createUuidFromHex(value) {
2920
- return `${value.slice(0, 8)}-${value.slice(8, 12)}-5${value.slice(13, 16)}-${(Number.parseInt(value.slice(16, 17), 16) & 3 | 8).toString(16)}${value.slice(17, 20)}-${value.slice(20, 32)}`;
2921
- }
2922
- var UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
2923
-
2924
2875
  // ../shared/src/urls.ts
2925
2876
  var DASHBOARD_PATH = "/dashboard";
2926
2877
  var WEB_APP_PATHS = {
@@ -3018,6 +2969,18 @@ function buildCodeHostPrUrl(repoUrl, provider2, prNumber) {
3018
2969
  return `${normalizedRepoUrl}/pull/${prNumber}`;
3019
2970
  }
3020
2971
 
2972
+ // ../shared/src/replicas-mcp.ts
2973
+ import { z as z14 } from "zod";
2974
+
2975
+ // ../shared/src/automations/trigger-schemas.ts
2976
+ import { z as z10 } from "zod";
2977
+
2978
+ // ../shared/src/uuid.ts
2979
+ function createUuidFromHex(value) {
2980
+ return `${value.slice(0, 8)}-${value.slice(8, 12)}-5${value.slice(13, 16)}-${(Number.parseInt(value.slice(16, 17), 16) & 3 | 8).toString(16)}${value.slice(17, 20)}-${value.slice(20, 32)}`;
2981
+ }
2982
+ var UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
2983
+
3021
2984
  // ../shared/src/automations/github/index.ts
3022
2985
  var REVIEW_REQUESTED_EVENT = "pull_request.review_requested";
3023
2986
 
@@ -3027,47 +2990,47 @@ function getReviewerLoginsError(event, logins) {
3027
2990
  if (isReviewRequested === !!logins?.some((login) => login.trim().replace(/^@+/, ""))) return null;
3028
2991
  return isReviewRequested ? "The PR review requested trigger needs at least one GitHub username" : "Requested reviewers only apply to the PR review requested trigger";
3029
2992
  }
3030
- var repositoryTriggerConfigSchema = z11.object({
3031
- event: z11.string(),
3032
- repository_ids: z11.array(z11.string().regex(UUID_RE, "must be a repository id")).optional(),
3033
- group_pr_events: z11.boolean().optional(),
3034
- excluded_actors: z11.array(z11.string()).optional(),
3035
- reviewer_logins: z11.array(z11.string()).optional()
2993
+ var repositoryTriggerConfigSchema = z10.object({
2994
+ event: z10.string(),
2995
+ repository_ids: z10.array(z10.string().regex(UUID_RE, "must be a repository id")).optional(),
2996
+ group_pr_events: z10.boolean().optional(),
2997
+ excluded_actors: z10.array(z10.string()).optional(),
2998
+ reviewer_logins: z10.array(z10.string()).optional()
3036
2999
  });
3037
- var cronTriggerSchema = z11.object({ type: z11.literal("cron"), config: z11.object({ schedule: z11.string(), timezone: z11.string().optional() }) });
3038
- var githubTriggerSchema = z11.object({
3039
- type: z11.literal("github"),
3000
+ var cronTriggerSchema = z10.object({ type: z10.literal("cron"), config: z10.object({ schedule: z10.string(), timezone: z10.string().optional() }) });
3001
+ var githubTriggerSchema = z10.object({
3002
+ type: z10.literal("github"),
3040
3003
  config: repositoryTriggerConfigSchema.superRefine((config, ctx) => {
3041
3004
  const message2 = getReviewerLoginsError(config.event, config.reviewer_logins);
3042
3005
  if (message2) ctx.addIssue({ code: "custom", message: message2, path: ["reviewer_logins"] });
3043
3006
  })
3044
3007
  });
3045
- var gitlabTriggerSchema = z11.object({ type: z11.literal("gitlab"), config: repositoryTriggerConfigSchema });
3046
- var automationTriggerSchema = z11.discriminatedUnion("type", [
3008
+ var gitlabTriggerSchema = z10.object({ type: z10.literal("gitlab"), config: repositoryTriggerConfigSchema });
3009
+ var automationTriggerSchema = z10.discriminatedUnion("type", [
3047
3010
  cronTriggerSchema,
3048
3011
  githubTriggerSchema,
3049
3012
  gitlabTriggerSchema,
3050
- z11.object({ type: z11.literal("slack"), config: z11.object({ event: z11.string(), channel_ids: z11.array(z11.string()).optional(), group_thread_replies: z11.boolean().optional() }) }),
3051
- z11.object({ type: z11.literal("sentry"), config: z11.object({ event: z11.string(), project_slugs: z11.array(z11.string()).optional(), min_level: z11.string().optional() }) }),
3052
- z11.object({ type: z11.literal("custom"), config: z11.object({}) })
3013
+ z10.object({ type: z10.literal("slack"), config: z10.object({ event: z10.string(), channel_ids: z10.array(z10.string()).optional(), group_thread_replies: z10.boolean().optional() }) }),
3014
+ z10.object({ type: z10.literal("sentry"), config: z10.object({ event: z10.string(), project_slugs: z10.array(z10.string()).optional(), min_level: z10.string().optional() }) }),
3015
+ z10.object({ type: z10.literal("custom"), config: z10.object({}) })
3053
3016
  ]);
3054
3017
 
3055
3018
  // ../shared/src/routes/environment.ts
3056
- import { z as z12 } from "zod";
3019
+ import { z as z11 } from "zod";
3057
3020
  var ENVIRONMENT_MCP_TRANSPORTS = ["stdio", "http", "sse"];
3058
- var stringMap = z12.record(z12.string(), z12.string());
3059
- var createEnvironmentMcpRequestSchema = z12.object({
3060
- name: z12.string(),
3061
- transport: z12.enum(ENVIRONMENT_MCP_TRANSPORTS),
3062
- config: z12.union([
3063
- z12.object({ command: z12.string().min(1), args: z12.array(z12.string()).optional(), env: stringMap.optional() }),
3064
- z12.object({ url: z12.url(), headers: stringMap.optional(), auth: mcpAuthSchema.optional() })
3021
+ var stringMap = z11.record(z11.string(), z11.string());
3022
+ var createEnvironmentMcpRequestSchema = z11.object({
3023
+ name: z11.string(),
3024
+ transport: z11.enum(ENVIRONMENT_MCP_TRANSPORTS),
3025
+ config: z11.union([
3026
+ z11.object({ command: z11.string().min(1), args: z11.array(z11.string()).optional(), env: stringMap.optional() }),
3027
+ z11.object({ url: z11.url(), headers: stringMap.optional(), auth: mcpAuthSchema.optional() })
3065
3028
  ]).describe("stdio: `{ command, args, env }`. http/sse: `{ url, headers }`.")
3066
3029
  });
3067
3030
  var updateEnvironmentMcpRequestSchema = createEnvironmentMcpRequestSchema.partial();
3068
3031
 
3069
3032
  // ../shared/src/routes/workspaces.ts
3070
- import { z as z14 } from "zod";
3033
+ import { z as z13 } from "zod";
3071
3034
 
3072
3035
  // ../shared/src/default-skills/replicas-agent/abilities/computer.ts
3073
3036
  var SECTION = `### Computer use (Linux desktop control)
@@ -3339,7 +3302,7 @@ var DOCKER_ABILITY = {
3339
3302
  };
3340
3303
 
3341
3304
  // ../shared/src/routes/environment-setups.ts
3342
- import { z as z13 } from "zod";
3305
+ import { z as z12 } from "zod";
3343
3306
  var ENVIRONMENT_SETUP_STEPS = [
3344
3307
  { key: "understand", label: "Understand the codebase" },
3345
3308
  { key: "install", label: "Install dependencies and run the app" },
@@ -3373,17 +3336,17 @@ var ENVIRONMENT_SETUP_LIMITS = {
3373
3336
  };
3374
3337
  var ENVIRONMENT_SETUP_VARIABLE_WAIT = { defaultMs: 5 * 6e4, maxMs: 15 * 6e4, pollMs: 5e3 };
3375
3338
  var VARIABLE_KEY_RE = /^[A-Za-z_][A-Za-z0-9_]*$/;
3376
- var text = (max) => max === void 0 ? z13.string().trim() : z13.string().trim().max(max);
3339
+ var text = (max) => max === void 0 ? z12.string().trim() : z12.string().trim().max(max);
3377
3340
  var requiredText = (max) => text(max).min(1, "must not be empty");
3378
3341
  var optionalText = (max) => text(max).nullish().transform((value) => value || null);
3379
3342
  var clearableText = (max) => text(max).nullish().transform((value) => value === void 0 ? void 0 : value || null);
3380
- var list = (item, max) => max === void 0 ? z13.array(item) : z13.array(item).max(max);
3343
+ var list = (item, max) => max === void 0 ? z12.array(item) : z12.array(item).max(max);
3381
3344
  var ENVIRONMENT_SETUP_AUTHORED_TRIGGER_TYPES = ["cron", "github", "gitlab"];
3382
3345
  function isEnvironmentSetupAuthoredTriggerType(type) {
3383
3346
  return ENVIRONMENT_SETUP_AUTHORED_TRIGGER_TYPES.some((authored) => authored === type);
3384
3347
  }
3385
- var proposalTriggerSchema = z13.discriminatedUnion("type", [cronTriggerSchema, githubTriggerSchema, gitlabTriggerSchema]);
3386
- var existingTriggerSchema = z13.custom(
3348
+ var proposalTriggerSchema = z12.discriminatedUnion("type", [cronTriggerSchema, githubTriggerSchema, gitlabTriggerSchema]);
3349
+ var existingTriggerSchema = z12.custom(
3387
3350
  (value) => isRecord(value) && typeof value.type === "string" && isRecord(value.config),
3388
3351
  "must be an automation trigger"
3389
3352
  );
@@ -3391,17 +3354,17 @@ var carriedTriggerSchema = existingTriggerSchema.refine(
3391
3354
  (trigger) => !isEnvironmentSetupAuthoredTriggerType(trigger.type)
3392
3355
  );
3393
3356
  function automationSchema(limits) {
3394
- const authored = z13.object({
3357
+ const authored = z12.object({
3395
3358
  name: text(limits.nameChars),
3396
3359
  description: text(limits.descriptionChars),
3397
3360
  prompt: text(limits.automationPromptChars),
3398
3361
  triggers: list(proposalTriggerSchema, limits.automationTriggers)
3399
3362
  });
3400
- const updated = authored.extend({ triggers: list(z13.union([proposalTriggerSchema, carriedTriggerSchema]), limits.automationTriggers) });
3401
- return z13.object({
3363
+ const updated = authored.extend({ triggers: list(z12.union([proposalTriggerSchema, carriedTriggerSchema]), limits.automationTriggers) });
3364
+ return z12.object({
3402
3365
  key: requiredText(limits.automationKeyChars),
3403
- action: z13.enum(ENVIRONMENT_SETUP_AUTOMATION_ACTIONS).default("create"),
3404
- automation_id: z13.string().regex(UUID_RE, "must be an automation id").nullable().default(null),
3366
+ action: z12.enum(ENVIRONMENT_SETUP_AUTOMATION_ACTIONS).default("create"),
3367
+ automation_id: z12.string().regex(UUID_RE, "must be an automation id").nullable().default(null),
3405
3368
  name: text().default(""),
3406
3369
  description: optionalText().transform((value) => value ?? ""),
3407
3370
  prompt: text().default(""),
@@ -3424,7 +3387,7 @@ function automationSchema(limits) {
3424
3387
  const content = (automation.action === "update" ? updated : authored).safeParse(automation);
3425
3388
  if (content.success) return { ...automation, ...content.data };
3426
3389
  for (const issue of content.error.issues) ctx.addIssue({ ...issue, code: "custom" });
3427
- return z13.NEVER;
3390
+ return z12.NEVER;
3428
3391
  });
3429
3392
  }
3430
3393
  function automationListSchema(limits) {
@@ -3442,7 +3405,7 @@ function automationListSchema(limits) {
3442
3405
  });
3443
3406
  }
3444
3407
  function environmentSchema(limits) {
3445
- return z13.object({
3408
+ return z12.object({
3446
3409
  name: optionalText(limits.nameChars).transform((value) => value ?? void 0),
3447
3410
  description: clearableText(limits.descriptionChars),
3448
3411
  system_prompt: clearableText(limits.systemPromptChars),
@@ -3451,26 +3414,26 @@ function environmentSchema(limits) {
3451
3414
  });
3452
3415
  }
3453
3416
  function variableSchema(limits, requiredDefault) {
3454
- return z13.object({
3455
- key: z13.string().regex(VARIABLE_KEY_RE, "must be a valid environment variable name").max(limits.variableKeyChars ?? Number.POSITIVE_INFINITY),
3417
+ return z12.object({
3418
+ key: z12.string().regex(VARIABLE_KEY_RE, "must be a valid environment variable name").max(limits.variableKeyChars ?? Number.POSITIVE_INFINITY),
3456
3419
  description: optionalText(limits.variableDescriptionChars).transform((value) => value ?? ""),
3457
- required: z13.boolean().default(requiredDefault)
3420
+ required: z12.boolean().default(requiredDefault)
3458
3421
  });
3459
3422
  }
3460
3423
  function proposalSchema(limits) {
3461
- return z13.object({
3424
+ return z12.object({
3462
3425
  summary: requiredText(limits.summaryChars),
3463
3426
  stack: list(text(), limits.stackItems).default([]).transform((items) => items.filter(Boolean)),
3464
3427
  environment: environmentSchema(limits),
3465
3428
  variables: list(variableSchema(limits, false), limits.variables).default([]),
3466
3429
  automations: automationListSchema(limits),
3467
- verification: list(z13.object({
3430
+ verification: list(z12.object({
3468
3431
  label: requiredText(limits.nameChars),
3469
- status: z13.enum(ENVIRONMENT_SETUP_VERIFICATION_STATUSES),
3432
+ status: z12.enum(ENVIRONMENT_SETUP_VERIFICATION_STATUSES),
3470
3433
  detail: optionalText(limits.verificationDetailChars).transform((value) => value ?? void 0)
3471
3434
  }), limits.verificationItems).default([]),
3472
- media: list(z13.object({
3473
- media_id: z13.string().regex(UUID_RE, "must be a media id"),
3435
+ media: list(z12.object({
3436
+ media_id: z12.string().regex(UUID_RE, "must be a media id"),
3474
3437
  title: requiredText(limits.nameChars)
3475
3438
  }), limits.mediaItems).default([])
3476
3439
  });
@@ -3478,35 +3441,35 @@ function proposalSchema(limits) {
3478
3441
  var environmentSetupProposalSchema = proposalSchema({});
3479
3442
  var environmentSetupProposalSubmissionSchema = proposalSchema(ENVIRONMENT_SETUP_LIMITS);
3480
3443
  var environmentSetupVariableRequestSchema = variableSchema({}, false).extend({
3481
- status: z13.enum(["pending", "provided", "skipped"]),
3482
- requested_at: z13.string(),
3483
- resolved_at: z13.string().nullable().default(null)
3444
+ status: z12.enum(["pending", "provided", "skipped"]),
3445
+ requested_at: z12.string(),
3446
+ resolved_at: z12.string().nullable().default(null)
3484
3447
  });
3485
- var environmentSetupRunStateSchema = z13.object({
3486
- status: z13.enum(ENVIRONMENT_SETUP_RUN_STATUSES),
3487
- steps: z13.partialRecord(z13.enum(ENVIRONMENT_SETUP_STEPS.map((step) => step.key)), z13.enum(ENVIRONMENT_SETUP_STEP_STATUSES)).default({}),
3448
+ var environmentSetupRunStateSchema = z12.object({
3449
+ status: z12.enum(ENVIRONMENT_SETUP_RUN_STATUSES),
3450
+ steps: z12.partialRecord(z12.enum(ENVIRONMENT_SETUP_STEPS.map((step) => step.key)), z12.enum(ENVIRONMENT_SETUP_STEP_STATUSES)).default({}),
3488
3451
  proposal: environmentSetupProposalSchema.nullable().default(null),
3489
- applied: z13.object({
3490
- applied_at: z13.string(),
3491
- automation_ids: z13.array(z13.string())
3452
+ applied: z12.object({
3453
+ applied_at: z12.string(),
3454
+ automation_ids: z12.array(z12.string())
3492
3455
  }).nullable().default(null),
3493
- variable_requests: z13.array(environmentSetupVariableRequestSchema).default([])
3456
+ variable_requests: z12.array(environmentSetupVariableRequestSchema).default([])
3494
3457
  });
3495
- var applyEnvironmentSetupRequestSchema = z13.object({
3458
+ var applyEnvironmentSetupRequestSchema = z12.object({
3496
3459
  environment: environmentSchema(ENVIRONMENT_SETUP_LIMITS).extend({ name: requiredText(ENVIRONMENT_SETUP_LIMITS.nameChars) }),
3497
- variables: list(z13.object({ key: z13.string().regex(VARIABLE_KEY_RE), value: z13.string() }), ENVIRONMENT_SETUP_LIMITS.variables).default([]).refine((variables) => new Set(variables.map((variable) => variable.key)).size === variables.length, "must have unique keys").transform((variables) => variables.filter((variable) => variable.value.length > 0)),
3460
+ variables: list(z12.object({ key: z12.string().regex(VARIABLE_KEY_RE), value: z12.string() }), ENVIRONMENT_SETUP_LIMITS.variables).default([]).refine((variables) => new Set(variables.map((variable) => variable.key)).size === variables.length, "must have unique keys").transform((variables) => variables.filter((variable) => variable.value.length > 0)),
3498
3461
  automations: automationListSchema(ENVIRONMENT_SETUP_LIMITS)
3499
3462
  });
3500
- var requestEnvironmentSetupVariablesSchema = z13.object({
3463
+ var requestEnvironmentSetupVariablesSchema = z12.object({
3501
3464
  variables: list(variableSchema(ENVIRONMENT_SETUP_LIMITS, true), ENVIRONMENT_SETUP_LIMITS.variables).min(1, "must not be empty")
3502
3465
  }).superRefine(({ variables }, ctx) => {
3503
3466
  if (new Set(variables.map((variable) => variable.key)).size !== variables.length) {
3504
3467
  ctx.addIssue({ code: "custom", path: ["variables"], message: "must have unique keys" });
3505
3468
  }
3506
3469
  });
3507
- var respondEnvironmentSetupVariablesSchema = z13.object({
3508
- values: z13.record(z13.string().regex(VARIABLE_KEY_RE), z13.string()).default({}),
3509
- skipped: z13.array(z13.string().regex(VARIABLE_KEY_RE)).default([])
3470
+ var respondEnvironmentSetupVariablesSchema = z12.object({
3471
+ values: z12.record(z12.string().regex(VARIABLE_KEY_RE), z12.string()).default({}),
3472
+ skipped: z12.array(z12.string().regex(VARIABLE_KEY_RE)).default([])
3510
3473
  });
3511
3474
 
3512
3475
  // ../shared/src/default-skills/replicas-agent/abilities/environment-setup.ts
@@ -5214,16 +5177,16 @@ var DEFAULT_WORKSPACE_FILTERS = {
5214
5177
  activity: "any"
5215
5178
  };
5216
5179
  var ONE_DAY_MS = 24 * 60 * 60 * 1e3;
5217
- var workspaceExecRequestSchema = z14.object({
5218
- command: z14.string().regex(/\S/, "command is required"),
5219
- timeout_seconds: z14.number().int().min(1).max(50).optional().describe("Default: 30")
5180
+ var workspaceExecRequestSchema = z13.object({
5181
+ command: z13.string().regex(/\S/, "command is required"),
5182
+ timeout_seconds: z13.number().int().min(1).max(50).optional().describe("Default: 30")
5220
5183
  });
5221
- var terminalRtcCandidateSchema = z14.object({ type: z14.literal("rtc-candidate"), candidate: z14.string(), mid: z14.string() });
5222
- var terminalSocketServerMessageSchema = z14.discriminatedUnion("type", [
5223
- z14.object({ type: z14.literal("output"), data: z14.string() }),
5224
- z14.object({ type: z14.literal("rtc-answer"), sdp: z14.string() }),
5184
+ var terminalRtcCandidateSchema = z13.object({ type: z13.literal("rtc-candidate"), candidate: z13.string(), mid: z13.string() });
5185
+ var terminalSocketServerMessageSchema = z13.discriminatedUnion("type", [
5186
+ z13.object({ type: z13.literal("output"), data: z13.string() }),
5187
+ z13.object({ type: z13.literal("rtc-answer"), sdp: z13.string() }),
5225
5188
  terminalRtcCandidateSchema,
5226
- z14.object({ type: z14.literal("rtc-switch") })
5189
+ z13.object({ type: z13.literal("rtc-switch") })
5227
5190
  ]);
5228
5191
  var TERMINAL_RTC_ICE_SERVER = "stun:stun.l.google.com:19302";
5229
5192
 
@@ -5245,46 +5208,207 @@ var REPLICAS_MCP_TOOLS = {
5245
5208
  messageSubagent: "message_subagent",
5246
5209
  listSubagents: "list_subagents",
5247
5210
  readSubagent: "read_subagent",
5248
- archiveSubagent: "archive_subagent"
5211
+ archiveSubagent: "archive_subagent",
5212
+ waitForSubagents: "wait_for_subagents"
5249
5213
  };
5250
- var automationToolInputSchema = z15.object({
5251
- name: z15.string().describe("Short automation name."),
5252
- prompt: z15.string().describe("Prompt each automation run starts with."),
5253
- environment_id: z15.string().describe(`Environment id from \`${REPLICAS_MCP_TOOLS.listEnvironments}\`.`),
5254
- triggers: z15.array(automationTriggerSchema).min(1).describe(
5214
+ var automationToolInputSchema = z14.object({
5215
+ name: z14.string().describe("Short automation name."),
5216
+ prompt: z14.string().describe("Prompt each automation run starts with."),
5217
+ environment_id: z14.string().describe(`Environment id from \`${REPLICAS_MCP_TOOLS.listEnvironments}\`.`),
5218
+ triggers: z14.array(automationTriggerSchema).min(1).describe(
5255
5219
  'One or more triggers. Cron: `{ "type": "cron", "config": { "schedule": "0 9 * * 1", "timezone": "America/New_York" } }`. GitHub: `{ "type": "github", "config": { "event": "pull_request.opened", "repository_ids": ["<repository uuid>"] } }`.'
5256
5220
  ),
5257
- description: z15.string().optional().describe("One-line summary shown in the dashboard."),
5258
- plan_mode: z15.boolean().optional(),
5259
- goal_mode: z15.boolean().optional(),
5260
- fast_mode: z15.boolean().optional()
5221
+ description: z14.string().optional().describe("One-line summary shown in the dashboard."),
5222
+ plan_mode: z14.boolean().optional(),
5223
+ goal_mode: z14.boolean().optional(),
5224
+ fast_mode: z14.boolean().optional()
5261
5225
  });
5262
5226
  var automationCreateToolInputSchema = automationToolInputSchema.extend({
5263
- scope: z15.enum(["org", "user"]).optional().describe("`org` (default) or `user` for a personal automation, which needs a personal API key.")
5227
+ scope: z14.enum(["org", "user"]).optional().describe("`org` (default) or `user` for a personal automation, which needs a personal API key.")
5264
5228
  });
5265
5229
  var automationUpdateToolInputSchema = automationToolInputSchema.partial().extend({
5266
- automation_id: z15.string().describe("Automation ID"),
5267
- enabled: z15.boolean().optional(),
5268
- agent_provider: z15.enum(AGENT).nullable().optional(),
5269
- model: z15.string().nullable().optional(),
5270
- thinking_level: z15.enum(VALID_THINKING_LEVELS).nullable().optional(),
5271
- workspace_lifecycle_policy: z15.enum(VALID_LIFECYCLE_POLICIES).optional(),
5272
- workspace_size: z15.enum(WORKSPACE_SIZES).optional()
5230
+ automation_id: z14.string().describe("Automation ID"),
5231
+ enabled: z14.boolean().optional(),
5232
+ agent_provider: z14.enum(AGENT).nullable().optional(),
5233
+ model: z14.string().nullable().optional(),
5234
+ thinking_level: z14.enum(VALID_THINKING_LEVELS).nullable().optional(),
5235
+ workspace_lifecycle_policy: z14.enum(VALID_LIFECYCLE_POLICIES).optional(),
5236
+ workspace_size: z14.enum(WORKSPACE_SIZES).optional()
5273
5237
  });
5274
- var chatPath = { id: z15.string().describe("Workspace ID"), chat_id: z15.string().describe("Chat ID") };
5238
+ var chatPath = { id: z14.string().describe("Workspace ID"), chat_id: z14.string().describe("Chat ID") };
5275
5239
  var { provider, model, thinkingLevel, title, message } = forkChatRequestSchema.shape;
5276
- var createChatToolInputSchema = z15.object({ id: chatPath.id, provider, title: createChatRequestSchema.shape.title });
5277
- var forkChatToolInputSchema = z15.object({ ...chatPath, provider, model, thinking_level: thinkingLevel, title, message });
5278
- var renameChatToolInputSchema = z15.object({ ...chatPath, display_name: updateChatDisplayNameRequestSchema.shape.displayName });
5279
- var runCommandToolInputSchema = z15.object({ id: chatPath.id, ...workspaceExecRequestSchema.shape });
5280
- var environmentMcpPath = { environment_id: z15.string().describe("Environment ID") };
5281
- var createEnvironmentMcpToolInputSchema = z15.object({ ...environmentMcpPath, ...createEnvironmentMcpRequestSchema.shape });
5282
- var updateEnvironmentMcpToolInputSchema = z15.object({
5240
+ var createChatToolInputSchema = z14.object({ id: chatPath.id, provider, title: createChatRequestSchema.shape.title });
5241
+ var forkChatToolInputSchema = z14.object({ ...chatPath, provider, model, thinking_level: thinkingLevel, title, message });
5242
+ var renameChatToolInputSchema = z14.object({ ...chatPath, display_name: updateChatDisplayNameRequestSchema.shape.displayName });
5243
+ var runCommandToolInputSchema = z14.object({ id: chatPath.id, ...workspaceExecRequestSchema.shape });
5244
+ var environmentMcpPath = { environment_id: z14.string().describe("Environment ID") };
5245
+ var createEnvironmentMcpToolInputSchema = z14.object({ ...environmentMcpPath, ...createEnvironmentMcpRequestSchema.shape });
5246
+ var updateEnvironmentMcpToolInputSchema = z14.object({
5283
5247
  ...environmentMcpPath,
5284
- mcp_id: z15.string().describe("MCP ID"),
5248
+ mcp_id: z14.string().describe("MCP ID"),
5285
5249
  ...updateEnvironmentMcpRequestSchema.shape
5286
5250
  });
5287
5251
 
5252
+ // ../shared/src/routes/preferences.ts
5253
+ var EMPTY_AGENT_DEFAULT_SETTINGS = {
5254
+ agent_provider: null,
5255
+ model: null,
5256
+ thinking_level: null,
5257
+ goal_mode: null,
5258
+ fast_mode: null
5259
+ };
5260
+ var DEFAULT_SUBAGENT_MCP_PROVIDERS = [...VALID_AGENT_PROVIDERS];
5261
+ var DEFAULT_USER_PREFERENCES = {
5262
+ default_agent: "codex",
5263
+ default_model: null,
5264
+ claude_models: null,
5265
+ codex_models: null,
5266
+ cursor_models: null,
5267
+ claude_hidden_models: null,
5268
+ codex_hidden_models: null,
5269
+ cursor_hidden_models: null,
5270
+ openrouter_models: null,
5271
+ opencode_go_models: null,
5272
+ close_workspace_on_pr_close: false,
5273
+ close_workspace_on_pr_merge: false,
5274
+ default_environment_id: null,
5275
+ respond_to_ci_workflows: true,
5276
+ respond_to_ci_checks: true,
5277
+ respond_to_human_pr_reviews: false,
5278
+ pr_user_attribution: false,
5279
+ auto_draft_prs: false,
5280
+ open_prs_in_graphite: false,
5281
+ open_links_in_desktop_app: false,
5282
+ memory_enabled: null,
5283
+ subagent_mcp_enabled: null,
5284
+ default_fast_mode: false,
5285
+ agent_defaults: { ...EMPTY_AGENT_DEFAULT_SETTINGS },
5286
+ fallback_chains: null
5287
+ };
5288
+ function defaultReplicasAgentAbilities() {
5289
+ const abilities = {};
5290
+ for (const key of REPLICAS_AGENT_ABILITIES) {
5291
+ abilities[key] = true;
5292
+ }
5293
+ if (hasAllReplicasAgentAbilities(abilities)) return abilities;
5294
+ throw new Error("Default Replicas agent ability flags are incomplete");
5295
+ }
5296
+ function hasAllReplicasAgentAbilities(abilities) {
5297
+ return REPLICAS_AGENT_ABILITIES.every((key) => typeof abilities[key] === "boolean");
5298
+ }
5299
+ var DEFAULT_DEFAULT_SKILLS = {
5300
+ replicas_agent: {
5301
+ enabled: true,
5302
+ abilities: defaultReplicasAgentAbilities()
5303
+ }
5304
+ };
5305
+
5306
+ // ../shared/src/prompts.ts
5307
+ var REPLICAS_INSTRUCTIONS_TAG = "replicas_instructions";
5308
+ var MULTITASK_INSTRUCTIONS_TAG = "multitask_instructions";
5309
+ function wrapInTag(content, tag) {
5310
+ return `<${tag}>
5311
+ ${content}
5312
+ </${tag}>`;
5313
+ }
5314
+ function removeTag(text2, tag) {
5315
+ const regex = new RegExp(`<${tag}>[\\s\\S]*?</${tag}>`, "g");
5316
+ return text2.replace(regex, "").trim();
5317
+ }
5318
+ function removeReplicasInstructions(text2) {
5319
+ return removeTag(text2, REPLICAS_INSTRUCTIONS_TAG);
5320
+ }
5321
+ var MULTITASK_INSTRUCTIONS_BLOCK = new RegExp(`\\s*<${MULTITASK_INSTRUCTIONS_TAG}>\\n([\\s\\S]*?)\\n</${MULTITASK_INSTRUCTIONS_TAG}>`);
5322
+ function splitMultitaskInstructions(customInstructions) {
5323
+ const match = customInstructions?.match(MULTITASK_INSTRUCTIONS_BLOCK);
5324
+ return {
5325
+ customInstructions: match ? customInstructions?.replace(match[0], "").trim() || void 0 : customInstructions,
5326
+ multitaskInstructions: match?.[1]
5327
+ };
5328
+ }
5329
+
5330
+ // ../shared/src/multitask-events.ts
5331
+ var MULTITASK_EVENT_KINDS = ["finished", "ready", "needs_attention", "merged", "closed", "archived"];
5332
+ var MULTITASK_EVENT_TYPE = "multitask-event";
5333
+ var multitaskEventSchema = z15.object({
5334
+ id: z15.string(),
5335
+ at: z15.string(),
5336
+ kind: z15.enum(MULTITASK_EVENT_KINDS),
5337
+ agentId: z15.string(),
5338
+ agentName: z15.string(),
5339
+ summary: z15.string(),
5340
+ detail: z15.string().optional(),
5341
+ // Already shown as a row when it happened, so the delivered message does not show it again.
5342
+ noticed: z15.boolean().optional()
5343
+ });
5344
+ var TAG = "multitask_event";
5345
+ var BLOCK = new RegExp(`<${TAG}((?:\\s+\\w+="[^"]*")*)>\\n?([\\s\\S]*?)\\n?</${TAG}>`, "g");
5346
+ var ATTRIBUTE = /(\w+)="([^"]*)"/g;
5347
+ var unescapeAttribute = (value) => value.replace(/&lt;/g, "<").replace(/&quot;/g, '"').replace(/&amp;/g, "&");
5348
+ function extractMultitaskEvents(text2) {
5349
+ return [...text2.matchAll(BLOCK)].flatMap((match) => {
5350
+ const attributes = Object.fromEntries([...match[1].matchAll(ATTRIBUTE)].map(([, key, value]) => [key, unescapeAttribute(value)]));
5351
+ const kind = MULTITASK_EVENT_KINDS.find((candidate) => candidate === attributes.kind);
5352
+ if (!kind || !attributes.id || !attributes.agent_id) return [];
5353
+ const [summary, ...rest] = match[2].replaceAll(`<\\/${TAG}`, `</${TAG}`).split("\n\n");
5354
+ const detail = rest.join("\n\n").trim();
5355
+ return [{
5356
+ id: attributes.id,
5357
+ at: attributes.at ?? "",
5358
+ kind,
5359
+ agentId: attributes.agent_id,
5360
+ agentName: attributes.agent ?? "subagent",
5361
+ summary: summary.trim(),
5362
+ ...detail ? { detail } : {},
5363
+ ...attributes.noticed === "true" ? { noticed: true } : {}
5364
+ }];
5365
+ });
5366
+ }
5367
+ function parseMultitaskEvents(text2) {
5368
+ const events = extractMultitaskEvents(text2);
5369
+ return events.length > 0 && text2.replace(BLOCK, "").replaceAll(MERGED_MESSAGE_SEPARATOR.trim(), "").trim() === "" ? events : null;
5370
+ }
5371
+
5372
+ // ../shared/src/learned-skills.ts
5373
+ import { z as z16 } from "zod";
5374
+
5375
+ // ../shared/src/frontmatter.ts
5376
+ import { parse as parseYaml } from "yaml";
5377
+ function parseFrontmatter(content) {
5378
+ const match = content.match(/^---\r?\n([\s\S]*?)\r?\n---(?:\r?\n|$)/);
5379
+ if (!match) return {};
5380
+ try {
5381
+ const parsed = parseYaml(match[1]);
5382
+ if (typeof parsed !== "object" || parsed === null) return {};
5383
+ return {
5384
+ ..."name" in parsed && typeof parsed.name === "string" ? { name: parsed.name.trim() } : {},
5385
+ ..."description" in parsed && typeof parsed.description === "string" ? { description: parsed.description.trim() } : {}
5386
+ };
5387
+ } catch {
5388
+ return {};
5389
+ }
5390
+ }
5391
+
5392
+ // ../shared/src/learned-skills.ts
5393
+ var LEARNED_SKILLS_ROOT = `${SANDBOX_PATHS.REPLICAS_DIR}/learned-skills`;
5394
+ var LEARNED_SKILLS_MANIFEST_PATH = `${LEARNED_SKILLS_ROOT}/manifest.json`;
5395
+ var LEARNED_SKILL_DIR_PREFIX = "replicas-learned__";
5396
+ var learnedSkillsManifestSchema = z16.object({
5397
+ skills: z16.array(z16.object({ name: z16.string(), sha256: z16.string() }))
5398
+ });
5399
+ var dreamVerdictChecksSchema = z16.object({
5400
+ repeatable: z16.boolean(),
5401
+ realInstruction: z16.boolean(),
5402
+ noContradiction: z16.boolean(),
5403
+ formatExact: z16.boolean(),
5404
+ humanOnly: z16.boolean(),
5405
+ actionable: z16.boolean(),
5406
+ durable: z16.boolean()
5407
+ });
5408
+ var DREAM_VERDICT_CHECKS = dreamVerdictChecksSchema.keyof().options;
5409
+ var dreamVerdictSchema = dreamVerdictChecksSchema.extend({ approve: z16.boolean(), reason: z16.string() });
5410
+ var learnedSkillFormatInstruction = (speaker) => `Write a SKILL.md whose frontmatter has a kebab-case \`name\` and a short \`description\` that starts with "Use when" and names the situations it applies to; the body records only what ${speaker} actually said, restated as a direct instruction, usually one to three lines. Every line of a learning is loaded into future sessions, so leave out anything an agent could infer on its own: no headings, explanations, rules, or examples unless ${speaker} stated those specifics themselves. For "from now on, use Conventional Commits", the body is just "Use Conventional Commits for every commit message and PR title."`;
5411
+
5288
5412
  // ../shared/src/user-message-matching.ts
5289
5413
  function parseTimestampMs(timestamp) {
5290
5414
  const value = typeof timestamp === "number" ? timestamp : Date.parse(timestamp);
@@ -5438,7 +5562,8 @@ var MULTITASK_TOOL_ACTIONS = {
5438
5562
  [REPLICAS_MCP_TOOLS.messageSubagent]: "send",
5439
5563
  [REPLICAS_MCP_TOOLS.listSubagents]: "list",
5440
5564
  [REPLICAS_MCP_TOOLS.readSubagent]: "read",
5441
- [REPLICAS_MCP_TOOLS.archiveSubagent]: "archive"
5565
+ [REPLICAS_MCP_TOOLS.archiveSubagent]: "archive",
5566
+ [REPLICAS_MCP_TOOLS.waitForSubagents]: "wait"
5442
5567
  };
5443
5568
  var INTERNAL_TOOLS = /* @__PURE__ */ new Set(["ToolSearch", "ListMcpResourcesTool", "ReadMcpResourceTool", "TaskOutput", "BashOutput"]);
5444
5569
  function describeToolCall(message2, base) {
@@ -5468,10 +5593,13 @@ function describeToolCall(message2, base) {
5468
5593
  ...base,
5469
5594
  key,
5470
5595
  failed: base.failed || Boolean(message2.output?.startsWith("Error:")),
5471
- multitask: { action: multitaskAction, name: inputString(input, "name"), agentId: inputString(input, "agent_id"), text: inputString(input, "prompt", "message") }
5596
+ multitask: { action: multitaskAction, name: inputString(input, "name"), agentId: inputString(input, "agent_id"), chatId: inputString(input, "chat_id"), text: inputString(input, "prompt", "message") }
5472
5597
  };
5473
5598
  if (multitaskAction === "spawn") return { ...step, category: "agent", icon: "network", live: "Spawning", done: "Spawned", detail: "multitask" };
5474
5599
  if (multitaskAction === "send") return { ...step, category: "agent", icon: "message", live: "Messaging", done: "Messaged", detail: "multitask" };
5600
+ if (multitaskAction === "wait") {
5601
+ return { ...step, category: "agent", icon: "clock", live: "Waiting for subagents", done: "Waited for subagents", detail: "multitask", multitask: { ...step.multitask, events: extractMultitaskEvents(message2.output ?? "") } };
5602
+ }
5475
5603
  if (multitaskAction === "archive") return { ...step, category: "tool", icon: "archive", live: "Archiving subagent", done: "Archived subagent", detail: "io" };
5476
5604
  return multitaskAction === "list" ? { ...step, category: "tool", icon: "network", live: "Listing subagents", done: "Listed subagents", detail: "io" } : { ...step, category: "tool", icon: "network", live: "Reading subagent response", done: "Read subagent response", detail: "io" };
5477
5605
  }
@@ -5522,127 +5650,6 @@ function describeToolCall(message2, base) {
5522
5650
  };
5523
5651
  }
5524
5652
 
5525
- // ../shared/src/multitask-events.ts
5526
- import { z as z16 } from "zod";
5527
-
5528
- // ../shared/src/routes/preferences.ts
5529
- var EMPTY_AGENT_DEFAULT_SETTINGS = {
5530
- agent_provider: null,
5531
- model: null,
5532
- thinking_level: null,
5533
- goal_mode: null,
5534
- fast_mode: null
5535
- };
5536
- var DEFAULT_SUBAGENT_MCP_PROVIDERS = [...VALID_AGENT_PROVIDERS];
5537
- var DEFAULT_USER_PREFERENCES = {
5538
- default_agent: "codex",
5539
- default_model: null,
5540
- claude_models: null,
5541
- codex_models: null,
5542
- cursor_models: null,
5543
- claude_hidden_models: null,
5544
- codex_hidden_models: null,
5545
- cursor_hidden_models: null,
5546
- openrouter_models: null,
5547
- opencode_go_models: null,
5548
- close_workspace_on_pr_close: false,
5549
- close_workspace_on_pr_merge: false,
5550
- default_environment_id: null,
5551
- respond_to_ci_workflows: true,
5552
- respond_to_ci_checks: true,
5553
- respond_to_human_pr_reviews: false,
5554
- pr_user_attribution: false,
5555
- auto_draft_prs: false,
5556
- open_prs_in_graphite: false,
5557
- open_links_in_desktop_app: false,
5558
- memory_enabled: null,
5559
- subagent_mcp_enabled: null,
5560
- default_fast_mode: false,
5561
- agent_defaults: { ...EMPTY_AGENT_DEFAULT_SETTINGS },
5562
- fallback_chains: null
5563
- };
5564
- function defaultReplicasAgentAbilities() {
5565
- const abilities = {};
5566
- for (const key of REPLICAS_AGENT_ABILITIES) {
5567
- abilities[key] = true;
5568
- }
5569
- if (hasAllReplicasAgentAbilities(abilities)) return abilities;
5570
- throw new Error("Default Replicas agent ability flags are incomplete");
5571
- }
5572
- function hasAllReplicasAgentAbilities(abilities) {
5573
- return REPLICAS_AGENT_ABILITIES.every((key) => typeof abilities[key] === "boolean");
5574
- }
5575
- var DEFAULT_DEFAULT_SKILLS = {
5576
- replicas_agent: {
5577
- enabled: true,
5578
- abilities: defaultReplicasAgentAbilities()
5579
- }
5580
- };
5581
-
5582
- // ../shared/src/prompts.ts
5583
- var REPLICAS_INSTRUCTIONS_TAG = "replicas_instructions";
5584
- var MULTITASK_INSTRUCTIONS_TAG = "multitask_instructions";
5585
- function wrapInTag(content, tag) {
5586
- return `<${tag}>
5587
- ${content}
5588
- </${tag}>`;
5589
- }
5590
- function removeTag(text2, tag) {
5591
- const regex = new RegExp(`<${tag}>[\\s\\S]*?</${tag}>`, "g");
5592
- return text2.replace(regex, "").trim();
5593
- }
5594
- function removeReplicasInstructions(text2) {
5595
- return removeTag(text2, REPLICAS_INSTRUCTIONS_TAG);
5596
- }
5597
- var MULTITASK_INSTRUCTIONS_BLOCK = new RegExp(`\\s*<${MULTITASK_INSTRUCTIONS_TAG}>\\n([\\s\\S]*?)\\n</${MULTITASK_INSTRUCTIONS_TAG}>`);
5598
- function splitMultitaskInstructions(customInstructions) {
5599
- const match = customInstructions?.match(MULTITASK_INSTRUCTIONS_BLOCK);
5600
- return {
5601
- customInstructions: match ? customInstructions?.replace(match[0], "").trim() || void 0 : customInstructions,
5602
- multitaskInstructions: match?.[1]
5603
- };
5604
- }
5605
-
5606
- // ../shared/src/multitask-events.ts
5607
- var MULTITASK_EVENT_KINDS = ["finished", "ready", "needs_attention", "merged", "closed", "archived"];
5608
- var MULTITASK_EVENT_TYPE = "multitask-event";
5609
- var multitaskEventSchema = z16.object({
5610
- id: z16.string(),
5611
- at: z16.string(),
5612
- kind: z16.enum(MULTITASK_EVENT_KINDS),
5613
- agentId: z16.string(),
5614
- agentName: z16.string(),
5615
- summary: z16.string(),
5616
- detail: z16.string().optional(),
5617
- // Already shown as a row when it happened, so the delivered message does not show it again.
5618
- noticed: z16.boolean().optional()
5619
- });
5620
- var TAG = "multitask_event";
5621
- var BLOCK = new RegExp(`<${TAG}((?:\\s+\\w+="[^"]*")*)>\\n?([\\s\\S]*?)\\n?</${TAG}>`, "g");
5622
- var ATTRIBUTE = /(\w+)="([^"]*)"/g;
5623
- var unescapeAttribute = (value) => value.replace(/&lt;/g, "<").replace(/&quot;/g, '"').replace(/&amp;/g, "&");
5624
- function parseMultitaskEvents(text2) {
5625
- const events = [];
5626
- for (const match of text2.matchAll(BLOCK)) {
5627
- const attributes = Object.fromEntries([...match[1].matchAll(ATTRIBUTE)].map(([, key, value]) => [key, unescapeAttribute(value)]));
5628
- const kind = MULTITASK_EVENT_KINDS.find((candidate) => candidate === attributes.kind);
5629
- if (!kind || !attributes.id || !attributes.agent_id) return null;
5630
- const [summary, ...rest] = match[2].replaceAll(`<\\/${TAG}`, `</${TAG}`).split("\n\n");
5631
- const detail = rest.join("\n\n").trim();
5632
- events.push({
5633
- id: attributes.id,
5634
- at: attributes.at ?? "",
5635
- kind,
5636
- agentId: attributes.agent_id,
5637
- agentName: attributes.agent ?? "subagent",
5638
- summary: summary.trim(),
5639
- ...detail ? { detail } : {},
5640
- ...attributes.noticed === "true" ? { noticed: true } : {}
5641
- });
5642
- }
5643
- return events.length > 0 && text2.replace(BLOCK, "").replaceAll(MERGED_MESSAGE_SEPARATOR.trim(), "").trim() === "" ? events : null;
5644
- }
5645
-
5646
5653
  // ../shared/src/user-message-attachments.ts
5647
5654
  var ATTACHMENT_PLACEHOLDER_REGEX = /^\[\d+ (?:(?:images?|files?)(?: and \d+ files?)? attached|(?:image )?attachments?)\]$/;
5648
5655
  var WALKTHROUGH_NOTE_REGEX = /(?:^|\n\n)<replicas_walkthrough path="([^"\n]+)" duration_seconds="(\d+)" audio="(true|false)">\n[^<]*\n<\/replicas_walkthrough>$/;
@@ -9927,16 +9934,11 @@ export {
9927
9934
  SUBAGENT_MCP_TOOLS,
9928
9935
  SUBAGENT_MCP_TOOL_NAMES,
9929
9936
  parseMcpToolName,
9930
- parseFrontmatter,
9931
- LEARNED_SKILLS_MANIFEST_PATH,
9932
- LEARNED_SKILL_DIR_PREFIX,
9933
- learnedSkillsManifestSchema,
9934
- learnedSkillFormatInstruction,
9935
- createUuidFromHex,
9936
9937
  isGitHubUrl,
9937
9938
  parseCodeHostPrUrl,
9938
9939
  decodePathSegments,
9939
9940
  buildCodeHostPrUrl,
9941
+ createUuidFromHex,
9940
9942
  WORKSPACE_IDENTITY_AUDIENCE,
9941
9943
  AWS_SOURCE_IDENTITY_CLAIM,
9942
9944
  IDENTITY_PROXY_PORT,
@@ -9949,14 +9951,19 @@ export {
9949
9951
  HISTORY_ROOT,
9950
9952
  HISTORY_INDEX_FILENAME,
9951
9953
  TERMINAL_RTC_ICE_SERVER,
9952
- areUserMessagesWithinMatchWindow,
9953
- isCompaction,
9954
- describeMessageSteps,
9955
9954
  REPLICAS_INSTRUCTIONS_TAG,
9956
9955
  MULTITASK_INSTRUCTIONS_TAG,
9957
9956
  wrapInTag,
9958
9957
  splitMultitaskInstructions,
9959
9958
  MULTITASK_EVENT_TYPE,
9959
+ parseFrontmatter,
9960
+ LEARNED_SKILLS_MANIFEST_PATH,
9961
+ LEARNED_SKILL_DIR_PREFIX,
9962
+ learnedSkillsManifestSchema,
9963
+ learnedSkillFormatInstruction,
9964
+ areUserMessagesWithinMatchWindow,
9965
+ isCompaction,
9966
+ describeMessageSteps,
9960
9967
  extractErrorText,
9961
9968
  isTransientErrorText,
9962
9969
  extractToolResultText,
@@ -5,14 +5,14 @@ import {
5
5
  getOriginDefaultBranch,
6
6
  monolithRequest,
7
7
  runGitCommand
8
- } from "./chunk-TUZZRDKQ.js";
8
+ } from "./chunk-EGH2TCYM.js";
9
9
  import {
10
10
  extractCommandProtectionCommandText,
11
11
  findCommandProtectionGitLookups,
12
12
  findGitCommitSignals,
13
13
  findPrMergeSignals,
14
14
  parseCommandProtectionRequest
15
- } from "./chunk-E4ON2EVA.js";
15
+ } from "./chunk-3LW5WKNJ.js";
16
16
 
17
17
  // src/services/command-protection-service.ts
18
18
  import { readFile, stat } from "fs/promises";
@@ -5,7 +5,7 @@ import {
5
5
  extractCommandProtectionCommandText,
6
6
  isRecord,
7
7
  parseCodeHostPrUrl
8
- } from "./chunk-E4ON2EVA.js";
8
+ } from "./chunk-3LW5WKNJ.js";
9
9
 
10
10
  // src/services/published-pull-request-urls.ts
11
11
  function publishedPullRequestUrls(result) {
@@ -10,15 +10,15 @@ import {
10
10
  resolveDiffBase,
11
11
  runGitCommand,
12
12
  setAgentCredentialSnapshot
13
- } from "./chunk-TUZZRDKQ.js";
13
+ } from "./chunk-EGH2TCYM.js";
14
14
  import {
15
15
  AppServerProcess,
16
16
  buildCodexAgentEnv
17
- } from "./chunk-HBLXTK7E.js";
17
+ } from "./chunk-UHTZM2RY.js";
18
18
  import {
19
19
  SUBPROCESS_MAX_BUFFER,
20
20
  execFileAsync
21
- } from "./chunk-PIZUFR3F.js";
21
+ } from "./chunk-LWVG6G7V.js";
22
22
  import {
23
23
  isRecord
24
24
  } from "./chunk-UZSNFLDQ.js";
@@ -55,7 +55,7 @@ import {
55
55
  resolveOpenAICompatibleModelsUrl,
56
56
  splitMultitaskInstructions,
57
57
  withTimeout
58
- } from "./chunk-E4ON2EVA.js";
58
+ } from "./chunk-3LW5WKNJ.js";
59
59
 
60
60
  // src/managers/codex-token-manager.ts
61
61
  import { promises as fs } from "fs";
@@ -291,7 +291,7 @@ var CodexTokenManager = class extends BaseRefreshManager {
291
291
  await this.applyCredentialUpdate(++this.credentialGeneration, async () => {
292
292
  await this.applyCredentialsResponse(data);
293
293
  setAgentCredentialSnapshot("codex", data);
294
- const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-GPVOHGYR.js");
294
+ const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-7Q4AT3PY.js");
295
295
  await restartCodexAspHostIfRunning2();
296
296
  });
297
297
  await this.start(true);
@@ -312,7 +312,7 @@ var CodexTokenManager = class extends BaseRefreshManager {
312
312
  const accountChanged = ENGINE_ENV.REPLICAS_AGENT_CREDENTIALS.codex?.credentialId !== data.credentialId;
313
313
  await this.applyCredentialsResponse(data);
314
314
  if (restartOnChange && (accountChanged || CODEX_AUTH_ENV_KEYS.some((key, index) => process.env[key] !== previousEnv[index]))) {
315
- const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-GPVOHGYR.js");
315
+ const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-7Q4AT3PY.js");
316
316
  await restartCodexAspHostIfRunning2();
317
317
  }
318
318
  setAgentCredentialSnapshot("codex", data);
@@ -4,7 +4,7 @@ const require = __createRequire(import.meta.url);
4
4
  import {
5
5
  SUBPROCESS_MAX_BUFFER,
6
6
  execFileAsync
7
- } from "./chunk-PIZUFR3F.js";
7
+ } from "./chunk-LWVG6G7V.js";
8
8
  import {
9
9
  isRecord as isRecord2
10
10
  } from "./chunk-UZSNFLDQ.js";
@@ -18,7 +18,7 @@ import {
18
18
  isValidAgentProvider,
19
19
  parsePosixEnvFile,
20
20
  readReplicasRuntimeEnv
21
- } from "./chunk-E4ON2EVA.js";
21
+ } from "./chunk-3LW5WKNJ.js";
22
22
 
23
23
  // src/runtime-env-loader.ts
24
24
  import { readFileSync } from "fs";
@@ -3,7 +3,7 @@ import { createRequire as __createRequire } from 'node:module';
3
3
  const require = __createRequire(import.meta.url);
4
4
  import {
5
5
  AspClient
6
- } from "./chunk-HBLXTK7E.js";
6
+ } from "./chunk-UHTZM2RY.js";
7
7
  import {
8
8
  ASTER_BASE_URL,
9
9
  ASTER_PROVIDER,
@@ -11,7 +11,7 @@ import {
11
11
  codexReasoningEffortForThinkingLevel,
12
12
  isRecord,
13
13
  readOllamaAuthEnv
14
- } from "./chunk-E4ON2EVA.js";
14
+ } from "./chunk-3LW5WKNJ.js";
15
15
 
16
16
  // src/managers/codex-asp/notification-dispatch.ts
17
17
  var TURN_STARTED_METHOD = "turn/started";
@@ -3,7 +3,7 @@ import { createRequire as __createRequire } from 'node:module';
3
3
  const require = __createRequire(import.meta.url);
4
4
  import {
5
5
  HOOK_EXEC_MAX_BUFFER_BYTES
6
- } from "./chunk-E4ON2EVA.js";
6
+ } from "./chunk-3LW5WKNJ.js";
7
7
 
8
8
  // src/utils/exec.ts
9
9
  import { exec, execFile } from "child_process";
@@ -3,10 +3,10 @@ import { createRequire as __createRequire } from 'node:module';
3
3
  const require = __createRequire(import.meta.url);
4
4
  import {
5
5
  execFileAsync
6
- } from "./chunk-PIZUFR3F.js";
6
+ } from "./chunk-LWVG6G7V.js";
7
7
  import {
8
8
  isVersionBelow
9
- } from "./chunk-E4ON2EVA.js";
9
+ } from "./chunk-3LW5WKNJ.js";
10
10
 
11
11
  // src/utils/codex-agent-env.ts
12
12
  function buildCodexAgentEnv(source = process.env) {
@@ -240,7 +240,7 @@ function getCodexModelProvider(method) {
240
240
  if (method === "foundry") return "azure";
241
241
  return method === "ollama" || method === "openai-compatible" ? "replicas_openai_compatible" : "openai";
242
242
  }
243
- var ENGINE_PACKAGE_VERSION = "0.1.1057";
243
+ var ENGINE_PACKAGE_VERSION = "0.1.1058";
244
244
  var INITIALIZE_METHOD = "initialize";
245
245
  var INITIALIZED_NOTIFICATION = "initialized";
246
246
  var ACCOUNT_LOGIN_START_METHOD = "account/login/start";
@@ -3,13 +3,13 @@ import { createRequire as __createRequire } from 'node:module';
3
3
  const require = __createRequire(import.meta.url);
4
4
  import {
5
5
  evaluateCommandProtection
6
- } from "./chunk-3ZHQBKGB.js";
7
- import "./chunk-TUZZRDKQ.js";
8
- import "./chunk-PIZUFR3F.js";
6
+ } from "./chunk-3YVQH4P6.js";
7
+ import "./chunk-EGH2TCYM.js";
8
+ import "./chunk-LWVG6G7V.js";
9
9
  import {
10
10
  isRecord
11
11
  } from "./chunk-UZSNFLDQ.js";
12
- import "./chunk-E4ON2EVA.js";
12
+ import "./chunk-3LW5WKNJ.js";
13
13
  import "./chunk-VEQXQN22.js";
14
14
 
15
15
  // src/command-protection-hook.ts
@@ -13,12 +13,12 @@ import {
13
13
  recoverCompletedTurn,
14
14
  spawnMuseMsp,
15
15
  startMuseSession
16
- } from "./chunk-SAZVO5ZV.js";
16
+ } from "./chunk-JINDQGGS.js";
17
17
  import {
18
18
  AppServerProcess,
19
19
  buildCodexAgentEnv
20
- } from "./chunk-HBLXTK7E.js";
21
- import "./chunk-PIZUFR3F.js";
20
+ } from "./chunk-UHTZM2RY.js";
21
+ import "./chunk-LWVG6G7V.js";
22
22
  import {
23
23
  AGENT,
24
24
  OPENCODE_GO_PROVIDER,
@@ -28,7 +28,7 @@ import {
28
28
  headlessAgentUsagePath,
29
29
  isRecord,
30
30
  withTimeout
31
- } from "./chunk-E4ON2EVA.js";
31
+ } from "./chunk-3LW5WKNJ.js";
32
32
  import "./chunk-VEQXQN22.js";
33
33
 
34
34
  // src/headless-agent.ts
package/dist/src/index.js CHANGED
@@ -27,7 +27,7 @@ import {
27
27
  evaluateCommandProtection,
28
28
  extractToolCommand,
29
29
  reportCommandProtectionBlock
30
- } from "./chunk-3ZHQBKGB.js";
30
+ } from "./chunk-3YVQH4P6.js";
31
31
  import {
32
32
  ACCOUNT_RATE_LIMITS_UPDATED_METHOD,
33
33
  AGENT_MESSAGE_DELTA_METHOD,
@@ -64,10 +64,10 @@ import {
64
64
  spawnMuseMsp,
65
65
  startMuseSession,
66
66
  uuidV7
67
- } from "./chunk-SAZVO5ZV.js";
67
+ } from "./chunk-JINDQGGS.js";
68
68
  import {
69
69
  publishedPullRequestUrls
70
- } from "./chunk-IKZOVE4K.js";
70
+ } from "./chunk-4KJVUKEN.js";
71
71
  import {
72
72
  ACCOUNT_RATE_LIMITS_READ_METHOD,
73
73
  AsyncLock,
@@ -129,7 +129,7 @@ import {
129
129
  timestampFromSeconds,
130
130
  upsertCredentialFileLines,
131
131
  writeSecureCredentialFile
132
- } from "./chunk-4NQ6T6MU.js";
132
+ } from "./chunk-6UJXFBYZ.js";
133
133
  import {
134
134
  ENGINE_ENV,
135
135
  monolithRequest,
@@ -138,15 +138,15 @@ import {
138
138
  reloadEngineEnv,
139
139
  resolveDiffBase,
140
140
  setAgentCredentialSnapshot
141
- } from "./chunk-TUZZRDKQ.js";
141
+ } from "./chunk-EGH2TCYM.js";
142
142
  import {
143
143
  getCodexModelProvider
144
- } from "./chunk-HBLXTK7E.js";
144
+ } from "./chunk-UHTZM2RY.js";
145
145
  import {
146
146
  SUBPROCESS_MAX_BUFFER,
147
147
  execAsync,
148
148
  execFileAsync
149
- } from "./chunk-PIZUFR3F.js";
149
+ } from "./chunk-LWVG6G7V.js";
150
150
  import {
151
151
  isRecord as isRecord2
152
152
  } from "./chunk-UZSNFLDQ.js";
@@ -374,7 +374,7 @@ import {
374
374
  workspaceTokenRequestSchema,
375
375
  workspaceTokenResponseSchema,
376
376
  wrapInTag
377
- } from "./chunk-E4ON2EVA.js";
377
+ } from "./chunk-3LW5WKNJ.js";
378
378
  import {
379
379
  cloneMcpConfig,
380
380
  ensureCompatibilityImports,
@@ -3,13 +3,13 @@ import { createRequire as __createRequire } from 'node:module';
3
3
  const require = __createRequire(import.meta.url);
4
4
  import {
5
5
  publishedPullRequestUrls
6
- } from "./chunk-IKZOVE4K.js";
6
+ } from "./chunk-4KJVUKEN.js";
7
7
  import {
8
8
  isRecord
9
9
  } from "./chunk-UZSNFLDQ.js";
10
10
  import {
11
11
  shouldRefreshPullRequests
12
- } from "./chunk-E4ON2EVA.js";
12
+ } from "./chunk-3LW5WKNJ.js";
13
13
  import "./chunk-VEQXQN22.js";
14
14
 
15
15
  // src/services/post-tool-pr-notifier.ts
@@ -9,7 +9,7 @@ import {
9
9
  spawnSubagentRequestSchema,
10
10
  subagentResponseSchema,
11
11
  waitSubagentRequestSchema
12
- } from "./chunk-E4ON2EVA.js";
12
+ } from "./chunk-3LW5WKNJ.js";
13
13
  import "./chunk-VEQXQN22.js";
14
14
 
15
15
  // src/subagent-mcp.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "replicas-engine",
3
- "version": "0.1.1057",
3
+ "version": "0.1.1058",
4
4
  "description": "Lightweight API server for Replicas workspaces",
5
5
  "type": "module",
6
6
  "main": "dist/src/index.js",