chatroom-cli 1.138.2 → 1.140.0

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/dist/index.js CHANGED
@@ -10016,6 +10016,33 @@ var init_rigging = __esm(() => {
10016
10016
  init_model_registry();
10017
10017
  });
10018
10018
 
10019
+ // src/commands/image-shared/writable-path.ts
10020
+ function dryRunOverwriteHint(dryRun) {
10021
+ return dryRun ? DRY_RUN_OVERWRITE_HINT : undefined;
10022
+ }
10023
+ function directoryRefusal(target) {
10024
+ return `${target.label} is a directory: ${target.path}. Pass a file path.`;
10025
+ }
10026
+ function fileRefusal(target) {
10027
+ return `${target.label} already exists: ${target.path}. ${target.hint ?? OVERWRITE_HINT}`;
10028
+ }
10029
+ function blockedMessage(target, status, force) {
10030
+ if (status === "directory")
10031
+ return directoryRefusal(target);
10032
+ if (status === "file" && !force)
10033
+ return fileRefusal(target);
10034
+ return null;
10035
+ }
10036
+ async function findUnwritablePathMessage(deps, targets, force) {
10037
+ for (const target of targets) {
10038
+ const message = blockedMessage(target, await deps.pathStatus(target.path), force);
10039
+ if (message !== null)
10040
+ return message;
10041
+ }
10042
+ return null;
10043
+ }
10044
+ var OVERWRITE_HINT = "Pass --force to overwrite.", DRY_RUN_OVERWRITE_HINT = "A real run would also refuse this. Add --force to print the plan; a dry run writes nothing; do not carry --force into the real run unless overwriting is intended.";
10045
+
10019
10046
  // src/commands/generate-3d/generate-3d.ts
10020
10047
  var exports_generate_3d = {};
