chatroom-cli 1.94.1 → 1.95.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -28452,6 +28452,44 @@ var init_model_variant = __esm(() => {
28452
28452
  PARAM_RE = /^[A-Za-z0-9_-]+=[^,\[\]\=]+$/;
28453
28453
  });
28454
28454
 
28455
+ // ../../services/backend/src/domain/entities/harness/model-provider.ts
28456
+ function prefixModelWithProvider(provider, modelId) {
28457
+ const bracket = modelId.indexOf("[");
28458
+ const base = bracket === -1 ? modelId : modelId.slice(0, bracket);
28459
+ const suffix = bracket === -1 ? "" : modelId.slice(bracket);
28460
+ if (base.includes("/"))
28461
+ return modelId;
28462
+ return `${provider}/${base}${suffix}`;
28463
+ }
28464
+ function stripProviderPrefix(provider, modelId) {
28465
+ const prefix = `${provider}/`;
28466
+ return modelId.startsWith(prefix) ? modelId.slice(prefix.length) : modelId;
28467
+ }
28468
+ function inferCopilotModelProvider(modelId) {
28469
+ const base = modelId.split("[")[0];
28470
+ if (base.startsWith("claude"))
28471
+ return "anthropic";
28472
+ if (base.startsWith("gpt"))
28473
+ return "openai";
28474
+ if (base.startsWith("gemini"))
28475
+ return "google";
28476
+ return "github-copilot";
28477
+ }
28478
+ function inferCommandCodeModelProvider(modelId) {
28479
+ const base = modelId.split("[")[0];
28480
+ if (base.startsWith("claude"))
28481
+ return "anthropic";
28482
+ if (base.startsWith("gpt"))
28483
+ return "openai";
28484
+ return "commandcode";
28485
+ }
28486
+ function prefixCatalogModels(provider, models) {
28487
+ return models.map((model) => prefixModelWithProvider(provider, model));
28488
+ }
28489
+ function prefixCatalogModelsWithInfer(infer, models) {
28490
+ return models.map((model) => prefixModelWithProvider(infer(model), model));
28491
+ }
28492
+
28455
28493
  // src/daemon/infrastructure/local/harness/services/cursor-sdk/cursor-sdk-package.ts
28456
28494
  var exports_cursor_sdk_package = {};
