@turmind/halo 1.1.3 → 1.1.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
@@ -8,7 +8,7 @@ var __export = (target, all) => {
8
8
  __defProp(target, name, { get: all[name], enumerable: true });
9
9
  };
10
10
 
11
- // packages/cli/src/server-supervisor.ts
11
+ // src/server-supervisor.ts
12
12
  var server_supervisor_exports = {};
13
13
  __export(server_supervisor_exports, {
14
14
  MAX_RESTARTS: () => MAX_RESTARTS,
@@ -114,7 +114,7 @@ async function superviseServer() {
114
114
  }
115
115
  var SUPERVISE_ENV, MAX_RESTARTS, RESTART_WINDOW_MS, RESTART_DELAY_MS, INTENTIONAL_SIGNALS;
116
116
  var init_server_supervisor = __esm({
117
- "packages/cli/src/server-supervisor.ts"() {
117
+ "src/server-supervisor.ts"() {
118
118
  "use strict";
119
119
  SUPERVISE_ENV = "HALO_SUPERVISE";
120
120
  MAX_RESTARTS = 5;
@@ -124,7 +124,7 @@ var init_server_supervisor = __esm({
124
124
  }
125
125
  });
126
126
 
127
- // packages/server/dist/prompts/md-loader.js
127
+ // ../server/dist/prompts/md-loader.js
128
128
  import fs2 from "node:fs/promises";
129
129
  import fsSync from "node:fs";
130
130
  import path2 from "node:path";
@@ -266,13 +266,13 @@ function resolveMdFilePath(agentId, fileType, scope, workspaceRoot) {
266
266
  }
267
267
  var HALO_HOME;
268
268
  var init_md_loader = __esm({
269
- "packages/server/dist/prompts/md-loader.js"() {
269
+ "../server/dist/prompts/md-loader.js"() {
270
270
  "use strict";
271
271
  HALO_HOME = path2.join(homedir2(), ".halo", "global");
272
272
  }
273
273
  });
274
274
 
275
- // packages/server/dist/settings-schema.js
275
+ // ../server/dist/settings-schema.js
276
276
  import fs3 from "node:fs";
277
277
  import path3 from "node:path";
278
278
  import { homedir as homedir3 } from "node:os";
@@ -525,7 +525,7 @@ function loadSettingsSchema(workspaceRoot) {
525
525
  }
526
526
  var GLOBAL_MODELS_DIR, GLOBAL_SKILLS_DIR, GLOBAL_AGENTS_DIR, VALID_TYPES;
527
527
  var init_settings_schema = __esm({
528
- "packages/server/dist/settings-schema.js"() {
528
+ "../server/dist/settings-schema.js"() {
529
529
  "use strict";
530
530
  GLOBAL_MODELS_DIR = path3.join(homedir3(), ".halo", "global", "models");
531
531
  GLOBAL_SKILLS_DIR = path3.join(homedir3(), ".halo", "global", "skills");
@@ -534,7 +534,7 @@ var init_settings_schema = __esm({
534
534
  }
535
535
  });
536
536
 
537
- // packages/server/dist/config.js
537
+ // ../server/dist/config.js
538
538
  var config_exports = {};
539
539
  __export(config_exports, {
540
540
  HALO_GLOBAL_DIR: () => HALO_GLOBAL_DIR,
@@ -840,7 +840,7 @@ function getModelsRegistry() {
840
840
  }
841
841
  var HALO_HOME2, HALO_GLOBAL_DIR, HALO_SECRETS_DIR, _modelsRegistryCache, SYSTEM_CONFIG_PATH, _systemConfigCache, SETTINGS_PATH, _settingsCache, _schemaDefaultsCache, ENV_PATTERN, _wsSettingsCache, config, HIDDEN_DIRS_DEFAULT, HIDDEN_FILES_DEFAULT;
842
842
  var init_config = __esm({
843
- "packages/server/dist/config.js"() {
843
+ "../server/dist/config.js"() {
844
844
  "use strict";
845
845
  init_settings_schema();
846
846
  HALO_HOME2 = path4.join(homedir4(), ".halo");
@@ -1058,7 +1058,7 @@ var init_config = __esm({
1058
1058
  }
1059
1059
  });
1060
1060
 
1061
- // packages/server/dist/agents/conversation-repair.js
1061
+ // ../server/dist/agents/conversation-repair.js
1062
1062
  function getToolUseId(block) {
1063
1063
  const b = block;
1064
1064
  if (b.type === "tool_use" && typeof b.id === "string")
@@ -1176,12 +1176,12 @@ function repairConversationMessages(raw, label = "[Repair]") {
1176
1176
  return messages2;
1177
1177
  }
1178
1178
  var init_conversation_repair = __esm({
1179
- "packages/server/dist/agents/conversation-repair.js"() {
1179
+ "../server/dist/agents/conversation-repair.js"() {
1180
1180
  "use strict";
1181
1181
  }
1182
1182
  });
1183
1183
 
1184
- // packages/server/dist/agents/compact.js
1184
+ // ../server/dist/agents/compact.js
1185
1185
  function splitForCompact(messages2) {
1186
1186
  const keepCount = config.compact.keep_messages;
1187
1187
  let cut = Math.max(0, messages2.length - keepCount);
@@ -1228,13 +1228,13 @@ ${summaryText}` }]
1228
1228
  return { compacted: true, messages: [summaryMsg, ...recentMsgs] };
1229
1229
  }
1230
1230
  var init_compact = __esm({
1231
- "packages/server/dist/agents/compact.js"() {
1231
+ "../server/dist/agents/compact.js"() {
1232
1232
  "use strict";
1233
1233
  init_config();
1234
1234
  }
1235
1235
  });
1236
1236
 
1237
- // packages/server/dist/agents/micro-compact.js
1237
+ // ../server/dist/agents/micro-compact.js
1238
1238
  function microCompactMessages(messages2, keepRecent = DEFAULT_KEEP_RECENT) {
1239
1239
  if (!messages2 || messages2.length === 0) {
1240
1240
  return { compacted: false, cleared: 0, messages: messages2 };
@@ -1282,7 +1282,7 @@ function microCompactMessages(messages2, keepRecent = DEFAULT_KEEP_RECENT) {
1282
1282
  }
1283
1283
  var MICRO_COMPACT_PLACEHOLDER, COMPACTABLE_TOOLS, DEFAULT_KEEP_RECENT;
1284
1284
  var init_micro_compact = __esm({
1285
- "packages/server/dist/agents/micro-compact.js"() {
1285
+ "../server/dist/agents/micro-compact.js"() {
1286
1286
  "use strict";
1287
1287
  MICRO_COMPACT_PLACEHOLDER = "[Old tool result content cleared]";
1288
1288
  COMPACTABLE_TOOLS = /* @__PURE__ */ new Set([
@@ -1299,10 +1299,10 @@ var init_micro_compact = __esm({
1299
1299
  }
1300
1300
  });
1301
1301
 
1302
- // packages/server/dist/agents/agent-loop.js
1302
+ // ../server/dist/agents/agent-loop.js
1303
1303
  var TOOL_ERROR_MARKER, TOOL_WARN_MARKER, MODEL_TIMEOUT_ERROR, AgentLoop;
1304
1304
  var init_agent_loop = __esm({
1305
- "packages/server/dist/agents/agent-loop.js"() {
1305
+ "../server/dist/agents/agent-loop.js"() {
1306
1306
  "use strict";
1307
1307
  init_config();
1308
1308
  TOOL_ERROR_MARKER = "__TOOL_ERROR__";
@@ -1464,7 +1464,7 @@ Error: ${err instanceof Error ? err.message : String(err)}`;
1464
1464
  }
1465
1465
  });
1466
1466
 
1467
- // packages/server/dist/prompts/md-vars.js
1467
+ // ../server/dist/prompts/md-vars.js
1468
1468
  var md_vars_exports = {};
1469
1469
  __export(md_vars_exports, {
1470
1470
  buildRenderContext: () => buildRenderContext,
@@ -1627,7 +1627,7 @@ async function buildRenderContext(opts) {
1627
1627
  }
1628
1628
  var PATTERN, ENV_PATTERN2, ARG_PATTERN, PARAM_PATH;
1629
1629
  var init_md_vars = __esm({
1630
- "packages/server/dist/prompts/md-vars.js"() {
1630
+ "../server/dist/prompts/md-vars.js"() {
1631
1631
  "use strict";
1632
1632
  PATTERN = /\{\{\s*([\w-][\w.-]*)\s*\}\}/g;
1633
1633
  ENV_PATTERN2 = /<<([A-Z_][A-Z0-9_]*)>>/g;
@@ -1636,7 +1636,7 @@ var init_md_vars = __esm({
1636
1636
  }
1637
1637
  });
1638
1638
 
1639
- // packages/server/dist/agents/agent-loader.js
1639
+ // ../server/dist/agents/agent-loader.js
1640
1640
  import fs6 from "node:fs/promises";
1641
1641
  import fsSync2 from "node:fs";
1642
1642
  import path6 from "node:path";
@@ -1919,7 +1919,7 @@ function isTeamMember(team, targetId) {
1919
1919
  }
1920
1920
  var GLOBAL_AGENTS_DIR2, GLOBAL_SKILLS_DIR2, SKILL_ID_RE, ACCESS_RANK;
1921
1921
  var init_agent_loader = __esm({
1922
- "packages/server/dist/agents/agent-loader.js"() {
1922
+ "../server/dist/agents/agent-loader.js"() {
1923
1923
  "use strict";
1924
1924
  init_agent_loop();
1925
1925
  GLOBAL_AGENTS_DIR2 = path6.join(homedir6(), ".halo", "global", "agents");
@@ -1934,7 +1934,7 @@ var init_agent_loader = __esm({
1934
1934
  }
1935
1935
  });
1936
1936
 
1937
- // packages/server/dist/ws/broadcast.js
1937
+ // ../server/dist/ws/broadcast.js
1938
1938
  import path7 from "node:path";
1939
1939
  function setBroadcastWss(wss2) {
1940
1940
  _wss = wss2;
@@ -1980,14 +1980,14 @@ function broadcastToWorkspace(workspacePath, event) {
1980
1980
  }
1981
1981
  var _wss, _workspaceOfClient;
1982
1982
  var init_broadcast = __esm({
1983
- "packages/server/dist/ws/broadcast.js"() {
1983
+ "../server/dist/ws/broadcast.js"() {
1984
1984
  "use strict";
1985
1985
  _wss = null;
1986
1986
  _workspaceOfClient = null;
1987
1987
  }
1988
1988
  });
1989
1989
 
1990
- // packages/server/dist/db/schema.js
1990
+ // ../server/dist/db/schema.js
1991
1991
  var schema_exports = {};
1992
1992
  __export(schema_exports, {
1993
1993
  agentSessions: () => agentSessions,
@@ -1996,7 +1996,7 @@ __export(schema_exports, {
1996
1996
  import { sqliteTable, text, integer } from "drizzle-orm/sqlite-core";
1997
1997
  var agentSessions, disabledItems;
1998
1998
  var init_schema = __esm({
1999
- "packages/server/dist/db/schema.js"() {
1999
+ "../server/dist/db/schema.js"() {
2000
2000
  "use strict";
2001
2001
  agentSessions = sqliteTable("agent_sessions", {
2002
2002
  id: text("id").primaryKey(),
@@ -2033,7 +2033,7 @@ var init_schema = __esm({
2033
2033
  }
2034
2034
  });
2035
2035
 
2036
- // packages/server/dist/init.js
2036
+ // ../server/dist/init.js
2037
2037
  var init_exports = {};
2038
2038
  __export(init_exports, {
2039
2039
  TEMPLATES_DIR: () => TEMPLATES_DIR,
@@ -2339,6 +2339,13 @@ function ensureHaloHome(haloHome2) {
2339
2339
  fs7.rmSync(staleWsSkill, { recursive: true, force: true });
2340
2340
  console.log("[Init] Removed stale `ws` skill (renamed to `workspace`)");
2341
2341
  }
2342
+ for (const staleId of ["nova-web-search", "openai-web-search"]) {
2343
+ const staleDir = path8.join(globalDir2, "skills", staleId);
2344
+ if (fs7.existsSync(staleDir)) {
2345
+ fs7.rmSync(staleDir, { recursive: true, force: true });
2346
+ console.log(`[Init] Removed stale \`${staleId}\` skill (merged into \`web-search\`)`);
2347
+ }
2348
+ }
2342
2349
  const docsSrc = resolveDocsSource();
2343
2350
  if (!docsSrc) {
2344
2351
  console.log(`[Init] No docs source found \u2014 skipping platform docs seed. Searched: ${DOCS_SRC_CANDIDATES.join(", ")}`);
@@ -2392,7 +2399,7 @@ function ensureWorkspaceHalo(workspaceRoot) {
2392
2399
  }
2393
2400
  var __dirname, TEMPLATES_DIR, DOCS_SRC_CANDIDATES, TEMPLATE_VERSION, VERSION_FILE, SKIP_NAMES, BUILTIN_AGENT_IDS, BUILTIN_SKILL_IDS, BUNDLED_DOCS, INSTALLED_OPTIONAL_SKILLS_FILE;
2394
2401
  var init_init = __esm({
2395
- "packages/server/dist/init.js"() {
2402
+ "../server/dist/init.js"() {
2396
2403
  "use strict";
2397
2404
  __dirname = path8.dirname(fileURLToPath(import.meta.url));
2398
2405
  TEMPLATES_DIR = path8.resolve(__dirname, "..", "templates");
@@ -2400,7 +2407,7 @@ var init_init = __esm({
2400
2407
  path8.resolve(__dirname, "..", "bundled-docs"),
2401
2408
  path8.resolve(__dirname, "..", "..", "..", ".halo", "docs")
2402
2409
  ];
2403
- TEMPLATE_VERSION = 50;
2410
+ TEMPLATE_VERSION = 52;
2404
2411
  VERSION_FILE = ".template-version";
2405
2412
  SKIP_NAMES = /* @__PURE__ */ new Set([".DS_Store", "schema.sql", "__pycache__", ".pytest_cache"]);
2406
2413
  BUILTIN_AGENT_IDS = /* @__PURE__ */ new Set([
@@ -2434,7 +2441,7 @@ var init_init = __esm({
2434
2441
  // Capability skills, model-invoked only (user-invocable: false — no slash
2435
2442
  // command). Preinstalled because they're broadly useful out of the box.
2436
2443
  "aws-knowledge",
2437
- "nova-web-search",
2444
+ "web-search",
2438
2445
  // The agent's visual "face": teaches it that `.halo/canvas/self.html`
2439
2446
  // (seeded per-workspace, see ensureWorkspaceHalo) is a live self-portrait
2440
2447
  // it can drive in real time by emitting `<<<SHOW: …js… >>>`, which the admin
@@ -2465,7 +2472,7 @@ var init_init = __esm({
2465
2472
  }
2466
2473
  });
2467
2474
 
2468
- // packages/server/dist/db/index.js
2475
+ // ../server/dist/db/index.js
2469
2476
  import Database from "better-sqlite3";
2470
2477
  import { drizzle } from "drizzle-orm/better-sqlite3";
2471
2478
  import { eq, and } from "drizzle-orm";
@@ -2554,7 +2561,7 @@ function toggleDisabled(db, itemType, itemId, scope) {
2554
2561
  }
2555
2562
  var SCHEMA_SQL_PATH, dbCache;
2556
2563
  var init_db = __esm({
2557
- "packages/server/dist/db/index.js"() {
2564
+ "../server/dist/db/index.js"() {
2558
2565
  "use strict";
2559
2566
  init_schema();
2560
2567
  init_init();
@@ -2563,7 +2570,7 @@ var init_db = __esm({
2563
2570
  }
2564
2571
  });
2565
2572
 
2566
- // packages/server/dist/agents/session-tools.js
2573
+ // ../server/dist/agents/session-tools.js
2567
2574
  async function callerTeamFor(sm, sessionId) {
2568
2575
  const callerId = sm.sessions.get(sessionId)?.agentId;
2569
2576
  if (!callerId)
@@ -2826,7 +2833,7 @@ ${skillInfo}` : ""
2826
2833
  ];
2827
2834
  }
2828
2835
  var init_session_tools = __esm({
2829
- "packages/server/dist/agents/session-tools.js"() {
2836
+ "../server/dist/agents/session-tools.js"() {
2830
2837
  "use strict";
2831
2838
  init_config();
2832
2839
  init_agent_loader();
@@ -2834,7 +2841,7 @@ var init_session_tools = __esm({
2834
2841
  }
2835
2842
  });
2836
2843
 
2837
- // packages/server/dist/sessions/session-archive.js
2844
+ // ../server/dist/sessions/session-archive.js
2838
2845
  import fsSync3 from "node:fs";
2839
2846
  import fs9 from "node:fs/promises";
2840
2847
  import path10 from "node:path";
@@ -2897,13 +2904,13 @@ async function deleteArchiveSegments(dir, seg) {
2897
2904
  }
2898
2905
  var ARCHIVE_SIZE_THRESHOLD;
2899
2906
  var init_session_archive = __esm({
2900
- "packages/server/dist/sessions/session-archive.js"() {
2907
+ "../server/dist/sessions/session-archive.js"() {
2901
2908
  "use strict";
2902
2909
  ARCHIVE_SIZE_THRESHOLD = 3 * 1024 * 1024;
2903
2910
  }
2904
2911
  });
2905
2912
 
2906
- // packages/server/dist/sessions/session-store.js
2913
+ // ../server/dist/sessions/session-store.js
2907
2914
  import fsSync4 from "node:fs";
2908
2915
  import fs10 from "node:fs/promises";
2909
2916
  import path11 from "node:path";
@@ -3144,13 +3151,13 @@ function findAndUpdateSessionTitle(sessionId, title, projectPath) {
3144
3151
  return false;
3145
3152
  }
3146
3153
  var init_session_store = __esm({
3147
- "packages/server/dist/sessions/session-store.js"() {
3154
+ "../server/dist/sessions/session-store.js"() {
3148
3155
  "use strict";
3149
3156
  init_session_archive();
3150
3157
  }
3151
3158
  });
3152
3159
 
3153
- // packages/server/dist/agents/goal-mode.js
3160
+ // ../server/dist/agents/goal-mode.js
3154
3161
  import fs11 from "node:fs";
3155
3162
  import path12 from "node:path";
3156
3163
  import { createHash } from "node:crypto";
@@ -3324,7 +3331,12 @@ async function deliverGoalRound(host, worker) {
3324
3331
  const activeChildren = db.select({ id: agentSessions.id }).from(agentSessions).where(and2(eq2(agentSessions.parentId, worker.id), isNull(agentSessions.stoppedAt), isNull(agentSessions.archivedAt))).all();
3325
3332
  if (activeChildren.length > 0 || worker.messageQueue.length > 0)
3326
3333
  return;
3327
- const report = worker.finalOutput || worker.output || "(no output)";
3334
+ let report = worker.finalOutput || worker.output || "(no output)";
3335
+ if (worker.turnError) {
3336
+ report = `[WORKER ABORTED: this round was terminated by an unrecoverable error, NOT a normal wrap-up. Error: ${worker.turnError}. The text below is a partial trace of the aborted turn \u2014 judge this as an interrupted round, do not score it as a completed result. Re-dispatch with query_session to let the worker resume.]
3337
+
3338
+ ${report}`;
3339
+ }
3328
3340
  const caps = state.caps;
3329
3341
  const currentSpecHash = hashFileOrNull(goalSpecPath(host.workspaceRoot, state.goalId));
3330
3342
  if (!currentSpecHash || currentSpecHash !== state.specHash) {
@@ -3617,7 +3629,7 @@ function sweepActiveGoals(host) {
3617
3629
  }
3618
3630
  var GOAL_AGENT_ID, DEFAULT_GOAL_CAPS, NO_PROGRESS_LIMIT, DELEGATED_DECISION_CAP, WORKER_RECENT_MAX_MESSAGES, WORKER_RECENT_MSG_CHARS, WORKER_RECENT_TOTAL_CHARS, NEED_INPUT_MARKER;
3619
3631
  var init_goal_mode = __esm({
3620
- "packages/server/dist/agents/goal-mode.js"() {
3632
+ "../server/dist/agents/goal-mode.js"() {
3621
3633
  "use strict";
3622
3634
  init_schema();
3623
3635
  init_session_store();
@@ -3638,7 +3650,7 @@ var init_goal_mode = __esm({
3638
3650
  }
3639
3651
  });
3640
3652
 
3641
- // packages/server/dist/agents/workspace-runtime-lock.js
3653
+ // ../server/dist/agents/workspace-runtime-lock.js
3642
3654
  import fs12 from "node:fs";
3643
3655
  import path13 from "node:path";
3644
3656
  function isPidAlive(pid) {
@@ -3686,13 +3698,13 @@ function claimWorkspaceRuntime(workspaceRoot) {
3686
3698
  }
3687
3699
  var RUNTIME_LOCK_FILE;
3688
3700
  var init_workspace_runtime_lock = __esm({
3689
- "packages/server/dist/agents/workspace-runtime-lock.js"() {
3701
+ "../server/dist/agents/workspace-runtime-lock.js"() {
3690
3702
  "use strict";
3691
3703
  RUNTIME_LOCK_FILE = "runtime.lock";
3692
3704
  }
3693
3705
  });
3694
3706
 
3695
- // packages/server/dist/db/evo-db.js
3707
+ // ../server/dist/db/evo-db.js
3696
3708
  import Database2 from "better-sqlite3";
3697
3709
  import { drizzle as drizzle2 } from "drizzle-orm/better-sqlite3";
3698
3710
  import { sqliteTable as sqliteTable2, text as text2, integer as integer2 } from "drizzle-orm/sqlite-core";
@@ -3716,7 +3728,7 @@ function getEvoDb() {
3716
3728
  }
3717
3729
  var evolutionRuns, evolutionApplies, CREATE_SQL, _evoDb;
3718
3730
  var init_evo_db = __esm({
3719
- "packages/server/dist/db/evo-db.js"() {
3731
+ "../server/dist/db/evo-db.js"() {
3720
3732
  "use strict";
3721
3733
  evolutionRuns = sqliteTable2("evolution_runs", {
3722
3734
  id: text2("id").primaryKey(),
@@ -3798,7 +3810,7 @@ CREATE INDEX IF NOT EXISTS idx_evo_applies_archived ON evolution_applies(archive
3798
3810
  }
3799
3811
  });
3800
3812
 
3801
- // packages/server/dist/paths.js
3813
+ // ../server/dist/paths.js
3802
3814
  import path15 from "node:path";
3803
3815
  import { homedir as homedir8 } from "node:os";
3804
3816
  function haloHome() {
@@ -3844,12 +3856,12 @@ function evoApplyLogFile(applyId) {
3844
3856
  return path15.join(evoLogsDir(), `apply-${applyId}.log`);
3845
3857
  }
3846
3858
  var init_paths = __esm({
3847
- "packages/server/dist/paths.js"() {
3859
+ "../server/dist/paths.js"() {
3848
3860
  "use strict";
3849
3861
  }
3850
3862
  });
3851
3863
 
3852
- // packages/server/dist/evolution/enqueue.js
3864
+ // ../server/dist/evolution/enqueue.js
3853
3865
  import fs14 from "node:fs";
3854
3866
  import path16 from "node:path";
3855
3867
  import { homedir as homedir9 } from "node:os";
@@ -4134,20 +4146,20 @@ function enqueueEvoRun(input) {
4134
4146
  return { ok: true, runId, runDir };
4135
4147
  }
4136
4148
  var init_enqueue = __esm({
4137
- "packages/server/dist/evolution/enqueue.js"() {
4149
+ "../server/dist/evolution/enqueue.js"() {
4138
4150
  "use strict";
4139
4151
  init_evo_db();
4140
4152
  init_paths();
4141
4153
  }
4142
4154
  });
4143
4155
 
4144
- // packages/core/dist/workspace/workspace.js
4156
+ // ../core/dist/workspace/workspace.js
4145
4157
  import { readFile, writeFile, mkdir } from "node:fs/promises";
4146
4158
  import { realpathSync } from "node:fs";
4147
4159
  import { resolve, isAbsolute, sep } from "node:path";
4148
4160
  var WorkspaceError, Workspace;
4149
4161
  var init_workspace = __esm({
4150
- "packages/core/dist/workspace/workspace.js"() {
4162
+ "../core/dist/workspace/workspace.js"() {
4151
4163
  "use strict";
4152
4164
  WorkspaceError = class extends Error {
4153
4165
  constructor(message) {
@@ -4192,13 +4204,13 @@ var init_workspace = __esm({
4192
4204
  }
4193
4205
  });
4194
4206
 
4195
- // packages/core/dist/workspace/git-manager.js
4207
+ // ../core/dist/workspace/git-manager.js
4196
4208
  import path17 from "node:path";
4197
4209
  import { promises as fs15 } from "node:fs";
4198
4210
  import simpleGit from "simple-git";
4199
4211
  var GitManagerError, GitManager;
4200
4212
  var init_git_manager = __esm({
4201
- "packages/core/dist/workspace/git-manager.js"() {
4213
+ "../core/dist/workspace/git-manager.js"() {
4202
4214
  "use strict";
4203
4215
  GitManagerError = class extends Error {
4204
4216
  constructor(message) {
@@ -4555,7 +4567,7 @@ var init_git_manager = __esm({
4555
4567
  }
4556
4568
  });
4557
4569
 
4558
- // packages/core/dist/media/mime.js
4570
+ // ../core/dist/media/mime.js
4559
4571
  function normalizeExt(ext) {
4560
4572
  const lower = ext.toLowerCase();
4561
4573
  return lower.startsWith(".") ? lower : `.${lower}`;
@@ -4568,7 +4580,7 @@ function extFromImageMime(mime) {
4568
4580
  }
4569
4581
  var PHOTO_MIME_BY_EXT, SERVE_ONLY_MIME_BY_EXT, IMAGE_MIME_BY_EXT, EXT_BY_PHOTO_MIME, IMAGE_EXTS;
4570
4582
  var init_mime = __esm({
4571
- "packages/core/dist/media/mime.js"() {
4583
+ "../core/dist/media/mime.js"() {
4572
4584
  "use strict";
4573
4585
  PHOTO_MIME_BY_EXT = {
4574
4586
  ".png": "image/png",
@@ -4592,9 +4604,9 @@ var init_mime = __esm({
4592
4604
  }
4593
4605
  });
4594
4606
 
4595
- // packages/core/dist/index.js
4607
+ // ../core/dist/index.js
4596
4608
  var init_dist = __esm({
4597
- "packages/core/dist/index.js"() {
4609
+ "../core/dist/index.js"() {
4598
4610
  "use strict";
4599
4611
  init_workspace();
4600
4612
  init_git_manager();
@@ -4602,7 +4614,7 @@ var init_dist = __esm({
4602
4614
  }
4603
4615
  });
4604
4616
 
4605
- // packages/server/dist/channels/shared/media-store.js
4617
+ // ../server/dist/channels/shared/media-store.js
4606
4618
  import fs16 from "node:fs/promises";
4607
4619
  import path18 from "node:path";
4608
4620
  import { randomBytes } from "node:crypto";
@@ -4663,7 +4675,7 @@ async function saveInboundMedia(params) {
4663
4675
  }
4664
4676
  var VISION_IMAGE_MIME_TYPES, EXT_BY_AV_MIME;
4665
4677
  var init_media_store = __esm({
4666
- "packages/server/dist/channels/shared/media-store.js"() {
4678
+ "../server/dist/channels/shared/media-store.js"() {
4667
4679
  "use strict";
4668
4680
  init_dist();
4669
4681
  VISION_IMAGE_MIME_TYPES = ["image/jpeg", "image/png", "image/gif", "image/webp"];
@@ -4680,7 +4692,7 @@ var init_media_store = __esm({
4680
4692
  }
4681
4693
  });
4682
4694
 
4683
- // packages/server/dist/sessions/ui-log-builder.js
4695
+ // ../server/dist/sessions/ui-log-builder.js
4684
4696
  import { randomUUID } from "node:crypto";
4685
4697
  function createEmptyUIState() {
4686
4698
  return {
@@ -5084,19 +5096,19 @@ function applyEvent(state, event) {
5084
5096
  }
5085
5097
  var msgCounter;
5086
5098
  var init_ui_log_builder = __esm({
5087
- "packages/server/dist/sessions/ui-log-builder.js"() {
5099
+ "../server/dist/sessions/ui-log-builder.js"() {
5088
5100
  "use strict";
5089
5101
  msgCounter = 0;
5090
5102
  }
5091
5103
  });
5092
5104
 
5093
- // packages/server/dist/agents/session-ui-store.js
5105
+ // ../server/dist/agents/session-ui-store.js
5094
5106
  import fsSync5 from "node:fs";
5095
5107
  import path19 from "node:path";
5096
5108
  import { eq as eq3 } from "drizzle-orm";
5097
5109
  var UI_STATE_IDLE_TTL_MS, UI_STATE_SWEEP_PERIOD_MS, SessionUIStore;
5098
5110
  var init_session_ui_store = __esm({
5099
- "packages/server/dist/agents/session-ui-store.js"() {
5111
+ "../server/dist/agents/session-ui-store.js"() {
5100
5112
  "use strict";
5101
5113
  init_broadcast();
5102
5114
  init_schema();
@@ -5127,6 +5139,17 @@ var init_session_ui_store = __esm({
5127
5139
  /** Last activity (event reduced / view built) per uiStates key — the idle
5128
5140
  * sweep's eviction clock. Invariant: every uiStates key has an entry. */
5129
5141
  uiStateTouched = /* @__PURE__ */ new Map();
5142
+ /** Roots whose in-memory UIState holds local mutations (event reduced in,
5143
+ * notification appended, log replaced) **not yet persisted** — marked on
5144
+ * every mutation, cleared once persistUIState lands the snapshot. A state
5145
+ * not in this set adds nothing to what's on disk: either it's a pure disk
5146
+ * seed (built to *view* a session another process may be driving — a cron
5147
+ * `halo cli` child shares the workspace's session files and keeps appending
5148
+ * after the seed), or its mutations were already flushed. The WS
5149
+ * detach/switch saves gate on `isUIStateDirty`: writing a clean state back
5150
+ * would overwrite the other process's newer messages with this process's
5151
+ * frozen snapshot (the cron-session UI-log truncation incident). */
5152
+ uiStateDirty = /* @__PURE__ */ new Set();
5130
5153
  constructor(host) {
5131
5154
  this.host = host;
5132
5155
  this.db = host.getDb();
@@ -5223,6 +5246,7 @@ var init_session_ui_store = __esm({
5223
5246
  reduceIntoUIState(rootId, event) {
5224
5247
  try {
5225
5248
  const state = this.ensureUIState(rootId);
5249
+ this.uiStateDirty.add(rootId);
5226
5250
  const result = applyEvent(state, event);
5227
5251
  if (result.subSessionSave) {
5228
5252
  this.persistSubSession(state, rootId, result.subSessionSave);
@@ -5319,6 +5343,7 @@ var init_session_ui_store = __esm({
5319
5343
  archiveCount: archive?.count,
5320
5344
  archivedUserDelta: archive?.userDelta
5321
5345
  });
5346
+ this.uiStateDirty.delete(rootId);
5322
5347
  } catch (err) {
5323
5348
  console.error(`[SessionUIStore] persistUIState failed for ${rootId}: ${err instanceof Error ? err.message : String(err)}`);
5324
5349
  }
@@ -5438,6 +5463,14 @@ var init_session_ui_store = __esm({
5438
5463
  getCachedUIState(rootSessionId) {
5439
5464
  return this.uiStates.get(rootSessionId) ?? null;
5440
5465
  }
5466
+ /** Whether the cached UIState holds local mutations not yet persisted.
5467
+ * False for a state that was only seeded from disk (view of a session
5468
+ * another process drives) or whose mutations already flushed — writing
5469
+ * such a state back is at best a no-op and at worst overwrites a fresher
5470
+ * file (see uiStateDirty). */
5471
+ isUIStateDirty(rootSessionId) {
5472
+ return this.uiStateDirty.has(rootSessionId);
5473
+ }
5441
5474
  /**
5442
5475
  * Get the UIState for a session, restoring it from disk if it isn't
5443
5476
  * in memory yet. Returns null only when the session id doesn't exist
@@ -5470,6 +5503,7 @@ var init_session_ui_store = __esm({
5470
5503
  timestamp: Date.now(),
5471
5504
  agentName
5472
5505
  });
5506
+ this.uiStateDirty.add(rootId);
5473
5507
  this.persistUIState(rootId, state);
5474
5508
  }
5475
5509
  /**
@@ -5483,6 +5517,7 @@ var init_session_ui_store = __esm({
5483
5517
  state.streamBuffer = "";
5484
5518
  state.turnToolCalls = [];
5485
5519
  state.turnContentBlocks = [];
5520
+ this.uiStateDirty.add(rootId);
5486
5521
  this.persistUIState(rootId, state);
5487
5522
  }
5488
5523
  /**
@@ -5504,6 +5539,7 @@ var init_session_ui_store = __esm({
5504
5539
  this.uiStates.delete(sessionId);
5505
5540
  this.uiStateProjectPaths.delete(sessionId);
5506
5541
  this.uiStateTouched.delete(sessionId);
5542
+ this.uiStateDirty.delete(sessionId);
5507
5543
  }
5508
5544
  /**
5509
5545
  * Evict UIStates whose tree has been idle past the TTL. This is THE eviction
@@ -5560,8 +5596,10 @@ var init_session_ui_store = __esm({
5560
5596
  * session evolving elsewhere would freeze on the first snapshot.
5561
5597
  */
5562
5598
  prepareForView(sessionId, selfDriven) {
5563
- if (!selfDriven)
5599
+ if (!selfDriven) {
5564
5600
  this.uiStates.delete(sessionId);
5601
+ this.uiStateDirty.delete(sessionId);
5602
+ }
5565
5603
  this.uiStateProjectPaths.set(sessionId, this.host.workspaceRoot);
5566
5604
  return this.ensureUIState(sessionId);
5567
5605
  }
@@ -5571,6 +5609,7 @@ var init_session_ui_store = __esm({
5571
5609
  this.uiStates.delete(id);
5572
5610
  this.uiStateProjectPaths.delete(id);
5573
5611
  this.uiStateTouched.delete(id);
5612
+ this.uiStateDirty.delete(id);
5574
5613
  const timer = this.persistTimers.get(id);
5575
5614
  if (timer) {
5576
5615
  clearTimeout(timer);
@@ -5583,11 +5622,11 @@ var init_session_ui_store = __esm({
5583
5622
  }
5584
5623
  });
5585
5624
 
5586
- // packages/server/dist/agents/session-query-store.js
5625
+ // ../server/dist/agents/session-query-store.js
5587
5626
  import { eq as eq4, and as and3, isNull as isNull2, desc, lt, gte, inArray } from "drizzle-orm";
5588
5627
  var SessionQueryStore;
5589
5628
  var init_session_query_store = __esm({
5590
- "packages/server/dist/agents/session-query-store.js"() {
5629
+ "../server/dist/agents/session-query-store.js"() {
5591
5630
  "use strict";
5592
5631
  init_schema();
5593
5632
  init_session_store();
@@ -5806,7 +5845,7 @@ var init_session_query_store = __esm({
5806
5845
  }
5807
5846
  });
5808
5847
 
5809
- // packages/server/dist/agents/bedrock-agent.js
5848
+ // ../server/dist/agents/bedrock-agent.js
5810
5849
  import { BedrockRuntimeClient, InvokeModelCommand } from "@aws-sdk/client-bedrock-runtime";
5811
5850
  function effortToBudget(effort, maxTokens) {
5812
5851
  const table = {
@@ -5828,7 +5867,7 @@ function extractRegionFromEndpoint(endpoint) {
5828
5867
  }
5829
5868
  var BedrockAgent;
5830
5869
  var init_bedrock_agent = __esm({
5831
- "packages/server/dist/agents/bedrock-agent.js"() {
5870
+ "../server/dist/agents/bedrock-agent.js"() {
5832
5871
  "use strict";
5833
5872
  init_config();
5834
5873
  init_agent_loop();
@@ -5957,7 +5996,7 @@ var init_bedrock_agent = __esm({
5957
5996
  }
5958
5997
  });
5959
5998
 
5960
- // packages/server/dist/agents/deepseek-agent.js
5999
+ // ../server/dist/agents/deepseek-agent.js
5961
6000
  function safeParse(json) {
5962
6001
  try {
5963
6002
  return JSON.parse(json || "{}");
@@ -5967,7 +6006,7 @@ function safeParse(json) {
5967
6006
  }
5968
6007
  var DeepSeekAgent;
5969
6008
  var init_deepseek_agent = __esm({
5970
- "packages/server/dist/agents/deepseek-agent.js"() {
6009
+ "../server/dist/agents/deepseek-agent.js"() {
5971
6010
  "use strict";
5972
6011
  init_config();
5973
6012
  init_agent_loop();
@@ -6147,7 +6186,7 @@ var init_deepseek_agent = __esm({
6147
6186
  }
6148
6187
  });
6149
6188
 
6150
- // packages/server/dist/agents/kimi-agent.js
6189
+ // ../server/dist/agents/kimi-agent.js
6151
6190
  function safeParse2(json) {
6152
6191
  try {
6153
6192
  return JSON.parse(json || "{}");
@@ -6157,7 +6196,7 @@ function safeParse2(json) {
6157
6196
  }
6158
6197
  var KimiAgent;
6159
6198
  var init_kimi_agent = __esm({
6160
- "packages/server/dist/agents/kimi-agent.js"() {
6199
+ "../server/dist/agents/kimi-agent.js"() {
6161
6200
  "use strict";
6162
6201
  init_config();
6163
6202
  init_agent_loop();
@@ -6353,7 +6392,7 @@ var init_kimi_agent = __esm({
6353
6392
  }
6354
6393
  });
6355
6394
 
6356
- // packages/server/dist/agents/minimax-agent.js
6395
+ // ../server/dist/agents/minimax-agent.js
6357
6396
  function effortToBudget2(effort, maxTokens) {
6358
6397
  const table = {
6359
6398
  low: 2048,
@@ -6370,7 +6409,7 @@ function effortToBudget2(effort, maxTokens) {
6370
6409
  }
6371
6410
  var MiniMaxAgent;
6372
6411
  var init_minimax_agent = __esm({
6373
- "packages/server/dist/agents/minimax-agent.js"() {
6412
+ "../server/dist/agents/minimax-agent.js"() {
6374
6413
  "use strict";
6375
6414
  init_config();
6376
6415
  init_agent_loop();
@@ -6492,7 +6531,7 @@ var init_minimax_agent = __esm({
6492
6531
  }
6493
6532
  });
6494
6533
 
6495
- // packages/server/dist/agents/qwen-agent.js
6534
+ // ../server/dist/agents/qwen-agent.js
6496
6535
  function effortToBudget3(effort, maxTokens) {
6497
6536
  const table = {
6498
6537
  low: 2048,
@@ -6509,7 +6548,7 @@ function effortToBudget3(effort, maxTokens) {
6509
6548
  }
6510
6549
  var QwenAgent;
6511
6550
  var init_qwen_agent = __esm({
6512
- "packages/server/dist/agents/qwen-agent.js"() {
6551
+ "../server/dist/agents/qwen-agent.js"() {
6513
6552
  "use strict";
6514
6553
  init_config();
6515
6554
  init_agent_loop();
@@ -6627,7 +6666,7 @@ var init_qwen_agent = __esm({
6627
6666
  }
6628
6667
  });
6629
6668
 
6630
- // packages/server/dist/agents/hunyuan-agent.js
6669
+ // ../server/dist/agents/hunyuan-agent.js
6631
6670
  function safeParse3(json) {
6632
6671
  try {
6633
6672
  return JSON.parse(json || "{}");
@@ -6637,7 +6676,7 @@ function safeParse3(json) {
6637
6676
  }
6638
6677
  var HunyuanAgent;
6639
6678
  var init_hunyuan_agent = __esm({
6640
- "packages/server/dist/agents/hunyuan-agent.js"() {
6679
+ "../server/dist/agents/hunyuan-agent.js"() {
6641
6680
  "use strict";
6642
6681
  init_config();
6643
6682
  init_agent_loop();
@@ -6808,7 +6847,7 @@ var init_hunyuan_agent = __esm({
6808
6847
  }
6809
6848
  });
6810
6849
 
6811
- // packages/server/dist/agents/doubao-agent.js
6850
+ // ../server/dist/agents/doubao-agent.js
6812
6851
  function safeParse4(json) {
6813
6852
  try {
6814
6853
  return JSON.parse(json || "{}");
@@ -6818,7 +6857,7 @@ function safeParse4(json) {
6818
6857
  }
6819
6858
  var DoubaoAgent;
6820
6859
  var init_doubao_agent = __esm({
6821
- "packages/server/dist/agents/doubao-agent.js"() {
6860
+ "../server/dist/agents/doubao-agent.js"() {
6822
6861
  "use strict";
6823
6862
  init_config();
6824
6863
  init_agent_loop();
@@ -6989,7 +7028,7 @@ var init_doubao_agent = __esm({
6989
7028
  }
6990
7029
  });
6991
7030
 
6992
- // packages/server/dist/agents/openai-agent.js
7031
+ // ../server/dist/agents/openai-agent.js
6993
7032
  function safeParse5(json) {
6994
7033
  try {
6995
7034
  return JSON.parse(json || "{}");
@@ -6999,7 +7038,7 @@ function safeParse5(json) {
6999
7038
  }
7000
7039
  var OpenAIAgent;
7001
7040
  var init_openai_agent = __esm({
7002
- "packages/server/dist/agents/openai-agent.js"() {
7041
+ "../server/dist/agents/openai-agent.js"() {
7003
7042
  "use strict";
7004
7043
  init_config();
7005
7044
  init_agent_loop();
@@ -7171,7 +7210,7 @@ var init_openai_agent = __esm({
7171
7210
  }
7172
7211
  });
7173
7212
 
7174
- // packages/server/dist/agents/mantle-agent.js
7213
+ // ../server/dist/agents/mantle-agent.js
7175
7214
  import { SignatureV4 } from "@smithy/signature-v4";
7176
7215
  import { Sha256 } from "@aws-crypto/sha256-js";
7177
7216
  import { defaultProvider } from "@aws-sdk/credential-provider-node";
@@ -7188,7 +7227,7 @@ function safeParse6(json) {
7188
7227
  }
7189
7228
  var MantleAgent;
7190
7229
  var init_mantle_agent = __esm({
7191
- "packages/server/dist/agents/mantle-agent.js"() {
7230
+ "../server/dist/agents/mantle-agent.js"() {
7192
7231
  "use strict";
7193
7232
  init_config();
7194
7233
  init_agent_loop();
@@ -7407,10 +7446,10 @@ var init_mantle_agent = __esm({
7407
7446
  }
7408
7447
  });
7409
7448
 
7410
- // packages/server/dist/agents/anthropic-agent.js
7449
+ // ../server/dist/agents/anthropic-agent.js
7411
7450
  var AnthropicAgent;
7412
7451
  var init_anthropic_agent = __esm({
7413
- "packages/server/dist/agents/anthropic-agent.js"() {
7452
+ "../server/dist/agents/anthropic-agent.js"() {
7414
7453
  "use strict";
7415
7454
  init_config();
7416
7455
  init_agent_loop();
@@ -7533,7 +7572,7 @@ var init_anthropic_agent = __esm({
7533
7572
  }
7534
7573
  });
7535
7574
 
7536
- // packages/server/dist/agents/model-runtime.js
7575
+ // ../server/dist/agents/model-runtime.js
7537
7576
  function createModelRuntime(providerId, cfg) {
7538
7577
  switch (providerId) {
7539
7578
  case "aws-bedrock-claude-invoke":
@@ -7668,7 +7707,7 @@ function createModelRuntime(providerId, cfg) {
7668
7707
  }
7669
7708
  }
7670
7709
  var init_model_runtime = __esm({
7671
- "packages/server/dist/agents/model-runtime.js"() {
7710
+ "../server/dist/agents/model-runtime.js"() {
7672
7711
  "use strict";
7673
7712
  init_bedrock_agent();
7674
7713
  init_deepseek_agent();
@@ -7683,7 +7722,7 @@ var init_model_runtime = __esm({
7683
7722
  }
7684
7723
  });
7685
7724
 
7686
- // packages/server/dist/tools/sandbox.js
7725
+ // ../server/dist/tools/sandbox.js
7687
7726
  import { exec, execFile, spawn as spawn2 } from "node:child_process";
7688
7727
  import { promisify } from "node:util";
7689
7728
  import path20 from "node:path";
@@ -8158,7 +8197,7 @@ async function sandboxReaddir(dirPath, opts) {
8158
8197
  }
8159
8198
  var execAsync, execFileAsync, HOME, HALO_HOME3, GLOBAL_DIR, KILL_GRACE_MS, _bwrapAvailable, DEFAULT_HIDDEN_DIRS, DEFAULT_HIDDEN_FILES, WORKSPACE_HIDDEN_DIRS, WORKSPACE_HIDDEN_FILES, _hiddenDirs, _hiddenFiles, _writableDirs;
8160
8199
  var init_sandbox = __esm({
8161
- "packages/server/dist/tools/sandbox.js"() {
8200
+ "../server/dist/tools/sandbox.js"() {
8162
8201
  "use strict";
8163
8202
  execAsync = promisify(exec);
8164
8203
  execFileAsync = promisify(execFile);
@@ -8207,7 +8246,7 @@ var init_sandbox = __esm({
8207
8246
  }
8208
8247
  });
8209
8248
 
8210
- // packages/server/dist/tools/workspace-tools.js
8249
+ // ../server/dist/tools/workspace-tools.js
8211
8250
  import fs17 from "node:fs/promises";
8212
8251
  import path21 from "node:path";
8213
8252
  import crypto from "node:crypto";
@@ -8924,7 +8963,7 @@ function imageDimensions(buf, mediaType) {
8924
8963
  }
8925
8964
  var SKIP_DIRS, GLOB_MAX_RESULTS, HOME2, PARAMS_PATTERN, ENV_PATTERN3;
8926
8965
  var init_workspace_tools = __esm({
8927
- "packages/server/dist/tools/workspace-tools.js"() {
8966
+ "../server/dist/tools/workspace-tools.js"() {
8928
8967
  "use strict";
8929
8968
  init_config();
8930
8969
  init_sandbox();
@@ -8940,7 +8979,7 @@ var init_workspace_tools = __esm({
8940
8979
  }
8941
8980
  });
8942
8981
 
8943
- // packages/server/dist/tools/draft-tool.js
8982
+ // ../server/dist/tools/draft-tool.js
8944
8983
  function createDraftTool() {
8945
8984
  let drafts = 0;
8946
8985
  const tool = {
@@ -8975,7 +9014,7 @@ Error: draft requires non-empty \`content\` \u2014 put your full draft answer th
8975
9014
  }
8976
9015
  var MAX_DRAFTS, REVIEW_CHECKLIST;
8977
9016
  var init_draft_tool = __esm({
8978
- "packages/server/dist/tools/draft-tool.js"() {
9017
+ "../server/dist/tools/draft-tool.js"() {
8979
9018
  "use strict";
8980
9019
  init_agent_loop();
8981
9020
  MAX_DRAFTS = 3;
@@ -8989,7 +9028,7 @@ If the draft clears all three, write the final answer now. If not, fix it (gathe
8989
9028
  }
8990
9029
  });
8991
9030
 
8992
- // packages/server/dist/prompts/system-prompts.js
9031
+ // ../server/dist/prompts/system-prompts.js
8993
9032
  import fs18 from "node:fs/promises";
8994
9033
  import path22 from "node:path";
8995
9034
  import { homedir as homedir12 } from "node:os";
@@ -9075,17 +9114,17 @@ async function loadSystemPrompts(workspaceRoot) {
9075
9114
  }
9076
9115
  var GLOBAL_PROMPTS_DIR;
9077
9116
  var init_system_prompts = __esm({
9078
- "packages/server/dist/prompts/system-prompts.js"() {
9117
+ "../server/dist/prompts/system-prompts.js"() {
9079
9118
  "use strict";
9080
9119
  GLOBAL_PROMPTS_DIR = path22.join(homedir12(), ".halo", "global", "prompts");
9081
9120
  }
9082
9121
  });
9083
9122
 
9084
- // packages/server/dist/agents/session-agent-builder.js
9123
+ // ../server/dist/agents/session-agent-builder.js
9085
9124
  import path23 from "node:path";
9086
9125
  var SessionAgentBuilder;
9087
9126
  var init_session_agent_builder = __esm({
9088
- "packages/server/dist/agents/session-agent-builder.js"() {
9127
+ "../server/dist/agents/session-agent-builder.js"() {
9089
9128
  "use strict";
9090
9129
  init_model_runtime();
9091
9130
  init_workspace_tools();
@@ -9487,10 +9526,10 @@ do delegate, say so in one line and keep going.`;
9487
9526
  }
9488
9527
  });
9489
9528
 
9490
- // packages/server/dist/commands/registry.js
9529
+ // ../server/dist/commands/registry.js
9491
9530
  var CommandRegistry;
9492
9531
  var init_registry = __esm({
9493
- "packages/server/dist/commands/registry.js"() {
9532
+ "../server/dist/commands/registry.js"() {
9494
9533
  "use strict";
9495
9534
  CommandRegistry = class {
9496
9535
  descriptors = /* @__PURE__ */ new Map();
@@ -9504,13 +9543,13 @@ var init_registry = __esm({
9504
9543
  }
9505
9544
  });
9506
9545
 
9507
- // packages/server/dist/commands/index.js
9546
+ // ../server/dist/commands/index.js
9508
9547
  function builtinCommandNames() {
9509
9548
  return commandRegistry.listDescriptors().filter((d) => d.source === "builtin").map((d) => d.name);
9510
9549
  }
9511
9550
  var commandRegistry;
9512
9551
  var init_commands = __esm({
9513
- "packages/server/dist/commands/index.js"() {
9552
+ "../server/dist/commands/index.js"() {
9514
9553
  "use strict";
9515
9554
  init_registry();
9516
9555
  commandRegistry = new CommandRegistry();
@@ -9560,7 +9599,7 @@ var init_commands = __esm({
9560
9599
  }
9561
9600
  });
9562
9601
 
9563
- // packages/server/dist/channels/shared/i18n.js
9602
+ // ../server/dist/channels/shared/i18n.js
9564
9603
  function getLang(account) {
9565
9604
  const v = account.language;
9566
9605
  return v === "en" || v === "zh" ? v : "en";
@@ -9579,7 +9618,7 @@ function t(key, lang, params) {
9579
9618
  }
9580
9619
  var messages;
9581
9620
  var init_i18n = __esm({
9582
- "packages/server/dist/channels/shared/i18n.js"() {
9621
+ "../server/dist/channels/shared/i18n.js"() {
9583
9622
  "use strict";
9584
9623
  messages = {
9585
9624
  // ── /help ──
@@ -9748,7 +9787,7 @@ var init_i18n = __esm({
9748
9787
  }
9749
9788
  });
9750
9789
 
9751
- // packages/server/dist/commands/skill-command.js
9790
+ // ../server/dist/commands/skill-command.js
9752
9791
  import fs19 from "node:fs/promises";
9753
9792
  import path24 from "node:path";
9754
9793
  async function scanDir(dir) {
@@ -9890,7 +9929,7 @@ ${body}`;
9890
9929
  }
9891
9930
  var cachedEntries;
9892
9931
  var init_skill_command = __esm({
9893
- "packages/server/dist/commands/skill-command.js"() {
9932
+ "../server/dist/commands/skill-command.js"() {
9894
9933
  "use strict";
9895
9934
  init_commands();
9896
9935
  init_agent_loader();
@@ -9901,7 +9940,7 @@ var init_skill_command = __esm({
9901
9940
  }
9902
9941
  });
9903
9942
 
9904
- // packages/server/dist/agents/session-skill-commands.js
9943
+ // ../server/dist/agents/session-skill-commands.js
9905
9944
  import { eq as eq5 } from "drizzle-orm";
9906
9945
  function commandVisibilityGate(d) {
9907
9946
  if (!d.verbs || d.verbs.length === 0)
@@ -9918,7 +9957,7 @@ function commandVisibilityGate(d) {
9918
9957
  }
9919
9958
  var VIS_RANK, SessionSkillCommands;
9920
9959
  var init_session_skill_commands = __esm({
9921
- "packages/server/dist/agents/session-skill-commands.js"() {
9960
+ "../server/dist/agents/session-skill-commands.js"() {
9922
9961
  "use strict";
9923
9962
  init_db();
9924
9963
  init_schema();
@@ -9985,12 +10024,12 @@ var init_session_skill_commands = __esm({
9985
10024
  }
9986
10025
  });
9987
10026
 
9988
- // packages/server/dist/agents/session-state-store.js
10027
+ // ../server/dist/agents/session-state-store.js
9989
10028
  import fsSync6 from "node:fs";
9990
10029
  import path25 from "node:path";
9991
10030
  var SessionStateStore;
9992
10031
  var init_session_state_store = __esm({
9993
- "packages/server/dist/agents/session-state-store.js"() {
10032
+ "../server/dist/agents/session-state-store.js"() {
9994
10033
  "use strict";
9995
10034
  init_session_store();
9996
10035
  SessionStateStore = class {
@@ -10053,7 +10092,7 @@ var init_session_state_store = __esm({
10053
10092
  }
10054
10093
  });
10055
10094
 
10056
- // packages/server/dist/agents/session-manager.js
10095
+ // ../server/dist/agents/session-manager.js
10057
10096
  import fsSync7 from "node:fs";
10058
10097
  import path26 from "node:path";
10059
10098
  import { eq as eq6, and as and4, isNull as isNull3, isNotNull as isNotNull2 } from "drizzle-orm";
@@ -10134,7 +10173,7 @@ function generateSessionId() {
10134
10173
  }
10135
10174
  var SessionManager;
10136
10175
  var init_session_manager = __esm({
10137
- "packages/server/dist/agents/session-manager.js"() {
10176
+ "../server/dist/agents/session-manager.js"() {
10138
10177
  "use strict";
10139
10178
  init_md_loader();
10140
10179
  init_config();
@@ -10392,6 +10431,7 @@ var init_session_manager = __esm({
10392
10431
  draftReset,
10393
10432
  output: "",
10394
10433
  finalOutput: "",
10434
+ turnError: null,
10395
10435
  promise: null,
10396
10436
  abortController: null,
10397
10437
  messageQueue: [],
@@ -10695,6 +10735,13 @@ var init_session_manager = __esm({
10695
10735
  getCachedUIState(rootSessionId) {
10696
10736
  return this.uiStore.getCachedUIState(rootSessionId);
10697
10737
  }
10738
+ /** Whether a root's cached UIState holds local mutations not yet persisted.
10739
+ * The WS save paths gate on this — a clean state (pure disk seed, or
10740
+ * already flushed) must not be written back over a file that another
10741
+ * process (cron `halo cli` child) may have advanced since. */
10742
+ isUIStateDirty(rootSessionId) {
10743
+ return this.uiStore.isUIStateDirty(rootSessionId);
10744
+ }
10698
10745
  getUIState(rootSessionId) {
10699
10746
  return this.uiStore.getUIState(rootSessionId);
10700
10747
  }
@@ -10743,7 +10790,7 @@ var init_session_manager = __esm({
10743
10790
  session.output += event.text ?? "";
10744
10791
  if (event.final)
10745
10792
  session.finalOutput += event.text ?? "";
10746
- this.emitEvent(session.id, { type: "stream", text: event.text, agentName, agentId, taskId });
10793
+ this.emitEvent(session.id, { type: "stream", text: event.text, final: event.final, agentName, agentId, taskId });
10747
10794
  break;
10748
10795
  }
10749
10796
  case "thinking": {
@@ -10802,6 +10849,7 @@ var init_session_manager = __esm({
10802
10849
  const maxRetries = config.agent.maxRetries;
10803
10850
  session.output = "";
10804
10851
  session.finalOutput = "";
10852
+ session.turnError = null;
10805
10853
  for (let attempt = 0; attempt < maxRetries; attempt++) {
10806
10854
  session.abortController = new AbortController();
10807
10855
  const signal = session.abortController.signal;
@@ -10858,6 +10906,7 @@ var init_session_manager = __esm({
10858
10906
  if (msg.includes("insufficient balance") || msg.includes("suspended") || msg.includes("invalid api key") || msg.includes("Invalid API Key") || msg.includes("Unauthorized") || msg.includes("authentication")) {
10859
10907
  console.error(`[SessionManager] Session ${session.id} account error: ${msg}`);
10860
10908
  this.emitEvent(session.id, { type: "error", error: msg, agentName: session.agentName, taskId: session.parentId ? session.id : void 0 });
10909
+ session.turnError = msg;
10861
10910
  resultText = `Error: ${msg}`;
10862
10911
  break;
10863
10912
  }
@@ -10883,7 +10932,7 @@ var init_session_manager = __esm({
10883
10932
  continue;
10884
10933
  }
10885
10934
  }
10886
- if (msg === "fetch failed" || msg === "Model request timed out" || msg.includes("UND_ERR_HEADERS_TIMEOUT") || msg.includes("HeadersTimeoutError") || msg.includes("socket hang up") || msg.includes("ECONNRESET") || msg.includes("ECONNREFUSED") || msg.includes("ETIMEDOUT") || msg.includes("EAI_AGAIN")) {
10935
+ if (msg === "fetch failed" || msg === "Model request timed out" || msg.includes("http2 request did not get a response") || msg.includes("UND_ERR_HEADERS_TIMEOUT") || msg.includes("HeadersTimeoutError") || msg.includes("socket hang up") || msg.includes("ECONNRESET") || msg.includes("ECONNREFUSED") || msg.includes("ETIMEDOUT") || msg.includes("EAI_AGAIN")) {
10887
10936
  if (attempt + 1 < maxRetries) {
10888
10937
  const delay = 1e3 * Math.pow(2, attempt) + Math.random() * 500;
10889
10938
  console.debug(`[SessionManager] Session ${session.id} transient network error, retrying in ${Math.round(delay)}ms (attempt ${attempt + 1}/${maxRetries}): ${msg}`);
@@ -10926,6 +10975,7 @@ var init_session_manager = __esm({
10926
10975
  const errDetail = [errName, httpStatus ? `HTTP ${httpStatus}` : ""].filter(Boolean).join(" ");
10927
10976
  console.error(`[SessionManager] Session ${session.id} error (attempt ${attempt + 1}/${maxRetries})${errDetail ? ` [${errDetail}]` : ""}: ${msg}`);
10928
10977
  this.emitEvent(session.id, { type: "error", error: msg, agentName: session.agentName, taskId: session.parentId ? session.id : void 0 });
10978
+ session.turnError = errName ? `${errName}: ${msg}` : msg;
10929
10979
  resultText = `Error: ${errName ? `${errName}: ` : ""}${msg}`;
10930
10980
  break;
10931
10981
  }
@@ -10991,7 +11041,12 @@ var init_session_manager = __esm({
10991
11041
  return;
10992
11042
  }
10993
11043
  this.db.update(agentSessions).set({ stoppedAt: Date.now() }).where(eq6(agentSessions.id, session.id)).run();
10994
- const result = session.finalOutput || session.output || "(no output)";
11044
+ let result = session.finalOutput || session.output || "(no output)";
11045
+ if (session.turnError) {
11046
+ result = `[SUB-AGENT ABORTED: the last turn was terminated by an unrecoverable error, NOT completed. Error: ${session.turnError}. The text below is a partial trace of the aborted turn \u2014 do not treat it as a finished result. Re-dispatch with query_session("${session.id}", ...) to let it resume.]
11047
+
11048
+ ${result}`;
11049
+ }
10995
11050
  console.debug(`[SessionManager] Auto-report: ${session.id} \u2192 parent ${session.parentId} \u2014 result: ${result.slice(0, 150)}`);
10996
11051
  const reportCap = config.limits.autoReportMax;
10997
11052
  const truncatedReport = result.length > reportCap ? result.slice(0, reportCap) + `
@@ -12109,11 +12164,11 @@ ${q.text}` : q.text);
12109
12164
  }
12110
12165
  });
12111
12166
 
12112
- // packages/server/dist/agents/session-manager-registry.js
12167
+ // ../server/dist/agents/session-manager-registry.js
12113
12168
  import fs20 from "node:fs";
12114
12169
  var SessionManagerRegistry;
12115
12170
  var init_session_manager_registry = __esm({
12116
- "packages/server/dist/agents/session-manager-registry.js"() {
12171
+ "../server/dist/agents/session-manager-registry.js"() {
12117
12172
  "use strict";
12118
12173
  init_session_manager();
12119
12174
  init_init();
@@ -12168,7 +12223,7 @@ var init_session_manager_registry = __esm({
12168
12223
  }
12169
12224
  });
12170
12225
 
12171
- // packages/server/dist/logger.js
12226
+ // ../server/dist/logger.js
12172
12227
  import fs21 from "node:fs";
12173
12228
  import path27 from "node:path";
12174
12229
  import { homedir as homedir13 } from "node:os";
@@ -12268,7 +12323,7 @@ function initLogger() {
12268
12323
  }
12269
12324
  var LOG_FILENAME, logDir, logFile, currentSize, LEVEL_ORDER;
12270
12325
  var init_logger = __esm({
12271
- "packages/server/dist/logger.js"() {
12326
+ "../server/dist/logger.js"() {
12272
12327
  "use strict";
12273
12328
  init_config();
12274
12329
  LOG_FILENAME = "server.log";
@@ -12279,7 +12334,7 @@ var init_logger = __esm({
12279
12334
  }
12280
12335
  });
12281
12336
 
12282
- // packages/server/dist/channels/shared/commands.js
12337
+ // ../server/dist/channels/shared/commands.js
12283
12338
  import fs22 from "node:fs";
12284
12339
  import path28 from "node:path";
12285
12340
  import os from "node:os";
@@ -13005,7 +13060,7 @@ function execWsSwitch(ctx, arg) {
13005
13060
  }
13006
13061
  var ALIASES_FILE, aliasCache, CHANNEL_LIST_LIMIT, DISPATCH_COMMANDS, NOT_ROUTED, SUBCOMMAND_ROUTES, RANK;
13007
13062
  var init_commands2 = __esm({
13008
- "packages/server/dist/channels/shared/commands.js"() {
13063
+ "../server/dist/channels/shared/commands.js"() {
13009
13064
  "use strict";
13010
13065
  init_agent_loader();
13011
13066
  init_init();
@@ -13081,7 +13136,7 @@ var init_commands2 = __esm({
13081
13136
  }
13082
13137
  });
13083
13138
 
13084
- // packages/cli/src/harness.ts
13139
+ // src/harness.ts
13085
13140
  var harness_exports = {};
13086
13141
  __export(harness_exports, {
13087
13142
  createHarness: () => createHarness,
@@ -13322,7 +13377,7 @@ async function createHarness(opts) {
13322
13377
  }
13323
13378
  var SESSION_PREFIX, USER_ID;
13324
13379
  var init_harness = __esm({
13325
- "packages/cli/src/harness.ts"() {
13380
+ "src/harness.ts"() {
13326
13381
  "use strict";
13327
13382
  init_session_manager();
13328
13383
  init_session_manager_registry();
@@ -13339,7 +13394,7 @@ var init_harness = __esm({
13339
13394
  }
13340
13395
  });
13341
13396
 
13342
- // packages/server/dist/middleware/password-hash.js
13397
+ // ../server/dist/middleware/password-hash.js
13343
13398
  var password_hash_exports = {};
13344
13399
  __export(password_hash_exports, {
13345
13400
  generateJwtSecret: () => generateJwtSecret,
@@ -13389,7 +13444,7 @@ function generateJwtSecret() {
13389
13444
  }
13390
13445
  var scryptAsync, COST, KEY_LEN;
13391
13446
  var init_password_hash = __esm({
13392
- "packages/server/dist/middleware/password-hash.js"() {
13447
+ "../server/dist/middleware/password-hash.js"() {
13393
13448
  "use strict";
13394
13449
  scryptAsync = promisify2(crypto2.scrypt);
13395
13450
  COST = { N: 16384, r: 8, p: 1 };
@@ -13397,7 +13452,7 @@ var init_password_hash = __esm({
13397
13452
  }
13398
13453
  });
13399
13454
 
13400
- // packages/server/dist/setup-config.js
13455
+ // ../server/dist/setup-config.js
13401
13456
  var setup_config_exports = {};
13402
13457
  __export(setup_config_exports, {
13403
13458
  configLeafSet: () => configLeafSet,
@@ -13438,13 +13493,13 @@ function configLeafSet(dotPath) {
13438
13493
  }
13439
13494
  var CONFIG_PATH;
13440
13495
  var init_setup_config = __esm({
13441
- "packages/server/dist/setup-config.js"() {
13496
+ "../server/dist/setup-config.js"() {
13442
13497
  "use strict";
13443
13498
  CONFIG_PATH = path30.join(homedir14(), ".halo", "secrets", "config.yaml");
13444
13499
  }
13445
13500
  });
13446
13501
 
13447
- // packages/server/dist/setup-settings.js
13502
+ // ../server/dist/setup-settings.js
13448
13503
  var setup_settings_exports = {};
13449
13504
  __export(setup_settings_exports, {
13450
13505
  maskSecret: () => maskSecret,
@@ -13523,13 +13578,13 @@ function maskSecret(value) {
13523
13578
  }
13524
13579
  var SETTINGS_PATH2;
13525
13580
  var init_setup_settings = __esm({
13526
- "packages/server/dist/setup-settings.js"() {
13581
+ "../server/dist/setup-settings.js"() {
13527
13582
  "use strict";
13528
13583
  SETTINGS_PATH2 = path31.join(homedir15(), ".halo", "secrets", "settings.yaml");
13529
13584
  }
13530
13585
  });
13531
13586
 
13532
- // packages/server/dist/setup-providers.js
13587
+ // ../server/dist/setup-providers.js
13533
13588
  var setup_providers_exports = {};
13534
13589
  __export(setup_providers_exports, {
13535
13590
  AWS_CREDENTIAL_CHAIN_PROVIDER: () => AWS_CREDENTIAL_CHAIN_PROVIDER,
@@ -13735,7 +13790,7 @@ function listRequiredSkillsWithSecrets() {
13735
13790
  }
13736
13791
  var AWS_CREDENTIAL_CHAIN_PROVIDER, REBIND_BUILTIN_AGENT_IDS, GLOBAL_AGENTS_DIR3;
13737
13792
  var init_setup_providers = __esm({
13738
- "packages/server/dist/setup-providers.js"() {
13793
+ "../server/dist/setup-providers.js"() {
13739
13794
  "use strict";
13740
13795
  init_init();
13741
13796
  init_setup_settings();
@@ -13745,7 +13800,7 @@ var init_setup_providers = __esm({
13745
13800
  }
13746
13801
  });
13747
13802
 
13748
- // packages/cli/src/setup-bind-provider.ts
13803
+ // src/setup-bind-provider.ts
13749
13804
  var setup_bind_provider_exports = {};
13750
13805
  __export(setup_bind_provider_exports, {
13751
13806
  AWS_CHAIN_PROVIDER: () => AWS_CHAIN_PROVIDER,
@@ -13785,14 +13840,14 @@ function buildBindProviderPlan(configured, currentProvider, currentProviderHasKe
13785
13840
  }
13786
13841
  var AWS_CHAIN_PROVIDER, KEEP_CURRENT;
13787
13842
  var init_setup_bind_provider = __esm({
13788
- "packages/cli/src/setup-bind-provider.ts"() {
13843
+ "src/setup-bind-provider.ts"() {
13789
13844
  "use strict";
13790
13845
  AWS_CHAIN_PROVIDER = "aws-bedrock-claude-invoke";
13791
13846
  KEEP_CURRENT = "__keep__";
13792
13847
  }
13793
13848
  });
13794
13849
 
13795
- // packages/cli/src/setup-prompts.ts
13850
+ // src/setup-prompts.ts
13796
13851
  var setup_prompts_exports = {};
13797
13852
  __export(setup_prompts_exports, {
13798
13853
  promptMultiSelect: () => promptMultiSelect,
@@ -14078,12 +14133,12 @@ function promptMultiSelectRich(question, options) {
14078
14133
  });
14079
14134
  }
14080
14135
  var init_setup_prompts = __esm({
14081
- "packages/cli/src/setup-prompts.ts"() {
14136
+ "src/setup-prompts.ts"() {
14082
14137
  "use strict";
14083
14138
  }
14084
14139
  });
14085
14140
 
14086
- // packages/cli/src/upgrade-verify.ts
14141
+ // src/upgrade-verify.ts
14087
14142
  var upgrade_verify_exports = {};
14088
14143
  __export(upgrade_verify_exports, {
14089
14144
  ALLOW_SCRIPTS: () => ALLOW_SCRIPTS,
@@ -14108,7 +14163,7 @@ function verifyNativeModules(pkgRoot) {
14108
14163
  }
14109
14164
  var NATIVE_MODULE_SMOKES, ALLOW_SCRIPTS;
14110
14165
  var init_upgrade_verify = __esm({
14111
- "packages/cli/src/upgrade-verify.ts"() {
14166
+ "src/upgrade-verify.ts"() {
14112
14167
  "use strict";
14113
14168
  NATIVE_MODULE_SMOKES = [
14114
14169
  { name: "better-sqlite3", smoke: "new (require(process.argv[1]))(':memory:')" },
@@ -14118,7 +14173,7 @@ var init_upgrade_verify = __esm({
14118
14173
  }
14119
14174
  });
14120
14175
 
14121
- // packages/cli/src/render-md.ts
14176
+ // src/render-md.ts
14122
14177
  import { marked } from "marked";
14123
14178
  import { markedTerminal } from "marked-terminal";
14124
14179
  function renderMarkdown(text5) {
@@ -14126,14 +14181,14 @@ function renderMarkdown(text5) {
14126
14181
  return rendered.replace(/\n{3,}/g, "\n\n").trimEnd();
14127
14182
  }
14128
14183
  var init_render_md = __esm({
14129
- "packages/cli/src/render-md.ts"() {
14184
+ "src/render-md.ts"() {
14130
14185
  "use strict";
14131
14186
  marked.use(markedTerminal({ reflowText: true, width: Math.min(process.stdout.columns || 80, 120) }));
14132
14187
  marked.use({ breaks: true });
14133
14188
  }
14134
14189
  });
14135
14190
 
14136
- // packages/cli/src/resolve-refs.ts
14191
+ // src/resolve-refs.ts
14137
14192
  import fs28 from "node:fs";
14138
14193
  import path34 from "node:path";
14139
14194
  function resolveRefs(input, workspace) {
@@ -14212,7 +14267,7 @@ ${content}
14212
14267
  }
14213
14268
  var MAX_FILE_BYTES, MAX_IMAGE_BYTES, REF_PATTERN;
14214
14269
  var init_resolve_refs = __esm({
14215
- "packages/cli/src/resolve-refs.ts"() {
14270
+ "src/resolve-refs.ts"() {
14216
14271
  "use strict";
14217
14272
  init_dist();
14218
14273
  MAX_FILE_BYTES = 100 * 1024;
@@ -14221,7 +14276,7 @@ var init_resolve_refs = __esm({
14221
14276
  }
14222
14277
  });
14223
14278
 
14224
- // packages/cli/src/format-usage.ts
14279
+ // src/format-usage.ts
14225
14280
  function fmtK(n) {
14226
14281
  return `${(n / 1e3).toFixed(1)}K`;
14227
14282
  }
@@ -14265,7 +14320,7 @@ function formatUsageLine(event) {
14265
14320
  }
14266
14321
  var ANSI;
14267
14322
  var init_format_usage = __esm({
14268
- "packages/cli/src/format-usage.ts"() {
14323
+ "src/format-usage.ts"() {
14269
14324
  "use strict";
14270
14325
  ANSI = {
14271
14326
  reset: "\x1B[0m",
@@ -14279,7 +14334,7 @@ var init_format_usage = __esm({
14279
14334
  }
14280
14335
  });
14281
14336
 
14282
- // packages/cli/src/tui/components/banner.tsx
14337
+ // src/tui/components/banner.tsx
14283
14338
  import { Box, Text } from "ink";
14284
14339
  import { jsx } from "react/jsx-runtime";
14285
14340
  function Banner() {
@@ -14287,7 +14342,7 @@ function Banner() {
14287
14342
  }
14288
14343
  var LINES, COLORS;
14289
14344
  var init_banner = __esm({
14290
- "packages/cli/src/tui/components/banner.tsx"() {
14345
+ "src/tui/components/banner.tsx"() {
14291
14346
  "use strict";
14292
14347
  LINES = [
14293
14348
  " \u2588\u2588\u2557 \u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2557 ",
@@ -14301,7 +14356,7 @@ var init_banner = __esm({
14301
14356
  }
14302
14357
  });
14303
14358
 
14304
- // packages/cli/src/tui/components/messages.tsx
14359
+ // src/tui/components/messages.tsx
14305
14360
  import { Box as Box2, Static, Text as Text2 } from "ink";
14306
14361
  import { jsx as jsx2, jsxs } from "react/jsx-runtime";
14307
14362
  function Messages({ blocks }) {
@@ -14359,7 +14414,7 @@ function Block({ block }) {
14359
14414
  }
14360
14415
  var BANNER_ID;
14361
14416
  var init_messages = __esm({
14362
- "packages/cli/src/tui/components/messages.tsx"() {
14417
+ "src/tui/components/messages.tsx"() {
14363
14418
  "use strict";
14364
14419
  init_format_usage();
14365
14420
  init_banner();
@@ -14367,7 +14422,7 @@ var init_messages = __esm({
14367
14422
  }
14368
14423
  });
14369
14424
 
14370
- // packages/cli/src/tui/terminal-text.ts
14425
+ // src/tui/terminal-text.ts
14371
14426
  function sanitizeToolOutput(s) {
14372
14427
  return s.replace(ESCAPE_SEQ_RE, "").replace(/\r\n?/g, "\n").replace(/\t/g, " ").replace(C0_RE, "");
14373
14428
  }
@@ -14397,14 +14452,14 @@ function tailByRows(text5, cols, maxRows) {
14397
14452
  }
14398
14453
  var ESCAPE_SEQ_RE, C0_RE;
14399
14454
  var init_terminal_text = __esm({
14400
- "packages/cli/src/tui/terminal-text.ts"() {
14455
+ "src/tui/terminal-text.ts"() {
14401
14456
  "use strict";
14402
14457
  ESCAPE_SEQ_RE = /\x1b\][^\x07\n]*\x07|\x1b\[[0-9;?]*[ -/]*[@-~]|\x1b[@-Z\\-_]/g;
14403
14458
  C0_RE = /[\x00-\x09\x0b-\x1f\x7f]/g;
14404
14459
  }
14405
14460
  });
14406
14461
 
14407
- // packages/cli/src/tui/components/streaming.tsx
14462
+ // src/tui/components/streaming.tsx
14408
14463
  import { useEffect, useState } from "react";
14409
14464
  import { Box as Box3, Text as Text3, useStdout } from "ink";
14410
14465
  import Spinner from "ink-spinner";
@@ -14457,13 +14512,13 @@ function Streaming({ spinnerLabel, liveText, liveThinking, activeSubs, turnStart
14457
14512
  ] });
14458
14513
  }
14459
14514
  var init_streaming = __esm({
14460
- "packages/cli/src/tui/components/streaming.tsx"() {
14515
+ "src/tui/components/streaming.tsx"() {
14461
14516
  "use strict";
14462
14517
  init_terminal_text();
14463
14518
  }
14464
14519
  });
14465
14520
 
14466
- // packages/cli/src/tui/history.ts
14521
+ // src/tui/history.ts
14467
14522
  import fs29 from "node:fs";
14468
14523
  import path35 from "node:path";
14469
14524
  import os2 from "node:os";
@@ -14489,14 +14544,14 @@ function appendHistory(entry) {
14489
14544
  }
14490
14545
  var HISTORY_FILE, MAX_ENTRIES;
14491
14546
  var init_history = __esm({
14492
- "packages/cli/src/tui/history.ts"() {
14547
+ "src/tui/history.ts"() {
14493
14548
  "use strict";
14494
14549
  HISTORY_FILE = path35.join(os2.homedir(), ".halo", "global", "tui-history.json");
14495
14550
  MAX_ENTRIES = 100;
14496
14551
  }
14497
14552
  });
14498
14553
 
14499
- // packages/cli/src/tui/components/status-bar.tsx
14554
+ // src/tui/components/status-bar.tsx
14500
14555
  import { Box as Box4, Text as Text4 } from "ink";
14501
14556
  import { Fragment, jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
14502
14557
  function shortModel(modelId) {
@@ -14532,12 +14587,12 @@ function StatusBar({ agentName, modelId, contextPercent, workspace, sessionId, v
14532
14587
  ] });
14533
14588
  }
14534
14589
  var init_status_bar = __esm({
14535
- "packages/cli/src/tui/components/status-bar.tsx"() {
14590
+ "src/tui/components/status-bar.tsx"() {
14536
14591
  "use strict";
14537
14592
  }
14538
14593
  });
14539
14594
 
14540
- // packages/cli/src/tui/components/slash-suggest.tsx
14595
+ // src/tui/components/slash-suggest.tsx
14541
14596
  import { Box as Box5, Text as Text5 } from "ink";
14542
14597
  import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
14543
14598
  function SlashSuggest({ items, selectedIdx, maxWidth = 80 }) {
@@ -14564,12 +14619,12 @@ function SlashSuggest({ items, selectedIdx, maxWidth = 80 }) {
14564
14619
  ] });
14565
14620
  }
14566
14621
  var init_slash_suggest = __esm({
14567
- "packages/cli/src/tui/components/slash-suggest.tsx"() {
14622
+ "src/tui/components/slash-suggest.tsx"() {
14568
14623
  "use strict";
14569
14624
  }
14570
14625
  });
14571
14626
 
14572
- // packages/cli/src/tui/components/path-suggest.tsx
14627
+ // src/tui/components/path-suggest.tsx
14573
14628
  import { Box as Box6, Text as Text6 } from "ink";
14574
14629
  import { jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
14575
14630
  function PathSuggest({ items, selectedIdx, cwdLabel }) {
@@ -14596,12 +14651,12 @@ function PathSuggest({ items, selectedIdx, cwdLabel }) {
14596
14651
  ] });
14597
14652
  }
14598
14653
  var init_path_suggest = __esm({
14599
- "packages/cli/src/tui/components/path-suggest.tsx"() {
14654
+ "src/tui/components/path-suggest.tsx"() {
14600
14655
  "use strict";
14601
14656
  }
14602
14657
  });
14603
14658
 
14604
- // packages/cli/src/tui/path-suggest-engine.ts
14659
+ // src/tui/path-suggest-engine.ts
14605
14660
  import fs30 from "node:fs";
14606
14661
  import path36 from "node:path";
14607
14662
  function detectActiveRef(value) {
@@ -14687,13 +14742,13 @@ function applyPathPick(value, ref, pick) {
14687
14742
  return `${before}@${kind} ${path66}`;
14688
14743
  }
14689
14744
  var init_path_suggest_engine = __esm({
14690
- "packages/cli/src/tui/path-suggest-engine.ts"() {
14745
+ "src/tui/path-suggest-engine.ts"() {
14691
14746
  "use strict";
14692
14747
  init_dist();
14693
14748
  }
14694
14749
  });
14695
14750
 
14696
- // packages/cli/src/tui/line-editor.ts
14751
+ // src/tui/line-editor.ts
14697
14752
  function toGraphemes(s) {
14698
14753
  if (s === "") return [];
14699
14754
  return [...segmenter.segment(s)].map((seg) => seg.segment);
@@ -14747,13 +14802,13 @@ function deleteToEnd(e) {
14747
14802
  }
14748
14803
  var segmenter;
14749
14804
  var init_line_editor = __esm({
14750
- "packages/cli/src/tui/line-editor.ts"() {
14805
+ "src/tui/line-editor.ts"() {
14751
14806
  "use strict";
14752
14807
  segmenter = new Intl.Segmenter();
14753
14808
  }
14754
14809
  });
14755
14810
 
14756
- // packages/cli/src/tui/components/text-input.tsx
14811
+ // src/tui/components/text-input.tsx
14757
14812
  import { Text as Text7 } from "ink";
14758
14813
  import { jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
14759
14814
  function TextInputView({ value, cursor, placeholder }) {
@@ -14778,13 +14833,13 @@ function TextInputView({ value, cursor, placeholder }) {
14778
14833
  ] });
14779
14834
  }
14780
14835
  var init_text_input = __esm({
14781
- "packages/cli/src/tui/components/text-input.tsx"() {
14836
+ "src/tui/components/text-input.tsx"() {
14782
14837
  "use strict";
14783
14838
  init_line_editor();
14784
14839
  }
14785
14840
  });
14786
14841
 
14787
- // packages/cli/src/tui/components/input-box.tsx
14842
+ // src/tui/components/input-box.tsx
14788
14843
  import { useState as useState2, useEffect as useEffect2, useMemo, useRef } from "react";
14789
14844
  import { Box as Box7, Text as Text8, useInput, usePaste } from "ink";
14790
14845
  import { jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
@@ -15035,7 +15090,7 @@ function InputBox({ enabled, placeholder, history, onSubmit, hint, commands = []
15035
15090
  ] });
15036
15091
  }
15037
15092
  var init_input_box = __esm({
15038
- "packages/cli/src/tui/components/input-box.tsx"() {
15093
+ "src/tui/components/input-box.tsx"() {
15039
15094
  "use strict";
15040
15095
  init_slash_suggest();
15041
15096
  init_path_suggest();
@@ -15045,7 +15100,7 @@ var init_input_box = __esm({
15045
15100
  }
15046
15101
  });
15047
15102
 
15048
- // packages/cli/src/tui/components/log-navigator.tsx
15103
+ // src/tui/components/log-navigator.tsx
15049
15104
  import { useState as useState3, useMemo as useMemo2, useEffect as useEffect3 } from "react";
15050
15105
  import { Box as Box8, Text as Text9, useInput as useInput2 } from "ink";
15051
15106
  import { jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
@@ -15124,12 +15179,12 @@ function LogNavigator({ tree, onPick, onCancel }) {
15124
15179
  ] });
15125
15180
  }
15126
15181
  var init_log_navigator = __esm({
15127
- "packages/cli/src/tui/components/log-navigator.tsx"() {
15182
+ "src/tui/components/log-navigator.tsx"() {
15128
15183
  "use strict";
15129
15184
  }
15130
15185
  });
15131
15186
 
15132
- // packages/cli/src/tui/components/log-viewer.tsx
15187
+ // src/tui/components/log-viewer.tsx
15133
15188
  import { useState as useState4, useMemo as useMemo3, useEffect as useEffect4, useRef as useRef2 } from "react";
15134
15189
  import { Box as Box9, Text as Text10, useInput as useInput3, useStdout as useStdout2 } from "ink";
15135
15190
  import { jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
@@ -15202,12 +15257,12 @@ function LogViewer({ title, lines, live, onClose }) {
15202
15257
  ] });
15203
15258
  }
15204
15259
  var init_log_viewer = __esm({
15205
- "packages/cli/src/tui/components/log-viewer.tsx"() {
15260
+ "src/tui/components/log-viewer.tsx"() {
15206
15261
  "use strict";
15207
15262
  }
15208
15263
  });
15209
15264
 
15210
- // packages/cli/src/tui/app.tsx
15265
+ // src/tui/app.tsx
15211
15266
  import { useEffect as useEffect5, useMemo as useMemo4, useReducer, useState as useState5, useRef as useRef3 } from "react";
15212
15267
  import { Box as Box10, useApp, useInput as useInput4 } from "ink";
15213
15268
  import { jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
@@ -15917,7 +15972,7 @@ ${lines.join("\n")}` });
15917
15972
  }
15918
15973
  var MAX_CONTEXT_TOKENS_FALLBACK, blockSeq, ANSI2;
15919
15974
  var init_app = __esm({
15920
- "packages/cli/src/tui/app.tsx"() {
15975
+ "src/tui/app.tsx"() {
15921
15976
  "use strict";
15922
15977
  init_render_md();
15923
15978
  init_resolve_refs();
@@ -15945,7 +16000,7 @@ var init_app = __esm({
15945
16000
  }
15946
16001
  });
15947
16002
 
15948
- // packages/cli/src/tui.tsx
16003
+ // src/tui.tsx
15949
16004
  var tui_exports = {};
15950
16005
  __export(tui_exports, {
15951
16006
  runTui: () => runTui
@@ -15960,13 +16015,13 @@ async function runTui(harness, opts = {}) {
15960
16015
  await instance.waitUntilExit();
15961
16016
  }
15962
16017
  var init_tui = __esm({
15963
- "packages/cli/src/tui.tsx"() {
16018
+ "src/tui.tsx"() {
15964
16019
  "use strict";
15965
16020
  init_app();
15966
16021
  }
15967
16022
  });
15968
16023
 
15969
- // packages/cli/src/cli.ts
16024
+ // src/cli.ts
15970
16025
  var cli_exports = {};
15971
16026
  __export(cli_exports, {
15972
16027
  runCli: () => runCli
@@ -15996,12 +16051,12 @@ async function runCli(harness, message, opts) {
15996
16051
  }
15997
16052
  const resolvedMessage = ref.text;
15998
16053
  const resolvedImages = ref.images.length > 0 ? ref.images : void 0;
15999
- const chunks = [];
16054
+ let turnFinal = "";
16055
+ let turnAll = "";
16000
16056
  const toolCalls = [];
16001
16057
  let errorText = "";
16002
16058
  let usage = null;
16003
16059
  let lastToolName = "";
16004
- let hadOutput = false;
16005
16060
  let hadMeta = false;
16006
16061
  const agentNames = /* @__PURE__ */ new Map();
16007
16062
  let spinnerTimer = null;
@@ -16056,16 +16111,20 @@ async function runCli(harness, message, opts) {
16056
16111
  process.stderr.write("\n");
16057
16112
  hadMeta = false;
16058
16113
  }
16059
- if (event.taskId) {
16060
- if (opts.verbose) process.stderr.write(`${tag}\x1B[2m${event.text}\x1B[0m
16114
+ if (opts.verbose) process.stderr.write(`${tag}\x1B[2m${event.text}\x1B[0m
16061
16115
  `);
16062
- } else {
16063
- if (opts.format === "text") process.stdout.write(renderMarkdown(event.text) + "\n");
16064
- chunks.push(event.text);
16065
- hadOutput = true;
16116
+ if (!event.taskId) {
16117
+ turnAll += event.text;
16118
+ if (event.final) turnFinal += event.text;
16066
16119
  }
16067
16120
  }
16068
16121
  break;
16122
+ case "queued_message":
16123
+ if (!event.taskId) {
16124
+ turnFinal = "";
16125
+ turnAll = "";
16126
+ }
16127
+ break;
16069
16128
  case "thinking":
16070
16129
  if (opts.verbose && event.text) {
16071
16130
  stopSpinner();
@@ -16103,10 +16162,6 @@ async function runCli(harness, message, opts) {
16103
16162
  usage = event;
16104
16163
  if (opts.verbose) {
16105
16164
  stopSpinner();
16106
- if (hadOutput) {
16107
- process.stdout.write("\n");
16108
- hadOutput = false;
16109
- }
16110
16165
  process.stderr.write(`
16111
16166
  ${tag}${formatUsageLine(event)}
16112
16167
  `);
@@ -16126,13 +16181,15 @@ ${tag}${formatUsageLine(event)}
16126
16181
  }
16127
16182
  }
16128
16183
  stopSpinner();
16184
+ const answer = turnFinal || turnAll;
16129
16185
  if (opts.format === "text") {
16130
- if (chunks.length > 0 && !chunks[chunks.length - 1].endsWith("\n")) {
16131
- process.stdout.write("\n");
16186
+ if (answer) {
16187
+ const out = process.stdout.isTTY ? renderMarkdown(answer) : answer;
16188
+ process.stdout.write(out.endsWith("\n") ? out : out + "\n");
16132
16189
  }
16133
16190
  } else {
16134
16191
  const result = {
16135
- text: chunks.join(""),
16192
+ text: answer,
16136
16193
  sessionId: harness.sessionId,
16137
16194
  toolCalls,
16138
16195
  usage: usage ? {
@@ -16148,7 +16205,7 @@ ${tag}${formatUsageLine(event)}
16148
16205
  return errorText ? 1 : 0;
16149
16206
  }
16150
16207
  var init_cli = __esm({
16151
- "packages/cli/src/cli.ts"() {
16208
+ "src/cli.ts"() {
16152
16209
  "use strict";
16153
16210
  init_render_md();
16154
16211
  init_resolve_refs();
@@ -16156,7 +16213,7 @@ var init_cli = __esm({
16156
16213
  }
16157
16214
  });
16158
16215
 
16159
- // packages/server/dist/channels/shared/media.js
16216
+ // ../server/dist/channels/shared/media.js
16160
16217
  import path37 from "node:path";
16161
16218
  import os3 from "node:os";
16162
16219
  function tempDir() {
@@ -16197,7 +16254,7 @@ function classifyMedia(filePath) {
16197
16254
  }
16198
16255
  var MEDIA_MARKER_RE, VIDEO_EXTS, VOICE_EXTS;
16199
16256
  var init_media = __esm({
16200
- "packages/server/dist/channels/shared/media.js"() {
16257
+ "../server/dist/channels/shared/media.js"() {
16201
16258
  "use strict";
16202
16259
  init_dist();
16203
16260
  MEDIA_MARKER_RE = /^MEDIA:\s*(\S.*?)\s*$/gm;
@@ -16206,7 +16263,7 @@ var init_media = __esm({
16206
16263
  }
16207
16264
  });
16208
16265
 
16209
- // packages/server/dist/routes/workspace-path.js
16266
+ // ../server/dist/routes/workspace-path.js
16210
16267
  import fs31 from "node:fs/promises";
16211
16268
  import { existsSync as existsSync2, realpathSync as realpathSync3 } from "node:fs";
16212
16269
  import path38 from "node:path";
@@ -16250,12 +16307,12 @@ function isSafeIdSegment(id) {
16250
16307
  return /^[\w.:>\u4e00-\u9fff-]+$/.test(id);
16251
16308
  }
16252
16309
  var init_workspace_path = __esm({
16253
- "packages/server/dist/routes/workspace-path.js"() {
16310
+ "../server/dist/routes/workspace-path.js"() {
16254
16311
  "use strict";
16255
16312
  }
16256
16313
  });
16257
16314
 
16258
- // packages/server/dist/routes/files.js
16315
+ // ../server/dist/routes/files.js
16259
16316
  import { Hono } from "hono";
16260
16317
  import fs32 from "node:fs/promises";
16261
16318
  import { createReadStream } from "node:fs";
@@ -16795,7 +16852,7 @@ function createFileRoutes() {
16795
16852
  return app2;
16796
16853
  }
16797
16854
  var init_files = __esm({
16798
- "packages/server/dist/routes/files.js"() {
16855
+ "../server/dist/routes/files.js"() {
16799
16856
  "use strict";
16800
16857
  init_dist();
16801
16858
  init_media();
@@ -16803,7 +16860,7 @@ var init_files = __esm({
16803
16860
  }
16804
16861
  });
16805
16862
 
16806
- // packages/server/dist/routes/data-preview.js
16863
+ // ../server/dist/routes/data-preview.js
16807
16864
  import { Hono as Hono2 } from "hono";
16808
16865
  import fs33 from "node:fs/promises";
16809
16866
  import { createReadStream as createReadStream2 } from "node:fs";
@@ -17028,7 +17085,7 @@ function createDataPreviewRoutes() {
17028
17085
  }
17029
17086
  var DEFAULT_LIMIT, MAX_LIMIT, MAX_ROW_CHARS, QUOTE, CR, LF, COMMA, SEMI, TAB, CsvScanner;
17030
17087
  var init_data_preview = __esm({
17031
- "packages/server/dist/routes/data-preview.js"() {
17088
+ "../server/dist/routes/data-preview.js"() {
17032
17089
  "use strict";
17033
17090
  init_workspace_path();
17034
17091
  DEFAULT_LIMIT = 100;
@@ -17129,7 +17186,7 @@ var init_data_preview = __esm({
17129
17186
  }
17130
17187
  });
17131
17188
 
17132
- // packages/server/dist/git-credentials.js
17189
+ // ../server/dist/git-credentials.js
17133
17190
  import fs34 from "node:fs";
17134
17191
  import path41 from "node:path";
17135
17192
  import { homedir as homedir18 } from "node:os";
@@ -17204,13 +17261,13 @@ function deleteGitCredential(host) {
17204
17261
  }
17205
17262
  var GIT_CREDENTIALS_PATH;
17206
17263
  var init_git_credentials = __esm({
17207
- "packages/server/dist/git-credentials.js"() {
17264
+ "../server/dist/git-credentials.js"() {
17208
17265
  "use strict";
17209
17266
  GIT_CREDENTIALS_PATH = path41.join(homedir18(), ".git-credentials");
17210
17267
  }
17211
17268
  });
17212
17269
 
17213
- // packages/server/dist/git-ssh.js
17270
+ // ../server/dist/git-ssh.js
17214
17271
  import fs35 from "node:fs";
17215
17272
  import os4 from "node:os";
17216
17273
  import path42 from "node:path";
@@ -17387,7 +17444,7 @@ function getRemoteProtocol(projectRoot) {
17387
17444
  }
17388
17445
  var SSH_DIR, NON_KEY_NAMES, ownedAgentPid, ASKPASS_SCRIPT;
17389
17446
  var init_git_ssh = __esm({
17390
- "packages/server/dist/git-ssh.js"() {
17447
+ "../server/dist/git-ssh.js"() {
17391
17448
  "use strict";
17392
17449
  SSH_DIR = path42.join(os4.homedir(), ".ssh");
17393
17450
  NON_KEY_NAMES = /* @__PURE__ */ new Set(["known_hosts", "known_hosts2", "authorized_keys", "config"]);
@@ -17400,7 +17457,7 @@ printf '%s\\n' "$HALO_SSH_PASSPHRASE"
17400
17457
  }
17401
17458
  });
17402
17459
 
17403
- // packages/server/dist/routes/git.js
17460
+ // ../server/dist/routes/git.js
17404
17461
  import { Hono as Hono3 } from "hono";
17405
17462
  import os5 from "node:os";
17406
17463
  import path43 from "node:path";
@@ -17766,7 +17823,7 @@ function createGitRoutes() {
17766
17823
  return app2;
17767
17824
  }
17768
17825
  var init_git = __esm({
17769
- "packages/server/dist/routes/git.js"() {
17826
+ "../server/dist/routes/git.js"() {
17770
17827
  "use strict";
17771
17828
  init_dist();
17772
17829
  init_workspace_path();
@@ -17776,7 +17833,7 @@ var init_git = __esm({
17776
17833
  }
17777
17834
  });
17778
17835
 
17779
- // packages/server/dist/routes/mtime-cache.js
17836
+ // ../server/dist/routes/mtime-cache.js
17780
17837
  function createMtimeCache() {
17781
17838
  const entries = /* @__PURE__ */ new Map();
17782
17839
  return {
@@ -17791,12 +17848,12 @@ function createMtimeCache() {
17791
17848
  };
17792
17849
  }
17793
17850
  var init_mtime_cache = __esm({
17794
- "packages/server/dist/routes/mtime-cache.js"() {
17851
+ "../server/dist/routes/mtime-cache.js"() {
17795
17852
  "use strict";
17796
17853
  }
17797
17854
  });
17798
17855
 
17799
- // packages/server/dist/routes/agent-configs.js
17856
+ // ../server/dist/routes/agent-configs.js
17800
17857
  import { Hono as Hono4 } from "hono";
17801
17858
  import fs36 from "node:fs/promises";
17802
17859
  import path44 from "node:path";
@@ -18311,7 +18368,7 @@ ${body.description ?? ""}
18311
18368
  }
18312
18369
  var _cachedTools, GLOBAL_AGENTS_DIR4, FALLBACK_SCAFFOLD_PROVIDER, _yamlCache;
18313
18370
  var init_agent_configs = __esm({
18314
- "packages/server/dist/routes/agent-configs.js"() {
18371
+ "../server/dist/routes/agent-configs.js"() {
18315
18372
  "use strict";
18316
18373
  init_workspace_tools();
18317
18374
  init_draft_tool();
@@ -18327,7 +18384,7 @@ var init_agent_configs = __esm({
18327
18384
  }
18328
18385
  });
18329
18386
 
18330
- // packages/server/dist/routes/skills.js
18387
+ // ../server/dist/routes/skills.js
18331
18388
  import { Hono as Hono5 } from "hono";
18332
18389
  import fs37 from "node:fs/promises";
18333
18390
  import path45 from "node:path";
@@ -18522,7 +18579,7 @@ function createSkillRoutes() {
18522
18579
  }
18523
18580
  var GLOBAL_SETTINGS_PATH, _skillMdCache;
18524
18581
  var init_skills = __esm({
18525
- "packages/server/dist/routes/skills.js"() {
18582
+ "../server/dist/routes/skills.js"() {
18526
18583
  "use strict";
18527
18584
  init_agent_loader();
18528
18585
  init_db();
@@ -18533,7 +18590,7 @@ var init_skills = __esm({
18533
18590
  }
18534
18591
  });
18535
18592
 
18536
- // packages/server/dist/routes/settings.js
18593
+ // ../server/dist/routes/settings.js
18537
18594
  import { Hono as Hono6 } from "hono";
18538
18595
  import fs38 from "node:fs/promises";
18539
18596
  import path46 from "node:path";
@@ -18802,7 +18859,7 @@ function createSettingsRoutes() {
18802
18859
  }
18803
18860
  var GLOBAL_SETTINGS_PATH2, _changeListeners;
18804
18861
  var init_settings = __esm({
18805
- "packages/server/dist/routes/settings.js"() {
18862
+ "../server/dist/routes/settings.js"() {
18806
18863
  "use strict";
18807
18864
  init_settings_schema();
18808
18865
  init_workspace_path();
@@ -18811,7 +18868,7 @@ var init_settings = __esm({
18811
18868
  }
18812
18869
  });
18813
18870
 
18814
- // packages/server/dist/evolution/archive.js
18871
+ // ../server/dist/evolution/archive.js
18815
18872
  import fs39 from "node:fs";
18816
18873
  import path47 from "node:path";
18817
18874
  import { pipeline } from "node:stream/promises";
@@ -18978,7 +19035,7 @@ function stopArchiveDaemon() {
18978
19035
  }
18979
19036
  var TERMINAL_RUN_STATUSES, TERMINAL_APPLY_STATUSES, DAY_MS, ARCHIVE_AFTER_MS, PURGE_AFTER_MS, _archiveTimer, _startupTimer;
18980
19037
  var init_archive = __esm({
18981
- "packages/server/dist/evolution/archive.js"() {
19038
+ "../server/dist/evolution/archive.js"() {
18982
19039
  "use strict";
18983
19040
  init_evo_db();
18984
19041
  init_paths();
@@ -18992,7 +19049,7 @@ var init_archive = __esm({
18992
19049
  }
18993
19050
  });
18994
19051
 
18995
- // packages/server/dist/db/raw-sqlite.js
19052
+ // ../server/dist/db/raw-sqlite.js
18996
19053
  function rawSqlite(db) {
18997
19054
  const withClient = db;
18998
19055
  const client = withClient.$client ?? withClient.session?.client;
@@ -19001,12 +19058,12 @@ function rawSqlite(db) {
19001
19058
  return client;
19002
19059
  }
19003
19060
  var init_raw_sqlite = __esm({
19004
- "packages/server/dist/db/raw-sqlite.js"() {
19061
+ "../server/dist/db/raw-sqlite.js"() {
19005
19062
  "use strict";
19006
19063
  }
19007
19064
  });
19008
19065
 
19009
- // packages/server/dist/routes/evolution.js
19066
+ // ../server/dist/routes/evolution.js
19010
19067
  import { Hono as Hono7 } from "hono";
19011
19068
  import { eq as eq8, desc as desc2, lt as lt3, and as and6, or, sql } from "drizzle-orm";
19012
19069
  import fs40 from "node:fs/promises";
@@ -19264,7 +19321,7 @@ function extractText(content) {
19264
19321
  }
19265
19322
  var UNDELETABLE_RUN_STATUSES;
19266
19323
  var init_evolution = __esm({
19267
- "packages/server/dist/routes/evolution.js"() {
19324
+ "../server/dist/routes/evolution.js"() {
19268
19325
  "use strict";
19269
19326
  init_evo_db();
19270
19327
  init_archive();
@@ -19275,7 +19332,7 @@ var init_evolution = __esm({
19275
19332
  }
19276
19333
  });
19277
19334
 
19278
- // packages/server/dist/routes/sessions.js
19335
+ // ../server/dist/routes/sessions.js
19279
19336
  import { Hono as Hono8 } from "hono";
19280
19337
  import { eq as eq9 } from "drizzle-orm";
19281
19338
  function rawId() {
@@ -19532,7 +19589,7 @@ function createSessionRoutes(smRegistry) {
19532
19589
  }
19533
19590
  var msgCounter2;
19534
19591
  var init_sessions = __esm({
19535
- "packages/server/dist/routes/sessions.js"() {
19592
+ "../server/dist/routes/sessions.js"() {
19536
19593
  "use strict";
19537
19594
  init_db();
19538
19595
  init_schema();
@@ -19543,7 +19600,7 @@ var init_sessions = __esm({
19543
19600
  }
19544
19601
  });
19545
19602
 
19546
- // packages/server/dist/routes/session-archive.js
19603
+ // ../server/dist/routes/session-archive.js
19547
19604
  import { Hono as Hono9 } from "hono";
19548
19605
  function createSessionArchiveRoutes(smRegistry) {
19549
19606
  const app2 = new Hono9();
@@ -19576,7 +19633,7 @@ function createSessionArchiveRoutes(smRegistry) {
19576
19633
  return app2;
19577
19634
  }
19578
19635
  var init_session_archive2 = __esm({
19579
- "packages/server/dist/routes/session-archive.js"() {
19636
+ "../server/dist/routes/session-archive.js"() {
19580
19637
  "use strict";
19581
19638
  init_db();
19582
19639
  init_session_store();
@@ -19585,7 +19642,7 @@ var init_session_archive2 = __esm({
19585
19642
  }
19586
19643
  });
19587
19644
 
19588
- // packages/server/dist/db/channel-db.js
19645
+ // ../server/dist/db/channel-db.js
19589
19646
  import Database4 from "better-sqlite3";
19590
19647
  import { drizzle as drizzle3 } from "drizzle-orm/better-sqlite3";
19591
19648
  import { sqliteTable as sqliteTable3, text as text3, integer as integer3 } from "drizzle-orm/sqlite-core";
@@ -19610,7 +19667,7 @@ function getChannelDb() {
19610
19667
  }
19611
19668
  var channelAccounts, CREATE_SQL2, _channelDb;
19612
19669
  var init_channel_db = __esm({
19613
- "packages/server/dist/db/channel-db.js"() {
19670
+ "../server/dist/db/channel-db.js"() {
19614
19671
  "use strict";
19615
19672
  channelAccounts = sqliteTable3("channel_accounts", {
19616
19673
  accountId: text3("account_id").primaryKey(),
@@ -19643,7 +19700,7 @@ CREATE INDEX IF NOT EXISTS idx_channel_accounts_type ON channel_accounts(channel
19643
19700
  }
19644
19701
  });
19645
19702
 
19646
- // packages/server/dist/channels/shared/accounts.js
19703
+ // ../server/dist/channels/shared/accounts.js
19647
19704
  import fs42 from "node:fs";
19648
19705
  import path50 from "node:path";
19649
19706
  import { eq as eq10, and as and7 } from "drizzle-orm";
@@ -19751,7 +19808,7 @@ function deleteAccount(db, accountId) {
19751
19808
  }
19752
19809
  var ACCOUNT_ACCESS_LEVELS, CHAT_ACCESS_LEVELS, _lastActiveChatCache;
19753
19810
  var init_accounts = __esm({
19754
- "packages/server/dist/channels/shared/accounts.js"() {
19811
+ "../server/dist/channels/shared/accounts.js"() {
19755
19812
  "use strict";
19756
19813
  init_channel_db();
19757
19814
  init_init();
@@ -19761,7 +19818,7 @@ var init_accounts = __esm({
19761
19818
  }
19762
19819
  });
19763
19820
 
19764
- // packages/server/dist/channels/web/accounts.js
19821
+ // ../server/dist/channels/web/accounts.js
19765
19822
  function toWeb(a) {
19766
19823
  const c = a.config;
19767
19824
  return {
@@ -19824,14 +19881,14 @@ function deleteAccount2(db, accountId) {
19824
19881
  }
19825
19882
  var CH;
19826
19883
  var init_accounts2 = __esm({
19827
- "packages/server/dist/channels/web/accounts.js"() {
19884
+ "../server/dist/channels/web/accounts.js"() {
19828
19885
  "use strict";
19829
19886
  init_accounts();
19830
19887
  CH = "web";
19831
19888
  }
19832
19889
  });
19833
19890
 
19834
- // packages/server/dist/middleware/brute-force.js
19891
+ // ../server/dist/middleware/brute-force.js
19835
19892
  import { getConnInfo } from "@hono/node-server/conninfo";
19836
19893
  function bucket(name) {
19837
19894
  let b = buckets.get(name);
@@ -19882,7 +19939,7 @@ function clearFailures(bucketName, ip) {
19882
19939
  }
19883
19940
  var MAX_ATTEMPTS, LOCKOUT_MS, buckets;
19884
19941
  var init_brute_force = __esm({
19885
- "packages/server/dist/middleware/brute-force.js"() {
19942
+ "../server/dist/middleware/brute-force.js"() {
19886
19943
  "use strict";
19887
19944
  init_config();
19888
19945
  MAX_ATTEMPTS = 5;
@@ -19891,7 +19948,7 @@ var init_brute_force = __esm({
19891
19948
  }
19892
19949
  });
19893
19950
 
19894
- // packages/server/dist/middleware/web-token.js
19951
+ // ../server/dist/middleware/web-token.js
19895
19952
  function resolveTokenAuth(c, db) {
19896
19953
  const ip = getClientIp(c);
19897
19954
  if (isLockedOut(TOKEN_BUCKET, ip))
@@ -19913,7 +19970,7 @@ function tokenAuthJsonError(c, reason) {
19913
19970
  }
19914
19971
  var TOKEN_BUCKET, TOKEN_AUTH_STATUS, JSON_ERROR;
19915
19972
  var init_web_token = __esm({
19916
- "packages/server/dist/middleware/web-token.js"() {
19973
+ "../server/dist/middleware/web-token.js"() {
19917
19974
  "use strict";
19918
19975
  init_accounts2();
19919
19976
  init_brute_force();
@@ -19931,7 +19988,7 @@ var init_web_token = __esm({
19931
19988
  }
19932
19989
  });
19933
19990
 
19934
- // packages/server/dist/sessions/session-types.js
19991
+ // ../server/dist/sessions/session-types.js
19935
19992
  function messageToolCalls(msg) {
19936
19993
  if (msg.contentBlocks) {
19937
19994
  return msg.contentBlocks.filter((b) => b.type === "tool_call").map((b) => b.toolCall);
@@ -19956,12 +20013,12 @@ function inferMessageType(msg) {
19956
20013
  return "notification";
19957
20014
  }
19958
20015
  var init_session_types = __esm({
19959
- "packages/server/dist/sessions/session-types.js"() {
20016
+ "../server/dist/sessions/session-types.js"() {
19960
20017
  "use strict";
19961
20018
  }
19962
20019
  });
19963
20020
 
19964
- // packages/server/dist/routes/halo-city.js
20021
+ // ../server/dist/routes/halo-city.js
19965
20022
  import { Hono as Hono10 } from "hono";
19966
20023
  import fs43 from "node:fs";
19967
20024
  import path51 from "node:path";
@@ -20348,7 +20405,7 @@ function createShowRoutes(registry2) {
20348
20405
  }
20349
20406
  var SESSIONS_PER_WS, _skillCache, _metaCache, _roReaders, SESSION_LOG_MAX_MSGS, _birthCache;
20350
20407
  var init_halo_city = __esm({
20351
- "packages/server/dist/routes/halo-city.js"() {
20408
+ "../server/dist/routes/halo-city.js"() {
20352
20409
  "use strict";
20353
20410
  init_channel_db();
20354
20411
  init_web_token();
@@ -20365,7 +20422,7 @@ var init_halo_city = __esm({
20365
20422
  }
20366
20423
  });
20367
20424
 
20368
- // packages/server/dist/routes/metrics.js
20425
+ // ../server/dist/routes/metrics.js
20369
20426
  import { Hono as Hono11 } from "hono";
20370
20427
  function family(name, type, help, samples) {
20371
20428
  const lines = [`# HELP ${name} ${help}`, `# TYPE ${name} ${type}`];
@@ -20444,7 +20501,7 @@ function createMetricsRoutes(registry2) {
20444
20501
  }
20445
20502
  var TEXT_ERROR, SESSIONS_PER_WS2;
20446
20503
  var init_metrics = __esm({
20447
- "packages/server/dist/routes/metrics.js"() {
20504
+ "../server/dist/routes/metrics.js"() {
20448
20505
  "use strict";
20449
20506
  init_channel_db();
20450
20507
  init_web_token();
@@ -20458,7 +20515,7 @@ var init_metrics = __esm({
20458
20515
  }
20459
20516
  });
20460
20517
 
20461
- // packages/server/dist/routes/commands.js
20518
+ // ../server/dist/routes/commands.js
20462
20519
  import { Hono as Hono12 } from "hono";
20463
20520
  function createCommandRoutes(registry2, smRegistry) {
20464
20521
  const app2 = new Hono12();
@@ -20483,12 +20540,12 @@ function createCommandRoutes(registry2, smRegistry) {
20483
20540
  return app2;
20484
20541
  }
20485
20542
  var init_commands3 = __esm({
20486
- "packages/server/dist/routes/commands.js"() {
20543
+ "../server/dist/routes/commands.js"() {
20487
20544
  "use strict";
20488
20545
  }
20489
20546
  });
20490
20547
 
20491
- // packages/server/dist/routes/agentcore.js
20548
+ // ../server/dist/routes/agentcore.js
20492
20549
  import { Hono as Hono13 } from "hono";
20493
20550
  import path52 from "node:path";
20494
20551
  import fs44 from "node:fs";
@@ -20837,7 +20894,7 @@ ${fullText}`, images.length > 0 ? images : void 0);
20837
20894
  }
20838
20895
  var SESSION_HEADER, MAX_IMAGES_PER_MESSAGE, MAX_IMAGE_BASE64_LENGTH, MAX_PENDING_UPLOADS, MAX_CHUNKS_PER_UPLOAD, activeOverrides;
20839
20896
  var init_agentcore = __esm({
20840
- "packages/server/dist/routes/agentcore.js"() {
20897
+ "../server/dist/routes/agentcore.js"() {
20841
20898
  "use strict";
20842
20899
  init_commands2();
20843
20900
  init_ui_log_builder();
@@ -20852,7 +20909,7 @@ var init_agentcore = __esm({
20852
20909
  }
20853
20910
  });
20854
20911
 
20855
- // packages/server/dist/ws/file-watcher.js
20912
+ // ../server/dist/ws/file-watcher.js
20856
20913
  import fs45 from "node:fs";
20857
20914
  import path53 from "node:path";
20858
20915
  function enqueueNativeOp(op) {
@@ -20874,7 +20931,7 @@ function isUnwatchablePath(absPath) {
20874
20931
  }
20875
20932
  var IGNORED_SEGMENTS, IS_WIN32, IGNORED_SEGMENT_SET, NATIVE_IGNORE, nativeOpChain, WorkspaceWatcher;
20876
20933
  var init_file_watcher = __esm({
20877
- "packages/server/dist/ws/file-watcher.js"() {
20934
+ "../server/dist/ws/file-watcher.js"() {
20878
20935
  "use strict";
20879
20936
  IGNORED_SEGMENTS = [
20880
20937
  // VCS
@@ -21096,12 +21153,12 @@ var init_file_watcher = __esm({
21096
21153
  }
21097
21154
  });
21098
21155
 
21099
- // packages/server/dist/ws/git-dir-watcher.js
21156
+ // ../server/dist/ws/git-dir-watcher.js
21100
21157
  import fs46 from "node:fs";
21101
21158
  import path54 from "node:path";
21102
21159
  var GitDirWatcher;
21103
21160
  var init_git_dir_watcher = __esm({
21104
- "packages/server/dist/ws/git-dir-watcher.js"() {
21161
+ "../server/dist/ws/git-dir-watcher.js"() {
21105
21162
  "use strict";
21106
21163
  GitDirWatcher = class {
21107
21164
  watcher = null;
@@ -21220,7 +21277,7 @@ var init_git_dir_watcher = __esm({
21220
21277
  }
21221
21278
  });
21222
21279
 
21223
- // packages/server/dist/ws/event-processor.js
21280
+ // ../server/dist/ws/event-processor.js
21224
21281
  function sendJson(ws, data) {
21225
21282
  if (ws.readyState === ws.OPEN) {
21226
21283
  try {
@@ -21319,13 +21376,13 @@ function bufferDetachedNotification(event, pendingEvents) {
21319
21376
  }
21320
21377
  }
21321
21378
  var init_event_processor = __esm({
21322
- "packages/server/dist/ws/event-processor.js"() {
21379
+ "../server/dist/ws/event-processor.js"() {
21323
21380
  "use strict";
21324
21381
  init_ui_log_builder();
21325
21382
  }
21326
21383
  });
21327
21384
 
21328
- // packages/server/dist/ws/terminal-manager.js
21385
+ // ../server/dist/ws/terminal-manager.js
21329
21386
  import { homedir as homedir22 } from "node:os";
21330
21387
  import { basename } from "node:path";
21331
21388
  import { createRequire } from "node:module";
@@ -21356,7 +21413,7 @@ function attachListenersOnce(t2) {
21356
21413
  }
21357
21414
  var requireFromHere, ptyModule, TERMINAL_GRACE_MS, terminals, TerminalManager;
21358
21415
  var init_terminal_manager = __esm({
21359
- "packages/server/dist/ws/terminal-manager.js"() {
21416
+ "../server/dist/ws/terminal-manager.js"() {
21360
21417
  "use strict";
21361
21418
  init_config();
21362
21419
  init_event_processor();
@@ -21503,7 +21560,7 @@ var init_terminal_manager = __esm({
21503
21560
  }
21504
21561
  });
21505
21562
 
21506
- // packages/server/dist/ws/handler.js
21563
+ // ../server/dist/ws/handler.js
21507
21564
  import path55 from "node:path";
21508
21565
  function setupWebSocketHandler(deps) {
21509
21566
  const { wss: wss2, registry: registry2 } = deps;
@@ -21552,6 +21609,8 @@ function setupWebSocketHandler(deps) {
21552
21609
  const state = getState(client);
21553
21610
  if (!state)
21554
21611
  return;
21612
+ if (!client.sessionManager.isUIStateDirty(client.sessionId))
21613
+ return;
21555
21614
  const projectPath = resolveProjectPath2(client.projectId);
21556
21615
  const snapshot = createSaveSnapshot(state);
21557
21616
  if (snapshot.length === 0)
@@ -22129,7 +22188,7 @@ ${msg.message}` : markers.join("\n");
22129
22188
  }
22130
22189
  var CLIENT_SILENCE_LIMIT_MS, detachedSessions;
22131
22190
  var init_handler = __esm({
22132
- "packages/server/dist/ws/handler.js"() {
22191
+ "../server/dist/ws/handler.js"() {
22133
22192
  "use strict";
22134
22193
  init_ui_log_builder();
22135
22194
  init_config();
@@ -22148,7 +22207,7 @@ var init_handler = __esm({
22148
22207
  }
22149
22208
  });
22150
22209
 
22151
- // packages/server/dist/db/cron-db.js
22210
+ // ../server/dist/db/cron-db.js
22152
22211
  import Database6 from "better-sqlite3";
22153
22212
  import { drizzle as drizzle4 } from "drizzle-orm/better-sqlite3";
22154
22213
  import { sqliteTable as sqliteTable4, text as text4, integer as integer4 } from "drizzle-orm/sqlite-core";
@@ -22183,7 +22242,7 @@ function getCronDb() {
22183
22242
  }
22184
22243
  var cronJobs, cronRuns, CREATE_SQL3, _cronDb;
22185
22244
  var init_cron_db = __esm({
22186
- "packages/server/dist/db/cron-db.js"() {
22245
+ "../server/dist/db/cron-db.js"() {
22187
22246
  "use strict";
22188
22247
  cronJobs = sqliteTable4("cron_jobs", {
22189
22248
  id: text4("id").primaryKey(),
@@ -22293,7 +22352,7 @@ CREATE INDEX IF NOT EXISTS idx_cron_runs_status ON cron_runs(status);
22293
22352
  }
22294
22353
  });
22295
22354
 
22296
- // packages/server/dist/cron/dispatcher.js
22355
+ // ../server/dist/cron/dispatcher.js
22297
22356
  function registerCronDispatcher(d) {
22298
22357
  _registry.set(d.channelType, d);
22299
22358
  }
@@ -22340,14 +22399,14 @@ async function dispatchToTargets(rawText, targets, workspacePath) {
22340
22399
  }
22341
22400
  var _registry;
22342
22401
  var init_dispatcher = __esm({
22343
- "packages/server/dist/cron/dispatcher.js"() {
22402
+ "../server/dist/cron/dispatcher.js"() {
22344
22403
  "use strict";
22345
22404
  init_media();
22346
22405
  _registry = /* @__PURE__ */ new Map();
22347
22406
  }
22348
22407
  });
22349
22408
 
22350
- // packages/server/dist/child-env.js
22409
+ // ../server/dist/child-env.js
22351
22410
  function cleanChildEnv() {
22352
22411
  const env = { ...process.env };
22353
22412
  delete env.HALO_PASSWORD;
@@ -22355,12 +22414,12 @@ function cleanChildEnv() {
22355
22414
  return env;
22356
22415
  }
22357
22416
  var init_child_env = __esm({
22358
- "packages/server/dist/child-env.js"() {
22417
+ "../server/dist/child-env.js"() {
22359
22418
  "use strict";
22360
22419
  }
22361
22420
  });
22362
22421
 
22363
- // packages/server/dist/cron/runner.js
22422
+ // ../server/dist/cron/runner.js
22364
22423
  import { spawn as spawn3, execFileSync } from "node:child_process";
22365
22424
  import fs48 from "node:fs";
22366
22425
  import path57 from "node:path";
@@ -22885,7 +22944,7 @@ function pruneOldLogs() {
22885
22944
  }
22886
22945
  var DAY_MS2, CLI_TIMEOUT_SEC, KILL_GRACE_SEC, RUNS_PER_JOB_KEEP, LOG_RETENTION_DAYS, _active, _inflight, _fingerprint, _daemonTimers, _lastCronDataVersion;
22887
22946
  var init_runner = __esm({
22888
- "packages/server/dist/cron/runner.js"() {
22947
+ "../server/dist/cron/runner.js"() {
22889
22948
  "use strict";
22890
22949
  init_cron_db();
22891
22950
  init_raw_sqlite();
@@ -22905,7 +22964,7 @@ var init_runner = __esm({
22905
22964
  }
22906
22965
  });
22907
22966
 
22908
- // packages/server/dist/routes/cron.js
22967
+ // ../server/dist/routes/cron.js
22909
22968
  import { Hono as Hono14 } from "hono";
22910
22969
  import { eq as eq12, desc as desc3, lt as lt5, and as and8 } from "drizzle-orm";
22911
22970
  import fs49 from "node:fs/promises";
@@ -23177,7 +23236,7 @@ function computeNextRun(j) {
23177
23236
  }
23178
23237
  var TIMEOUT_SEC_MIN, TIMEOUT_SEC_MAX;
23179
23238
  var init_cron = __esm({
23180
- "packages/server/dist/routes/cron.js"() {
23239
+ "../server/dist/routes/cron.js"() {
23181
23240
  "use strict";
23182
23241
  init_cron_db();
23183
23242
  init_runner();
@@ -23188,7 +23247,7 @@ var init_cron = __esm({
23188
23247
  }
23189
23248
  });
23190
23249
 
23191
- // packages/server/dist/evolution/ticker.js
23250
+ // ../server/dist/evolution/ticker.js
23192
23251
  import { eq as eq13, and as and9, or as or2, asc, isNull as isNull5, sql as sql2 } from "drizzle-orm";
23193
23252
  function setEvoSpawner(fn) {
23194
23253
  _spawner = fn;
@@ -23414,7 +23473,7 @@ function claimApply(id) {
23414
23473
  }
23415
23474
  var _lastRunStatus, _lastApplyStatus, _spawner, TICK_INTERVAL_MS, _interval, _startupTimer2;
23416
23475
  var init_ticker = __esm({
23417
- "packages/server/dist/evolution/ticker.js"() {
23476
+ "../server/dist/evolution/ticker.js"() {
23418
23477
  "use strict";
23419
23478
  init_config();
23420
23479
  init_evo_db();
@@ -23430,13 +23489,13 @@ var init_ticker = __esm({
23430
23489
  }
23431
23490
  });
23432
23491
 
23433
- // packages/server/dist/evolution/spawn.js
23492
+ // ../server/dist/evolution/spawn.js
23434
23493
  import path58 from "node:path";
23435
23494
  import { spawn as spawn4 } from "node:child_process";
23436
23495
  import { fileURLToPath as fileURLToPath2 } from "node:url";
23437
23496
  var __dirname2, WRAPPER_PATH, realEvoSpawner;
23438
23497
  var init_spawn = __esm({
23439
- "packages/server/dist/evolution/spawn.js"() {
23498
+ "../server/dist/evolution/spawn.js"() {
23440
23499
  "use strict";
23441
23500
  init_child_env();
23442
23501
  __dirname2 = path58.dirname(fileURLToPath2(import.meta.url));
@@ -23458,7 +23517,7 @@ var init_spawn = __esm({
23458
23517
  }
23459
23518
  });
23460
23519
 
23461
- // packages/server/dist/channels/registry.js
23520
+ // ../server/dist/channels/registry.js
23462
23521
  function bootChannels(app2, descriptors, deps) {
23463
23522
  for (const d of descriptors) {
23464
23523
  if (d.registerCronDispatcher)
@@ -23483,13 +23542,13 @@ async function shutdownChannels() {
23483
23542
  }
23484
23543
  var _running;
23485
23544
  var init_registry2 = __esm({
23486
- "packages/server/dist/channels/registry.js"() {
23545
+ "../server/dist/channels/registry.js"() {
23487
23546
  "use strict";
23488
23547
  _running = [];
23489
23548
  }
23490
23549
  });
23491
23550
 
23492
- // packages/server/dist/channels/telegram/accounts.js
23551
+ // ../server/dist/channels/telegram/accounts.js
23493
23552
  function toTelegram(a) {
23494
23553
  const c = a.config;
23495
23554
  return {
@@ -23563,18 +23622,40 @@ function deleteAccount3(db, accountId) {
23563
23622
  }
23564
23623
  var CH2;
23565
23624
  var init_accounts3 = __esm({
23566
- "packages/server/dist/channels/telegram/accounts.js"() {
23625
+ "../server/dist/channels/telegram/accounts.js"() {
23567
23626
  "use strict";
23568
23627
  init_accounts();
23569
23628
  CH2 = "telegram";
23570
23629
  }
23571
23630
  });
23572
23631
 
23573
- // packages/server/dist/channels/telegram/event-adapter.js
23632
+ // ../server/dist/channels/shared/chunk.js
23633
+ function splitText(text5, limit) {
23634
+ const out = [];
23635
+ let rest = text5;
23636
+ while (rest.length > limit) {
23637
+ const window = rest.slice(0, limit);
23638
+ const lastPara = window.lastIndexOf("\n\n");
23639
+ const cut = lastPara > limit / 2 ? lastPara + 2 : limit;
23640
+ out.push(rest.slice(0, cut));
23641
+ rest = rest.slice(cut).trimStart();
23642
+ }
23643
+ if (rest)
23644
+ out.push(rest);
23645
+ return out;
23646
+ }
23647
+ var init_chunk = __esm({
23648
+ "../server/dist/channels/shared/chunk.js"() {
23649
+ "use strict";
23650
+ }
23651
+ });
23652
+
23653
+ // ../server/dist/channels/telegram/event-adapter.js
23574
23654
  var HARD_CHARS, TelegramResponder;
23575
23655
  var init_event_adapter = __esm({
23576
- "packages/server/dist/channels/telegram/event-adapter.js"() {
23656
+ "../server/dist/channels/telegram/event-adapter.js"() {
23577
23657
  "use strict";
23658
+ init_chunk();
23578
23659
  init_media();
23579
23660
  HARD_CHARS = 4e3;
23580
23661
  TelegramResponder = class {
@@ -23591,7 +23672,7 @@ var init_event_adapter = __esm({
23591
23672
  return;
23592
23673
  switch (event.type) {
23593
23674
  case "stream":
23594
- if (event.text)
23675
+ if (event.final && event.text)
23595
23676
  this.append(event.text);
23596
23677
  break;
23597
23678
  case "error":
@@ -23619,34 +23700,20 @@ var init_event_adapter = __esm({
23619
23700
  }
23620
23701
  append(text5) {
23621
23702
  this.buffer += text5;
23622
- while (this.buffer.length >= HARD_CHARS) {
23623
- const cut = this.findSplitPoint(this.buffer, HARD_CHARS);
23624
- const chunk = this.buffer.slice(0, cut);
23625
- this.buffer = this.buffer.slice(cut).trimStart();
23703
+ if (this.buffer.length <= HARD_CHARS)
23704
+ return;
23705
+ const chunks = splitText(this.buffer, HARD_CHARS);
23706
+ this.buffer = chunks.pop() ?? "";
23707
+ for (const chunk of chunks)
23626
23708
  void this.dispatchChunk(chunk);
23627
- }
23628
23709
  }
23629
23710
  flushAll() {
23630
23711
  if (!this.buffer)
23631
23712
  return;
23632
- while (this.buffer.length > HARD_CHARS) {
23633
- const cut = this.findSplitPoint(this.buffer, HARD_CHARS);
23634
- const chunk = this.buffer.slice(0, cut);
23635
- this.buffer = this.buffer.slice(cut).trimStart();
23713
+ const chunks = splitText(this.buffer, HARD_CHARS);
23714
+ this.buffer = "";
23715
+ for (const chunk of chunks)
23636
23716
  void this.dispatchChunk(chunk);
23637
- }
23638
- if (this.buffer) {
23639
- const text5 = this.buffer;
23640
- this.buffer = "";
23641
- void this.dispatchChunk(text5);
23642
- }
23643
- }
23644
- findSplitPoint(text5, limit) {
23645
- const window = text5.slice(0, limit);
23646
- const lastPara = window.lastIndexOf("\n\n");
23647
- if (lastPara > limit / 2)
23648
- return lastPara + 2;
23649
- return limit;
23650
23717
  }
23651
23718
  async dispatchChunk(chunk) {
23652
23719
  const { text: text5, mediaPaths } = extractMediaMessage(chunk);
@@ -23669,7 +23736,7 @@ var init_event_adapter = __esm({
23669
23736
  }
23670
23737
  });
23671
23738
 
23672
- // packages/server/dist/channels/shared/busy-hint.js
23739
+ // ../server/dist/channels/shared/busy-hint.js
23673
23740
  function busyHint(sm, sessionId, lang) {
23674
23741
  if (sm.isSessionCompacting(sessionId))
23675
23742
  return t("handler.compacting", lang);
@@ -23678,13 +23745,13 @@ function busyHint(sm, sessionId, lang) {
23678
23745
  return null;
23679
23746
  }
23680
23747
  var init_busy_hint = __esm({
23681
- "packages/server/dist/channels/shared/busy-hint.js"() {
23748
+ "../server/dist/channels/shared/busy-hint.js"() {
23682
23749
  "use strict";
23683
23750
  init_i18n();
23684
23751
  }
23685
23752
  });
23686
23753
 
23687
- // packages/server/dist/channels/shared/inbound.js
23754
+ // ../server/dist/channels/shared/inbound.js
23688
23755
  function sessionAccess(accountAccessLevel) {
23689
23756
  return accountAccessLevel === "full" ? null : accountAccessLevel === "workspace" ? "workspace" : "readonly";
23690
23757
  }
@@ -23742,7 +23809,7 @@ async function dispatchChannelCommand(ctx, command, arg, opts) {
23742
23809
  }
23743
23810
  var InboundBridge;
23744
23811
  var init_inbound = __esm({
23745
- "packages/server/dist/channels/shared/inbound.js"() {
23812
+ "../server/dist/channels/shared/inbound.js"() {
23746
23813
  "use strict";
23747
23814
  init_goal_mode();
23748
23815
  init_accounts();
@@ -23812,17 +23879,17 @@ var init_inbound = __esm({
23812
23879
  }
23813
23880
  });
23814
23881
 
23815
- // packages/server/dist/channels/shared/session-prefix.js
23882
+ // ../server/dist/channels/shared/session-prefix.js
23816
23883
  function sessionPrefix(channel, userId) {
23817
23884
  return `${channel}_${userId}_`;
23818
23885
  }
23819
23886
  var init_session_prefix = __esm({
23820
- "packages/server/dist/channels/shared/session-prefix.js"() {
23887
+ "../server/dist/channels/shared/session-prefix.js"() {
23821
23888
  "use strict";
23822
23889
  }
23823
23890
  });
23824
23891
 
23825
- // packages/server/dist/channels/telegram/handler.js
23892
+ // ../server/dist/channels/telegram/handler.js
23826
23893
  import { Bot, InputFile } from "grammy";
23827
23894
  function inferMediaKind(filePath) {
23828
23895
  const cls = classifyMedia(filePath);
@@ -24209,7 +24276,7 @@ async function handleUserMessage(args) {
24209
24276
  }
24210
24277
  var MAX_TG_DOWNLOAD_BYTES;
24211
24278
  var init_handler2 = __esm({
24212
- "packages/server/dist/channels/telegram/handler.js"() {
24279
+ "../server/dist/channels/telegram/handler.js"() {
24213
24280
  "use strict";
24214
24281
  init_accounts3();
24215
24282
  init_event_adapter();
@@ -24224,7 +24291,7 @@ var init_handler2 = __esm({
24224
24291
  }
24225
24292
  });
24226
24293
 
24227
- // packages/server/dist/routes/telegram.js
24294
+ // ../server/dist/routes/telegram.js
24228
24295
  import { Hono as Hono15 } from "hono";
24229
24296
  import { Bot as Bot2 } from "grammy";
24230
24297
  import fs50 from "node:fs";
@@ -24343,14 +24410,14 @@ function createTelegramRoutes(deps) {
24343
24410
  return app2;
24344
24411
  }
24345
24412
  var init_telegram = __esm({
24346
- "packages/server/dist/routes/telegram.js"() {
24413
+ "../server/dist/routes/telegram.js"() {
24347
24414
  "use strict";
24348
24415
  init_accounts3();
24349
24416
  init_accounts();
24350
24417
  }
24351
24418
  });
24352
24419
 
24353
- // packages/server/dist/channels/telegram/cron-dispatcher.js
24420
+ // ../server/dist/channels/telegram/cron-dispatcher.js
24354
24421
  import { Bot as Bot3 } from "grammy";
24355
24422
  async function dispatch(accountId, text5, explicitChatId) {
24356
24423
  const acct = getAccount3(getChannelDb(), accountId);
@@ -24399,7 +24466,7 @@ function registerTelegramCronDispatcher() {
24399
24466
  registerCronDispatcher({ channelType: "telegram", dispatch, listTargets });
24400
24467
  }
24401
24468
  var init_cron_dispatcher = __esm({
24402
- "packages/server/dist/channels/telegram/cron-dispatcher.js"() {
24469
+ "../server/dist/channels/telegram/cron-dispatcher.js"() {
24403
24470
  "use strict";
24404
24471
  init_channel_db();
24405
24472
  init_accounts3();
@@ -24407,10 +24474,10 @@ var init_cron_dispatcher = __esm({
24407
24474
  }
24408
24475
  });
24409
24476
 
24410
- // packages/server/dist/channels/telegram/descriptor.js
24477
+ // ../server/dist/channels/telegram/descriptor.js
24411
24478
  var telegramDescriptor;
24412
24479
  var init_descriptor = __esm({
24413
- "packages/server/dist/channels/telegram/descriptor.js"() {
24480
+ "../server/dist/channels/telegram/descriptor.js"() {
24414
24481
  "use strict";
24415
24482
  init_handler2();
24416
24483
  init_telegram();
@@ -24425,7 +24492,7 @@ var init_descriptor = __esm({
24425
24492
  }
24426
24493
  });
24427
24494
 
24428
- // packages/server/dist/channels/wechat/api.js
24495
+ // ../server/dist/channels/wechat/api.js
24429
24496
  import crypto3 from "node:crypto";
24430
24497
  function buildClientVersion(version) {
24431
24498
  const [ma, mi, pa] = version.split(".").map((p) => parseInt(p, 10));
@@ -24570,7 +24637,7 @@ async function sendMessage(params) {
24570
24637
  try {
24571
24638
  const parsed = JSON.parse(raw);
24572
24639
  if (parsed.ret !== void 0 && parsed.ret !== 0 || parsed.errcode !== void 0 && parsed.errcode !== 0) {
24573
- const hint = parsed.ret === -2 ? " (target user has never messaged this bot \u2014 they must send any message first)" : "";
24640
+ const hint = parsed.ret === -2 ? " (gateway rejected the message \u2014 payload too large (>16KB observed) or the target user has no recent inbound message with this bot)" : "";
24574
24641
  throw new Error(`[wechat:sendmessage] gateway error ret=${parsed.ret} errcode=${parsed.errcode} ${parsed.errmsg ?? ""}${hint}`);
24575
24642
  }
24576
24643
  } catch (err) {
@@ -24614,7 +24681,7 @@ async function notifyStop(params) {
24614
24681
  }
24615
24682
  var QR_BASE_URL, DEFAULT_BOT_TYPE, CHANNEL_VERSION, ILINK_APP_ID, ILINK_APP_CLIENT_VERSION, DEFAULT_LONG_POLL_TIMEOUT_MS, DEFAULT_API_TIMEOUT_MS;
24616
24683
  var init_api = __esm({
24617
- "packages/server/dist/channels/wechat/api.js"() {
24684
+ "../server/dist/channels/wechat/api.js"() {
24618
24685
  "use strict";
24619
24686
  QR_BASE_URL = "https://ilinkai.weixin.qq.com";
24620
24687
  DEFAULT_BOT_TYPE = "3";
@@ -24626,10 +24693,10 @@ var init_api = __esm({
24626
24693
  }
24627
24694
  });
24628
24695
 
24629
- // packages/server/dist/channels/wechat/types.js
24696
+ // ../server/dist/channels/wechat/types.js
24630
24697
  var MessageItemType, MessageType, MessageState, UploadMediaType;
24631
24698
  var init_types = __esm({
24632
- "packages/server/dist/channels/wechat/types.js"() {
24699
+ "../server/dist/channels/wechat/types.js"() {
24633
24700
  "use strict";
24634
24701
  MessageItemType = {
24635
24702
  NONE: 0,
@@ -24658,7 +24725,7 @@ var init_types = __esm({
24658
24725
  }
24659
24726
  });
24660
24727
 
24661
- // packages/server/dist/channels/wechat/accounts.js
24728
+ // ../server/dist/channels/wechat/accounts.js
24662
24729
  function toWechat(a) {
24663
24730
  const c = a.config;
24664
24731
  return {
@@ -24740,24 +24807,27 @@ function saveSyncBuf(db, accountId, syncBuf) {
24740
24807
  }
24741
24808
  var CH3;
24742
24809
  var init_accounts4 = __esm({
24743
- "packages/server/dist/channels/wechat/accounts.js"() {
24810
+ "../server/dist/channels/wechat/accounts.js"() {
24744
24811
  "use strict";
24745
24812
  init_accounts();
24746
24813
  CH3 = "wechat";
24747
24814
  }
24748
24815
  });
24749
24816
 
24750
- // packages/server/dist/channels/wechat/event-adapter.js
24751
- var HARD_CHARS2, WechatResponder;
24817
+ // ../server/dist/channels/wechat/event-adapter.js
24818
+ var WECHAT_TEXT_LIMIT, WechatResponder;
24752
24819
  var init_event_adapter2 = __esm({
24753
- "packages/server/dist/channels/wechat/event-adapter.js"() {
24820
+ "../server/dist/channels/wechat/event-adapter.js"() {
24754
24821
  "use strict";
24822
+ init_chunk();
24755
24823
  init_media();
24756
- HARD_CHARS2 = 3500;
24824
+ WECHAT_TEXT_LIMIT = 3500;
24757
24825
  WechatResponder = class {
24758
24826
  buffer = "";
24759
24827
  deps;
24760
24828
  closed = false;
24829
+ /** Tail of the per-responder send chain — see `enqueueChunk`. */
24830
+ sendTail = Promise.resolve();
24761
24831
  constructor(deps) {
24762
24832
  this.deps = deps;
24763
24833
  }
@@ -24768,19 +24838,19 @@ var init_event_adapter2 = __esm({
24768
24838
  return;
24769
24839
  switch (event.type) {
24770
24840
  case "stream":
24771
- if (event.text)
24841
+ if (event.final && event.text)
24772
24842
  this.append(event.text);
24773
24843
  break;
24774
24844
  case "error":
24775
24845
  if (event.error) {
24776
24846
  this.flushAll();
24777
- void this.dispatchChunk(`\u274C ${event.error}`);
24847
+ this.enqueueChunk(`\u274C ${event.error}`);
24778
24848
  }
24779
24849
  break;
24780
24850
  case "system":
24781
24851
  if (event.text) {
24782
24852
  this.flushAll();
24783
- void this.dispatchChunk(`\u2139\uFE0F ${event.text}`);
24853
+ this.enqueueChunk(`\u2139\uFE0F ${event.text}`);
24784
24854
  }
24785
24855
  break;
24786
24856
  case "complete":
@@ -24788,46 +24858,43 @@ var init_event_adapter2 = __esm({
24788
24858
  break;
24789
24859
  }
24790
24860
  }
24861
+ /** Returns the drain promise so the bridge keeps the reply route alive
24862
+ * until the last queued chunk has actually been sent. */
24791
24863
  close() {
24792
24864
  if (this.closed)
24793
- return;
24865
+ return this.sendTail;
24794
24866
  this.flushAll();
24795
24867
  this.closed = true;
24868
+ return this.sendTail;
24796
24869
  }
24797
24870
  append(text5) {
24798
24871
  this.buffer += text5;
24799
- while (this.buffer.length >= HARD_CHARS2) {
24800
- const cut = this.findSplitPoint(this.buffer, HARD_CHARS2);
24801
- const chunk = this.buffer.slice(0, cut);
24802
- this.buffer = this.buffer.slice(cut).trimStart();
24803
- void this.dispatchChunk(chunk);
24804
- }
24872
+ if (this.buffer.length <= WECHAT_TEXT_LIMIT)
24873
+ return;
24874
+ const chunks = splitText(this.buffer, WECHAT_TEXT_LIMIT);
24875
+ this.buffer = chunks.pop() ?? "";
24876
+ for (const chunk of chunks)
24877
+ this.enqueueChunk(chunk);
24805
24878
  }
24806
24879
  flushAll() {
24807
24880
  if (!this.buffer)
24808
24881
  return;
24809
- while (this.buffer.length > HARD_CHARS2) {
24810
- const cut = this.findSplitPoint(this.buffer, HARD_CHARS2);
24811
- const chunk = this.buffer.slice(0, cut);
24812
- this.buffer = this.buffer.slice(cut).trimStart();
24813
- void this.dispatchChunk(chunk);
24814
- }
24815
- if (this.buffer) {
24816
- const text5 = this.buffer;
24817
- this.buffer = "";
24818
- void this.dispatchChunk(text5);
24819
- }
24882
+ const chunks = splitText(this.buffer, WECHAT_TEXT_LIMIT);
24883
+ this.buffer = "";
24884
+ for (const chunk of chunks)
24885
+ this.enqueueChunk(chunk);
24820
24886
  }
24821
24887
  /**
24822
- * Pick an index ≤ `limit` to split `text` at. Prefer the last paragraph
24823
- * break (`\n\n`) within the limit; fall back to a hard cut at `limit`.
24888
+ * Serialize sends per responder — same rationale as the Slack adapter
24889
+ * (audit A-L3): a flush emits several chunks in one synchronous loop, and
24890
+ * firing their HTTP sends concurrently gave arrival order no guarantee.
24891
+ * Each chunk waits for the previous send to settle; the `catch` keeps a
24892
+ * rejected link from poisoning the chain (dispatchChunk already logs
24893
+ * per-send failures).
24824
24894
  */
24825
- findSplitPoint(text5, limit) {
24826
- const window = text5.slice(0, limit);
24827
- const lastPara = window.lastIndexOf("\n\n");
24828
- if (lastPara > limit / 2)
24829
- return lastPara + 2;
24830
- return limit;
24895
+ enqueueChunk(chunk) {
24896
+ this.sendTail = this.sendTail.then(() => this.dispatchChunk(chunk)).catch(() => {
24897
+ });
24831
24898
  }
24832
24899
  /**
24833
24900
  * Extract MEDIA: lines, dispatching them as media sends. Remaining text
@@ -24854,7 +24921,7 @@ var init_event_adapter2 = __esm({
24854
24921
  }
24855
24922
  });
24856
24923
 
24857
- // packages/server/dist/channels/wechat/cdn.js
24924
+ // ../server/dist/channels/wechat/cdn.js
24858
24925
  import { createDecipheriv, createCipheriv, randomBytes as randomBytes2, createHash as createHash2 } from "node:crypto";
24859
24926
  function decryptAesEcb(ciphertext, key) {
24860
24927
  const decipher = createDecipheriv("aes-128-ecb", key, null);
@@ -24953,14 +25020,14 @@ async function uploadCiphertext(params) {
24953
25020
  }
24954
25021
  var CDN_BASE_URL, UPLOAD_MAX_RETRIES;
24955
25022
  var init_cdn = __esm({
24956
- "packages/server/dist/channels/wechat/cdn.js"() {
25023
+ "../server/dist/channels/wechat/cdn.js"() {
24957
25024
  "use strict";
24958
25025
  CDN_BASE_URL = "https://novac2c.cdn.weixin.qq.com/c2c";
24959
25026
  UPLOAD_MAX_RETRIES = 3;
24960
25027
  }
24961
25028
  });
24962
25029
 
24963
- // packages/server/dist/channels/wechat/send-media.js
25030
+ // ../server/dist/channels/wechat/send-media.js
24964
25031
  import fs51 from "node:fs/promises";
24965
25032
  import path59 from "node:path";
24966
25033
  function inferKind(filePath) {
@@ -25054,7 +25121,7 @@ function buildMessageItem(args) {
25054
25121
  };
25055
25122
  }
25056
25123
  var init_send_media = __esm({
25057
- "packages/server/dist/channels/wechat/send-media.js"() {
25124
+ "../server/dist/channels/wechat/send-media.js"() {
25058
25125
  "use strict";
25059
25126
  init_api();
25060
25127
  init_cdn();
@@ -25063,7 +25130,7 @@ var init_send_media = __esm({
25063
25130
  }
25064
25131
  });
25065
25132
 
25066
- // packages/server/dist/channels/wechat/login.js
25133
+ // ../server/dist/channels/wechat/login.js
25067
25134
  import { randomUUID as randomUUID2 } from "node:crypto";
25068
25135
  function isFresh(l) {
25069
25136
  return Date.now() - l.startedAt < ACTIVE_TTL_MS;
@@ -25165,7 +25232,7 @@ async function waitLogin(params) {
25165
25232
  }
25166
25233
  var ACTIVE_TTL_MS, MAX_QR_REFRESH, activeLogins;
25167
25234
  var init_login = __esm({
25168
- "packages/server/dist/channels/wechat/login.js"() {
25235
+ "../server/dist/channels/wechat/login.js"() {
25169
25236
  "use strict";
25170
25237
  init_api();
25171
25238
  ACTIVE_TTL_MS = 5 * 6e4;
@@ -25174,7 +25241,7 @@ var init_login = __esm({
25174
25241
  }
25175
25242
  });
25176
25243
 
25177
- // packages/server/dist/channels/wechat/handler.js
25244
+ // ../server/dist/channels/wechat/handler.js
25178
25245
  import fs52 from "node:fs";
25179
25246
  import path60 from "node:path";
25180
25247
  import QRCode from "qrcode";
@@ -25630,7 +25697,7 @@ function sleep2(ms, signal) {
25630
25697
  }
25631
25698
  var MAX_CONSECUTIVE_FAILURES, BACKOFF_DELAY_MS, RETRY_DELAY_MS;
25632
25699
  var init_handler3 = __esm({
25633
- "packages/server/dist/channels/wechat/handler.js"() {
25700
+ "../server/dist/channels/wechat/handler.js"() {
25634
25701
  "use strict";
25635
25702
  init_api();
25636
25703
  init_types();
@@ -25652,7 +25719,7 @@ var init_handler3 = __esm({
25652
25719
  }
25653
25720
  });
25654
25721
 
25655
- // packages/server/dist/routes/wechat.js
25722
+ // ../server/dist/routes/wechat.js
25656
25723
  import { Hono as Hono16 } from "hono";
25657
25724
  import path61 from "node:path";
25658
25725
  import fs53 from "node:fs";
@@ -25767,7 +25834,7 @@ function stripSecrets(acc) {
25767
25834
  return rest;
25768
25835
  }
25769
25836
  var init_wechat = __esm({
25770
- "packages/server/dist/routes/wechat.js"() {
25837
+ "../server/dist/routes/wechat.js"() {
25771
25838
  "use strict";
25772
25839
  init_login();
25773
25840
  init_accounts4();
@@ -25775,7 +25842,7 @@ var init_wechat = __esm({
25775
25842
  }
25776
25843
  });
25777
25844
 
25778
- // packages/server/dist/channels/wechat/cron-dispatcher.js
25845
+ // ../server/dist/channels/wechat/cron-dispatcher.js
25779
25846
  function readLastActiveChatId(accountId) {
25780
25847
  const acct = getAccount(getChannelDb(), accountId);
25781
25848
  if (!acct)
@@ -25795,7 +25862,14 @@ async function dispatch2(accountId, text5, explicitChatId, media) {
25795
25862
  }
25796
25863
  const out = [];
25797
25864
  if (text5) {
25798
- await sendToUser({ account: acct, toUserId: chatId, text: text5 });
25865
+ const chunks = splitText(text5, WECHAT_TEXT_LIMIT);
25866
+ for (const [i, chunk] of chunks.entries()) {
25867
+ try {
25868
+ await sendToUser({ account: acct, toUserId: chatId, text: chunk });
25869
+ } catch (err) {
25870
+ throw new Error(`chunk ${i + 1}/${chunks.length}: ${err instanceof Error ? err.message : String(err)}`);
25871
+ }
25872
+ }
25799
25873
  out.push({ channelType: "wechat", accountId, chatId, ok: true });
25800
25874
  }
25801
25875
  for (const filePath of media?.paths ?? []) {
@@ -25842,22 +25916,24 @@ function registerWechatCronDispatcher() {
25842
25916
  registerCronDispatcher({ channelType: "wechat", supportsMedia: true, dispatch: dispatch2, listTargets: listTargets2 });
25843
25917
  }
25844
25918
  var init_cron_dispatcher2 = __esm({
25845
- "packages/server/dist/channels/wechat/cron-dispatcher.js"() {
25919
+ "../server/dist/channels/wechat/cron-dispatcher.js"() {
25846
25920
  "use strict";
25847
25921
  init_channel_db();
25848
25922
  init_accounts();
25849
25923
  init_accounts4();
25850
25924
  init_handler3();
25851
25925
  init_send_media();
25926
+ init_event_adapter2();
25927
+ init_chunk();
25852
25928
  init_media();
25853
25929
  init_dispatcher();
25854
25930
  }
25855
25931
  });
25856
25932
 
25857
- // packages/server/dist/channels/wechat/descriptor.js
25933
+ // ../server/dist/channels/wechat/descriptor.js
25858
25934
  var wechatDescriptor;
25859
25935
  var init_descriptor2 = __esm({
25860
- "packages/server/dist/channels/wechat/descriptor.js"() {
25936
+ "../server/dist/channels/wechat/descriptor.js"() {
25861
25937
  "use strict";
25862
25938
  init_handler3();
25863
25939
  init_wechat();
@@ -25872,7 +25948,7 @@ var init_descriptor2 = __esm({
25872
25948
  }
25873
25949
  });
25874
25950
 
25875
- // packages/server/dist/channels/web/handler.js
25951
+ // ../server/dist/channels/web/handler.js
25876
25952
  function buildWebSessionPrefix(accountId) {
25877
25953
  return sessionPrefix("web", accountId);
25878
25954
  }
@@ -26255,7 +26331,7 @@ function createMediaBuffer() {
26255
26331
  };
26256
26332
  }
26257
26333
  var init_handler4 = __esm({
26258
- "packages/server/dist/channels/web/handler.js"() {
26334
+ "../server/dist/channels/web/handler.js"() {
26259
26335
  "use strict";
26260
26336
  init_ui_log_builder();
26261
26337
  init_accounts2();
@@ -26270,7 +26346,7 @@ var init_handler4 = __esm({
26270
26346
  }
26271
26347
  });
26272
26348
 
26273
- // packages/server/dist/routes/web.js
26349
+ // ../server/dist/routes/web.js
26274
26350
  import { Hono as Hono17 } from "hono";
26275
26351
  import { streamSSE } from "hono/streaming";
26276
26352
  import crypto4 from "node:crypto";
@@ -26467,7 +26543,7 @@ function createWebRoutes(deps) {
26467
26543
  return app2;
26468
26544
  }
26469
26545
  var init_web = __esm({
26470
- "packages/server/dist/routes/web.js"() {
26546
+ "../server/dist/routes/web.js"() {
26471
26547
  "use strict";
26472
26548
  init_dist();
26473
26549
  init_accounts2();
@@ -26476,10 +26552,10 @@ var init_web = __esm({
26476
26552
  }
26477
26553
  });
26478
26554
 
26479
- // packages/server/dist/channels/web/descriptor.js
26555
+ // ../server/dist/channels/web/descriptor.js
26480
26556
  var webDescriptor;
26481
26557
  var init_descriptor3 = __esm({
26482
- "packages/server/dist/channels/web/descriptor.js"() {
26558
+ "../server/dist/channels/web/descriptor.js"() {
26483
26559
  "use strict";
26484
26560
  init_handler4();
26485
26561
  init_web();
@@ -26495,7 +26571,7 @@ var init_descriptor3 = __esm({
26495
26571
  }
26496
26572
  });
26497
26573
 
26498
- // packages/server/dist/channels/slack/accounts.js
26574
+ // ../server/dist/channels/slack/accounts.js
26499
26575
  function toSlack(a) {
26500
26576
  const c = a.config;
26501
26577
  return {
@@ -26571,14 +26647,14 @@ function deleteAccount5(db, accountId) {
26571
26647
  }
26572
26648
  var CH4;
26573
26649
  var init_accounts5 = __esm({
26574
- "packages/server/dist/channels/slack/accounts.js"() {
26650
+ "../server/dist/channels/slack/accounts.js"() {
26575
26651
  "use strict";
26576
26652
  init_accounts();
26577
26653
  CH4 = "slack";
26578
26654
  }
26579
26655
  });
26580
26656
 
26581
- // packages/server/dist/channels/shared/markdown.js
26657
+ // ../server/dist/channels/shared/markdown.js
26582
26658
  function formatForSlack(input) {
26583
26659
  if (!input)
26584
26660
  return "";
@@ -26657,19 +26733,20 @@ function stripCommonMark(line) {
26657
26733
  return line;
26658
26734
  }
26659
26735
  var init_markdown = __esm({
26660
- "packages/server/dist/channels/shared/markdown.js"() {
26736
+ "../server/dist/channels/shared/markdown.js"() {
26661
26737
  "use strict";
26662
26738
  }
26663
26739
  });
26664
26740
 
26665
- // packages/server/dist/channels/slack/event-adapter.js
26666
- var HARD_CHARS3, SlackResponder;
26741
+ // ../server/dist/channels/slack/event-adapter.js
26742
+ var HARD_CHARS2, SlackResponder;
26667
26743
  var init_event_adapter3 = __esm({
26668
- "packages/server/dist/channels/slack/event-adapter.js"() {
26744
+ "../server/dist/channels/slack/event-adapter.js"() {
26669
26745
  "use strict";
26746
+ init_chunk();
26670
26747
  init_markdown();
26671
26748
  init_media();
26672
- HARD_CHARS3 = 35e3;
26749
+ HARD_CHARS2 = 35e3;
26673
26750
  SlackResponder = class {
26674
26751
  buffer = "";
26675
26752
  deps;
@@ -26686,7 +26763,7 @@ var init_event_adapter3 = __esm({
26686
26763
  return;
26687
26764
  switch (event.type) {
26688
26765
  case "stream":
26689
- if (event.text)
26766
+ if (event.final && event.text)
26690
26767
  this.buffer += event.text;
26691
26768
  break;
26692
26769
  case "system":
@@ -26718,24 +26795,10 @@ var init_event_adapter3 = __esm({
26718
26795
  flushBuffer() {
26719
26796
  if (!this.buffer)
26720
26797
  return;
26721
- while (this.buffer.length > HARD_CHARS3) {
26722
- const cut = this.findSplitPoint(this.buffer, HARD_CHARS3);
26723
- const chunk = this.buffer.slice(0, cut);
26724
- this.buffer = this.buffer.slice(cut).trimStart();
26798
+ const chunks = splitText(this.buffer, HARD_CHARS2);
26799
+ this.buffer = "";
26800
+ for (const chunk of chunks)
26725
26801
  this.enqueueChunk(chunk);
26726
- }
26727
- if (this.buffer) {
26728
- const text5 = this.buffer;
26729
- this.buffer = "";
26730
- this.enqueueChunk(text5);
26731
- }
26732
- }
26733
- findSplitPoint(text5, limit) {
26734
- const window = text5.slice(0, limit);
26735
- const lastPara = window.lastIndexOf("\n\n");
26736
- if (lastPara > limit / 2)
26737
- return lastPara + 2;
26738
- return limit;
26739
26802
  }
26740
26803
  /**
26741
26804
  * Serialize sends per responder. `flushBuffer` can produce several chunks
@@ -26771,7 +26834,7 @@ var init_event_adapter3 = __esm({
26771
26834
  }
26772
26835
  });
26773
26836
 
26774
- // packages/server/dist/channels/slack/api.js
26837
+ // ../server/dist/channels/slack/api.js
26775
26838
  async function slackPost(endpoint, token, body) {
26776
26839
  const isForm = body instanceof FormData;
26777
26840
  const res = await fetch(`${SLACK_API}/${endpoint}`, {
@@ -26959,13 +27022,13 @@ async function downloadFile(botToken, urlPrivate) {
26959
27022
  }
26960
27023
  var SLACK_API;
26961
27024
  var init_api2 = __esm({
26962
- "packages/server/dist/channels/slack/api.js"() {
27025
+ "../server/dist/channels/slack/api.js"() {
26963
27026
  "use strict";
26964
27027
  SLACK_API = "https://slack.com/api";
26965
27028
  }
26966
27029
  });
26967
27030
 
26968
- // packages/server/dist/channels/slack/handler.js
27031
+ // ../server/dist/channels/slack/handler.js
26969
27032
  import path62 from "node:path";
26970
27033
  import { WebSocket } from "ws";
26971
27034
  function slashToBang(text5, commandNames) {
@@ -27325,7 +27388,7 @@ function buildCmdCtx(args) {
27325
27388
  }
27326
27389
  var SLACK_EXTRA_COMMANDS, SEEN_EVENT_IDS, SEEN_EVENT_IDS_MAX;
27327
27390
  var init_handler5 = __esm({
27328
- "packages/server/dist/channels/slack/handler.js"() {
27391
+ "../server/dist/channels/slack/handler.js"() {
27329
27392
  "use strict";
27330
27393
  init_accounts5();
27331
27394
  init_event_adapter3();
@@ -27345,7 +27408,7 @@ var init_handler5 = __esm({
27345
27408
  }
27346
27409
  });
27347
27410
 
27348
- // packages/server/dist/routes/slack.js
27411
+ // ../server/dist/routes/slack.js
27349
27412
  import { Hono as Hono18 } from "hono";
27350
27413
  import fs55 from "node:fs";
27351
27414
  function createSlackRoutes(deps) {
@@ -27479,7 +27542,7 @@ function createSlackRoutes(deps) {
27479
27542
  return app2;
27480
27543
  }
27481
27544
  var init_slack = __esm({
27482
- "packages/server/dist/routes/slack.js"() {
27545
+ "../server/dist/routes/slack.js"() {
27483
27546
  "use strict";
27484
27547
  init_accounts5();
27485
27548
  init_accounts();
@@ -27487,7 +27550,7 @@ var init_slack = __esm({
27487
27550
  }
27488
27551
  });
27489
27552
 
27490
- // packages/server/dist/channels/slack/cron-dispatcher.js
27553
+ // ../server/dist/channels/slack/cron-dispatcher.js
27491
27554
  function parseChatId(raw) {
27492
27555
  const idx = raw.indexOf(":");
27493
27556
  if (idx < 0)
@@ -27551,7 +27614,7 @@ function registerSlackCronDispatcher() {
27551
27614
  registerCronDispatcher({ channelType: "slack", supportsMedia: true, dispatch: dispatch3, listTargets: listTargets3 });
27552
27615
  }
27553
27616
  var init_cron_dispatcher3 = __esm({
27554
- "packages/server/dist/channels/slack/cron-dispatcher.js"() {
27617
+ "../server/dist/channels/slack/cron-dispatcher.js"() {
27555
27618
  "use strict";
27556
27619
  init_channel_db();
27557
27620
  init_accounts5();
@@ -27561,10 +27624,10 @@ var init_cron_dispatcher3 = __esm({
27561
27624
  }
27562
27625
  });
27563
27626
 
27564
- // packages/server/dist/channels/slack/descriptor.js
27627
+ // ../server/dist/channels/slack/descriptor.js
27565
27628
  var slackDescriptor;
27566
27629
  var init_descriptor4 = __esm({
27567
- "packages/server/dist/channels/slack/descriptor.js"() {
27630
+ "../server/dist/channels/slack/descriptor.js"() {
27568
27631
  "use strict";
27569
27632
  init_handler5();
27570
27633
  init_slack();
@@ -27579,7 +27642,7 @@ var init_descriptor4 = __esm({
27579
27642
  }
27580
27643
  });
27581
27644
 
27582
- // packages/server/dist/channels/feishu/accounts.js
27645
+ // ../server/dist/channels/feishu/accounts.js
27583
27646
  function toFeishu(a) {
27584
27647
  const c = a.config;
27585
27648
  return {
@@ -27657,21 +27720,22 @@ function deleteAccount6(db, accountId) {
27657
27720
  }
27658
27721
  var CH5;
27659
27722
  var init_accounts6 = __esm({
27660
- "packages/server/dist/channels/feishu/accounts.js"() {
27723
+ "../server/dist/channels/feishu/accounts.js"() {
27661
27724
  "use strict";
27662
27725
  init_accounts();
27663
27726
  CH5 = "feishu";
27664
27727
  }
27665
27728
  });
27666
27729
 
27667
- // packages/server/dist/channels/feishu/event-adapter.js
27668
- var HARD_CHARS4, FeishuResponder;
27730
+ // ../server/dist/channels/feishu/event-adapter.js
27731
+ var HARD_CHARS3, FeishuResponder;
27669
27732
  var init_event_adapter4 = __esm({
27670
- "packages/server/dist/channels/feishu/event-adapter.js"() {
27733
+ "../server/dist/channels/feishu/event-adapter.js"() {
27671
27734
  "use strict";
27735
+ init_chunk();
27672
27736
  init_markdown();
27673
27737
  init_media();
27674
- HARD_CHARS4 = 4500;
27738
+ HARD_CHARS3 = 4500;
27675
27739
  FeishuResponder = class {
27676
27740
  buffer = "";
27677
27741
  deps;
@@ -27688,7 +27752,7 @@ var init_event_adapter4 = __esm({
27688
27752
  return;
27689
27753
  switch (event.type) {
27690
27754
  case "stream":
27691
- if (event.text)
27755
+ if (event.final && event.text)
27692
27756
  this.buffer += event.text;
27693
27757
  break;
27694
27758
  case "system":
@@ -27720,24 +27784,10 @@ var init_event_adapter4 = __esm({
27720
27784
  flushBuffer() {
27721
27785
  if (!this.buffer)
27722
27786
  return;
27723
- while (this.buffer.length > HARD_CHARS4) {
27724
- const cut = this.findSplitPoint(this.buffer, HARD_CHARS4);
27725
- const chunk = this.buffer.slice(0, cut);
27726
- this.buffer = this.buffer.slice(cut).trimStart();
27787
+ const chunks = splitText(this.buffer, HARD_CHARS3);
27788
+ this.buffer = "";
27789
+ for (const chunk of chunks)
27727
27790
  this.enqueueChunk(chunk);
27728
- }
27729
- if (this.buffer) {
27730
- const text5 = this.buffer;
27731
- this.buffer = "";
27732
- this.enqueueChunk(text5);
27733
- }
27734
- }
27735
- findSplitPoint(text5, limit) {
27736
- const window = text5.slice(0, limit);
27737
- const lastPara = window.lastIndexOf("\n\n");
27738
- if (lastPara > limit / 2)
27739
- return lastPara + 2;
27740
- return limit;
27741
27791
  }
27742
27792
  /**
27743
27793
  * Serialize sends per responder — same rationale as the Slack adapter
@@ -27773,7 +27823,7 @@ var init_event_adapter4 = __esm({
27773
27823
  }
27774
27824
  });
27775
27825
 
27776
- // packages/server/dist/channels/feishu/api.js
27826
+ // ../server/dist/channels/feishu/api.js
27777
27827
  async function getTenantAccessToken(args) {
27778
27828
  const cached = tokenCache.get(args.appId);
27779
27829
  if (cached && cached.expiresAt - Date.now() > 6e4)
@@ -28037,14 +28087,14 @@ async function searchFeishuTargets(args) {
28037
28087
  }
28038
28088
  var FEISHU_BASE, tokenCache;
28039
28089
  var init_api3 = __esm({
28040
- "packages/server/dist/channels/feishu/api.js"() {
28090
+ "../server/dist/channels/feishu/api.js"() {
28041
28091
  "use strict";
28042
28092
  FEISHU_BASE = "https://open.feishu.cn";
28043
28093
  tokenCache = /* @__PURE__ */ new Map();
28044
28094
  }
28045
28095
  });
28046
28096
 
28047
- // packages/server/dist/channels/feishu/handler.js
28097
+ // ../server/dist/channels/feishu/handler.js
28048
28098
  import path63 from "node:path";
28049
28099
  import * as Lark from "@larksuiteoapi/node-sdk";
28050
28100
  function buildSessionPrefixForThread2(chatId, rootId) {
@@ -28454,7 +28504,7 @@ function buildCmdCtx2(args) {
28454
28504
  };
28455
28505
  }
28456
28506
  var init_handler6 = __esm({
28457
- "packages/server/dist/channels/feishu/handler.js"() {
28507
+ "../server/dist/channels/feishu/handler.js"() {
28458
28508
  "use strict";
28459
28509
  init_accounts6();
28460
28510
  init_event_adapter4();
@@ -28469,7 +28519,7 @@ var init_handler6 = __esm({
28469
28519
  }
28470
28520
  });
28471
28521
 
28472
- // packages/server/dist/routes/feishu.js
28522
+ // ../server/dist/routes/feishu.js
28473
28523
  import { Hono as Hono19 } from "hono";
28474
28524
  import fs56 from "node:fs";
28475
28525
  function createFeishuRoutes(deps) {
@@ -28606,7 +28656,7 @@ function createFeishuRoutes(deps) {
28606
28656
  return app2;
28607
28657
  }
28608
28658
  var init_feishu = __esm({
28609
- "packages/server/dist/routes/feishu.js"() {
28659
+ "../server/dist/routes/feishu.js"() {
28610
28660
  "use strict";
28611
28661
  init_accounts6();
28612
28662
  init_accounts();
@@ -28614,7 +28664,7 @@ var init_feishu = __esm({
28614
28664
  }
28615
28665
  });
28616
28666
 
28617
- // packages/server/dist/channels/feishu/cron-dispatcher.js
28667
+ // ../server/dist/channels/feishu/cron-dispatcher.js
28618
28668
  function parseChatId2(raw) {
28619
28669
  const idx = raw.indexOf(":");
28620
28670
  return { chatId: idx < 0 ? raw : raw.slice(0, idx) };
@@ -28664,7 +28714,7 @@ function registerFeishuCronDispatcher() {
28664
28714
  registerCronDispatcher({ channelType: "feishu", dispatch: dispatch4, listTargets: listTargets4 });
28665
28715
  }
28666
28716
  var init_cron_dispatcher4 = __esm({
28667
- "packages/server/dist/channels/feishu/cron-dispatcher.js"() {
28717
+ "../server/dist/channels/feishu/cron-dispatcher.js"() {
28668
28718
  "use strict";
28669
28719
  init_channel_db();
28670
28720
  init_accounts6();
@@ -28673,10 +28723,10 @@ var init_cron_dispatcher4 = __esm({
28673
28723
  }
28674
28724
  });
28675
28725
 
28676
- // packages/server/dist/channels/feishu/descriptor.js
28726
+ // ../server/dist/channels/feishu/descriptor.js
28677
28727
  var feishuDescriptor;
28678
28728
  var init_descriptor5 = __esm({
28679
- "packages/server/dist/channels/feishu/descriptor.js"() {
28729
+ "../server/dist/channels/feishu/descriptor.js"() {
28680
28730
  "use strict";
28681
28731
  init_handler6();
28682
28732
  init_feishu();
@@ -28691,10 +28741,10 @@ var init_descriptor5 = __esm({
28691
28741
  }
28692
28742
  });
28693
28743
 
28694
- // packages/server/dist/channels/descriptors.js
28744
+ // ../server/dist/channels/descriptors.js
28695
28745
  var defaultChannelDescriptors;
28696
28746
  var init_descriptors = __esm({
28697
- "packages/server/dist/channels/descriptors.js"() {
28747
+ "../server/dist/channels/descriptors.js"() {
28698
28748
  "use strict";
28699
28749
  init_descriptor();
28700
28750
  init_descriptor2();
@@ -28711,7 +28761,7 @@ var init_descriptors = __esm({
28711
28761
  }
28712
28762
  });
28713
28763
 
28714
- // packages/server/dist/middleware/auth.js
28764
+ // ../server/dist/middleware/auth.js
28715
28765
  import { Hono as Hono20 } from "hono";
28716
28766
  import { getCookie, setCookie } from "hono/cookie";
28717
28767
  import crypto5 from "node:crypto";
@@ -28904,7 +28954,7 @@ function authMiddleware() {
28904
28954
  }
28905
28955
  var TOKEN_MAX_AGE, REFRESH_AFTER, COOKIE_NAME, ADMIN_LOGIN_BUCKET, isLockedOut2, recordFailure2, clearFailures2, PUBLIC_PATHS;
28906
28956
  var init_auth = __esm({
28907
- "packages/server/dist/middleware/auth.js"() {
28957
+ "../server/dist/middleware/auth.js"() {
28908
28958
  "use strict";
28909
28959
  init_config();
28910
28960
  init_password_hash();
@@ -28921,7 +28971,7 @@ var init_auth = __esm({
28921
28971
  }
28922
28972
  });
28923
28973
 
28924
- // packages/server/dist/index.js
28974
+ // ../server/dist/index.js
28925
28975
  var dist_exports = {};
28926
28976
  import { Hono as Hono21 } from "hono";
28927
28977
  import { cors } from "hono/cors";
@@ -29049,7 +29099,7 @@ async function gracefulShutdown(signal) {
29049
29099
  }
29050
29100
  var __dirname3, PORT, HALO_VERSION, PROJECT_ROOT, HALO_HOME4, GIT_SHA, AGENTCORE, app, allowlist, authRoutes, fileRoutes, dataPreviewRoutes, gitRoutes, agentConfigRoutes, skillRoutes, settingsRoutes, evolutionRoutes, cronRoutes, channelDb, registry, sessionRoutes, sessionArchiveRoutes, showRoutes, metricsRoutes, commandRoutes, FRONTEND_DIR, server, wss;
29051
29101
  var init_dist2 = __esm({
29052
- async "packages/server/dist/index.js"() {
29102
+ async "../server/dist/index.js"() {
29053
29103
  "use strict";
29054
29104
  init_files();
29055
29105
  init_data_preview();
@@ -29087,7 +29137,7 @@ var init_dist2 = __esm({
29087
29137
  init_git_ssh();
29088
29138
  __dirname3 = path64.dirname(fileURLToPath3(import.meta.url));
29089
29139
  PORT = config.server.port;
29090
- HALO_VERSION = "1.1.3";
29140
+ HALO_VERSION = "1.1.5";
29091
29141
  PROJECT_ROOT = findProjectRoot();
29092
29142
  HALO_HOME4 = path64.join(homedir24(), ".halo");
29093
29143
  GIT_SHA = readGitSha();
@@ -29264,7 +29314,7 @@ var init_dist2 = __esm({
29264
29314
  }
29265
29315
  });
29266
29316
 
29267
- // packages/acp-adapter/dist/halo-client.js
29317
+ // ../acp-adapter/dist/halo-client.js
29268
29318
  async function safeText(res) {
29269
29319
  try {
29270
29320
  return (await res.text()).slice(0, 500);
@@ -29307,7 +29357,7 @@ async function* parseSseStream(body) {
29307
29357
  }
29308
29358
  var HaloClient;
29309
29359
  var init_halo_client = __esm({
29310
- "packages/acp-adapter/dist/halo-client.js"() {
29360
+ "../acp-adapter/dist/halo-client.js"() {
29311
29361
  "use strict";
29312
29362
  HaloClient = class {
29313
29363
  opts;
@@ -29386,7 +29436,7 @@ var init_halo_client = __esm({
29386
29436
  }
29387
29437
  });
29388
29438
 
29389
- // packages/acp-adapter/dist/adapter.js
29439
+ // ../acp-adapter/dist/adapter.js
29390
29440
  function newError(message, code = -32603) {
29391
29441
  const e = new Error(message);
29392
29442
  e.code = code;
@@ -29394,7 +29444,7 @@ function newError(message, code = -32603) {
29394
29444
  }
29395
29445
  var AcpAdapter;
29396
29446
  var init_adapter = __esm({
29397
- "packages/acp-adapter/dist/adapter.js"() {
29447
+ "../acp-adapter/dist/adapter.js"() {
29398
29448
  "use strict";
29399
29449
  init_halo_client();
29400
29450
  AcpAdapter = class {
@@ -29683,10 +29733,10 @@ var init_adapter = __esm({
29683
29733
  }
29684
29734
  });
29685
29735
 
29686
- // packages/acp-adapter/dist/jsonrpc.js
29736
+ // ../acp-adapter/dist/jsonrpc.js
29687
29737
  var ERROR_PARSE, ERROR_METHOD_NOT_FOUND, ERROR_INTERNAL, JsonRpcConnection;
29688
29738
  var init_jsonrpc = __esm({
29689
- "packages/acp-adapter/dist/jsonrpc.js"() {
29739
+ "../acp-adapter/dist/jsonrpc.js"() {
29690
29740
  "use strict";
29691
29741
  ERROR_PARSE = -32700;
29692
29742
  ERROR_METHOD_NOT_FOUND = -32601;
@@ -29819,7 +29869,7 @@ var init_jsonrpc = __esm({
29819
29869
  }
29820
29870
  });
29821
29871
 
29822
- // packages/acp-adapter/dist/index.js
29872
+ // ../acp-adapter/dist/index.js
29823
29873
  var dist_exports2 = {};
29824
29874
  __export(dist_exports2, {
29825
29875
  main: () => main
@@ -29935,7 +29985,7 @@ function main(argv = process.argv.slice(2)) {
29935
29985
  }
29936
29986
  var HELP;
29937
29987
  var init_dist3 = __esm({
29938
- "packages/acp-adapter/dist/index.js"() {
29988
+ "../acp-adapter/dist/index.js"() {
29939
29989
  "use strict";
29940
29990
  init_adapter();
29941
29991
  init_jsonrpc();
@@ -29974,7 +30024,7 @@ Stdio:
29974
30024
  }
29975
30025
  });
29976
30026
 
29977
- // packages/cli/src/silence-warnings.ts
30027
+ // src/silence-warnings.ts
29978
30028
  var emit = process.emitWarning.bind(process);
29979
30029
  process.emitWarning = (warning, ...args) => {
29980
30030
  const opt = args[0];
@@ -29983,13 +30033,13 @@ process.emitWarning = (warning, ...args) => {
29983
30033
  return emit(warning, ...args);
29984
30034
  };
29985
30035
 
29986
- // packages/cli/src/index.ts
30036
+ // src/index.ts
29987
30037
  init_server_supervisor();
29988
30038
  import path65 from "node:path";
29989
30039
  import fs58 from "node:fs";
29990
30040
  import { homedir as homedir25 } from "node:os";
29991
30041
  import { parseArgs as parseArgs2 } from "node:util";
29992
- var VERSION = "1.1.3";
30042
+ var VERSION = "1.1.5";
29993
30043
  var HELP_TOP = `Usage: halo <command> [options]
29994
30044
 
29995
30045
  Commands: