@markus-global/cli 0.8.4-rc.1 → 0.8.4-rc.6

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/markus.mjs CHANGED
@@ -10070,20 +10070,18 @@ echo ${sentinel}_$?_
10070
10070
  this.agentSessions.clear();
10071
10071
  }
10072
10072
  createSession(sessionId, agentId2, cwd) {
10073
- const shell = process.env["SHELL"] || "/bin/sh";
10074
- const isBashLike = /\b(bash|zsh)\b/.test(shell);
10075
- const args = isBashLike ? ["--norc", "--noprofile", "-i"] : [];
10073
+ const isWin = process.platform === "win32";
10074
+ const shell = isWin ? process.env["COMSPEC"] || "cmd.exe" : process.env["SHELL"] || "/bin/sh";
10075
+ const isBashLike = !isWin && /\b(bash|zsh)\b/.test(shell);
10076
+ const args = isWin ? ["/Q"] : isBashLike ? ["--norc", "--noprofile", "-i"] : [];
10076
10077
  const child = spawn(shell, args, {
10077
10078
  cwd: cwd ?? process.cwd(),
10078
10079
  stdio: ["pipe", "pipe", "pipe"],
10079
10080
  env: {
10080
10081
  ...process.env,
10081
- PS1: "",
10082
- PS2: "",
10083
- PROMPT_COMMAND: "",
10084
- TERM: "dumb",
10085
- ENV: ""
10086
- }
10082
+ ...isWin ? {} : { PS1: "", PS2: "", PROMPT_COMMAND: "", TERM: "dumb", ENV: "" }
10083
+ },
10084
+ windowsHide: true
10087
10085
  });
10088
10086
  const session = new ManagedSession(sessionId, agentId2, child);
10089
10087
  this.sessions.set(sessionId, session);
@@ -10109,6 +10107,7 @@ echo ${sentinel}_$?_
10109
10107
  // ../core/dist/tools/shell.js
10110
10108
  import { spawn as spawn2 } from "node:child_process";
10111
10109
  import { resolve as resolve4, normalize, sep } from "node:path";