28457
28495
  __export(exports_cursor_sdk_package, {
@@ -28604,7 +28642,7 @@ async function fetchCursorSdkModelCatalog() {
28604
28642
  try {
28605
28643
  const sdk = await importBundledCursorSdk();
28606
28644
  const models = await sdk.Cursor.models.list();
28607
- return expandCursorSdkModelCatalog(models);
28645
+ return prefixCatalogModels("cursor", expandCursorSdkModelCatalog(models));
28608
28646
  } catch (err) {
28609
28647
  console.warn(`[cursor] listModels failed:`, err instanceof Error ? err.message : err);
28610
28648
  return [];
@@ -28891,6 +28929,9 @@ var init_copilot_stream_reader = __esm(() => {
28891
28929
  });
28892
28930
 
28893
28931
  // src/daemon/infrastructure/local/harness/services/copilot/copilot-agent-service.ts
28932
+ function resolveCopilotSpawnModel(model) {
28933
+ return stripProviderPrefix(inferCopilotModelProvider(model), model);
28934
+ }
28894
28935
  var COPILOT_COMMAND = "copilot", CopilotAgentService;
28895
28936
  var init_copilot_agent_service = __esm(() => {
28896
28937
  init_base_cli_agent_service();
@@ -28916,7 +28957,7 @@ var init_copilot_agent_service = __esm(() => {
28916
28957
  const args2 = ["-p"];
28917
28958
  args2.push("--stream", "on");
28918
28959
  if (options.model) {
28919
- args2.push("--model", options.model);
28960
+ args2.push("--model", resolveCopilotSpawnModel(options.model));
28920
28961
  }
28921
28962
  args2.push("--allow-all");
28922
28963
  args2.push(prompt);
@@ -29038,13 +29079,14 @@ var init_claude_model_variants = __esm(() => {
29038
29079
  function decodeClaudeVariant(encoded) {
29039
29080
  if (encoded === undefined)
29040
29081
  return;
29082
+ const stripped = stripProviderPrefix("anthropic", encoded);
29041
29083
  try {
29042
- const d = validateModelVariantParams(decodeModelVariant(encoded), CLAUDE_MODEL_VARIANT_COMBINATIONS);
29084
+ const d = validateModelVariantParams(decodeModelVariant(stripped), CLAUDE_MODEL_VARIANT_COMBINATIONS);
29043
29085
  const effort = d.params.effort;
29044
29086
  return { model: d.model, ...effort && effort !== "none" ? { effort } : {} };
29045
29087
  } catch (error) {
29046
- if (!encoded.includes("["))
29047
- return { model: encoded };
29088
+ if (!stripped.includes("["))
29089
+ return { model: stripped };
29048
29090
  throw error;
29049
29091
  }
29050
29092
  }
@@ -30656,7 +30698,7 @@ function buildAgentName(context5) {
30656
30698
  function decodeCodexVariant(encoded) {
30657
30699
  if (encoded === undefined)
30658
30700
  return;
30659
- return validateModelVariantParams(decodeModelVariant(encoded), CODEX_MODEL_VARIANT_COMBINATIONS);
30701
+ return validateModelVariantParams(decodeModelVariant(stripProviderPrefix("openai", encoded)), CODEX_MODEL_VARIANT_COMBINATIONS);
30660
30702
  }
30661
30703
  function buildThreadOptions(workingDir, variant) {
30662
30704
  const options = {
@@ -31228,7 +31270,7 @@ var init_command_code_agent_service = __esm(() => {
31228
31270
  return this.checkVersion(COMMANDCODE_COMMAND);
31229
31271
  }
31230
31272
  async listModels() {
31231
- return COMMANDCODE_MODELS;
31273
+ return COMMANDCODE_MODELS.map((model) => prefixModelWithProvider(inferCommandCodeModelProvider(model), model));
31232
31274
  }
31233
31275
  createExitSubscription(childProcess, pid, context5) {
31234
31276
  let exitInfo = null;
@@ -78163,6 +78205,7 @@ var init_participant = __esm(() => {
78163
78205
  ONLINE_OR_STARTING_STATUSES = new Set([
78164
78206
  "agent.waiting",
78165
78207
  "agent.requestStart",
78208
+ "agent.restart",
78166
78209
  "agent.started",
78167
78210
  "task.acknowledged",
78168
78211
  "task.inProgress",
@@ -79000,6 +79043,32 @@ var init_builder_to_planner = __esm(() => {
79000
79043
  init_role_guidance_disclosure();
79001
79044
  });
79002
79045
 
79046
+ // ../../services/backend/prompts/enhancer/defragmentation-reference.ts
79047
+ function renderDefragmentationHandoffReference() {
79048
+ return [
79049
+ "### Defragmentation workflow checklist",
79050
+ 'Complete the optional **Defragmentation** section when the planner check-in addresses a large or multi-surface system revision, including refactoring, consolidation, or consistency work. Write exactly "Not Applicable." only when no such revision is proposed.',
79051
+ "",
79052
+ "1. **Study surfaces** — map all call sites, use cases, and complexity variants before proposing slices; name every relevant file/module",
79053
+ "2. **Golden implementation** — build a standalone canonical solution first; introduce canonical domain entities/types only when the studied variants require them, then shared use cases, UI components, or utilities; do not patch duplicates in place",
79054
+ "3. **Migrate callers** — refactor all consumers to the golden path; each slice must be shippable end-to-end",
79055
+ "4. **Delete legacy** — remove old implementations only after migration is complete; no dead-code leftovers",
79056
+ "",
79057
+ "### Anti-patterns to flag",
79058
+ "- Incremental copy-paste fixes across N files without a golden SSOT",
79059
+ "- New abstraction without studying all existing variants",
79060
+ '- Leaving old code "for safety" after migration',
79061
+ "- Slices that add helpers/infra without a runnable end-to-end outcome",
79062
+ "- Parallel implementations coexisting without a deletion plan",
79063
+ "",
79064
+ "### Structural decisions",
79065
+ "- Identify SSOT locations for domain entities, shared use cases, and UI components",
79066
+ "- Align with `structural-decisions` glossary: folder structure, file naming, interface locations",
79067
+ "- Flag when the plan scatters the canonical implementation across unrelated modules"
79068
+ ].join(`
79069
+ `);
79070
+ }
79071
+
79003
79072
  // ../../services/backend/prompts/enhancer/webapp-ux-reference.ts
79004
79073
  function renderWebappUxHandoffReference() {
79005
79074
  return [
@@ -79098,7 +79167,7 @@ function getEnhancerFeedbackTemplateBody() {
79098
79167
  <specific misreadings or missing constraints — what the user asked vs what the planner proposed>
79099
79168
  </handoff-overview>
79100
79169
 
79101
- <!-- UI collapses proofs, direction, ux, and notes by default; overview and action required are expanded -->
79170
+ <!-- UI collapses proofs, direction, ux, defragmentation, and notes by default; overview and action required are expanded -->
79102
79171
 
79103
79172
  <handoff-proofs>
79104
79173
  ## Reasoning review
@@ -79125,6 +79194,20 @@ function getEnhancerFeedbackTemplateBody() {
79125
79194
  - **Bulk safeguards:** <batch/multi-item operations gated by confirm with count/impact summary; cite missing confirms>
79126
79195
  </handoff-ux>
79127
79196
 
79197
+ <handoff-defragmentation>
79198
+ <!-- Optional — write exactly "Not Applicable." when no large or multi-surface system revision is proposed -->
79199
+ <!-- When revision work is proposed: specific findings tied to the planner's proposal. No code blocks (use Suggested edits). -->
79200
+ - **Surfaces:** <call sites and modules identified; gaps in surface mapping>
79201
+ - **Golden path:** <whether planner builds standalone canonical implementation first>
79202
+ - **Domain model:** <canonical types/entities needed or "not needed">
79203
+ - **Shared components:** <shared abstractions planned (use cases, UI, utilities)>
79204
+ - **Slice ordering:** <study → golden → migrate → delete sequence respected?>
79205
+ - **Migration plan:** <how all callers move to golden path>
79206
+ - **Deletion plan:** <old implementations slated for removal>
79207
+ - **Duplication:** <existing duplicates to eliminate; risk of new duplication>
79208
+ - **Structural decisions:** <folder/module boundaries; SSOT locations>
79209
+ </handoff-defragmentation>
79210
+
79128
79211
  <handoff-notes>
79129
79212
  ## Knowledge gaps
79130
79213
  <specific facts, files, or research to verify — name what to check and why>
@@ -79163,10 +79246,12 @@ ${getHandoffReportTemplateIntro("Planning Feedback (Enhancer → Planner)")}
79163
79246
 
79164
79247
  The planner sent you three XML sections. Your job is **advisory adversarial review** — raise risks, challenge assumptions, align with user intent. Be **specific and targeted**: cite concrete claims, files, UX choices, and gaps from the check-in so the planner can improve the plan without re-synthesizing vague feedback.
79165
79248
 
79166
- Give **concrete, actionable recommendations** in every section. End with **Recommendations** (second-last: summarized suggestions, tradeoffs, and considerations) then **Suggested edits** (last: proposed edits to grounding and the builder-handoff with file paths and code snippets). For UI work, complete the optional **UX** section using the reference below. **Do not rewrite their full builder brief.** The planner makes the final call.
79249
+ Give **concrete, actionable recommendations** in every section. End with **Recommendations** (second-last: summarized suggestions, tradeoffs, and considerations) then **Suggested edits** (last: proposed edits to grounding and the builder-handoff with file paths and code snippets). For UI work, complete the optional **UX** section using the reference below. For large or multi-surface revision work, complete the optional **Defragmentation** section using its reference below. **Do not rewrite their full builder brief.** The planner makes the final call.
79167
79250
 
79168
79251
  ${renderWebappUxHandoffReference()}
79169
79252
 
79253
+ ${renderDefragmentationHandoffReference()}
79254
+
79170
79255
  \`\`\`markdown
79171
79256
  ${getEnhancerFeedbackTemplateBody()}
79172
79257
  \`\`\`
@@ -80212,6 +80297,24 @@ var init_generator = __esm(() => {
80212
80297
  init_review_guidelines();
80213
80298
  });
80214
80299
 
80300
+ // src/infrastructure/deps/create-convex-command-deps.ts
80301
+ async function createConvexCommandDeps() {
80302
+ const client4 = await getConvexClient();
80303
+ const backend2 = {
80304
+ mutation: (endpoint, args2) => client4.mutation(endpoint, args2),
80305
+ query: (endpoint, args2) => client4.query(endpoint, args2)
80306
+ };
80307
+ const session2 = { getSessionId, getConvexUrl, getOtherSessionUrls };
80308
+ return {
80309
+ backend: backend2,
80310
+ session: session2
80311
+ };
80312
+ }
80313
+ var init_create_convex_command_deps = __esm(() => {
80314
+ init_storage();
80315
+ init_client2();
80316
+ });
80317
+
80215
80318
  // src/commands/handoff/index.ts
80216
80319
  var exports_handoff = {};
80217
80320
  __export(exports_handoff, {
@@ -80219,18 +80322,7 @@ __export(exports_handoff, {
80219
80322
  handoff: () => handoff
80220
80323
  });
80221
80324
  async function createDefaultDeps10() {
80222
- const client4 = await getConvexClient();
80223
- return {
80224
- backend: {
80225
- mutation: (endpoint, args2) => client4.mutation(endpoint, args2),
80226
- query: (endpoint, args2) => client4.query(endpoint, args2)
80227
- },
80228
- session: {
80229
- getSessionId,
80230
- getConvexUrl,
80231
- getOtherSessionUrls
80232
- }
80233
- };
80325
+ return createConvexCommandDeps();
80234
80326
  }
80235
80327
  function handleHandoffError(err) {
80236
80328
  return exports_Effect.sync(() => {
@@ -80347,8 +80439,7 @@ var init_handoff = __esm(() => {
80347
80439
  init_values();
80348
80440
  init_esm();
80349
80441
  init_api3();
80350
- init_storage();
80351
- init_client2();
80442
+ init_create_convex_command_deps();
80352
80443
  init_services();
80353
80444
  init_error_formatting();
80354
80445
  });
@@ -81645,18 +81736,7 @@ __export(exports_skill, {
81645
81736
  activateSkill: () => activateSkill
81646
81737
  });
81647
81738
  async function createDefaultDeps15() {
81648
- const client4 = await getConvexClient();
81649
- return {
81650
- backend: {
81651
- mutation: (endpoint, args2) => client4.mutation(endpoint, args2),
81652
- query: (endpoint, args2) => client4.query(endpoint, args2)
81653
- },
81654
- session: {
81655
- getSessionId,
81656
- getConvexUrl,
81657
- getOtherSessionUrls
81658
- }
81659
- };
81739
+ return createConvexCommandDeps();
81660
81740
  }
81661
81741
  function handleListSkillsError(err) {
81662
81742
  return exports_Effect.sync(() => {
@@ -81782,8 +81862,7 @@ var listSkillsEffect = (chatroomId, _options) => exports_Effect.gen(function* ()
81782
81862
  var init_skill = __esm(() => {
81783
81863
  init_esm();
81784
81864
  init_api3();
81785
- init_storage();
81786
- init_client2();
81865
+ init_create_convex_command_deps();
81787
81866
  init_services();
81788
81867
  init_convex_error();
81789
81868
  });
@@ -81841,6 +81920,111 @@ var init_send = __esm(() => {
81841
81920
  init_client2();
81842
81921
  });
81843
81922
 
81923
+ // ../../services/backend/src/domain/usecase/message/serialize-message.ts
81924
+ function attachmentContext(options) {
81925
+ return { chatroomId: options.chatroomId ?? "", role: options.role ?? "" };
81926
+ }
81927
+ function serializeLinearMessage(message, options) {
81928
+ const target = message.targetRole ? ` → ${message.targetRole}` : "";
81929
+ const attachments = message.attachments ? renderDeliveryAttachmentsBlock(message.attachments, attachmentContext(options)).join(`
81930
+ `) : "";
81931
+ return `${new Date(message._creationTime).toISOString()} | ${message.senderRole}${target}
81932
+ ${attachments ? `${attachments}
81933
+ ` : ""}
81934
+ ${message.content}`;
81935
+ }
81936
+ function serializeTaskOriginMessage(message) {
81937
+ return `<message sender="${escapeXmlAttribute(message.senderRole)}" message-id="${escapeXmlAttribute(message._id)}">
81938
+ <message-content>
81939
+ ${escapeXmlText(message.content)}
81940
+ </message-content>
81941
+ </message>`;
81942
+ }
81943
+ function serializeContextXmlMessage(message, options) {
81944
+ const indent = options.indent ?? " ";
81945
+ const attrs = contextMessageAttributes(message);
81946
+ const task = contextTaskBlock(message, indent);
81947
+ const attachmentLines = contextAttachmentLines(message, options, indent);
81948
+ return [
81949
+ `<message ${attrs}>`,
81950
+ task,
81951
+ ...attachmentLines,
81952
+ `${indent}Content:`,
81953
+ `${indent}<message-content>`,
81954
+ `${indent}${indent}${escapeXmlText(message.content)}`,
81955
+ `${indent}</message-content>`,
81956
+ `</message>`
81957
+ ].filter(Boolean).join(`
81958
+ `);
81959
+ }
81960
+ function contextMessageAttributes(message) {
81961
+ const target = message.targetRole ? ` to="${escapeXmlAttribute(message.targetRole)}"` : "";
81962
+ return `id="${escapeXmlAttribute(message._id)}" from="${escapeXmlAttribute(message.senderRole)}"${target} type="${escapeXmlAttribute(message.type)}"`;
81963
+ }
81964
+ function contextTaskBlock(message, indent) {
81965
+ if (!message.task)
81966
+ return "";
81967
+ return `
81968
+ ${indent}<task id="${escapeXmlAttribute(message.task._id)}" status="${escapeXmlAttribute(message.task.status)}">
81969
+ ${indent}${indent}${escapeXmlText(message.task.content)}
81970
+ ${indent}</task>`;
81971
+ }
81972
+ function contextAttachmentLines(message, options, indent) {
81973
+ if (!message.attachments)
81974
+ return [];
81975
+ return renderDeliveryAttachmentsBlock(message.attachments, attachmentContext(options)).map((line) => line ? indent + line : "");
81976
+ }
81977
+ function serializeMessage(message, options) {
81978
+ switch (options.profile) {
81979
+ case "linear":
81980
+ return serializeLinearMessage(message, options);
81981
+ case "task-origin":
81982
+ return serializeTaskOriginMessage(message);
81983
+ case "context-xml":
81984
+ return serializeContextXmlMessage(message, options);
81985
+ }
81986
+ }
81987
+ var init_serialize_message = __esm(() => {
81988
+ init_render_delivery_attachments();
81989
+ });
81990
+
81991
+ // ../../services/backend/src/domain/usecase/message/to-serializable-message.ts
81992
+ function normalizeDeliveryAttachments(input) {
81993
+ const attachments = {
81994
+ attachedTasks: input.attachedTasks?.map((item) => ({
81995
+ _id: item._id,
81996
+ content: item.content,
81997
+ status: item.status ?? item.backlogStatus ?? ""
81998
+ })),
81999
+ attachedBacklogItems: input.attachedBacklogItems?.map((item) => ({
82000
+ _id: item._id ?? item.id ?? "",
82001
+ content: item.content,
82002
+ status: item.status
82003
+ })),
82004
+ attachedMessages: input.attachedMessages,
82005
+ attachedSnippets: input.attachedSnippets
82006
+ };
82007
+ return Object.values(attachments).some((items) => items && items.length > 0) ? attachments : undefined;
82008
+ }
82009
+ function normalizeTask(input) {
82010
+ if (!input.taskId || input.taskStatus == null || input.taskContent == null)
82011
+ return;
82012
+ return { _id: input.taskId, status: input.taskStatus, content: input.taskContent };
82013
+ }
82014
+ function toSerializableMessage(input) {
82015
+ const attachments = normalizeDeliveryAttachments(input);
82016
+ return {
82017
+ _id: input._id,
82018
+ _creationTime: input._creationTime,
82019
+ senderRole: input.senderRole,
82020
+ targetRole: input.targetRole,
82021
+ type: input.type,
82022
+ content: input.content,
82023
+ ...attachments ? { attachments } : {},
82024
+ ...normalizeTask(input) ? { task: normalizeTask(input) } : {}
82025
+ };
82026
+ }
82027
+
81844
82028
  // src/commands/messages/messages-fs-service.ts
81845
82029
  import * as nodeFs2 from "node:fs/promises";
81846
82030
  function messageFilename(msg) {
@@ -81848,13 +82032,6 @@ function messageFilename(msg) {
81848
82032
  const receiver = msg.targetRole ?? "all";
81849
82033
  return `${sortPrefix}_${msg.senderRole}-to-${receiver}_${msg._id}.md`;
81850
82034
  }
81851
- function buildLinearMessageContent(msg) {
81852
- const ts = new Date(msg._creationTime).toISOString();
81853
- const receiver = msg.targetRole ? ` → ${msg.targetRole}` : "";
81854
- return `${ts} | ${msg.senderRole}${receiver}
81855
-
81856
- ${msg.content}`;
81857
- }
81858
82035
  var MessagesFsService, MessagesFsServiceLive, SORT_KEY_MAX = 9999999999999;
81859
82036
  var init_messages_fs_service = __esm(() => {
81860
82037
  init_esm();
@@ -82031,7 +82208,11 @@ var PAGE_SIZE = 50, SINCE_PAGE_SIZE = 500, ABSOLUTE_MAX = 5000, DEFAULT_LIMIT =
82031
82208
  const manifestEntries = [];
82032
82209
  for (const msg of messages) {
82033
82210
  const file = messageFilename(msg);
82034
- const content = buildLinearMessageContent(msg);
82211
+ const content = serializeMessage(toSerializableMessage(msg), {
82212
+ profile: "linear",
82213
+ chatroomId,
82214
+ role: options.role
82215
+ });
82035
82216
  const filePath = nodePath2.join(outputDir, file);
82036
82217
  yield* fs11.writeFile(filePath, content).pipe(exports_Effect.mapError((cause3) => ({
82037
82218
  _tag: "WriteFailed",
@@ -82089,6 +82270,7 @@ var PAGE_SIZE = 50, SINCE_PAGE_SIZE = 500, ABSOLUTE_MAX = 5000, DEFAULT_LIMIT =
82089
82270
  });
82090
82271
  });
82091
82272
  var init_download = __esm(() => {
82273
+ init_serialize_message();
82092
82274
  init_esm();
82093
82275
  init_messages_fs_service();
82094
82276
  init_api3();
@@ -82400,18 +82582,19 @@ __export(exports_context2, {
82400
82582
  inspectContext: () => inspectContext
82401
82583
  });
82402
82584
  async function createDefaultDeps18() {
82403
- const client4 = await getConvexClient();
82404
- return {
82405
- backend: {
82406
- mutation: (endpoint, args2) => client4.mutation(endpoint, args2),
82407
- query: (endpoint, args2) => client4.query(endpoint, args2)
82408
- },
82409
- session: {
82410
- getSessionId,
82411
- getConvexUrl,
82412
- getOtherSessionUrls
82413
- }
82414
- };
82585
+ return createConvexCommandDeps();
82586
+ }
82587
+ function requireAuthenticatedChatroom(chatroomId) {
82588
+ return exports_Effect.gen(function* () {
82589
+ const sessionId = yield* requireSessionIdEffect(() => ({
82590
+ _tag: "NotAuthenticated"
82591
+ }));
82592
+ yield* validateChatroomIdEffect(chatroomId, (id3) => ({
82593
+ _tag: "InvalidChatroomId",
82594
+ id: id3
82595
+ }));
82596
+ return sessionId;
82597
+ });
82415
82598
  }
82416
82599
  function handleContextError(err) {
82417
82600
  return exports_Effect.sync(() => {
@@ -82464,13 +82647,7 @@ async function inspectContext(chatroomId, options, deps) {
82464
82647
  }
82465
82648
  var readContextEffect = (chatroomId, options) => exports_Effect.gen(function* () {
82466
82649
  const backend2 = yield* BackendService;
82467
- const sessionId = yield* requireSessionIdEffect(() => ({
82468
- _tag: "NotAuthenticated"
82469
- }));
82470
- yield* validateChatroomIdEffect(chatroomId, (id3) => ({
82471
- _tag: "InvalidChatroomId",
82472
- id: id3
82473
- }));
82650
+ const sessionId = yield* requireAuthenticatedChatroom(chatroomId);
82474
82651
  const context5 = yield* backend2.query(api.messages.getContextForRole, {
82475
82652
  sessionId,
82476
82653
  chatroomId,
@@ -82517,47 +82694,12 @@ var readContextEffect = (chatroomId, options) => exports_Effect.gen(function* ()
82517
82694
  \uD83D\uDCAC Chat History:`);
82518
82695
  console.log("─".repeat(60));
82519
82696
  for (const message of context5.messages) {
82520
- const toAttr = message.targetRole ? ` to="${message.targetRole}"` : "";
82521
- console.log(`<message id="${message._id}" from="${message.senderRole}"${toAttr} type="${message.type}">`);
82522
- if (message.taskId) {
82523
- console.log(` Task:`);
82524
- console.log(` ID: ${message.taskId}`);
82525
- if (message.taskStatus) {
82526
- console.log(` Status: ${message.taskStatus}`);
82527
- }
82528
- if (message.taskContent) {
82529
- const safeTaskContent = sanitizeForTerminal(message.taskContent);
82530
- console.log(` Content:`);
82531
- console.log(` <task-content>`);
82532
- console.log(safeTaskContent.split(`
82533
- `).map((l) => ` ${l}`).join(`
82534
- `));
82535
- console.log(` </task-content>`);
82536
- }
82537
- }
82538
- if (message.attachedTasks && message.attachedTasks.length > 0) {
82539
- console.log(` Attachments:`);
82540
- for (const task of message.attachedTasks) {
82541
- console.log(` \uD83D\uDD39 Task ID: ${task._id}`);
82542
- console.log(` Type: Task`);
82543
- const contentLines = sanitizeForTerminal(task.content).split(`
82544
- `);
82545
- console.log(` Content:`);
82546
- console.log(` <task-content>`);
82547
- for (const line of contentLines) {
82548
- console.log(` ${line}`);
82549
- }
82550
- console.log(` </task-content>`);
82551
- }
82552
- }
82553
- console.log(` Content:`);
82554
- console.log(` <message-content>`);
82555
- const safeMessageContent = sanitizeForTerminal(message.content);
82556
- console.log(safeMessageContent.split(`
82557
- `).map((l) => ` ${l}`).join(`
82558
- `));
82559
- console.log(` </message-content>`);
82560
- console.log(`</message>`);
82697
+ const serialized = serializeMessage(toSerializableMessage(message), {
82698
+ profile: "context-xml",
82699
+ chatroomId,
82700
+ role: options.role
82701
+ });
82702
+ console.log(sanitizeForTerminal(serialized));
82561
82703
  }
82562
82704
  console.log(`
82563
82705
  ` + "═".repeat(60));
@@ -82565,13 +82707,7 @@ var readContextEffect = (chatroomId, options) => exports_Effect.gen(function* ()
82565
82707
  });
82566
82708
  }), newContextEffect = (chatroomId, options) => exports_Effect.gen(function* () {
82567
82709
  const backend2 = yield* BackendService;
82568
- const sessionId = yield* requireSessionIdEffect(() => ({
82569
- _tag: "NotAuthenticated"
82570
- }));
82571
- yield* validateChatroomIdEffect(chatroomId, (id3) => ({
82572
- _tag: "InvalidChatroomId",
82573
- id: id3
82574
- }));
82710
+ const sessionId = yield* requireAuthenticatedChatroom(chatroomId);
82575
82711
  if (!options.content || options.content.trim().length === 0) {
82576
82712
  return yield* exports_Effect.fail({ _tag: "EmptyContent" });
82577
82713
  }
@@ -82682,11 +82818,11 @@ var readContextEffect = (chatroomId, options) => exports_Effect.gen(function* ()
82682
82818
  });
82683
82819
  });
82684
82820
  var init_context2 = __esm(() => {
82821
+ init_serialize_message();
82685
82822
  init_esm();
82686
82823
  init_format_new_context_error();
82687
82824
  init_api3();
82688
- init_storage();
82689
- init_client2();
82825
+ init_create_convex_command_deps();
82690
82826
  init_services();
82691
82827
  });
82692
82828
 
@@ -82815,18 +82951,7 @@ __export(exports_artifact, {
82815
82951
  createArtifact: () => createArtifact
82816
82952
  });
82817
82953
  async function createDefaultDeps20() {
82818
- const client4 = await getConvexClient();
82819
- return {
82820
- backend: {
82821
- mutation: (endpoint, args2) => client4.mutation(endpoint, args2),
82822
- query: (endpoint, args2) => client4.query(endpoint, args2)
82823
- },
82824
- session: {
82825
- getSessionId,
82826
- getConvexUrl,
82827
- getOtherSessionUrls
82828
- }
82829
- };
82954
+ return createConvexCommandDeps();
82830
82955
  }
82831
82956
  function handleArtifactError(err) {
82832
82957
  return exports_Effect.sync(() => {
@@ -82977,8 +83102,7 @@ var createArtifactEffect = (chatroomId, options) => exports_Effect.gen(function*
82977
83102
  var init_artifact = __esm(() => {
82978
83103
  init_esm();
82979
83104
  init_api3();
82980
- init_storage();
82981
- init_client2();
83105
+ init_create_convex_command_deps();
82982
83106
  init_services();
82983
83107
  init_file_content();
82984
83108
  artifactErrorHandlers = {
@@ -98469,9 +98593,11 @@ function parseAssignedTaskSignal(raw) {
98469
98593
  return assignedTaskSignalSchema.parse(raw);
98470
98594
  }
98471
98595
  function parseAssignedTaskPresenceSignal(raw) {
98596
+ const full = assignedTaskPresenceSignalSchema.safeParse(raw);
98597
+ if (full.success)
98598
+ return full.data;
98472
98599
  const delta = assignedTaskPresenceDeltaSchema.safeParse(raw);
98473
- const hasFullWireFields = typeof raw === "object" && raw !== null && "chatroomId" in raw && "presenceUpdatedAt" in raw;
98474
- if (delta.success && !hasFullWireFields) {
98600
+ if (delta.success) {
98475
98601
  const presenceUpdatedAt = Number(delta.data.presenceKey.split(":")[0]);
98476
98602
  const resolvedAt = Number.isFinite(presenceUpdatedAt) ? presenceUpdatedAt : 0;
98477
98603
  return {
@@ -99394,11 +99520,13 @@ async function runRestartOrchestrator(deps, event) {
99394
99520
  markRestartOrchestratorInFlight(chatroomId, role, event.correlationId);
99395
99521
  try {
99396
99522
  resetRoleDeliveryState(chatroomId, role);
99523
+ await emitPhase(deps, event, "reset");
99397
99524
  await deps.agentMgr.stop({
99398
99525
  chatroomId,
99399
99526
  role,
99400
99527
  reason: "user.restart"
99401
99528
  });
99529
+ await emitPhase(deps, event, "spawn");
99402
99530
  const spawnResult = await exports_Effect.runPromise(deps.agentMgr.ensureRunning({
99403
99531
  chatroomId,
99404
99532
  role,
@@ -99412,13 +99540,17 @@ async function runRestartOrchestrator(deps, event) {
99412
99540
  await emitPhase(deps, event, "failed", spawnResult.error ?? "spawn failed");
99413
99541
  return;
99414
99542
  }
99543
+ await emitPhase(deps, event, "await_session");
99415
99544
  const harnessSessionId = await waitForHarnessSessionId(deps, event, spawnResult.pid);
99416
99545
  if (!harnessSessionId) {
99417
99546
  await emitPhase(deps, event, "failed", "harnessSessionId timeout");
99418
99547
  return;
99419
99548
  }
99420
99549
  await forceNativeWaiting(deps, event);
99550
+ await emitPhase(deps, event, "ready");
99551
+ await emitPhase(deps, event, "deliver");
99421
99552
  const deliveredTaskIds = await deliverPendingTasks(deps, event);
99553
+ await emitPhase(deps, event, "completed");
99422
99554
  await deps.session.backend.mutation(api.machines.emitRestartCompleted, {
99423
99555
  sessionId: deps.session.sessionId,
99424
99556
  machineId: deps.session.machineId,
@@ -105946,9 +106078,9 @@ var init_claude_session = () => {};
105946
106078
 
105947
106079
  // ../../services/backend/src/domain/entities/harness/model-catalog.ts
105948
106080
  function codexModelVariants() {
105949
- return expandModelVariantCatalog(CODEX_MODEL_IDS, CODEX_MODEL_VARIANT_COMBINATIONS);
106081
+ return prefixCatalogModels("openai", expandModelVariantCatalog(CODEX_MODEL_IDS, CODEX_MODEL_VARIANT_COMBINATIONS));
105950
106082
  }
105951
- var claudeModelVariants = () => expandModelVariantCatalog(CLAUDE_CATALOG_BASE_MODEL_IDS, CLAUDE_MODEL_VARIANT_COMBINATIONS), CODEX_MODEL_IDS, HARNESS_MODEL_CATALOG;
106083
+ var claudeModelVariants = () => prefixCatalogModels("anthropic", expandModelVariantCatalog(CLAUDE_CATALOG_BASE_MODEL_IDS, CLAUDE_MODEL_VARIANT_COMBINATIONS)), CODEX_MODEL_IDS, HARNESS_MODEL_CATALOG;
105952
106084
  var init_model_catalog = __esm(() => {
105953
106085
  init_claude_model_variants();
105954
106086
  init_codex_sdk_model_variants();
@@ -105962,7 +106094,7 @@ var init_model_catalog = __esm(() => {
105962
106094
  ];
105963
106095
  HARNESS_MODEL_CATALOG = {
105964
106096
  "codex-sdk": codexModelVariants(),
105965
- copilot: [
106097
+ copilot: prefixCatalogModelsWithInfer(inferCopilotModelProvider, [
105966
106098
  "claude-3-5-sonnet-20241022",
105967
106099
  "claude-3-5-haiku-20241022",
105968
106100
  "claude-haiku-4.5",
@@ -105973,7 +106105,7 @@ var init_model_catalog = __esm(() => {
105973
106105
  "gpt-4-turbo",
105974
106106
  "gemini-3-pro-preview",
105975
106107
  "gemini-2-5-flash"
105976
- ],
106108
+ ]),
105977
106109
  claude: claudeModelVariants(),
105978
106110
  "claude-sdk": claudeModelVariants()
105979
106111
  };
@@ -127268,13 +127400,13 @@ import { dirname as dirname15, join as join27 } from "node:path";
127268
127400
  import { fileURLToPath as fileURLToPath7 } from "node:url";
127269
127401
  function clientDistCandidates(here) {
127270
127402
  return [
127403
+ join27(here, "client/build"),
127271
127404
  join27(here, "../client/build"),
127272
- join27(here, "../src/daemon/local-web/client/build"),
127273
- join27(here, "../../../src/daemon/local-web/client/build")
127405
+ join27(here, "../src/daemon/local-web/client/build")
127274
127406
  ];
127275
127407
  }
127276
- function resolveClientDistDir() {
127277
- const candidates = clientDistCandidates(dirname15(fileURLToPath7(import.meta.url)));
127408
+ function resolveClientDistDir(here = dirname15(fileURLToPath7(import.meta.url))) {
127409
+ const candidates = clientDistCandidates(here);
127278
127410
  for (const dir of candidates) {
127279
127411
  if (existsSync9(join27(dir, "index.html")))
127280
127412
  return dir;
@@ -127556,7 +127688,7 @@ async function startLocalWebServer(config4, deps = {}) {
127556
127688
  throw new Error(`local-web must bind to 127.0.0.1 only (got ${config4.host})`);
127557
127689
  }
127558
127690
  const streamHub = deps.streamHub ?? createStreamHub();
127559
- const clientDistDir = resolveClientDistDir();
127691
+ const clientDistDir = deps.clientDistDir ?? resolveClientDistDir();
127560
127692
  const server2 = createServer((req, res) => {
127561
127693
  if (tryServeStatic(req, res, clientDistDir))
127562
127694
  return;
@@ -128893,4 +129025,4 @@ program2.hook("preAction", async (_thisCommand, actionCommand) => {
128893
129025
  });
128894
129026
  program2.parse();
128895
129027
 
128896
- //# debugId=270BCA25C4386AFE64756E2164756E21
129028
+ //# debugId=3C5E79A2AC47FADE64756E2164756E21