10021
10048
  __export(exports_generate_3d, {
@@ -10104,18 +10131,16 @@ async function validateInputImage(deps, inputImage) {
10104
10131
  }
10105
10132
  return { kind: "file", path: localPath, contentType };
10106
10133
  }
10107
- async function requireWritablePath(deps, path, label, force, hint = "Pass --force to overwrite.") {
10108
- const status = await deps.pathStatus(path);
10109
- if (status === "directory") {
10110
- throw new Generate3dError(`${label} is a directory: ${path}. Pass a file path.`);
10111
- }
10112
- if (status === "file" && !force) {
10113
- throw new Generate3dError(`${label} already exists: ${path}. ${hint}`);
10114
- }
10134
+ async function requireWritablePaths(deps, targets, force) {
10135
+ const message = await findUnwritablePathMessage(deps, targets, force);
10136
+ if (message !== null)
10137
+ throw new Generate3dError(message);
10115
10138
  }
10116
- async function requireWritableOutput(deps, outPath, manifestPath, force) {
10117
- await requireWritablePath(deps, outPath, "--out", force);
10118
- await requireWritablePath(deps, manifestPath, "Manifest", force);
10139
+ async function requireWritableOutput(deps, outPath, manifestPath, force, dryRun) {
10140
+ await requireWritablePaths(deps, [
10141
+ { path: outPath, label: "--out", hint: dryRunOverwriteHint(dryRun) },
10142
+ { path: manifestPath, label: "Manifest", hint: dryRunOverwriteHint(dryRun) }
10143
+ ], force);
10119
10144
  }
10120
10145
  function planInputImageUrl(target) {
10121
10146
  if (target === undefined)
@@ -10186,13 +10211,17 @@ function buildRiggingPlan(outPath, rig, animationActionIds) {
10186
10211
  extraCostLines: riggingCostLines(animationActionIds.length)
10187
10212
  };
10188
10213
  }
10189
- async function requireWritableRiggingPaths(deps, rigging, force) {
10214
+ async function requireWritableRiggingPaths(deps, rigging, force, dryRun) {
10190
10215
  if (rigging.riggedOutPath === null)
10191
10216
  return;
10192
- await requireWritablePath(deps, rigging.riggedOutPath, "Rigged GLB", force);
10193
- for (const animation of rigging.animationOutPaths) {
10194
- await requireWritablePath(deps, animation.path, `Animation clip ${animation.actionId} GLB`, force);
10195
- }
10217
+ await requireWritablePaths(deps, [
10218
+ { path: rigging.riggedOutPath, label: "Rigged GLB", hint: dryRunOverwriteHint(dryRun) },
10219
+ ...rigging.animationOutPaths.map((animation) => ({
10220
+ path: animation.path,
10221
+ label: `Animation clip ${animation.actionId} GLB`,
10222
+ hint: dryRunOverwriteHint(dryRun)
10223
+ }))
10224
+ ], force);
10196
10225
  }
10197
10226
  function packageFilePaths(packageDir, base) {
10198
10227
  return { zipPath: join2(packageDir, `${base}.zip`), htmlPath: join2(packageDir, `${base}.html`) };
@@ -10445,10 +10474,10 @@ function planReferenceStep(args) {
10445
10474
  costLines: [{ label: REFERENCE_IMAGE_COST_LABEL, usd: REFERENCE_IMAGE_COST_USD }]
10446
10475
  };
10447
10476
  }
10448
- async function requireWritableReference(deps, reference, force) {
10477
+ async function requireWritableReference(deps, reference, force, dryRun) {
10449
10478
  if (reference?.source !== "generated" || reference.localPath === null)
10450
10479
  return;
10451
- await requireWritablePath(deps, reference.localPath, "Reference image", force);
10480
+ await requireWritablePaths(deps, [{ path: reference.localPath, label: "Reference image", hint: dryRunOverwriteHint(dryRun) }], force);
10452
10481
  }
10453
10482
  function requireRigForClips(rig, animationActionIds) {
10454
10483
  if (animationActionIds.length > 0 && !rig) {
@@ -10456,13 +10485,16 @@ function requireRigForClips(rig, animationActionIds) {
10456
10485
  }
10457
10486
  }
10458
10487
  async function requireWritablePlanPaths(args) {
10459
- await requireWritableOutput(args.deps, args.outPath, args.manifestPath, args.force);
10460
- await requireWritableRiggingPaths(args.deps, args.rigging, args.force);
10461
- await requireWritablePackage(args.deps, args.naming, args.force);
10488
+ await requireWritableOutput(args.deps, args.outPath, args.manifestPath, args.force, args.dryRun);
10489
+ await requireWritableRiggingPaths(args.deps, args.rigging, args.force, args.dryRun);
10490
+ await requireWritablePackage(args.deps, args.naming, args.force, args.dryRun);
10462
10491
  }
10463
- async function requireWritablePackage(deps, paths, force) {
10464
- await requireWritablePath(deps, paths.zipPath, "Package", force, PACKAGE_COLLISION_HINT);
10465
- await requireWritablePath(deps, paths.htmlPath, "Preview", force, PACKAGE_COLLISION_HINT);
10492
+ async function requireWritablePackage(deps, paths, force, dryRun) {
10493
+ const hint = dryRun ? DRY_RUN_PACKAGE_HINT : PACKAGE_COLLISION_HINT;
10494
+ await requireWritablePaths(deps, [
10495
+ { path: paths.zipPath, label: "Package", hint },
10496
+ { path: paths.htmlPath, label: "Preview", hint }
10497
+ ], force);
10466
10498
  }
10467
10499
  function resolvePlanTarget(opts) {
10468
10500
  const model = requireModel(opts.model);
@@ -10496,13 +10528,14 @@ async function planGenerate3d(opts, deps) {
10496
10528
  await requireWritablePlanPaths({
10497
10529
  deps,
10498
10530
  force: opts.force === true,
10531
+ dryRun: opts.dryRun === true,
10499
10532
  outPath,
10500
10533
  manifestPath,
10501
10534
  rigging,
10502
10535
  naming
10503
10536
  });
10504
10537
  const referenceStep = planReferenceStep({ model, opts, outPath, inputTarget });
10505
- await requireWritableReference(deps, referenceStep.referenceImage, opts.force === true);
10538
+ await requireWritableReference(deps, referenceStep.referenceImage, opts.force === true, opts.dryRun === true);
10506
10539
  const input = model.buildInput({
10507
10540
  prompt: opts.prompt,
10508
10541
  imageUrl: referenceStep.imageUrl,
@@ -11448,7 +11481,7 @@ async function generate3d(opts, deps) {
11448
11481
  costLines: formatGenerate3dCost(plan.costLines, plan.model.id, plan.generationCostKnown)
11449
11482
  };
11450
11483
  }
11451
- var GLB_CONTENT_TYPE = "model/gltf-binary", GLB_EXTENSION = ".glb", PLANNED_MODEL_URL = "<generated mesh GLB URL>", RIGGING_HUMANOID_WARNING = "Rigging (Meshy) expects a humanoid mesh; non-humanoid meshes fail on fal.", WEB_VARIANT_TRIANGLE_TARGET = 30000, WEB_VARIANT_MAX_TEXTURE_PX = 1024, WEB_VARIANT_TEXTURE_QUALITY = 80, WEB_VARIANT_DATA_TEXTURE_QUALITY = 95, PACKAGE_MANIFEST_NAME = "manifest.json", PACKAGE_PRICING_NOTE = "list-price estimate, not a billed amount", HTTP_URL_PATTERN, INPUT_IMAGE_CONTENT_TYPES, INPUT_REQUIREMENTS, PACKAGE_COLLISION_HINT = "Another run used this name in the same second; wait a second, use a different --package-dir, or pass --force.", FLAG_CAPABILITY, INPUT_FLAG_NAMES, INPUT_PLACEHOLDERS, INPUT_CAPABILITY, RESERVED_INPUT_FLAGS, GENERATED_REFERENCE_URL = "<generated reference image URL>", WEB_VARIANT_OPTIONS, SILENT_LOGGER2;
11484
+ var GLB_CONTENT_TYPE = "model/gltf-binary", GLB_EXTENSION = ".glb", PLANNED_MODEL_URL = "<generated mesh GLB URL>", RIGGING_HUMANOID_WARNING = "Rigging (Meshy) expects a humanoid mesh; non-humanoid meshes fail on fal.", WEB_VARIANT_TRIANGLE_TARGET = 30000, WEB_VARIANT_MAX_TEXTURE_PX = 1024, WEB_VARIANT_TEXTURE_QUALITY = 80, WEB_VARIANT_DATA_TEXTURE_QUALITY = 95, PACKAGE_MANIFEST_NAME = "manifest.json", PACKAGE_PRICING_NOTE = "list-price estimate, not a billed amount", HTTP_URL_PATTERN, INPUT_IMAGE_CONTENT_TYPES, INPUT_REQUIREMENTS, PACKAGE_COLLISION_CAUSE = "Another run used this name in the same second; wait a second, use a different --package-dir", PACKAGE_COLLISION_HINT, DRY_RUN_PACKAGE_HINT, FLAG_CAPABILITY, INPUT_FLAG_NAMES, INPUT_PLACEHOLDERS, INPUT_CAPABILITY, RESERVED_INPUT_FLAGS, GENERATED_REFERENCE_URL = "<generated reference image URL>", WEB_VARIANT_OPTIONS, SILENT_LOGGER2;
11452
11485
  var init_generate_3d = __esm(() => {
11453
11486
  init_meshoptimizer();
11454
11487
  init_asset_analysis();
@@ -11469,6 +11502,8 @@ var init_generate_3d = __esm(() => {
11469
11502
  text: { flag: "--prompt", value: (opts) => opts.prompt },
11470
11503
  image: { flag: "--input-image", value: (opts) => opts.inputImage }
11471
11504
  };
11505
+ PACKAGE_COLLISION_HINT = `${PACKAGE_COLLISION_CAUSE}, or pass --force.`;
11506
+ DRY_RUN_PACKAGE_HINT = `${PACKAGE_COLLISION_CAUSE}. ${DRY_RUN_OVERWRITE_HINT}`;
11472
11507
  FLAG_CAPABILITY = {
11473
11508
  "--prompt": "prompt",
11474
11509
  "--input-image": "image",
@@ -11618,16 +11653,16 @@ function packageBase(zipName, zipPath) {
11618
11653
  }
11619
11654
  return zipName.slice(0, -".zip".length);
11620
11655
  }
11621
- async function requireWritablePreview(htmlPath, force) {
11622
- const stats = await stat2(htmlPath).catch(() => null);
11656
+ async function previewPathStatus(path) {
11657
+ const stats = await stat2(path).catch(() => null);
11623
11658
  if (stats === null)
11624
- return;
11625
- if (stats.isDirectory()) {
11626
- throw new Error(`Preview is a directory: ${htmlPath}. Pass a file path.`);
11627
- }
11628
- if (!force) {
11629
- throw new Error(`Preview already exists: ${htmlPath}. Pass --force to overwrite.`);
11630
- }
11659
+ return "missing";
11660
+ return stats.isDirectory() ? "directory" : "file";
11661
+ }
11662
+ async function requireWritablePreview(htmlPath, force) {
11663
+ const message = await findUnwritablePathMessage({ pathStatus: previewPathStatus }, [{ path: htmlPath, label: "Preview" }], force);
11664
+ if (message !== null)
11665
+ throw new Error(message);
11631
11666
  }
11632
11667
  async function writePreview(htmlPath, html, force) {
11633
11668
  await requireWritablePreview(htmlPath, force);
@@ -11852,16 +11887,17 @@ function readPngDimensions(bytes) {
11852
11887
  const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
11853
11888
  return { width: view.getUint32(16), height: view.getUint32(20) };
11854
11889
  }
11855
- function formatConflicts(conflicts) {
11890
+ function formatConflicts(conflicts, dryRun) {
11856
11891
  const shown = conflicts.slice(0, 10);
11857
11892
  const lines = shown.map((conflict) => `- ${conflict.path}: ${conflict.reason}`);
11858
11893
  if (conflicts.length > shown.length) {
11859
11894
  lines.push(`- and ${conflicts.length - shown.length} more`);
11860
11895
  }
11896
+ const hint = dryRunOverwriteHint(dryRun) ?? "Pass --force to overwrite.";
11861
11897
  return `Refusing to write ${conflicts.length} output file(s):
11862
11898
  ${lines.join(`
11863
11899
  `)}
11864
- Pass --force to overwrite.`;
11900
+ ${hint}`;
11865
11901
  }
11866
11902
  async function findOutputConflicts(deps, paths, sourcePaths, sourceIdentities, force) {
11867
11903
  const matchesSourceIdentity = (identity) => sourceIdentities.some((source) => source !== null && source.dev === identity.dev && source.ino === identity.ino);
@@ -12149,18 +12185,16 @@ function requireImage2(images, model) {
12149
12185
  }
12150
12186
  return image;
12151
12187
  }
12152
- async function requireWritablePath2(deps, path, label, force) {
12153
- const status = await deps.pathStatus(path);
12154
- if (status === "directory") {
12155
- throw new GenerateImageError(`${label} is a directory: ${path}. Pass a file path.`);
12156
- }
12157
- if (status === "file" && !force) {
12158
- throw new GenerateImageError(`${label} already exists: ${path}. Pass --force to overwrite.`);
12159
- }
12188
+ async function requireWritablePaths2(deps, targets, force) {
12189
+ const message = await findUnwritablePathMessage(deps, targets, force);
12190
+ if (message !== null)
12191
+ throw new GenerateImageError(message);
12160
12192
  }
12161
- async function requireWritableOutput2(deps, outPath, manifestPath, force) {
12162
- await requireWritablePath2(deps, outPath, "--out", force);
12163
- await requireWritablePath2(deps, manifestPath, "Manifest", force);
12193
+ async function requireWritableOutput2(deps, outPath, manifestPath, force, dryRun) {
12194
+ await requireWritablePaths2(deps, [
12195
+ { path: outPath, label: "--out", hint: dryRunOverwriteHint(dryRun) },
12196
+ { path: manifestPath, label: "Manifest", hint: dryRunOverwriteHint(dryRun) }
12197
+ ], force);
12164
12198
  }
12165
12199
  function recoveryMessage(action, err2, requestId, url) {
12166
12200
  const detail = err2 instanceof Error ? err2.message : String(err2);
@@ -12433,7 +12467,7 @@ async function planGenerateImage(opts, deps) {
12433
12467
  validateInputOption(opts);
12434
12468
  const inputTarget = await validateInputImage2(deps, inputImage);
12435
12469
  const manifestPath = `${outPath}.json`;
12436
- await requireWritableOutput2(deps, outPath, manifestPath, opts.force === true);
12470
+ await requireWritableOutput2(deps, outPath, manifestPath, opts.force === true, opts.dryRun === true);
12437
12471
  const input = buildInput(prompt, opts, planInputImageUrl2(inputTarget));
12438
12472
  const cost = await buildGenerateImageCost({ model, input, inputTarget, deps });
12439
12473
  return {
@@ -14763,18 +14797,16 @@ function requireMatchingDimensions(args) {
14763
14797
  }
14764
14798
  return result;
14765
14799
  }
14766
- async function requireWritablePath3(path, label, force, deps) {
14767
- const status = await deps.pathStatus(path);
14768
- if (status === "directory") {
14769
- throw new RemoveBackgroundFalError(`${label} is a directory: ${path}. Pass a file path.`);
14770
- }
14771
- if (status === "file" && !force) {
14772
- throw new RemoveBackgroundFalError(`${label} already exists: ${path}. Pass --force to overwrite.`);
14773
- }
14800
+ async function requireWritablePaths3(deps, targets, force) {
14801
+ const message = await findUnwritablePathMessage(deps, targets, force);
14802
+ if (message !== null)
14803
+ throw new RemoveBackgroundFalError(message);
14774
14804
  }
14775
14805
  async function requireWritableOutputs(outPath, manifestPath, force, deps) {
14776
- await requireWritablePath3(outPath, "--out", force, deps);
14777
- await requireWritablePath3(manifestPath, "Manifest", force, deps);
14806
+ await requireWritablePaths3(deps, [
14807
+ { path: outPath, label: "--out" },
14808
+ { path: manifestPath, label: "Manifest" }
14809
+ ], force);
14778
14810
  }
14779
14811
  function manifestSaveMessage(err2, requestId, outPath, manifestPath) {
14780
14812
  const detail = err2 instanceof Error ? err2.message : String(err2);
@@ -33111,7 +33143,7 @@ var init_reliability = __esm(() => {
33111
33143
  // ../shared/src/domain/team-kind.ts
33112
33144
  var TEAM_PRESET_IDS;
33113
33145
  var init_team_kind = __esm(() => {
33114
- TEAM_PRESET_IDS = ["duo", "solo"];
33146
+ TEAM_PRESET_IDS = ["duo", "solo", "trio"];
33115
33147
  });
33116
33148
 
33117
33149
  // ../shared/src/domain/agent-role.ts
@@ -33218,9 +33250,16 @@ var init_agent_role = __esm(() => {
33218
33250
  tags: ["permanent" /* Permanent */],
33219
33251
  teams: [{ teamId: "duo", order: 10 }]
33220
33252
  },
33253
+ coordinator: {
33254
+ tags: ["permanent" /* Permanent */],
33255
+ teams: [{ teamId: "trio", order: 10 }]
33256
+ },
33221
33257
  builder: {
33222
33258
  tags: ["permanent" /* Permanent */],
33223
- teams: [{ teamId: "duo", order: 50 }]
33259
+ teams: [
33260
+ { teamId: "duo", order: 50 },
33261
+ { teamId: "trio", order: 50 }
33262
+ ]
33224
33263
  },
33225
33264
  solo: {
33226
33265
  tags: ["permanent" /* Permanent */],
@@ -33230,41 +33269,58 @@ var init_agent_role = __esm(() => {
33230
33269
  tags: ["ephemeral" /* Ephemeral */],
33231
33270
  teams: [
33232
33271
  { teamId: "duo", order: 20 },
33233
- { teamId: "solo", order: 20 }
33272
+ { teamId: "solo", order: 20 },
33273
+ { teamId: "trio", order: 20 }
33234
33274
  ]
33235
33275
  },
33236
33276
  triage: {
33237
33277
  tags: ["ephemeral" /* Ephemeral */],
33238
33278
  teams: [
33239
33279
  { teamId: "duo", order: 30 },
33240
- { teamId: "solo", order: 30 }
33280
+ { teamId: "solo", order: 30 },
33281
+ { teamId: "trio", order: 30 }
33241
33282
  ]
33242
33283
  },
33243
33284
  "uiux-engineer": {
33244
33285
  tags: ["ephemeral" /* Ephemeral */],
33245
33286
  teams: [
33246
33287
  { teamId: "duo", order: 40 },
33247
- { teamId: "solo", order: 40 }
33288
+ { teamId: "solo", order: 40 },
33289
+ { teamId: "trio", order: 40 }
33248
33290
  ]
33249
33291
  },
33250
33292
  researcher: {
33251
33293
  tags: ["ephemeral" /* Ephemeral */],
33252
- teams: [{ teamId: "duo", order: 25 }]
33294
+ teams: [
33295
+ { teamId: "duo", order: 25 },
33296
+ { teamId: "trio", order: 25 }
33297
+ ]
33253
33298
  },
33254
33299
  verifier: {
33255
33300
  tags: ["ephemeral" /* Ephemeral */],
33256
33301
  teams: [
33257
33302
  { teamId: "duo", order: 45 },
33258
- { teamId: "solo", order: 45 }
33303
+ { teamId: "solo", order: 45 },
33304
+ { teamId: "trio", order: 45 }
33259
33305
  ]
33260
33306
  },
33261
33307
  reviewer: {
33262
33308
  tags: ["ephemeral" /* Ephemeral */],
33263
- teams: [{ teamId: "duo", order: 35 }]
33309
+ teams: [
33310
+ { teamId: "duo", order: 35 },
33311
+ { teamId: "trio", order: 35 }
33312
+ ]
33264
33313
  },
33265
33314
  "game-asset-designer": {
33266
33315
  tags: ["ephemeral" /* Ephemeral */],
33267
- teams: [{ teamId: "duo", order: 42 }]
33316
+ teams: [
33317
+ { teamId: "duo", order: 42 },
33318
+ { teamId: "trio", order: 42 }
33319
+ ]
33320
+ },
33321
+ specifier: {
33322
+ tags: ["permanent" /* Permanent */],
33323
+ teams: [{ teamId: "trio", order: 48 }]
33268
33324
  }
33269
33325
  };
33270
33326
  AGENT_ROLE_DEFINITIONS = Object.fromEntries(Object.entries(roleMetadata).map(([role, metadata]) => [role, { role, ...metadata }]));
@@ -48679,6 +48735,8 @@ var init_errorCodes = __esm(() => {
48679
48735
  EMPTY_PROMPT: "EMPTY_PROMPT",
48680
48736
  INVALID_SCHEDULE: "INVALID_SCHEDULE",
48681
48737
  LIFECYCLE_DISABLED: "LIFECYCLE_DISABLED",
48738
+ NOTHING_TO_UPDATE: "NOTHING_TO_UPDATE",
48739
+ SCHEDULE_FINISHED: "SCHEDULE_FINISHED",
48682
48740
  TITLE_REQUIRED: "TITLE_REQUIRED",
48683
48741
  TITLE_TOO_LONG: "TITLE_TOO_LONG",
48684
48742
  HARNESS_SESSION_ALREADY_ASSOCIATED: "HARNESS_SESSION_ALREADY_ASSOCIATED",
@@ -48694,6 +48752,18 @@ var init_errorCodes = __esm(() => {
48694
48752
  INVITE_INVALID: "INVITE_INVALID",
48695
48753
  INVITE_EMAIL_MISMATCH: "INVITE_EMAIL_MISMATCH",
48696
48754
  SIGNUP_DISABLED: "SIGNUP_DISABLED",
48755
+ FILE_ATTACHMENT_NOT_FOUND: "FILE_ATTACHMENT_NOT_FOUND",
48756
+ FILE_ATTACHMENT_INVALID_STATE: "FILE_ATTACHMENT_INVALID_STATE",
48757
+ FILE_ATTACHMENT_INVALID: "FILE_ATTACHMENT_INVALID",
48758
+ FILE_ATTACHMENT_TOO_LARGE: "FILE_ATTACHMENT_TOO_LARGE",
48759
+ FILE_ATTACHMENT_TYPE_NOT_ALLOWED: "FILE_ATTACHMENT_TYPE_NOT_ALLOWED",
48760
+ FILE_ATTACHMENT_INVALID_FILENAME: "FILE_ATTACHMENT_INVALID_FILENAME",
48761
+ FILE_ATTACHMENT_EXCEEDS_QUOTA: "FILE_ATTACHMENT_EXCEEDS_QUOTA",
48762
+ FILE_ATTACHMENT_LIMIT_EXCEEDED: "FILE_ATTACHMENT_LIMIT_EXCEEDED",
48763
+ FILE_ATTACHMENT_TOO_MANY_PENDING: "FILE_ATTACHMENT_TOO_MANY_PENDING",
48764
+ FILE_ATTACHMENTS_REQUIRE_USER_TARGET: "FILE_ATTACHMENTS_REQUIRE_USER_TARGET",
48765
+ FILE_UPLOADS_UNAVAILABLE: "FILE_UPLOADS_UNAVAILABLE",
48766
+ WEB_SESSION_REQUIRED: "WEB_SESSION_REQUIRED",
48697
48767
  CONFLICT: "CONFLICT"
48698
48768
  };
48699
48769
  FATAL_ERROR_CODES = [
@@ -48788,6 +48858,8 @@ var init_errorCodes = __esm(() => {
48788
48858
  BACKEND_ERROR_CODES.EMPTY_PROMPT,
48789
48859
  BACKEND_ERROR_CODES.INVALID_SCHEDULE,
48790
48860
  BACKEND_ERROR_CODES.LIFECYCLE_DISABLED,
48861
+ BACKEND_ERROR_CODES.NOTHING_TO_UPDATE,
48862
+ BACKEND_ERROR_CODES.SCHEDULE_FINISHED,
48791
48863
  BACKEND_ERROR_CODES.TITLE_REQUIRED,
48792
48864
  BACKEND_ERROR_CODES.TITLE_TOO_LONG,
48793
48865
  BACKEND_ERROR_CODES.HARNESS_SESSION_ALREADY_ASSOCIATED,
@@ -48818,7 +48890,19 @@ var init_errorCodes = __esm(() => {
48818
48890
  BACKEND_ERROR_CODES.HARNESS_SESSION_INVALID_AGENT,
48819
48891
  BACKEND_ERROR_CODES.HARNESS_SESSION_INVALID_PROMPT,
48820
48892
  BACKEND_ERROR_CODES.HARNESS_SESSION_CLOSED,
48821
- BACKEND_ERROR_CODES.HARNESS_SESSION_UNKNOWN_AGENT
48893
+ BACKEND_ERROR_CODES.HARNESS_SESSION_UNKNOWN_AGENT,
48894
+ BACKEND_ERROR_CODES.FILE_ATTACHMENT_NOT_FOUND,
48895
+ BACKEND_ERROR_CODES.FILE_ATTACHMENT_INVALID_STATE,
48896
+ BACKEND_ERROR_CODES.FILE_ATTACHMENT_INVALID,
48897
+ BACKEND_ERROR_CODES.FILE_ATTACHMENT_TOO_LARGE,
48898
+ BACKEND_ERROR_CODES.FILE_ATTACHMENT_TYPE_NOT_ALLOWED,
48899
+ BACKEND_ERROR_CODES.FILE_ATTACHMENT_INVALID_FILENAME,
48900
+ BACKEND_ERROR_CODES.FILE_ATTACHMENT_EXCEEDS_QUOTA,
48901
+ BACKEND_ERROR_CODES.FILE_ATTACHMENT_LIMIT_EXCEEDED,
48902
+ BACKEND_ERROR_CODES.FILE_ATTACHMENT_TOO_MANY_PENDING,
48903
+ BACKEND_ERROR_CODES.FILE_ATTACHMENTS_REQUIRE_USER_TARGET,
48904
+ BACKEND_ERROR_CODES.FILE_UPLOADS_UNAVAILABLE,
48905
+ BACKEND_ERROR_CODES.WEB_SESSION_REQUIRED
48822
48906
  ];
48823
48907
  });
48824
48908
 
@@ -49207,12 +49291,9 @@ class NativeTaskDeliveryQueue {
49207
49291
  var roleKey2 = (chatroomId, role) => `${chatroomId}:${role.toLowerCase()}`;
49208
49292
 
49209
49293
  // ../shared/src/domain/conversation-mode.ts
49210
- function legacyConversationMode(plannerEnhancerEnabled) {
49211
- return plannerEnhancerEnabled ? "code:enhanced" : "code";
49212
- }
49213
49294
  var CONVERSATION_MODES;
49214
49295
  var init_conversation_mode = __esm(() => {
49215
- CONVERSATION_MODES = ["chat", "code", "code:enhanced"];
49296
+ CONVERSATION_MODES = ["chat", "code"];
49216
49297
  });
49217
49298
 
49218
49299
  // ../shared/src/domain/task-envelope.ts
@@ -49288,7 +49369,7 @@ function deriveLegacyMode(input) {
49288
49369
  assertConversationMode(rawMode, "normalizeTaskEnvelope");
49289
49370
  return rawMode;
49290
49371
  }
49291
- return legacyConversationMode(input.plannerEnhancerEnabled);
49372
+ return "code";
49292
49373
  }
49293
49374
  function deriveLegacySession(startInNewSession) {
49294
49375
  return startInNewSession === true ? "new" : "continue";
@@ -49305,18 +49386,12 @@ function normalizeTaskEnvelope(input) {
49305
49386
  var TASK_ENVELOPE_VERSION = 1, HANDOFF_WORKFLOW_PRESETS, HANDOFF_WORKFLOW_PHASES, TASK_SESSION_POLICIES, MODE_DEFAULT_PRESET;
49306
49387
  var init_task_envelope = __esm(() => {
49307
49388
  init_conversation_mode();
49308
- HANDOFF_WORKFLOW_PRESETS = ["direct", "team", "enhanced-team"];
49309
- HANDOFF_WORKFLOW_PHASES = [
49310
- "entry",
49311
- "enhancement",
49312
- "implementation",
49313
- "delivery"
49314
- ];
49389
+ HANDOFF_WORKFLOW_PRESETS = ["direct", "team"];
49390
+ HANDOFF_WORKFLOW_PHASES = ["entry", "implementation", "delivery"];
49315
49391
  TASK_SESSION_POLICIES = ["continue", "new"];
49316
49392
  MODE_DEFAULT_PRESET = {
49317
49393
  chat: "direct",
49318
- code: "team",
49319
- "code:enhanced": "enhanced-team"
49394
+ code: "team"
49320
49395
  };
49321
49396
  });
49322
49397
 
@@ -72314,11 +72389,7 @@ var init_get_next_task = __esm(() => {
72314
72389
  // ../shared/src/domain/team-presets.ts
72315
72390
  function getTeamPresetId(teamId) {
72316
72391
  const normalized = teamId.trim().toLowerCase();
72317
- if (normalized === "duo" || normalized === TEAM_STRUCTURE_IDS.duo)
72318
- return "duo";
72319
- if (normalized === "solo" || normalized === TEAM_STRUCTURE_IDS.solo)
72320
- return "solo";
72321
- return;
72392
+ return TEAM_PRESET_IDS.find((id) => normalized === id || normalized === TEAM_STRUCTURE_IDS[id]);
72322
72393
  }
72323
72394
  function getTeamPreset(teamId) {
72324
72395
  const presetId = getTeamPresetId(teamId);
@@ -72334,7 +72405,8 @@ var init_team_presets = __esm(() => {
72334
72405
  init_team_kind();
72335
72406
  TEAM_STRUCTURE_IDS = {
72336
72407
  duo: "duo@1",
72337
- solo: "solo@1"
72408
+ solo: "solo@1",
72409
+ trio: "trio@1"
72338
72410
  };
72339
72411
  TEAM_PRESETS = {
72340
72412
  duo: {
@@ -72342,14 +72414,32 @@ var init_team_presets = __esm(() => {
72342
72414
  name: "Duo",
72343
72415
  description: "A planner and builder working as a pair, planner as coordinator, with optional ephemeral architect, researcher, triage, reviewer, uiux-engineer, game-asset-designer, and verifier roles",
72344
72416
  roles: getBuiltinRolesForTeam("duo"),
72345
- entryPoint: "planner"
72417
+ entryPoint: "planner",
72418
+ handoffGraph: "advisory",
72419
+ handoffSessionRules: []
72346
72420
  },
72347
72421
  solo: {
72348
72422
  structureId: TEAM_STRUCTURE_IDS.solo,
72349
72423
  name: "Solo",
72350
72424
  description: "A single agent working independently, with optional ephemeral architect, triage, uiux-engineer, and verifier roles",
72351
72425
  roles: getBuiltinRolesForTeam("solo"),
72352
- entryPoint: "solo"
72426
+ entryPoint: "solo",
72427
+ handoffGraph: "advisory",
72428
+ handoffSessionRules: []
72429
+ },
72430
+ trio: {
72431
+ structureId: TEAM_STRUCTURE_IDS.trio,
72432
+ name: "Trio",
72433
+ description: "A coordinator, specifier, and builder: the coordinator owns the user conversation and routes all work, the specifier turns plans into code-level builder briefs, with optional ephemeral architect, researcher, triage, reviewer, uiux-engineer, game-asset-designer, and verifier roles",
72434
+ roles: getBuiltinRolesForTeam("trio"),
72435
+ entryPoint: "coordinator",
72436
+ handoffGraph: "enforced",
72437
+ handoffSessionRules: [
72438
+ { from: "coordinator", to: "specifier", sessionPolicy: "new" },
72439
+ { from: "builder", to: "specifier", sessionPolicy: "continue" },
72440
+ { from: "specifier", to: "builder", sessionPolicy: "new" },
72441
+ { from: "*", to: "coordinator", sessionPolicy: "continue" }
72442
+ ]
72353
72443
  }
72354
72444
  };
72355
72445
  });
@@ -72596,7 +72686,7 @@ function unknownModeMessage(mode) {
72596
72686
  }
72597
72687
  function legacyRoleFlagsMessage(command, input) {
72598
72688
  const header = `handoff ${command} no longer accepts --role/--next-role. Handoff templates are keyed by the (sender, recipient) pair.`;
72599
- const modeArg = input.mode ?? "<chat|code|code:enhanced>";
72689
+ const modeArg = input.mode ?? "<chat|code>";
72600
72690
  if (input.legacyRole !== undefined && input.legacyNextRole !== undefined) {
72601
72691
  return [
72602
72692
  header,
@@ -72693,7 +72783,9 @@ function getArchitectRequirements() {
72693
72783
  - Analyze concurrency and races: concurrent writers, idempotency, ordering and monotonicity, retries, transactions, and failure/recovery behavior.
72694
72784
  - Design read patterns first: primary read paths, indexes, projections/read models, query shapes, scan and transaction limits, and invalidation/subscription scope.
72695
72785
  - Account for Convex reactivity and bandwidth: query invalidation patterns, avoiding unnecessary reactive fanout, and separating high-frequency heartbeat/liveness/status fields from low-frequency identity/configuration fields.
72696
- - Specify concrete schema, query, and mutation changes; migration/backfill sequence; tests; and verification order.`;
72786
+ - Specify concrete schema, query, and mutation changes; migration/backfill sequence; tests; and verification order.
72787
+ - Make every new or changed interface complete: list each method or field with its callers, its inputs and outputs, and the failure modes it must signal to those callers. An interface with an unnamed caller or an unspecified failure mode is incomplete.
72788
+ - Apply the deletion test to every new module, class, or abstraction: name what complexity would reappear across its callers if it were deleted. A module that fails the test (its callers would be no more complex without it) must be removed from the design.`;
72697
72789
  }
72698
72790
  function getEntryPointToArchitectHandoffTemplate(query) {
72699
72791
  const entryPoint = query.fromRole;
@@ -72701,7 +72793,7 @@ function getEntryPointToArchitectHandoffTemplate(query) {
72701
72793
 
72702
72794
  Use this before any backend contract, API, or schema/persistence change.
72703
72795
 
72704
- Provide the request, relevant constraints, and the files or product surfaces that need inspection. Ask for one evidence-backed design focused on ${getArchitectFocus()}.
72796
+ Provide the request, relevant constraints, and the files or product surfaces that need inspection. Name any prior decision in \`memory/\` or \`docs/\` the design must respect, and name the known test constraints (for example, an existing fake, or a rule that tests run against a real database). Ask for one evidence-backed design focused on ${getArchitectFocus()}.
72705
72797
 
72706
72798
  After completing the design, the \`architect\` must hand it back to \`${entryPoint}\` with the normal handoff command, then stop; it must not implement the design or delegate further work.
72707
72799
 
@@ -72729,6 +72821,8 @@ function getArchitectToEntryPointHandoffTemplate(query) {
72729
72821
  <cite the inspected repository patterns and complete the architect checklist below; do not provide a high-level essay>
72730
72822
  - Produce exactly one recommended design for ${getArchitectFocus()}.
72731
72823
  - Name concrete repository paths, existing abstractions, APIs/types, state/data flow, acceptance criteria, risks, and verification steps.
72824
+ - Name every seam the design introduces. A test seam is the public interface where a test observes behavior. Substitution in a test is allowed only at a port or adapter boundary (an external dependency injected through a port). Do not mock internal collaborators. Each seam must have a named consumer: a test that substitutes it, or a second real adapter. Do not introduce a seam with neither.
72825
+ - Check \`memory/\` and \`docs/\` for prior decisions about the area being designed. Cite each relevant decision by path and state whether the design preserves it or overturns it, with the reason. Verify each path exists with \`ls\` before citing it.
72732
72826
  ${getArchitectRequirements()}
72733
72827
 
72734
72828
  ## Force Multipliers
@@ -72958,12 +73052,13 @@ var init_architect = __esm(() => {
72958
73052
  var CODE_CHANGE_VERIFICATION_CONFIRMATION = "- [ ] I confirm that I have run typecheck and tests for the project (only required if code changes were made)";
72959
73053
 
72960
73054
  // ../../services/backend/prompts/utils/delegation-disclosure.ts
72961
- function getDelegationBriefDisclosureComment() {
72962
- return `<!-- Reference the ## Goal and ## Requirements (acceptance criteria) sections from the planner handoff you received. State the delegation goal and confirm it was achieved. -->`;
73055
+ function getDelegationBriefDisclosureComment(briefSourceRole) {
73056
+ return `<!-- Reference the ## Goal and ## Requirements (acceptance criteria) sections from the ${briefSourceRole} handoff you received. State the delegation goal and confirm it was achieved. -->`;
72963
73057
  }
72964
- function getDelegationBriefDisclosureBlock() {
73058
+ function getDelegationBriefDisclosureBlock(options) {
73059
+ const { briefSourceRole } = options;
72965
73060
  return `${DELEGATION_BRIEF_DISCLOSURE_CHECKBOX}
72966
- ${getDelegationBriefDisclosureComment()}`;
73061
+ ${getDelegationBriefDisclosureComment(briefSourceRole)}`;
72967
73062
  }
72968
73063
  var DELEGATION_BRIEF_DISCLOSURE_CHECKBOX = "- [ ] I confirm the delegation brief is fully met: all (Required) files done, verified end-to-end, acceptance criteria pass";
72969
73064
 
@@ -73054,8 +73149,16 @@ ${getRoleGuidanceDisclosureComment(params)}`;
73054
73149
  var ROLE_GUIDANCE_DISCLOSURE_CHECKBOX = "- [ ] I confirm that I've read and followed the role guidance before starting any work";
73055
73150
  var init_role_guidance_disclosure = () => {};
73056
73151
 
73057
- // ../../services/backend/prompts/teams/duo/handoff-templates/builder-planner-code.ts
73058
- function getBuilderPlannerCodeBody(roleGuidanceContext) {
73152
+ // ../../services/backend/prompts/teams/builder-handback-handoff-templates.ts
73153
+ function getBuilderHandbackTemplate(query) {
73154
+ const recipientRole = query.toRole;
73155
+ return getBuilderHandbackBody({
73156
+ chatroomId: query.chatroomId,
73157
+ role: query.role,
73158
+ cliEnvPrefix: query.cliEnvPrefix
73159
+ }, recipientRole);
73160
+ }
73161
+ function getBuilderHandbackBody(roleGuidanceContext, recipientRole) {
73059
73162
  return `${getHandoffReportTemplateIntro()}
73060
73163
 
73061
73164
  \`\`\`markdown
@@ -73069,32 +73172,33 @@ ${getRoleGuidanceDisclosureBlock(roleGuidanceContext)}
73069
73172
  ${getHandoffQualityPrinciplesSectionBlock()}
73070
73173
 
73071
73174
  ## Proof of Completion
73072
- ${getDelegationBriefDisclosureBlock()}
73175
+ ${getDelegationBriefDisclosureBlock({ briefSourceRole: recipientRole })}
73073
73176
  ${getFileReferenceProofOfCompletionExample()}
73074
- <evidence the goal was met — list every file you modified>
73177
+ <evidence the goal was met — list every file you modified; for each behavior the brief's \`## Test seams\` section names a seam for: the test name, the seam it calls, the failure output observed before the implementation, and the passing output after>
73075
73178
 
73076
73179
  ## Code Change Verification
73077
73180
  ${CODE_CHANGE_VERIFICATION_CONFIRMATION}
73078
73181
 
73079
73182
  ## Blockers / questions
73080
73183
  ${getHandoffNotApplicableSectionComment("List blockers")}
73081
- <anything needing planner decision>
73184
+ <anything needing ${recipientRole} decision>
73082
73185
 
73083
73186
  ## Notes for review
73084
73187
  ${getHandoffNotApplicableSectionComment("List review notes")}
73085
- <specific areas for planner to check>
73188
+ <specific areas for ${recipientRole} to check; any test written at a seam other than the one the brief's \`## Test seams\` section named, and why>
73086
73189
  \`\`\``;
73087
73190
  }
73191
+ var init_builder_handback_handoff_templates = __esm(() => {
73192
+ init_handoff_quality_principles();
73193
+ init_role_guidance_disclosure();
73194
+ });
73195
+
73196
+ // ../../services/backend/prompts/teams/duo/handoff-templates/builder-planner-code.ts
73088
73197
  function getBuilderPlannerCodeTemplate(query) {
73089
- return getBuilderPlannerCodeBody({
73090
- chatroomId: query.chatroomId,
73091
- role: query.role,
73092
- cliEnvPrefix: query.cliEnvPrefix
73093
- });
73198
+ return getBuilderHandbackTemplate(query);
73094
73199
  }
73095
73200
  var init_builder_planner_code = __esm(() => {
73096
- init_handoff_quality_principles();
73097
- init_role_guidance_disclosure();
73201
+ init_builder_handback_handoff_templates();
73098
73202
  });
73099
73203
 
73100
73204
  // ../../services/backend/prompts/teams/duo/handoff-templates/builder-planner-chat.ts
@@ -73143,35 +73247,30 @@ function formatProofOfPrinciples() {
73143
73247
  var GAME_ASSET_RULES;
73144
73248
  var init_game_asset_designer_workflow = __esm(() => {
73145
73249
  GAME_ASSET_RULES = [
73146
- "Generate 2D assets only with `chatroom generate-image --platform=fal --model <Model>`, where <Model> is the brief's Model: `fal-ai/flux-2/flash` (FLUX 2 Flash), or `fal-ai/flux-2/flash/edit` with --input-image for reference edits. Generate a 3D model only with `chatroom generate-3d --platform=fal --model <Model>`, where <Model> is the brief's Model and is a fal 3D model id (`chatroom generate-3d --help` lists the known ids and their flags); the default is `fal-ai/trellis-2`, where a prompt generates a reference image first and that image ships in the zip. Pass --rig and --animation-action-id only for `meshy/v7.1` models, only when the brief asks for them, and only after the user confirms the priced dry run (a real run needs --confirm-cost). Pass --confirm-cost only when ## Cost confirmation quotes the user's approval; otherwise run --dry-run, return the priced plan, and do not pass --confirm-cost. A 3D run writes `<base>.zip` (`<stem>.glb`, `web/<stem>.web.glb`, `manifest.json`, the reference image when one was generated or supplied, and the rigged and animation GLBs with their web versions when rigging ran) and `<base>.html`, a separate preview of the web variant; `<base>` is the `--out` stem plus the run's UTC timestamp, and `--package-dir <dir>` (default: the master's directory) moves both.",
73147
- "Process images only with `chatroom slice-image` and `chatroom remove-image-background`; no other tool, script, or remote service.",
73148
- "A sheet is at most the brief's `Sheet grid` (default 2x2); a larger grid needs a user request quoted in the brief.",
73149
- "Names come from looking at each tile, never from cell order or prompt order.",
73150
- "Never pass `--names` to `slice-image` except P8's fallback when `remove-image-background --help` fails; assign names only with `remove-image-background --map` or `--out`.",
73151
73250
  "Write only under `Output location` and `Allowed edit paths`; never overwrite or delete unless the brief names the path.",
73152
73251
  "Mark `pass` or `fail` only with `measured` or `inspected` evidence (labels below).",
73153
- "Run `<command> --help` before first use of `slice-image`, `remove-image-background`, or `generate-3d`.",
73154
- "Always pass `--trim` to `chatroom remove-image-background`; use `--trim-padding` only when the brief names a padding.",
73155
- "If `generate-image` or `generate-3d` is missing, `FAL_API_KEY` is not set, or the generator fails, stop generation, deliver `spec only`, quote the exact error in Summary, and list it under Open questions. Do not retry in a loop.",
73252
+ "If the generator is missing, `FAL_API_KEY` is not set, or generation fails, stop generation, deliver `spec only`, quote the exact error in Summary, and list it under Open questions. Do not retry in a loop.",
73156
73253
  "Do not install or run any remote tool, script, or skill, and do not fetch generator code.",
73157
73254
  "Never switch generators.",
73158
73255
  "Describe generated output as production-ready only when every checklist item for it passes with `measured` or `inspected` evidence.",
73159
73256
  "Commit only when the brief names the paths and the commit message.",
73160
73257
  "Generate only when the brief names an output location and allowed tools.",
73161
- "Before the first real call of each command shape (sheet, per-asset, reference edit, or 3D model), run the same command with --dry-run and apply every constraint it prints; take model-specific constraints only from the dry run, never from memory."
73258
+ "You own the lighting and palette anchor for the asset set: from the brief's `## Lighting contract` and `## Style reference`, define one shared anchor (palette, light direction, colour temperature, background, material treatment) and repeat it word for word in every prompt of the set. Write every prompt yourself; the brief states goals and constraints, not prompts.",
73259
+ 'Honour the `## Lighting contract`: no lighting may be baked into the base colour. If the generator\'s whole-surface metal warning (named in `game-asset-3d-ai`) remains after one regeneration, or any other material warning remains, report it under Open questions. The **rig reference render** is "the existing render of the target rig, attached by path under `## Lighting contract`, used as a style target before generation. It is input only and cannot support `pass`."',
73260
+ "Verify lighting under the target conditions, not the generator's. A `pass` also needs an **asset-in-rig render**: \"a render of the generated asset loaded in the project's real scene after generation, attached by path under `## Lighting verification`. Only this render supports `pass`.\" Producing it is never your job. Without it the lighting checklist item is `not checked`, which blocks delivery (the Summary starts `Delivered, lighting not verified:`). The lighting item is `n/a` when the brief's `## Lighting contract` is `Not applicable.`"
73162
73261
  ];
73163
73262
  });
73164
73263
 
73165
73264
  // ../../services/backend/prompts/teams/game-asset-designer-handoff-templates.ts
73166
73265
  function getEntryPointToGameAssetDesignerHandoffTemplate(query) {
73167
73266
  const entryPoint = query.fromRole;
73168
- return `Instructions (not part of the message): Pass the asset request as a brief the designer can act on without guessing. Provide every field below; write \`Not specified.\` for a field you cannot fill and the designer will ask or apply a stated default. Give each asset a stable ID (\`A01\`, \`A02\`…). Use \`spec only\` only when you want a specification with no files; the default is \`spec and generate\`. The \`## Allowed tools\` value is fixed: \`chatroom generate-image --platform=fal --model <Model> (dry run first), chatroom generate-3d --platform=fal --model <Model> (dry run first), chatroom slice-image, chatroom remove-image-background\`. Do not name any other generator; for a 3D model also fill \`## Output paths\`, whose \`--package-dir\` stays on the \`generate-3d\` entry. Before generating anything, the designer evaluates each \`## Free asset candidates\` entry and records a \`use\`, \`adapt\`, or \`reject\` decision; it generates only the assets that no candidate covers.
73267
+ return `Instructions (not part of the message): Pass the asset request as a brief the designer can act on without guessing. Provide every field below; write \`Not specified.\` for a field you cannot fill and the designer will ask or apply a stated default, except \`## Lighting contract\`, which is required for a brief with any 3D asset and may be \`Not applicable.\` only when the brief has only 2D or audio assets. Pass goals and constraints as an open problem: do not author prompts, material treatment, style, or lighting art direction; the designer proposes the palette, lighting anchor, and prompts. Give each asset a stable ID (\`A01\`, \`A02\`…). Use \`spec only\` only when you want a specification with no files; the default is \`spec and generate\`. In \`## Allowed tools\`, keep the fixed line for each domain the brief contains and delete the others; name no other tool or generator. See the matching skill for how each tool is used. For a 3D model generated with AI also fill \`## Output paths\`; a procedural asset uses \`## Output location\` and the brief's allowed edit paths instead. Before generating anything, the designer evaluates each \`## Free asset candidates\` entry and records a \`use\`, \`adapt\`, or \`reject\` decision; it generates only the assets that no candidate covers. For a verification-only lighting brief, name the existing generated asset paths and the asset-in-rig render under \`## Existing assets\`; the designer applies only the lighting checklist item and does not generate, slice, or package.
73169
73268
 
73170
73269
  ## Asset request
73171
73270
  <one to three sentences: what the assets are for and the user-visible goal>
73172
73271
 
73173
73272
  ## Target
73174
- <engine and version; genre and camera; platform tier (mobile, PC, console, VR); render pipeline if known>
73273
+ <engine and version; genre and camera; platform tier (mobile, PC, console, VR); render pipeline (renderer, tone mapping) if known; lighting goes in the Lighting contract>
73175
73274
 
73176
73275
  ## Assets requested
73177
73276
  <numbered list with stable IDs \`A01\`, \`A02\`…; each item: asset name, category (3D model, PBR textures, 2D sprite/UI, audio, other), purpose, quantity or variants>
@@ -73182,26 +73281,29 @@ function getEntryPointToGameAssetDesignerHandoffTemplate(query) {
73182
73281
  ## Style reference
73183
73282
  <repository paths, URLs, or a written style sheet; or \`Not specified.\`>
73184
73283
 
73284
+ ## Lighting contract
73285
+ <required for a brief with any 3D asset; \`Not specified.\` is not allowed, and \`Not applicable.\` is only for a brief with only 2D or audio assets. State the goal ("consistent with the game's rig and palette") plus the rig facts the repo defines: lighting model (image-based / directional / unlit / toon); environment map present or absent; metalness policy; exposure and tone mapping; colour space; shadow setup; the repository paths that define the rig; and a **rig reference render** path (required for a 3D asset; the designer cannot produce it): "the existing render of the target rig, attached by path under \`## Lighting contract\`, used as a style target before generation. It is input only and cannot support \`pass\`." The **asset-in-rig render** is "a render of the generated asset loaded in the project's real scene after generation, attached by path under \`## Lighting verification\`. Only this render supports \`pass\`." If you do not know a fact write \`Unknown: designer to read <path>\`. Do not write prompts, material treatment, or art direction; the designer owns those.>
73286
+
73185
73287
  ## Perspective
73186
- <one camera perspective shared by every asset in the set, for example \`orthographic front view\`, \`orthographic isometric\`, \`dimetric 2:1\`, or \`side view\`; optionally \`reference: <repository path>\` of an existing asset to match (requires \`## Model\` = \`fal-ai/flux-2/flash/edit\`); a reference makes every asset an individual edit, with no sheets; \`Not Applicable.\` for 3D models and audio; or \`Not specified.\`>
73288
+ <one camera perspective shared by every asset in the set, for example \`orthographic front view\`, \`orthographic isometric\`, \`dimetric 2:1\`, or \`side view\`; optionally \`reference: <repository path>\` of an existing asset to match. A reference constrains \`## Model\` to a reference-edit model, and every asset is then generated individually; the matching skill states which. \`Not Applicable.\` for 3D models and audio; or \`Not specified.\`>
73187
73289
 
73188
73290
  ## Model
73189
- <for a 2D asset: \`fal-ai/flux-2/flash\` (FLUX 2 Flash), passed as --model; \`fal-ai/flux-2/flash/edit\` only when \`## Perspective\` names a reference asset. For a 3D model: one fal 3D model id; \`chatroom generate-3d --help\` lists the known ids and the flags each takes>
73291
+ <for a 2D asset: \`fal-ai/flux-2/flash\` (FLUX 2 Flash), passed as --model; \`fal-ai/flux-2/flash/edit\` only when \`## Perspective\` names a reference asset. For a 3D asset generated with AI: one fal 3D model id; \`chatroom generate-3d --help\` lists the known ids and the flags each takes. For a procedural 3D asset: \`procedural: <generator script path>\`. For a mixed brief, give one line per domain prefixed \`AI 2D:\` / \`AI 3D:\` / \`Procedural 3D:\`, matching the Allowed tools prefixes.>
73190
73292
 
73191
73293
  ## Model parameters
73192
- <a JSON object as text passed to \`generate-image --input\`, or to \`generate-3d --input\` for a 3D model; one object for every call of a set; its keys must pass the model's --dry-run check; \`Not specified.\` if none>
73294
+ <a JSON object of model parameters, one object for every call of a set; its keys must pass the model's parameter check. For a mixed brief, give one line per domain prefixed \`AI 2D:\` / \`AI 3D:\` / \`Procedural 3D:\`, matching the Allowed tools prefixes. \`Not specified.\` if none. \`Not applicable.\` for a procedural asset (its parameters live in the config file named in \`## Allowed edit paths\`).>
73193
73295
 
73194
73296
  ## Cost confirmation
73195
- <the user's quoted approval of the priced dry run, with the estimate it approved; or Not confirmed.>
73297
+ <the user's quoted approval of the priced generation plan, with the estimate it approved; or Not confirmed. \`Not applicable.\` for a procedural asset (no fal cost).>
73196
73298
 
73197
73299
  ## Output paths
73198
- <for a 3D model: the \`--out\` path, whose file name becomes the package base \`<out-stem>-<timestamp>\`, and the optional \`--package-dir\` directory (default: the master's directory). The run writes \`<base>.zip\` (\`<stem>.glb\`, \`web/<stem>.web.glb\`, \`manifest.json\`) and \`<base>.html\`, a separate preview of the web variant, beside the master or in that directory. \`Not Applicable.\` for a 2D-only request>
73300
+ <for a 3D model generated with AI: the \`--out\` path and the optional \`--package-dir\`; the run writes the package beside the master, and the matching skill names the files. \`Not Applicable.\` for a 2D-only request and for a procedural asset: its export path comes from \`## Output location\`, and its script, config, and output are named in \`## Allowed edit paths\`.>
73199
73301
 
73200
73302
  ## Spec consumer
73201
73303
  <who integrates these assets from the spec: \`builder\` (application logic outside the allowed edit paths) or \`user\`; asset files themselves are generated only by \`game-asset-designer\`>
73202
73304
 
73203
73305
  ## Existing assets
73204
- <repository paths the designer must reuse or must not overwrite; or \`Not specified.\`>
73306
+ <repository paths the designer must reuse or must not overwrite; for a verification-only lighting brief, the existing generated asset paths and the asset-in-rig render path; or \`Not specified.\`>
73205
73307
 
73206
73308
  ## Free asset candidates
73207
73309
  <one entry per third-party pack to evaluate before generating: pack name, source URL, expected licence (for example CC0), formats, and the asset IDs it could cover; or \`None.\`. The designer checks each pack's own licence file and file sizes and gives each candidate a \`use\`, \`adapt\`, or \`reject\` decision. It fetches only the URLs named here, inspects the pack as static files, and never runs its code.>
@@ -73210,7 +73312,10 @@ function getEntryPointToGameAssetDesignerHandoffTemplate(query) {
73210
73312
  <\`spec and generate\` (default when you name an output location and allowed tools) or \`spec only\`>
73211
73313
 
73212
73314
  ## Allowed tools
73213
- \`chatroom generate-image --platform=fal --model <Model> (dry run first), chatroom generate-3d --platform=fal --model <Model> (dry run first), chatroom slice-image, chatroom remove-image-background\`
73315
+ <keep the line for each domain the brief contains and delete the others; \`None.\` for \`spec only\`.
73316
+ AI 2D: \`chatroom generate-image --platform=fal --model <Model> (dry run first), chatroom slice-image, chatroom remove-image-background\`
73317
+ AI 3D: \`chatroom generate-3d --platform=fal --model <Model> (dry run first), gltf-transform inspect\`
73318
+ Procedural 3D: \`<generator script path> <run command>, git rev-parse HEAD, gltf-transform inspect\`>
73214
73319
 
73215
73320
  ## Allowed edit paths
73216
73321
  <repository-relative paths the designer may edit; \`None.\` for none>
@@ -73232,7 +73337,7 @@ ${formatProofOfPrinciples()}
73232
73337
  ## Proof of Completion
73233
73338
  - [ ] <one checkbox per acceptance criterion; state the evidence label required (measured or inspected)>
73234
73339
 
73235
- Instructions after the body (not part of the message): the planner may append extra Proof of Principles lines if needed. Run the normal handoff command to \`game-asset-designer\` with the complete body above, then stop. Use this template only under the conditions below; the body above ends at \`## Proof of Completion\`.
73340
+ Instructions after the body (not part of the message): the ${entryPoint} may append extra Proof of Principles lines if needed. Run the normal handoff command to \`game-asset-designer\` with the complete body above, then stop. Use this template only under the conditions below; the body above ends at \`## Proof of Completion\`.
73236
73341
 
73237
73342
  ### When to use the game asset designer
73238
73343
  - the request creates or changes any asset file: game art or audio (models, textures, sprites, UI art, sound effects), or non-game UI icons and illustrations;
@@ -73252,29 +73357,31 @@ ${handoffCommand({
73252
73357
  }
73253
73358
  function getGameAssetDesignerToEntryPointHandoffTemplate(query) {
73254
73359
  const entryPoint = query.toRole;
73255
- return `Instructions (not part of the message): Return a complete asset delivery report for the request the planner named. Label every checked property with one evidence label: ${GAME_ASSET_EVIDENCE_LABEL_LIST}. Definitions: ${GAME_ASSET_EVIDENCE_DEFINITIONS} ${GAME_ASSET_NEVER_CLAIM_RULE} ${GAME_ASSET_RESULT_RULE} Write only under the named output location and the named edit paths. In \`spec only\` you write no files. If you are blocked, send the same sections with Summary starting \`Blocked:\` and every section you could not reach written as \`Not started.\`
73360
+ return `Instructions (not part of the message): Return a complete asset delivery report for the request the ${entryPoint} named. Label every checked property with one evidence label: ${GAME_ASSET_EVIDENCE_LABEL_LIST}. Definitions: ${GAME_ASSET_EVIDENCE_DEFINITIONS} ${GAME_ASSET_NEVER_CLAIM_RULE} ${GAME_ASSET_RESULT_RULE} Write only under the named output location and the named edit paths. In \`spec only\` you write no files. If you are blocked, send the same sections with Summary starting \`Blocked:\` and every section you could not reach written as \`Not started.\`
73256
73361
 
73257
73362
  ## Summary
73258
73363
  <one to three sentences: what was delivered, whether it is spec only or includes files, and the count of \`fail\` and \`not checked\` items>
73259
73364
 
73260
73365
  ## Proof of Principles
73261
73366
  ${PROOF_OF_PRINCIPLES_REPORT}
73367
+ - [ ] <append the domain Proof of Principles lines the matching skill lists, one per line>
73262
73368
 
73263
73369
  ## Proof of Completion
73264
73370
  - [ ] <one checkbox per brief acceptance criterion; state the evidence label required (measured or inspected)>
73265
73371
  - [ ] Every asset ID has a file or \`Specified only.\`
73266
- - [ ] Every sliced asset was isolated with \`remove-image-background\` and \`inspected\`.
73372
+ - [ ] Every sheet-derived asset was isolated and \`inspected\`.
73267
73373
  - [ ] Manifests are listed in the asset manifest.
73374
+ - [ ] Lighting verified under the brief's Lighting contract with an **asset-in-rig render**: "a render of the generated asset loaded in the project's real scene after generation, attached by path under \`## Lighting verification\`. Only this render supports \`pass\`." The **rig reference render** is "the existing render of the target rig, attached by path under \`## Lighting contract\`, used as a style target before generation. It is input only and cannot support \`pass\`."; otherwise the Summary starts \`Delivered, lighting not verified:\`.
73268
73375
  - [ ] Every candidate in the brief has a decision with its licence and file sizes labelled \`inspected\`.
73269
73376
 
73270
73377
  ## Target and assumptions
73271
- <each assumption you made and why; each deviation from the planner's target or budgets; or \`None.\`>
73378
+ <each assumption you made and why; each deviation from the ${entryPoint}'s target or budgets; or \`None.\`>
73272
73379
 
73273
73380
  ## Free asset decisions
73274
73381
  <one entry per candidate in the brief: pack name, licence quoted from the pack's own licence file, file sizes checked, decision (\`use\`, \`adapt\`, or \`reject\`), asset IDs covered, and the reason; for \`adapt\`, the edits made; write exactly \`None.\` if the brief named no candidates>
73275
73382
 
73276
73383
  ## Asset manifest
73277
- <one entry per asset, keyed by the planner's stable ID (\`A01\`…): name, category, file format, path (or \`Specified only.\`), dimensions/units/scale, pivot, naming, LOD list with triangle budgets, texture set with resolution, color space and channel packing, atlas/pixel grid/frame data, audio format and loudness target, import settings, dependencies and variants; for each budget, the acceptance check (exact command and expected value); for each generated file, the generator command line (\`chatroom generate-image\` with its \`--platform\`, \`--model\`, \`--seed\`, \`--input\`, and \`--input-image\` values, or \`chatroom generate-3d\` with its \`--platform\`, \`--model\`, \`--prompt\`/\`--input-image\`, \`--input\`, \`--rig\`, and \`--animation-action-id\` values), the sheet and tile manifests, and the isolated asset manifest path>
73384
+ <one entry per asset, keyed by the ${entryPoint}'s stable ID (\`A01\`…): name, category, file format, path (or \`Specified only.\`), dimensions/units/scale, pivot, naming, LOD list with triangle budgets, texture set with resolution, color space and channel packing, atlas/pixel grid/frame data, audio format and loudness target, import settings, dependencies and variants; for each budget, the acceptance check (exact command and expected value); for each generated file, the command line the matching skill requires (model, seed, parameters, and any generator-specific flags), the sheet and tile manifests, and the isolated asset manifest path>
73278
73385
 
73279
73386
  ## Quality checklist results
73280
73387
  <per asset: each applicable checklist item as \`pass\`, \`fail\`, \`n/a\`, or \`not checked\`, with its evidence label and, for \`measured\`, the command and value; write exactly \`None failed.\` after the list if no item failed>
@@ -73282,6 +73389,9 @@ ${PROOF_OF_PRINCIPLES_REPORT}
73282
73389
  ## Style consistency
73283
73390
  <how the set matches the style reference; deviations; what was compared and how>
73284
73391
 
73392
+ ## Lighting verification
73393
+ <per 3D asset: the lighting contract you applied; the shared palette/lighting anchor you used; an **asset-in-rig render**: "a render of the generated asset loaded in the project's real scene after generation, attached by path under \`## Lighting verification\`. Only this render supports \`pass\`."; the **rig reference render** path: "the existing render of the target rig, attached by path under \`## Lighting contract\`, used as a style target before generation. It is input only and cannot support \`pass\`."; result \`pass\`, \`fail\`, or \`not checked\` with its evidence label. For an AI-generated 3D asset also record the preview inspection marked \`not checked\` with the reason "no allowed capture tool" (no allowed tool captures Directional or Unlit views; Studio is image-based lighting and is never evidence); a procedural asset has no preview. In a verification-only brief (existing asset paths and an asset-in-rig render named), apply only this lighting item to those files; do not regenerate, slice, or package. If any asset is \`not checked\`, the Summary must start \`Delivered, lighting not verified:\`. Write \`n/a\` for 2D-only or audio-only requests and for \`spec only\` deliverables (no asset is rendered).>
73394
+
73285
73395
  ## Naming map
73286
73396
  | cell stem | seen | assigned name | path | inspection note |
73287
73397
  | --- | --- | --- | --- | --- |
@@ -73298,13 +73408,13 @@ Write exactly \`None.\` if no sheet was used.
73298
73408
  <URLs for engine or platform rules relied on, with version or date checked>
73299
73409
 
73300
73410
  ## Open questions
73301
- <each clarification needed from the planner with a recommended default; write exactly \`None.\` if none>
73411
+ <each clarification needed from the ${entryPoint} with a recommended default; write exactly \`None.\` if none>
73302
73412
 
73303
73413
  ## Not verified
73304
73414
  <every property you could not measure or inspect; write exactly \`None.\` if none>
73305
73415
 
73306
73416
  ## Recommended next step
73307
- <exactly one target: \`game-asset-designer\` (re-run with the listed asset IDs), \`builder\` (application logic outside the allowed edit paths), \`uiux-engineer\` (layout, component, or styling changes only, never asset files), or \`planner\` (decision needed on an open question); then the affected asset IDs>
73417
+ <exactly one target: \`game-asset-designer\` (re-run with the listed asset IDs), \`builder\` (application logic outside the allowed edit paths), \`uiux-engineer\` (layout, component, or styling changes only, never asset files), or \`${entryPoint}\` (decision needed on an open question); then the affected asset IDs>
73308
73418
 
73309
73419
  Instructions after the body (not part of the message): run the normal handoff command to \`${entryPoint}\` with the complete body above, then stop.
73310
73420
 
@@ -73322,7 +73432,7 @@ var init_game_asset_designer_handoff_templates = __esm(() => {
73322
73432
  init_game_asset_designer_evidence();
73323
73433
  init_game_asset_designer_workflow();
73324
73434
  init_command2();
73325
- PROOF_OF_PRINCIPLES_REPORT = GAME_ASSET_RULES.map((rule) => `- [ ] ${rule} — <evidence: command lines, grid values, or naming map reference>`).join(`
73435
+ PROOF_OF_PRINCIPLES_REPORT = GAME_ASSET_RULES.map((rule) => `- [ ] ${rule} — <evidence: command lines and output values; grid values when a sheet was generated; naming map reference when names came from a mapping>`).join(`
73326
73436
  `);
73327
73437
  });
73328
73438
 
@@ -73371,18 +73481,24 @@ var init_planner_architect_chat = __esm(() => {
73371
73481
  init_planner_architect_code();
73372
73482
  });
73373
73483
 
73374
- // ../../services/backend/prompts/teams/duo/handoff-templates/planner-builder-code.ts
73375
- function getPlannerBuilderCodeBody() {
73376
- return `${getDelegationBriefIntro()}
73377
-
73378
- **Before you delegate:** if this slice introduces anything not yet grounded in the repository (a new library, API, external platform behavior, or an unresolved choice that depends on missing facts), hand off to \`researcher\` first and delegate only after its brief returns. Skip this when the \`researcher\` template's skip condition applies. The \`researcher\` handoff template defines the criteria.
73484
+ // ../../services/backend/prompts/teams/builder-delegation-handoff-templates.ts
73485
+ function getBuilderDelegationBriefTemplate(options) {
73486
+ const { delegatorRole, gatesOwner } = options;
73487
+ const prelude = gatesOwner === "self" ? `**Before you delegate:** if this slice introduces anything not yet grounded in the repository (a new library, API, external platform behavior, or an unresolved choice that depends on missing facts), hand off to \`researcher\` first and delegate only after its brief returns. Skip this when the \`researcher\` template's skip condition applies. The \`researcher\` handoff template defines the criteria.
73379
73488
 
73380
73489
  **Bug fixes:** if this slice fixes a reported bug, delegate only after a \`triage\` report for that bug has returned, and build the brief from its root cause and proposed fix. The \`triage\` handoff template defines the investigation.
73381
73490
 
73382
- **Division of labor:** For backend contract, API, or schema/persistence changes, the architect designs first and you delegate only after its design returns. You (planner) own slicing and sequencing of builder work. The UI/UX engineer owns UI/UX design. Include its target markup, classes, styles, and screen and flow drawings in UI implementation briefs; the builder implements the components.
73491
+ **Division of labor:** For backend contract, API, or schema/persistence changes, the architect designs first and you delegate only after its design returns. You (${delegatorRole}) own slicing and sequencing of builder work. The UI/UX engineer owns UI/UX design. Include its target markup, classes, styles, and screen and flow drawings in UI implementation briefs; the builder implements the components.` : `**Before you delegate:** the \`${gatesOwner}\` clears research, triage, architecture, UI/UX, and asset gates before work reaches you. If a slice depends on a fact, design decision, or bug diagnosis that the work package does not settle, hand back to \`${gatesOwner}\` with the open question instead of guessing. Do not hand off to \`researcher\`, \`triage\`, \`architect\`, or any other specialist yourself.
73492
+
73493
+ **Division of labor:** You (${delegatorRole}) own turning the work package into file-level builder slices and sequencing them. Copy any UI/UX target markup, classes, styles, and drawings from the work package into UI implementation briefs; the builder implements the components.`;
73494
+ return `${getDelegationBriefIntro()}
73495
+
73496
+ ${prelude}
73383
73497
 
73384
73498
  **Detail bar:** Specify down to **every file** the builder will create or modify (full repo paths). Include code snippets — types, signatures, stubs, or target implementations — until a competent builder **cannot misinterpret** what to write. Vague layers ("update the backend", "fix the component") are not acceptable.
73385
73499
 
73500
+ **Test seams:** Fill \`## Test seams\` in the brief body for each behavior the slice changes. See the \`test-seam\` glossary term for what a seam is.
73501
+
73386
73502
  Guidance for you (not part of the message): Keep one slice ≈ one focused review surface. Delegate slices incrementally — one at a time, not all at once.
73387
73503
 
73388
73504
  \`\`\`\`markdown
@@ -73420,7 +73536,7 @@ ${getFileReferenceGuidanceComment()}
73420
73536
 
73421
73537
  (Add one ### block per file. If this slice touches only one file, still use the ### header.)
73422
73538
 
73423
- ## Shared contracts (planner-owned)
73539
+ ## Shared contracts (${delegatorRole}-owned)
73424
73540
  Cross-file types, interfaces, or patterns that apply beyond a single file. Omit if everything is already specified per-file above.
73425
73541
 
73426
73542
  ### Interfaces & types
@@ -73437,8 +73553,15 @@ Cross-file types, interfaces, or patterns that apply beyond a single file. Omit
73437
73553
  - <verifiable outcome the builder can self-check>
73438
73554
  - Include at least one check that the feature is **verified end-to-end**. Unit tests alone are insufficient for new features.
73439
73555
 
73556
+ ## Test seams
73557
+ - <behavior>: seam <public interface or port>; catches <what>; misses <what>
73558
+ - or: no test seam — <reason>
73559
+ - For each named seam: write a failing test first, then make it pass (red-green). If the seam is \`no test seam\`, delete this line.
73560
+
73440
73561
  ## What to avoid
73441
73562
  - <anti-patterns, recurring mistakes, or scope creep for this slice — be explicit>
73563
+ - Do not test private methods or mock internal collaborators. A test that breaks on refactor while behavior is unchanged is wrong.
73564
+ - Do not derive expected values by re-running the code's own formula. Take them from a known-good literal, a worked example, or the spec.
73442
73565
  - <e.g. "Do not add new abstractions", "Do not refactor unrelated files", "Do not change existing public APIs">
73443
73566
 
73444
73567
  ## Skills to activate
@@ -73449,10 +73572,15 @@ Cross-file types, interfaces, or patterns that apply beyond a single file. Omit
73449
73572
 
73450
73573
  \`\`\`\``;
73451
73574
  }
73575
+ var init_builder_delegation_handoff_templates = () => {};
73576
+
73577
+ // ../../services/backend/prompts/teams/duo/handoff-templates/planner-builder-code.ts
73452
73578
  function getPlannerBuilderCodeTemplate(_query) {
73453
- return getPlannerBuilderCodeBody();
73579
+ return getBuilderDelegationBriefTemplate({ delegatorRole: "planner", gatesOwner: "self" });
73454
73580
  }
73455
- var init_planner_builder_code = () => {};
73581
+ var init_planner_builder_code = __esm(() => {
73582
+ init_builder_delegation_handoff_templates();
73583
+ });
73456
73584
 
73457
73585
  // ../../services/backend/prompts/teams/duo/handoff-templates/planner-builder-chat.ts
73458
73586
  var init_planner_builder_chat = __esm(() => {
@@ -73475,7 +73603,7 @@ var init_planner_game_asset_designer_chat = __esm(() => {
73475
73603
  // ../../services/backend/prompts/teams/researcher-handoff-templates.ts
73476
73604
  function getEntryPointToResearcherHandoffTemplate(query) {
73477
73605
  const entryPoint = query.fromRole;
73478
- return `The automatically injected \`<user-message>\` is the authoritative request. Pass the decisions the research must ground, the specific research questions, known constraints, and the files or areas already suspected. Ask the researcher for a report only: do not edit files, implement code, or design alternative architectures.
73606
+ return `The automatically injected \`<user-message>\` is the authoritative request. Pass the decisions the research must ground, the specific research questions, known constraints, and the files or areas already suspected. List the domain nouns the research must check for existing equivalents in the repository, and any source the researcher must prefer or avoid. Ask the researcher for a report only: do not edit files, implement code, or design alternative architectures.
73479
73607
 
73480
73608
  ### When to research
73481
73609
 
@@ -73500,7 +73628,7 @@ ${handoffCommand({
73500
73628
  }
73501
73629
  function getResearcherToEntryPointHandoffTemplate(query) {
73502
73630
  const entryPoint = query.toRole;
73503
- return `Instructions (not part of the message): Return a complete, evidence-backed research brief for the authoritative request. The researcher is advisory: do not edit files, implement code, or present alternative architectures beyond what grounds the decision. Answer only the questions asked. Separate every finding into confirmed (with evidence), inferred (with reasoning), or unknown. Never present a guess as fact. External claims must cite the source URL together with the version or date checked. Use the exact sections below, in this order.
73631
+ return `Instructions (not part of the message): Return a complete, evidence-backed research brief for the authoritative request. The researcher is advisory: do not edit files, implement code, or present alternative architectures beyond what grounds the decision. Answer only the questions asked. Separate every finding into confirmed (with evidence), inferred (with reasoning), or unknown. Never present a guess as fact. External claims must cite the source URL together with the version or date checked. Prefer official documentation and primary sources (the package's own source or changelog, the platform's release notes) over blog posts and summaries; if only a secondary source was found, label the claim as resting on it. Use the exact sections below, in this order.
73504
73632
 
73505
73633
  ## Summary
73506
73634
  <state the answer to the core question in two to four sentences and whether any decision remains open>
@@ -73512,13 +73640,13 @@ function getResearcherToEntryPointHandoffTemplate(query) {
73512
73640
  <one entry per question, each tagged \`confirmed\` (with evidence), \`inferred\` (with reasoning), or \`unknown\`>
73513
73641
 
73514
73642
  ## Repository evidence
73515
- <concrete repository paths and symbols with what each shows; quote the relevant lines briefly>
73643
+ <concrete repository paths and symbols with what each shows; quote the relevant lines briefly; before recommending any new library, type, module, or abstraction, search the repository for an existing concept that does the same job under another name (search the domain nouns and their synonyms), and list each match with whether it fits and why>
73516
73644
 
73517
73645
  ## External sources
73518
- <URL, version or date checked, and the specific claim each source supports; write exactly \`None consulted.\` if no external source was needed, and say why>
73646
+ <one line per source: URL, the version or date checked, whether it is primary (official documentation, source code, changelog, release notes) or secondary, and the specific claim it supports; write exactly \`None consulted.\` if no external source was needed, and say why>
73519
73647
 
73520
73648
  ## Grounded facts for the plan
73521
- <the facts the planner can rely on when decomposing and delegating, each tagged confirmed or inferred>
73649
+ <the facts the ${entryPoint} can rely on when decomposing and delegating, each tagged confirmed or inferred>
73522
73650
 
73523
73651
  ## Remaining ambiguity
73524
73652
  <each open decision, who must decide it, and a recommended default; write exactly \`None observed.\` if none remain>
@@ -73560,7 +73688,7 @@ var init_planner_researcher_chat = __esm(() => {
73560
73688
  // ../../services/backend/prompts/teams/reviewer-handoff-templates.ts
73561
73689
  function getEntryPointToReviewerHandoffTemplate(query) {
73562
73690
  const entryPoint = query.fromRole;
73563
- return `Pass the review target and the review focus. State the exact commit range, branch, pull request, or file list to inspect, the focus areas (for example security, correctness, or test quality), and any known context or constraints. Ask the reviewer for a report only: do not edit files, run builds or tests, or implement fixes.
73691
+ return `Pass the review target and the review focus. State the exact commit range, branch, pull request, or file list to inspect, the focus areas (for example security, correctness, or test quality), and any known context or constraints. Name the spec the change must satisfy (the user's request, an issue, or a file under \`docs/\`), or write \`no spec available\` when there is none. Ask the reviewer for a report only: do not edit files, run builds or tests, or implement fixes.
73564
73692
 
73565
73693
  ### When to review
73566
73694
 
@@ -73584,16 +73712,35 @@ ${handoffCommand({
73584
73712
  }
73585
73713
  function getReviewerToEntryPointHandoffTemplate(query) {
73586
73714
  const entryPoint = query.toRole;
73587
- return `Instructions (not part of the message): Return a complete review report for the target the planner named. The reviewer is advisory: do not edit files, implement fixes, run builds or tests, or propose architecture rewrites beyond each issue's suggested fix. Report only what you observed and mark anything unverified as such. Label every issue with a severity: \`blocker\`, \`major\`, \`minor\`, or \`nit\`. Group the issues by severity with blockers first, and cite the repository-relative file and line or line range for each. Use the exact sections below, in this order.
73715
+ return `Instructions (not part of the message): Return a complete review report for the target the \`${entryPoint}\` named. The reviewer is advisory: do not edit files, implement fixes, run builds or tests, or propose architecture rewrites beyond each issue's suggested fix.
73716
+
73717
+ What a good review covers:
73718
+ - Read the actual files and the surrounding code the diff depends on, not summaries.
73719
+ - Judge the target on three axes: \`standards\` (the repository's documented standards, such as \`CONTRIBUTING.md\`, \`AGENTS.md\`, or \`CLAUDE.md\` when present, and the conventions of the surrounding code; cite the standard by file and rule), \`spec\` (the request, issue, or spec the planner named, recorded in \`## Review scope\`; quote the requirement), and \`defect\` (a demonstrable bug or security flaw, cited by reproduction or code path). Tag every issue with its axis.
73720
+ - Cite the repository-relative \`file:line\` or line range for every issue, give the evidence (the quoted line or the code path), and suggest a concrete, small fix.
73721
+ - Calibrate severity: \`blocker\` for exposure or modification of another user's data, a broken build, or a violated must-have spec requirement; \`major\` for a real defect or a non-blocking spec miss, including a missing or wrong auth check that exposes no other user's data (the endpoint audit's Reporting rule takes precedence for auth gaps); \`minor\` for a real but low-impact issue; \`nit\` for style only. Group the issues by severity with blockers first.
73722
+ - Report only what you observed; mark anything unverified as such and append \`(judgement)\` to a heuristic call that is neither a documented-standard breach nor a \`defect\`.
73723
+ - Quote the named spec's requirement for every \`spec\` issue. If no spec was named or found, write \`no spec available\` in \`## Review scope\`; do not invent one.
73724
+ - Stay within the stated focus, and do not duplicate issues.
73725
+ - Name what you did not check under \`## Not reviewed\`.
73726
+
73727
+ Audit authentication and authorization for every backend endpoint in review scope, regardless of the stated focus. An endpoint is any exported Convex query, mutation, or action, HTTP route, or API handler that the target adds or changes, plus any such endpoint the changed code calls or exposes. For each endpoint, check:
73728
+ - **Authentication:** the endpoint establishes the caller's identity before it reads or writes data, using the shared auth helper the sibling endpoints use. It does not trust a caller-supplied user id, role, or team id as proof of identity.
73729
+ - **Authorization:** the endpoint checks that the authenticated caller may act on the specific resource the request names (for example chatroom membership, ownership, or role) before it returns data or changes state. A login check alone is not sufficient.
73730
+ - **Coverage:** no code path returns or changes data before its check runs. An internal helper that skips checks may be called only from endpoints that already performed them.
73731
+ - **Intent:** an endpoint without a check is acceptable only when the code or the spec states why it is public. Otherwise report it.
73732
+ - **Reporting:** report each missing or wrong check as a \`defect\` axis issue. Use \`blocker\` when it exposes or changes another user's data, and \`major\` otherwise. Cite the endpoint's \`file:line\`; list every in-scope endpoint you did not read under \`## Not reviewed\`.
73733
+
73734
+ Use the exact sections below, in this order.
73588
73735
 
73589
73736
  ## Summary
73590
- <one to three sentences: overall state of the target and the count of blocker/major issues>
73737
+ <one to three sentences: overall state of the target; the pass/fail result for each of \`standards\`, \`spec\`, and \`defect\`; and the count of blocker/major issues>
73591
73738
 
73592
73739
  ## Review scope
73593
- <commits, paths, and PR/branch inspected; commands run, if any>
73740
+ <commits, paths, and PR/branch inspected; the spec source used for the spec axis, or exactly \`no spec available\` when none was named or found; the standards files read; commands run, if any>
73594
73741
 
73595
73742
  ## Issues
73596
- <numbered list grouped by severity (blocker, major, minor, nit); each item: \`file:line\` — summary — evidence — suggested fix; write exactly \`None observed.\` if none>
73743
+ <numbered list grouped by severity (blocker, major, minor, nit); each item: severity, axis (\`standards\`, \`spec\`, or \`defect\`), \`file:line\` — summary — evidence — suggested fix; append \`(judgement)\` to the summary when the issue is a heuristic call; write exactly \`None observed.\` if none>
73597
73744
 
73598
73745
  ## Not reviewed
73599
73746
  <anything out of scope or unreadable; write exactly \`None.\` if none>
@@ -73629,7 +73776,7 @@ var init_planner_reviewer_chat = __esm(() => {
73629
73776
  // ../../services/backend/prompts/teams/triage-handoff-templates.ts
73630
73777
  function getEntryPointToTriageHandoffTemplate(query) {
73631
73778
  const entryPoint = query.fromRole;
73632
- return `The automatically injected \`<user-message>\` is the authoritative request. Pass the reported bug, observed and expected behavior, reproduction details and commands, relevant constraints, and the files or symbols already suspected. Ask triage to investigate and report only. Triage may inspect code and attempt a focused automated regression test as evidence, but must not edit implementation files or implement a fix.
73779
+ return `The automatically injected \`<user-message>\` is the authoritative request. Pass the reported bug, observed and expected behavior with the source of the expectation (the reporter's words, a spec, or a documented decision), reproduction details and commands, relevant constraints, and the files or symbols already suspected. State the observable success condition: what the fixed behavior looks like to the reporter, so triage can build a loop that goes red on this bug and green once it is fixed. Ask triage to investigate and report only. Triage may inspect code and attempt a focused automated regression test as evidence, but must not edit implementation files or implement a fix.
73633
73780
 
73634
73781
  Use this for every reported bug (something broken or behaving differently than expected) before any fix is implemented.
73635
73782
 
@@ -73646,7 +73793,7 @@ ${handoffCommand({
73646
73793
  }
73647
73794
  function getTriageToEntryPointHandoffTemplate(query) {
73648
73795
  const entryPoint = query.toRole;
73649
- return `Instructions (not part of the message): Return a complete, evidence-backed investigation of the authoritative reported bug. Triage is advisory: do not edit implementation files or implement the proposed fix. Begin with the \`## Summary\` section, then use the remaining sections below in order. Use \`###\` for sub-items within a section. Cite concrete repository paths and symbols, observed behavior, commands, and test output. Distinguish confirmed findings from hypotheses; never claim a test proved behavior unless its failing assertion demonstrates the report.
73796
+ return `Instructions (not part of the message): Return a complete, evidence-backed investigation of the authoritative reported bug. Triage is advisory: do not edit implementation files or implement the proposed fix. Begin with the \`## Summary\` section, then use the remaining sections below in order. Use \`###\` for sub-items within a section. Cite concrete repository paths and symbols, observed behavior, commands, and test output. Distinguish confirmed findings from hypotheses; never claim a test proved behavior unless its failing assertion demonstrates the report. Redact every secret in quoted output as \`<REDACTED>\`, and quote only the lines that carry the signal.
73650
73797
 
73651
73798
  ## Summary
73652
73799
  <briefly state the diagnosis and whether the root cause was confirmed or remains a hypothesis>
@@ -73655,13 +73802,13 @@ function getTriageToEntryPointHandoffTemplate(query) {
73655
73802
  <state the reported symptoms and expected behavior, including reproduction details and constraints recovered from the request or relevant history>
73656
73803
 
73657
73804
  ## Root cause
73658
- <trace the relevant ownership, data, and control flow using concrete repository paths and symbols; explain the causal reasoning and explicitly label the finding as confirmed or a hypothesis>
73805
+ <first list 3 to 5 ranked hypotheses, or fewer when a stack trace or failing assertion already pins the cause, each as "If <X> is the cause, then <changing Y> removes the symptom (or <changing Z> makes it worse)", before testing any of them; then state the confirmed or hypothesized cause, tracing ownership, data, and control flow with concrete repository paths and symbols; for each hypothesis, say whether it was tested and the outcome; check decision records under \`memory/\` (start at \`memory/index.md\`) and docs/ for whether the behavior is documented as intended before calling it a defect; label the finding confirmed or hypothesis>
73659
73806
 
73660
73807
  ## Reproduction attempt
73661
- <give the focused test path and exact command, the failing assertion or exact blocker, and the outcome; if reproduction was blocked, state what was tried and what additional information would help; do not fabricate proof>
73808
+ <give the one command that drives the user's exact symptom, its observed output (redacted), and whether it is deterministic; when cheap and safe, record the run count, flake rate, and performance baseline; give the minimal scenario, listing each input, caller, or configuration removed and whether the symptom stayed; if a regression test was written, its path, command, and failing assertion; if no reproducing command could be built, say so, list what was tried, and name exactly what is needed to proceed (environment access, a redacted captured artifact, or permission to add temporary instrumentation); never fabricate proof>
73662
73809
 
73663
73810
  ## Proposed immediate fix
73664
- <recommend the smallest appropriate change, naming the likely files and the specific change; do not implement it>
73811
+ <recommend the smallest appropriate change, naming the likely files and the specific change; do not implement it; then name the regression-test seam. A test seam is the public interface where a test observes behavior. Substitution in a test is allowed only at a port or adapter boundary (an external dependency injected through a port). Do not mock internal collaborators. Give one line on what the seam catches and what it misses; if only a shallow seam exists (the bug needs several callers or a longer chain of calls to trigger), say so and add it under Systemic issues>
73665
73812
 
73666
73813
  ## Systemic issues
73667
73814
  <list each separate systemic concern with repository evidence, impact, and follow-up concern, or write exactly: None observed.>
@@ -73881,7 +74028,7 @@ function getEntryPointToVerifierHandoffTemplate(query) {
73881
74028
  <1 or 2; for 2, cite the round-1 verdict message id>
73882
74029
 
73883
74030
  ## Mode
73884
- <chat | code | code:enhanced>
74031
+ <chat | code>
73885
74032
 
73886
74033
  ## User message id
73887
74034
  <id of the user's last message: the origin message id of the user task, or from \`chatroom messages anchor\`>
@@ -74683,6 +74830,649 @@ var init_handoff_templates2 = __esm(() => {
74683
74830
  })();
74684
74831
  });
74685
74832
 
74833
+ // ../../services/backend/prompts/teams/trio/handoff-templates/architect-coordinator-code.ts
74834
+ function getArchitectCoordinatorCodeTemplate(query) {
74835
+ return getArchitectToEntryPointHandoffTemplate(query);
74836
+ }
74837
+ var init_architect_coordinator_code = __esm(() => {
74838
+ init_architect_handoff_templates();
74839
+ });
74840
+
74841
+ // ../../services/backend/prompts/teams/trio/handoff-templates/architect-coordinator-chat.ts
74842
+ var init_architect_coordinator_chat = __esm(() => {
74843
+ init_architect_coordinator_code();
74844
+ });
74845
+
74846
+ // ../../services/backend/prompts/teams/trio/handoff-templates/architect.ts
74847
+ var trioArchitectHandoffContract;
74848
+ var init_architect3 = __esm(() => {
74849
+ init_architect_coordinator_chat();
74850
+ init_architect_coordinator_code();
74851
+ init_contracts();
74852
+ trioArchitectHandoffContract = {
74853
+ role: "architect",
74854
+ receivesFrom: ["coordinator"],
74855
+ returnsTo: ["coordinator"],
74856
+ outboundTemplates: {
74857
+ coordinator: handoffTemplateByMode({
74858
+ chat: getArchitectCoordinatorCodeTemplate,
74859
+ code: getArchitectCoordinatorCodeTemplate
74860
+ })
74861
+ }
74862
+ };
74863
+ });
74864
+
74865
+ // ../../services/backend/prompts/teams/trio/handoff-templates/builder-specifier-code.ts
74866
+ function getBuilderSpecifierCodeTemplate(query) {
74867
+ return getBuilderHandbackTemplate(query);
74868
+ }
74869
+ var init_builder_specifier_code = __esm(() => {
74870
+ init_builder_handback_handoff_templates();
74871
+ });
74872
+
74873
+ // ../../services/backend/prompts/teams/trio/handoff-templates/builder-specifier-chat.ts
74874
+ var init_builder_specifier_chat = __esm(() => {
74875
+ init_builder_specifier_code();
74876
+ });
74877
+
74878
+ // ../../services/backend/prompts/teams/trio/handoff-templates/builder.ts
74879
+ var trioBuilderHandoffContract;
74880
+ var init_builder2 = __esm(() => {
74881
+ init_builder_specifier_chat();
74882
+ init_builder_specifier_code();
74883
+ init_contracts();
74884
+ trioBuilderHandoffContract = {
74885
+ role: "builder",
74886
+ receivesFrom: ["specifier"],
74887
+ returnsTo: ["specifier"],
74888
+ outboundTemplates: {
74889
+ specifier: handoffTemplateByMode({
74890
+ chat: getBuilderSpecifierCodeTemplate,
74891
+ code: getBuilderSpecifierCodeTemplate
74892
+ })
74893
+ }
74894
+ };
74895
+ });
74896
+
74897
+ // ../../services/backend/prompts/teams/trio/handoff-templates/coordinator-architect-code.ts
74898
+ function getCoordinatorArchitectCodeTemplate(query) {
74899
+ return getEntryPointToArchitectHandoffTemplate(query);
74900
+ }
74901
+ var init_coordinator_architect_code = __esm(() => {
74902
+ init_architect_handoff_templates();
74903
+ });
74904
+
74905
+ // ../../services/backend/prompts/teams/trio/handoff-templates/coordinator-architect-chat.ts
74906
+ var init_coordinator_architect_chat = __esm(() => {
74907
+ init_coordinator_architect_code();
74908
+ });
74909
+
74910
+ // ../../services/backend/prompts/teams/trio/handoff-templates/coordinator-game-asset-designer-code.ts
74911
+ function getCoordinatorGameAssetDesignerCodeTemplate(query) {
74912
+ return getEntryPointToGameAssetDesignerHandoffTemplate(query);
74913
+ }
74914
+ var init_coordinator_game_asset_designer_code = __esm(() => {
74915
+ init_game_asset_designer_handoff_templates();
74916
+ });
74917
+
74918
+ // ../../services/backend/prompts/teams/trio/handoff-templates/coordinator-game-asset-designer-chat.ts
74919
+ var init_coordinator_game_asset_designer_chat = __esm(() => {
74920
+ init_coordinator_game_asset_designer_code();
74921
+ });
74922
+
74923
+ // ../../services/backend/prompts/teams/trio/handoff-templates/coordinator-researcher-code.ts
74924
+ function getCoordinatorResearcherCodeTemplate(query) {
74925
+ return getEntryPointToResearcherHandoffTemplate(query);
74926
+ }
74927
+ var init_coordinator_researcher_code = __esm(() => {
74928
+ init_researcher_handoff_templates();
74929
+ });
74930
+
74931
+ // ../../services/backend/prompts/teams/trio/handoff-templates/coordinator-researcher-chat.ts
74932
+ var init_coordinator_researcher_chat = __esm(() => {
74933
+ init_coordinator_researcher_code();
74934
+ });
74935
+
74936
+ // ../../services/backend/prompts/teams/trio/handoff-templates/coordinator-reviewer-code.ts
74937
+ function getCoordinatorReviewerCodeTemplate(query) {
74938
+ return getEntryPointToReviewerHandoffTemplate(query);
74939
+ }
74940
+ var init_coordinator_reviewer_code = __esm(() => {
74941
+ init_reviewer_handoff_templates();
74942
+ });
74943
+
74944
+ // ../../services/backend/prompts/teams/trio/handoff-templates/coordinator-reviewer-chat.ts
74945
+ var init_coordinator_reviewer_chat = __esm(() => {
74946
+ init_coordinator_reviewer_code();
74947
+ });
74948
+
74949
+ // ../../services/backend/prompts/teams/trio/handoff-templates/coordinator-specifier-code.ts
74950
+ function getCoordinatorSpecifierCodeTemplate(_query) {
74951
+ return `Instructions (not part of the message): Delegate ONE work package to the \`specifier\`. The specifier turns it into file-level builder slices, drives the builder through every build pass, and hands one consolidated report back to you. Clear every required gate first (researcher, triage, architect, uiux-engineer, game-asset-designer) and include the decisions from their briefs, citing message ids — the specifier cannot contact those roles. Do not write file-level code instructions yourself; state outcomes, constraints, and acceptance criteria. Each package starts the specifier in a fresh session: include everything it needs, or name the message ids it must read with \`chatroom messages download\`.
74952
+
74953
+ ${getDelegationBriefIntro()}
74954
+
74955
+ \`\`\`markdown
74956
+ ## Summary
74957
+ <the user's intent in plain terms and where this package fits in the larger task>
74958
+
74959
+ ## Goal
74960
+ <one sentence: the outcome this work package delivers>
74961
+
74962
+ ## User requirements
74963
+ <the user's requirements and constraints, quoted or paraphrased, each with its source message id>
74964
+
74965
+ ## Inputs from specialists
74966
+ <for each architect / researcher / triage / uiux-engineer / game-asset-designer brief this package depends on: message id and the decisions to adopt; or \`None.\`>
74967
+ ${getFileReferenceGuidanceComment()}
74968
+
74969
+ ## Scope
74970
+ - In scope: <surfaces and behaviors>
74971
+ - Out of scope: <surfaces the specifier and builder must not touch>
74972
+
74973
+ ## Rework findings (prior round)
74974
+ <message id of the specifier, reviewer, or verifier report and the blocking findings to fix (paste each with file and line where known); or \`None.\`>
74975
+
74976
+ ## Acceptance criteria
74977
+ - <verifiable outcome; include at least one end-to-end check>
74978
+
74979
+ ## Delivery expectations
74980
+ <commit, branch, push, and PR expectations from the user; or \`None stated.\`>
74981
+
74982
+ ## History pointers
74983
+ <message ids or a \`--since-message-id\` anchor the specifier should download for context; or \`None.\`>
74984
+ \`\`\``;
74985
+ }
74986
+ var init_coordinator_specifier_code = () => {};
74987
+
74988
+ // ../../services/backend/prompts/teams/trio/handoff-templates/coordinator-specifier-chat.ts
74989
+ var init_coordinator_specifier_chat = __esm(() => {
74990
+ init_coordinator_specifier_code();
74991
+ });
74992
+
74993
+ // ../../services/backend/prompts/teams/trio/handoff-templates/coordinator-triage-code.ts
74994
+ function getCoordinatorTriageCodeTemplate(query) {
74995
+ return getEntryPointToTriageHandoffTemplate(query);
74996
+ }
74997
+ var init_coordinator_triage_code = __esm(() => {
74998
+ init_triage_handoff_templates();
74999
+ });
75000
+
75001
+ // ../../services/backend/prompts/teams/trio/handoff-templates/coordinator-triage-chat.ts
75002
+ var init_coordinator_triage_chat = __esm(() => {
75003
+ init_coordinator_triage_code();
75004
+ });
75005
+
75006
+ // ../../services/backend/prompts/teams/trio/handoff-templates/coordinator-uiux-engineer-code.ts
75007
+ function getCoordinatorUiuxEngineerCodeTemplate(query) {
75008
+ return getEntryPointToUiuxEngineerHandoffTemplate(query);
75009
+ }
75010
+ var init_coordinator_uiux_engineer_code = __esm(() => {
75011
+ init_uiux_engineer_handoff_templates();
75012
+ });
75013
+
75014
+ // ../../services/backend/prompts/teams/trio/handoff-templates/coordinator-uiux-engineer-chat.ts
75015
+ var init_coordinator_uiux_engineer_chat = __esm(() => {
75016
+ init_coordinator_uiux_engineer_code();
75017
+ });
75018
+
75019
+ // ../../services/backend/prompts/teams/trio/handoff-templates/coordinator-user-chat.ts
75020
+ var init_coordinator_user_chat = () => {};
75021
+
75022
+ // ../../services/backend/prompts/teams/trio/handoff-templates/coordinator-user-code.ts
75023
+ function getCoordinatorUserCodeTemplate(roleGuidanceContext) {
75024
+ return `${getHandoffReportTemplateIntro()}
75025
+
75026
+ \`\`\`markdown
75027
+ ${getHandoffReportTemplateBody(roleGuidanceContext, { includeProofOfVerification: true })}
75028
+ \`\`\``;
75029
+ }
75030
+ var init_coordinator_user_code = __esm(() => {
75031
+ init_handoff_report_template_body();
75032
+ });
75033
+
75034
+ // ../../services/backend/prompts/teams/trio/handoff-templates/coordinator-verifier-code.ts
75035
+ function getCoordinatorVerifierCodeTemplate(query) {
75036
+ return getEntryPointToVerifierHandoffTemplate(query);
75037
+ }
75038
+ var init_coordinator_verifier_code = __esm(() => {
75039
+ init_verifier_handoff_templates();
75040
+ });
75041
+
75042
+ // ../../services/backend/prompts/teams/trio/handoff-templates/coordinator-verifier-chat.ts
75043
+ var init_coordinator_verifier_chat = __esm(() => {
75044
+ init_coordinator_verifier_code();
75045
+ });
75046
+
75047
+ // ../../services/backend/prompts/teams/trio/handoff-templates/coordinator.ts
75048
+ var trioCoordinatorHandoffContract;
75049
+ var init_coordinator = __esm(() => {
75050
+ init_coordinator_architect_chat();
75051
+ init_coordinator_architect_code();
75052
+ init_coordinator_game_asset_designer_chat();
75053
+ init_coordinator_game_asset_designer_code();
75054
+ init_coordinator_researcher_chat();
75055
+ init_coordinator_researcher_code();
75056
+ init_coordinator_reviewer_chat();
75057
+ init_coordinator_reviewer_code();
75058
+ init_coordinator_specifier_chat();
75059
+ init_coordinator_specifier_code();
75060
+ init_coordinator_triage_chat();
75061
+ init_coordinator_triage_code();
75062
+ init_coordinator_uiux_engineer_chat();
75063
+ init_coordinator_uiux_engineer_code();
75064
+ init_coordinator_user_chat();
75065
+ init_coordinator_user_code();
75066
+ init_coordinator_verifier_chat();
75067
+ init_coordinator_verifier_code();
75068
+ init_contracts();
75069
+ trioCoordinatorHandoffContract = {
75070
+ role: "coordinator",
75071
+ receivesFrom: [
75072
+ "user",
75073
+ "specifier",
75074
+ "architect",
75075
+ "uiux-engineer",
75076
+ "triage",
75077
+ "researcher",
75078
+ "reviewer",
75079
+ "game-asset-designer",
75080
+ "verifier"
75081
+ ],
75082
+ returnsTo: [
75083
+ "user",
75084
+ "specifier",
75085
+ "architect",
75086
+ "uiux-engineer",
75087
+ "triage",
75088
+ "researcher",
75089
+ "reviewer",
75090
+ "game-asset-designer",
75091
+ "verifier"
75092
+ ],
75093
+ outboundTemplates: {
75094
+ user: handoffTemplateByMode({
75095
+ chat: getChatToUserHandoffTemplate,
75096
+ code: getCoordinatorUserCodeTemplate
75097
+ }),
75098
+ specifier: handoffTemplateByMode({
75099
+ chat: getCoordinatorSpecifierCodeTemplate,
75100
+ code: getCoordinatorSpecifierCodeTemplate
75101
+ }),
75102
+ architect: handoffTemplateByMode({
75103
+ chat: getCoordinatorArchitectCodeTemplate,
75104
+ code: getCoordinatorArchitectCodeTemplate
75105
+ }),
75106
+ "uiux-engineer": handoffTemplateByMode({
75107
+ chat: getCoordinatorUiuxEngineerCodeTemplate,
75108
+ code: getCoordinatorUiuxEngineerCodeTemplate
75109
+ }),
75110
+ triage: handoffTemplateByMode({
75111
+ chat: getCoordinatorTriageCodeTemplate,
75112
+ code: getCoordinatorTriageCodeTemplate
75113
+ }),
75114
+ researcher: handoffTemplateByMode({
75115
+ chat: getCoordinatorResearcherCodeTemplate,
75116
+ code: getCoordinatorResearcherCodeTemplate
75117
+ }),
75118
+ reviewer: handoffTemplateByMode({
75119
+ chat: getCoordinatorReviewerCodeTemplate,
75120
+ code: getCoordinatorReviewerCodeTemplate
75121
+ }),
75122
+ "game-asset-designer": handoffTemplateByMode({
75123
+ chat: getCoordinatorGameAssetDesignerCodeTemplate,
75124
+ code: getCoordinatorGameAssetDesignerCodeTemplate
75125
+ }),
75126
+ verifier: handoffTemplateByMode({
75127
+ chat: getCoordinatorVerifierCodeTemplate,
75128
+ code: getCoordinatorVerifierCodeTemplate
75129
+ })
75130
+ }
75131
+ };
75132
+ });
75133
+
75134
+ // ../../services/backend/prompts/teams/trio/handoff-templates/game-asset-designer-coordinator-code.ts
75135
+ function getGameAssetDesignerCoordinatorCodeTemplate(query) {
75136
+ return getGameAssetDesignerToEntryPointHandoffTemplate(query);
75137
+ }
75138
+ var init_game_asset_designer_coordinator_code = __esm(() => {
75139
+ init_game_asset_designer_handoff_templates();
75140
+ });
75141
+
75142
+ // ../../services/backend/prompts/teams/trio/handoff-templates/game-asset-designer-coordinator-chat.ts
75143
+ var init_game_asset_designer_coordinator_chat = __esm(() => {
75144
+ init_game_asset_designer_coordinator_code();
75145
+ });
75146
+
75147
+ // ../../services/backend/prompts/teams/trio/handoff-templates/game-asset-designer.ts
75148
+ var trioGameAssetDesignerHandoffContract;
75149
+ var init_game_asset_designer2 = __esm(() => {
75150
+ init_game_asset_designer_coordinator_chat();
75151
+ init_game_asset_designer_coordinator_code();
75152
+ init_contracts();
75153
+ trioGameAssetDesignerHandoffContract = {
75154
+ role: "game-asset-designer",
75155
+ receivesFrom: ["coordinator"],
75156
+ returnsTo: ["coordinator"],
75157
+ outboundTemplates: {
75158
+ coordinator: handoffTemplateByMode({
75159
+ chat: getGameAssetDesignerCoordinatorCodeTemplate,
75160
+ code: getGameAssetDesignerCoordinatorCodeTemplate
75161
+ })
75162
+ }
75163
+ };
75164
+ });
75165
+
75166
+ // ../../services/backend/prompts/teams/trio/handoff-templates/researcher-coordinator-code.ts
75167
+ function getResearcherCoordinatorCodeTemplate(query) {
75168
+ return getResearcherToEntryPointHandoffTemplate(query);
75169
+ }
75170
+ var init_researcher_coordinator_code = __esm(() => {
75171
+ init_researcher_handoff_templates();
75172
+ });
75173
+
75174
+ // ../../services/backend/prompts/teams/trio/handoff-templates/researcher-coordinator-chat.ts
75175
+ var init_researcher_coordinator_chat = __esm(() => {
75176
+ init_researcher_coordinator_code();
75177
+ });
75178
+
75179
+ // ../../services/backend/prompts/teams/trio/handoff-templates/researcher.ts
75180
+ var trioResearcherHandoffContract;
75181
+ var init_researcher2 = __esm(() => {
75182
+ init_researcher_coordinator_chat();
75183
+ init_researcher_coordinator_code();
75184
+ init_contracts();
75185
+ trioResearcherHandoffContract = {
75186
+ role: "researcher",
75187
+ receivesFrom: ["coordinator"],
75188
+ returnsTo: ["coordinator"],
75189
+ outboundTemplates: {
75190
+ coordinator: handoffTemplateByMode({
75191
+ chat: getResearcherCoordinatorCodeTemplate,
75192
+ code: getResearcherCoordinatorCodeTemplate
75193
+ })
75194
+ }
75195
+ };
75196
+ });
75197
+
75198
+ // ../../services/backend/prompts/teams/trio/handoff-templates/reviewer-coordinator-code.ts
75199
+ function getReviewerCoordinatorCodeTemplate(query) {
75200
+ return getReviewerToEntryPointHandoffTemplate(query);
75201
+ }
75202
+ var init_reviewer_coordinator_code = __esm(() => {
75203
+ init_reviewer_handoff_templates();
75204
+ });
75205
+
75206
+ // ../../services/backend/prompts/teams/trio/handoff-templates/reviewer-coordinator-chat.ts
75207
+ var init_reviewer_coordinator_chat = __esm(() => {
75208
+ init_reviewer_coordinator_code();
75209
+ });
75210
+
75211
+ // ../../services/backend/prompts/teams/trio/handoff-templates/reviewer.ts
75212
+ var trioReviewerHandoffContract;
75213
+ var init_reviewer2 = __esm(() => {
75214
+ init_reviewer_coordinator_chat();
75215
+ init_reviewer_coordinator_code();
75216
+ init_contracts();
75217
+ trioReviewerHandoffContract = {
75218
+ role: "reviewer",
75219
+ receivesFrom: ["coordinator"],
75220
+ returnsTo: ["coordinator"],
75221
+ outboundTemplates: {
75222
+ coordinator: handoffTemplateByMode({
75223
+ chat: getReviewerCoordinatorCodeTemplate,
75224
+ code: getReviewerCoordinatorCodeTemplate
75225
+ })
75226
+ }
75227
+ };
75228
+ });
75229
+
75230
+ // ../../services/backend/prompts/teams/trio/handoff-templates/specifier-builder-code.ts
75231
+ function getSpecifierBuilderCodeTemplate(_query) {
75232
+ return getBuilderDelegationBriefTemplate({
75233
+ delegatorRole: "specifier",
75234
+ gatesOwner: "coordinator"
75235
+ });
75236
+ }
75237
+ var init_specifier_builder_code = __esm(() => {
75238
+ init_builder_delegation_handoff_templates();
75239
+ });
75240
+
75241
+ // ../../services/backend/prompts/teams/trio/handoff-templates/specifier-builder-chat.ts
75242
+ var init_specifier_builder_chat = __esm(() => {
75243
+ init_specifier_builder_code();
75244
+ });
75245
+
75246
+ // ../../services/backend/prompts/teams/trio/handoff-templates/specifier-coordinator-chat.ts
75247
+ function getSpecifierCoordinatorChatTemplate(_query) {
75248
+ return `Instructions (not part of the message): chat response for the coordinator —
75249
+ \`\`\`markdown
75250
+ <write only the concise status the coordinator needs: what was delivered, blockers, and decisions it must make; do not add handoff XML sections, proofs, or report headings>
75251
+ \`\`\``;
75252
+ }
75253
+
75254
+ // ../../services/backend/prompts/teams/trio/handoff-templates/specifier-coordinator-code.ts
75255
+ function getSpecifierCoordinatorCodeTemplate(query) {
75256
+ return `${getHandoffReportTemplateIntro()}
75257
+
75258
+ \`\`\`markdown
75259
+ ## Summary
75260
+ <what this work package delivered, or why it stopped, in plain terms>
75261
+
75262
+ ## Template Disclosure Confirmation
75263
+ - [ ] I confirm that I have seen this template at the start of this work package, before driving the builder
75264
+ ${getRoleGuidanceDisclosureBlock({
75265
+ chatroomId: query.chatroomId,
75266
+ role: query.role,
75267
+ cliEnvPrefix: query.cliEnvPrefix
75268
+ })}
75269
+
75270
+ ## What exists today
75271
+ ${getHandoffNotApplicableSectionComment("Describe current state after this work package")}
75272
+ <current state after this work package: what the user can now do, what is in place, how the system behaves>
75273
+
75274
+ ## Slices delivered
75275
+ <one entry per builder slice: builder handoff message id, commits, files changed, rework rounds>
75276
+
75277
+ ${getHandoffQualityPrinciplesSectionBlock("work")}
75278
+
75279
+ ## Proof of Completion
75280
+ ${getFileReferenceProofOfCompletionExample()}
75281
+ <for each acceptance criterion in the work package: met / not met, with evidence (test names and output, commands run, commits)>
75282
+
75283
+ ## Code Change Verification
75284
+ ${CODE_CHANGE_VERIFICATION_CONFIRMATION}
75285
+
75286
+ ## Key Technical Decisions
75287
+ ${getHandoffNotApplicableSectionComment("List decisions")}
75288
+ - <schema design, modules, interfaces, domain entities: what you chose and why>
75289
+
75290
+ ## Key Tradeoffs
75291
+ ${getHandoffNotApplicableSectionComment("List tradeoffs")}
75292
+ - <what was weighed against what, and why you chose this path>
75293
+
75294
+ ## Deviations from the work package
75295
+ ${getHandoffNotApplicableSectionComment("List deviations")}
75296
+ <each place the implementation differs from the package, and why>
75297
+
75298
+ ## Tech Debt Observed
75299
+ ${getHandoffNotApplicableSectionComment("List tech debt")}
75300
+ ${getHandoffSeverityGuidanceBlock()}
75301
+ - <issues noticed but intentionally left out of scope of this work package>
75302
+
75303
+ ${getUnresolvedDecisionsSectionBlock()}
75304
+
75305
+ ## Manual steps
75306
+ ${getHandoffNotApplicableSectionComment("List manual steps outside the system")}
75307
+ <steps the user must take outside the system: deploy, configure credentials, run commands, verify in production>
75308
+
75309
+ ## Notes for review
75310
+ ${getHandoffNotApplicableSectionComment("List review notes")}
75311
+ <areas for the coordinator or reviewer to inspect>
75312
+ \`\`\``;
75313
+ }
75314
+ var init_specifier_coordinator_code = __esm(() => {
75315
+ init_handoff_quality_principles();
75316
+ init_role_guidance_disclosure();
75317
+ init_unresolved_decisions();
75318
+ });
75319
+
75320
+ // ../../services/backend/prompts/teams/trio/handoff-templates/specifier.ts
75321
+ var trioSpecifierHandoffContract;
75322
+ var init_specifier = __esm(() => {
75323
+ init_specifier_builder_chat();
75324
+ init_specifier_builder_code();
75325
+ init_specifier_coordinator_code();
75326
+ init_contracts();
75327
+ trioSpecifierHandoffContract = {
75328
+ role: "specifier",
75329
+ receivesFrom: ["coordinator", "builder"],
75330
+ returnsTo: ["coordinator", "builder"],
75331
+ outboundTemplates: {
75332
+ coordinator: handoffTemplateByMode({
75333
+ chat: getSpecifierCoordinatorChatTemplate,
75334
+ code: getSpecifierCoordinatorCodeTemplate
75335
+ }),
75336
+ builder: handoffTemplateByMode({
75337
+ chat: getSpecifierBuilderCodeTemplate,
75338
+ code: getSpecifierBuilderCodeTemplate
75339
+ })
75340
+ }
75341
+ };
75342
+ });
75343
+
75344
+ // ../../services/backend/prompts/teams/trio/handoff-templates/triage-coordinator-code.ts
75345
+ function getTriageCoordinatorCodeTemplate(query) {
75346
+ return getTriageToEntryPointHandoffTemplate(query);
75347
+ }
75348
+ var init_triage_coordinator_code = __esm(() => {
75349
+ init_triage_handoff_templates();
75350
+ });
75351
+
75352
+ // ../../services/backend/prompts/teams/trio/handoff-templates/triage-coordinator-chat.ts
75353
+ var init_triage_coordinator_chat = __esm(() => {
75354
+ init_triage_coordinator_code();
75355
+ });
75356
+
75357
+ // ../../services/backend/prompts/teams/trio/handoff-templates/triage.ts
75358
+ var trioTriageHandoffContract;
75359
+ var init_triage3 = __esm(() => {
75360
+ init_triage_coordinator_chat();
75361
+ init_triage_coordinator_code();
75362
+ init_contracts();
75363
+ trioTriageHandoffContract = {
75364
+ role: "triage",
75365
+ receivesFrom: ["coordinator"],
75366
+ returnsTo: ["coordinator"],
75367
+ outboundTemplates: {
75368
+ coordinator: handoffTemplateByMode({
75369
+ chat: getTriageCoordinatorCodeTemplate,
75370
+ code: getTriageCoordinatorCodeTemplate
75371
+ })
75372
+ }
75373
+ };
75374
+ });
75375
+
75376
+ // ../../services/backend/prompts/teams/trio/handoff-templates/uiux-engineer-coordinator-code.ts
75377
+ function getUiuxEngineerCoordinatorCodeTemplate(query) {
75378
+ return getUiuxEngineerToEntryPointHandoffTemplate(query);
75379
+ }
75380
+ var init_uiux_engineer_coordinator_code = __esm(() => {
75381
+ init_uiux_engineer_handoff_templates();
75382
+ });
75383
+
75384
+ // ../../services/backend/prompts/teams/trio/handoff-templates/uiux-engineer-coordinator-chat.ts
75385
+ var init_uiux_engineer_coordinator_chat = __esm(() => {
75386
+ init_uiux_engineer_coordinator_code();
75387
+ });
75388
+
75389
+ // ../../services/backend/prompts/teams/trio/handoff-templates/uiux-engineer.ts
75390
+ var trioUiuxEngineerHandoffContract;
75391
+ var init_uiux_engineer3 = __esm(() => {
75392
+ init_uiux_engineer_coordinator_chat();
75393
+ init_uiux_engineer_coordinator_code();
75394
+ init_contracts();
75395
+ trioUiuxEngineerHandoffContract = {
75396
+ role: "uiux-engineer",
75397
+ receivesFrom: ["coordinator"],
75398
+ returnsTo: ["coordinator"],
75399
+ outboundTemplates: {
75400
+ coordinator: handoffTemplateByMode({
75401
+ chat: getUiuxEngineerCoordinatorCodeTemplate,
75402
+ code: getUiuxEngineerCoordinatorCodeTemplate
75403
+ })
75404
+ }
75405
+ };
75406
+ });
75407
+
75408
+ // ../../services/backend/prompts/teams/trio/handoff-templates/verifier-coordinator-code.ts
75409
+ function getVerifierCoordinatorCodeTemplate(query) {
75410
+ return getVerifierToEntryPointHandoffTemplate(query);
75411
+ }
75412
+ var init_verifier_coordinator_code = __esm(() => {
75413
+ init_verifier_handoff_templates();
75414
+ });
75415
+
75416
+ // ../../services/backend/prompts/teams/trio/handoff-templates/verifier-coordinator-chat.ts
75417
+ var init_verifier_coordinator_chat = __esm(() => {
75418
+ init_verifier_coordinator_code();
75419
+ });
75420
+
75421
+ // ../../services/backend/prompts/teams/trio/handoff-templates/verifier.ts
75422
+ var trioVerifierHandoffContract;
75423
+ var init_verifier3 = __esm(() => {
75424
+ init_verifier_coordinator_chat();
75425
+ init_verifier_coordinator_code();
75426
+ init_contracts();
75427
+ trioVerifierHandoffContract = {
75428
+ role: "verifier",
75429
+ receivesFrom: ["coordinator"],
75430
+ returnsTo: ["coordinator"],
75431
+ outboundTemplates: {
75432
+ coordinator: handoffTemplateByMode({
75433
+ chat: getVerifierCoordinatorCodeTemplate,
75434
+ code: getVerifierCoordinatorCodeTemplate
75435
+ })
75436
+ }
75437
+ };
75438
+ });
75439
+
75440
+ // ../../services/backend/prompts/teams/trio/handoff-templates/index.ts
75441
+ function listTrioRoleHandoffContracts() {
75442
+ return validatedTrioRoleHandoffContracts;
75443
+ }
75444
+ var TRIO_ROLE_HANDOFF_CATALOG, TRIO_ROLE_HANDOFF_CONTRACTS, validatedTrioRoleHandoffContracts;
75445
+ var init_handoff_templates3 = __esm(() => {
75446
+ init_architect3();
75447
+ init_builder2();
75448
+ init_coordinator();
75449
+ init_game_asset_designer2();
75450
+ init_researcher2();
75451
+ init_reviewer2();
75452
+ init_specifier();
75453
+ init_triage3();
75454
+ init_uiux_engineer3();
75455
+ init_verifier3();
75456
+ init_contracts();
75457
+ TRIO_ROLE_HANDOFF_CATALOG = {
75458
+ coordinator: trioCoordinatorHandoffContract,
75459
+ specifier: trioSpecifierHandoffContract,
75460
+ builder: trioBuilderHandoffContract,
75461
+ architect: trioArchitectHandoffContract,
75462
+ researcher: trioResearcherHandoffContract,
75463
+ reviewer: trioReviewerHandoffContract,
75464
+ "uiux-engineer": trioUiuxEngineerHandoffContract,
75465
+ "game-asset-designer": trioGameAssetDesignerHandoffContract,
75466
+ triage: trioTriageHandoffContract,
75467
+ verifier: trioVerifierHandoffContract
75468
+ };
75469
+ TRIO_ROLE_HANDOFF_CONTRACTS = Object.values(TRIO_ROLE_HANDOFF_CATALOG);
75470
+ validatedTrioRoleHandoffContracts = (() => {
75471
+ validateBuiltinTeamRoleHandoffContracts("trio", TRIO_ROLE_HANDOFF_CONTRACTS);
75472
+ return TRIO_ROLE_HANDOFF_CONTRACTS;
75473
+ })();
75474
+ });
75475
+
74686
75476
  // ../../services/backend/prompts/cli/handoff-templates/index.ts
74687
75477
  function listHandoffTemplatePairs(teamId, fromRole) {
74688
75478
  const team = (teamId ?? DEFAULT_HANDOFF_TEAM_ID).trim().toLowerCase();
@@ -74769,13 +75559,16 @@ function getReplyHandoffTemplatePair(pair) {
74769
75559
  return { teamId: pair.teamId, fromRole: pair.toRole, toRole: pair.fromRole };
74770
75560
  }
74771
75561
  var BUILTIN_TEAM_HANDOFF_CONTRACTS;
74772
- var init_handoff_templates3 = __esm(() => {
75562
+ var init_handoff_templates4 = __esm(() => {
75563
+ init_team_presets();
74773
75564
  init_pair();
74774
75565
  init_handoff_templates();
74775
75566
  init_handoff_templates2();
75567
+ init_handoff_templates3();
74776
75568
  BUILTIN_TEAM_HANDOFF_CONTRACTS = {
74777
75569
  duo: listDuoRoleHandoffContracts(),
74778
- solo: listSoloRoleHandoffContracts()
75570
+ solo: listSoloRoleHandoffContracts(),
75571
+ trio: listTrioRoleHandoffContracts()
74779
75572
  };
74780
75573
  });
74781
75574
 
@@ -74793,7 +75586,7 @@ function viewHandoffTemplate(params) {
74793
75586
  return template;
74794
75587
  }
74795
75588
  var init_view_template2 = __esm(() => {
74796
- init_handoff_templates3();
75589
+ init_handoff_templates4();
74797
75590
  init_pair();
74798
75591
  });
74799
75592
 
@@ -74843,7 +75636,7 @@ function listHandoffTemplatesCommand(params) {
74843
75636
  `);
74844
75637
  }
74845
75638
  var init_list_templates = __esm(() => {
74846
- init_handoff_templates3();
75639
+ init_handoff_templates4();
74847
75640
  init_pair();
74848
75641
  init_command2();
74849
75642
  });
@@ -75045,6 +75838,14 @@ var init_data_design = () => {};
75045
75838
 
75046
75839
  // ../../services/backend/src/domain/usecase/skills/modules/defragmentation/index.ts
75047
75840
  var init_defragmentation = () => {};
75841
+
75842
+ // ../../services/backend/src/domain/usecase/skills/modules/game-asset-2d-ai/index.ts
75843
+ var init_game_asset_2d_ai = () => {};
75844
+ // ../../services/backend/src/domain/usecase/skills/modules/game-asset-3d-ai/index.ts
75845
+ var init_game_asset_3d_ai = () => {};
75846
+
75847
+ // ../../services/backend/src/domain/usecase/skills/modules/game-asset-3d-procedural/index.ts
75848
+ var init_game_asset_3d_procedural = () => {};
75048
75849
  // ../../services/backend/src/domain/usecase/skills/modules/user-centricity/index.ts
75049
75850
  var init_user_centricity = () => {};
75050
75851
 
@@ -75054,6 +75855,9 @@ var init_registry3 = __esm(() => {
75054
75855
  init_code_review();
75055
75856
  init_data_design();
75056
75857
  init_defragmentation();
75858
+ init_game_asset_2d_ai();
75859
+ init_game_asset_3d_ai();
75860
+ init_game_asset_3d_procedural();
75057
75861
  init_user_centricity();
75058
75862
  });
75059
75863
 
@@ -75107,6 +75911,10 @@ var init_glossary = __esm(() => {
75107
75911
  {
75108
75912
  term: "structural-decisions",
75109
75913
  definition: "Meta-level architectural choices that persist in the codebase and influence consistency: " + "folder structure, file naming, interface definitions, and key abstraction names/locations " + "(e.g., Repository/Service layers)."
75914
+ },
75915
+ {
75916
+ term: "test-seam",
75917
+ definition: "The public interface where a test observes behavior. Substitution in a test is allowed only at a port or adapter boundary (an external dependency injected through a port); do not mock internal collaborators."
75110
75918
  }
75111
75919
  ];
75112
75920
  NATIVE_GLOSSARY_TERMS = [
@@ -75153,7 +75961,7 @@ var init_commands_reference = __esm(() => {
75153
75961
 
75154
75962
  // ../../services/backend/prompts/cli/sections/handoff-template-discovery.ts
75155
75963
  var init_handoff_template_discovery = __esm(() => {
75156
- init_handoff_templates3();
75964
+ init_handoff_templates4();
75157
75965
  init_pair();
75158
75966
  });
75159
75967
 
@@ -75191,7 +75999,7 @@ var init_sections = __esm(() => {
75191
75999
 
75192
76000
  // ../../services/backend/prompts/cli/roles/architect.ts
75193
76001
  var ARCHITECT_GUIDANCE;
75194
- var init_architect3 = __esm(() => {
76002
+ var init_architect4 = __esm(() => {
75195
76003
  init_sections();
75196
76004
  ARCHITECT_GUIDANCE = `## Architect Operating Model
75197
76005
 
@@ -75217,24 +76025,32 @@ The handoff must contain every required brief section, repository evidence, chos
75217
76025
  });
75218
76026
 
75219
76027
  // ../../services/backend/prompts/cli/roles/builder.ts
75220
- var init_builder2 = __esm(() => {
76028
+ var init_builder3 = __esm(() => {
75221
76029
  init_sections();
75222
76030
  });
75223
76031
 
75224
76032
  // ../../services/backend/prompts/cli/roles/game-asset-designer.ts
75225
76033
  var GAME_ASSET_DESIGNER_GUIDANCE;
75226
- var init_game_asset_designer2 = __esm(() => {
76034
+ var init_game_asset_designer3 = __esm(() => {
75227
76035
  init_game_asset_designer_evidence();
75228
76036
  init_game_asset_designer_workflow();
75229
76037
  init_sections();
75230
76038
  GAME_ASSET_DESIGNER_GUIDANCE = `## Game Asset Designer Operating Model
75231
76039
 
75232
- You specify and generate production-quality game and UI assets (generation is the default unless the brief says \`spec only\`), using \`chatroom generate-image --platform=fal\` for 2D assets and \`chatroom generate-3d --platform=fal\` for 3D models. A 3D run writes \`<base>.zip\` (contents: R1) and \`<base>.html\`, a separate preview of the web variant; \`<base>\` is the \`--out\` stem plus the run's UTC timestamp, and \`--package-dir <dir>\` (default: the master's directory) moves both. You are not the builder or planner; do not implement application logic outside the asset-integration paths the brief allows. Your delivery report uses Proof of Principles and Proof of Completion.
76040
+ You specify and generate production-quality game and UI assets (generation is the default unless the brief says \`spec only\`). You use the matching skill for every generation step. You are not the builder or {ENTRY_POINT_ROLE}; do not implement application logic outside the asset-integration paths the brief allows. Your delivery report uses Proof of Principles and Proof of Completion.
75233
76041
 
75234
76042
  ${"{SESSION_CONTINUITY}"}
75235
76043
 
75236
76044
  ${getInterRoleHandoffRule()}
75237
76045
 
76046
+ ### Skills
76047
+ Activate exactly the skill that matches each asset, using the command form for this chatroom and role:
76048
+ - 3D asset via AI generation → \`game-asset-3d-ai\`: \`chatroom skill activate game-asset-3d-ai --chatroom-id=<chatroom-id> --role=game-asset-designer\`
76049
+ - 2D asset via AI generation → \`game-asset-2d-ai\`: \`chatroom skill activate game-asset-2d-ai --chatroom-id=<chatroom-id> --role=game-asset-designer\`
76050
+ - 3D asset via a committed procedural generator → \`game-asset-3d-procedural\`: \`chatroom skill activate game-asset-3d-procedural --chatroom-id=<chatroom-id> --role=game-asset-designer\`
76051
+
76052
+ A brief that mixes asset types activates each skill it needs. Audio and non-game UI icons are not covered by these skills; for audio, apply the All assets and Audio checklists in this prompt.
76053
+
75238
76054
  ### RULES
75239
76055
  ${formatGameAssetRules()}
75240
76056
 
@@ -75243,16 +76059,13 @@ ${GAME_ASSET_EVIDENCE_DEFINITIONS}
75243
76059
  ${GAME_ASSET_NEVER_CLAIM_RULE} ${GAME_ASSET_RESULT_RULE}
75244
76060
 
75245
76061
  ### PROCEDURE
75246
- P1 Recover the brief. IF engine, tier, style, or budgets are missing and the repo cannot answer THEN ask \`{ENTRY_POINT_ROLE}\` (Summary "Blocked:", unreached "Not started") ELSE defaults+assumptions.
76062
+ P1 Recover the brief. IF \`## Lighting contract\` is missing, not specified, or not applicable for a 3D asset, or engine, tier, style, or budgets are missing and the repo cannot answer, THEN ask \`{ENTRY_POINT_ROLE}\` (Summary "Blocked:", unreached "Not started"); ELSE apply defaults+assumptions (\`Not applicable.\` only for 2D/audio).
75247
76063
  P2 Inspect assets, names, folders, engine config; cite paths.
75248
76064
  P3 Classify each asset; one manifest entry per ID (\`A01\`…).
75249
- P4 IF \`Deliverable mode\` = \`spec only\` OR \`Output location\`/\`Allowed tools\` missing/ambiguous THEN no files, deliver \`Specified only.\`, GOTO P10.
75250
- P5 IF the asset is 3D THEN \`generate-3d --platform=fal --model <Model>\` (\`--prompt\`/\`--input-image\`, \`--out <Output location>/<ascii-name>.glb\`, \`--rig\`/\`--animation-action-id\` only as R1 allows (approval quoted)), GOTO P9. ELSE Count N. IF N=1 or styles differ THEN per-asset \`generate-image\`, GOTO P8. ELSE use ceil(N / (C×R)) sheets of ≤(C×R) items per \`Sheet grid\` (2x2 default). Prompt: one item per cell, CxR grid, no lines/borders/frames/duplicates. Generate \`generate-image --platform=fal --model <Model> --prompt "<prompt>" --out <Output location>/_work/<sheet>.png\`.
75251
- P6 \`chatroom slice-image --in <sheet> --out-dir <Output location>/_work/tiles --cols C --rows R\`. IF refused regenerate once; IF still refused one \`generate-image\` per asset (P5).
75252
- P7 View each tile. IF any tile has 0/2+ items, a cut item, or count differs from the brief's requested count (extra cells OK) THEN regenerate once; IF still bad THEN one \`generate-image\` per asset (P5). Name from sight.
75253
- P8 IF \`remove-image-background --help\` succeeds THEN run \`remove-image-background --in-dir <tiles> --out-dir <Output location> --map <stem>=<name>,... --trim\` (single: \`--in <image> --out <Output location>/<name>.png --trim\`); view results. IF warnings/halo THEN rerun with \`--tolerance\`/\`--force\` max twice, ELSE accept. ELSE rerun \`slice-image --names\`; record trimming not delivered as a failed item/open question.
75254
- P9 Record model, seed, manifests, names.
75255
- P10 Apply checklist, label evidence, fill proofs.
76065
+ P4 IF existing assets and an asset-in-rig render are named THEN skip P5–P9 (no generation, slicing, or packaging), apply only the lighting item in this prompt's All assets checklist, GOTO P10. IF \`Deliverable mode\` = \`spec only\` OR \`Output location\`/\`Allowed tools\` missing THEN deliver \`Specified only.\`, lighting \`n/a\`, GOTO P10.
76066
+ P5 Generate: activate the matching skill and follow its generation procedure for each asset type; never use a generator the brief does not name.
76067
+ P9 Record the model or generator and tool, the seed or parameter set, the manifests, and the names.
76068
+ P10 Apply checklist, label evidence, fill proofs; apply the lighting item (\`n/a\` for \`spec only\`); if \`not checked\`, deliver as \`Delivered, lighting not verified:\`.
75256
76069
  P11 Hand off to \`{ENTRY_POINT_ROLE}\`, then stop.
75257
76070
 
75258
76071
  ### Quality checklist (apply to each asset; mark each item pass, fail, or not applicable, with its evidence label)
@@ -75262,43 +76075,15 @@ P11 Hand off to \`{ENTRY_POINT_ROLE}\`, then stop.
75262
76075
  - File format is the one the target engine imports (glTF 2.0/GLB, FBX, PNG, WAV/OGG as named in the request); no unused data (hidden meshes, unused materials, history).
75263
76076
  - Style matches the named style reference: silhouette, value range, palette, level of detail, and texel density or pixel grid.
75264
76077
  - Budgets in the request are met; any exceedance is called out with the measured value.
75265
-
75266
- **3D models**
75267
- - Units and axes match the target (glTF: meters, +Y up, front +Z); scale is applied (identity scale) and a real-world size is stated.
75268
- - Pivot/origin follows the declared policy; LODs share the base pivot and alignment.
75269
- - Clean topology: no n-gons or non-manifold edges unless declared, no flipped normals or inverted winding (glTF: counter-clockwise front faces), consistent normals and tangents (MikkTSpace).
75270
- - Triangle count per LOD is within budget; LOD naming matches the engine (Unity \`_LOD0\`, \`_LOD1\`; Unreal LODs share the base pivot and alignment and are imported per the FBX import options; Godot generates LODs at import, so declare the Generate LODs setting instead of a suffix).
75271
- - UVs: non-overlapping unique layout where textures are unique, island padding, consistent texel density, no stretched islands; a second UV set if the engine needs baked lighting.
75272
- - Collision and sockets use the engine's naming (Unreal \`UBX_\`/\`UCP_\`/\`USP_\`/\`UCX_\` + mesh name and \`SOCKET_\` + mesh name; Godot \`-col\`/\`-convcolonly\` suffixes).
75273
- - Skinned meshes: bone count within budget, influences per vertex within the declared budget (commonly 4, marked \`unverified\`; glTF allows more via \`JOINTS_1\`), no leftover IK helpers, a named rest pose.
75274
-
75275
- **PBR materials and textures**
75276
- - Metallic-roughness workflow with documented channel packing (glTF: roughness in G, metallic in B, occlusion in R).
75277
- - Color space: base color and emissive sRGB; normal, roughness, metallic, occlusion, masks linear. State the normal map Y convention. In glTF, color space is set by the material slot that references the image, not by embedded PNG chunks. Verify the slot for each map: \`baseColorTexture\` and \`emissiveTexture\` are sRGB; \`metallicRoughnessTexture\`, \`occlusionTexture\` and \`normalTexture\` are linear.
75278
- - Base color values stay in a physically plausible range (community starting range roughly 30–240 sRGB per channel for non-metals; the request's budget overrides it); metallic is near binary.
75279
- - Resolution matches the texel-density budget and surface size; dimensions meet the engine/platform rule (power of two where the engine needs mipmaps or streaming, for example Unreal; confirm for the target engine version); compression format named.
75280
- - Tiling textures wrap without a visible seam; no baked-in lighting or text in base color unless declared.
75281
- - Maps in one set share texel density, value range, and naming (\`T_Name_BaseColor\`, \`_Normal\`, \`_ORM\`).
75282
-
75283
- **2D sprites and UI art**
75284
- - Fixed grid and pixels-per-unit declared; sprite sizes are multiples of the grid; no sub-pixel offsets.
75285
- - Palette size and colors declared; transparent background with clean alpha edges.
75286
- - Animation: uniform frame size per clip, frame count, frame rate, loop flag, and pivot per clip.
75287
- - Atlas: padding of at least the engine default (Unity default 4 px), atlas size within the platform max, filter mode Point for pixel art and no mip maps.
75288
- - Export PNG (lossless with alpha); name states size and frame count where relevant.
75289
- - Camera perspective matches the perspective chosen for the set (the brief's \`Perspective\`, or the one recorded under assumptions) and every other asset in the set (compare them side by side); \`n/a\` for a single asset.
76078
+ - **Lighting**: renders correctly under the brief's \`## Lighting contract\` (visible, coloured and textured, not near-black). Pass needs the asset-in-rig render under \`## Lighting verification\`; the rig reference render and Studio mode never support pass.
75290
76079
 
75291
76080
  **Audio**
75292
- - Loudness measured against the platform target stated in the request (for example console -24 LUFS, mobile -18 LUFS, true peak at or below -1 dBTP); no clipping. Measure with a tool: \`ffmpeg -i <file> -af ebur128=peak=true -f null -\` for integrated loudness and true peak; \`ffprobe <file>\` for sample rate, bit depth and channels; for glTF, \`gltf-transform inspect <file>\` (quote the command's actual output). Cite the platform source. If the request does not state the target, mark the loudness target \`unverified\` and name the source. Mobile targets vary (-18 vs -16 LUFS).
76081
+ - Loudness measured against the platform target stated in the request (for example console -24 LUFS, mobile -18 LUFS, true peak at or below -1 dBTP); no clipping. Measure with a tool: \`ffmpeg -i <file> -af ebur128=peak=true -f null -\` for integrated loudness and true peak; \`ffprobe <file>\` for sample rate, bit depth and channels. Quote the command's actual output. Cite the platform source. If the request does not state the target, mark the loudness target \`unverified\` and name the source. Mobile targets vary (-18 vs -16 LUFS).
75293
76082
  - Sample rate, bit depth, channel count, loop points, and format stated; short noisy SFX use PCM or ADPCM, long audio uses compressed or streamed formats, per the engine's guidance.
75294
76083
 
75295
- ### Perspective consistency (generated 2D sets)
75296
- Assets used together must share one camera perspective. The model's constraints (unsupported parameters, size defaults, what it does not guarantee) come only from the matching \`--dry-run\` (R16) — \`generate-image --dry-run\` for a 2D asset and \`generate-3d --dry-run\` for a 3D model; apply them, and never add a parameter the dry run reports as unsupported.
75297
- - Repeat the perspective term from the brief's \`Perspective\` word for word in every prompt of the set (never the \`reference:\` path), and add the same flattening terms to every prompt: \`flat 2D game asset, orthographic, centered, plain background, even lighting\`. Suggested perspective terms (\`unverified\`): side view, front view, orthographic top-down, orthographic isometric, dimetric 2:1, three-quarter view. If the field names only a reference, describe that reference's view in words and record the description under assumptions. If \`Perspective\` is \`Not specified.\`, pick one, record it under assumptions, and use it for the whole set. If the \`Style reference\` asks for a lighting style these terms contradict (for example dramatic lighting), keep the perspective term and drop only the conflicting flattening term.
75298
- - Use one \`--input\` JSON (from \`Model parameters\`) on every call of the set; if the dry run reports a size parameter as defaulted, set it once in that JSON and reuse it. Add \`--input '<JSON>'\` and the seed to every P5 command.
75299
- - Use one shared \`--seed\` for the first call of each item or sheet. For every regeneration (P6, P7, or a perspective mismatch), use a new seed and record it (P9). A shared seed does not keep perspective across different prompts.
75300
- - Pass \`--input-image <path>\` with \`--model fal-ai/flux-2/flash/edit\` only when the brief's \`Model\` is \`fal-ai/flux-2/flash/edit\` and \`Perspective\` names a reference path. In this mode generate every asset individually (the P5 per-asset path, one \`--input-image\` per asset); never use a sheet.
75301
- - Inspect the set side by side. A mismatched item is regenerated individually (the P5 per-asset path, with a new seed), at most twice per item, separately from the sheet regenerations of P6 and P7. If it still differs, mark the perspective checklist item \`fail\` with \`inspected\` evidence.
76084
+ ### Set consistency principles
76085
+ - **One camera perspective per set.** Repeat the perspective term from the brief's \`## Perspective\` word for word in every prompt of the set; \`n/a\` for 3D models and audio. The matching skill owns the full perspective rules.
76086
+ - **One lighting and palette anchor per set.** From the brief's \`## Lighting contract\` and \`## Style reference\`, choose one anchor (palette, light direction, colour temperature, background, material treatment) and repeat it word for word in every prompt of the set. If the contract and the style reference conflict, follow the contract and record the deviation under assumptions. The matching skill owns the full anchor rules.
75302
76087
 
75303
76088
  ### Scope boundary
75304
76089
  You may specify, name, organize, generate, validate, and integrate assets within the paths the brief allows. You must not claim fidelity you did not establish. If you cannot open or measure a file, write \`unverified\`. Do not present alternative art directions beyond what the request needs; recommend one.
@@ -75320,19 +76105,19 @@ var init_planner2 = __esm(() => {
75320
76105
 
75321
76106
  // ../../services/backend/prompts/cli/roles/researcher.ts
75322
76107
  var RESEARCHER_GUIDANCE;
75323
- var init_researcher2 = __esm(() => {
76108
+ var init_researcher3 = __esm(() => {
75324
76109
  init_sections();
75325
76110
  RESEARCHER_GUIDANCE = `## Researcher Operating Model
75326
76111
 
75327
- You are the researcher responsible for grounding a request with evidence so the planner can decide and delegate without ambiguity. You are advisory only: do not edit files, implement code, or act as the builder or planner.
76112
+ You are the researcher responsible for grounding a request with evidence so the {ENTRY_POINT_ROLE} can decide and delegate without ambiguity. You are advisory only: do not edit files, implement code, or act as the builder or {ENTRY_POINT_ROLE}.
75328
76113
 
75329
76114
  ${"{SESSION_CONTINUITY}"}
75330
76115
 
75331
76116
  ${getInterRoleHandoffRule()}
75332
76117
 
75333
- 1. Recover the authoritative request and the research questions from the injected task and chatroom history. If the questions are not explicit, derive the decisions the planner must make and answer those.
76118
+ 1. Recover the authoritative request and the research questions from the injected task and chatroom history. If the questions are not explicit, derive the decisions the {ENTRY_POINT_ROLE} must make and answer those.
75334
76119
  2. Investigate the repository first: existing modules, APIs, types, patterns, tests, and conventions that bear on the request. Cite concrete paths and symbols.
75335
- 3. Investigate external sources when the request depends on libraries, APIs, platform behavior, versions, or recent changes. Prefer official documentation and primary sources. Record the URL, the version, and the date checked.
76120
+ 3. Investigate external sources when the request depends on libraries, APIs, platform behavior, versions, or recent changes. Prefer official documentation and primary sources (the package's own source or changelog, the platform's release notes). Record the URL, the version, and the date checked.
75336
76121
  4. Label every finding \`confirmed\`, \`inferred\`, or \`unknown\`. Never present a guess as fact.
75337
76122
  5. Resolve ambiguity where evidence allows. For the rest, state the open question, who must decide it, and a recommended default.
75338
76123
  6. Follow the injected \`<handoff-templates>\` research brief exactly, in its order. Answer only the questions asked. Do not present alternative architectures beyond what grounds the decision.
@@ -75345,22 +76130,28 @@ chatroom handoff --chatroom-id="<chatroom-id>" --role="researcher" --next-role="
75345
76130
 
75346
76131
  // ../../services/backend/prompts/cli/roles/reviewer.ts
75347
76132
  var REVIEWER_GUIDANCE;
75348
- var init_reviewer2 = __esm(() => {
76133
+ var init_reviewer3 = __esm(() => {
75349
76134
  init_sections();
75350
76135
  REVIEWER_GUIDANCE = `## Reviewer Operating Model
75351
76136
 
75352
- You are the reviewer responsible for inspecting the code artifacts the planner names and reporting the issues you observe. You are advisory only: do not edit files, implement fixes, or act as the builder or planner.
76137
+ You are the reviewer responsible for inspecting the code artifacts the {ENTRY_POINT_ROLE} names and reporting the issues you observe. You are advisory only: do not edit files, implement fixes, or act as the builder or {ENTRY_POINT_ROLE}.
75353
76138
 
75354
76139
  ${"{SESSION_CONTINUITY}"}
75355
76140
 
75356
76141
  ${getInterRoleHandoffRule()}
75357
76142
 
75358
- 1. Recover the review target and focus from the injected task and the \`<handoff-templates>\` brief. If the target is not explicit, ask the planner through the handoff; do not guess a range.
76143
+ 1. Recover the review target and focus from the injected task and the \`<handoff-templates>\` brief. If the target is not explicit, ask the {ENTRY_POINT_ROLE} through the handoff; do not guess a range.
75359
76144
  2. Inspect the target: the diff or commits, the changed files, and the surrounding code they depend on. Read the actual files; do not review from summaries.
75360
76145
  3. Look for correctness bugs, security issues, missing or weak tests, unclear ownership or error handling, dead code, duplication, and type drift. Stay within the stated focus when one is given.
75361
- 4. Label every issue with a severity (\`blocker\`, \`major\`, \`minor\`, \`nit\`) and cite the file and line. Only report what you observed; mark anything unverified as such.
75362
- 5. Follow the injected \`<handoff-templates>\` review report exactly, in its order.
75363
- 6. Hand the report to \`{ENTRY_POINT_ROLE}\` with the normal command, then stop:
76146
+ 4. Audit authentication and authorization for every backend endpoint in review scope. An endpoint is any exported Convex query, mutation, or action, HTTP route, or API handler that the target adds or changes, plus any such endpoint the changed code calls or exposes. For each endpoint, check:
76147
+ - **Authentication:** the endpoint establishes the caller's identity before it reads or writes data, using the shared auth helper the sibling endpoints use. It does not trust a caller-supplied user id, role, or team id as proof of identity.
76148
+ - **Authorization:** the endpoint checks that the authenticated caller may act on the specific resource the request names (for example chatroom membership, ownership, or role) before it returns data or changes state. A login check alone is not sufficient.
76149
+ - **Coverage:** no code path returns or changes data before its check runs. An internal helper that skips checks may be called only from endpoints that already performed them.
76150
+ - **Intent:** an endpoint without a check is acceptable only when the code or the spec states why it is public. Otherwise report it.
76151
+ Report each missing or wrong check as a \`defect\` axis issue. Use severity \`blocker\` when the gap exposes or changes another user's data, and \`major\` otherwise. Cite the endpoint's file and line. List any endpoint in scope that you did not read under \`## Not reviewed\`.
76152
+ 5. Label every issue with a severity (\`blocker\`, \`major\`, \`minor\`, \`nit\`) and cite the file and line. Only report what you observed; mark anything unverified as such.
76153
+ 6. Follow the injected \`<handoff-templates>\` review report exactly, in its order.
76154
+ 7. Hand the report to \`{ENTRY_POINT_ROLE}\` with the normal command, then stop:
75364
76155
 
75365
76156
  \`\`\`bash
75366
76157
  chatroom handoff --chatroom-id="<chatroom-id>" --role="reviewer" --next-role="{ENTRY_POINT_ROLE}"
@@ -75369,7 +76160,7 @@ chatroom handoff --chatroom-id="<chatroom-id>" --role="reviewer" --next-role="{E
75369
76160
 
75370
76161
  // ../../services/backend/prompts/cli/roles/triage.ts
75371
76162
  var TRIAGE_GUIDANCE;
75372
- var init_triage3 = __esm(() => {
76163
+ var init_triage4 = __esm(() => {
75373
76164
  init_sections();
75374
76165
  TRIAGE_GUIDANCE = `## Triage Operating Model
75375
76166
 
@@ -75381,7 +76172,7 @@ ${getInterRoleHandoffRule()}
75381
76172
 
75382
76173
  1. Recover the reported bug from the injected task and chatroom history: the observed behavior, the expected behavior, and any reproduction details. If the expected behavior is not explicit, state the assumption you made.
75383
76174
  2. Trace the relevant code paths with concrete repository paths and symbols. Label every finding \`confirmed\` or \`hypothesis\`. Never present a hypothesis as fact.
75384
- 3. Attempt a focused reproduction only when it is cheap and safe. A focused regression test may be written as evidence. Do not edit implementation files.
76175
+ 3. Attempt a focused reproduction, and when cheap and safe, record the run count, flake rate, and performance baseline. A focused regression test may be written as evidence. Do not edit implementation files.
75385
76176
  4. Write the report using the sections in the injected \`<handoff-templates>\`, in the order given, beginning with the \`## Summary\` section.
75386
76177
  5. Hand the report to \`{ENTRY_POINT_ROLE}\` with the normal command, then stop:
75387
76178
 
@@ -75392,7 +76183,7 @@ chatroom handoff --chatroom-id="<chatroom-id>" --role="triage" --next-role="{ENT
75392
76183
 
75393
76184
  // ../../services/backend/prompts/cli/roles/uiux-engineer.ts
75394
76185
  var UIUX_ENGINEER_GUIDANCE;
75395
- var init_uiux_engineer3 = __esm(() => {
76186
+ var init_uiux_engineer4 = __esm(() => {
75396
76187
  init_sections();
75397
76188
  UIUX_ENGINEER_GUIDANCE = `## UI/UX Engineer Operating Model
75398
76189
 
@@ -75420,7 +76211,7 @@ The handoff must contain every required brief section, repository evidence, chos
75420
76211
 
75421
76212
  // ../../services/backend/prompts/cli/roles/verifier.ts
75422
76213
  var ACHIEVED2, NOT_ACHIEVED2, INCONCLUSIVE2, VERIFIER_GUIDANCE;
75423
- var init_verifier3 = __esm(() => {
76214
+ var init_verifier4 = __esm(() => {
75424
76215
  init_verifier_handoff_templates();
75425
76216
  init_handoff_report_template_body();
75426
76217
  init_sections();
@@ -75466,24 +76257,23 @@ var init_fromContext = __esm(() => {
75466
76257
 
75467
76258
  // ../../services/backend/prompts/cli/roles/fromContext.ts
75468
76259
  var init_fromContext2 = __esm(() => {
75469
- init_architect3();
75470
- init_builder2();
75471
- init_game_asset_designer2();
76260
+ init_architect4();
76261
+ init_builder3();
76262
+ init_game_asset_designer3();
75472
76263
  init_planner2();
75473
- init_researcher2();
75474
- init_reviewer2();
75475
- init_triage3();
75476
- init_uiux_engineer3();
75477
- init_verifier3();
76264
+ init_researcher3();
76265
+ init_reviewer3();
76266
+ init_triage4();
76267
+ init_uiux_engineer4();
76268
+ init_verifier4();
75478
76269
  init_fromContext();
75479
- init_handoff_templates3();
76270
+ init_handoff_templates4();
75480
76271
  });
75481
76272
 
75482
76273
  // ../../services/backend/prompts/teams/duo/prompts/builder.ts
75483
- var init_builder3 = __esm(() => {
75484
- init_builder2();
76274
+ var init_builder4 = __esm(() => {
76275
+ init_builder3();
75485
76276
  });
75486
-
75487
76277
  // ../../services/backend/prompts/teams/duo/prompts/planner.ts
75488
76278
  var init_planner3 = __esm(() => {
75489
76279
  init_planner_guidance_context();
@@ -75492,14 +76282,41 @@ var init_planner3 = __esm(() => {
75492
76282
 
75493
76283
  // ../../services/backend/prompts/teams/duo/prompts/fromContext.ts
75494
76284
  var init_fromContext3 = __esm(() => {
75495
- init_builder3();
76285
+ init_builder4();
75496
76286
  init_planner3();
75497
76287
  });
76288
+ // ../../services/backend/prompts/teams/trio/prompts/builder.ts
76289
+ var init_builder5 = __esm(() => {
76290
+ init_builder3();
76291
+ init_env();
76292
+ });
76293
+
76294
+ // ../../services/backend/prompts/teams/trio/prompts/coordinator.ts
76295
+ var init_coordinator2 = __esm(() => {
76296
+ init_agent_role();
76297
+ init_planner_guidance_context();
76298
+ init_sections();
76299
+ });
76300
+
76301
+ // ../../services/backend/prompts/teams/trio/prompts/specifier.ts
76302
+ var init_specifier2 = __esm(() => {
76303
+ init_planner_guidance_context();
76304
+ init_sections();
76305
+ });
76306
+
76307
+ // ../../services/backend/prompts/teams/trio/prompts/fromContext.ts
76308
+ var init_fromContext4 = __esm(() => {
76309
+ init_builder5();
76310
+ init_coordinator2();
76311
+ init_specifier2();
76312
+ });
75498
76313
  // ../../services/backend/prompts/selector-context.ts
75499
76314
  var init_selector_context = __esm(() => {
76315
+ init_team_presets();
75500
76316
  init_fromContext2();
75501
76317
  init_fromContext3();
75502
76318
  init_fromContext();
76319
+ init_fromContext4();
75503
76320
  });
75504
76321
 
75505
76322
  // ../../services/backend/prompts/sections/role-guidance.ts
@@ -75539,6 +76356,33 @@ var init_templates = __esm(() => {
75539
76356
  ],
75540
76357
  defaultHandoffTarget: "builder"
75541
76358
  },
76359
+ coordinator: {
76360
+ role: "coordinator",
76361
+ title: "Coordinator",
76362
+ description: "You are the team coordinator responsible for understanding what the user wants, owning the plan for the whole task, and routing all work between team roles.",
76363
+ responsibilities: [
76364
+ "Communicate with the user as the single point of contact",
76365
+ "Keep the plan and decisions across the whole task",
76366
+ "Clear research, triage, architecture, UI/UX, and asset gates with the specialists",
76367
+ "Delegate implementation to the specifier as work packages",
76368
+ "Review returned work against the user request",
76369
+ "Deliver the final result to the user"
76370
+ ],
76371
+ defaultHandoffTarget: "specifier"
76372
+ },
76373
+ specifier: {
76374
+ role: "specifier",
76375
+ title: "Specifier",
76376
+ description: "You are the specifier responsible for turning the coordinator's work package into detailed, code-level builder briefs and driving the builder through every build pass; you do not implement code.",
76377
+ responsibilities: [
76378
+ "Inspect the repository to ground the work package",
76379
+ "Split the package into file-level builder slices",
76380
+ "Review each builder slice against the brief and acceptance criteria",
76381
+ "Send rework to the builder with specific feedback",
76382
+ "Report the completed package or blockers to the coordinator"
76383
+ ],
76384
+ defaultHandoffTarget: "builder"
76385
+ },
75542
76386
  architect: {
75543
76387
  role: "architect",
75544
76388
  title: "Architect",
@@ -75732,6 +76576,7 @@ function generateHandoffOutput(params) {
75732
76576
  var init_generator = __esm(() => {
75733
76577
  init_command();
75734
76578
  init_reminder();
76579
+ init_handoff_templates4();
75735
76580
  init_system_prompt();
75736
76581
  init_classification_guide();
75737
76582
  init_commands_reference();
@@ -75748,6 +76593,218 @@ var init_generator = __esm(() => {
75748
76593
  init_review_guidelines();
75749
76594
  });
75750
76595
 
76596
+ // ../shared/src/domain/file-attachment.ts
76597
+ function basenameOf(path2) {
76598
+ return path2.split(PATH_SEPARATOR_PATTERN).pop() ?? "";
76599
+ }
76600
+ function hasForbiddenFilenameCharacter(filename) {
76601
+ return INVALID_FILENAME_CHARACTER_PATTERN.test(filename) || BIDI_CONTROL_CHARACTER_PATTERN.test(filename);
76602
+ }
76603
+ function resolveFileAttachmentType(filename) {
76604
+ const basename7 = basenameOf(filename);
76605
+ const dotIndex = basename7.lastIndexOf(".");
76606
+ if (dotIndex <= 0)
76607
+ return null;
76608
+ const mimeType = EXTENSION_TO_MIME_TYPE.get(basename7.slice(dotIndex).toLowerCase());
76609
+ if (!mimeType)
76610
+ return null;
76611
+ const info = FILE_ATTACHMENT_TYPES[mimeType];
76612
+ return { mimeType, previewKind: info.previewKind, activeContent: info.activeContent };
76613
+ }
76614
+ function isValidAttachmentFilename(filename) {
76615
+ return filename.length > 0 && filename.length <= FILE_ATTACHMENT_MAX_FILENAME_LENGTH && !RESERVED_FILENAME_PATTERN.test(filename) && !hasForbiddenFilenameCharacter(filename);
76616
+ }
76617
+ var FILE_ATTACHMENT_MAX_BYTES, FILE_ATTACHMENT_MAX_PER_HANDOFF = 10, FILE_ATTACHMENT_MAX_FILENAME_LENGTH = 255, FILE_ATTACHMENT_THUMBNAIL_AUTOLOAD_MAX_BYTES, FILE_ATTACHMENT_TYPES, FILE_ATTACHMENT_MIME_TYPES, EXTENSION_TO_MIME_TYPE, INVALID_FILENAME_CHARACTER_PATTERN, BIDI_CONTROL_CHARACTER_PATTERN, PATH_SEPARATOR_PATTERN, RESERVED_FILENAME_PATTERN;
76618
+ var init_file_attachment = __esm(() => {
76619
+ FILE_ATTACHMENT_MAX_BYTES = 10 * 1024 * 1024;
76620
+ FILE_ATTACHMENT_THUMBNAIL_AUTOLOAD_MAX_BYTES = 2 * 1024 * 1024;
76621
+ FILE_ATTACHMENT_TYPES = {
76622
+ "image/png": { extensions: [".png"], previewKind: "image", activeContent: false },
76623
+ "image/jpeg": { extensions: [".jpg", ".jpeg"], previewKind: "image", activeContent: false },
76624
+ "image/gif": { extensions: [".gif"], previewKind: "image", activeContent: false },
76625
+ "image/webp": { extensions: [".webp"], previewKind: "image", activeContent: false },
76626
+ "image/svg+xml": { extensions: [".svg"], previewKind: "image", activeContent: true },
76627
+ "application/pdf": { extensions: [".pdf"], previewKind: "pdf", activeContent: false },
76628
+ "text/plain": { extensions: [".txt", ".log"], previewKind: "text", activeContent: false },
76629
+ "text/markdown": { extensions: [".md"], previewKind: "markdown", activeContent: false },
76630
+ "text/csv": { extensions: [".csv"], previewKind: "text", activeContent: false },
76631
+ "application/json": { extensions: [".json"], previewKind: "text", activeContent: false },
76632
+ "text/html": { extensions: [".html", ".htm"], previewKind: "text", activeContent: true },
76633
+ "application/zip": { extensions: [".zip"], previewKind: "download", activeContent: false }
76634
+ };
76635
+ FILE_ATTACHMENT_MIME_TYPES = Object.keys(FILE_ATTACHMENT_TYPES);
76636
+ EXTENSION_TO_MIME_TYPE = new Map(Object.entries(FILE_ATTACHMENT_TYPES).flatMap(([mimeType, info]) => info.extensions.map((extension2) => [
76637
+ extension2.toLowerCase(),
76638
+ mimeType
76639
+ ])));
76640
+ INVALID_FILENAME_CHARACTER_PATTERN = /[/\\\u0000-\u001f\u007f]/;
76641
+ BIDI_CONTROL_CHARACTER_PATTERN = /[\u061c\u200e\u200f\u202a-\u202e\u2066-\u2069]/;
76642
+ PATH_SEPARATOR_PATTERN = /[/\\]/;
76643
+ RESERVED_FILENAME_PATTERN = /^\.{1,2}$/;
76644
+ });
76645
+
76646
+ // src/commands/handoff/deps.ts
76647
+ var FileAttachmentUploadError;
76648
+ var init_deps3 = __esm(() => {
76649
+ FileAttachmentUploadError = class FileAttachmentUploadError extends Error {
76650
+ code;
76651
+ httpStatus;
76652
+ constructor(args2) {
76653
+ super(args2.message);
76654
+ this.name = "FileAttachmentUploadError";
76655
+ this.code = args2.code;
76656
+ this.httpStatus = args2.httpStatus;
76657
+ }
76658
+ };
76659
+ });
76660
+
76661
+ // src/commands/handoff/attachments.ts
76662
+ import { readFile as readFile12, stat as stat8 } from "node:fs/promises";
76663
+ import { basename as basename7 } from "node:path";
76664
+ function attachmentInvalid(path2, reason) {
76665
+ return { _tag: "AttachmentInvalid", path: path2, reason };
76666
+ }
76667
+ function uploadFailed(filename, cause) {
76668
+ if (cause instanceof FileAttachmentUploadError) {
76669
+ return {
76670
+ _tag: "AttachmentUploadFailed",
76671
+ filename,
76672
+ code: cause.code,
76673
+ message: cause.message
76674
+ };
76675
+ }
76676
+ return {
76677
+ _tag: "AttachmentUploadFailed",
76678
+ filename,
76679
+ code: "UPLOAD_FAILED",
76680
+ message: cause instanceof Error ? cause.message : String(cause)
76681
+ };
76682
+ }
76683
+ function validateFileStats(path2, stats) {
76684
+ if (!stats.isFile()) {
76685
+ return exports_Effect.fail(attachmentInvalid(path2, "not a regular file"));
76686
+ }
76687
+ if (stats.size <= 0) {
76688
+ return exports_Effect.fail(attachmentInvalid(path2, "file is empty"));
76689
+ }
76690
+ if (stats.size > FILE_ATTACHMENT_MAX_BYTES) {
76691
+ return exports_Effect.fail(attachmentInvalid(path2, `file exceeds the ${FILE_ATTACHMENT_MAX_BYTES}-byte limit`));
76692
+ }
76693
+ return exports_Effect.void;
76694
+ }
76695
+ function resolveAttachmentType(path2, filename) {
76696
+ const type = resolveFileAttachmentType(filename);
76697
+ if (!type) {
76698
+ return exports_Effect.fail(attachmentInvalid(path2, "file type is not allowed"));
76699
+ }
76700
+ if (!isValidAttachmentFilename(filename)) {
76701
+ return exports_Effect.fail(attachmentInvalid(path2, "filename is not valid"));
76702
+ }
76703
+ return exports_Effect.succeed(type.mimeType);
76704
+ }
76705
+ function prepareOneAttachment(path2) {
76706
+ return exports_Effect.gen(function* () {
76707
+ const filename = basename7(path2);
76708
+ const stats = yield* exports_Effect.tryPromise({
76709
+ try: () => stat8(path2),
76710
+ catch: () => attachmentInvalid(path2, "file does not exist or cannot be read")
76711
+ });
76712
+ yield* validateFileStats(path2, stats);
76713
+ const mimeType = yield* resolveAttachmentType(path2, filename);
76714
+ return { path: path2, filename, sizeBytes: stats.size, mimeType };
76715
+ });
76716
+ }
76717
+ function validateAttachmentEnvelope(paths, nextRole) {
76718
+ const normalizedNextRole = nextRole.toLowerCase();
76719
+ if (normalizedNextRole !== "user") {
76720
+ return exports_Effect.fail({ _tag: "AttachmentsRequireUserTarget" });
76721
+ }
76722
+ if (paths.length > FILE_ATTACHMENT_MAX_PER_HANDOFF) {
76723
+ return exports_Effect.fail({
76724
+ _tag: "AttachmentLimitExceeded",
76725
+ max: FILE_ATTACHMENT_MAX_PER_HANDOFF,
76726
+ count: paths.length
76727
+ });
76728
+ }
76729
+ return exports_Effect.void;
76730
+ }
76731
+ function prepareHandoffAttachments(paths, nextRole) {
76732
+ return exports_Effect.gen(function* () {
76733
+ if (paths.length === 0)
76734
+ return [];
76735
+ yield* validateAttachmentEnvelope(paths, nextRole);
76736
+ const prepared = [];
76737
+ for (const path2 of paths) {
76738
+ prepared.push(yield* prepareOneAttachment(path2));
76739
+ }
76740
+ return prepared;
76741
+ });
76742
+ }
76743
+ function discardHandoffAttachments(uploader, sessionId, attachmentIds) {
76744
+ if (attachmentIds.length === 0)
76745
+ return exports_Effect.void;
76746
+ return exports_Effect.tryPromise({
76747
+ try: () => uploader.discardUploads({ sessionId, attachmentIds: [...attachmentIds] }),
76748
+ catch: () => {
76749
+ return;
76750
+ }
76751
+ }).pipe(exports_Effect.catch(() => exports_Effect.void));
76752
+ }
76753
+ function uploadOneFile(uploader, args2, file2) {
76754
+ return exports_Effect.gen(function* () {
76755
+ const bytes = yield* exports_Effect.tryPromise({
76756
+ try: () => readFile12(file2.path),
76757
+ catch: (cause) => uploadFailed(file2.filename, cause)
76758
+ });
76759
+ if (bytes.length > FILE_ATTACHMENT_MAX_BYTES) {
76760
+ return yield* exports_Effect.fail(attachmentInvalid(file2.path, `file exceeds the ${FILE_ATTACHMENT_MAX_BYTES}-byte limit`));
76761
+ }
76762
+ if (bytes.length !== file2.sizeBytes) {
76763
+ return yield* exports_Effect.fail(attachmentInvalid(file2.path, "file changed while it was being read"));
76764
+ }
76765
+ const begun = yield* exports_Effect.tryPromise({
76766
+ try: () => uploader.beginUpload({
76767
+ sessionId: args2.sessionId,
76768
+ chatroomId: args2.chatroomId,
76769
+ senderRole: args2.senderRole,
76770
+ filename: file2.filename,
76771
+ sizeBytes: bytes.length
76772
+ }),
76773
+ catch: (cause) => uploadFailed(file2.filename, cause)
76774
+ });
76775
+ yield* exports_Effect.tryPromise({
76776
+ try: () => uploader.uploadBytes({
76777
+ sessionId: args2.sessionId,
76778
+ attachmentId: begun.attachmentId,
76779
+ uploadUrl: begun.uploadUrl,
76780
+ bytes
76781
+ }),
76782
+ catch: (cause) => uploadFailed(file2.filename, cause)
76783
+ }).pipe(exports_Effect.tapError(() => discardHandoffAttachments(uploader, args2.sessionId, [begun.attachmentId])));
76784
+ return begun.attachmentId;
76785
+ });
76786
+ }
76787
+ function uploadHandoffAttachments(uploader, args2) {
76788
+ return exports_Effect.gen(function* () {
76789
+ const uploadedIds = [];
76790
+ const uploadAll = exports_Effect.gen(function* () {
76791
+ for (const file2 of args2.files) {
76792
+ uploadedIds.push(yield* uploadOneFile(uploader, args2, file2));
76793
+ }
76794
+ });
76795
+ yield* uploadAll.pipe(exports_Effect.catch((error51) => exports_Effect.gen(function* () {
76796
+ yield* discardHandoffAttachments(uploader, args2.sessionId, uploadedIds);
76797
+ return yield* exports_Effect.fail(error51);
76798
+ })));
76799
+ return uploadedIds;
76800
+ });
76801
+ }
76802
+ var init_attachments = __esm(() => {
76803
+ init_file_attachment();
76804
+ init_dist();
76805
+ init_deps3();
76806
+ });
76807
+
75751
76808
  // src/infrastructure/cli-gateway/local-handoff-gateway.ts
75752
76809
  function createLocalHandoffGateway() {
75753
76810
  return {
@@ -75781,6 +76838,113 @@ var init_create_convex_command_deps = __esm(() => {
75781
76838
  init_client2();
75782
76839
  });
75783
76840
 
76841
+ // src/infrastructure/file-attachments/convex-file-attachment-uploader.ts
76842
+ function createConvexFileAttachmentUploader(backend2, fetchFn = fetch) {
76843
+ const backendUrl = getConvexUrl();
76844
+ return {
76845
+ beginUpload: async (args2) => {
76846
+ const result3 = await backend2.mutation(api.fileAttachments.beginUpload, args2);
76847
+ return {
76848
+ attachmentId: result3.attachmentId,
76849
+ uploadUrl: result3.uploadUrl
76850
+ };
76851
+ },
76852
+ uploadBytes: async ({ sessionId, attachmentId, uploadUrl, bytes }) => {
76853
+ assertUploadUrlAllowed(uploadUrl, backendUrl);
76854
+ const response = await fetchFn(uploadUrl, {
76855
+ method: "POST",
76856
+ headers: {
76857
+ Authorization: `Bearer ${sessionId}`,
76858
+ [ATTACHMENT_ID_HEADER]: attachmentId,
76859
+ "Content-Type": "application/octet-stream",
76860
+ "Content-Length": String(bytes.byteLength)
76861
+ },
76862
+ body: bytes
76863
+ });
76864
+ if (response.ok)
76865
+ return;
76866
+ const { code: code2, message } = await readUploadError(response);
76867
+ throw new FileAttachmentUploadError({ code: code2, message, httpStatus: response.status });
76868
+ },
76869
+ discardUploads: async ({ sessionId, attachmentIds }) => {
76870
+ await backend2.mutation(api.fileAttachments.discardUploads, { sessionId, attachmentIds });
76871
+ }
76872
+ };
76873
+ }
76874
+ function rejectedUploadUrl(message) {
76875
+ return new FileAttachmentUploadError({
76876
+ code: REJECTED_UPLOAD_URL_CODE,
76877
+ message,
76878
+ httpStatus: 0
76879
+ });
76880
+ }
76881
+ function isLoopbackHostname(hostname5) {
76882
+ return hostname5 === "localhost" || hostname5 === "127.0.0.1" || hostname5 === "[::1]";
76883
+ }
76884
+ function isConvexLocalSitePort(uploadPort, backendPort) {
76885
+ return uploadPort !== "" && backendPort !== "" && Number(uploadPort) === Number(backendPort) + 1;
76886
+ }
76887
+ function parseUploadUrl(uploadUrl, backendUrl) {
76888
+ try {
76889
+ return { upload: new URL(uploadUrl), backend: new URL(backendUrl) };
76890
+ } catch {
76891
+ throw rejectedUploadUrl("Upload URL is not a valid URL");
76892
+ }
76893
+ }
76894
+ function isSupportedUploadProtocol(protocol4) {
76895
+ return protocol4 === "http:" || protocol4 === "https:";
76896
+ }
76897
+ function requiresHttps(upload) {
76898
+ return upload.protocol === "http:" && !isLoopbackHostname(upload.hostname);
76899
+ }
76900
+ function assertUploadProtocol(upload) {
76901
+ if (!isSupportedUploadProtocol(upload.protocol)) {
76902
+ throw rejectedUploadUrl(`Upload URL uses an unsupported protocol: ${upload.protocol}`);
76903
+ }
76904
+ if (requiresHttps(upload)) {
76905
+ throw rejectedUploadUrl("Upload URL must use HTTPS unless it targets loopback");
76906
+ }
76907
+ }
76908
+ function isConvexLocalSiteUrl(upload, backend2) {
76909
+ return isLoopbackHostname(upload.hostname) && isLoopbackHostname(backend2.hostname) && isConvexLocalSitePort(upload.port, backend2.port);
76910
+ }
76911
+ function isConvexCloudSiteUrl(upload, backend2) {
76912
+ if (backend2.protocol !== "https:" || backend2.port !== "")
76913
+ return false;
76914
+ if (!backend2.hostname.endsWith(CONVEX_CLOUD_SUFFIX))
76915
+ return false;
76916
+ const siteOrigin = `https://${backend2.hostname.slice(0, -CONVEX_CLOUD_SUFFIX.length)}${CONVEX_SITE_SUFFIX}`;
76917
+ return upload.origin === siteOrigin;
76918
+ }
76919
+ function assertUploadUrlAllowed(uploadUrl, backendUrl) {
76920
+ const { upload, backend: backend2 } = parseUploadUrl(uploadUrl, backendUrl);
76921
+ assertUploadProtocol(upload);
76922
+ if (upload.origin === backend2.origin || isConvexLocalSiteUrl(upload, backend2) || isConvexCloudSiteUrl(upload, backend2)) {
76923
+ return;
76924
+ }
76925
+ throw rejectedUploadUrl(`Upload URL origin ${upload.origin} does not match the configured backend ${backend2.origin}`);
76926
+ }
76927
+ async function readUploadError(response) {
76928
+ try {
76929
+ const body = await response.json();
76930
+ return {
76931
+ code: typeof body.code === "string" ? body.code : DEFAULT_UPLOAD_ERROR_CODE,
76932
+ message: typeof body.message === "string" ? body.message : `Upload failed with status ${response.status}`
76933
+ };
76934
+ } catch {
76935
+ return {
76936
+ code: DEFAULT_UPLOAD_ERROR_CODE,
76937
+ message: `Upload failed with status ${response.status}`
76938
+ };
76939
+ }
76940
+ }
76941
+ var ATTACHMENT_ID_HEADER = "X-Chatroom-Attachment-Id", DEFAULT_UPLOAD_ERROR_CODE = "FILE_ATTACHMENT_UPLOAD_FAILED", REJECTED_UPLOAD_URL_CODE = "FILE_ATTACHMENT_UPLOAD_URL_REJECTED", CONVEX_CLOUD_SUFFIX = ".convex.cloud", CONVEX_SITE_SUFFIX = ".convex.site";
76942
+ var init_convex_file_attachment_uploader = __esm(() => {
76943
+ init_api3();
76944
+ init_deps3();
76945
+ init_client2();
76946
+ });
76947
+
75784
76948
  // src/commands/handoff/index.ts
75785
76949
  var exports_handoff = {};
75786
76950
  __export(exports_handoff, {
@@ -75789,106 +76953,222 @@ __export(exports_handoff, {
75789
76953
  });
75790
76954
  async function createDefaultDeps10() {
75791
76955
  const deps = await createConvexCommandDeps();
75792
- return { backend: deps.backend, gateway: createLocalHandoffGateway(), session: deps.session };
76956
+ return {
76957
+ backend: deps.backend,
76958
+ gateway: createLocalHandoffGateway(),
76959
+ session: deps.session,
76960
+ attachmentUploader: createConvexFileAttachmentUploader(deps.backend)
76961
+ };
75793
76962
  }
75794
- function handleHandoffError(err2) {
75795
- return exports_Effect.sync(() => {
75796
- if (err2._tag === "NotAuthenticated") {
76963
+ function toHandoffFailure(cause) {
76964
+ let errorData;
76965
+ if (cause instanceof ConvexError) {
76966
+ errorData = cause.data;
76967
+ } else if (cause instanceof LocalDaemonServerError && cause.details) {
76968
+ errorData = cause.details;
76969
+ }
76970
+ return { _tag: "HandoffFailed", cause, errorData };
76971
+ }
76972
+ function callHandoffGateway(gateway, request3) {
76973
+ return exports_Effect.tryPromise({
76974
+ try: () => gateway(request3),
76975
+ catch: (cause) => cause instanceof Error ? cause : new Error(String(cause))
76976
+ }).pipe(exports_Effect.mapError(toHandoffFailure));
76977
+ }
76978
+ function discardAfterFailedHandoff(uploader, sessionId, attachedFileIds) {
76979
+ if (!uploader || !attachedFileIds || attachedFileIds.length === 0)
76980
+ return exports_Effect.void;
76981
+ return discardHandoffAttachments(uploader, sessionId, attachedFileIds);
76982
+ }
76983
+ function performHandoff(args2) {
76984
+ return exports_Effect.gen(function* () {
76985
+ const result3 = yield* callHandoffGateway(args2.gateway, args2.request);
76986
+ if (!result3.success && result3.error) {
76987
+ return yield* exports_Effect.fail({
76988
+ _tag: "HandoffRejected",
76989
+ error: result3.error
76990
+ });
76991
+ }
76992
+ return result3;
76993
+ }).pipe(exports_Effect.catch((error51) => exports_Effect.gen(function* () {
76994
+ yield* discardAfterFailedHandoff(args2.uploader, args2.sessionId, args2.attachedFileIds);
76995
+ return yield* exports_Effect.fail(error51);
76996
+ })));
76997
+ }
76998
+ function uploadHandoffFiles(uploader, args2) {
76999
+ return exports_Effect.gen(function* () {
77000
+ if (args2.attachFiles.length === 0)
77001
+ return;
77002
+ if (!uploader) {
77003
+ return yield* exports_Effect.fail({
77004
+ _tag: "AttachmentUploadFailed",
77005
+ filename: "",
77006
+ code: "UPLOAD_UNAVAILABLE",
77007
+ message: "File attachments are not available in this environment"
77008
+ });
77009
+ }
77010
+ const files = yield* prepareHandoffAttachments(args2.attachFiles, args2.nextRole);
77011
+ return yield* uploadHandoffAttachments(uploader, {
77012
+ sessionId: args2.sessionId,
77013
+ chatroomId: args2.chatroomId,
77014
+ senderRole: args2.senderRole,
77015
+ files
77016
+ });
77017
+ });
77018
+ }
77019
+ function handleSessionError(err2) {
77020
+ switch (err2._tag) {
77021
+ case "NotAuthenticated":
75797
77022
  formatAuthError(err2.convexUrl, err2.otherUrls);
75798
- process.exit(1);
75799
- } else if (err2._tag === "InvalidChatroomId") {
77023
+ return true;
77024
+ case "InvalidChatroomId":
75800
77025
  formatChatroomIdError(err2.id);
75801
- process.exit(1);
75802
- } else if (err2._tag === "HandoffFailed") {
75803
- console.error(`
75804
- ❌ ERROR: Handoff failed`);
75805
- if (err2.errorData) {
75806
- console.error(`
75807
- ${err2.errorData.message || "An unexpected error occurred"}`);
75808
- if (process.env.CHATROOM_DEBUG === "true") {
75809
- console.error(`
77026
+ return true;
77027
+ default:
77028
+ return false;
77029
+ }
77030
+ }
77031
+ function printDebugInfo(value2) {
77032
+ if (process.env.CHATROOM_DEBUG !== "true")
77033
+ return;
77034
+ console.error(`
75810
77035
  \uD83D\uDD0D Debug Info:`);
75811
- console.error(JSON.stringify(err2.errorData, null, 2));
75812
- }
75813
- if (err2.errorData.code === "AUTH_FAILED") {
75814
- console.error(`
77036
+ console.error(value2);
77037
+ }
77038
+ function printHandoffFailureHint(code2) {
77039
+ if (code2 === "AUTH_FAILED") {
77040
+ console.error(`
75815
77041
  \uD83D\uDCA1 Try authenticating again:`);
75816
- console.error(` chatroom auth login`);
75817
- } else if (err2.errorData.code === "INVALID_ROLE") {
75818
- console.error(`
77042
+ console.error(` chatroom auth login`);
77043
+ } else if (code2 === "INVALID_ROLE") {
77044
+ console.error(`
75819
77045
  \uD83D\uDCA1 Check your team configuration and use a valid role`);
75820
- }
75821
- } else {
75822
- console.error(`
77046
+ }
77047
+ }
77048
+ function printHandoffFailed(err2) {
77049
+ console.error(`
77050
+ ❌ ERROR: Handoff failed`);
77051
+ if (err2.errorData) {
77052
+ console.error(`
77053
+ ${err2.errorData.message || "An unexpected error occurred"}`);
77054
+ printDebugInfo(JSON.stringify(err2.errorData, null, 2));
77055
+ printHandoffFailureHint(err2.errorData.code);
77056
+ } else {
77057
+ console.error(`
75823
77058
  ${err2.cause instanceof Error ? err2.cause.message : String(err2.cause)}`);
75824
- if (process.env.CHATROOM_DEBUG === "true") {
75825
- console.error(`
75826
- \uD83D\uDD0D Debug Info:`);
75827
- console.error(err2.cause);
75828
- }
75829
- }
75830
- console.error(`
77059
+ printDebugInfo(err2.cause);
77060
+ }
77061
+ console.error(`
75831
77062
  \uD83D\uDCDA Need help? Check the docs or run:`);
75832
- console.error(` chatroom handoff --help`);
75833
- process.exit(1);
75834
- } else if (err2._tag === "HandoffRejected") {
75835
- console.error(`
75836
- ❌ ERROR: ${err2.error.message}`);
75837
- if (err2.error.code === "INVALID_TARGET_ROLE" && err2.error.suggestedTargets) {
75838
- console.error(`
77063
+ console.error(` chatroom handoff --help`);
77064
+ }
77065
+ function printSuggestedTargets(targets) {
77066
+ console.error(`
75839
77067
  \uD83D\uDCCB Available handoff targets for this team:`);
75840
- for (const target of err2.error.suggestedTargets) {
75841
- console.error(` • ${target}`);
75842
- }
75843
- console.error(`
77068
+ for (const target of targets) {
77069
+ console.error(` • ${target}`);
77070
+ }
77071
+ console.error(`
75844
77072
  \uD83D\uDCA1 Check your team's handoff rules in the system prompt for valid paths.`);
75845
- } else if (err2.error.suggestedTarget) {
75846
- console.error(`
77073
+ }
77074
+ function printSuggestedTarget(target) {
77075
+ console.error(`
75847
77076
  \uD83D\uDCA1 Try this instead:`);
75848
- console.error("```");
75849
- console.error(` chatroom handoff --next-role=${err2.error.suggestedTarget} ...`);
75850
- console.error("```");
75851
- }
77077
+ console.error("```");
77078
+ console.error(` chatroom handoff --next-role=${target} ...`);
77079
+ console.error("```");
77080
+ }
77081
+ function printHandoffRejected(err2) {
77082
+ console.error(`
77083
+ ❌ ERROR: ${err2.error.message}`);
77084
+ if (err2.error.code === "INVALID_TARGET_ROLE" && err2.error.suggestedTargets) {
77085
+ printSuggestedTargets(err2.error.suggestedTargets);
77086
+ } else if (err2.error.suggestedTarget) {
77087
+ printSuggestedTarget(err2.error.suggestedTarget);
77088
+ }
77089
+ }
77090
+ function printAttachmentTargetFailure(err2) {
77091
+ if (err2._tag === "AttachmentsRequireUserTarget") {
77092
+ console.error(`
77093
+ ❌ ERROR: --attach-file can only be used with --next-role=user. Agent-to-agent handoffs cannot carry files.`);
77094
+ return;
77095
+ }
77096
+ console.error(`
77097
+ ❌ ERROR: Too many files. At most ${err2.max} files can be attached to one handoff (got ${err2.count}).`);
77098
+ }
77099
+ function printAttachmentUploadFailure(err2) {
77100
+ if (err2._tag === "AttachmentInvalid") {
77101
+ console.error(`
77102
+ ❌ ERROR: Cannot attach "${err2.path}": ${err2.reason}`);
77103
+ return;
77104
+ }
77105
+ console.error(`
77106
+ ❌ ERROR: Failed to upload "${err2.filename}": ${err2.message}`);
77107
+ console.error(` Code: ${err2.code}`);
77108
+ }
77109
+ function printAttachmentFailure(err2) {
77110
+ if (err2._tag === "AttachmentsRequireUserTarget" || err2._tag === "AttachmentLimitExceeded") {
77111
+ printAttachmentTargetFailure(err2);
77112
+ return;
77113
+ }
77114
+ printAttachmentUploadFailure(err2);
77115
+ }
77116
+ function handleHandoffError(err2) {
77117
+ return exports_Effect.sync(() => {
77118
+ if (handleSessionError(err2)) {
75852
77119
  process.exit(1);
77120
+ return;
77121
+ }
77122
+ switch (err2._tag) {
77123
+ case "HandoffFailed":
77124
+ printHandoffFailed(err2);
77125
+ break;
77126
+ case "HandoffRejected":
77127
+ printHandoffRejected(err2);
77128
+ break;
77129
+ default:
77130
+ printAttachmentFailure(err2);
77131
+ break;
75853
77132
  }
77133
+ process.exit(1);
75854
77134
  });
75855
77135
  }
75856
77136
  async function handoff(chatroomId, options, deps) {
75857
77137
  const d = deps ?? await createDefaultDeps10();
75858
77138
  const layer = commandServicesLayerFromDeps(d);
75859
- await exports_Effect.runPromise(handoffEffect(chatroomId, options).pipe(exports_Effect.catch((err2) => handleHandoffError(err2)), exports_Effect.provide(layer)));
77139
+ await exports_Effect.runPromise(handoffEffect(chatroomId, options, d.attachmentUploader).pipe(exports_Effect.catch((err2) => handleHandoffError(err2)), exports_Effect.provide(layer)));
75860
77140
  }
75861
- var handoffEffect = (chatroomId, options) => exports_Effect.gen(function* () {
77141
+ var handoffEffect = (chatroomId, options, attachmentUploader) => exports_Effect.gen(function* () {
75862
77142
  const session2 = yield* SessionService;
75863
77143
  const gateway = yield* CliGatewayService;
75864
- const { role, message, nextRole } = options;
77144
+ const { role, message, nextRole, attachFiles = [] } = options;
75865
77145
  const sessionId = yield* requireSessionForChatroomEffect({ chatroomId });
75866
- const result3 = yield* exports_Effect.tryPromise({
75867
- try: () => gateway.handoff({
77146
+ const attachedFileIds = yield* uploadHandoffFiles(attachmentUploader, {
77147
+ sessionId,
77148
+ chatroomId,
77149
+ senderRole: role,
77150
+ nextRole,
77151
+ attachFiles
77152
+ });
77153
+ const result3 = yield* performHandoff({
77154
+ gateway: gateway.handoff,
77155
+ request: {
75868
77156
  sessionId,
75869
77157
  chatroomId,
75870
77158
  senderRole: role,
75871
77159
  content: message,
75872
- targetRole: nextRole
75873
- }),
75874
- catch: (cause) => cause instanceof Error ? cause : new Error(String(cause))
75875
- }).pipe(exports_Effect.mapError((cause) => {
75876
- let errorData;
75877
- if (cause instanceof ConvexError) {
75878
- errorData = cause.data;
75879
- } else if (cause instanceof LocalDaemonServerError && cause.details) {
75880
- errorData = cause.details;
75881
- }
75882
- return { _tag: "HandoffFailed", cause, errorData };
75883
- }));
75884
- if (!result3.success && result3.error) {
75885
- return yield* exports_Effect.fail({
75886
- _tag: "HandoffRejected",
75887
- error: result3.error
75888
- });
75889
- }
77160
+ targetRole: nextRole,
77161
+ ...attachedFileIds ? { attachedFileIds } : {}
77162
+ },
77163
+ uploader: attachmentUploader,
77164
+ sessionId,
77165
+ attachedFileIds
77166
+ });
75890
77167
  const convexUrl = yield* session2.getConvexUrl();
75891
77168
  yield* exports_Effect.sync(() => {
77169
+ if (result3.attachmentsDiscarded) {
77170
+ console.error("Warning: this handoff was already recorded for this message, so the attached files were not delivered. " + "Send the files in a new handoff to user after the current one is complete.");
77171
+ }
75892
77172
  console.log(generateHandoffOutput({
75893
77173
  role,
75894
77174
  nextRole,
@@ -75902,9 +77182,11 @@ var init_handoff = __esm(() => {
75902
77182
  init_generator();
75903
77183
  init_values();
75904
77184
  init_dist();
77185
+ init_attachments();
75905
77186
  init_local_daemon();
75906
77187
  init_local_handoff_gateway();
75907
77188
  init_create_convex_command_deps();
77189
+ init_convex_file_attachment_uploader();
75908
77190
  init_services();
75909
77191
  init_error_formatting();
75910
77192
  });
@@ -84266,7 +85548,7 @@ var init_parse_skill_file = __esm(() => {
84266
85548
  });
84267
85549
 
84268
85550
  // src/infrastructure/external-skills/discover-external-skills.ts
84269
- import { lstat as lstat2, readdir as readdir2, readFile as readFile13, realpath, stat as stat8 } from "node:fs/promises";
85551
+ import { lstat as lstat2, readdir as readdir2, readFile as readFile14, realpath, stat as stat9 } from "node:fs/promises";
84270
85552
  import os from "node:os";
84271
85553
  import { join as join22 } from "node:path";
84272
85554
  function errorCode(err2) {
@@ -84341,7 +85623,7 @@ async function scanEntry(entry, sourcePath, state) {
84341
85623
  }
84342
85624
  async function isSkillCandidate(sourcePath, issues) {
84343
85625
  try {
84344
- if (!(await stat8(sourcePath)).isDirectory())
85626
+ if (!(await stat9(sourcePath)).isDirectory())
84345
85627
  return false;
84346
85628
  } catch (err2) {
84347
85629
  issues.push(issue2(sourcePath, "unreadable", errorCode(err2)));
@@ -84349,7 +85631,7 @@ async function isSkillCandidate(sourcePath, issues) {
84349
85631
  }
84350
85632
  const skillPath = join22(sourcePath, SKILL_FILE_NAME);
84351
85633
  try {
84352
- const skillStat = await stat8(skillPath);
85634
+ const skillStat = await stat9(skillPath);
84353
85635
  if (!skillStat.isFile())
84354
85636
  return false;
84355
85637
  if (skillStat.size > MAX_SKILL_FILE_BYTES) {
@@ -84374,7 +85656,7 @@ async function isSymlink2(path2) {
84374
85656
  }
84375
85657
  async function readSkillFile(sourcePath, issues) {
84376
85658
  try {
84377
- return await readFile13(join22(sourcePath, SKILL_FILE_NAME), "utf8");
85659
+ return await readFile14(join22(sourcePath, SKILL_FILE_NAME), "utf8");
84378
85660
  } catch (err2) {
84379
85661
  issues.push(issue2(sourcePath, "unreadable", errorCode(err2)));
84380
85662
  return;
@@ -86865,7 +88147,7 @@ var init_orphan_tracker = __esm(() => {
86865
88147
  });
86866
88148
 
86867
88149
  // src/daemon/entry/handlers/process/output-store.ts
86868
- import { appendFile as appendFile2, mkdir as mkdir10, readFile as readFile14, rm as rm3 } from "node:fs/promises";
88150
+ import { appendFile as appendFile2, mkdir as mkdir10, readFile as readFile15, rm as rm3 } from "node:fs/promises";
86869
88151
  import { tmpdir } from "node:os";
86870
88152
  import { join as join25 } from "node:path";
86871
88153
 
@@ -86898,7 +88180,7 @@ class TempFileOutputStore {
86898
88180
  async getLastNLines(maxLines) {
86899
88181
  let source;
86900
88182
  try {
86901
- source = await readFile14(this.state.filePath, "utf-8");
88183
+ source = await readFile15(this.state.filePath, "utf-8");
86902
88184
  } catch {
86903
88185
  source = this.state.inMemory;
86904
88186
  }
@@ -86915,7 +88197,7 @@ class TempFileOutputStore {
86915
88197
  }
86916
88198
  async getFullOutput() {
86917
88199
  try {
86918
- return await readFile14(this.state.filePath, "utf-8");
88200
+ return await readFile15(this.state.filePath, "utf-8");
86919
88201
  } catch {
86920
88202
  return this.state.inMemory;
86921
88203
  }
@@ -88545,7 +89827,7 @@ var init_workspace_visibility_policy = __esm(() => {
88545
89827
 
88546
89828
  // src/infrastructure/services/workspace/workspace-ignore.ts
88547
89829
  import { promises as fsPromises } from "node:fs";
88548
- import { readFile as readFile15 } from "node:fs/promises";
89830
+ import { readFile as readFile16 } from "node:fs/promises";
88549
89831
  import { homedir as homedir11 } from "node:os";
88550
89832
  import path2 from "node:path";
88551
89833
  function normalizeRelativePath(relativePath) {
@@ -88610,7 +89892,7 @@ async function loadGitExtraExcludeRuleSets(rootDir) {
88610
89892
  }
88611
89893
  async function readIgnoreFile(filePath) {
88612
89894
  try {
88613
- return await readFile15(filePath, "utf-8");
89895
+ return await readFile16(filePath, "utf-8");
88614
89896
  } catch {
88615
89897
  return null;
88616
89898
  }
@@ -89582,7 +90864,7 @@ var init_git_workspace_hierarchy = __esm(() => {
89582
90864
  });
89583
90865
 
89584
90866
  // ../../node_modules/.pnpm/readdirp@5.1.1/node_modules/readdirp/index.js
89585
- import { lstat as lstat3, readdir as readdir3, realpath as realpath2, stat as stat9 } from "node:fs/promises";
90867
+ import { lstat as lstat3, readdir as readdir3, realpath as realpath2, stat as stat10 } from "node:fs/promises";
89586
90868
  import { join as pjoin, resolve as presolve, sep as psep } from "node:path";
89587
90869
  import { Readable } from "node:stream";
89588
90870
  function readdirp(root, options = {}) {
@@ -89679,7 +90961,7 @@ var init_readdirp = __esm(() => {
89679
90961
  const type = opts.type ?? defaultOptions.type;
89680
90962
  this._fileFilter = normalizeFilter(opts.fileFilter);
89681
90963
  this._directoryFilter = normalizeFilter(opts.directoryFilter);
89682
- const statMethod = opts.lstat ? lstat3 : stat9;
90964
+ const statMethod = opts.lstat ? lstat3 : stat10;
89683
90965
  if (wantBigintFsStats) {
89684
90966
  this._stat = (path5) => statMethod(path5, { bigint: true });
89685
90967
  } else {
@@ -89767,9 +91049,9 @@ var init_readdirp = __esm(() => {
89767
91049
  return { files, depth, path: path5 };
89768
91050
  }
89769
91051
  _formatEntry(dirent, path5) {
89770
- const basename7 = this._isDirent ? dirent.name : dirent;
89771
- const fullPath = pjoin(path5, basename7);
89772
- const entry = { path: fullPath.slice(this._relStart), fullPath, basename: basename7 };
91052
+ const basename8 = this._isDirent ? dirent.name : dirent;
91053
+ const fullPath = pjoin(path5, basename8);
91054
+ const entry = { path: fullPath.slice(this._relStart), fullPath, basename: basename8 };
89773
91055
  if (this._isDirent) {
89774
91056
  entry.dirent = dirent;
89775
91057
  return entry;
@@ -89834,7 +91116,7 @@ var init_readdirp = __esm(() => {
89834
91116
 
89835
91117
  // ../../node_modules/.pnpm/chokidar@5.0.0/node_modules/chokidar/handler.js
89836
91118
  import { watch as fs_watch, unwatchFile, watchFile } from "node:fs";
89837
- import { realpath as fsrealpath, lstat as lstat4, open, stat as stat10 } from "node:fs/promises";
91119
+ import { realpath as fsrealpath, lstat as lstat4, open, stat as stat11 } from "node:fs/promises";
89838
91120
  import { type as osType } from "node:os";
89839
91121
  import * as sp from "node:path";
89840
91122
  function createFsWatchInstance(path5, options, listener, errHandler, emitRaw) {
@@ -89865,9 +91147,9 @@ class NodeFsHandler {
89865
91147
  _watchWithNodeFs(path5, listener) {
89866
91148
  const opts = this.fsw.options;
89867
91149
  const directory = sp.dirname(path5);
89868
- const basename8 = sp.basename(path5);
91150
+ const basename9 = sp.basename(path5);
89869
91151
  const parent = this.fsw._getWatchedDir(directory);
89870
- parent.add(basename8);
91152
+ parent.add(basename9);
89871
91153
  const absolutePath = sp.resolve(path5);
89872
91154
  const options = {
89873
91155
  persistent: opts.persistent
@@ -89877,7 +91159,7 @@ class NodeFsHandler {
89877
91159
  let closer;
89878
91160
  if (opts.usePolling) {
89879
91161
  const enableBin = opts.interval !== opts.binaryInterval;
89880
- options.interval = enableBin && isBinaryPath(basename8) ? opts.binaryInterval : opts.interval;
91162
+ options.interval = enableBin && isBinaryPath(basename9) ? opts.binaryInterval : opts.interval;
89881
91163
  closer = setFsWatchFileListener(path5, absolutePath, options, {
89882
91164
  listener,
89883
91165
  rawEmitter: this.fsw._emitRaw
@@ -89896,17 +91178,17 @@ class NodeFsHandler {
89896
91178
  return;
89897
91179
  }
89898
91180
  const dirname19 = sp.dirname(file2);
89899
- const basename8 = sp.basename(file2);
91181
+ const basename9 = sp.basename(file2);
89900
91182
  const parent = this.fsw._getWatchedDir(dirname19);
89901
91183
  let prevStats = stats;
89902
- if (parent.has(basename8))
91184
+ if (parent.has(basename9))
89903
91185
  return;
89904
91186
  const listener = async (path5, newStats) => {
89905
91187
  if (!this.fsw._throttle(THROTTLE_MODE_WATCH, file2, 5))
89906
91188
  return;
89907
91189
  if (!newStats || newStats.mtimeMs === 0) {
89908
91190
  try {
89909
- const newStats2 = await stat10(file2);
91191
+ const newStats2 = await stat11(file2);
89910
91192
  if (this.fsw.closed)
89911
91193
  return;
89912
91194
  const at = newStats2.atimeMs;
@@ -89924,9 +91206,9 @@ class NodeFsHandler {
89924
91206
  prevStats = newStats2;
89925
91207
  }
89926
91208
  } catch (error51) {
89927
- this.fsw._remove(dirname19, basename8);
91209
+ this.fsw._remove(dirname19, basename9);
89928
91210
  }
89929
- } else if (parent.has(basename8)) {
91211
+ } else if (parent.has(basename9)) {
89930
91212
  const at = newStats.atimeMs;
89931
91213
  const mt = newStats.mtimeMs;
89932
91214
  if (!at || at <= mt || mt !== prevStats.mtimeMs) {
@@ -90262,7 +91544,7 @@ var init_handler = __esm(() => {
90262
91544
  ERROR: "error"
90263
91545
  };
90264
91546
  EV = EVENTS;
90265
- statMethods = { lstat: lstat4, stat: stat10 };
91547
+ statMethods = { lstat: lstat4, stat: stat11 };
90266
91548
  HANDLER_KEYS = [KEY_LISTENERS, KEY_ERR, KEY_RAW];
90267
91549
  binaryExtensions = new Set([
90268
91550
  "3dm",
@@ -90534,7 +91816,7 @@ var init_handler = __esm(() => {
90534
91816
  // ../../node_modules/.pnpm/chokidar@5.0.0/node_modules/chokidar/index.js
90535
91817
  import { EventEmitter } from "node:events";
90536
91818
  import { stat as statcb, Stats } from "node:fs";
90537
- import { readdir as readdir4, stat as stat11 } from "node:fs/promises";
91819
+ import { readdir as readdir4, stat as stat12 } from "node:fs/promises";
90538
91820
  import * as sp2 from "node:path";
90539
91821
  function arrify(item) {
90540
91822
  return Array.isArray(item) ? item : [item];
@@ -90988,7 +92270,7 @@ var init_chokidar = __esm(() => {
90988
92270
  const fullPath = opts.cwd ? sp2.join(opts.cwd, path5) : path5;
90989
92271
  let stats2;
90990
92272
  try {
90991
- stats2 = await stat11(fullPath);
92273
+ stats2 = await stat12(fullPath);
90992
92274
  } catch (err2) {}
90993
92275
  if (!stats2 || this.closed)
90994
92276
  return;
@@ -91092,8 +92374,8 @@ var init_chokidar = __esm(() => {
91092
92374
  }
91093
92375
  return this._userIgnored(path5, stats);
91094
92376
  }
91095
- _isntIgnored(path5, stat12) {
91096
- return !this._isIgnored(path5, stat12);
92377
+ _isntIgnored(path5, stat13) {
92378
+ return !this._isIgnored(path5, stat13);
91097
92379
  }
91098
92380
  _getWatchHelpers(path5) {
91099
92381
  return new WatchHelper(path5, this.options.followSymlinks, this);
@@ -93205,8 +94487,8 @@ function parseMakefileTargets(content) {
93205
94487
  var MAX_NAME_LENGTH2 = 256;
93206
94488
 
93207
94489
  // src/infrastructure/services/workspace/workspace-resolver.ts
93208
- import { readFile as readFile17, readdir as readdir5, stat as stat12 } from "node:fs/promises";
93209
- import { join as join30, basename as basename9, resolve as resolve11 } from "node:path";
94490
+ import { readFile as readFile18, readdir as readdir5, stat as stat13 } from "node:fs/promises";
94491
+ import { join as join30, basename as basename10, resolve as resolve11 } from "node:path";
93210
94492
  async function resolveGlobPatternStar(rootDir, cleaned) {
93211
94493
  const parentDir2 = join30(rootDir, cleaned.slice(0, -2));
93212
94494
  try {
@@ -93230,7 +94512,7 @@ async function resolveLiteralPath(rootDir, cleaned) {
93230
94512
  try {
93231
94513
  if (!resolve11(dir).startsWith(resolve11(rootDir)))
93232
94514
  return [];
93233
- const s = await stat12(dir);
94515
+ const s = await stat13(dir);
93234
94516
  if (s.isDirectory())
93235
94517
  return [dir];
93236
94518
  } catch {}
@@ -93246,10 +94528,10 @@ async function resolveGlobPattern(rootDir, pattern) {
93246
94528
  }
93247
94529
  async function readPackageJson(dir) {
93248
94530
  try {
93249
- const content = await readFile17(join30(dir, "package.json"), "utf-8");
94531
+ const content = await readFile18(join30(dir, "package.json"), "utf-8");
93250
94532
  const pkg = JSON.parse(content);
93251
94533
  return {
93252
- name: pkg.name || basename9(dir),
94534
+ name: pkg.name || basename10(dir),
93253
94535
  scripts: pkg.scripts && typeof pkg.scripts === "object" ? pkg.scripts : {}
93254
94536
  };
93255
94537
  } catch {
@@ -93258,7 +94540,7 @@ async function readPackageJson(dir) {
93258
94540
  }
93259
94541
  async function readPnpmWorkspacePatterns(rootDir) {
93260
94542
  try {
93261
- const content = await readFile17(join30(rootDir, "pnpm-workspace.yaml"), "utf-8");
94543
+ const content = await readFile18(join30(rootDir, "pnpm-workspace.yaml"), "utf-8");
93262
94544
  const patterns = [];
93263
94545
  let inPackages = false;
93264
94546
  for (const line of content.split(`
@@ -93285,7 +94567,7 @@ async function readPnpmWorkspacePatterns(rootDir) {
93285
94567
  }
93286
94568
  async function readPackageJsonWorkspacePatterns(rootDir) {
93287
94569
  try {
93288
- const content = await readFile17(join30(rootDir, "package.json"), "utf-8");
94570
+ const content = await readFile18(join30(rootDir, "package.json"), "utf-8");
93289
94571
  const pkg = JSON.parse(content);
93290
94572
  if (!pkg.workspaces)
93291
94573
  return [];
@@ -93333,8 +94615,8 @@ async function resolveSubWorkspaces(rootDir, pm) {
93333
94615
  var init_workspace_resolver = () => {};
93334
94616
 
93335
94617
  // src/infrastructure/services/workspace/command-discovery.ts
93336
- import { access as access2, readFile as readFile18 } from "node:fs/promises";
93337
- import { join as join31, relative as relative3, basename as basename10 } from "node:path";
94618
+ import { access as access2, readFile as readFile19 } from "node:fs/promises";
94619
+ import { join as join31, relative as relative3, basename as basename11 } from "node:path";
93338
94620
  async function detectPackageManager(workingDir) {
93339
94621
  for (const { file: file2, manager } of LOCKFILE_MAP) {
93340
94622
  try {
@@ -93382,7 +94664,7 @@ function isValidScriptEntry(name, script) {
93382
94664
  }
93383
94665
  async function readJsonFile(filePath, label) {
93384
94666
  try {
93385
- const content = await readFile18(filePath, "utf-8");
94667
+ const content = await readFile19(filePath, "utf-8");
93386
94668
  return parseJsonc2(content);
93387
94669
  } catch (error51) {
93388
94670
  if (error51.code !== "ENOENT") {
@@ -93406,7 +94688,7 @@ function collectRootScriptCommands(scripts, pm, scriptPrefix, rootSw) {
93406
94688
  return commands;
93407
94689
  }
93408
94690
  async function readRootPackageJson(workingDir, pm, scriptPrefix) {
93409
- let rootPackageName = basename10(workingDir);
94691
+ let rootPackageName = basename11(workingDir);
93410
94692
  const pkg = await readJsonFile(join31(workingDir, "package.json"), "root package.json");
93411
94693
  if (!pkg)
93412
94694
  return { commands: [], rootPackageName };
@@ -93439,7 +94721,7 @@ async function readDenoJson(workingDir) {
93439
94721
  const deno = await readJsonFile(join31(workingDir, fileName), fileName);
93440
94722
  if (!deno?.tasks || typeof deno.tasks !== "object")
93441
94723
  continue;
93442
- const pkgName = deno.name ?? basename10(workingDir);
94724
+ const pkgName = deno.name ?? basename11(workingDir);
93443
94725
  const subWorkspace = { type: "deno", path: ".", name: pkgName };
93444
94726
  for (const [taskName, taskCommand] of Object.entries(deno.tasks)) {
93445
94727
  if (!isValidScriptEntry(taskName, taskCommand))
@@ -93459,14 +94741,14 @@ async function readMakefile(workingDir) {
93459
94741
  const commands = [];
93460
94742
  for (const fileName of ["Makefile", "makefile"]) {
93461
94743
  try {
93462
- const content = await readFile18(join31(workingDir, fileName), "utf-8");
94744
+ const content = await readFile19(join31(workingDir, fileName), "utf-8");
93463
94745
  const targets = parseMakefileTargets(content);
93464
94746
  if (targets.length === 0)
93465
94747
  continue;
93466
94748
  const subWorkspace = {
93467
94749
  type: "make",
93468
94750
  path: ".",
93469
- name: basename10(workingDir)
94751
+ name: basename11(workingDir)
93470
94752
  };
93471
94753
  for (const target of targets) {
93472
94754
  commands.push({
@@ -93597,8 +94879,8 @@ function createWorkspaceGitProbe(args2) {
93597
94879
  }
93598
94880
  async function statFingerprint(absPath) {
93599
94881
  try {
93600
- const stat13 = await fs7.stat(absPath);
93601
- return `${stat13.mtimeMs}:${stat13.size}`;
94882
+ const stat14 = await fs7.stat(absPath);
94883
+ return `${stat14.mtimeMs}:${stat14.size}`;
93602
94884
  } catch {
93603
94885
  return "missing";
93604
94886
  }
@@ -94624,12 +95906,12 @@ async function readCommandsUnits(workingDir) {
94624
95906
  return [{ kind: "commands", commands: commands.map(toCommandEntry) }];
94625
95907
  }
94626
95908
  async function readWorktreeUnits(workingDir) {
94627
- const [dirty, stat13] = await Promise.all([isDirty(workingDir), getDiffStat(workingDir)]);
95909
+ const [dirty, stat14] = await Promise.all([isDirty(workingDir), getDiffStat(workingDir)]);
94628
95910
  return [
94629
95911
  {
94630
95912
  kind: "worktree",
94631
95913
  isDirty: dirty,
94632
- diffStat: stat13.status === "available" ? { ...stat13.diffStat } : { filesChanged: 0, insertions: 0, deletions: 0 }
95914
+ diffStat: stat14.status === "available" ? { ...stat14.diffStat } : { filesChanged: 0, insertions: 0, deletions: 0 }
94633
95915
  }
94634
95916
  ];
94635
95917
  }
@@ -95006,7 +96288,7 @@ var init_workspace_service2 = __esm(() => {
95006
96288
  });
95007
96289
 
95008
96290
  // src/daemon/entry/init-daemon.ts
95009
- import { stat as stat13 } from "node:fs/promises";
96291
+ import { stat as stat14 } from "node:fs/promises";
95010
96292
  async function discoverModelsForHarness(harness, service4) {
95011
96293
  const installed2 = await service4.isInstalled();
95012
96294
  if (!installed2) {
@@ -95041,7 +96323,7 @@ function createDefaultDeps22() {
95041
96323
  kill: (pid, signal) => process.kill(pid, signal)
95042
96324
  },
95043
96325
  fs: {
95044
- stat: stat13
96326
+ stat: stat14
95045
96327
  },
95046
96328
  machine: {
95047
96329
  clearAgentPid,
@@ -98881,7 +100163,7 @@ var init_git_clone = __esm(() => {
98881
100163
 
98882
100164
  // src/infrastructure/local-actions/git-clone.ts
98883
100165
  import { spawn as spawn5 } from "node:child_process";
98884
- import { readdir as readdir6, stat as stat14 } from "node:fs/promises";
100166
+ import { readdir as readdir6, stat as stat15 } from "node:fs/promises";
98885
100167
  function parseGitCloneProgressLine(line) {
98886
100168
  const match5 = PROGRESS_LINE_PATTERN.exec(line.trim());
98887
100169
  if (!match5?.[1] || !match5[2])
@@ -98895,7 +100177,7 @@ function classifyGitCloneFailure(stderrTail, spawnErrorCode) {
98895
100177
  }
98896
100178
  async function statOrNull(path8) {
98897
100179
  try {
98898
- return await stat14(path8);
100180
+ return await stat15(path8);
98899
100181
  } catch (error51) {
98900
100182
  if (error51.code === "ENOENT")
98901
100183
  return null;
@@ -99579,7 +100861,7 @@ function gunzipBase64Payload(base643, maxBytes) {
99579
100861
  var init_workspace_path_security = () => {};
99580
100862
 
99581
100863
  // src/daemon/entry/files/file-content-fulfillment.ts
99582
- import { readFile as readFile19 } from "node:fs/promises";
100864
+ import { readFile as readFile20 } from "node:fs/promises";
99583
100865
  import { gzipSync as gzipSync3 } from "node:zlib";
99584
100866
  function getErrorCause(error51) {
99585
100867
  if (typeof error51 === "object" && error51 !== null && "cause" in error51 && error51.cause !== undefined) {
@@ -99654,7 +100936,7 @@ var init_file_content_fulfillment = __esm(() => {
99654
100936
  continue;
99655
100937
  }
99656
100938
  let fileNotFound = false;
99657
- const buffer = yield* exports_Effect.catch(exports_Effect.tryPromise(() => readFile19(absolutePath)), (error51) => {
100939
+ const buffer = yield* exports_Effect.catch(exports_Effect.tryPromise(() => readFile20(absolutePath)), (error51) => {
99658
100940
  if (isENOENT(error51)) {
99659
100941
  fileNotFound = true;
99660
100942
  return exports_Effect.succeed(Buffer.alloc(0));
@@ -99899,10 +101181,10 @@ function parseAttachmentFileName(remainder) {
99899
101181
  if (underscore <= 0)
99900
101182
  return false;
99901
101183
  const uuid3 = remainder.slice(0, underscore);
99902
- const basename11 = remainder.slice(underscore + 1);
99903
- if (!UUID_V4_RE.test(uuid3) || !basename11)
101184
+ const basename12 = remainder.slice(underscore + 1);
101185
+ if (!UUID_V4_RE.test(uuid3) || !basename12)
99904
101186
  return false;
99905
- return sanitizeChatAttachmentFileName(basename11) === basename11;
101187
+ return sanitizeChatAttachmentFileName(basename12) === basename12;
99906
101188
  }
99907
101189
  function getInvalidChatAttachmentUploadPathReason(relativePath) {
99908
101190
  if (relativePath.includes("\\"))
@@ -99931,14 +101213,14 @@ function normalizeSegments(relativePath) {
99931
101213
  function hasBlockedSegment(lowerSegments) {
99932
101214
  return lowerSegments.some((segment) => BLOCKED_SEGMENT_NAMES.has(segment));
99933
101215
  }
99934
- function hasBlockedBasename(basename11) {
99935
- return /^\.env(?:\.|$)/.test(basename11) || /\.(?:pem|key)$/.test(basename11) || basename11 === "id_rsa" || basename11 === "credentials.json";
101216
+ function hasBlockedBasename(basename12) {
101217
+ return /^\.env(?:\.|$)/.test(basename12) || /\.(?:pem|key)$/.test(basename12) || basename12 === "id_rsa" || basename12 === "credentials.json";
99936
101218
  }
99937
101219
  function isBlockedUploadTargetPath(relativePath) {
99938
101220
  if (!relativePath)
99939
101221
  return false;
99940
- const { lowerSegments, basename: basename11 } = normalizeSegments(relativePath);
99941
- return hasBlockedSegment(lowerSegments) || hasBlockedBasename(basename11);
101222
+ const { lowerSegments, basename: basename12 } = normalizeSegments(relativePath);
101223
+ return hasBlockedSegment(lowerSegments) || hasBlockedBasename(basename12);
99942
101224
  }
99943
101225
  function getBlockedUploadTargetReason(relativePath) {
99944
101226
  if (!isBlockedUploadTargetPath(relativePath))
@@ -101830,7 +103112,7 @@ function createDaemonDeps(opts = {}) {
101830
103112
  })
101831
103113
  };
101832
103114
  }
101833
- var init_deps3 = __esm(() => {
103115
+ var init_deps4 = __esm(() => {
101834
103116
  init_publisher_registry();
101835
103117
  });
101836
103118
 
@@ -119329,7 +120611,7 @@ var init_start_daemon = __esm(() => {
119329
120611
  init_daemon_layers();
119330
120612
  init_daemon_runtime();
119331
120613
  init_default_router_deps();
119332
- init_deps3();
120614
+ init_deps4();
119333
120615
  init_execute_chatroom_stop_command();
119334
120616
  init_init_daemon();
119335
120617
  init_persistence_path();
@@ -120170,7 +121452,7 @@ async function runGenerate3dPreview(zip, options, command) {
120170
121452
  }
120171
121453
  }
120172
121454
  function registerGenerate3dCommand(program2) {
120173
- const generate3d2 = program2.command("generate-3d").description("Generate one 3D mesh (GLB) with a fal model, plus its JSON manifest and a zip/preview package").option("--model <id>", "fal endpoint id (default fal-ai/trellis-2); any id is accepted").option("--out <path>", "Output GLB path (required; manifest is written to <path>.json)").option("--platform <name>", "Generation platform: fal", parsePlatform, DEFAULT_GENERATE_3D_PLATFORM).option("--prompt <text>", "text prompt; with the default model, a reference image is generated first").option("--input-image <path-or-url>", "reference image (local file or URL); the image-to-3D input").option("--force", "replace existing output, reference, package, preview, rig, and clip files").option("--target-height <meters>", "Scale the model so its height is this many metres (positive, finite)", parseTargetHeight).option("--origin <origin>", "Where the origin goes: feet (bottom centre), center, or as-is (default)", parseOrigin, "as-is").option("--rig", "rig with Meshy 7.1 (requires --model meshy/v7.1/...); needs --confirm-cost on a real run").option("--animation-action-id <id>", "Meshy preset animation id (0-696), repeatable; requires --rig", collectRepeatable, []).option("--package-dir <dir>", "Directory for the package zip and preview (default: the directory of --out)").option("--input <json|@file>", "extra fal request fields as a JSON object, merged over the model defaults; reserved: prompt, image_url; @file reads JSON from a file").option("--confirm-cost", "confirm the priced plan for a real run that rigs or animates (Meshy 7.1 only), after the user confirms the priced dry run; not needed for --dry-run").option("--dry-run", "Validate and print the request and the static list-price estimate. No upload or fal generation call is made; FAL_API_KEY is not required").addHelpText("after", HELP_AFTER).action(runGenerate3d);
121455
+ const generate3d2 = program2.command("generate-3d").description("Generate one 3D mesh (GLB) with a fal model, plus its JSON manifest and a zip/preview package").option("--model <id>", "fal endpoint id (default fal-ai/trellis-2); any id is accepted").option("--out <path>", "Output GLB path (required; manifest is written to <path>.json)").option("--platform <name>", "Generation platform: fal", parsePlatform, DEFAULT_GENERATE_3D_PLATFORM).option("--prompt <text>", "text prompt; with the default model, a reference image is generated first").option("--input-image <path-or-url>", "reference image (local file or URL); the image-to-3D input").option("--force", "replace existing output, reference, package, preview, rig, and clip files").option("--target-height <meters>", "Scale the model so its height is this many metres (positive, finite)", parseTargetHeight).option("--origin <origin>", "Where the origin goes: feet (bottom centre), center, or as-is (default)", parseOrigin, "as-is").option("--rig", "rig with Meshy 7.1 (requires --model meshy/v7.1/...); needs --confirm-cost on a real run").option("--animation-action-id <id>", "Meshy preset animation id (0-696), repeatable; requires --rig", collectRepeatable, []).option("--package-dir <dir>", "Directory for the package zip and preview (default: the directory of --out)").option("--input <json|@file>", "extra fal request fields as a JSON object, merged over the model defaults; reserved: prompt, image_url; @file reads JSON from a file").option("--confirm-cost", "confirm the priced plan for a real run that rigs or animates (Meshy 7.1 only), after the user confirms the priced dry run; not needed for --dry-run").option("--dry-run", "Validate and print the request and the static list-price estimate. No upload or fal generation call is made; FAL_API_KEY is not required. Refuses an existing output like a real run; add --force to print the plan anyway (a dry run writes nothing)").addHelpText("after", HELP_AFTER).action(runGenerate3d);
120174
121456
  generate3d2.command("preview <zip>").description("Rebuild <base>.html from an existing package zip, offline").option("--force", "replace an existing <base>.html").action(runGenerate3dPreview);
120175
121457
  }
120176
121458
 
@@ -120237,7 +121519,8 @@ async function runGenerateImage(options) {
120237
121519
  seed: options.seed,
120238
121520
  input,
120239
121521
  inputImage: options.inputImage,
120240
- force: options.force
121522
+ force: options.force,
121523
+ dryRun: options.dryRun === true
120241
121524
  };
120242
121525
  if (options.dryRun === true) {
120243
121526
  const { formatGenerateImagePlan: formatGenerateImagePlan2, planGenerateImage: planGenerateImage2 } = await Promise.resolve().then(() => (init_image(), exports_image));
@@ -120255,7 +121538,7 @@ async function runGenerateImage(options) {
120255
121538
  }
120256
121539
  }
120257
121540
  function registerGenerateImageCommand(program2) {
120258
- program2.command("generate-image").description("Generate one image with a fal model and write a JSON manifest next to it").requiredOption("--prompt <text>", "Text prompt describing the image").requiredOption("--out <path>", "Output image path (manifest is written to <path>.json)").option("--platform <name>", "Generation platform: fal", parsePlatform2, DEFAULT_GENERATE_IMAGE_PLATFORM).requiredOption("--model <id>", `fal model id (required), for example ${FLUX_2_FLASH_MODEL}, or ${FLUX_2_FLASH_EDIT_MODEL} with --input-image`).option("--aspect-ratio <ratio>", "Aspect ratio for models that take one, e.g. 1:1, 16:9 (omitted = model default). Rejected for models the CLI knows do not support it").option("--output-format <format>", "Output format: png or webp (omitted = model default)", parseOutputFormat).option("--seed <n>", "Seed for the random number generator", parseSeed).option("--input <json|@file>", "Model-specific JSON input object merged into the fal request; @file reads JSON from a file").option("--input-image <path-or-url>", `Image to edit: a local .png, .jpg, .jpeg, .webp, or .gif (uploaded to fal) or an http(s) URL. Requires an edit model such as ${FLUX_2_FLASH_EDIT_MODEL}`).option("--force", "Overwrite existing output and manifest files").option("--dry-run", "Validate and print the request, the model constraints the CLI knows, and the estimated fal cost. No upload or fal generation call is made; one read-only pricing request may be made when FAL_API_KEY is set (the key is not required)").addHelpText("after", HELP_AFTER2).action(runGenerateImage);
121541
+ program2.command("generate-image").description("Generate one image with a fal model and write a JSON manifest next to it").requiredOption("--prompt <text>", "Text prompt describing the image").requiredOption("--out <path>", "Output image path (manifest is written to <path>.json)").option("--platform <name>", "Generation platform: fal", parsePlatform2, DEFAULT_GENERATE_IMAGE_PLATFORM).requiredOption("--model <id>", `fal model id (required), for example ${FLUX_2_FLASH_MODEL}, or ${FLUX_2_FLASH_EDIT_MODEL} with --input-image`).option("--aspect-ratio <ratio>", "Aspect ratio for models that take one, e.g. 1:1, 16:9 (omitted = model default). Rejected for models the CLI knows do not support it").option("--output-format <format>", "Output format: png or webp (omitted = model default)", parseOutputFormat).option("--seed <n>", "Seed for the random number generator", parseSeed).option("--input <json|@file>", "Model-specific JSON input object merged into the fal request; @file reads JSON from a file").option("--input-image <path-or-url>", `Image to edit: a local .png, .jpg, .jpeg, .webp, or .gif (uploaded to fal) or an http(s) URL. Requires an edit model such as ${FLUX_2_FLASH_EDIT_MODEL}`).option("--force", "Overwrite existing output and manifest files").option("--dry-run", "Validate and print the request, the model constraints the CLI knows, and the estimated fal cost. No upload or fal generation call is made; one read-only pricing request may be made when FAL_API_KEY is set (the key is not required). Refuses an existing output like a real run; add --force to print the plan anyway (a dry run writes nothing)").addHelpText("after", HELP_AFTER2).action(runGenerateImage);
120259
121542
  }
120260
121543
 
120261
121544
  // src/commands/register-chatroom-role-command.ts
@@ -120898,7 +122181,7 @@ function buildManifest3(asset, deps, tolerance, minAreaPercent, isolatedAt) {
120898
122181
  licensing: "unverified"
120899
122182
  };
120900
122183
  }
120901
- async function preflight(outputs, tiles, force, deps) {
122184
+ async function preflight(outputs, tiles, force, dryRun, deps) {
120902
122185
  const sourcePaths = new Set;
120903
122186
  const sourceIdentities = [];
120904
122187
  for (const tile of tiles) {
@@ -120909,7 +122192,7 @@ async function preflight(outputs, tiles, force, deps) {
120909
122192
  }
120910
122193
  const conflicts = await findOutputConflicts(deps, outputs, sourcePaths, sourceIdentities, force);
120911
122194
  if (conflicts.length > 0)
120912
- throw new RemoveBackgroundError(formatConflicts(conflicts));
122195
+ throw new RemoveBackgroundError(formatConflicts(conflicts, dryRun));
120913
122196
  }
120914
122197
  function encodeAsset(image, keyed, options, deps) {
120915
122198
  if (!options.trim) {
@@ -121031,7 +122314,7 @@ async function removeImageBackground(opts, deps) {
121031
122314
  }
121032
122315
  const tiles = inspected.map((tile) => decodeInput(tile, deps));
121033
122316
  const prepared = await prepareAssets(assignNames(mode, opts, tiles), mode, options, deps);
121034
- await preflight(prepared.flatMap((asset) => [asset.path, asset.manifestPath]), tiles, opts.force === true, deps);
122317
+ await preflight(prepared.flatMap((asset) => [asset.path, asset.manifestPath]), tiles, opts.force === true, opts.dryRun === true, deps);
121035
122318
  const result = {
121036
122319
  dryRun: opts.dryRun === true,
121037
122320
  assets: toAssets(prepared),
@@ -121387,10 +122670,10 @@ function parseSourceManifest(raw, sheetSha, manifestPath) {
121387
122670
  warnings
121388
122671
  };
121389
122672
  }
121390
- async function preflightOutputs(deps, paths, sourcePaths, sourceIdentities, force) {
122673
+ async function preflightOutputs(deps, paths, sourcePaths, sourceIdentities, force, dryRun) {
121391
122674
  const conflicts = await findOutputConflicts(deps, paths, sourcePaths, sourceIdentities, force);
121392
122675
  if (conflicts.length > 0) {
121393
- throw new SliceImageError(formatConflicts(conflicts));
122676
+ throw new SliceImageError(formatConflicts(conflicts, dryRun));
121394
122677
  }
121395
122678
  }
121396
122679
  var EDGE_CONTENT_THRESHOLD = 25;
@@ -121612,7 +122895,7 @@ async function sliceImage(opts, deps) {
121612
122895
  await deps.fileIdentity(inPath),
121613
122896
  await deps.fileIdentity(sourceManifestPath)
121614
122897
  ];
121615
- await preflightOutputs(deps, allOutputPaths, new Set([inPath, sourceManifestPath]), sourceIdentities, force);
122898
+ await preflightOutputs(deps, allOutputPaths, new Set([inPath, sourceManifestPath]), sourceIdentities, force, dryRun);
121616
122899
  const encoded = outputs.map((output) => {
121617
122900
  const cropped = cropTile(image, output.cell);
121618
122901
  let encodedBytes;
@@ -121994,12 +123277,12 @@ teamCommand.command("get").description("Show the current team configuration").re
121994
123277
  const { getTeam: getTeam2 } = await Promise.resolve().then(() => (init_team(), exports_team));
121995
123278
  await getTeam2(options.chatroomId);
121996
123279
  });
121997
- teamCommand.command("set").description("Set the team preset for a chatroom").requiredOption("--chatroom-id <id>", "Chatroom identifier").requiredOption("--team <id>", "Team preset (duo|solo)").action(async (options) => {
123280
+ teamCommand.command("set").description("Set the team preset for a chatroom").requiredOption("--chatroom-id <id>", "Chatroom identifier").requiredOption("--team <id>", "Team preset (duo|solo|trio)").action(async (options) => {
121998
123281
  await maybeRequireAuth();
121999
123282
  const { setTeam: setTeam2 } = await Promise.resolve().then(() => (init_team(), exports_team));
122000
123283
  await setTeam2(options.chatroomId, options.team);
122001
123284
  });
122002
- handoffCommandGroup.command("view-template").description("Print the handoff template for one sender → recipient pair in one conversation mode (requires --from, --to, and --mode)").option("--from <role>", "Sending role (the role that runs the handoff)").option("--to <role>", "Receiving role (the --next-role of the handoff)").option("--mode <mode>", "Conversation mode: chat | code | code:enhanced (required)").option("--team-id <teamId>", "Team id (solo, duo); defaults to duo").action(async function(options) {
123285
+ handoffCommandGroup.command("view-template").description("Print the handoff template for one sender → recipient pair in one conversation mode (requires --from, --to, and --mode)").option("--from <role>", "Sending role (the role that runs the handoff)").option("--to <role>", "Receiving role (the --next-role of the handoff)").option("--mode <mode>", "Conversation mode: chat | code (required)").option("--team-id <teamId>", "Team id (solo, duo, trio); defaults to duo").action(async function(options) {
122003
123286
  const parentOpts = this.parent?.opts() ?? {};
122004
123287
  const { printHandoffViewTemplate: printHandoffViewTemplate2 } = await Promise.resolve().then(() => (init_view_template3(), exports_view_template));
122005
123288
  printHandoffViewTemplate2({
@@ -122011,7 +123294,7 @@ handoffCommandGroup.command("view-template").description("Print the handoff temp
122011
123294
  legacyNextRole: parentOpts.nextRole
122012
123295
  });
122013
123296
  });
122014
- handoffCommandGroup.command("list-templates").description("Show the pair descriptor and handoff template for one sender → recipient pair in one conversation mode (requires --from, --to, and --mode; static, no chatroom required)").option("--from <role>", "Sending role (the role that runs the handoff)").option("--to <role>", "Receiving role (the --next-role of the handoff)").option("--mode <mode>", "Conversation mode: chat | code | code:enhanced (required)").option("--team-id <teamId>", "Team id (solo, duo); defaults to duo").action(async function(options) {
123297
+ handoffCommandGroup.command("list-templates").description("Show the pair descriptor and handoff template for one sender → recipient pair in one conversation mode (requires --from, --to, and --mode; static, no chatroom required)").option("--from <role>", "Sending role (the role that runs the handoff)").option("--to <role>", "Receiving role (the --next-role of the handoff)").option("--mode <mode>", "Conversation mode: chat | code (required)").option("--team-id <teamId>", "Team id (solo, duo, trio); defaults to duo").action(async function(options) {
122015
123298
  const parentOpts = this.parent?.opts() ?? {};
122016
123299
  const { printHandoffListTemplates: printHandoffListTemplates2 } = await Promise.resolve().then(() => (init_list_templates2(), exports_list_templates));
122017
123300
  printHandoffListTemplates2({
@@ -122023,7 +123306,7 @@ handoffCommandGroup.command("list-templates").description("Show the pair descrip
122023
123306
  legacyNextRole: parentOpts.nextRole
122024
123307
  });
122025
123308
  });
122026
- handoffCommandGroup.option("--chatroom-id <id>", "Chatroom identifier").option("--role <role>", "Your role").option("--next-role <nextRole>", "Role to hand off to").action(async (options) => {
123309
+ handoffCommandGroup.option("--chatroom-id <id>", "Chatroom identifier").option("--role <role>", "Your role").option("--next-role <nextRole>", "Role to hand off to").option("--attach-file <path>", "File to attach (only with --next-role=user; repeatable, max 10, 10 MiB each)", collectMultiValueOption, []).action(async (options) => {
122027
123310
  const missing = [
122028
123311
  ["--chatroom-id", options.chatroomId],
122029
123312
  ["--role", options.role],
@@ -122056,7 +123339,8 @@ handoffCommandGroup.option("--chatroom-id <id>", "Chatroom identifier").option("
122056
123339
  await handoff2(chatroomId, {
122057
123340
  role,
122058
123341
  message,
122059
- nextRole
123342
+ nextRole,
123343
+ attachFiles: options.attachFile ?? []
122060
123344
  });
122061
123345
  });
122062
123346
  program2.command("notify-user").description("Send the user an update while you keep working (does not complete or transition your task)").requiredOption("--chatroom-id <id>", "Chatroom identifier").requiredOption("--role <role>", "Your role").action(async (options) => {
@@ -122463,4 +123747,4 @@ program2.hook("preAction", async (_thisCommand, actionCommand) => {
122463
123747
  });
122464
123748
  program2.parse();
122465
123749
 
122466
- //# debugId=874F17B509E159FE64756E2164756E21
123750
+ //# debugId=E7468AF5E7D2685E64756E2164756E21