chatroom-cli 1.58.3 → 1.58.5

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
@@ -2140,8 +2140,88 @@ var require_commander = __commonJS((exports) => {
2140
2140
  exports.InvalidOptionArgumentError = InvalidArgumentError;
2141
2141
  });
2142
2142
 
2143
- // src/version.ts
2143
+ // src/utils/file-content.ts
2144
+ var exports_file_content = {};
2145
+ __export(exports_file_content, {
2146
+ readFileContent: () => readFileContent
2147
+ });
2144
2148
  import { readFileSync } from "node:fs";
2149
+ import { resolve } from "node:path";
2150
+ function readFileContent(filePath, optionName) {
2151
+ const absolutePath = resolve(process.cwd(), filePath);
2152
+ try {
2153
+ return readFileSync(absolutePath, "utf-8");
2154
+ } catch (err) {
2155
+ const nodeErr = err;
2156
+ throw new Error(`Cannot read file for --${optionName}: ${absolutePath}
2157
+ ` + `Reason: ${nodeErr.message}`);
2158
+ }
2159
+ }
2160
+ var init_file_content = () => {};
2161
+
2162
+ // ../../services/backend/prompts/cli/stdin-heredoc.ts
2163
+ var exports_stdin_heredoc = {};
2164
+ __export(exports_stdin_heredoc, {
2165
+ validateStdinHeredocBody: () => validateStdinHeredocBody,
2166
+ formatStdinHeredocCommand: () => formatStdinHeredocCommand,
2167
+ findReservedDelimiterLines: () => findReservedDelimiterLines,
2168
+ HANDOFF_STDIN_DELIMITER: () => HANDOFF_STDIN_DELIMITER,
2169
+ HANDOFF_MESSAGE_MARKER: () => HANDOFF_MESSAGE_MARKER,
2170
+ CONTEXT_STDIN_DELIMITER: () => CONTEXT_STDIN_DELIMITER,
2171
+ BACKLOG_STDIN_DELIMITER: () => BACKLOG_STDIN_DELIMITER
2172
+ });
2173
+ function formatStdinHeredocCommand(commandPrefix, delimiter, placeholder, options) {
2174
+ const marker = options?.messageMarker;
2175
+ const body = marker ? `${marker}
2176
+ ${placeholder}` : placeholder;
2177
+ return `${commandPrefix} << '${delimiter}'
2178
+ ${body}
2179
+ ${delimiter}`;
2180
+ }
2181
+ function stdinBodyContainsHeredocDelimiter(content, delimiter) {
2182
+ return content.split(`
2183
+ `).some((line) => line.trim() === delimiter);
2184
+ }
2185
+ function validateStdinHeredocBody(content, delimiter, contentLabel = "Message") {
2186
+ if (!stdinBodyContainsHeredocDelimiter(content, delimiter)) {
2187
+ return;
2188
+ }
2189
+ throw new Error(`${contentLabel} cannot contain the line '${delimiter}' — that line ends the shell heredoc. ` + `Rephrase or remove that line from the ${contentLabel.toLowerCase()}.`);
2190
+ }
2191
+ function findReservedDelimiterLines(content) {
2192
+ const reserved = new Set([
2193
+ ...RESERVED_STDIN_HEREDOC_DELIMITERS,
2194
+ ...RESERVED_STRUCTURED_PARAM_MARKERS,
2195
+ "EOF"
2196
+ ]);
2197
+ const hits = [];
2198
+ for (const line of content.split(`
2199
+ `)) {
2200
+ const trimmed = line.trim();
2201
+ if (reserved.has(trimmed) && !hits.includes(trimmed)) {
2202
+ hits.push(trimmed);
2203
+ }
2204
+ }
2205
+ return hits;
2206
+ }
2207
+ var HANDOFF_STDIN_DELIMITER = "CHATROOM_HANDOFF_END", CONTEXT_STDIN_DELIMITER = "CHATROOM_CONTEXT_END", BACKLOG_STDIN_DELIMITER = "CHATROOM_BACKLOG_END", CLASSIFY_STDIN_DELIMITER = "CHATROOM_CLASSIFY_END", HANDOFF_MESSAGE_MARKER = "---MESSAGE---", RESERVED_STDIN_HEREDOC_DELIMITERS, RESERVED_STRUCTURED_PARAM_MARKERS;
2208
+ var init_stdin_heredoc = __esm(() => {
2209
+ RESERVED_STDIN_HEREDOC_DELIMITERS = [
2210
+ HANDOFF_STDIN_DELIMITER,
2211
+ CONTEXT_STDIN_DELIMITER,
2212
+ BACKLOG_STDIN_DELIMITER,
2213
+ CLASSIFY_STDIN_DELIMITER
2214
+ ];
2215
+ RESERVED_STRUCTURED_PARAM_MARKERS = [
2216
+ HANDOFF_MESSAGE_MARKER,
2217
+ "---TITLE---",
2218
+ "---DESCRIPTION---",
2219
+ "---TECH_SPECS---"
2220
+ ];
2221
+ });
2222
+
2223
+ // src/version.ts
2224
+ import { readFileSync as readFileSync2 } from "node:fs";
2145
2225
  import { dirname, join } from "node:path";
2146
2226
  import { fileURLToPath } from "node:url";