10110
+ import { platform as platform2 } from "node:os";
10112
10111
  function injectGitCommitMeta(command, meta) {
10113
10112
  if (!meta)
10114
10113
  return command;
@@ -10277,13 +10276,16 @@ function createShellTool(security, workspacePath, agentMeta, policy, onCommandAp
10277
10276
  settled = true;
10278
10277
  resolve21(result);
10279
10278
  };
10280
- const child = spawn2("sh", ["-c", finalCommand], {
10279
+ const isWin = platform2() === "win32";
10280
+ const child = spawn2(isWin ? process.env["COMSPEC"] || "cmd.exe" : "sh", isWin ? ["/d", "/s", "/c", finalCommand] : ["-c", finalCommand], {
10281
10281
  cwd: effectiveCwd ?? void 0,
10282
10282
  stdio: ["ignore", "pipe", "pipe"],
10283
- detached: true,
10284
- env: { ...process.env }
10283
+ detached: !isWin,
10284
+ env: { ...process.env },
10285
+ windowsHide: true
10285
10286
  });
10286
- child.unref();
10287
+ if (!isWin)
10288
+ child.unref();
10287
10289
  let stdout = "";
10288
10290
  let stderr = "";
10289
10291
  let killed = false;
@@ -10291,12 +10293,20 @@ function createShellTool(security, workspacePath, agentMeta, policy, onCommandAp
10291
10293
  const timeout = setTimeout(() => {
10292
10294
  killed = true;
10293
10295
  try {
10294
- process.kill(-child.pid, "SIGTERM");
10296
+ if (isWin) {
10297
+ child.kill();
10298
+ } else {
10299
+ process.kill(-child.pid, "SIGTERM");
10300
+ }
10295
10301
  } catch {
10296
10302
  }
10297
10303
  setTimeout(() => {
10298
10304
  try {
10299
- process.kill(-child.pid, "SIGKILL");
10305
+ if (isWin) {
10306
+ child.kill("SIGKILL");
10307
+ } else {
10308
+ process.kill(-child.pid, "SIGKILL");
10309
+ }
10300
10310
  } catch {
10301
10311
  }
10302
10312
  child.stdout?.destroy();
@@ -42223,10 +42233,10 @@ var require_turndown_cjs = __commonJS({
42223
42233
  if (!content) return "";
42224
42234
  content = content.replace(/\r?\n|\r/g, " ");
42225
42235
  var extraSpace = /^`|^ .*?[^ ].* $|`$/.test(content) ? " " : "";
42226
- var delimiter = "`";
42236
+ var delimiter2 = "`";
42227
42237
  var matches2 = content.match(/`+/gm) || [];
42228
- while (matches2.indexOf(delimiter) !== -1) delimiter = delimiter + "`";
42229
- return delimiter + extraSpace + content + extraSpace + delimiter;
42238
+ while (matches2.indexOf(delimiter2) !== -1) delimiter2 = delimiter2 + "`";
42239
+ return delimiter2 + extraSpace + content + extraSpace + delimiter2;
42230
42240
  }
42231
42241
  };
42232
42242
  rules.image = {
@@ -43782,6 +43792,7 @@ var init_patch = __esm({
43782
43792
  // ../core/dist/tools/process-manager.js
43783
43793
  import { spawn as spawn3 } from "node:child_process";
43784
43794
  import { resolve as resolve7 } from "node:path";
43795
+ import { platform as platform3 } from "node:os";
43785
43796
  function onBackgroundCompletion(cb) {
43786
43797
  completionListeners.push(cb);
43787
43798
  return () => {
@@ -43848,9 +43859,11 @@ function createBackgroundExecTool(workspacePath) {
43848
43859
  return JSON.stringify({ status: "denied", error: "Working directory must be within workspace" });
43849
43860
  }
43850
43861
  const id = `bg_${++sessionCounter}_${Date.now()}`;
43851
- const child = spawn3("sh", ["-c", command], {
43862
+ const isWin = platform3() === "win32";
43863
+ const child = spawn3(isWin ? process.env["COMSPEC"] || "cmd.exe" : "sh", isWin ? ["/d", "/s", "/c", command] : ["-c", command], {
43852
43864
  cwd: effectiveCwd,
43853
- stdio: ["ignore", "pipe", "pipe"]
43865
+ stdio: ["ignore", "pipe", "pipe"],
43866
+ windowsHide: true
43854
43867
  });
43855
43868
  const session = {
43856
43869
  id,
@@ -57963,12 +57976,12 @@ var init_semantic_search = __esm({
57963
57976
 
57964
57977
  // ../core/dist/tools/chrome-dialog-clicker.js
57965
57978
  import { execFile as execFile3, spawn as spawn5 } from "node:child_process";
57966
- import { platform as platform2 } from "node:os";
57979
+ import { platform as platform4 } from "node:os";
57967
57980
  import { resolve as resolve9, dirname as dirname5 } from "node:path";
57968
57981
  import { fileURLToPath as fileURLToPath3 } from "node:url";
57969
57982
  import { existsSync as existsSync17 } from "node:fs";
57970
57983
  async function checkAutoClickStatus() {
57971
- const os = platform2();
57984
+ const os = platform4();
57972
57985
  const base = {
57973
57986
  platform: os,
57974
57987
  supported: os === "darwin" || os === "win32",
@@ -58007,7 +58020,7 @@ async function checkAutoClickStatus() {
58007
58020
  return base;
58008
58021
  }
58009
58022
  async function openAccessibilitySettings() {
58010
- const os = platform2();
58023
+ const os = platform4();
58011
58024
  if (os === "darwin") {
58012
58025
  const bin = resolve9(SCRIPTS_DIR, "markus-chrome-allow");
58013
58026
  if (!existsSync17(bin))
@@ -58038,7 +58051,7 @@ async function testAutoClick() {
58038
58051
  result.error = "Helper binary not found";
58039
58052
  return result;
58040
58053
  }
58041
- if (platform2() === "darwin" && !checkResult.accessibilityPermission) {
58054
+ if (platform4() === "darwin" && !checkResult.accessibilityPermission) {
58042
58055
  result.openedAccessibilitySettings = await openAccessibilitySettings();
58043
58056
  result.clickResult = "no_permission";
58044
58057
  return result;
@@ -58064,13 +58077,13 @@ async function testAutoClick() {
58064
58077
  return result;
58065
58078
  }
58066
58079
  async function runMcpTest() {
58067
- const npxCmd = platform2() === "win32" ? "npx.cmd" : "npx";
58080
+ const npxCmd = platform4() === "win32" ? "npx.cmd" : "npx";
58068
58081
  return new Promise((resolveTest, rejectTest) => {
58069
58082
  const stderrChunks = [];
58070
58083
  const proc = spawn5(npxCmd, ["-y", "chrome-devtools-mcp@latest", "--autoConnect"], {
58071
58084
  stdio: ["pipe", "pipe", "pipe"],
58072
58085
  env: { ...process.env },
58073
- shell: platform2() === "win32"
58086
+ shell: platform4() === "win32"
58074
58087
  });
58075
58088
  let stdout = "";
58076
58089
  let requestId = 1;
@@ -58169,7 +58182,7 @@ async function runMcpTest() {
58169
58182
  });
58170
58183
  }
58171
58184
  async function clickChromeAllowDialog(timeoutSec = 5) {
58172
- const os = platform2();
58185
+ const os = platform4();
58173
58186
  if (os === "darwin") {
58174
58187
  const bin = resolve9(SCRIPTS_DIR, "markus-chrome-allow");
58175
58188
  return runHelper(bin, ["--timeout", String(timeoutSec)], timeoutSec);
@@ -60132,13 +60145,10 @@ You are ${request.name}.`,
60132
60145
  throw new Error(`Task not found: ${taskId2}`);
60133
60146
  const reviewerId = task.reviewerId;
60134
60147
  const _validTypes = /* @__PURE__ */ new Set(["file", "directory"]);
60135
- const deliverables = [{
60136
- type: "branch",
60137
- reference: `task/${taskId2}`,
60138
- summary: `${summary}${knownIssues ? `
60148
+ const completionSummary = `${summary}${knownIssues ? `
60139
60149
 
60140
- Known issues: ${knownIssues}` : ""}`
60141
- }];
60150
+ Known issues: ${knownIssues}` : ""}`;
60151
+ const deliverables = [];
60142
60152
  if (Array.isArray(inputDeliverables)) {
60143
60153
  for (const d of inputDeliverables) {
60144
60154
  if (d?.reference) {
@@ -60150,7 +60160,7 @@ Known issues: ${knownIssues}` : ""}`
60150
60160
  }
60151
60161
  }
60152
60162
  }
60153
- return ts.submitForReview(taskId2, deliverables, reviewerId);
60163
+ return ts.submitForReview(taskId2, deliverables, reviewerId, completionSummary);
60154
60164
  },
60155
60165
  proposeRequirement: this.requirementService ? async (params) => {
60156
60166
  return this.requirementService.proposeRequirement({
@@ -60844,13 +60854,10 @@ You are ${row.name}.`,
60844
60854
  throw new Error(`Task not found: ${taskId2}`);
60845
60855
  const reviewerId = task.reviewerId;
60846
60856
  const _validTypes = /* @__PURE__ */ new Set(["file", "directory"]);
60847
- const deliverables = [{
60848
- type: "branch",
60849
- reference: `task/${taskId2}`,
60850
- summary: `${summary}${knownIssues ? `
60857
+ const completionSummary = `${summary}${knownIssues ? `
60851
60858
 
60852
- Known issues: ${knownIssues}` : ""}`
60853
- }];
60859
+ Known issues: ${knownIssues}` : ""}`;
60860
+ const deliverables = [];
60854
60861
  if (Array.isArray(inputDeliverables)) {
60855
60862
  for (const d of inputDeliverables) {
60856
60863
  if (d?.reference) {
@@ -60862,7 +60869,7 @@ Known issues: ${knownIssues}` : ""}`
60862
60869
  }
60863
60870
  }
60864
60871
  }
60865
- return ts.submitForReview(taskId2, deliverables, reviewerId);
60872
+ return ts.submitForReview(taskId2, deliverables, reviewerId, completionSummary);
60866
60873
  },
60867
60874
  proposeRequirement: this.requirementService ? async (params) => {
60868
60875
  return this.requirementService.proposeRequirement({
@@ -63075,7 +63082,7 @@ var init_fireworks = __esm({
63075
63082
  import { readFileSync as readFileSync14, existsSync as existsSync19 } from "node:fs";
63076
63083
  import { execSync as execSync2 } from "node:child_process";
63077
63084
  import { join as join14 } from "node:path";
63078
- import { homedir as homedir7, platform as platform3 } from "node:os";
63085
+ import { homedir as homedir7, platform as platform5 } from "node:os";
63079
63086
  function readNetworkConfig() {
63080
63087
  try {
63081
63088
  const configPath = join14(homedir7(), ".markus", "markus.json");
@@ -63091,7 +63098,7 @@ function readNetworkConfig() {
63091
63098
  }
63092
63099
  }
63093
63100
  function readSystemProxy() {
63094
- const os = platform3();
63101
+ const os = platform5();
63095
63102
  try {
63096
63103
  if (os === "darwin") {
63097
63104
  return readMacOSProxy();
@@ -67287,7 +67294,7 @@ var init_external_gateway = __esm({
67287
67294
  return rows.length;
67288
67295
  }
67289
67296
  async register(request) {
67290
- const { externalAgentId, agentName, orgId: orgId2, capabilities = [], platform: platform7, platformConfig, agentCardUrl, openClawConfig } = request;
67297
+ const { externalAgentId, agentName, orgId: orgId2, capabilities = [], platform: platform9, platformConfig, agentCardUrl, openClawConfig } = request;
67291
67298
  if (!externalAgentId || !agentName || !orgId2) {
67292
67299
  throw new GatewayError("Missing required fields: externalAgentId, agentName, orgId", 400);
67293
67300
  }
@@ -67314,7 +67321,7 @@ var init_external_gateway = __esm({
67314
67321
  agentName,
67315
67322
  orgId: orgId2,
67316
67323
  capabilities,
67317
- platform: platform7 ?? (openClawConfig ? "openclaw" : void 0),
67324
+ platform: platform9 ?? (openClawConfig ? "openclaw" : void 0),
67318
67325
  platformConfig: platformConfig ?? openClawConfig,
67319
67326
  agentCardUrl,
67320
67327
  openClawConfig,
@@ -81109,11 +81116,17 @@ var init_task_service = __esm({
81109
81116
  lines.push(`- ${note.slice(0, PROMPT_DEP_NOTE_CHARS)}`);
81110
81117
  }
81111
81118
  }
81119
+ if (depTask.completionSummary) {
81120
+ lines.push(`**Completion Summary:** ${depTask.completionSummary}`);
81121
+ }
81112
81122
  if (depTask.deliverables?.length) {
81113
- lines.push("**Deliverables (review these for background context):**");
81114
- for (const d of depTask.deliverables) {
81115
- const refInfo = d.type === "file" ? ` \u2014 File: \`${d.reference}\` (use \`file_read\` to inspect)` : d.type === "branch" ? ` [branch: ${d.reference}]` : d.reference ? ` \u2014 ref: \`${d.reference}\`` : "";
81116
- lines.push(`- ${d.summary ?? "(no summary)"}${refInfo}`);
81123
+ const files = depTask.deliverables.filter((d) => d.type !== "branch" && d.reference);
81124
+ if (files.length > 0) {
81125
+ lines.push("**Deliverables (review these for background context):**");
81126
+ for (const d of files) {
81127
+ const refInfo = d.type === "file" ? ` \u2014 File: \`${d.reference}\` (use \`file_read\` to inspect)` : d.reference ? ` \u2014 ref: \`${d.reference}\`` : "";
81128
+ lines.push(`- ${d.summary ?? "(no summary)"}${refInfo}`);
81129
+ }
81117
81130
  }
81118
81131
  }
81119
81132
  depSections.push(lines.join("\n"));
@@ -81600,6 +81613,7 @@ ${c.content}`;
81600
81613
  blockedBy,
81601
81614
  result: row.result ?? void 0,
81602
81615
  deliverables: Array.isArray(row.deliverables) ? row.deliverables : void 0,
81616
+ completionSummary: row.completionSummary ?? void 0,
81603
81617
  notes: Array.isArray(row.notes) ? row.notes : void 0,
81604
81618
  createdAt: row.createdAt instanceof Date ? row.createdAt.toISOString() : String(row.createdAt),
81605
81619
  updatedAt: row.updatedAt instanceof Date ? row.updatedAt.toISOString() : String(row.updatedAt),
@@ -81622,6 +81636,33 @@ ${c.content}`;
81622
81636
  log57.warn("Failed to load tasks from DB", { error: String(err) });
81623
81637
  }
81624
81638
  }
81639
+ /**
81640
+ * One-time migration: extract branch deliverable summaries into task.completionSummary
81641
+ * and remove branch items from task.deliverables JSON.
81642
+ */
81643
+ async migrateBranchToCompletionSummary() {
81644
+ let migrated = 0;
81645
+ for (const [taskId2, task] of this.tasks) {
81646
+ if (task.completionSummary)
81647
+ continue;
81648
+ if (!task.deliverables?.length)
81649
+ continue;
81650
+ const branchItem = task.deliverables.find((d) => d.type === "branch");
81651
+ if (!branchItem)
81652
+ continue;
81653
+ task.completionSummary = branchItem.summary;
81654
+ task.deliverables = task.deliverables.filter((d) => d.type !== "branch");
81655
+ task.updatedAt = (/* @__PURE__ */ new Date()).toISOString();
81656
+ if (this.taskRepo) {
81657
+ this.taskRepo.updateCompletionSummary(taskId2, task.completionSummary).catch((err) => log57.warn("Failed to persist completionSummary migration", { taskId: taskId2, error: String(err) }));
81658
+ this.taskRepo.updateDeliverables(taskId2, task.deliverables).catch((err) => log57.warn("Failed to persist deliverables cleanup", { taskId: taskId2, error: String(err) }));
81659
+ }
81660
+ migrated++;
81661
+ }
81662
+ if (migrated > 0) {
81663
+ log57.info(`Migrated branch->completionSummary for ${migrated} tasks`);
81664
+ }
81665
+ }
81625
81666
  static PRIORITY_ORDER = {
81626
81667
  urgent: 0,
81627
81668
  high: 1,
@@ -82738,7 +82779,7 @@ Action: ${guidance}` : ""
82738
82779
  return { allowed: true };
82739
82780
  }
82740
82781
  // ─── Governance: Submit for Review ─────────────────────────────────────────
82741
- async submitForReview(taskId2, deliverables, reviewerId) {
82782
+ async submitForReview(taskId2, deliverables, reviewerId, completionSummary) {
82742
82783
  const task = this.tasks.get(taskId2);
82743
82784
  if (!task)
82744
82785
  throw new Error(`Task not found: ${taskId2}`);
@@ -82789,8 +82830,14 @@ Action: ${guidance}` : ""
82789
82830
  if (reviewerId) {
82790
82831
  task.reviewerId = reviewerId;
82791
82832
  }
82833
+ if (completionSummary) {
82834
+ task.completionSummary = completionSummary;
82835
+ }
82792
82836
  if (this.taskRepo) {
82793
82837
  this.taskRepo.updateDeliverables(task.id, task.deliverables).catch((err) => log57.warn("Failed to persist deliverables to DB", { taskId: task.id, error: String(err) }));
82838
+ if (completionSummary) {
82839
+ this.taskRepo.updateCompletionSummary(task.id, completionSummary).catch((err) => log57.warn("Failed to persist completionSummary to DB", { taskId: task.id, error: String(err) }));
82840
+ }
82794
82841
  if (reviewerId) {
82795
82842
  this.taskRepo.update(task.id, { reviewerId }).catch((err) => log57.warn("Failed to persist reviewer change to DB", { taskId: task.id, error: String(err) }));
82796
82843
  }
@@ -82881,8 +82928,12 @@ Action: ${guidance}` : ""
82881
82928
  parts.push(`[REVIEW REQUEST \u2014 ACTION REQUIRED] Task "${task.title}" (ID: ${task.id}) has been submitted for your review by ${assigneeName}.`);
82882
82929
  parts.push("");
82883
82930
  parts.push(`**Description:** ${task.description}`);
82931
+ if (task.completionSummary) {
82932
+ parts.push("");
82933
+ parts.push(`**Summary:** ${task.completionSummary}`);
82934
+ }
82884
82935
  if (task.deliverables && task.deliverables.length > 0) {
82885
- const files = task.deliverables.filter((d) => d.type !== "branch");
82936
+ const files = task.deliverables.filter((d) => d.type !== "branch" && d.reference);
82886
82937
  if (files.length > 0) {
82887
82938
  parts.push("");
82888
82939
  parts.push("**Deliverables:**");
@@ -82892,12 +82943,6 @@ Action: ${guidance}` : ""
82892
82943
  if (files.length > REVIEWER_FILE_LIST_MAX)
82893
82944
  parts.push(` ... and ${files.length - REVIEWER_FILE_LIST_MAX} more`);
82894
82945
  }
82895
- const branch = task.deliverables.find((d) => d.type === "branch");
82896
- if (branch) {
82897
- parts.push(`**Branch:** ${branch.reference}`);
82898
- if (branch.summary)
82899
- parts.push(`**Summary:** ${branch.summary}`);
82900
- }
82901
82946
  }
82902
82947
  if (task.subtasks.length > 0) {
82903
82948
  const done = task.subtasks.filter((s2) => s2.status === "completed").length;
@@ -83517,11 +83562,17 @@ ${reason}`
83517
83562
  for (const note of depTask.notes.slice(-PROMPT_DEP_NOTES_MAX).reverse())
83518
83563
  lines.push(`- ${note.slice(0, PROMPT_DEP_NOTE_CHARS)}`);
83519
83564
  }
83565
+ if (depTask.completionSummary) {
83566
+ lines.push(`**Completion Summary:** ${depTask.completionSummary}`);
83567
+ }
83520
83568
  if (depTask.deliverables?.length) {
83521
- lines.push("**Deliverables (review these for background context):**");
83522
- for (const d of depTask.deliverables) {
83523
- const refInfo = d.type === "file" ? ` \u2014 File: \`${d.reference}\` (use \`file_read\` to inspect)` : d.type === "branch" ? ` [branch: ${d.reference}]` : d.reference ? ` \u2014 ref: \`${d.reference}\`` : "";
83524
- lines.push(`- ${d.summary ?? "(no summary)"}${refInfo}`);
83569
+ const files = depTask.deliverables.filter((d) => d.type !== "branch" && d.reference);
83570
+ if (files.length > 0) {
83571
+ lines.push("**Deliverables (review these for background context):**");
83572
+ for (const d of files) {
83573
+ const refInfo = d.type === "file" ? ` \u2014 File: \`${d.reference}\` (use \`file_read\` to inspect)` : d.reference ? ` \u2014 ref: \`${d.reference}\`` : "";
83574
+ lines.push(`- ${d.summary ?? "(no summary)"}${refInfo}`);
83575
+ }
83525
83576
  }
83526
83577
  }
83527
83578
  depSections.push(lines.join("\n"));
@@ -94776,8 +94827,8 @@ var require_common = __commonJS({
94776
94827
  }
94777
94828
  return debug;
94778
94829
  }
94779
- function extend(namespace, delimiter) {
94780
- const newDebug = createDebug(this.namespace + (typeof delimiter === "undefined" ? ":" : delimiter) + namespace);
94830
+ function extend(namespace, delimiter2) {
94831
+ const newDebug = createDebug(this.namespace + (typeof delimiter2 === "undefined" ? ":" : delimiter2) + namespace);
94781
94832
  newDebug.log = this.log;
94782
94833
  return newDebug;
94783
94834
  }
@@ -96189,14 +96240,14 @@ var require_axios = __commonJS({
96189
96240
  }
96190
96241
  });
96191
96242
  };
96192
- var toObjectSet = (arrayOrString, delimiter) => {
96243
+ var toObjectSet = (arrayOrString, delimiter2) => {
96193
96244
  const obj = {};
96194
96245
  const define = (arr) => {
96195
96246
  arr.forEach((value) => {
96196
96247
  obj[value] = true;
96197
96248
  });
96198
96249
  };
96199
- isArray2(arrayOrString) ? define(arrayOrString) : define(String(arrayOrString).split(delimiter));
96250
+ isArray2(arrayOrString) ? define(arrayOrString) : define(String(arrayOrString).split(delimiter2));
96200
96251
  return obj;
96201
96252
  };
96202
96253
  var noop = () => {
@@ -96677,14 +96728,14 @@ var require_axios = __commonJS({
96677
96728
  navigator: _navigator,
96678
96729
  origin
96679
96730
  });
96680
- var platform7 = {
96731
+ var platform9 = {
96681
96732
  ...utils,
96682
96733
  ...platform$1
96683
96734
  };
96684
96735
  function toURLEncodedForm(data, options) {
96685
- return toFormData(data, new platform7.classes.URLSearchParams(), {
96736
+ return toFormData(data, new platform9.classes.URLSearchParams(), {
96686
96737
  visitor: function(value, key2, path, helpers) {
96687
- if (platform7.isNode && utils$1.isBuffer(value)) {
96738
+ if (platform9.isNode && utils$1.isBuffer(value)) {
96688
96739
  this.append(key2, value.toString("base64"));
96689
96740
  return false;
96690
96741
  }
@@ -96837,8 +96888,8 @@ var require_axios = __commonJS({
96837
96888
  maxContentLength: -1,
96838
96889
  maxBodyLength: -1,
96839
96890
  env: {
96840
- FormData: platform7.classes.FormData,
96841
- Blob: platform7.classes.Blob
96891
+ FormData: platform9.classes.FormData,
96892
+ Blob: platform9.classes.Blob
96842
96893
  },
96843
96894
  validateStatus: function validateStatus(status) {
96844
96895
  return status >= 200 && status < 300;
@@ -97201,7 +97252,7 @@ var require_axios = __commonJS({
97201
97252
  }
97202
97253
  var DATA_URL_PATTERN = /^(?:([^;]+);)?(?:[^;]+;)?(base64|),([\s\S]*)$/;
97203
97254
  function fromDataURI(uri, asBlob, options) {
97204
- const _Blob = options && options.Blob || platform7.classes.Blob;
97255
+ const _Blob = options && options.Blob || platform9.classes.Blob;
97205
97256
  const protocol = parseProtocol(uri);
97206
97257
  if (asBlob === void 0 && _Blob) {
97207
97258
  asBlob = true;
@@ -97359,7 +97410,7 @@ var require_axios = __commonJS({
97359
97410
  }
97360
97411
  };
97361
97412
  var readBlob$1 = readBlob;
97362
- var BOUNDARY_ALPHABET = platform7.ALPHABET.ALPHA_DIGIT + "-_";
97413
+ var BOUNDARY_ALPHABET = platform9.ALPHABET.ALPHA_DIGIT + "-_";
97363
97414
  var textEncoder = typeof TextEncoder === "function" ? new TextEncoder() : new util__default["default"].TextEncoder();
97364
97415
  var CRLF = "\r\n";
97365
97416
  var CRLF_BYTES = textEncoder.encode(CRLF);
@@ -97405,7 +97456,7 @@ var require_axios = __commonJS({
97405
97456
  const {
97406
97457
  tag = "form-data-boundary",
97407
97458
  size = 25,
97408
- boundary = tag + "-" + platform7.generateString(size, BOUNDARY_ALPHABET)
97459
+ boundary = tag + "-" + platform9.generateString(size, BOUNDARY_ALPHABET)
97409
97460
  } = options || {};
97410
97461
  if (!utils$1.isFormData(form)) {
97411
97462
  throw TypeError("FormData instance required");
@@ -97634,7 +97685,7 @@ var require_axios = __commonJS({
97634
97685
  var isBrotliSupported = utils$1.isFunction(zlib__default["default"].createBrotliDecompress);
97635
97686
  var { http: httpFollow, https: httpsFollow } = followRedirects__default["default"];
97636
97687
  var isHttps = /https:?/;
97637
- var supportedProtocols = platform7.protocols.map((protocol) => {
97688
+ var supportedProtocols = platform9.protocols.map((protocol) => {
97638
97689
  return protocol + ":";
97639
97690
  });
97640
97691
  var flushOnFinish = (stream2, [throttled, flush]) => {
@@ -97886,7 +97937,7 @@ var require_axios = __commonJS({
97886
97937
  }
97887
97938
  });
97888
97939
  const fullPath = buildFullPath(config.baseURL, config.url, config.allowAbsoluteUrls);
97889
- const parsed = new URL(fullPath, platform7.hasBrowserEnv ? platform7.origin : void 0);
97940
+ const parsed = new URL(fullPath, platform9.hasBrowserEnv ? platform9.origin : void 0);
97890
97941
  const protocol = parsed.protocol || supportedProtocols[0];
97891
97942
  if (protocol === "data:") {
97892
97943
  if (config.maxContentLength > -1) {
@@ -98294,14 +98345,14 @@ var require_axios = __commonJS({
98294
98345
  }
98295
98346
  });
98296
98347
  };
98297
- var isURLSameOrigin = platform7.hasStandardBrowserEnv ? /* @__PURE__ */ ((origin2, isMSIE) => (url2) => {
98298
- url2 = new URL(url2, platform7.origin);
98348
+ var isURLSameOrigin = platform9.hasStandardBrowserEnv ? /* @__PURE__ */ ((origin2, isMSIE) => (url2) => {
98349
+ url2 = new URL(url2, platform9.origin);
98299
98350
  return origin2.protocol === url2.protocol && origin2.host === url2.host && (isMSIE || origin2.port === url2.port);
98300
98351
  })(
98301
- new URL(platform7.origin),
98302
- platform7.navigator && /(msie|trident)/i.test(platform7.navigator.userAgent)
98352
+ new URL(platform9.origin),
98353
+ platform9.navigator && /(msie|trident)/i.test(platform9.navigator.userAgent)
98303
98354
  ) : () => true;
98304
- var cookies = platform7.hasStandardBrowserEnv ? (
98355
+ var cookies = platform9.hasStandardBrowserEnv ? (
98305
98356
  // Standard browser envs support document.cookie
98306
98357
  {
98307
98358
  write(name, value, expires, path, domain, secure, sameSite) {
@@ -98442,7 +98493,7 @@ var require_axios = __commonJS({
98442
98493
  );
98443
98494
  }
98444
98495
  if (utils$1.isFormData(data)) {
98445
- if (platform7.hasStandardBrowserEnv || platform7.hasStandardBrowserWebWorkerEnv) {
98496
+ if (platform9.hasStandardBrowserEnv || platform9.hasStandardBrowserWebWorkerEnv) {
98446
98497
  headers.setContentType(void 0);
98447
98498
  } else if (utils$1.isFunction(data.getHeaders)) {
98448
98499
  const formHeaders = data.getHeaders();
@@ -98454,7 +98505,7 @@ var require_axios = __commonJS({
98454
98505
  });
98455
98506
  }
98456
98507
  }
98457
- if (platform7.hasStandardBrowserEnv) {
98508
+ if (platform9.hasStandardBrowserEnv) {
98458
98509
  withXSRFToken && utils$1.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(newConfig));
98459
98510
  if (withXSRFToken || withXSRFToken !== false && isURLSameOrigin(newConfig.url)) {
98460
98511
  const xsrfValue = xsrfHeaderName && xsrfCookieName && cookies.read(xsrfCookieName);
@@ -98592,7 +98643,7 @@ var require_axios = __commonJS({
98592
98643
  }
98593
98644
  }
98594
98645
  const protocol = parseProtocol(_config.url);
98595
- if (protocol && platform7.protocols.indexOf(protocol) === -1) {
98646
+ if (protocol && platform9.protocols.indexOf(protocol) === -1) {
98596
98647
  reject(
98597
98648
  new AxiosError$1(
98598
98649
  "Unsupported protocol " + protocol + ":",
@@ -98752,7 +98803,7 @@ var require_axios = __commonJS({
98752
98803
  const encodeText = isFetchSupported && (typeof TextEncoder$1 === "function" ? /* @__PURE__ */ ((encoder) => (str) => encoder.encode(str))(new TextEncoder$1()) : async (str) => new Uint8Array(await new Request(str).arrayBuffer()));
98753
98804
  const supportsRequestStream = isRequestSupported && isReadableStreamSupported && test(() => {
98754
98805
  let duplexAccessed = false;
98755
- const hasContentType = new Request(platform7.origin, {
98806
+ const hasContentType = new Request(platform9.origin, {
98756
98807
  body: new ReadableStream$1(),
98757
98808
  method: "POST",
98758
98809
  get duplex() {
@@ -98789,7 +98840,7 @@ var require_axios = __commonJS({
98789
98840
  return body.size;
98790
98841
  }
98791
98842
  if (utils$1.isSpecCompliantForm(body)) {
98792
- const _request = new Request(platform7.origin, {
98843
+ const _request = new Request(platform9.origin, {
98793
98844
  method: "POST",
98794
98845
  body
98795
98846
  });
@@ -196731,18 +196782,42 @@ ${cleanText}`,
196731
196782
  }
196732
196783
  if (path === "/api/tasks/deliverables" && req.method === "GET") {
196733
196784
  const projectId = url.searchParams.get("projectId") ?? void 0;
196734
- const all = this.taskService.listTasks({ projectId });
196735
- const items = all.filter((t2) => t2.deliverables && t2.deliverables.length > 0).map((t2) => ({
196736
- taskId: t2.id,
196737
- taskTitle: t2.title,
196738
- taskStatus: t2.status,
196739
- projectId: t2.projectId,
196740
- requirementId: t2.requirementId,
196741
- assignedAgentId: t2.assignedAgentId,
196742
- updatedAt: t2.updatedAt,
196743
- deliverables: t2.deliverables
196744
- }));
196745
- this.json(res, 200, { items });
196785
+ if (this.deliverableService) {
196786
+ const { results } = this.deliverableService.search({ projectId, limit: 500 });
196787
+ const grouped = /* @__PURE__ */ new Map();
196788
+ for (const d of results) {
196789
+ if (!d.taskId)
196790
+ continue;
196791
+ if (!grouped.has(d.taskId)) {
196792
+ const task = this.taskService.getTask(d.taskId);
196793
+ grouped.set(d.taskId, {
196794
+ taskId: d.taskId,
196795
+ taskTitle: task?.title ?? "",
196796
+ taskStatus: task?.status ?? "",
196797
+ projectId: task?.projectId,
196798
+ requirementId: task?.requirementId,
196799
+ assignedAgentId: task?.assignedAgentId,
196800
+ updatedAt: task?.updatedAt,
196801
+ deliverables: []
196802
+ });
196803
+ }
196804
+ grouped.get(d.taskId).deliverables.push(d);
196805
+ }
196806
+ this.json(res, 200, { items: [...grouped.values()] });
196807
+ } else {
196808
+ const all = this.taskService.listTasks({ projectId });
196809
+ const items = all.filter((t2) => t2.deliverables && t2.deliverables.length > 0).map((t2) => ({
196810
+ taskId: t2.id,
196811
+ taskTitle: t2.title,
196812
+ taskStatus: t2.status,
196813
+ projectId: t2.projectId,
196814
+ requirementId: t2.requirementId,
196815
+ assignedAgentId: t2.assignedAgentId,
196816
+ updatedAt: t2.updatedAt,
196817
+ deliverables: t2.deliverables
196818
+ }));
196819
+ this.json(res, 200, { items });
196820
+ }
196746
196821
  return;
196747
196822
  }
196748
196823
  if (path === "/api/deliverables" && req.method === "GET") {
@@ -201222,11 +201297,11 @@ EXPLANATION_END`;
201222
201297
  return;
201223
201298
  try {
201224
201299
  const { exec: execCb2 } = await import("node:child_process");
201225
- const platform7 = process.platform;
201226
- if (platform7 === "darwin") {
201300
+ const platform9 = process.platform;
201301
+ if (platform9 === "darwin") {
201227
201302
  execCb2('open -a "Google Chrome" "chrome://extensions"', () => {
201228
201303
  });
201229
- } else if (platform7 === "win32") {
201304
+ } else if (platform9 === "win32") {
201230
201305
  execCb2('start "" "chrome://extensions"', () => {
201231
201306
  });
201232
201307
  } else {
@@ -203275,10 +203350,10 @@ You can now:
203275
203350
  this.json(res, 400, { error: "Invalid or non-existent path" });
203276
203351
  return;
203277
203352
  }
203278
- const platform7 = process.platform;
203279
- if (platform7 === "darwin")
203353
+ const platform9 = process.platform;
203354
+ if (platform9 === "darwin")
203280
203355
  execSync4(`open ${JSON.stringify(dirPath)}`);
203281
- else if (platform7 === "win32")
203356
+ else if (platform9 === "win32")
203282
203357
  execSync4(`explorer ${JSON.stringify(dirPath)}`);
203283
203358
  else
203284
203359
  execSync4(`xdg-open ${JSON.stringify(dirPath)}`);
@@ -203626,11 +203701,11 @@ You can now:
203626
203701
  return;
203627
203702
  }
203628
203703
  const isDir = statSync8(resolved).isDirectory();
203629
- const platform7 = process.platform;
203704
+ const platform9 = process.platform;
203630
203705
  let cmd;
203631
- if (platform7 === "darwin") {
203706
+ if (platform9 === "darwin") {
203632
203707
  cmd = isDir ? `open "${resolved}"` : `open -R "${resolved}"`;
203633
- } else if (platform7 === "win32") {
203708
+ } else if (platform9 === "win32") {
203634
203709
  cmd = isDir ? `explorer "${resolved}"` : `explorer /select,"${resolved}"`;
203635
203710
  } else {
203636
203711
  cmd = `xdg-open "${isDir ? resolved : dirname16(resolved)}"`;
@@ -206300,7 +206375,7 @@ MCowBQYDK2VwAyEAPlaceholderPublicKeyForOfflineLicenseVerification00=
206300
206375
  // ../org-manager/dist/telemetry-service.js
206301
206376
  import { readFileSync as readFileSync26, writeFileSync as writeFileSync20, existsSync as existsSync32, mkdirSync as mkdirSync22 } from "node:fs";
206302
206377
  import { join as join28, dirname as dirname10 } from "node:path";
206303
- import { homedir as homedir18, platform as platform4, arch as arch2 } from "node:os";
206378
+ import { homedir as homedir18, platform as platform6, arch as arch2 } from "node:os";
206304
206379
  async function hubFetch2(url, init) {
206305
206380
  let currentUrl = url;
206306
206381
  for (let i = 0; i < 3; i++) {
@@ -206379,7 +206454,7 @@ var init_telemetry_service = __esm({
206379
206454
  const payload = {
206380
206455
  instanceId: this.instanceId,
206381
206456
  version: APP_VERSION,
206382
- os: `${platform4()}/${arch2()}`,
206457
+ os: `${platform6()}/${arch2()}`,
206383
206458
  ...stats
206384
206459
  };
206385
206460
  const hubToken = this.readHubToken();
@@ -208008,56 +208083,23 @@ var init_deliverable_service = __esm({
208008
208083
  return missing;
208009
208084
  }
208010
208085
  /**
208011
- * One-time migration: scan existing tasks and create Deliverable entries
208012
- * for any task.deliverables that don't yet have a corresponding row.
208013
- * Also cleans up any legacy "branch"-type deliverables by marking them outdated.
208086
+ * Clean up legacy migration markers and branch-type deliverables from the table.
208087
+ * Safe to call on startup removes only housekeeping rows.
208014
208088
  */
208015
- async migrateFromTasks(tasks) {
208016
- let branchCleaned = 0;
208089
+ async cleanupLegacyRows() {
208090
+ let cleaned = 0;
208017
208091
  for (const [id, d] of this.cache) {
208018
- if (d.type === "branch" && d.status !== "outdated") {
208019
- d.status = "outdated";
208020
- d.updatedAt = (/* @__PURE__ */ new Date()).toISOString();
208021
- await this.repo?.update(id, { status: "outdated" });
208022
- branchCleaned++;
208023
- }
208024
- }
208025
- if (branchCleaned > 0) {
208026
- log75.info("Cleaned up legacy branch-type deliverables", { count: branchCleaned });
208027
- }
208028
- const existingTaskIds = this.repo ? await this.repo.listTaskIdsWithDeliverables() : new Set([...this.cache.values()].map((d) => d.taskId).filter(Boolean));
208029
- let migrated = 0;
208030
- for (const task of tasks) {
208031
- if (!task.deliverables?.length)
208032
- continue;
208033
- if (existingTaskIds.has(task.id))
208034
- continue;
208035
- for (const d of task.deliverables) {
208036
- if (d.type === "branch")
208037
- continue;
208038
- try {
208039
- await this.create({
208040
- type: this.mapTaskDeliverableType(d.type),
208041
- title: d.summary?.slice(0, 200) || d.reference,
208042
- summary: d.summary || "",
208043
- reference: d.reference,
208044
- taskId: task.id,
208045
- agentId: task.assignedAgentId,
208046
- projectId: task.projectId,
208047
- requirementId: task.requirementId,
208048
- diffStats: d.diffStats,
208049
- testResults: d.testResults
208050
- });
208051
- migrated++;
208052
- } catch (err) {
208053
- log75.warn("Failed to migrate task deliverable", { taskId: task.id, ref: d.reference, error: String(err) });
208054
- }
208092
+ const isMigrationMarker = d.title === "[migration-processed]" && d.status === "outdated";
208093
+ const isBranchType = d.type === "branch";
208094
+ if (isMigrationMarker || isBranchType) {
208095
+ this.cache.delete(id);
208096
+ await this.repo?.delete(id);
208097
+ cleaned++;
208055
208098
  }
208056
208099
  }
208057
- if (migrated > 0) {
208058
- log75.info("Migrated task deliverables to unified table", { migrated });
208100
+ if (cleaned > 0) {
208101
+ log75.info("Cleaned up legacy deliverable rows", { count: cleaned });
208059
208102
  }
208060
- return migrated;
208061
208103
  }
208062
208104
  parseTags(raw) {
208063
208105
  if (Array.isArray(raw))
@@ -208074,14 +208116,6 @@ var init_deliverable_service = __esm({
208074
208116
  }
208075
208117
  return [];
208076
208118
  }
208077
- mapTaskDeliverableType(type) {
208078
- switch (type) {
208079
- case "file":
208080
- return "file";
208081
- default:
208082
- return "file";
208083
- }
208084
- }
208085
208119
  rowToDeliverable(r) {
208086
208120
  return {
208087
208121
  id: r.id,
@@ -208871,7 +208905,8 @@ function openSqlite(dbPath) {
208871
208905
  { table: "agents", column: "disabled", sql: "ALTER TABLE agents ADD COLUMN disabled INTEGER NOT NULL DEFAULT 0" },
208872
208906
  { table: "deliverables", column: "format", sql: "ALTER TABLE deliverables ADD COLUMN format TEXT" },
208873
208907
  { table: "task_comments", column: "reply_to_id", sql: "ALTER TABLE task_comments ADD COLUMN reply_to_id TEXT" },
208874
- { table: "requirement_comments", column: "reply_to_id", sql: "ALTER TABLE requirement_comments ADD COLUMN reply_to_id TEXT" }
208908
+ { table: "requirement_comments", column: "reply_to_id", sql: "ALTER TABLE requirement_comments ADD COLUMN reply_to_id TEXT" },
208909
+ { table: "tasks", column: "completion_summary", sql: "ALTER TABLE tasks ADD COLUMN completion_summary TEXT" }
208875
208910
  ];
208876
208911
  for (const m of migrations) {
208877
208912
  const cols = _db.prepare(`PRAGMA table_info(${m.table})`).all();
@@ -209819,6 +209854,9 @@ CREATE INDEX IF NOT EXISTS idx_integrations_org ON integrations(org_id, platform
209819
209854
  async updateDeliverables(id, deliverables) {
209820
209855
  this.db.prepare("UPDATE tasks SET deliverables = ?, updated_at = ? WHERE id = ?").run(toJson(deliverables), now2(), id);
209821
209856
  }
209857
+ async updateCompletionSummary(id, summary) {
209858
+ this.db.prepare("UPDATE tasks SET completion_summary = ?, updated_at = ? WHERE id = ?").run(summary, now2(), id);
209859
+ }
209822
209860
  listByOrg(orgId2, filters2) {
209823
209861
  let q = "SELECT * FROM tasks WHERE org_id = ?";
209824
209862
  const vals = [orgId2];
@@ -209890,6 +209928,7 @@ CREATE INDEX IF NOT EXISTS idx_integrations_org ON integrations(org_id, platform
209890
209928
  completedAt: toDate(r["completed_at"]),
209891
209929
  taskType: r["task_type"] ?? "standard",
209892
209930
  scheduleConfig: fromJson(r["schedule_config"]),
209931
+ completionSummary: r["completion_summary"] ?? void 0,
209893
209932
  createdAt: toDate(r["created_at"]),
209894
209933
  updatedAt: toDate(r["updated_at"]),
209895
209934
  dueAt: toDate(r["due_at"])
@@ -211419,6 +211458,9 @@ CREATE INDEX IF NOT EXISTS idx_integrations_org ON integrations(org_id, platform
211419
211458
  async remove(id) {
211420
211459
  this.db.prepare("UPDATE deliverables SET status = 'outdated', updated_at = ? WHERE id = ?").run(now2(), id);
211421
211460
  }
211461
+ async delete(id) {
211462
+ this.db.prepare("DELETE FROM deliverables WHERE id = ?").run(id);
211463
+ }
211422
211464
  async listAll(limit = 500) {
211423
211465
  const rows = this.db.prepare("SELECT * FROM deliverables WHERE status != 'outdated' ORDER BY updated_at DESC LIMIT ?").all(limit);
211424
211466
  return rows.map((r) => this.mapRow(r));
@@ -212078,8 +212120,8 @@ CREATE INDEX IF NOT EXISTS idx_integrations_org ON integrations(org_id, platform
212078
212120
  const rows = this.db.prepare("SELECT * FROM integrations WHERE org_id = ? ORDER BY platform, display_name").all(orgId2);
212079
212121
  return rows.map((r) => this.mapRow(r));
212080
212122
  }
212081
- listByPlatform(orgId2, platform7) {
212082
- const rows = this.db.prepare("SELECT * FROM integrations WHERE org_id = ? AND platform = ? ORDER BY display_name").all(orgId2, platform7);
212123
+ listByPlatform(orgId2, platform9) {
212124
+ const rows = this.db.prepare("SELECT * FROM integrations WHERE org_id = ? AND platform = ? ORDER BY display_name").all(orgId2, platform9);
212083
212125
  return rows.map((r) => this.mapRow(r));
212084
212126
  }
212085
212127
  async update(id, data) {
@@ -221706,8 +221748,8 @@ var init_router2 = __esm({
221706
221748
  this.adapters.set(adapter2.platform, adapter2);
221707
221749
  log95.info(`Registered comm adapter: ${adapter2.platform}`);
221708
221750
  }
221709
- bindAgentToChannel(agentId2, platform7, channelId) {
221710
- const key2 = `${platform7}:${channelId}`;
221751
+ bindAgentToChannel(agentId2, platform9, channelId) {
221752
+ const key2 = `${platform9}:${channelId}`;
221711
221753
  this.agentChannelMap.set(key2, agentId2);
221712
221754
  log95.info(`Bound agent ${agentId2} to ${key2}`);
221713
221755
  }
@@ -221738,16 +221780,16 @@ var init_router2 = __esm({
221738
221780
  }
221739
221781
  }
221740
221782
  }
221741
- async sendToChannel(platform7, channelId, content) {
221742
- const adapter2 = this.adapters.get(platform7);
221783
+ async sendToChannel(platform9, channelId, content) {
221784
+ const adapter2 = this.adapters.get(platform9);
221743
221785
  if (!adapter2 || !adapter2.isConnected()) {
221744
- log95.warn(`Adapter not available for platform: ${platform7}`);
221786
+ log95.warn(`Adapter not available for platform: ${platform9}`);
221745
221787
  return void 0;
221746
221788
  }
221747
221789
  return adapter2.sendMessage(channelId, content);
221748
221790
  }
221749
- async sendAsAgent(agentId2, platform7, channelId, content) {
221750
- return this.sendToChannel(platform7, channelId, content);
221791
+ async sendAsAgent(agentId2, platform9, channelId, content) {
221792
+ return this.sendToChannel(platform9, channelId, content);
221751
221793
  }
221752
221794
  async routeIncomingMessage(message) {
221753
221795
  const key2 = `${message.platform}:${message.channelId}`;
@@ -221879,10 +221921,10 @@ var init_logger2 = __esm({
221879
221921
  // src/utils/browser.ts
221880
221922
  import { exec } from "node:child_process";
221881
221923
  import { get as httpGet } from "node:http";
221882
- import { platform as platform5 } from "node:os";
221924
+ import { platform as platform7 } from "node:os";
221883
221925
  function openBrowser(url) {
221884
221926
  if (process.env["NO_BROWSER"]) return;
221885
- const sys = platform5();
221927
+ const sys = platform7();
221886
221928
  const cmd = sys === "darwin" ? `open "${url}"` : sys === "win32" ? `start "" "${url}"` : `xdg-open "${url}"`;
221887
221929
  exec(cmd, (err) => {
221888
221930
  if (err) {
@@ -222223,8 +222265,8 @@ function loadFromDir(dir, map) {
222223
222265
  }
222224
222266
  }
222225
222267
  }
222226
- function findConnector(platform7) {
222227
- return loadConnectors().find((c) => c.platform === platform7);
222268
+ function findConnector(platform9) {
222269
+ return loadConnectors().find((c) => c.platform === platform9);
222228
222270
  }
222229
222271
  function scanInstalledPlatforms() {
222230
222272
  const connectors = loadConnectors();
@@ -223489,7 +223531,7 @@ __export(start_exports, {
223489
223531
  registerStartCommand: () => registerStartCommand,
223490
223532
  startServerHeadless: () => startServerHeadless
223491
223533
  });
223492
- import { resolve as resolve18, join as join37, dirname as dirname13 } from "node:path";
223534
+ import { resolve as resolve18, join as join37, dirname as dirname13, delimiter } from "node:path";
223493
223535
  import { existsSync as existsSync41, readFileSync as readFileSync31 } from "node:fs";
223494
223536
  import { homedir as homedir26 } from "node:os";
223495
223537
  function registerStartCommand(program2) {
@@ -223827,7 +223869,7 @@ async function startServerCore(config, values, opts) {
223827
223869
  const cwdBin = join37(process.cwd(), "node_modules", ".bin");
223828
223870
  if (existsSync41(cwdBin) && !currentPath.includes(cwdBin)) extraPaths.push(cwdBin);
223829
223871
  if (extraPaths.length > 0) {
223830
- process.env["PATH"] = `${extraPaths.join(":")}:${currentPath}`;
223872
+ process.env["PATH"] = `${extraPaths.join(delimiter)}${delimiter}${currentPath}`;
223831
223873
  }
223832
223874
  if (config.security?.adminPassword && !process.env["ADMIN_PASSWORD"]) {
223833
223875
  process.env["ADMIN_PASSWORD"] = config.security.adminPassword;
@@ -223899,9 +223941,8 @@ async function startServerCore(config, values, opts) {
223899
223941
  const knowledgeService = new KnowledgeService(knowledgeStore);
223900
223942
  const deliverableService = new DeliverableService(storage?.deliverableRepo);
223901
223943
  await deliverableService.load();
223902
- const allTasks = taskService.listTasks({ orgId: "default" });
223903
- await deliverableService.migrateFromTasks(allTasks);
223904
- await deliverableService.deduplicateByReference();
223944
+ await taskService.migrateBranchToCompletionSummary();
223945
+ await deliverableService.cleanupLegacyRows();
223905
223946
  const reportService = new ReportService(taskService, billingService, auditService, knowledgeService);
223906
223947
  const _trustService = new TrustService();
223907
223948
  const requirementService = new RequirementService();
@@ -224906,7 +224947,7 @@ ${reason}`;
224906
224947
  }
224907
224948
  startupBlank();
224908
224949
  const logFile = getStartupLogFile();
224909
- const logFileName = logFile.split("/").pop() ?? logFile;
224950
+ const logFileName = logFile.replace(/.*[/\\]/, "") || logFile;
224910
224951
  const uiUrl = `http://localhost:${apiPort}`;
224911
224952
  progress?.finish(uiUrl);
224912
224953
  onProgress?.("ready", `server ready at ${uiUrl}`);
@@ -226129,7 +226170,7 @@ __export(update_exports, {
226129
226170
  import { execSync as execSync6, spawnSync } from "node:child_process";
226130
226171
  import { existsSync as existsSync42, mkdirSync as mkdirSync31, renameSync, rmSync as rmSync4, createWriteStream as createWriteStream3 } from "node:fs";
226131
226172
  import { join as join38 } from "node:path";
226132
- import { homedir as homedir27, platform as platform6, arch as arch3 } from "node:os";
226173
+ import { homedir as homedir27, platform as platform8, arch as arch3 } from "node:os";
226133
226174
  import { pipeline } from "node:stream/promises";
226134
226175
  import { Readable } from "node:stream";
226135
226176
  function detectInstallMethod() {
@@ -226150,7 +226191,7 @@ function detectInstallMethod() {
226150
226191
  return "unknown";
226151
226192
  }
226152
226193
  function getDownloadUrl(version) {
226153
- const os = platform6();
226194
+ const os = platform8();
226154
226195
  const a = arch3();
226155
226196
  const platformStr = os === "win32" ? "win" : os;
226156
226197
  const archStr = a === "arm64" ? "arm64" : "x64";
@@ -226372,19 +226413,19 @@ __export(install_agent_exports, {
226372
226413
  import { execSync as execSync7 } from "node:child_process";
226373
226414
  import { randomBytes as randomBytes6 } from "node:crypto";
226374
226415
  function registerInstallAgentCommands(program2) {
226375
- program2.command("install <platform>").description("Install an external agent platform and connect it to Markus").option("--org-id <id>", "Organization ID", "default").option("--agent-name <name>", "Agent display name").option("--skip-install", "Skip npm install (platform already installed)").option("--skip-init", "Skip platform initialization").option("--skip-connect", "Only install, do not register with Markus").action(async (platform7, opts, cmd) => {
226416
+ program2.command("install <platform>").description("Install an external agent platform and connect it to Markus").option("--org-id <id>", "Organization ID", "default").option("--agent-name <name>", "Agent display name").option("--skip-install", "Skip npm install (platform already installed)").option("--skip-init", "Skip platform initialization").option("--skip-connect", "Only install, do not register with Markus").action(async (platform9, opts, cmd) => {
226376
226417
  const g = cmd.optsWithGlobals();
226377
- const connector = findConnector(platform7);
226418
+ const connector = findConnector(platform9);
226378
226419
  if (!connector) {
226379
226420
  const available = loadConnectors().map((c) => c.platform).join(", ");
226380
- fail(`Unknown platform "${platform7}". Available: ${available || "none"}`);
226421
+ fail(`Unknown platform "${platform9}". Available: ${available || "none"}`);
226381
226422
  return;
226382
226423
  }
226383
226424
  console.log(`
226384
226425
  Installing ${connector.displayName}...
226385
226426
  `);
226386
226427
  const scan = scanInstalledPlatforms();
226387
- const existing = scan.find((s2) => s2.platform === platform7);
226428
+ const existing = scan.find((s2) => s2.platform === platform9);
226388
226429
  const alreadyInstalled = existing?.installed;
226389
226430
  if (alreadyInstalled && !opts.skipInstall) {
226390
226431
  console.log(` [1/5] ${connector.displayName} is already installed.`);
@@ -226420,13 +226461,13 @@ function registerInstallAgentCommands(program2) {
226420
226461
  console.log(` [4/5] Token generation skipped.`);
226421
226462
  console.log(` [5/5] Config write skipped.`);
226422
226463
  console.log(`
226423
- ${connector.displayName} installed. Run \`markus install ${platform7}\` again without --skip-connect to connect later.
226464
+ ${connector.displayName} installed. Run \`markus install ${platform9}\` again without --skip-connect to connect later.
226424
226465
  `);
226425
226466
  return;
226426
226467
  }
226427
226468
  const client = createClient(g);
226428
226469
  const serverUrl = g.server || process.env["MARKUS_API_URL"] || "http://localhost:8056";
226429
- const agentId2 = `${platform7}-${randomBytes6(4).toString("hex")}`;
226470
+ const agentId2 = `${platform9}-${randomBytes6(4).toString("hex")}`;
226430
226471
  const agentName = opts.agentName || connector.defaultAgentName || `${connector.displayName} Agent`;
226431
226472
  const capabilities = connector.defaultCapabilities ?? [];
226432
226473
  try {
@@ -226489,7 +226530,7 @@ function registerInstallAgentCommands(program2) {
226489
226530
  Connection failed: ${e.message}`);
226490
226531
  console.log(` ${connector.displayName} was installed but could not connect to Markus.`);
226491
226532
  console.log(` Make sure the Markus server is running (\`markus start\`), then run:`);
226492
- console.log(` markus install ${platform7}
226533
+ console.log(` markus install ${platform9}
226493
226534
  `);
226494
226535
  return;
226495
226536
  }