2147
2227
  function getVersion() {
@@ -2154,7 +2234,7 @@ function getVersion() {
2154
2234
  ];
2155
2235
  for (const packagePath of possiblePaths) {
2156
2236
  try {
2157
- const packageJson = JSON.parse(readFileSync(packagePath, "utf-8"));
2237
+ const packageJson = JSON.parse(readFileSync2(packagePath, "utf-8"));
2158
2238
  if (packageJson.version) {
2159
2239
  return packageJson.version;
2160
2240
  }
@@ -3033,11 +3113,11 @@ class RequestManager {
3033
3113
  this.requestsOlderThanRestart = /* @__PURE__ */ new Set;
3034
3114
  }
3035
3115
  request(message, sent) {
3036
- const result = new Promise((resolve) => {
3116
+ const result = new Promise((resolve2) => {
3037
3117
  const status = sent ? "Requested" : "NotSent";
3038
3118
  this.inflightRequests.set(message.requestId, {
3039
3119
  message,
3040
- status: { status, requestedAt: /* @__PURE__ */ new Date, onResult: resolve }
3120
+ status: { status, requestedAt: /* @__PURE__ */ new Date, onResult: resolve2 }
3041
3121
  });
3042
3122
  if (message.type === "Mutation") {
3043
3123
  this.inflightMutationsCount++;
@@ -5590,10 +5670,10 @@ class ConvexClient2 {
5590
5670
  const value = this.client.localQueryResult(getFunctionName(query), args);
5591
5671
  if (value !== undefined)
5592
5672
  return Promise.resolve(value);
5593
- return new Promise((resolve, reject) => {
5673
+ return new Promise((resolve2, reject) => {
5594
5674
  const { unsubscribe } = this.onUpdate(query, args, (value2) => {
5595
5675
  unsubscribe();
5596
- resolve(value2);
5676
+ resolve2(value2);
5597
5677
  }, (e) => {
5598
5678
  unsubscribe();
5599
5679
  reject(e);
@@ -5804,10 +5884,10 @@ var init_simple_client_node = __esm(() => {
5804
5884
  if (debug)
5805
5885
  return debug;
5806
5886
  }
5807
- var prebuild = resolve(dir);
5887
+ var prebuild = resolve2(dir);
5808
5888
  if (prebuild)
5809
5889
  return prebuild;
5810
- var nearby = resolve(path.dirname(process.execPath));
5890
+ var nearby = resolve2(path.dirname(process.execPath));
5811
5891
  if (nearby)
5812
5892
  return nearby;
5813
5893
  var target = [
@@ -5825,7 +5905,7 @@ var init_simple_client_node = __esm(() => {
5825
5905
  throw new Error("No native build was found for " + target + `
5826
5906
  loaded from: ` + dir + `
5827
5907
  `);
5828
- function resolve(dir2) {
5908
+ function resolve2(dir2) {
5829
5909
  var tuples = readdirSync(path.join(dir2, "prebuilds")).map(parseTuple);
5830
5910
  var tuple = tuples.filter(matchTuple(platform, arch)).sort(compareTuples)[0];
5831
5911
  if (!tuple)
@@ -8895,10 +8975,10 @@ class ConvexHttpClient2 {
8895
8975
  }
8896
8976
  this.isProcessingQueue = true;
8897
8977
  while (this.mutationQueue.length > 0) {
8898
- const { mutation, args, resolve, reject } = this.mutationQueue.shift();
8978
+ const { mutation, args, resolve: resolve2, reject } = this.mutationQueue.shift();
8899
8979
  try {
8900
8980
  const result = await this.mutationInner(mutation, args);
8901
- resolve(result);
8981
+ resolve2(result);
8902
8982
  } catch (error) {
8903
8983
  reject(error);
8904
8984
  }
@@ -8906,8 +8986,8 @@ class ConvexHttpClient2 {
8906
8986
  this.isProcessingQueue = false;
8907
8987
  }
8908
8988
  enqueueMutation(mutation, args) {
8909
- return new Promise((resolve, reject) => {
8910
- this.mutationQueue.push({ mutation, args, resolve, reject });
8989
+ return new Promise((resolve2, reject) => {
8990
+ this.mutationQueue.push({ mutation, args, resolve: resolve2, reject });
8911
8991
  this.processMutationQueue();
8912
8992
  });
8913
8993
  }
@@ -9935,7 +10015,7 @@ async function retryValidation(sessionId, convexUrl, retryIntervalMs) {
9935
10015
  } else {
9936
10016
  console.log(`❌ Backend still unreachable (attempt ${consecutiveNetworkFailures}, retrying in ${retrySec}s)`);
9937
10017
  }
9938
- await new Promise((resolve) => setTimeout(resolve, retryIntervalMs));
10018
+ await new Promise((resolve2) => setTimeout(resolve2, retryIntervalMs));
9939
10019
  }
9940
10020
  }
9941
10021
  }
@@ -17846,17 +17926,17 @@ var annotateLogs, asSome = (self2) => map9(self2, some2), asSomeError = (self2)
17846
17926
  return errors2.length === 0 ? failCause(cause2) : fail2(errors2);
17847
17927
  },
17848
17928
  onSuccess: succeed
17849
- }), patchFiberRefs = (patch8) => updateFiberRefs((fiberId2, fiberRefs3) => pipe(patch8, patch6(fiberId2, fiberRefs3))), promise = (evaluate2) => evaluate2.length >= 1 ? async_((resolve, signal) => {
17929
+ }), patchFiberRefs = (patch8) => updateFiberRefs((fiberId2, fiberRefs3) => pipe(patch8, patch6(fiberId2, fiberRefs3))), promise = (evaluate2) => evaluate2.length >= 1 ? async_((resolve2, signal) => {
17850
17930
  try {
17851
- evaluate2(signal).then((a) => resolve(succeed(a)), (e) => resolve(die2(e)));
17931
+ evaluate2(signal).then((a) => resolve2(succeed(a)), (e) => resolve2(die2(e)));
17852
17932
  } catch (e) {
17853
- resolve(die2(e));
17933
+ resolve2(die2(e));
17854
17934
  }
17855
- }) : async_((resolve) => {
17935
+ }) : async_((resolve2) => {
17856
17936
  try {
17857
- evaluate2().then((a) => resolve(succeed(a)), (e) => resolve(die2(e)));
17937
+ evaluate2().then((a) => resolve2(succeed(a)), (e) => resolve2(die2(e)));
17858
17938
  } catch (e) {
17859
- resolve(die2(e));
17939
+ resolve2(die2(e));
17860
17940
  }
17861
17941
  }), provideService, provideServiceEffect, random2, reduce9, reduceRight2, reduceWhile, reduceWhileLoop = (iterator, index, state, predicate, f) => {
17862
17942
  const next2 = iterator.next();
@@ -17878,19 +17958,19 @@ var annotateLogs, asSome = (self2) => map9(self2, some2), asSomeError = (self2)
17878
17958
  }
17879
17959
  const fail4 = (e) => catcher ? failSync(() => catcher(e)) : fail2(new UnknownException(e, "An unknown error occurred in Effect.tryPromise"));
17880
17960
  if (evaluate2.length >= 1) {
17881
- return async_((resolve, signal) => {
17961
+ return async_((resolve2, signal) => {
17882
17962
  try {
17883
- evaluate2(signal).then((a) => resolve(succeed(a)), (e) => resolve(fail4(e)));
17963
+ evaluate2(signal).then((a) => resolve2(succeed(a)), (e) => resolve2(fail4(e)));
17884
17964
  } catch (e) {
17885
- resolve(fail4(e));
17965
+ resolve2(fail4(e));
17886
17966
  }
17887
17967
  });
17888
17968
  }
17889
- return async_((resolve) => {
17969
+ return async_((resolve2) => {
17890
17970
  try {
17891
- evaluate2().then((a) => resolve(succeed(a)), (e) => resolve(fail4(e)));
17971
+ evaluate2().then((a) => resolve2(succeed(a)), (e) => resolve2(fail4(e)));
17892
17972
  } catch (e) {
17893
- resolve(fail4(e));
17973
+ resolve2(fail4(e));
17894
17974
  }
17895
17975
  });
17896
17976
  }, tryMap, tryMapPromise, unless, unlessEffect, unsandbox = (self2) => mapErrorCause(self2, flatten2), updateFiberRefs = (f) => withFiberRuntime((state) => {
@@ -22382,14 +22462,14 @@ var init_runtime = __esm(() => {
22382
22462
  }
22383
22463
  }
22384
22464
  }));
22385
- unsafeRunPromiseExit = /* @__PURE__ */ makeDual((runtime2, effect, options) => new Promise((resolve) => {
22465
+ unsafeRunPromiseExit = /* @__PURE__ */ makeDual((runtime2, effect, options) => new Promise((resolve2) => {
22386
22466
  const op = fastPath(effect);
22387
22467
  if (op) {
22388
- resolve(op);
22468
+ resolve2(op);
22389
22469
  }
22390
22470
  const fiber = unsafeFork2(runtime2)(effect);
22391
22471
  fiber.addObserver((exit2) => {
22392
- resolve(exit2);
22472
+ resolve2(exit2);
22393
22473
  });
22394
22474
  if (options?.signal !== undefined) {
22395
22475
  if (options.signal.aborted) {
@@ -26673,7 +26753,7 @@ var init_clock2 = __esm(() => {
26673
26753
  };
26674
26754
  ClockServiceLive = exports_Layer.succeed(ClockService, {
26675
26755
  now: () => exports_Effect.sync(() => Date.now()),
26676
- delay: (ms) => exports_Effect.promise(() => new Promise((resolve) => setTimeout(resolve, ms)))
26756
+ delay: (ms) => exports_Effect.promise(() => new Promise((resolve2) => setTimeout(resolve2, ms)))
26677
26757
  });
26678
26758
  });
26679
26759
 
@@ -26779,7 +26859,7 @@ function createDefaultDeps() {
26779
26859
  },
26780
26860
  clock: {
26781
26861
  now: () => Date.now(),
26782
- delay: (ms) => new Promise((resolve) => setTimeout(resolve, ms))
26862
+ delay: (ms) => new Promise((resolve2) => setTimeout(resolve2, ms))
26783
26863
  },
26784
26864
  process: {
26785
26865
  env: process.env,
@@ -27342,7 +27422,7 @@ class BaseCLIAgentService {
27342
27422
  } catch {
27343
27423
  return;
27344
27424
  }
27345
- await new Promise((resolve) => setTimeout(resolve, POLL_INTERVAL_MS));
27425
+ await new Promise((resolve2) => setTimeout(resolve2, POLL_INTERVAL_MS));
27346
27426
  }
27347
27427
  try {
27348
27428
  this.deps.kill(-pid, "SIGKILL");
@@ -27378,7 +27458,7 @@ class BaseCLIAgentService {
27378
27458
  return buildAgentSpawnEnv(resolvedConvexUrl);
27379
27459
  }
27380
27460
  async assertChildProcessStarted(childProcess) {
27381
- await new Promise((resolve) => setTimeout(resolve, SPAWN_READY_DELAY_MS));
27461
+ await new Promise((resolve2) => setTimeout(resolve2, SPAWN_READY_DELAY_MS));
27382
27462
  if (childProcess.killed || childProcess.exitCode !== null) {
27383
27463
  throw new Error(`Agent process exited immediately (exit code: ${childProcess.exitCode})`);
27384
27464
  }
@@ -27772,7 +27852,7 @@ var init_pi_agent_service = __esm(() => {
27772
27852
  return childProcess;
27773
27853
  }
27774
27854
  async waitForSpawnReady(childProcess) {
27775
- await new Promise((resolve) => setTimeout(resolve, SPAWN_READY_DELAY_MS2));
27855
+ await new Promise((resolve2) => setTimeout(resolve2, SPAWN_READY_DELAY_MS2));
27776
27856
  if (childProcess.killed || childProcess.exitCode !== null) {
27777
27857
  throw new Error(`Agent process exited immediately (exit code: ${childProcess.exitCode})`);
27778
27858
  }
@@ -27781,27 +27861,27 @@ var init_pi_agent_service = __esm(() => {
27781
27861
  }
27782
27862
  }
27783
27863
  writePrompt(child, prompt) {
27784
- return new Promise((resolve, reject) => {
27864
+ return new Promise((resolve2, reject) => {
27785
27865
  if (!child.stdin) {
27786
27866
  reject(new Error("Pi RPC process has no stdin"));
27787
27867
  return;
27788
27868
  }
27789
27869
  const message = JSON.stringify({ type: "prompt", message: prompt }) + `
27790
27870
  `;
27791
- child.stdin.write(message, (err) => err ? reject(err) : resolve());
27871
+ child.stdin.write(message, (err) => err ? reject(err) : resolve2());
27792
27872
  });
27793
27873
  }
27794
27874
  async querySessionId(reader, stdin) {
27795
27875
  if (!stdin) {
27796
27876
  throw new Error("Pi RPC process has no stdin");
27797
27877
  }
27798
- return new Promise((resolve, reject) => {
27878
+ return new Promise((resolve2, reject) => {
27799
27879
  const timer = setTimeout(() => {
27800
27880
  reject(new Error(`get_state timed out after ${GET_STATE_TIMEOUT_MS}ms`));
27801
27881
  }, GET_STATE_TIMEOUT_MS);
27802
27882
  reader.onStateResponse((sessionId) => {
27803
27883
  clearTimeout(timer);
27804
- resolve(sessionId);
27884
+ resolve2(sessionId);
27805
27885
  });
27806
27886
  stdin.write(JSON.stringify({ type: "get_state" }) + `
27807
27887
  `);
@@ -28909,7 +28989,7 @@ __export(exports_cursor_sdk_package, {
28909
28989
  getBundledCursorSdkVersion: () => getBundledCursorSdkVersion,
28910
28990
  formatCursorSdkLoadError: () => formatCursorSdkLoadError
28911
28991
  });
28912
- import { existsSync, readFileSync as readFileSync2 } from "node:fs";
28992
+ import { existsSync, readFileSync as readFileSync3 } from "node:fs";
28913
28993
  import { createRequire as createRequire3 } from "node:module";
28914
28994
  import { dirname as dirname2, join as join7 } from "node:path";
28915
28995
  import { fileURLToPath as fileURLToPath2, pathToFileURL } from "node:url";
@@ -28919,7 +28999,7 @@ function resolveChatroomCliRoot(moduleRef = import.meta.url) {
28919
28999
  while (dir !== dirname2(dir)) {
28920
29000
  const packageJsonPath = join7(dir, "package.json");
28921
29001
  if (existsSync(packageJsonPath)) {
28922
- const pkg = JSON.parse(readFileSync2(packageJsonPath, "utf8"));
29002
+ const pkg = JSON.parse(readFileSync3(packageJsonPath, "utf8"));
28923
29003
  if (pkg.name === "chatroom-cli") {
28924
29004
  return dir;
28925
29005
  }
@@ -28929,7 +29009,7 @@ function resolveChatroomCliRoot(moduleRef = import.meta.url) {
28929
29009
  throw new CursorSdkPackageError(`Could not locate chatroom-cli package root while resolving @cursor/sdk. ${REINSTALL_HINT}`);
28930
29010
  }
28931
29011
  function readPinnedSdkVersion(chatroomCliRoot) {
28932
- const pkg = JSON.parse(readFileSync2(join7(chatroomCliRoot, "package.json"), "utf8"));
29012
+ const pkg = JSON.parse(readFileSync3(join7(chatroomCliRoot, "package.json"), "utf8"));
28933
29013
  const specifier = pkg.dependencies?.["@cursor/sdk"];
28934
29014
  const pinned = specifier?.replace(/^[\^~>=<]+/, "").trim() ?? "";
28935
29015
  const match17 = pinned.match(/^(\d+\.\d+\.\d+)/);
@@ -28940,7 +29020,7 @@ function readPinnedSdkVersion(chatroomCliRoot) {
28940
29020
  }
28941
29021
  function readInstalledSdkVersion(entryPath) {
28942
29022
  const packageJsonPath = join7(dirname2(entryPath), "..", "..", "package.json");
28943
- const pkg = JSON.parse(readFileSync2(packageJsonPath, "utf8"));
29023
+ const pkg = JSON.parse(readFileSync3(packageJsonPath, "utf8"));
28944
29024
  return pkg.version;
28945
29025
  }
28946
29026
  function resolveSdkEsmImportPath(cjsEntryPath) {
@@ -29153,18 +29233,18 @@ function waitForResumeOrAbort(session2) {
29153
29233
  return Promise.resolve(queued);
29154
29234
  }
29155
29235
  return Promise.race([
29156
- new Promise((resolve) => {
29236
+ new Promise((resolve2) => {
29157
29237
  session2.resumeResolve = (prompt) => {
29158
29238
  session2.resumeResolve = undefined;
29159
29239
  session2.abortResolve = undefined;
29160
- resolve(prompt);
29240
+ resolve2(prompt);
29161
29241
  };
29162
29242
  }),
29163
- new Promise((resolve) => {
29243
+ new Promise((resolve2) => {
29164
29244
  session2.abortResolve = () => {
29165
29245
  session2.resumeResolve = undefined;
29166
29246
  session2.abortResolve = undefined;
29167
- resolve(null);
29247
+ resolve2(null);
29168
29248
  };
29169
29249
  })
29170
29250
  ]);
@@ -29240,10 +29320,10 @@ var init_cursor_sdk_agent_service = __esm(() => {
29240
29320
  throw new Error(`No cursor-sdk session for pid=${pid}`);
29241
29321
  }
29242
29322
  if (session2.resumeResolve) {
29243
- const resolve = session2.resumeResolve;
29323
+ const resolve2 = session2.resumeResolve;
29244
29324
  session2.resumeResolve = undefined;
29245
29325
  session2.abortResolve = undefined;
29246
- resolve(prompt);
29326
+ resolve2(prompt);
29247
29327
  return;
29248
29328
  }
29249
29329
  session2.pendingResumePrompt = prompt;
@@ -29605,7 +29685,7 @@ var init_types_gen = () => {};
29605
29685
  // ../../node_modules/.pnpm/@opencode-ai+sdk@1.15.11/node_modules/@opencode-ai/sdk/dist/gen/core/serverSentEvents.gen.js
29606
29686
  var createSseClient = ({ onSseError, onSseEvent, responseTransformer, responseValidator, sseDefaultRetryDelay, sseMaxRetryAttempts, sseMaxRetryDelay, sseSleepFn, url, ...options }) => {
29607
29687
  let lastEventId;
29608
- const sleep5 = sseSleepFn ?? ((ms) => new Promise((resolve) => setTimeout(resolve, ms)));
29688
+ const sleep5 = sseSleepFn ?? ((ms) => new Promise((resolve2) => setTimeout(resolve2, ms)));
29609
29689
  const createStream = async function* () {
29610
29690
  let retryDelay = sseDefaultRetryDelay ?? 3000;
29611
29691
  let attempt = 0;
@@ -31105,12 +31185,12 @@ var require_isexe = __commonJS((exports, module) => {
31105
31185
  if (typeof Promise !== "function") {
31106
31186
  throw new TypeError("callback not provided");
31107
31187
  }
31108
- return new Promise(function(resolve, reject) {
31188
+ return new Promise(function(resolve2, reject) {
31109
31189
  isexe(path, options || {}, function(er, is) {
31110
31190
  if (er) {
31111
31191
  reject(er);
31112
31192
  } else {
31113
- resolve(is);
31193
+ resolve2(is);
31114
31194
  }
31115
31195
  });
31116
31196
  });
@@ -31172,27 +31252,27 @@ var require_which = __commonJS((exports, module) => {
31172
31252
  opt = {};
31173
31253
  const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
31174
31254
  const found = [];
31175
- const step4 = (i2) => new Promise((resolve, reject) => {
31255
+ const step4 = (i2) => new Promise((resolve2, reject) => {
31176
31256
  if (i2 === pathEnv.length)
31177
- return opt.all && found.length ? resolve(found) : reject(getNotFoundError(cmd));
31257
+ return opt.all && found.length ? resolve2(found) : reject(getNotFoundError(cmd));
31178
31258
  const ppRaw = pathEnv[i2];
31179
31259
  const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
31180
31260
  const pCmd = path.join(pathPart, cmd);
31181
31261
  const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
31182
- resolve(subStep(p, i2, 0));
31262
+ resolve2(subStep(p, i2, 0));
31183
31263
  });
31184
- const subStep = (p, i2, ii) => new Promise((resolve, reject) => {
31264
+ const subStep = (p, i2, ii) => new Promise((resolve2, reject) => {
31185
31265
  if (ii === pathExt.length)
31186
- return resolve(step4(i2 + 1));
31266
+ return resolve2(step4(i2 + 1));
31187
31267
  const ext = pathExt[ii];
31188
31268
  isexe(p + ext, { pathExt: pathExtExe }, (er, is) => {
31189
31269
  if (!er && is) {
31190
31270
  if (opt.all)
31191
31271
  found.push(p + ext);
31192
31272
  else
31193
- return resolve(p + ext);
31273
+ return resolve2(p + ext);
31194
31274
  }
31195
- return resolve(subStep(p, i2, ii + 1));
31275
+ return resolve2(subStep(p, i2, ii + 1));
31196
31276
  });
31197
31277
  });
31198
31278
  return cb ? step4(0).then((res) => cb(null, res), cb) : step4(0);
@@ -31562,7 +31642,7 @@ function forwardFiltered(source, target, shouldDrop) {
31562
31642
 
31563
31643
  // src/infrastructure/services/remote-agents/opencode-sdk/parse-listening-url.ts
31564
31644
  async function waitForListeningUrl(child, options) {
31565
- return new Promise((resolve, reject) => {
31645
+ return new Promise((resolve2, reject) => {
31566
31646
  const buffers = { stdout: "", stderr: "" };
31567
31647
  const cleanup = () => {
31568
31648
  clearTimeout(timer);
@@ -31575,7 +31655,7 @@ async function waitForListeningUrl(child, options) {
31575
31655
  const match17 = buffers[key].match(LISTENING_URL_RE);
31576
31656
  if (match17) {
31577
31657
  cleanup();
31578
- resolve(match17[1]);
31658
+ resolve2(match17[1]);
31579
31659
  return;
31580
31660
  }
31581
31661
  const lastNl = buffers[key].lastIndexOf(`
@@ -31785,8 +31865,8 @@ function startSessionEventForwarder(client4, options) {
31785
31865
  let lastStatus;
31786
31866
  const agentEndCallbacks = [];
31787
31867
  const recentLogLines = [];
31788
- const donePromise = new Promise((resolve) => {
31789
- doneResolve = resolve;
31868
+ const donePromise = new Promise((resolve2) => {
31869
+ doneResolve = resolve2;
31790
31870
  });
31791
31871
  function recordRecentLogLine(line) {
31792
31872
  recentLogLines.push(line);
@@ -32008,7 +32088,7 @@ var init_session_event_forwarder = __esm(() => {
32008
32088
  });
32009
32089
 
32010
32090
  // src/infrastructure/services/remote-agents/opencode-sdk/session-metadata-store.ts
32011
- import { existsSync as existsSync2, mkdirSync, readFileSync as readFileSync3, writeFileSync } from "node:fs";
32091
+ import { existsSync as existsSync2, mkdirSync, readFileSync as readFileSync4, writeFileSync } from "node:fs";
32012
32092
  import { homedir as homedir2 } from "node:os";
32013
32093
  import { dirname as dirname3, join as join8 } from "node:path";
32014
32094
 
@@ -32020,7 +32100,7 @@ class FileSessionMetadataStore {
32020
32100
  load() {
32021
32101
  try {
32022
32102
  if (existsSync2(this.filePath)) {
32023
- return JSON.parse(readFileSync3(this.filePath, "utf-8"));
32103
+ return JSON.parse(readFileSync4(this.filePath, "utf-8"));
32024
32104
  }
32025
32105
  } catch {}
32026
32106
  return {};
@@ -32531,7 +32611,7 @@ __export(exports_pi_sdk_package, {
32531
32611
  getBundledPiSdkVersion: () => getBundledPiSdkVersion,
32532
32612
  formatPiSdkLoadError: () => formatPiSdkLoadError
32533
32613
  });
32534
- import { existsSync as existsSync3, readFileSync as readFileSync4 } from "node:fs";
32614
+ import { existsSync as existsSync3, readFileSync as readFileSync5 } from "node:fs";
32535
32615
  import { dirname as dirname4, join as join9 } from "node:path";
32536
32616
  import { fileURLToPath as fileURLToPath3, pathToFileURL as pathToFileURL2 } from "node:url";
32537
32617
  function resolveChatroomCliRoot2(moduleRef = import.meta.url) {
@@ -32540,7 +32620,7 @@ function resolveChatroomCliRoot2(moduleRef = import.meta.url) {
32540
32620
  while (dir !== dirname4(dir)) {
32541
32621
  const packageJsonPath = join9(dir, "package.json");
32542
32622
  if (existsSync3(packageJsonPath)) {
32543
- const pkg = JSON.parse(readFileSync4(packageJsonPath, "utf8"));
32623
+ const pkg = JSON.parse(readFileSync5(packageJsonPath, "utf8"));
32544
32624
  if (pkg.name === "chatroom-cli") {
32545
32625
  return dir;
32546
32626
  }
@@ -32550,7 +32630,7 @@ function resolveChatroomCliRoot2(moduleRef = import.meta.url) {
32550
32630
  throw new PiSdkPackageError(`Could not locate chatroom-cli package root while resolving ${PI_CODING_AGENT_PKG}. ${REINSTALL_HINT2}`);
32551
32631
  }
32552
32632
  function readPinnedSdkVersion2(chatroomCliRoot) {
32553
- const pkg = JSON.parse(readFileSync4(join9(chatroomCliRoot, "package.json"), "utf8"));
32633
+ const pkg = JSON.parse(readFileSync5(join9(chatroomCliRoot, "package.json"), "utf8"));
32554
32634
  const specifier = pkg.dependencies?.[PI_CODING_AGENT_PKG];
32555
32635
  const pinned = specifier?.replace(/^[\^~>=<]+/, "").trim() ?? "";
32556
32636
  const match17 = pinned.match(/^(\d+\.\d+\.\d+)/);
@@ -32561,7 +32641,7 @@ function readPinnedSdkVersion2(chatroomCliRoot) {
32561
32641
  }
32562
32642
  function readInstalledSdkVersion2(entryPath) {
32563
32643
  const packageJsonPath = join9(dirname4(entryPath), "..", "package.json");
32564
- const pkg = JSON.parse(readFileSync4(packageJsonPath, "utf8"));
32644
+ const pkg = JSON.parse(readFileSync5(packageJsonPath, "utf8"));
32565
32645
  return pkg.version;
32566
32646
  }
32567
32647
  function resolvePiSdkEntryPathFromNodeModules(chatroomCliRoot) {
@@ -32774,18 +32854,18 @@ function waitForResumeOrAbort2(session2) {
32774
32854
  return Promise.resolve(queued);
32775
32855
  }
32776
32856
  return Promise.race([
32777
- new Promise((resolve) => {
32857
+ new Promise((resolve2) => {
32778
32858
  session2.resumeResolve = (prompt) => {
32779
32859
  session2.resumeResolve = undefined;
32780
32860
  session2.abortResolve = undefined;
32781
- resolve(prompt);
32861
+ resolve2(prompt);
32782
32862
  };
32783
32863
  }),
32784
- new Promise((resolve) => {
32864
+ new Promise((resolve2) => {
32785
32865
  session2.abortResolve = () => {
32786
32866
  session2.resumeResolve = undefined;
32787
32867
  session2.abortResolve = undefined;
32788
- resolve(null);
32868
+ resolve2(null);
32789
32869
  };
32790
32870
  })
32791
32871
  ]);
@@ -32868,10 +32948,10 @@ var init_pi_sdk_agent_service = __esm(() => {
32868
32948
  throw new Error(`No pi-sdk session for pid=${pid}`);
32869
32949
  }
32870
32950
  if (session2.resumeResolve) {
32871
- const resolve = session2.resumeResolve;
32951
+ const resolve2 = session2.resumeResolve;
32872
32952
  session2.resumeResolve = undefined;
32873
32953
  session2.abortResolve = undefined;
32874
- resolve(prompt);
32954
+ resolve2(prompt);
32875
32955
  return;
32876
32956
  }
32877
32957
  session2.pendingResumePrompt = prompt;
@@ -34033,26 +34113,26 @@ function pLimit(concurrency) {
34033
34113
  activeCount--;
34034
34114
  resumeNext();
34035
34115
  };
34036
- const run3 = async (function_, resolve, arguments_) => {
34116
+ const run3 = async (function_, resolve2, arguments_) => {
34037
34117
  const result = (async () => function_(...arguments_))();
34038
- resolve(result);
34118
+ resolve2(result);
34039
34119
  try {
34040
34120
  await result;
34041
34121
  } catch {}
34042
34122
  next4();
34043
34123
  };
34044
- const enqueue = (function_, resolve, reject, arguments_) => {
34124
+ const enqueue = (function_, resolve2, reject, arguments_) => {
34045
34125
  const queueItem = { reject };
34046
34126
  new Promise((internalResolve) => {
34047
34127
  queueItem.run = internalResolve;
34048
34128
  queue.enqueue(queueItem);
34049
- }).then(run3.bind(undefined, function_, resolve, arguments_));
34129
+ }).then(run3.bind(undefined, function_, resolve2, arguments_));
34050
34130
  if (activeCount < concurrency) {
34051
34131
  resumeNext();
34052
34132
  }
34053
34133
  };
34054
- const generator = (function_, ...arguments_) => new Promise((resolve, reject) => {
34055
- enqueue(function_, resolve, reject, arguments_);
34134
+ const generator = (function_, ...arguments_) => new Promise((resolve2, reject) => {
34135
+ enqueue(function_, resolve2, reject, arguments_);
34056
34136
  });
34057
34137
  Object.defineProperties(generator, {
34058
34138
  activeCount: {
@@ -34131,11 +34211,11 @@ var init_config3 = __esm(() => {
34131
34211
  // ../../node_modules/.pnpm/@hyzyla+pdfium@2.1.13/node_modules/@hyzyla/pdfium/dist/index.esm.js
34132
34212
  function __awaiter(thisArg, _arguments, P, generator) {
34133
34213
  function adopt(value) {
34134
- return value instanceof P ? value : new P(function(resolve) {
34135
- resolve(value);
34214
+ return value instanceof P ? value : new P(function(resolve2) {
34215
+ resolve2(value);
34136
34216
  });
34137
34217
  }
34138
- return new (P || (P = Promise))(function(resolve, reject) {
34218
+ return new (P || (P = Promise))(function(resolve2, reject) {
34139
34219
  function fulfilled(value) {
34140
34220
  try {
34141
34221
  step4(generator.next(value));
@@ -34151,7 +34231,7 @@ function __awaiter(thisArg, _arguments, P, generator) {
34151
34231
  }
34152
34232
  }
34153
34233
  function step4(result) {
34154
- result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
34234
+ result.done ? resolve2(result.value) : adopt(result.value).then(fulfilled, rejected);
34155
34235
  }
34156
34236
  step4((generator = generator.apply(thisArg, _arguments || [])).next());
34157
34237
  });
@@ -34811,13 +34891,13 @@ var init_index_esm = __esm(() => {
34811
34891
  }
34812
34892
  readAsync = async (url) => {
34813
34893
  if (isFileURI(url)) {
34814
- return new Promise((resolve, reject) => {
34894
+ return new Promise((resolve2, reject) => {
34815
34895
  var xhr = new XMLHttpRequest;
34816
34896
  xhr.open("GET", url, true);
34817
34897
  xhr.responseType = "arraybuffer";
34818
34898
  xhr.onload = () => {
34819
34899
  if (xhr.status == 200 || xhr.status == 0 && xhr.response) {
34820
- resolve(xhr.response);
34900
+ resolve2(xhr.response);
34821
34901
  return;
34822
34902
  }
34823
34903
  reject(xhr.status);
@@ -35151,10 +35231,10 @@ var init_index_esm = __esm(() => {
35151
35231
  }
35152
35232
  var info = getWasmImports();
35153
35233
  if (Module["instantiateWasm"]) {
35154
- return new Promise((resolve, reject) => {
35234
+ return new Promise((resolve2, reject) => {
35155
35235
  try {
35156
35236
  Module["instantiateWasm"](info, (mod, inst) => {
35157
- resolve(receiveInstance(mod, inst));
35237
+ resolve2(receiveInstance(mod, inst));
35158
35238
  });
35159
35239
  } catch (e) {
35160
35240
  err(`Module.instantiateWasm callback failed with error: ${e}`);
@@ -39836,8 +39916,8 @@ var init_index_esm = __esm(() => {
39836
39916
  if (runtimeInitialized) {
39837
39917
  moduleRtn = Module;
39838
39918
  } else {
39839
- moduleRtn = new Promise((resolve, reject) => {
39840
- readyPromiseResolve = resolve;
39919
+ moduleRtn = new Promise((resolve2, reject) => {
39920
+ readyPromiseResolve = resolve2;
39841
39921
  readyPromiseReject = reject;
39842
39922
  });
39843
39923
  }
@@ -39953,21 +40033,21 @@ var require_filesystem = __commonJS((exports, module) => {
39953
40033
  var LDD_PATH = "/usr/bin/ldd";
39954
40034
  var SELF_PATH = "/proc/self/exe";
39955
40035
  var MAX_LENGTH = 2048;
39956
- var readFileSync5 = (path2) => {
40036
+ var readFileSync6 = (path2) => {
39957
40037
  const fd = fs6.openSync(path2, "r");
39958
40038
  const buffer = Buffer.alloc(MAX_LENGTH);
39959
40039
  const bytesRead = fs6.readSync(fd, buffer, 0, MAX_LENGTH, 0);
39960
40040
  fs6.close(fd, () => {});
39961
40041
  return buffer.subarray(0, bytesRead);
39962
40042
  };
39963
- var readFile4 = (path2) => new Promise((resolve, reject) => {
40043
+ var readFile4 = (path2) => new Promise((resolve2, reject) => {
39964
40044
  fs6.open(path2, "r", (err, fd) => {
39965
40045
  if (err) {
39966
40046
  reject(err);
39967
40047
  } else {
39968
40048
  const buffer = Buffer.alloc(MAX_LENGTH);
39969
40049
  fs6.read(fd, buffer, 0, MAX_LENGTH, 0, (_, bytesRead) => {
39970
- resolve(buffer.subarray(0, bytesRead));
40050
+ resolve2(buffer.subarray(0, bytesRead));
39971
40051
  fs6.close(fd, () => {});
39972
40052
  });
39973
40053
  }
@@ -39976,7 +40056,7 @@ var require_filesystem = __commonJS((exports, module) => {
39976
40056
  module.exports = {
39977
40057
  LDD_PATH,
39978
40058
  SELF_PATH,
39979
- readFileSync: readFileSync5,
40059
+ readFileSync: readFileSync6,
39980
40060
  readFile: readFile4
39981
40061
  };
39982
40062
  });
@@ -40019,7 +40099,7 @@ var require_elf = __commonJS((exports, module) => {
40019
40099
  var require_detect_libc = __commonJS((exports, module) => {
40020
40100
  var childProcess = __require("child_process");
40021
40101
  var { isLinux, getReport } = require_process();
40022
- var { LDD_PATH, SELF_PATH, readFile: readFile4, readFileSync: readFileSync5 } = require_filesystem();
40102
+ var { LDD_PATH, SELF_PATH, readFile: readFile4, readFileSync: readFileSync6 } = require_filesystem();
40023
40103
  var { interpreterPath } = require_elf();
40024
40104
  var cachedFamilyInterpreter;
40025
40105
  var cachedFamilyFilesystem;
@@ -40028,10 +40108,10 @@ var require_detect_libc = __commonJS((exports, module) => {
40028
40108
  var commandOut = "";
40029
40109
  var safeCommand = () => {
40030
40110
  if (!commandOut) {
40031
- return new Promise((resolve) => {
40111
+ return new Promise((resolve2) => {
40032
40112
  childProcess.exec(command, (err, out) => {
40033
40113
  commandOut = err ? " " : out;
40034
- resolve(commandOut);
40114
+ resolve2(commandOut);
40035
40115
  });
40036
40116
  });
40037
40117
  }
@@ -40110,7 +40190,7 @@ var require_detect_libc = __commonJS((exports, module) => {
40110
40190
  }
40111
40191
  cachedFamilyFilesystem = null;
40112
40192
  try {
40113
- const lddContent = readFileSync5(LDD_PATH);
40193
+ const lddContent = readFileSync6(LDD_PATH);
40114
40194
  cachedFamilyFilesystem = getFamilyFromLddContent(lddContent);
40115
40195
  } catch (e) {}
40116
40196
  return cachedFamilyFilesystem;
@@ -40133,7 +40213,7 @@ var require_detect_libc = __commonJS((exports, module) => {
40133
40213
  }
40134
40214
  cachedFamilyInterpreter = null;
40135
40215
  try {
40136
- const selfContent = readFileSync5(SELF_PATH);
40216
+ const selfContent = readFileSync6(SELF_PATH);
40137
40217
  const path2 = interpreterPath(selfContent);
40138
40218
  cachedFamilyInterpreter = familyFromInterpreterPath(path2);
40139
40219
  } catch (e) {}
@@ -40195,7 +40275,7 @@ var require_detect_libc = __commonJS((exports, module) => {
40195
40275
  }
40196
40276
  cachedVersionFilesystem = null;
40197
40277
  try {
40198
- const lddContent = readFileSync5(LDD_PATH);
40278
+ const lddContent = readFileSync6(LDD_PATH);
40199
40279
  const versionMatch = lddContent.match(RE_GLIBC_VERSION);
40200
40280
  if (versionMatch) {
40201
40281
  cachedVersionFilesystem = versionMatch[1];
@@ -42591,14 +42671,14 @@ var require_input = __commonJS((exports, module) => {
42591
42671
  return this;
42592
42672
  } else {
42593
42673
  if (this._isStreamInput()) {
42594
- return new Promise((resolve, reject) => {
42674
+ return new Promise((resolve2, reject) => {
42595
42675
  const finished = () => {
42596
42676
  this._flattenBufferIn();
42597
42677
  sharp.metadata(this.options, (err, metadata2) => {
42598
42678
  if (err) {
42599
42679
  reject(is.nativeError(err, stack));
42600
42680
  } else {
42601
- resolve(metadata2);
42681
+ resolve2(metadata2);
42602
42682
  }
42603
42683
  });
42604
42684
  };
@@ -42609,12 +42689,12 @@ var require_input = __commonJS((exports, module) => {
42609
42689
  }
42610
42690
  });
42611
42691
  } else {
42612
- return new Promise((resolve, reject) => {
42692
+ return new Promise((resolve2, reject) => {
42613
42693
  sharp.metadata(this.options, (err, metadata2) => {
42614
42694
  if (err) {
42615
42695
  reject(is.nativeError(err, stack));
42616
42696
  } else {
42617
- resolve(metadata2);
42697
+ resolve2(metadata2);
42618
42698
  }
42619
42699
  });
42620
42700
  });
@@ -42647,25 +42727,25 @@ var require_input = __commonJS((exports, module) => {
42647
42727
  return this;
42648
42728
  } else {
42649
42729
  if (this._isStreamInput()) {
42650
- return new Promise((resolve, reject) => {
42730
+ return new Promise((resolve2, reject) => {
42651
42731
  this.on("finish", function() {
42652
42732
  this._flattenBufferIn();
42653
42733
  sharp.stats(this.options, (err, stats2) => {
42654
42734
  if (err) {
42655
42735
  reject(is.nativeError(err, stack));
42656
42736
  } else {
42657
- resolve(stats2);
42737
+ resolve2(stats2);
42658
42738
  }
42659
42739
  });
42660
42740
  });
42661
42741
  });
42662
42742
  } else {
42663
- return new Promise((resolve, reject) => {
42743
+ return new Promise((resolve2, reject) => {
42664
42744
  sharp.stats(this.options, (err, stats2) => {
42665
42745
  if (err) {
42666
42746
  reject(is.nativeError(err, stack));
42667
42747
  } else {
42668
- resolve(stats2);
42748
+ resolve2(stats2);
42669
42749
  }
42670
42750
  });
42671
42751
  });
@@ -46067,7 +46147,7 @@ var require_output = __commonJS((exports, module) => {
46067
46147
  return this;
46068
46148
  } else {
46069
46149
  if (this._isStreamInput()) {
46070
- return new Promise((resolve, reject) => {
46150
+ return new Promise((resolve2, reject) => {
46071
46151
  this.once("finish", () => {
46072
46152
  this._flattenBufferIn();
46073
46153
  sharp.pipeline(this.options, (err, data, info) => {
@@ -46075,24 +46155,24 @@ var require_output = __commonJS((exports, module) => {
46075
46155
  reject(is.nativeError(err, stack));
46076
46156
  } else {
46077
46157
  if (this.options.resolveWithObject) {
46078
- resolve({ data, info });
46158
+ resolve2({ data, info });
46079
46159
  } else {
46080
- resolve(data);
46160
+ resolve2(data);
46081
46161
  }
46082
46162
  }
46083
46163
  });
46084
46164
  });
46085
46165
  });
46086
46166
  } else {
46087
- return new Promise((resolve, reject) => {
46167
+ return new Promise((resolve2, reject) => {
46088
46168
  sharp.pipeline(this.options, (err, data, info) => {
46089
46169
  if (err) {
46090
46170
  reject(is.nativeError(err, stack));
46091
46171
  } else {
46092
46172
  if (this.options.resolveWithObject) {
46093
- resolve({ data, info });
46173
+ resolve2({ data, info });
46094
46174
  } else {
46095
- resolve(data);
46175
+ resolve2(data);
46096
46176
  }
46097
46177
  }
46098
46178
  });
@@ -47166,7 +47246,7 @@ var require_runtime = __commonJS((exports, module) => {
47166
47246
  return { __await: arg };
47167
47247
  };
47168
47248
  function AsyncIterator(generator, PromiseImpl) {
47169
- function invoke(method, arg, resolve, reject) {
47249
+ function invoke(method, arg, resolve2, reject) {
47170
47250
  var record = tryCatch(generator[method], generator, arg);
47171
47251
  if (record.type === "throw") {
47172
47252
  reject(record.arg);
@@ -47175,24 +47255,24 @@ var require_runtime = __commonJS((exports, module) => {
47175
47255
  var value = result.value;
47176
47256
  if (value && typeof value === "object" && hasOwn.call(value, "__await")) {
47177
47257
  return PromiseImpl.resolve(value.__await).then(function(value2) {
47178
- invoke("next", value2, resolve, reject);
47258
+ invoke("next", value2, resolve2, reject);
47179
47259
  }, function(err) {
47180
- invoke("throw", err, resolve, reject);
47260
+ invoke("throw", err, resolve2, reject);
47181
47261
  });
47182
47262
  }
47183
47263
  return PromiseImpl.resolve(value).then(function(unwrapped) {
47184
47264
  result.value = unwrapped;
47185
- resolve(result);
47265
+ resolve2(result);
47186
47266
  }, function(error) {
47187
- return invoke("throw", error, resolve, reject);
47267
+ return invoke("throw", error, resolve2, reject);
47188
47268
  });
47189
47269
  }
47190
47270
  }
47191
47271
  var previousPromise;
47192
47272
  function enqueue(method, arg) {
47193
47273
  function callInvokeWithMethodAndArg() {
47194
- return new PromiseImpl(function(resolve, reject) {
47195
- invoke(method, arg, resolve, reject);
47274
+ return new PromiseImpl(function(resolve2, reject) {
47275
+ invoke(method, arg, resolve2, reject);
47196
47276
  });
47197
47277
  }
47198
47278
  return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
@@ -47612,13 +47692,13 @@ var require_createScheduler = __commonJS((exports, module) => {
47612
47692
  }
47613
47693
  }
47614
47694
  };
47615
- const queue = (action, payload) => new Promise((resolve, reject) => {
47695
+ const queue = (action, payload) => new Promise((resolve2, reject) => {
47616
47696
  const job = createJob({ action, payload });
47617
47697
  jobQueue.push(async (w) => {
47618
47698
  jobQueue.shift();
47619
47699
  runningWorkers[w.id] = job;
47620
47700
  try {
47621
- resolve(await w[action].apply(exports, [...payload, job.id]));
47701
+ resolve2(await w[action].apply(exports, [...payload, job.id]));
47622
47702
  } catch (err) {
47623
47703
  reject(err);
47624
47704
  } finally {
@@ -49752,7 +49832,7 @@ var require_lib3 = __commonJS((exports, module) => {
49752
49832
  let accum = [];
49753
49833
  let accumBytes = 0;
49754
49834
  let abort = false;
49755
- return new Body.Promise(function(resolve, reject) {
49835
+ return new Body.Promise(function(resolve2, reject) {
49756
49836
  let resTimeout;
49757
49837
  if (_this4.timeout) {
49758
49838
  resTimeout = setTimeout(function() {
@@ -49786,7 +49866,7 @@ var require_lib3 = __commonJS((exports, module) => {
49786
49866
  }
49787
49867
  clearTimeout(resTimeout);
49788
49868
  try {
49789
- resolve(Buffer.concat(accum, accumBytes));
49869
+ resolve2(Buffer.concat(accum, accumBytes));
49790
49870
  } catch (err) {
49791
49871
  reject(new FetchError(`Could not create Buffer from response body for ${_this4.url}: ${err.message}`, "system", err));
49792
49872
  }
@@ -50385,7 +50465,7 @@ var require_lib3 = __commonJS((exports, module) => {
50385
50465
  throw new Error("native promise missing, set fetch.Promise to your favorite alternative");
50386
50466
  }
50387
50467
  Body.Promise = fetch2.Promise;
50388
- return new fetch2.Promise(function(resolve, reject) {
50468
+ return new fetch2.Promise(function(resolve2, reject) {
50389
50469
  const request2 = new Request3(url, opts);
50390
50470
  const options = getNodeRequestOptions(request2);
50391
50471
  const send = (options.protocol === "https:" ? https : http).request;
@@ -50520,7 +50600,7 @@ var require_lib3 = __commonJS((exports, module) => {
50520
50600
  requestOpts.body = undefined;
50521
50601
  requestOpts.headers.delete("content-length");
50522
50602
  }
50523
- resolve(fetch2(new Request3(locationURL, requestOpts)));
50603
+ resolve2(fetch2(new Request3(locationURL, requestOpts)));
50524
50604
  finalize();
50525
50605
  return;
50526
50606
  }
@@ -50542,7 +50622,7 @@ var require_lib3 = __commonJS((exports, module) => {
50542
50622
  const codings = headers.get("Content-Encoding");
50543
50623
  if (!request2.compress || request2.method === "HEAD" || codings === null || res.statusCode === 204 || res.statusCode === 304) {
50544
50624
  response = new Response2(body, response_options);
50545
- resolve(response);
50625
+ resolve2(response);
50546
50626
  return;
50547
50627
  }
50548
50628
  const zlibOptions = {
@@ -50552,7 +50632,7 @@ var require_lib3 = __commonJS((exports, module) => {
50552
50632
  if (codings == "gzip" || codings == "x-gzip") {
50553
50633
  body = body.pipe(zlib.createGunzip(zlibOptions));
50554
50634
  response = new Response2(body, response_options);
50555
- resolve(response);
50635
+ resolve2(response);
50556
50636
  return;
50557
50637
  }
50558
50638
  if (codings == "deflate" || codings == "x-deflate") {
@@ -50564,12 +50644,12 @@ var require_lib3 = __commonJS((exports, module) => {
50564
50644
  body = body.pipe(zlib.createInflateRaw());
50565
50645
  }
50566
50646
  response = new Response2(body, response_options);
50567
- resolve(response);
50647
+ resolve2(response);
50568
50648
  });
50569
50649
  raw.on("end", function() {
50570
50650
  if (!response) {
50571
50651
  response = new Response2(body, response_options);
50572
- resolve(response);
50652
+ resolve2(response);
50573
50653
  }
50574
50654
  });
50575
50655
  return;
@@ -50577,11 +50657,11 @@ var require_lib3 = __commonJS((exports, module) => {
50577
50657
  if (codings == "br" && typeof zlib.createBrotliDecompress === "function") {
50578
50658
  body = body.pipe(zlib.createBrotliDecompress());
50579
50659
  response = new Response2(body, response_options);
50580
- resolve(response);
50660
+ resolve2(response);
50581
50661
  return;
50582
50662
  }
50583
50663
  response = new Response2(body, response_options);
50584
- resolve(response);
50664
+ resolve2(response);
50585
50665
  });
50586
50666
  writeToStream(req, request2);
50587
50667
  });
@@ -50731,8 +50811,8 @@ var require_createWorker = __commonJS((exports, module) => {
50731
50811
  const lstmOnlyCore = [OEM.DEFAULT, OEM.LSTM_ONLY].includes(oem) && !options.legacyCore;
50732
50812
  let workerResReject;
50733
50813
  let workerResResolve;
50734
- const workerRes = new Promise((resolve, reject) => {
50735
- workerResResolve = resolve;
50814
+ const workerRes = new Promise((resolve2, reject) => {
50815
+ workerResResolve = resolve2;
50736
50816
  workerResReject = reject;
50737
50817
  });
50738
50818
  const workerError = (event) => {
@@ -50741,10 +50821,10 @@ var require_createWorker = __commonJS((exports, module) => {
50741
50821
  let worker = spawnWorker(options);
50742
50822
  worker.onerror = workerError;
50743
50823
  workerCounter += 1;
50744
- const startJob = ({ id: jobId, action, payload }) => new Promise((resolve, reject) => {
50824
+ const startJob = ({ id: jobId, action, payload }) => new Promise((resolve2, reject) => {
50745
50825
  log4(`[${id3}]: Start ${jobId}, action=${action}`);
50746
50826
  const promiseId = `${action}-${jobId}`;
50747
- promises[promiseId] = { resolve, reject };
50827
+ promises[promiseId] = { resolve: resolve2, reject };
50748
50828
  send(worker, {
50749
50829
  workerId: id3,
50750
50830
  jobId,
@@ -62725,10 +62805,10 @@ var init_CanceledError = __esm(() => {
62725
62805
  });
62726
62806
 
62727
62807
  // ../../node_modules/.pnpm/axios@1.16.1/node_modules/axios/lib/core/settle.js
62728
- function settle(resolve, reject, response) {
62808
+ function settle(resolve2, reject, response) {
62729
62809
  const validateStatus2 = response.config.validateStatus;
62730
62810
  if (!response.status || !validateStatus2 || validateStatus2(response.status)) {
62731
- resolve(response);
62811
+ resolve2(response);
62732
62812
  } else {
62733
62813
  reject(new AxiosError_default("Request failed with status code " + response.status, response.status >= 400 && response.status < 500 ? AxiosError_default.ERR_BAD_REQUEST : AxiosError_default.ERR_BAD_RESPONSE, response.config, response.request, response));
62734
62814
  }
@@ -63569,12 +63649,12 @@ var require_promisify = __commonJS((exports) => {
63569
63649
  Object.defineProperty(exports, "__esModule", { value: true });
63570
63650
  function promisify2(fn2) {
63571
63651
  return function(req, opts) {
63572
- return new Promise((resolve, reject) => {
63652
+ return new Promise((resolve2, reject) => {
63573
63653
  fn2.call(this, req, opts, (err, rtn) => {
63574
63654
  if (err) {
63575
63655
  reject(err);
63576
63656
  } else {
63577
- resolve(rtn);
63657
+ resolve2(rtn);
63578
63658
  }
63579
63659
  });
63580
63660
  });
@@ -63768,7 +63848,7 @@ var require_parse_proxy_response = __commonJS((exports) => {
63768
63848
  var debug_1 = __importDefault(require_src2());
63769
63849
  var debug = debug_1.default("https-proxy-agent:parse-proxy-response");
63770
63850
  function parseProxyResponse(socket) {
63771
- return new Promise((resolve, reject) => {
63851
+ return new Promise((resolve2, reject) => {
63772
63852
  let buffersLength = 0;
63773
63853
  const buffers = [];
63774
63854
  function read() {
@@ -63811,7 +63891,7 @@ var require_parse_proxy_response = __commonJS((exports) => {
63811
63891
  `));
63812
63892
  const statusCode = +firstLine.split(" ")[1];
63813
63893
  debug("got proxy server response: %o", firstLine);
63814
- resolve({
63894
+ resolve2({
63815
63895
  statusCode,
63816
63896
  buffered
63817
63897
  });
@@ -63829,11 +63909,11 @@ var require_parse_proxy_response = __commonJS((exports) => {
63829
63909
  var require_agent = __commonJS((exports) => {
63830
63910
  var __awaiter2 = exports && exports.__awaiter || function(thisArg, _arguments, P, generator) {
63831
63911
  function adopt(value) {
63832
- return value instanceof P ? value : new P(function(resolve) {
63833
- resolve(value);
63912
+ return value instanceof P ? value : new P(function(resolve2) {
63913
+ resolve2(value);
63834
63914
  });
63835
63915
  }
63836
- return new (P || (P = Promise))(function(resolve, reject) {
63916
+ return new (P || (P = Promise))(function(resolve2, reject) {
63837
63917
  function fulfilled(value) {
63838
63918
  try {
63839
63919
  step4(generator.next(value));
@@ -63849,7 +63929,7 @@ var require_agent = __commonJS((exports) => {
63849
63929
  }
63850
63930
  }
63851
63931
  function step4(result) {
63852
- result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
63932
+ result.done ? resolve2(result.value) : adopt(result.value).then(fulfilled, rejected);
63853
63933
  }
63854
63934
  step4((generator = generator.apply(thisArg, _arguments || [])).next());
63855
63935
  });
@@ -65348,7 +65428,7 @@ var import_https_proxy_agent, import_follow_redirects, zlibOptions, brotliOption
65348
65428
  stream4.on("end", flush).on("error", flush);
65349
65429
  return throttled;
65350
65430
  }, http2Sessions, isHttpAdapterSupported, wrapAsync = (asyncExecutor) => {
65351
- return new Promise((resolve, reject) => {
65431
+ return new Promise((resolve2, reject) => {
65352
65432
  let onDone;
65353
65433
  let isDone5;
65354
65434
  const done9 = (value, isRejected) => {
@@ -65359,7 +65439,7 @@ var import_https_proxy_agent, import_follow_redirects, zlibOptions, brotliOption
65359
65439
  };
65360
65440
  const _resolve = (value) => {
65361
65441
  done9(value);
65362
- resolve(value);
65442
+ resolve2(value);
65363
65443
  };
65364
65444
  const _reject = (reason) => {
65365
65445
  done9(reason, true);
@@ -65448,7 +65528,7 @@ var init_http = __esm(() => {
65448
65528
  }
65449
65529
  };
65450
65530
  http_default = isHttpAdapterSupported && function httpAdapter(config2) {
65451
- return wrapAsync(async function dispatchHttpRequest(resolve, reject, onDone) {
65531
+ return wrapAsync(async function dispatchHttpRequest(resolve2, reject, onDone) {
65452
65532
  const own2 = (key) => utils_default.hasOwnProp(config2, key) ? config2[key] : undefined;
65453
65533
  let data = own2("data");
65454
65534
  let lookup2 = own2("lookup");
@@ -65554,7 +65634,7 @@ var init_http = __esm(() => {
65554
65634
  }
65555
65635
  let convertedData;
65556
65636
  if (method !== "GET") {
65557
- return settle(resolve, reject, {
65637
+ return settle(resolve2, reject, {
65558
65638
  status: 405,
65559
65639
  statusText: "method not allowed",
65560
65640
  headers: {},
@@ -65576,7 +65656,7 @@ var init_http = __esm(() => {
65576
65656
  } else if (responseType === "stream") {
65577
65657
  convertedData = stream3.Readable.from(convertedData);
65578
65658
  }
65579
- return settle(resolve, reject, {
65659
+ return settle(resolve2, reject, {
65580
65660
  data: convertedData,
65581
65661
  status: 200,
65582
65662
  statusText: "OK",
@@ -65798,7 +65878,7 @@ var init_http = __esm(() => {
65798
65878
  });
65799
65879
  }
65800
65880
  response.data = responseStream;
65801
- settle(resolve, reject, response);
65881
+ settle(resolve2, reject, response);
65802
65882
  } else {
65803
65883
  const responseBuffer = [];
65804
65884
  let totalResponseBytes = 0;
@@ -65837,7 +65917,7 @@ var init_http = __esm(() => {
65837
65917
  } catch (err) {
65838
65918
  return reject(AxiosError_default.from(err, null, config2, response.request, response));
65839
65919
  }
65840
- settle(resolve, reject, response);
65920
+ settle(resolve2, reject, response);
65841
65921
  });
65842
65922
  }
65843
65923
  abortEmitter.once("abort", (err) => {
@@ -66179,7 +66259,7 @@ var init_xhr = __esm(() => {
66179
66259
  init_sanitizeHeaderValue();
66180
66260
  isXHRAdapterSupported = typeof XMLHttpRequest !== "undefined";
66181
66261
  xhr_default = isXHRAdapterSupported && function(config2) {
66182
- return new Promise(function dispatchXhrRequest(resolve, reject) {
66262
+ return new Promise(function dispatchXhrRequest(resolve2, reject) {
66183
66263
  const _config = resolveConfig_default(config2);
66184
66264
  let requestData = _config.data;
66185
66265
  const requestHeaders = AxiosHeaders_default.from(_config.headers).normalize();
@@ -66211,7 +66291,7 @@ var init_xhr = __esm(() => {
66211
66291
  request: request2
66212
66292
  };
66213
66293
  settle(function _resolve(value) {
66214
- resolve(value);
66294
+ resolve2(value);
66215
66295
  done9();
66216
66296
  }, function _reject(err) {
66217
66297
  reject(err);
@@ -66629,8 +66709,8 @@ var DEFAULT_CHUNK_SIZE, isFunction4, test = (fn2, ...args2) => {
66629
66709
  }
66630
66710
  }
66631
66711
  !isStreamResponse && unsubscribe && unsubscribe();
66632
- return await new Promise((resolve, reject) => {
66633
- settle(resolve, reject, {
66712
+ return await new Promise((resolve2, reject) => {
66713
+ settle(resolve2, reject, {
66634
66714
  data: responseData,
66635
66715
  headers: AxiosHeaders_default.from(response.headers),
66636
66716
  status: response.status,
@@ -67054,8 +67134,8 @@ class CancelToken {
67054
67134
  throw new TypeError("executor must be a function.");
67055
67135
  }
67056
67136
  let resolvePromise;
67057
- this.promise = new Promise(function promiseExecutor(resolve) {
67058
- resolvePromise = resolve;
67137
+ this.promise = new Promise(function promiseExecutor(resolve2) {
67138
+ resolvePromise = resolve2;
67059
67139
  });
67060
67140
  const token = this;
67061
67141
  this.promise.then((cancel) => {
@@ -67069,9 +67149,9 @@ class CancelToken {
67069
67149
  });
67070
67150
  this.promise.then = (onfulfilled) => {
67071
67151
  let _resolve;
67072
- const promise3 = new Promise((resolve) => {
67073
- token.subscribe(resolve);
67074
- _resolve = resolve;
67152
+ const promise3 = new Promise((resolve2) => {
67153
+ token.subscribe(resolve2);
67154
+ _resolve = resolve2;
67075
67155
  }).then(onfulfilled);
67076
67156
  promise3.cancel = function reject() {
67077
67157
  token.unsubscribe(_resolve);
@@ -69806,9 +69886,9 @@ class Deferred2 {
69806
69886
  constructor() {
69807
69887
  this.resolve = () => null;
69808
69888
  this.reject = () => null;
69809
- this.promise = new Promise((resolve, reject) => {
69889
+ this.promise = new Promise((resolve2, reject) => {
69810
69890
  this.reject = reject;
69811
- this.resolve = resolve;
69891
+ this.resolve = resolve2;
69812
69892
  });
69813
69893
  }
69814
69894
  }
@@ -71872,7 +71952,7 @@ function readByobReaderWithSignal(reader, buffer, signal) {
71872
71952
  return reader.read(buffer);
71873
71953
  }
71874
71954
  signal.throwIfAborted();
71875
- return new Promise((resolve, reject) => {
71955
+ return new Promise((resolve2, reject) => {
71876
71956
  const cleanup = () => {
71877
71957
  signal.removeEventListener("abort", onAbort);
71878
71958
  };
@@ -71891,7 +71971,7 @@ function readByobReaderWithSignal(reader, buffer, signal) {
71891
71971
  try {
71892
71972
  const result = await reader.read(buffer);
71893
71973
  cleanup();
71894
- resolve(result);
71974
+ resolve2(result);
71895
71975
  } catch (error) {
71896
71976
  cleanup();
71897
71977
  reject(error);
@@ -73762,7 +73842,7 @@ var init_file_type = __esm(() => {
73762
73842
  const { signal } = this.options;
73763
73843
  const normalizedSampleSize = normalizeSampleSize(sampleSize);
73764
73844
  signal?.throwIfAborted();
73765
- return new Promise((resolve, reject) => {
73845
+ return new Promise((resolve2, reject) => {
73766
73846
  let isSettled = false;
73767
73847
  const cleanup = () => {
73768
73848
  readableStream.off("error", onError3);
@@ -73801,7 +73881,7 @@ var init_file_type = __esm(() => {
73801
73881
  settle2(reject, error);
73802
73882
  }
73803
73883
  }
73804
- settle2(resolve, outputStream);
73884
+ settle2(resolve2, outputStream);
73805
73885
  } catch (error) {
73806
73886
  settle2(reject, error);
73807
73887
  }
@@ -73835,7 +73915,7 @@ async function guessFileExtension(filePath) {
73835
73915
  return null;
73836
73916
  }
73837
73917
  async function executeCommand(command, args2, timeoutMs = 60000) {
73838
- return new Promise((resolve, reject) => {
73918
+ return new Promise((resolve2, reject) => {
73839
73919
  const proc = spawn2(command, args2, {
73840
73920
  stdio: ["ignore", "pipe", "pipe"]
73841
73921
  });
@@ -73854,7 +73934,7 @@ async function executeCommand(command, args2, timeoutMs = 60000) {
73854
73934
  proc.on("close", (code2) => {
73855
73935
  clearTimeout(timeout3);
73856
73936
  if (code2 === 0) {
73857
- resolve(stdout);
73937
+ resolve2(stdout);
73858
73938
  } else {
73859
73939
  reject(new Error(`Command failed with code ${code2}: ${stderr}`));
73860
73940
  }
@@ -74491,7 +74571,7 @@ __export(exports_parse_pdf, {
74491
74571
  parsePdf: () => parsePdf
74492
74572
  });
74493
74573
  import { access, readFile as readFile4, writeFile as writeFile5, mkdir as mkdir5, appendFile } from "node:fs/promises";
74494
- import { resolve } from "node:path";
74574
+ import { resolve as resolve2 } from "node:path";
74495
74575
  function isUrl(input) {
74496
74576
  return input.startsWith("http://") || input.startsWith("https://");
74497
74577
  }
@@ -74543,7 +74623,7 @@ function createDefaultDeps6() {
74543
74623
  };
74544
74624
  }
74545
74625
  async function resolvePdfPath(input, workingDir, d) {
74546
- const absolutePath = resolve(workingDir, input);
74626
+ const absolutePath = resolve2(workingDir, input);
74547
74627
  try {
74548
74628
  await d.fs.access(absolutePath);
74549
74629
  } catch {
@@ -74791,67 +74871,6 @@ var init_register_agent = __esm(() => {
74791
74871
  init_services();
74792
74872
  init_convex_error();
74793
74873
  });
74794
- // ../../services/backend/prompts/cli/stdin-heredoc.ts
74795
- var exports_stdin_heredoc = {};
74796
- __export(exports_stdin_heredoc, {
74797
- validateStdinHeredocBody: () => validateStdinHeredocBody,
74798
- formatStdinHeredocCommand: () => formatStdinHeredocCommand,
74799
- findReservedDelimiterLines: () => findReservedDelimiterLines,
74800
- HANDOFF_STDIN_DELIMITER: () => HANDOFF_STDIN_DELIMITER,
74801
- HANDOFF_MESSAGE_MARKER: () => HANDOFF_MESSAGE_MARKER,
74802
- CONTEXT_STDIN_DELIMITER: () => CONTEXT_STDIN_DELIMITER,
74803
- BACKLOG_STDIN_DELIMITER: () => BACKLOG_STDIN_DELIMITER
74804
- });
74805
- function formatStdinHeredocCommand(commandPrefix, delimiter, placeholder, options) {
74806
- const marker = options?.messageMarker;
74807
- const body = marker ? `${marker}
74808
- ${placeholder}` : placeholder;
74809
- return `${commandPrefix} << '${delimiter}'
74810
- ${body}
74811
- ${delimiter}`;
74812
- }
74813
- function stdinBodyContainsHeredocDelimiter(content, delimiter) {
74814
- return content.split(`
74815
- `).some((line) => line.trim() === delimiter);
74816
- }
74817
- function validateStdinHeredocBody(content, delimiter, contentLabel = "Message") {
74818
- if (!stdinBodyContainsHeredocDelimiter(content, delimiter)) {
74819
- return;
74820
- }
74821
- throw new Error(`${contentLabel} cannot contain the line '${delimiter}' — that line ends the shell heredoc. ` + `Rephrase or remove that line from the ${contentLabel.toLowerCase()}.`);
74822
- }
74823
- function findReservedDelimiterLines(content) {
74824
- const reserved = new Set([
74825
- ...RESERVED_STDIN_HEREDOC_DELIMITERS,
74826
- ...RESERVED_STRUCTURED_PARAM_MARKERS,
74827
- "EOF"
74828
- ]);
74829
- const hits = [];
74830
- for (const line of content.split(`
74831
- `)) {
74832
- const trimmed = line.trim();
74833
- if (reserved.has(trimmed) && !hits.includes(trimmed)) {
74834
- hits.push(trimmed);
74835
- }
74836
- }
74837
- return hits;
74838
- }
74839
- var HANDOFF_STDIN_DELIMITER = "CHATROOM_HANDOFF_END", CONTEXT_STDIN_DELIMITER = "CHATROOM_CONTEXT_END", BACKLOG_STDIN_DELIMITER = "CHATROOM_BACKLOG_END", CLASSIFY_STDIN_DELIMITER = "CHATROOM_CLASSIFY_END", HANDOFF_MESSAGE_MARKER = "---MESSAGE---", RESERVED_STDIN_HEREDOC_DELIMITERS, RESERVED_STRUCTURED_PARAM_MARKERS;
74840
- var init_stdin_heredoc = __esm(() => {
74841
- RESERVED_STDIN_HEREDOC_DELIMITERS = [
74842
- HANDOFF_STDIN_DELIMITER,
74843
- CONTEXT_STDIN_DELIMITER,
74844
- BACKLOG_STDIN_DELIMITER,
74845
- CLASSIFY_STDIN_DELIMITER
74846
- ];
74847
- RESERVED_STRUCTURED_PARAM_MARKERS = [
74848
- HANDOFF_MESSAGE_MARKER,
74849
- "---TITLE---",
74850
- "---DESCRIPTION---",
74851
- "---TECH_SPECS---"
74852
- ];
74853
- });
74854
-
74855
74874
  // ../../services/backend/prompts/cli/context/new.ts
74856
74875
  var init_new = __esm(() => {
74857
74876
  init_stdin_heredoc();
@@ -75567,8 +75586,48 @@ var init_code_change_verification = __esm(() => {
75567
75586
  CODE_CHANGE_VERIFICATION_CONFIRMATION = `- [ ] I confirm that I have run \`${CODE_CHANGE_VERIFICATION_COMMAND}\` (only required if code changes were made)`;
75568
75587
  });
75569
75588
 
75589
+ // ../../services/backend/prompts/cli/context/read.ts
75590
+ function contextReadCommand(params = {}) {
75591
+ const prefix = params.cliEnvPrefix ?? "";
75592
+ const chatroomId = params.chatroomId ?? "<chatroom-id>";
75593
+ const role = params.role ?? "<role>";
75594
+ return `${prefix}chatroom context read --chatroom-id="${chatroomId}" --role="${role}"`;
75595
+ }
75596
+
75597
+ // ../../services/backend/prompts/utils/context-disclosure.ts
75598
+ function getContextReadDisclosureComment(params = {}) {
75599
+ const command = contextReadCommand(params);
75600
+ return `<!-- Read context before handoff if not already done this task: \`${command}\`. State the context goal and confirm it was achieved. -->`;
75601
+ }
75602
+ function getContextReadDisclosureBlock(params = {}) {
75603
+ return `${CONTEXT_READ_DISCLOSURE_CHECKBOX}
75604
+ ${getContextReadDisclosureComment(params)}`;
75605
+ }
75606
+ var CONTEXT_READ_DISCLOSURE_CHECKBOX = "- [ ] I confirm that I read the current chatroom task context using the command below and that the goal stated in that context has been met";
75607
+ var init_context_disclosure = () => {};
75608
+
75609
+ // ../../services/backend/prompts/cli/role-guidance/command.ts
75610
+ function roleGuidanceCommand(params = {}) {
75611
+ const prefix = params.cliEnvPrefix ?? "";
75612
+ const chatroomId = params.chatroomId ?? "<chatroom-id>";
75613
+ const role = params.role ?? "<role>";
75614
+ return `${prefix}chatroom get-role-guidance --chatroom-id="${chatroomId}" --role="${role}"`;
75615
+ }
75616
+
75617
+ // ../../services/backend/prompts/utils/role-guidance-disclosure.ts
75618
+ function getRoleGuidanceDisclosureComment(params = {}) {
75619
+ const command = roleGuidanceCommand(params);
75620
+ return `<!-- Role guidance is static for your role and does not change between tasks. Run once if needed: \`${command}\`. You do not need to re-read it on every task if you have already read it once. -->`;
75621
+ }
75622
+ function getRoleGuidanceDisclosureBlock(params = {}) {
75623
+ return `${ROLE_GUIDANCE_DISCLOSURE_CHECKBOX}
75624
+ ${getRoleGuidanceDisclosureComment(params)}`;
75625
+ }
75626
+ var ROLE_GUIDANCE_DISCLOSURE_CHECKBOX = "- [ ] I confirm that I've read and followed the role guidance before starting any work";
75627
+ var init_role_guidance_disclosure = () => {};
75628
+
75570
75629
  // ../../services/backend/prompts/teams/duo/handoff-templates/builder-to-planner.ts
75571
- function getBuilderToPlannerHandoffTemplate() {
75630
+ function getBuilderToPlannerHandoffTemplate(roleGuidanceContext) {
75572
75631
  return `${getHandoffRecipientVisibilityCallout("planner")}
75573
75632
 
75574
75633
  **Handoff Template (Builder → Planner)** — paste into the handoff message. Fill in EVERY section below. If a section does not apply, write \`Not Applicable\` (do not delete the section):
@@ -75579,6 +75638,7 @@ function getBuilderToPlannerHandoffTemplate() {
75579
75638
 
75580
75639
  ## Template Disclosure Confirmation
75581
75640
  - [ ] I confirm that I have seen this template at the start of this task, before implementing or modifying any code
75641
+ ${getRoleGuidanceDisclosureBlock(roleGuidanceContext)}
75582
75642
 
75583
75643
  ## Proof of Principle
75584
75644
  <!-- Demonstrate adherence to:
@@ -75588,6 +75648,7 @@ function getBuilderToPlannerHandoffTemplate() {
75588
75648
  <how this work follows the principles above — localized changes, readable structure, correctness provable from source then tests>
75589
75649
 
75590
75650
  ## Proof of Completion
75651
+ ${getContextReadDisclosureBlock(roleGuidanceContext)}
75591
75652
  - \`path/to/file.ts\` — <what changed and why>
75592
75653
  <evidence the goal was met — list every file you modified>
75593
75654
 
@@ -75603,6 +75664,8 @@ ${CODE_CHANGE_VERIFICATION_CONFIRMATION}
75603
75664
  }
75604
75665
  var init_builder_to_planner = __esm(() => {
75605
75666
  init_code_change_verification();
75667
+ init_context_disclosure();
75668
+ init_role_guidance_disclosure();
75606
75669
  });
75607
75670
 
75608
75671
  // ../../services/backend/prompts/teams/duo/handoff-templates/planner-to-builder.ts
@@ -75689,7 +75752,7 @@ Keep one slice ≈ one focused review surface. Delegate slices incrementally —
75689
75752
  var init_planner_to_builder = () => {};
75690
75753
 
75691
75754
  // ../../services/backend/prompts/teams/duo/handoff-templates/planner-to-user.ts
75692
- function getPlannerToUserReportTemplate() {
75755
+ function getPlannerToUserReportTemplate(roleGuidanceContext) {
75693
75756
  return `${getHandoffRecipientVisibilityCallout("user")}
75694
75757
 
75695
75758
  **Report Template (Planner → User)** — fill in EVERY section below in your handoff message. If a section does not apply, write \`Not Applicable\` (do not delete the section):
@@ -75700,6 +75763,7 @@ function getPlannerToUserReportTemplate() {
75700
75763
 
75701
75764
  ## Template Disclosure Confirmation
75702
75765
  - [ ] I confirm that I have seen this template at the start of any planning, before working on or delegating any task to the team
75766
+ ${getRoleGuidanceDisclosureBlock(roleGuidanceContext)}
75703
75767
 
75704
75768
  ## Proof of Planning
75705
75769
  <!-- Demonstrate the goal was decomposed into actionable steps with clear outcomes before implementation. -->
@@ -75707,14 +75771,18 @@ function getPlannerToUserReportTemplate() {
75707
75771
  - <step 2: concrete artifact or outcome>
75708
75772
  <List the planned slices/steps the planner defined (or would have defined) before delegating. Each step should name a verifiable deliverable — not vague layers like "backend work". Write \`Not Applicable\` only for trivial single-step tasks.>
75709
75773
 
75710
- ## Proof of Principle
75774
+ ## What changed
75775
+ <high-level view of what changed since the user's message before the detailed proofs below>
75776
+
75777
+ ### Proof of Principle
75711
75778
  <!-- Demonstrate adherence to:
75712
75779
  - Organization & Maintainability: a small change in requirements should result in a small change in code in a small number of files and folders.
75713
75780
  - Static Evaluability and Provability: the system's behavior should be provably correct by looking at the source code, then automated tests, then manual tests, in this order.
75714
75781
  -->
75715
75782
  <how this work follows the principles above — localized changes, readable structure, correctness provable from source then tests>
75716
75783
 
75717
- ## Proof of Completion
75784
+ ### Proof of Completion
75785
+ ${getContextReadDisclosureBlock(roleGuidanceContext)}
75718
75786
  - \`path/to/file.ts\` — <what changed and why>
75719
75787
  <evidence the goal was met — list every file you (or the builder) modified>
75720
75788
 
@@ -75753,12 +75821,14 @@ ${CODE_CHANGE_VERIFICATION_CONFIRMATION}
75753
75821
  }
75754
75822
  var init_planner_to_user = __esm(() => {
75755
75823
  init_code_change_verification();
75824
+ init_context_disclosure();
75825
+ init_role_guidance_disclosure();
75756
75826
  });
75757
75827
 
75758
75828
  // ../../services/backend/prompts/teams/duo/handoff-templates/index.ts
75759
75829
  function getDuoHandoffTemplate(query) {
75760
75830
  const getter = DUO_HANDOFF_TEMPLATES[`${query.fromRole.toLowerCase()}:${query.toRole.toLowerCase()}`];
75761
- return getter?.(query.nativeIntegration) ?? null;
75831
+ return getter?.(query) ?? null;
75762
75832
  }
75763
75833
  var DUO_HANDOFF_TEMPLATES;
75764
75834
  var init_handoff_templates = __esm(() => {
@@ -75766,14 +75836,22 @@ var init_handoff_templates = __esm(() => {
75766
75836
  init_planner_to_builder();
75767
75837
  init_planner_to_user();
75768
75838
  DUO_HANDOFF_TEMPLATES = {
75769
- "planner:builder": getPlannerToBuilderHandoffTemplate,
75770
- "planner:user": () => getPlannerToUserReportTemplate(),
75771
- "builder:planner": () => getBuilderToPlannerHandoffTemplate()
75839
+ "planner:builder": (query) => getPlannerToBuilderHandoffTemplate(query.nativeIntegration),
75840
+ "planner:user": (query) => getPlannerToUserReportTemplate({
75841
+ chatroomId: query.chatroomId,
75842
+ role: query.role,
75843
+ cliEnvPrefix: query.cliEnvPrefix
75844
+ }),
75845
+ "builder:planner": (query) => getBuilderToPlannerHandoffTemplate({
75846
+ chatroomId: query.chatroomId,
75847
+ role: query.role,
75848
+ cliEnvPrefix: query.cliEnvPrefix
75849
+ })
75772
75850
  };
75773
75851
  });
75774
75852
 
75775
75853
  // ../../services/backend/prompts/teams/solo/handoff-templates/solo-to-user.ts
75776
- function getSoloToUserReportTemplate() {
75854
+ function getSoloToUserReportTemplate(roleGuidanceContext) {
75777
75855
  return `${getHandoffRecipientVisibilityCallout("user")}
75778
75856
 
75779
75857
  **Report Template (Solo → User)** — fill in EVERY section below in your handoff message. If a section does not apply, write \`Not Applicable\` (do not delete the section):
@@ -75782,9 +75860,39 @@ function getSoloToUserReportTemplate() {
75782
75860
  ## Summary
75783
75861
  <what was accomplished, in plain terms — no references to prior messages>
75784
75862
 
75785
- ## Proof files changed
75863
+ ## Template Disclosure Confirmation
75864
+ - [ ] I confirm that I have seen this template at the start of any planning, before implementing any code for this task
75865
+ ${getRoleGuidanceDisclosureBlock(roleGuidanceContext)}
75866
+
75867
+ ## Proof of Planning
75868
+ <!-- Demonstrate the goal was decomposed into actionable steps with clear outcomes before implementation. -->
75869
+ - <step 1: concrete artifact or outcome>
75870
+ - <step 2: concrete artifact or outcome>
75871
+ <List the planned steps you defined before implementing. Each step should name a verifiable deliverable — not vague layers like "backend work". Write \`Not Applicable\` only for trivial single-step tasks.>
75872
+
75873
+ ## What changed
75874
+ <high-level view of what changed since the user's message before the detailed proofs below>
75875
+
75876
+ ### Proof of Principle
75877
+ <!-- Demonstrate adherence to:
75878
+ - Organization & Maintainability: a small change in requirements should result in a small change in code in a small number of files and folders.
75879
+ - Static Evaluability and Provability: the system's behavior should be provably correct by looking at the source code, then automated tests, then manual tests, in this order.
75880
+ -->
75881
+ <how this work follows the principles above — localized changes, readable structure, correctness provable from source then tests>
75882
+
75883
+ ### Proof of Completion
75884
+ ${getContextReadDisclosureBlock(roleGuidanceContext)}
75786
75885
  - \`path/to/file.ts\` — <what changed and why>
75787
- <list every file you modified; this is the evidence of work>
75886
+ <evidence the goal was met list every file you modified>
75887
+
75888
+ ## Backlog Tasks Implemented
75889
+ - \`backlog-item-id\` — <backlog item title/summary and how this work addresses it>
75890
+ <List every backlog item this work implemented. Write \`Not Applicable\` if no backlog items were in scope.>
75891
+
75892
+ ## Backlog Pending User Review Confirmation
75893
+ - [ ] I confirm that every backlog item implemented in this work has been moved to \`pending_user_review\` via \`chatroom backlog mark-for-review\` because a PR has been raised for user review
75894
+ - PR URL(s): <link to PR(s), or \`Not Applicable\` if no PR was raised>
75895
+ - If no backlog items apply, write \`Not Applicable\` for the checkbox and explain in one line
75788
75896
 
75789
75897
  ## Key Technical Decisions
75790
75898
  - <schema design, modules, interfaces, domain entities — what you chose and why, or "Not Applicable">
@@ -75803,22 +75911,33 @@ flowchart TD
75803
75911
  A[Component] --> B[Component]
75804
75912
  \`\`\`
75805
75913
 
75914
+ ## Code Change Verification
75915
+ ${CODE_CHANGE_VERIFICATION_CONFIRMATION}
75916
+
75806
75917
  ## Notes / Next steps
75807
75918
  <anything the user should know, follow-ups, or open questions, or "Not Applicable">
75808
75919
  \`\`\``;
75809
75920
  }
75810
- var init_solo_to_user = () => {};
75921
+ var init_solo_to_user = __esm(() => {
75922
+ init_code_change_verification();
75923
+ init_context_disclosure();
75924
+ init_role_guidance_disclosure();
75925
+ });
75811
75926
 
75812
75927
  // ../../services/backend/prompts/teams/solo/handoff-templates/index.ts
75813
75928
  function getSoloHandoffTemplate(query) {
75814
75929
  const getter = SOLO_HANDOFF_TEMPLATES[`${query.fromRole.toLowerCase()}:${query.toRole.toLowerCase()}`];
75815
- return getter?.() ?? null;
75930
+ return getter?.(query) ?? null;
75816
75931
  }
75817
75932
  var SOLO_HANDOFF_TEMPLATES;
75818
75933
  var init_handoff_templates2 = __esm(() => {
75819
75934
  init_solo_to_user();
75820
75935
  SOLO_HANDOFF_TEMPLATES = {
75821
- "solo:user": getSoloToUserReportTemplate
75936
+ "solo:user": (query) => getSoloToUserReportTemplate({
75937
+ chatroomId: query.chatroomId,
75938
+ role: query.role,
75939
+ cliEnvPrefix: query.cliEnvPrefix
75940
+ })
75822
75941
  };
75823
75942
  });
75824
75943
 
@@ -76025,53 +76144,10 @@ function getNativeHandoffTurnEndGuidance(nextRole) {
76025
76144
  `);
76026
76145
  }
76027
76146
 
76028
- // ../../services/backend/prompts/cli/roles/builder.ts
76029
- var init_builder = () => {};
76030
- // ../../services/backend/prompts/cli/sections/handoff-rules.ts
76031
- var init_handoff_rules = () => {};
76032
- // ../../services/backend/prompts/cli/sections/operating-model.ts
76033
- var init_operating_model = () => {};
76034
-
76035
- // ../../services/backend/prompts/cli/sections/index.ts
76036
- var init_sections = __esm(() => {
76037
- init_handoff_rules();
76038
- init_operating_model();
76039
- });
76040
-
76041
- // ../../services/backend/prompts/cli/roles/planner.ts
76042
- var init_planner = __esm(() => {
76043
- init_env();
76044
- init_sections();
76045
- });
76046
-
76047
- // ../../services/backend/prompts/teams/solo/prompts/solo.ts
76048
- var init_solo = __esm(() => {
76049
- init_sections();
76050
- });
76051
-
76052
- // ../../services/backend/prompts/cli/roles/fromContext.ts
76053
- var init_fromContext = __esm(() => {
76054
- init_builder();
76055
- init_planner();
76056
- init_solo();
76057
- });
76058
-
76059
- // ../../services/backend/prompts/native/task-started-content.ts
76060
- var init_task_started_content = __esm(() => {
76061
- init_new();
76062
- });
76063
- // ../../services/backend/prompts/sections/classification-guide.ts
76064
- var init_classification_guide = __esm(() => {
76065
- init_cli();
76066
- init_task_started_content();
76067
- init_utils3();
76068
- });
76069
-
76070
76147
  // ../../services/backend/prompts/cli/handoff/command.ts
76071
76148
  var init_command2 = __esm(() => {
76072
76149
  init_stdin_heredoc();
76073
76150
  });
76074
-
76075
76151
  // ../../services/backend/prompts/sections/commands-reference.ts
76076
76152
  var init_commands_reference = __esm(() => {
76077
76153
  init_command();
@@ -76079,14 +76155,6 @@ var init_commands_reference = __esm(() => {
76079
76155
  init_command2();
76080
76156
  init_utils3();
76081
76157
  });
76082
-
76083
- // ../../services/backend/prompts/sections/current-classification.ts
76084
- var init_current_classification = () => {};
76085
-
76086
- // ../../services/backend/prompts/sections/getting-started.ts
76087
- var init_getting_started = __esm(() => {
76088
- init_getting_started_content();
76089
- });
76090
76158
  // ../../services/backend/src/domain/usecase/skills/modules/attachments/index.ts
76091
76159
  var init_attachments = () => {};
76092
76160
 
@@ -76161,30 +76229,36 @@ var init_glossary = __esm(() => {
76161
76229
  ];
76162
76230
  });
76163
76231
 
76164
- // ../../services/backend/prompts/sections/handoff-options.ts
76165
- var init_handoff_options = () => {};
76232
+ // ../../services/backend/prompts/cli/roles/builder.ts
76233
+ var init_builder = () => {};
76234
+ // ../../services/backend/prompts/cli/sections/handoff-rules.ts
76235
+ var init_handoff_rules = () => {};
76236
+ // ../../services/backend/prompts/cli/sections/operating-model.ts
76237
+ var init_operating_model = () => {};
76166
76238
 
76167
- // ../../services/backend/prompts/sections/next-step.ts
76168
- var init_next_step = __esm(() => {
76169
- init_command();
76170
- init_utils3();
76239
+ // ../../services/backend/prompts/cli/sections/index.ts
76240
+ var init_sections = __esm(() => {
76241
+ init_handoff_rules();
76242
+ init_operating_model();
76171
76243
  });
76172
76244
 
76173
- // ../../services/backend/prompts/sections/role-guidance.ts
76174
- var init_role_guidance = __esm(() => {
76175
- init_generator();
76245
+ // ../../services/backend/prompts/cli/roles/planner.ts
76246
+ var init_planner = __esm(() => {
76247
+ init_env();
76248
+ init_sections();
76176
76249
  });
76177
76250
 
76178
- // ../../services/backend/prompts/templates.ts
76179
- var init_templates = () => {};
76180
-
76181
- // ../../services/backend/prompts/sections/role-identity.ts
76182
- var init_role_identity = __esm(() => {
76183
- init_templates();
76251
+ // ../../services/backend/prompts/teams/solo/prompts/solo.ts
76252
+ var init_solo = __esm(() => {
76253
+ init_sections();
76184
76254
  });
76185
76255
 
76186
- // ../../services/backend/prompts/sections/session-vs-chatroom-task.ts
76187
- var init_session_vs_chatroom_task = () => {};
76256
+ // ../../services/backend/prompts/cli/roles/fromContext.ts
76257
+ var init_fromContext = __esm(() => {
76258
+ init_builder();
76259
+ init_planner();
76260
+ init_solo();
76261
+ });
76188
76262
 
76189
76263
  // ../../services/backend/prompts/teams/duo/prompts/builder.ts
76190
76264
  var init_builder2 = __esm(() => {
@@ -76212,6 +76286,66 @@ var init_fromContext2 = __esm(() => {
76212
76286
  var init_fromContext3 = __esm(() => {
76213
76287
  init_solo();
76214
76288
  });
76289
+ // ../../services/backend/prompts/selector-context.ts
76290
+ var init_selector_context = __esm(() => {
76291
+ init_fromContext();
76292
+ init_fromContext2();
76293
+ init_fromContext3();
76294
+ });
76295
+
76296
+ // ../../services/backend/prompts/sections/role-guidance.ts
76297
+ var init_role_guidance = __esm(() => {
76298
+ init_selector_context();
76299
+ });
76300
+
76301
+ // ../../services/backend/prompts/templates.ts
76302
+ var init_templates = () => {};
76303
+
76304
+ // ../../services/backend/prompts/sections/role-identity.ts
76305
+ var init_role_identity = __esm(() => {
76306
+ init_templates();
76307
+ });
76308
+
76309
+ // ../../services/backend/prompts/native/system-prompt.ts
76310
+ var init_system_prompt = __esm(() => {
76311
+ init_commands_reference();
76312
+ init_glossary();
76313
+ init_role_guidance();
76314
+ init_role_identity();
76315
+ init_selector_context();
76316
+ });
76317
+
76318
+ // ../../services/backend/prompts/native/task-started-content.ts
76319
+ var init_task_started_content = __esm(() => {
76320
+ init_new();
76321
+ });
76322
+
76323
+ // ../../services/backend/prompts/sections/classification-guide.ts
76324
+ var init_classification_guide = __esm(() => {
76325
+ init_cli();
76326
+ init_task_started_content();
76327
+ init_utils3();
76328
+ });
76329
+
76330
+ // ../../services/backend/prompts/sections/current-classification.ts
76331
+ var init_current_classification = () => {};
76332
+
76333
+ // ../../services/backend/prompts/sections/getting-started.ts
76334
+ var init_getting_started = __esm(() => {
76335
+ init_getting_started_content();
76336
+ });
76337
+
76338
+ // ../../services/backend/prompts/sections/handoff-options.ts
76339
+ var init_handoff_options = () => {};
76340
+
76341
+ // ../../services/backend/prompts/sections/next-step.ts
76342
+ var init_next_step = __esm(() => {
76343
+ init_command();
76344
+ init_utils3();
76345
+ });
76346
+
76347
+ // ../../services/backend/prompts/sections/session-vs-chatroom-task.ts
76348
+ var init_session_vs_chatroom_task = () => {};
76215
76349
 
76216
76350
  // ../../services/backend/src/domain/entities/harness/claude.config.ts
76217
76351
  var claudeCapabilities;
@@ -76420,7 +76554,7 @@ function generateHandoffOutput(params) {
76420
76554
  var init_generator = __esm(() => {
76421
76555
  init_command();
76422
76556
  init_reminder();
76423
- init_fromContext();
76557
+ init_system_prompt();
76424
76558
  init_classification_guide();
76425
76559
  init_commands_reference();
76426
76560
  init_current_classification();
@@ -76431,8 +76565,7 @@ var init_generator = __esm(() => {
76431
76565
  init_role_guidance();
76432
76566
  init_role_identity();
76433
76567
  init_session_vs_chatroom_task();
76434
- init_fromContext2();
76435
- init_fromContext3();
76568
+ init_selector_context();
76436
76569
  init_utils3();
76437
76570
  init_types();
76438
76571
  init_review_guidelines();
@@ -77408,32 +77541,28 @@ var init_backlog2 = __esm(() => {
77408
77541
  STALENESS_THRESHOLD_MS = 7 * 24 * 60 * 60 * 1000;
77409
77542
  });
77410
77543
 
77411
- // src/utils/file-content.ts
77412
- var exports_file_content = {};
77413
- __export(exports_file_content, {
77414
- readFileContent: () => readFileContent
77415
- });
77416
- import { readFileSync as readFileSync5 } from "node:fs";
77417
- import { resolve as resolve2 } from "node:path";
77418
- function readFileContent(filePath, optionName) {
77419
- const absolutePath = resolve2(process.cwd(), filePath);
77420
- try {
77421
- return readFileSync5(absolutePath, "utf-8");
77422
- } catch (err) {
77423
- const nodeErr = err;
77424
- throw new Error(`Cannot read file for --${optionName}: ${absolutePath}
77425
- ` + `Reason: ${nodeErr.message}`);
77544
+ // ../../services/backend/prompts/attachments/xml.ts
77545
+ function escapeXmlText(value) {
77546
+ return value.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
77547
+ }
77548
+ function escapeXmlAttribute(value) {
77549
+ return escapeXmlText(value).replace(/"/g, "&quot;");
77550
+ }
77551
+ function xmlTextElement(tag, content, indent = " ") {
77552
+ if (!content.includes(`
77553
+ `)) {
77554
+ return [`${indent}<${tag}>${escapeXmlText(content)}</${tag}>`];
77426
77555
  }
77556
+ return [`${indent}<${tag}>`, escapeXmlText(content), `${indent}</${tag}>`];
77427
77557
  }
77428
- var init_file_content = () => {};
77429
77558
 
77430
77559
  // ../../services/backend/prompts/attachments/render-delivery-attachments.ts
77431
77560
  function renderSnippetAttachment(snippet) {
77432
77561
  return [
77433
- ` <attachment reference="${snippet.reference}">`,
77434
- ` <snippet file-source="${snippet.fileSource}">`,
77562
+ ` <attachment type="snippet" reference="${escapeXmlAttribute(snippet.reference)}">`,
77563
+ ` <snippet file-source="${escapeXmlAttribute(snippet.fileSource)}">`,
77435
77564
  ` <user-selected-content>`,
77436
- snippet.selectedContent,
77565
+ escapeXmlText(snippet.selectedContent),
77437
77566
  ` </user-selected-content>`,
77438
77567
  ` </snippet>`,
77439
77568
  ` </attachment>`
@@ -77442,10 +77571,9 @@ function renderSnippetAttachment(snippet) {
77442
77571
  function renderBacklogAttachments(items, ctx) {
77443
77572
  const lines = [];
77444
77573
  for (const item of items) {
77445
- lines.push(` <attachment type="backlog-item">`);
77446
- lines.push(` - [${item.status.toUpperCase()}] ${item.content}`);
77447
- lines.push(` ID: ${item._id}`);
77448
- lines.push(` <hint>Work on this item. When done: chatroom backlog mark-for-review --chatroom-id="${ctx.chatroomId}" --role="${ctx.role}" --backlog-item-id=${item._id}</hint>`);
77574
+ lines.push(` <attachment type="backlog" backlog-item-id="${escapeXmlAttribute(item._id)}">`);
77575
+ lines.push(...xmlTextElement("content", item.content, " "));
77576
+ lines.push(` <hint>Work on this item. When done: chatroom backlog mark-for-review --chatroom-id="${escapeXmlAttribute(ctx.chatroomId)}" --role="${escapeXmlAttribute(ctx.role)}" --backlog-item-id=${item._id}</hint>`);
77449
77577
  lines.push(` </attachment>`);
77450
77578
  }
77451
77579
  return lines;
@@ -77457,19 +77585,51 @@ function renderSnippetAttachments(snippets) {
77457
77585
  }
77458
77586
  return lines;
77459
77587
  }
77588
+ function renderTaskAttachments(items, _ctx) {
77589
+ const lines = [];
77590
+ for (const item of items) {
77591
+ lines.push(` <attachment type="task" task-id="${escapeXmlAttribute(item._id)}">`);
77592
+ lines.push(...xmlTextElement("content", item.content, " "));
77593
+ lines.push(` <hint>Referenced task attached by user.</hint>`);
77594
+ lines.push(` </attachment>`);
77595
+ }
77596
+ return lines;
77597
+ }
77598
+ function renderMessageAttachments(items) {
77599
+ const lines = [];
77600
+ for (const item of items) {
77601
+ lines.push(` <attachment type="message" message-id="${escapeXmlAttribute(item._id)}">`);
77602
+ lines.push(...xmlTextElement("sender-role", item.senderRole, " "));
77603
+ lines.push(...xmlTextElement("content", item.content, " "));
77604
+ lines.push(` </attachment>`);
77605
+ }
77606
+ return lines;
77607
+ }
77460
77608
  function renderDeliveryAttachmentsBlock(input, ctx) {
77461
77609
  const backlogLines = input.attachedBacklogItems?.length ? DELIVERY_ATTACHMENT_RENDERERS.backlog(input.attachedBacklogItems, ctx) : [];
77610
+ const taskLines = input.attachedTasks?.length ? DELIVERY_ATTACHMENT_RENDERERS.task(input.attachedTasks, ctx) : [];
77611
+ const messageLines = input.attachedMessages?.length ? DELIVERY_ATTACHMENT_RENDERERS.message(input.attachedMessages, ctx) : [];
77462
77612
  const snippetLines = input.attachedSnippets?.length ? DELIVERY_ATTACHMENT_RENDERERS.snippet(input.attachedSnippets, ctx) : [];
77463
- if (backlogLines.length === 0 && snippetLines.length === 0)
77613
+ if (backlogLines.length === 0 && taskLines.length === 0 && messageLines.length === 0 && snippetLines.length === 0) {
77464
77614
  return [];
77465
- return ["", "<attachments>", ...backlogLines, ...snippetLines, "</attachments>"];
77615
+ }
77616
+ return [
77617
+ "",
77618
+ "<attachments>",
77619
+ ...backlogLines,
77620
+ ...taskLines,
77621
+ ...messageLines,
77622
+ ...snippetLines,
77623
+ "</attachments>"
77624
+ ];
77466
77625
  }
77467
77626
  var DELIVERY_ATTACHMENT_RENDERERS;
77468
77627
  var init_render_delivery_attachments = __esm(() => {
77469
77628
  DELIVERY_ATTACHMENT_RENDERERS = {
77470
77629
  backlog: renderBacklogAttachments,
77471
77630
  snippet: renderSnippetAttachments,
77472
- message: () => []
77631
+ message: renderMessageAttachments,
77632
+ task: renderTaskAttachments
77473
77633
  };
77474
77634
  });
77475
77635
 
@@ -77483,7 +77643,9 @@ function detectBacklogDivergence(contextContent, attachedIds) {
77483
77643
  function renderAttachments(input, chatroomId, role) {
77484
77644
  return renderDeliveryAttachmentsBlock({
77485
77645
  attachedBacklogItems: input.attachedBacklogItems,
77486
- attachedSnippets: input.attachedSnippets
77646
+ attachedSnippets: input.attachedSnippets,
77647
+ attachedTasks: input.attachedTasks,
77648
+ attachedMessages: input.attachedMessages
77487
77649
  }, { chatroomId, role, mode: "task-read" });
77488
77650
  }
77489
77651
  function renderDivergenceWarnings(input) {
@@ -77578,7 +77740,9 @@ function buildTaskPromptFromReadResult(result, chatroomId, role) {
77578
77740
  role,
77579
77741
  context: result.context && typeof result.context === "object" ? result.context : undefined,
77580
77742
  attachedBacklogItems: Array.isArray(result.attachedBacklogItems) ? result.attachedBacklogItems : undefined,
77581
- attachedSnippets: Array.isArray(result.attachedSnippets) ? result.attachedSnippets : undefined
77743
+ attachedSnippets: Array.isArray(result.attachedSnippets) ? result.attachedSnippets : undefined,
77744
+ attachedTasks: Array.isArray(result.attachedTasks) ? result.attachedTasks : undefined,
77745
+ attachedMessages: Array.isArray(result.attachedMessages) ? result.attachedMessages : undefined
77582
77746
  });
77583
77747
  }
77584
77748
  function handleTaskReadError(err) {
@@ -78697,13 +78861,8 @@ var init_artifact = __esm(() => {
78697
78861
  };
78698
78862
  });
78699
78863
 
78700
- // src/commands/get-system-prompt/index.ts
78701
- var exports_get_system_prompt = {};
78702
- __export(exports_get_system_prompt, {
78703
- getSystemPromptEffect: () => getSystemPromptEffect,
78704
- getSystemPrompt: () => getSystemPrompt
78705
- });
78706
- async function createDefaultDeps16() {
78864
+ // src/commands/prompt-fetch/shared.ts
78865
+ async function createPromptFetchDeps() {
78707
78866
  const client4 = await getConvexClient();
78708
78867
  return {
78709
78868
  backend: {
@@ -78717,10 +78876,41 @@ async function createDefaultDeps16() {
78717
78876
  }
78718
78877
  };
78719
78878
  }
78720
- function layerFromDeps8(deps) {
78879
+ function promptFetchLayerFromDeps(deps) {
78721
78880
  return exports_Layer.mergeAll(BackendServiceLive(deps.backend), SessionServiceLive(deps.session));
78722
78881
  }
78723
- function handleGetSystemPromptError(err) {
78882
+ function loadChatroomTeamContextEffect(chatroomId) {
78883
+ return exports_Effect.gen(function* () {
78884
+ if (!chatroomId || chatroomId.trim() === "") {
78885
+ return yield* exports_Effect.fail({
78886
+ _tag: "InvalidChatroomId",
78887
+ chatroomId
78888
+ });
78889
+ }
78890
+ const session2 = yield* SessionService;
78891
+ const sessionId = yield* session2.getSessionId();
78892
+ if (!sessionId) {
78893
+ return yield* exports_Effect.fail({ _tag: "NotAuthenticated" });
78894
+ }
78895
+ const convexUrl = yield* session2.getConvexUrl();
78896
+ const backend2 = yield* BackendService;
78897
+ const chatroom = yield* backend2.query(api.chatrooms.get, {
78898
+ sessionId,
78899
+ chatroomId
78900
+ }).pipe(exports_Effect.mapError((cause3) => ({ _tag: "BackendError", cause: cause3 })));
78901
+ if (!chatroom) {
78902
+ return yield* exports_Effect.fail({
78903
+ _tag: "ChatroomNotFound",
78904
+ chatroomId
78905
+ });
78906
+ }
78907
+ return { convexUrl, chatroom };
78908
+ });
78909
+ }
78910
+ function loadChatroomTeamContext(chatroomId) {
78911
+ return loadChatroomTeamContextEffect(chatroomId);
78912
+ }
78913
+ function handlePromptFetchError(err, resourceLabel) {
78724
78914
  return exports_Effect.sync(() => {
78725
78915
  if (err._tag === "NotAuthenticated") {
78726
78916
  console.error(`❌ Not authenticated. Please run: chatroom auth login`);
@@ -78732,41 +78922,37 @@ function handleGetSystemPromptError(err) {
78732
78922
  console.error(`❌ Chatroom not found: ${err.chatroomId}`);
78733
78923
  process.exit(1);
78734
78924
  } else {
78735
- console.error(`❌ Error fetching system prompt: ${err.cause.message}`);
78925
+ console.error(`❌ Error fetching ${resourceLabel}: ${err.cause.message}`);
78736
78926
  process.exit(1);
78737
78927
  }
78738
78928
  });
78739
78929
  }
78930
+ async function runPromptFetchEffect(effect2, resourceLabel, deps) {
78931
+ const d = deps ?? await createPromptFetchDeps();
78932
+ const layer = promptFetchLayerFromDeps(d);
78933
+ await exports_Effect.runPromise(effect2.pipe(exports_Effect.catchAll((err) => handlePromptFetchError(err, resourceLabel)), exports_Effect.provide(layer)));
78934
+ }
78935
+ var init_shared = __esm(() => {
78936
+ init_esm();
78937
+ init_api3();
78938
+ init_storage();
78939
+ init_client2();
78940
+ init_services();
78941
+ });
78942
+
78943
+ // src/commands/get-system-prompt/index.ts
78944
+ var exports_get_system_prompt = {};
78945
+ __export(exports_get_system_prompt, {
78946
+ getSystemPromptEffect: () => getSystemPromptEffect,
78947
+ getSystemPrompt: () => getSystemPrompt
78948
+ });
78740
78949
  async function getSystemPrompt(chatroomId, options, deps) {
78741
- const d = deps ?? await createDefaultDeps16();
78742
- const layer = layerFromDeps8(d);
78743
- await exports_Effect.runPromise(getSystemPromptEffect(chatroomId, options).pipe(exports_Effect.catchAll((err) => handleGetSystemPromptError(err)), exports_Effect.provide(layer)));
78950
+ await runPromptFetchEffect(getSystemPromptEffect(chatroomId, options), "system prompt", deps);
78744
78951
  }
78745
78952
  var getSystemPromptEffect = (chatroomId, options) => exports_Effect.gen(function* () {
78746
78953
  const { role } = options;
78747
- if (!chatroomId || chatroomId.trim() === "") {
78748
- return yield* exports_Effect.fail({
78749
- _tag: "InvalidChatroomId",
78750
- chatroomId
78751
- });
78752
- }
78753
- const session2 = yield* SessionService;
78754
- const sessionId = yield* session2.getSessionId();
78755
- if (!sessionId) {
78756
- return yield* exports_Effect.fail({ _tag: "NotAuthenticated" });
78757
- }
78758
- const convexUrl = yield* session2.getConvexUrl();
78954
+ const { convexUrl, chatroom } = yield* loadChatroomTeamContext(chatroomId);
78759
78955
  const backend2 = yield* BackendService;
78760
- const chatroom = yield* backend2.query(api.chatrooms.get, {
78761
- sessionId,
78762
- chatroomId
78763
- }).pipe(exports_Effect.mapError((cause3) => ({ _tag: "BackendError", cause: cause3 })));
78764
- if (!chatroom) {
78765
- return yield* exports_Effect.fail({
78766
- _tag: "ChatroomNotFound",
78767
- chatroomId
78768
- });
78769
- }
78770
78956
  const prompt = yield* backend2.query(api.prompts.webapp.getAgentPrompt, {
78771
78957
  chatroomId,
78772
78958
  role,
@@ -78783,9 +78969,41 @@ var getSystemPromptEffect = (chatroomId, options) => exports_Effect.gen(function
78783
78969
  var init_get_system_prompt = __esm(() => {
78784
78970
  init_esm();
78785
78971
  init_api3();
78786
- init_storage();
78787
- init_client2();
78788
78972
  init_services();
78973
+ init_shared();
78974
+ });
78975
+
78976
+ // src/commands/get-role-guidance/index.ts
78977
+ var exports_get_role_guidance = {};
78978
+ __export(exports_get_role_guidance, {
78979
+ getRoleGuidanceEffect: () => getRoleGuidanceEffect,
78980
+ getRoleGuidance: () => getRoleGuidance
78981
+ });
78982
+ async function getRoleGuidance(chatroomId, options, deps) {
78983
+ await runPromptFetchEffect(getRoleGuidanceEffect(chatroomId, options), "role guidance", deps);
78984
+ }
78985
+ var getRoleGuidanceEffect = (chatroomId, options) => exports_Effect.gen(function* () {
78986
+ const { role } = options;
78987
+ const { convexUrl, chatroom } = yield* loadChatroomTeamContext(chatroomId);
78988
+ const backend2 = yield* BackendService;
78989
+ const guidance = yield* backend2.query(api.prompts.webapp.getRoleGuidance, {
78990
+ chatroomId,
78991
+ role,
78992
+ teamId: chatroom.teamId,
78993
+ teamName: chatroom.teamName,
78994
+ teamRoles: chatroom.teamRoles,
78995
+ teamEntryPoint: chatroom.teamEntryPoint,
78996
+ convexUrl: convexUrl ?? undefined
78997
+ }).pipe(exports_Effect.mapError((cause3) => ({ _tag: "BackendError", cause: cause3 })));
78998
+ yield* exports_Effect.sync(() => {
78999
+ console.log(guidance);
79000
+ });
79001
+ });
79002
+ var init_get_role_guidance = __esm(() => {
79003
+ init_esm();
79004
+ init_api3();
79005
+ init_services();
79006
+ init_shared();
78789
79007
  });
78790
79008
 
78791
79009
  // src/commands/telegram/index.ts
@@ -78794,7 +79012,7 @@ __export(exports_telegram, {
78794
79012
  sendMessageEffect: () => sendMessageEffect,
78795
79013
  sendMessage: () => sendMessage
78796
79014
  });
78797
- async function createDefaultDeps17() {
79015
+ async function createDefaultDeps16() {
78798
79016
  const client4 = await getConvexClient();
78799
79017
  return {
78800
79018
  backend: {
@@ -78807,7 +79025,7 @@ async function createDefaultDeps17() {
78807
79025
  }
78808
79026
  };
78809
79027
  }
78810
- function layerFromDeps9(deps) {
79028
+ function layerFromDeps8(deps) {
78811
79029
  return commandServicesLayerFromDeps({
78812
79030
  backend: {
78813
79031
  query: async () => {
@@ -78876,8 +79094,8 @@ ${err.cause.message}`);
78876
79094
  });
78877
79095
  }
78878
79096
  async function sendMessage(options, deps) {
78879
- const d = deps ?? await createDefaultDeps17();
78880
- const layer = layerFromDeps9(d);
79097
+ const d = deps ?? await createDefaultDeps16();
79098
+ const layer = layerFromDeps8(d);
78881
79099
  await exports_Effect.runPromise(sendMessageEffect(options).pipe(exports_Effect.catchAll((err) => handleSendMessageError(err)), exports_Effect.provide(layer)));
78882
79100
  }
78883
79101
  var sendMessageEffect = (options) => exports_Effect.gen(function* () {
@@ -88138,7 +88356,7 @@ async function discoverModelsForHarness(harness, service3) {
88138
88356
  async function discoverModels(agentServices) {
88139
88357
  return exports_Effect.runPromise(discoverModelsEffect(agentServices));
88140
88358
  }
88141
- function createDefaultDeps18() {
88359
+ function createDefaultDeps17() {
88142
88360
  return {
88143
88361
  backend: {
88144
88362
  mutation: async () => {
@@ -88473,7 +88691,7 @@ var init_init2 = __esm(() => {
88473
88691
  convexUrl,
88474
88692
  agentServices,
88475
88693
  cachedModels,
88476
- deps: createDefaultDeps18()
88694
+ deps: createDefaultDeps17()
88477
88695
  });
88478
88696
  yield* registerEventListenersEffect().pipe(exports_Effect.provide(daemonSessionToLayers(init2)));
88479
88697
  yield* logStartupEffect(cachedModels).pipe(exports_Effect.provide(daemonSessionToLayers(init2)));
@@ -105033,7 +105251,7 @@ async function isChatroomInstalledDefault() {
105033
105251
  return false;
105034
105252
  }
105035
105253
  }
105036
- async function createDefaultDeps19() {
105254
+ async function createDefaultDeps18() {
105037
105255
  const client4 = await getConvexClient();
105038
105256
  const fs11 = await import("fs/promises");
105039
105257
  return {
@@ -105060,7 +105278,7 @@ async function createDefaultDeps19() {
105060
105278
  isChatroomInstalled: isChatroomInstalledDefault
105061
105279
  };
105062
105280
  }
105063
- function layerFromDeps10(deps) {
105281
+ function layerFromDeps9(deps) {
105064
105282
  return exports_Layer.succeed(OpenCodeInstallFsService, {
105065
105283
  access: (p) => exports_Effect.tryPromise({
105066
105284
  try: () => deps.fs.access(p),
@@ -105108,8 +105326,8 @@ After installation, run this command again.`;
105108
105326
  });
105109
105327
  }
105110
105328
  async function installTool(options = {}, deps) {
105111
- const d = deps ?? await createDefaultDeps19();
105112
- const layer = layerFromDeps10(d);
105329
+ const d = deps ?? await createDefaultDeps18();
105330
+ const layer = layerFromDeps9(d);
105113
105331
  return exports_Effect.runPromise(installToolEffect(options).pipe(exports_Effect.catchAll((err) => handleInstallError(err)), exports_Effect.provide(layer)));
105114
105332
  }
105115
105333
  var TOOL_CONTENT = `import { tool } from "@opencode-ai/plugin";
@@ -105516,6 +105734,19 @@ var {
105516
105734
  Help
105517
105735
  } = import__.default;
105518
105736
 
105737
+ // src/commands/register-chatroom-role-command.ts
105738
+ function registerChatroomRoleCommand(program2, config) {
105739
+ program2.command(config.name).description(config.description).requiredOption("--chatroom-id <id>", "Chatroom identifier").requiredOption("--role <role>", "Your role (e.g., planner, builder)").action(async (options) => {
105740
+ await config.maybeRequireAuth();
105741
+ await config.run(options.chatroomId, { role: options.role });
105742
+ });
105743
+ }
105744
+
105745
+ // src/utils/multi-value-option.ts
105746
+ function collectMultiValueOption(value, previous) {
105747
+ return previous ? [...previous, value] : [value];
105748
+ }
105749
+
105519
105750
  // src/utils/stdin.ts
105520
105751
  async function readStdin() {
105521
105752
  return new Promise((resolve, reject) => {
@@ -105532,6 +105763,28 @@ async function readStdin() {
105532
105763
  });
105533
105764
  }
105534
105765
 
105766
+ // src/utils/read-heredoc-or-file-content.ts
105767
+ async function readHeredocOrFileContent(options, params) {
105768
+ let content;
105769
+ if (options.contentFile) {
105770
+ const { readFileContent: readFileContent2 } = await Promise.resolve().then(() => (init_file_content(), exports_file_content));
105771
+ content = readFileContent2(options.contentFile, "content-file");
105772
+ } else {
105773
+ const stdinContent = await readStdin();
105774
+ const { validateStdinHeredocBody: validateStdinHeredocBody2 } = await Promise.resolve().then(() => (init_stdin_heredoc(), exports_stdin_heredoc));
105775
+ validateStdinHeredocBody2(stdinContent, params.delimiter, params.fieldLabel);
105776
+ content = stdinContent;
105777
+ }
105778
+ if (!content || content.trim().length === 0) {
105779
+ console.error(`❌ ${params.emptyMessage}`);
105780
+ console.error("");
105781
+ console.error(" Example with heredoc:");
105782
+ console.error(` ${params.heredocExampleCommand}`);
105783
+ process.exit(1);
105784
+ }
105785
+ return content;
105786
+ }
105787
+
105535
105788
  // src/index.ts
105536
105789
  init_version();
105537
105790
  var program2 = new Command;
@@ -105606,9 +105859,7 @@ handoffCommandGroup.command("view-template").description("Print the handoff mess
105606
105859
  process.exit(1);
105607
105860
  }
105608
105861
  });
105609
- handoffCommandGroup.requiredOption("--chatroom-id <id>", "Chatroom identifier").requiredOption("--role <role>", "Your role").requiredOption("--next-role <nextRole>", "Role to hand off to").option("--attach-artifact <artifactId>", "Attach artifact to handoff (can be used multiple times)", (value, previous) => {
105610
- return previous ? [...previous, value] : [value];
105611
- }, []).action(async (options) => {
105862
+ handoffCommandGroup.requiredOption("--chatroom-id <id>", "Chatroom identifier").requiredOption("--role <role>", "Your role").requiredOption("--next-role <nextRole>", "Role to hand off to").option("--attach-artifact <artifactId>", "Attach artifact to handoff (can be used multiple times)", collectMultiValueOption, []).action(async (options) => {
105612
105863
  await maybeRequireAuth();
105613
105864
  const { decode: decode5 } = await Promise.resolve().then(() => exports_decode);
105614
105865
  const stdinContent = await readStdin();
@@ -105648,32 +105899,15 @@ backlogCommand.command("list").description("List backlog items").requiredOption(
105648
105899
  backlogCommand.command("add").description("Add a backlog item").requiredOption("--chatroom-id <id>", "Chatroom identifier").requiredOption("--role <role>", "Your role (creator)").option("--content-file <path>", "Path to file containing task content (or use stdin/heredoc)").action(async (options) => {
105649
105900
  await maybeRequireAuth();
105650
105901
  let content;
105651
- if (options.contentFile) {
105652
- const { readFileContent: readFileContent2 } = await Promise.resolve().then(() => (init_file_content(), exports_file_content));
105653
- try {
105654
- content = readFileContent2(options.contentFile, "content-file");
105655
- } catch (err) {
105656
- console.error(`❌ ${err.message}`);
105657
- process.exit(1);
105658
- }
105659
- } else {
105660
- const stdinContent = await readStdin();
105661
- const { BACKLOG_STDIN_DELIMITER: BACKLOG_STDIN_DELIMITER2, validateStdinHeredocBody: validateStdinHeredocBody2 } = await Promise.resolve().then(() => (init_stdin_heredoc(), exports_stdin_heredoc));
105662
- try {
105663
- validateStdinHeredocBody2(stdinContent, BACKLOG_STDIN_DELIMITER2, "Content");
105664
- } catch (err) {
105665
- console.error(`❌ ${err.message}`);
105666
- process.exit(1);
105667
- }
105668
- content = stdinContent;
105669
- }
105670
- if (!content || content.trim().length === 0) {
105671
- console.error("❌ Content is empty. Provide content via --content-file or stdin (heredoc).");
105672
- console.error("");
105673
- console.error(" Example with heredoc:");
105674
- console.error(" chatroom backlog add --chatroom-id=<id> --role=<role> << 'CHATROOM_BACKLOG_END'");
105675
- console.error(" Your backlog item content here");
105676
- console.error(" CHATROOM_BACKLOG_END");
105902
+ try {
105903
+ content = await readHeredocOrFileContent(options, {
105904
+ delimiter: (await Promise.resolve().then(() => (init_stdin_heredoc(), exports_stdin_heredoc))).BACKLOG_STDIN_DELIMITER,
105905
+ fieldLabel: "Content",
105906
+ emptyMessage: "Content is empty. Provide content via --content-file or stdin (heredoc).",
105907
+ heredocExampleCommand: "chatroom backlog add --chatroom-id=<id> --role=<role> << 'CHATROOM_BACKLOG_END'"
105908
+ });
105909
+ } catch (err) {
105910
+ console.error(`❌ ${err.message}`);
105677
105911
  process.exit(1);
105678
105912
  }
105679
105913
  const { addBacklog: addBacklog2 } = await Promise.resolve().then(() => (init_backlog2(), exports_backlog));
@@ -105682,32 +105916,15 @@ backlogCommand.command("add").description("Add a backlog item").requiredOption("
105682
105916
  backlogCommand.command("update").description("Update the content of an existing backlog item.").requiredOption("--chatroom-id <id>", "Chatroom identifier").requiredOption("--role <role>", "Your role").requiredOption("--backlog-item-id <id>", "Backlog item ID to update").option("--content-file <path>", "Path to file containing new content (or use stdin/heredoc)").action(async (options) => {
105683
105917
  await maybeRequireAuth();
105684
105918
  let content;
105685
- if (options.contentFile) {
105686
- const { readFileContent: readFileContent2 } = await Promise.resolve().then(() => (init_file_content(), exports_file_content));
105687
- try {
105688
- content = readFileContent2(options.contentFile, "content-file");
105689
- } catch (err) {
105690
- console.error(`❌ ${err.message}`);
105691
- process.exit(1);
105692
- }
105693
- } else {
105694
- const stdinContent = await readStdin();
105695
- const { BACKLOG_STDIN_DELIMITER: BACKLOG_STDIN_DELIMITER2, validateStdinHeredocBody: validateStdinHeredocBody2 } = await Promise.resolve().then(() => (init_stdin_heredoc(), exports_stdin_heredoc));
105696
- try {
105697
- validateStdinHeredocBody2(stdinContent, BACKLOG_STDIN_DELIMITER2, "Content");
105698
- } catch (err) {
105699
- console.error(`❌ ${err.message}`);
105700
- process.exit(1);
105701
- }
105702
- content = stdinContent;
105703
- }
105704
- if (!content || content.trim().length === 0) {
105705
- console.error("❌ Content is empty. Provide content via --content-file or stdin (heredoc).");
105706
- console.error("");
105707
- console.error(" Example with heredoc:");
105708
- console.error(" chatroom backlog update --chatroom-id=<id> --role=<role> --backlog-item-id=<id> << 'CHATROOM_BACKLOG_END'");
105709
- console.error(" New content here");
105710
- console.error(" CHATROOM_BACKLOG_END");
105919
+ try {
105920
+ content = await readHeredocOrFileContent(options, {
105921
+ delimiter: (await Promise.resolve().then(() => (init_stdin_heredoc(), exports_stdin_heredoc))).BACKLOG_STDIN_DELIMITER,
105922
+ fieldLabel: "Content",
105923
+ emptyMessage: "Content is empty. Provide content via --content-file or stdin (heredoc).",
105924
+ heredocExampleCommand: "chatroom backlog update --chatroom-id=<id> --role=<role> --backlog-item-id=<id> << 'CHATROOM_BACKLOG_END'"
105925
+ });
105926
+ } catch (err) {
105927
+ console.error(`❌ ${err.message}`);
105711
105928
  process.exit(1);
105712
105929
  }
105713
105930
  const { updateBacklog: updateBacklog2 } = await Promise.resolve().then(() => (init_backlog2(), exports_backlog));
@@ -105879,9 +106096,7 @@ artifactCommand.command("view").description("View a single artifact").requiredOp
105879
106096
  const { viewArtifact: viewArtifact2 } = await Promise.resolve().then(() => (init_artifact(), exports_artifact));
105880
106097
  await viewArtifact2(options.chatroomId, { role: options.role, artifactId: options.artifactId });
105881
106098
  });
105882
- artifactCommand.command("view-many").description("View multiple artifacts").requiredOption("--chatroom-id <id>", "Chatroom identifier").requiredOption("--role <role>", "Your role").option("--artifact <artifactId>", "Artifact ID to view (can be used multiple times)", (value, previous) => {
105883
- return previous ? [...previous, value] : [value];
105884
- }, []).action(async (options) => {
106099
+ artifactCommand.command("view-many").description("View multiple artifacts").requiredOption("--chatroom-id <id>", "Chatroom identifier").requiredOption("--role <role>", "Your role").option("--artifact <artifactId>", "Artifact ID to view (can be used multiple times)", collectMultiValueOption, []).action(async (options) => {
105885
106100
  await maybeRequireAuth();
105886
106101
  const { viewManyArtifacts: viewManyArtifacts2 } = await Promise.resolve().then(() => (init_artifact(), exports_artifact));
105887
106102
  await viewManyArtifacts2(options.chatroomId, {
@@ -105889,10 +106104,23 @@ artifactCommand.command("view-many").description("View multiple artifacts").requ
105889
106104
  artifactIds: options.artifact || []
105890
106105
  });
105891
106106
  });
105892
- program2.command("get-system-prompt").description("Fetch the system prompt for your role in a chatroom").requiredOption("--chatroom-id <id>", "Chatroom identifier").requiredOption("--role <role>", "Your role (e.g., planner, builder)").action(async (options) => {
105893
- await maybeRequireAuth();
105894
- const { getSystemPrompt: getSystemPrompt2 } = await Promise.resolve().then(() => (init_get_system_prompt(), exports_get_system_prompt));
105895
- await getSystemPrompt2(options.chatroomId, { role: options.role });
106107
+ registerChatroomRoleCommand(program2, {
106108
+ name: "get-system-prompt",
106109
+ description: "Fetch the system prompt for your role in a chatroom",
106110
+ maybeRequireAuth,
106111
+ run: async (chatroomId, { role }) => {
106112
+ const { getSystemPrompt: getSystemPrompt2 } = await Promise.resolve().then(() => (init_get_system_prompt(), exports_get_system_prompt));
106113
+ await getSystemPrompt2(chatroomId, { role });
106114
+ }
106115
+ });
106116
+ registerChatroomRoleCommand(program2, {
106117
+ name: "get-role-guidance",
106118
+ description: "Fetch role-specific operating-model guidance for your role in a chatroom",
106119
+ maybeRequireAuth,
106120
+ run: async (chatroomId, { role }) => {
106121
+ const { getRoleGuidance: getRoleGuidance2 } = await Promise.resolve().then(() => (init_get_role_guidance(), exports_get_role_guidance));
106122
+ await getRoleGuidance2(chatroomId, { role });
106123
+ }
105896
106124
  });
105897
106125
  var telegramCommand = program2.command("telegram").description("Telegram integration commands");
105898
106126
  telegramCommand.command("send-message").description("Send a message to a connected Telegram integration").requiredOption("--chatroom-id <id>", "Chatroom identifier").requiredOption("--integration-id <id>", "Telegram integration ID").requiredOption("--message <text>", "Message to send").option("--role <role>", "Sender role label (default: user)").action(async (options) => {
@@ -105941,4 +106169,4 @@ program2.hook("preAction", async (_thisCommand, actionCommand) => {
105941
106169
  });
105942
106170
  program2.parse();
105943
106171
 
105944
- //# debugId=27DC6D1FF01641CC64756E2164756E21
106172
+ //# debugId=2DFDF6706DFDE76764756E2164756E21