@turmind/halo 1.1.4 → 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,
@@ -2399,7 +2399,7 @@ function ensureWorkspaceHalo(workspaceRoot) {
2399
2399
  }
2400
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;
2401
2401
  var init_init = __esm({
2402
- "packages/server/dist/init.js"() {
2402
+ "../server/dist/init.js"() {
2403
2403
  "use strict";
2404
2404
  __dirname = path8.dirname(fileURLToPath(import.meta.url));
2405
2405
  TEMPLATES_DIR = path8.resolve(__dirname, "..", "templates");
@@ -2472,7 +2472,7 @@ var init_init = __esm({
2472
2472
  }
2473
2473
  });
2474
2474
 
2475
- // packages/server/dist/db/index.js
2475
+ // ../server/dist/db/index.js
2476
2476
  import Database from "better-sqlite3";
2477
2477
  import { drizzle } from "drizzle-orm/better-sqlite3";
2478
2478
  import { eq, and } from "drizzle-orm";
@@ -2561,7 +2561,7 @@ function toggleDisabled(db, itemType, itemId, scope) {
2561
2561
  }
2562
2562
  var SCHEMA_SQL_PATH, dbCache;
2563
2563
  var init_db = __esm({
2564
- "packages/server/dist/db/index.js"() {
2564
+ "../server/dist/db/index.js"() {
2565
2565
  "use strict";
2566
2566
  init_schema();
2567
2567
  init_init();
@@ -2570,7 +2570,7 @@ var init_db = __esm({
2570
2570
  }
2571
2571
  });
2572
2572
 
2573
- // packages/server/dist/agents/session-tools.js
2573
+ // ../server/dist/agents/session-tools.js
2574
2574
  async function callerTeamFor(sm, sessionId) {
2575
2575
  const callerId = sm.sessions.get(sessionId)?.agentId;
2576
2576
  if (!callerId)
@@ -2833,7 +2833,7 @@ ${skillInfo}` : ""
2833
2833
  ];
2834
2834
  }
2835
2835
  var init_session_tools = __esm({
2836
- "packages/server/dist/agents/session-tools.js"() {
2836
+ "../server/dist/agents/session-tools.js"() {
2837
2837
  "use strict";
2838
2838
  init_config();
2839
2839
  init_agent_loader();
@@ -2841,7 +2841,7 @@ var init_session_tools = __esm({
2841
2841
  }
2842
2842
  });
2843
2843
 
2844
- // packages/server/dist/sessions/session-archive.js
2844
+ // ../server/dist/sessions/session-archive.js
2845
2845
  import fsSync3 from "node:fs";
2846
2846
  import fs9 from "node:fs/promises";
2847
2847
  import path10 from "node:path";
@@ -2904,13 +2904,13 @@ async function deleteArchiveSegments(dir, seg) {
2904
2904
  }
2905
2905
  var ARCHIVE_SIZE_THRESHOLD;
2906
2906
  var init_session_archive = __esm({
2907
- "packages/server/dist/sessions/session-archive.js"() {
2907
+ "../server/dist/sessions/session-archive.js"() {
2908
2908
  "use strict";
2909
2909
  ARCHIVE_SIZE_THRESHOLD = 3 * 1024 * 1024;
2910
2910
  }
2911
2911
  });
2912
2912
 
2913
- // packages/server/dist/sessions/session-store.js
2913
+ // ../server/dist/sessions/session-store.js
2914
2914
  import fsSync4 from "node:fs";
2915
2915
  import fs10 from "node:fs/promises";
2916
2916
  import path11 from "node:path";
@@ -3151,13 +3151,13 @@ function findAndUpdateSessionTitle(sessionId, title, projectPath) {
3151
3151
  return false;
3152
3152
  }
3153
3153
  var init_session_store = __esm({
3154
- "packages/server/dist/sessions/session-store.js"() {
3154
+ "../server/dist/sessions/session-store.js"() {
3155
3155
  "use strict";
3156
3156
  init_session_archive();
3157
3157
  }
3158
3158
  });
3159
3159
 
3160
- // packages/server/dist/agents/goal-mode.js
3160
+ // ../server/dist/agents/goal-mode.js
3161
3161
  import fs11 from "node:fs";
3162
3162
  import path12 from "node:path";
3163
3163
  import { createHash } from "node:crypto";
@@ -3629,7 +3629,7 @@ function sweepActiveGoals(host) {
3629
3629
  }
3630
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;
3631
3631
  var init_goal_mode = __esm({
3632
- "packages/server/dist/agents/goal-mode.js"() {
3632
+ "../server/dist/agents/goal-mode.js"() {
3633
3633
  "use strict";
3634
3634
  init_schema();
3635
3635
  init_session_store();
@@ -3650,7 +3650,7 @@ var init_goal_mode = __esm({
3650
3650
  }
3651
3651
  });
3652
3652
 
3653
- // packages/server/dist/agents/workspace-runtime-lock.js
3653
+ // ../server/dist/agents/workspace-runtime-lock.js
3654
3654
  import fs12 from "node:fs";
3655
3655
  import path13 from "node:path";
3656
3656
  function isPidAlive(pid) {
@@ -3698,13 +3698,13 @@ function claimWorkspaceRuntime(workspaceRoot) {
3698
3698
  }
3699
3699
  var RUNTIME_LOCK_FILE;
3700
3700
  var init_workspace_runtime_lock = __esm({
3701
- "packages/server/dist/agents/workspace-runtime-lock.js"() {
3701
+ "../server/dist/agents/workspace-runtime-lock.js"() {
3702
3702
  "use strict";
3703
3703
  RUNTIME_LOCK_FILE = "runtime.lock";
3704
3704
  }
3705
3705
  });
3706
3706
 
3707
- // packages/server/dist/db/evo-db.js
3707
+ // ../server/dist/db/evo-db.js
3708
3708
  import Database2 from "better-sqlite3";
3709
3709
  import { drizzle as drizzle2 } from "drizzle-orm/better-sqlite3";
3710
3710
  import { sqliteTable as sqliteTable2, text as text2, integer as integer2 } from "drizzle-orm/sqlite-core";
@@ -3728,7 +3728,7 @@ function getEvoDb() {
3728
3728
  }
3729
3729
  var evolutionRuns, evolutionApplies, CREATE_SQL, _evoDb;
3730
3730
  var init_evo_db = __esm({
3731
- "packages/server/dist/db/evo-db.js"() {
3731
+ "../server/dist/db/evo-db.js"() {
3732
3732
  "use strict";
3733
3733
  evolutionRuns = sqliteTable2("evolution_runs", {
3734
3734
  id: text2("id").primaryKey(),
@@ -3810,7 +3810,7 @@ CREATE INDEX IF NOT EXISTS idx_evo_applies_archived ON evolution_applies(archive
3810
3810
  }
3811
3811
  });
3812
3812
 
3813
- // packages/server/dist/paths.js
3813
+ // ../server/dist/paths.js
3814
3814
  import path15 from "node:path";
3815
3815
  import { homedir as homedir8 } from "node:os";
3816
3816
  function haloHome() {
@@ -3856,12 +3856,12 @@ function evoApplyLogFile(applyId) {
3856
3856
  return path15.join(evoLogsDir(), `apply-${applyId}.log`);
3857
3857
  }
3858
3858
  var init_paths = __esm({
3859
- "packages/server/dist/paths.js"() {
3859
+ "../server/dist/paths.js"() {
3860
3860
  "use strict";
3861
3861
  }
3862
3862
  });
3863
3863
 
3864
- // packages/server/dist/evolution/enqueue.js
3864
+ // ../server/dist/evolution/enqueue.js
3865
3865
  import fs14 from "node:fs";
3866
3866
  import path16 from "node:path";
3867
3867
  import { homedir as homedir9 } from "node:os";
@@ -4146,20 +4146,20 @@ function enqueueEvoRun(input) {
4146
4146
  return { ok: true, runId, runDir };
4147
4147
  }
4148
4148
  var init_enqueue = __esm({
4149
- "packages/server/dist/evolution/enqueue.js"() {
4149
+ "../server/dist/evolution/enqueue.js"() {
4150
4150
  "use strict";
4151
4151
  init_evo_db();
4152
4152
  init_paths();
4153
4153
  }
4154
4154
  });
4155
4155
 
4156
- // packages/core/dist/workspace/workspace.js
4156
+ // ../core/dist/workspace/workspace.js
4157
4157
  import { readFile, writeFile, mkdir } from "node:fs/promises";
4158
4158
  import { realpathSync } from "node:fs";
4159
4159
  import { resolve, isAbsolute, sep } from "node:path";
4160
4160
  var WorkspaceError, Workspace;
4161
4161
  var init_workspace = __esm({
4162
- "packages/core/dist/workspace/workspace.js"() {
4162
+ "../core/dist/workspace/workspace.js"() {
4163
4163
  "use strict";
4164
4164
  WorkspaceError = class extends Error {
4165
4165
  constructor(message) {
@@ -4204,13 +4204,13 @@ var init_workspace = __esm({
4204
4204
  }
4205
4205
  });
4206
4206
 
4207
- // packages/core/dist/workspace/git-manager.js
4207
+ // ../core/dist/workspace/git-manager.js
4208
4208
  import path17 from "node:path";
4209
4209
  import { promises as fs15 } from "node:fs";
4210
4210
  import simpleGit from "simple-git";
4211
4211
  var GitManagerError, GitManager;
4212
4212
  var init_git_manager = __esm({
4213
- "packages/core/dist/workspace/git-manager.js"() {
4213
+ "../core/dist/workspace/git-manager.js"() {
4214
4214
  "use strict";
4215
4215
  GitManagerError = class extends Error {
4216
4216
  constructor(message) {
@@ -4567,7 +4567,7 @@ var init_git_manager = __esm({
4567
4567
  }
4568
4568
  });
4569
4569
 
4570
- // packages/core/dist/media/mime.js
4570
+ // ../core/dist/media/mime.js
4571
4571
  function normalizeExt(ext) {
4572
4572
  const lower = ext.toLowerCase();
4573
4573
  return lower.startsWith(".") ? lower : `.${lower}`;
@@ -4580,7 +4580,7 @@ function extFromImageMime(mime) {
4580
4580
  }
4581
4581
  var PHOTO_MIME_BY_EXT, SERVE_ONLY_MIME_BY_EXT, IMAGE_MIME_BY_EXT, EXT_BY_PHOTO_MIME, IMAGE_EXTS;
4582
4582
  var init_mime = __esm({
4583
- "packages/core/dist/media/mime.js"() {
4583
+ "../core/dist/media/mime.js"() {
4584
4584
  "use strict";
4585
4585
  PHOTO_MIME_BY_EXT = {
4586
4586
  ".png": "image/png",
@@ -4604,9 +4604,9 @@ var init_mime = __esm({
4604
4604
  }
4605
4605
  });
4606
4606
 
4607
- // packages/core/dist/index.js
4607
+ // ../core/dist/index.js
4608
4608
  var init_dist = __esm({
4609
- "packages/core/dist/index.js"() {
4609
+ "../core/dist/index.js"() {
4610
4610
  "use strict";
4611
4611
  init_workspace();
4612
4612
  init_git_manager();
@@ -4614,7 +4614,7 @@ var init_dist = __esm({
4614
4614
  }
4615
4615
  });
4616
4616
 
4617
- // packages/server/dist/channels/shared/media-store.js
4617
+ // ../server/dist/channels/shared/media-store.js
4618
4618
  import fs16 from "node:fs/promises";
4619
4619
  import path18 from "node:path";
4620
4620
  import { randomBytes } from "node:crypto";
@@ -4675,7 +4675,7 @@ async function saveInboundMedia(params) {
4675
4675
  }
4676
4676
  var VISION_IMAGE_MIME_TYPES, EXT_BY_AV_MIME;
4677
4677
  var init_media_store = __esm({
4678
- "packages/server/dist/channels/shared/media-store.js"() {
4678
+ "../server/dist/channels/shared/media-store.js"() {
4679
4679
  "use strict";
4680
4680
  init_dist();
4681
4681
  VISION_IMAGE_MIME_TYPES = ["image/jpeg", "image/png", "image/gif", "image/webp"];
@@ -4692,7 +4692,7 @@ var init_media_store = __esm({
4692
4692
  }
4693
4693
  });
4694
4694
 
4695
- // packages/server/dist/sessions/ui-log-builder.js
4695
+ // ../server/dist/sessions/ui-log-builder.js
4696
4696
  import { randomUUID } from "node:crypto";
4697
4697
  function createEmptyUIState() {
4698
4698
  return {
@@ -5096,19 +5096,19 @@ function applyEvent(state, event) {
5096
5096
  }
5097
5097
  var msgCounter;
5098
5098
  var init_ui_log_builder = __esm({
5099
- "packages/server/dist/sessions/ui-log-builder.js"() {
5099
+ "../server/dist/sessions/ui-log-builder.js"() {
5100
5100
  "use strict";
5101
5101
  msgCounter = 0;
5102
5102
  }
5103
5103
  });
5104
5104
 
5105
- // packages/server/dist/agents/session-ui-store.js
5105
+ // ../server/dist/agents/session-ui-store.js
5106
5106
  import fsSync5 from "node:fs";
5107
5107
  import path19 from "node:path";
5108
5108
  import { eq as eq3 } from "drizzle-orm";
5109
5109
  var UI_STATE_IDLE_TTL_MS, UI_STATE_SWEEP_PERIOD_MS, SessionUIStore;
5110
5110
  var init_session_ui_store = __esm({
5111
- "packages/server/dist/agents/session-ui-store.js"() {
5111
+ "../server/dist/agents/session-ui-store.js"() {
5112
5112
  "use strict";
5113
5113
  init_broadcast();
5114
5114
  init_schema();
@@ -5622,11 +5622,11 @@ var init_session_ui_store = __esm({
5622
5622
  }
5623
5623
  });
5624
5624
 
5625
- // packages/server/dist/agents/session-query-store.js
5625
+ // ../server/dist/agents/session-query-store.js
5626
5626
  import { eq as eq4, and as and3, isNull as isNull2, desc, lt, gte, inArray } from "drizzle-orm";
5627
5627
  var SessionQueryStore;
5628
5628
  var init_session_query_store = __esm({
5629
- "packages/server/dist/agents/session-query-store.js"() {
5629
+ "../server/dist/agents/session-query-store.js"() {
5630
5630
  "use strict";
5631
5631
  init_schema();
5632
5632
  init_session_store();
@@ -5845,7 +5845,7 @@ var init_session_query_store = __esm({
5845
5845
  }
5846
5846
  });
5847
5847
 
5848
- // packages/server/dist/agents/bedrock-agent.js
5848
+ // ../server/dist/agents/bedrock-agent.js
5849
5849
  import { BedrockRuntimeClient, InvokeModelCommand } from "@aws-sdk/client-bedrock-runtime";
5850
5850
  function effortToBudget(effort, maxTokens) {
5851
5851
  const table = {
@@ -5867,7 +5867,7 @@ function extractRegionFromEndpoint(endpoint) {
5867
5867
  }
5868
5868
  var BedrockAgent;
5869
5869
  var init_bedrock_agent = __esm({
5870
- "packages/server/dist/agents/bedrock-agent.js"() {
5870
+ "../server/dist/agents/bedrock-agent.js"() {
5871
5871
  "use strict";
5872
5872
  init_config();
5873
5873
  init_agent_loop();
@@ -5996,7 +5996,7 @@ var init_bedrock_agent = __esm({
5996
5996
  }
5997
5997
  });
5998
5998
 
5999
- // packages/server/dist/agents/deepseek-agent.js
5999
+ // ../server/dist/agents/deepseek-agent.js
6000
6000
  function safeParse(json) {
6001
6001
  try {
6002
6002
  return JSON.parse(json || "{}");
@@ -6006,7 +6006,7 @@ function safeParse(json) {
6006
6006
  }
6007
6007
  var DeepSeekAgent;
6008
6008
  var init_deepseek_agent = __esm({
6009
- "packages/server/dist/agents/deepseek-agent.js"() {
6009
+ "../server/dist/agents/deepseek-agent.js"() {
6010
6010
  "use strict";
6011
6011
  init_config();
6012
6012
  init_agent_loop();
@@ -6186,7 +6186,7 @@ var init_deepseek_agent = __esm({
6186
6186
  }
6187
6187
  });
6188
6188
 
6189
- // packages/server/dist/agents/kimi-agent.js
6189
+ // ../server/dist/agents/kimi-agent.js
6190
6190
  function safeParse2(json) {
6191
6191
  try {
6192
6192
  return JSON.parse(json || "{}");
@@ -6196,7 +6196,7 @@ function safeParse2(json) {
6196
6196
  }
6197
6197
  var KimiAgent;
6198
6198
  var init_kimi_agent = __esm({
6199
- "packages/server/dist/agents/kimi-agent.js"() {
6199
+ "../server/dist/agents/kimi-agent.js"() {
6200
6200
  "use strict";
6201
6201
  init_config();
6202
6202
  init_agent_loop();
@@ -6392,7 +6392,7 @@ var init_kimi_agent = __esm({
6392
6392
  }
6393
6393
  });
6394
6394
 
6395
- // packages/server/dist/agents/minimax-agent.js
6395
+ // ../server/dist/agents/minimax-agent.js
6396
6396
  function effortToBudget2(effort, maxTokens) {
6397
6397
  const table = {
6398
6398
  low: 2048,
@@ -6409,7 +6409,7 @@ function effortToBudget2(effort, maxTokens) {
6409
6409
  }
6410
6410
  var MiniMaxAgent;
6411
6411
  var init_minimax_agent = __esm({
6412
- "packages/server/dist/agents/minimax-agent.js"() {
6412
+ "../server/dist/agents/minimax-agent.js"() {
6413
6413
  "use strict";
6414
6414
  init_config();
6415
6415
  init_agent_loop();
@@ -6531,7 +6531,7 @@ var init_minimax_agent = __esm({
6531
6531
  }
6532
6532
  });
6533
6533
 
6534
- // packages/server/dist/agents/qwen-agent.js
6534
+ // ../server/dist/agents/qwen-agent.js
6535
6535
  function effortToBudget3(effort, maxTokens) {
6536
6536
  const table = {
6537
6537
  low: 2048,
@@ -6548,7 +6548,7 @@ function effortToBudget3(effort, maxTokens) {
6548
6548
  }
6549
6549
  var QwenAgent;
6550
6550
  var init_qwen_agent = __esm({
6551
- "packages/server/dist/agents/qwen-agent.js"() {
6551
+ "../server/dist/agents/qwen-agent.js"() {
6552
6552
  "use strict";
6553
6553
  init_config();
6554
6554
  init_agent_loop();
@@ -6666,7 +6666,7 @@ var init_qwen_agent = __esm({
6666
6666
  }
6667
6667
  });
6668
6668
 
6669
- // packages/server/dist/agents/hunyuan-agent.js
6669
+ // ../server/dist/agents/hunyuan-agent.js
6670
6670
  function safeParse3(json) {
6671
6671
  try {
6672
6672
  return JSON.parse(json || "{}");
@@ -6676,7 +6676,7 @@ function safeParse3(json) {
6676
6676
  }
6677
6677
  var HunyuanAgent;
6678
6678
  var init_hunyuan_agent = __esm({
6679
- "packages/server/dist/agents/hunyuan-agent.js"() {
6679
+ "../server/dist/agents/hunyuan-agent.js"() {
6680
6680
  "use strict";
6681
6681
  init_config();
6682
6682
  init_agent_loop();
@@ -6847,7 +6847,7 @@ var init_hunyuan_agent = __esm({
6847
6847
  }
6848
6848
  });
6849
6849
 
6850
- // packages/server/dist/agents/doubao-agent.js
6850
+ // ../server/dist/agents/doubao-agent.js
6851
6851
  function safeParse4(json) {
6852
6852
  try {
6853
6853
  return JSON.parse(json || "{}");
@@ -6857,7 +6857,7 @@ function safeParse4(json) {
6857
6857
  }
6858
6858
  var DoubaoAgent;
6859
6859
  var init_doubao_agent = __esm({
6860
- "packages/server/dist/agents/doubao-agent.js"() {
6860
+ "../server/dist/agents/doubao-agent.js"() {
6861
6861
  "use strict";
6862
6862
  init_config();
6863
6863
  init_agent_loop();
@@ -7028,7 +7028,7 @@ var init_doubao_agent = __esm({
7028
7028
  }
7029
7029
  });
7030
7030
 
7031
- // packages/server/dist/agents/openai-agent.js
7031
+ // ../server/dist/agents/openai-agent.js
7032
7032
  function safeParse5(json) {
7033
7033
  try {
7034
7034
  return JSON.parse(json || "{}");
@@ -7038,7 +7038,7 @@ function safeParse5(json) {
7038
7038
  }
7039
7039
  var OpenAIAgent;
7040
7040
  var init_openai_agent = __esm({
7041
- "packages/server/dist/agents/openai-agent.js"() {
7041
+ "../server/dist/agents/openai-agent.js"() {
7042
7042
  "use strict";
7043
7043
  init_config();
7044
7044
  init_agent_loop();
@@ -7210,7 +7210,7 @@ var init_openai_agent = __esm({
7210
7210
  }
7211
7211
  });
7212
7212
 
7213
- // packages/server/dist/agents/mantle-agent.js
7213
+ // ../server/dist/agents/mantle-agent.js
7214
7214
  import { SignatureV4 } from "@smithy/signature-v4";
7215
7215
  import { Sha256 } from "@aws-crypto/sha256-js";
7216
7216
  import { defaultProvider } from "@aws-sdk/credential-provider-node";
@@ -7227,7 +7227,7 @@ function safeParse6(json) {
7227
7227
  }
7228
7228
  var MantleAgent;
7229
7229
  var init_mantle_agent = __esm({
7230
- "packages/server/dist/agents/mantle-agent.js"() {
7230
+ "../server/dist/agents/mantle-agent.js"() {
7231
7231
  "use strict";
7232
7232
  init_config();
7233
7233
  init_agent_loop();
@@ -7446,10 +7446,10 @@ var init_mantle_agent = __esm({
7446
7446
  }
7447
7447
  });
7448
7448
 
7449
- // packages/server/dist/agents/anthropic-agent.js
7449
+ // ../server/dist/agents/anthropic-agent.js
7450
7450
  var AnthropicAgent;
7451
7451
  var init_anthropic_agent = __esm({
7452
- "packages/server/dist/agents/anthropic-agent.js"() {
7452
+ "../server/dist/agents/anthropic-agent.js"() {
7453
7453
  "use strict";
7454
7454
  init_config();
7455
7455
  init_agent_loop();
@@ -7572,7 +7572,7 @@ var init_anthropic_agent = __esm({
7572
7572
  }
7573
7573
  });
7574
7574
 
7575
- // packages/server/dist/agents/model-runtime.js
7575
+ // ../server/dist/agents/model-runtime.js
7576
7576
  function createModelRuntime(providerId, cfg) {
7577
7577
  switch (providerId) {
7578
7578
  case "aws-bedrock-claude-invoke":
@@ -7707,7 +7707,7 @@ function createModelRuntime(providerId, cfg) {
7707
7707
  }
7708
7708
  }
7709
7709
  var init_model_runtime = __esm({
7710
- "packages/server/dist/agents/model-runtime.js"() {
7710
+ "../server/dist/agents/model-runtime.js"() {
7711
7711
  "use strict";
7712
7712
  init_bedrock_agent();
7713
7713
  init_deepseek_agent();
@@ -7722,7 +7722,7 @@ var init_model_runtime = __esm({
7722
7722
  }
7723
7723
  });
7724
7724
 
7725
- // packages/server/dist/tools/sandbox.js
7725
+ // ../server/dist/tools/sandbox.js
7726
7726
  import { exec, execFile, spawn as spawn2 } from "node:child_process";
7727
7727
  import { promisify } from "node:util";
7728
7728
  import path20 from "node:path";
@@ -8197,7 +8197,7 @@ async function sandboxReaddir(dirPath, opts) {
8197
8197
  }
8198
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;
8199
8199
  var init_sandbox = __esm({
8200
- "packages/server/dist/tools/sandbox.js"() {
8200
+ "../server/dist/tools/sandbox.js"() {
8201
8201
  "use strict";
8202
8202
  execAsync = promisify(exec);
8203
8203
  execFileAsync = promisify(execFile);
@@ -8246,7 +8246,7 @@ var init_sandbox = __esm({
8246
8246
  }
8247
8247
  });
8248
8248
 
8249
- // packages/server/dist/tools/workspace-tools.js
8249
+ // ../server/dist/tools/workspace-tools.js
8250
8250
  import fs17 from "node:fs/promises";
8251
8251
  import path21 from "node:path";
8252
8252
  import crypto from "node:crypto";
@@ -8963,7 +8963,7 @@ function imageDimensions(buf, mediaType) {
8963
8963
  }
8964
8964
  var SKIP_DIRS, GLOB_MAX_RESULTS, HOME2, PARAMS_PATTERN, ENV_PATTERN3;
8965
8965
  var init_workspace_tools = __esm({
8966
- "packages/server/dist/tools/workspace-tools.js"() {
8966
+ "../server/dist/tools/workspace-tools.js"() {
8967
8967
  "use strict";
8968
8968
  init_config();
8969
8969
  init_sandbox();
@@ -8979,7 +8979,7 @@ var init_workspace_tools = __esm({
8979
8979
  }
8980
8980
  });
8981
8981
 
8982
- // packages/server/dist/tools/draft-tool.js
8982
+ // ../server/dist/tools/draft-tool.js
8983
8983
  function createDraftTool() {
8984
8984
  let drafts = 0;
8985
8985
  const tool = {
@@ -9014,7 +9014,7 @@ Error: draft requires non-empty \`content\` \u2014 put your full draft answer th
9014
9014
  }
9015
9015
  var MAX_DRAFTS, REVIEW_CHECKLIST;
9016
9016
  var init_draft_tool = __esm({
9017
- "packages/server/dist/tools/draft-tool.js"() {
9017
+ "../server/dist/tools/draft-tool.js"() {
9018
9018
  "use strict";
9019
9019
  init_agent_loop();
9020
9020
  MAX_DRAFTS = 3;
@@ -9028,7 +9028,7 @@ If the draft clears all three, write the final answer now. If not, fix it (gathe
9028
9028
  }
9029
9029
  });
9030
9030
 
9031
- // packages/server/dist/prompts/system-prompts.js
9031
+ // ../server/dist/prompts/system-prompts.js
9032
9032
  import fs18 from "node:fs/promises";
9033
9033
  import path22 from "node:path";
9034
9034
  import { homedir as homedir12 } from "node:os";
@@ -9114,17 +9114,17 @@ async function loadSystemPrompts(workspaceRoot) {
9114
9114
  }
9115
9115
  var GLOBAL_PROMPTS_DIR;
9116
9116
  var init_system_prompts = __esm({
9117
- "packages/server/dist/prompts/system-prompts.js"() {
9117
+ "../server/dist/prompts/system-prompts.js"() {
9118
9118
  "use strict";
9119
9119
  GLOBAL_PROMPTS_DIR = path22.join(homedir12(), ".halo", "global", "prompts");
9120
9120
  }
9121
9121
  });
9122
9122
 
9123
- // packages/server/dist/agents/session-agent-builder.js
9123
+ // ../server/dist/agents/session-agent-builder.js
9124
9124
  import path23 from "node:path";
9125
9125
  var SessionAgentBuilder;
9126
9126
  var init_session_agent_builder = __esm({
9127
- "packages/server/dist/agents/session-agent-builder.js"() {
9127
+ "../server/dist/agents/session-agent-builder.js"() {
9128
9128
  "use strict";
9129
9129
  init_model_runtime();
9130
9130
  init_workspace_tools();
@@ -9526,10 +9526,10 @@ do delegate, say so in one line and keep going.`;
9526
9526
  }
9527
9527
  });
9528
9528
 
9529
- // packages/server/dist/commands/registry.js
9529
+ // ../server/dist/commands/registry.js
9530
9530
  var CommandRegistry;
9531
9531
  var init_registry = __esm({
9532
- "packages/server/dist/commands/registry.js"() {
9532
+ "../server/dist/commands/registry.js"() {
9533
9533
  "use strict";
9534
9534
  CommandRegistry = class {
9535
9535
  descriptors = /* @__PURE__ */ new Map();
@@ -9543,13 +9543,13 @@ var init_registry = __esm({
9543
9543
  }
9544
9544
  });
9545
9545
 
9546
- // packages/server/dist/commands/index.js
9546
+ // ../server/dist/commands/index.js
9547
9547
  function builtinCommandNames() {
9548
9548
  return commandRegistry.listDescriptors().filter((d) => d.source === "builtin").map((d) => d.name);
9549
9549
  }
9550
9550
  var commandRegistry;
9551
9551
  var init_commands = __esm({
9552
- "packages/server/dist/commands/index.js"() {
9552
+ "../server/dist/commands/index.js"() {
9553
9553
  "use strict";
9554
9554
  init_registry();
9555
9555
  commandRegistry = new CommandRegistry();
@@ -9599,7 +9599,7 @@ var init_commands = __esm({
9599
9599
  }
9600
9600
  });
9601
9601
 
9602
- // packages/server/dist/channels/shared/i18n.js
9602
+ // ../server/dist/channels/shared/i18n.js
9603
9603
  function getLang(account) {
9604
9604
  const v = account.language;
9605
9605
  return v === "en" || v === "zh" ? v : "en";
@@ -9618,7 +9618,7 @@ function t(key, lang, params) {
9618
9618
  }
9619
9619
  var messages;
9620
9620
  var init_i18n = __esm({
9621
- "packages/server/dist/channels/shared/i18n.js"() {
9621
+ "../server/dist/channels/shared/i18n.js"() {
9622
9622
  "use strict";
9623
9623
  messages = {
9624
9624
  // ── /help ──
@@ -9787,7 +9787,7 @@ var init_i18n = __esm({
9787
9787
  }
9788
9788
  });
9789
9789
 
9790
- // packages/server/dist/commands/skill-command.js
9790
+ // ../server/dist/commands/skill-command.js
9791
9791
  import fs19 from "node:fs/promises";
9792
9792
  import path24 from "node:path";
9793
9793
  async function scanDir(dir) {
@@ -9929,7 +9929,7 @@ ${body}`;
9929
9929
  }
9930
9930
  var cachedEntries;
9931
9931
  var init_skill_command = __esm({
9932
- "packages/server/dist/commands/skill-command.js"() {
9932
+ "../server/dist/commands/skill-command.js"() {
9933
9933
  "use strict";
9934
9934
  init_commands();
9935
9935
  init_agent_loader();
@@ -9940,7 +9940,7 @@ var init_skill_command = __esm({
9940
9940
  }
9941
9941
  });
9942
9942
 
9943
- // packages/server/dist/agents/session-skill-commands.js
9943
+ // ../server/dist/agents/session-skill-commands.js
9944
9944
  import { eq as eq5 } from "drizzle-orm";
9945
9945
  function commandVisibilityGate(d) {
9946
9946
  if (!d.verbs || d.verbs.length === 0)
@@ -9957,7 +9957,7 @@ function commandVisibilityGate(d) {
9957
9957
  }
9958
9958
  var VIS_RANK, SessionSkillCommands;
9959
9959
  var init_session_skill_commands = __esm({
9960
- "packages/server/dist/agents/session-skill-commands.js"() {
9960
+ "../server/dist/agents/session-skill-commands.js"() {
9961
9961
  "use strict";
9962
9962
  init_db();
9963
9963
  init_schema();
@@ -10024,12 +10024,12 @@ var init_session_skill_commands = __esm({
10024
10024
  }
10025
10025
  });
10026
10026
 
10027
- // packages/server/dist/agents/session-state-store.js
10027
+ // ../server/dist/agents/session-state-store.js
10028
10028
  import fsSync6 from "node:fs";
10029
10029
  import path25 from "node:path";
10030
10030
  var SessionStateStore;
10031
10031
  var init_session_state_store = __esm({
10032
- "packages/server/dist/agents/session-state-store.js"() {
10032
+ "../server/dist/agents/session-state-store.js"() {
10033
10033
  "use strict";
10034
10034
  init_session_store();
10035
10035
  SessionStateStore = class {
@@ -10092,7 +10092,7 @@ var init_session_state_store = __esm({
10092
10092
  }
10093
10093
  });
10094
10094
 
10095
- // packages/server/dist/agents/session-manager.js
10095
+ // ../server/dist/agents/session-manager.js
10096
10096
  import fsSync7 from "node:fs";
10097
10097
  import path26 from "node:path";
10098
10098
  import { eq as eq6, and as and4, isNull as isNull3, isNotNull as isNotNull2 } from "drizzle-orm";
@@ -10173,7 +10173,7 @@ function generateSessionId() {
10173
10173
  }
10174
10174
  var SessionManager;
10175
10175
  var init_session_manager = __esm({
10176
- "packages/server/dist/agents/session-manager.js"() {
10176
+ "../server/dist/agents/session-manager.js"() {
10177
10177
  "use strict";
10178
10178
  init_md_loader();
10179
10179
  init_config();
@@ -10790,7 +10790,7 @@ var init_session_manager = __esm({
10790
10790
  session.output += event.text ?? "";
10791
10791
  if (event.final)
10792
10792
  session.finalOutput += event.text ?? "";
10793
- 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 });
10794
10794
  break;
10795
10795
  }
10796
10796
  case "thinking": {
@@ -12164,11 +12164,11 @@ ${q.text}` : q.text);
12164
12164
  }
12165
12165
  });
12166
12166
 
12167
- // packages/server/dist/agents/session-manager-registry.js
12167
+ // ../server/dist/agents/session-manager-registry.js
12168
12168
  import fs20 from "node:fs";
12169
12169
  var SessionManagerRegistry;
12170
12170
  var init_session_manager_registry = __esm({
12171
- "packages/server/dist/agents/session-manager-registry.js"() {
12171
+ "../server/dist/agents/session-manager-registry.js"() {
12172
12172
  "use strict";
12173
12173
  init_session_manager();
12174
12174
  init_init();
@@ -12223,7 +12223,7 @@ var init_session_manager_registry = __esm({
12223
12223
  }
12224
12224
  });
12225
12225
 
12226
- // packages/server/dist/logger.js
12226
+ // ../server/dist/logger.js
12227
12227
  import fs21 from "node:fs";
12228
12228
  import path27 from "node:path";
12229
12229
  import { homedir as homedir13 } from "node:os";
@@ -12323,7 +12323,7 @@ function initLogger() {
12323
12323
  }
12324
12324
  var LOG_FILENAME, logDir, logFile, currentSize, LEVEL_ORDER;
12325
12325
  var init_logger = __esm({
12326
- "packages/server/dist/logger.js"() {
12326
+ "../server/dist/logger.js"() {
12327
12327
  "use strict";
12328
12328
  init_config();
12329
12329
  LOG_FILENAME = "server.log";
@@ -12334,7 +12334,7 @@ var init_logger = __esm({
12334
12334
  }
12335
12335
  });
12336
12336
 
12337
- // packages/server/dist/channels/shared/commands.js
12337
+ // ../server/dist/channels/shared/commands.js
12338
12338
  import fs22 from "node:fs";
12339
12339
  import path28 from "node:path";
12340
12340
  import os from "node:os";
@@ -13060,7 +13060,7 @@ function execWsSwitch(ctx, arg) {
13060
13060
  }
13061
13061
  var ALIASES_FILE, aliasCache, CHANNEL_LIST_LIMIT, DISPATCH_COMMANDS, NOT_ROUTED, SUBCOMMAND_ROUTES, RANK;
13062
13062
  var init_commands2 = __esm({
13063
- "packages/server/dist/channels/shared/commands.js"() {
13063
+ "../server/dist/channels/shared/commands.js"() {
13064
13064
  "use strict";
13065
13065
  init_agent_loader();
13066
13066
  init_init();
@@ -13136,7 +13136,7 @@ var init_commands2 = __esm({
13136
13136
  }
13137
13137
  });
13138
13138
 
13139
- // packages/cli/src/harness.ts
13139
+ // src/harness.ts
13140
13140
  var harness_exports = {};
13141
13141
  __export(harness_exports, {
13142
13142
  createHarness: () => createHarness,
@@ -13377,7 +13377,7 @@ async function createHarness(opts) {
13377
13377
  }
13378
13378
  var SESSION_PREFIX, USER_ID;
13379
13379
  var init_harness = __esm({
13380
- "packages/cli/src/harness.ts"() {
13380
+ "src/harness.ts"() {
13381
13381
  "use strict";
13382
13382
  init_session_manager();
13383
13383
  init_session_manager_registry();
@@ -13394,7 +13394,7 @@ var init_harness = __esm({
13394
13394
  }
13395
13395
  });
13396
13396
 
13397
- // packages/server/dist/middleware/password-hash.js
13397
+ // ../server/dist/middleware/password-hash.js
13398
13398
  var password_hash_exports = {};
13399
13399
  __export(password_hash_exports, {
13400
13400
  generateJwtSecret: () => generateJwtSecret,
@@ -13444,7 +13444,7 @@ function generateJwtSecret() {
13444
13444
  }
13445
13445
  var scryptAsync, COST, KEY_LEN;
13446
13446
  var init_password_hash = __esm({
13447
- "packages/server/dist/middleware/password-hash.js"() {
13447
+ "../server/dist/middleware/password-hash.js"() {
13448
13448
  "use strict";
13449
13449
  scryptAsync = promisify2(crypto2.scrypt);
13450
13450
  COST = { N: 16384, r: 8, p: 1 };
@@ -13452,7 +13452,7 @@ var init_password_hash = __esm({
13452
13452
  }
13453
13453
  });
13454
13454
 
13455
- // packages/server/dist/setup-config.js
13455
+ // ../server/dist/setup-config.js
13456
13456
  var setup_config_exports = {};
13457
13457
  __export(setup_config_exports, {
13458
13458
  configLeafSet: () => configLeafSet,
@@ -13493,13 +13493,13 @@ function configLeafSet(dotPath) {
13493
13493
  }
13494
13494
  var CONFIG_PATH;
13495
13495
  var init_setup_config = __esm({
13496
- "packages/server/dist/setup-config.js"() {
13496
+ "../server/dist/setup-config.js"() {
13497
13497
  "use strict";
13498
13498
  CONFIG_PATH = path30.join(homedir14(), ".halo", "secrets", "config.yaml");
13499
13499
  }
13500
13500
  });
13501
13501
 
13502
- // packages/server/dist/setup-settings.js
13502
+ // ../server/dist/setup-settings.js
13503
13503
  var setup_settings_exports = {};
13504
13504
  __export(setup_settings_exports, {
13505
13505
  maskSecret: () => maskSecret,
@@ -13578,13 +13578,13 @@ function maskSecret(value) {
13578
13578
  }
13579
13579
  var SETTINGS_PATH2;
13580
13580
  var init_setup_settings = __esm({
13581
- "packages/server/dist/setup-settings.js"() {
13581
+ "../server/dist/setup-settings.js"() {
13582
13582
  "use strict";
13583
13583
  SETTINGS_PATH2 = path31.join(homedir15(), ".halo", "secrets", "settings.yaml");
13584
13584
  }
13585
13585
  });
13586
13586
 
13587
- // packages/server/dist/setup-providers.js
13587
+ // ../server/dist/setup-providers.js
13588
13588
  var setup_providers_exports = {};
13589
13589
  __export(setup_providers_exports, {
13590
13590
  AWS_CREDENTIAL_CHAIN_PROVIDER: () => AWS_CREDENTIAL_CHAIN_PROVIDER,
@@ -13790,7 +13790,7 @@ function listRequiredSkillsWithSecrets() {
13790
13790
  }
13791
13791
  var AWS_CREDENTIAL_CHAIN_PROVIDER, REBIND_BUILTIN_AGENT_IDS, GLOBAL_AGENTS_DIR3;
13792
13792
  var init_setup_providers = __esm({
13793
- "packages/server/dist/setup-providers.js"() {
13793
+ "../server/dist/setup-providers.js"() {
13794
13794
  "use strict";
13795
13795
  init_init();
13796
13796
  init_setup_settings();
@@ -13800,7 +13800,7 @@ var init_setup_providers = __esm({
13800
13800
  }
13801
13801
  });
13802
13802
 
13803
- // packages/cli/src/setup-bind-provider.ts
13803
+ // src/setup-bind-provider.ts
13804
13804
  var setup_bind_provider_exports = {};
13805
13805
  __export(setup_bind_provider_exports, {
13806
13806
  AWS_CHAIN_PROVIDER: () => AWS_CHAIN_PROVIDER,
@@ -13840,14 +13840,14 @@ function buildBindProviderPlan(configured, currentProvider, currentProviderHasKe
13840
13840
  }
13841
13841
  var AWS_CHAIN_PROVIDER, KEEP_CURRENT;
13842
13842
  var init_setup_bind_provider = __esm({
13843
- "packages/cli/src/setup-bind-provider.ts"() {
13843
+ "src/setup-bind-provider.ts"() {
13844
13844
  "use strict";
13845
13845
  AWS_CHAIN_PROVIDER = "aws-bedrock-claude-invoke";
13846
13846
  KEEP_CURRENT = "__keep__";
13847
13847
  }
13848
13848
  });
13849
13849
 
13850
- // packages/cli/src/setup-prompts.ts
13850
+ // src/setup-prompts.ts
13851
13851
  var setup_prompts_exports = {};
13852
13852
  __export(setup_prompts_exports, {
13853
13853
  promptMultiSelect: () => promptMultiSelect,
@@ -14133,12 +14133,12 @@ function promptMultiSelectRich(question, options) {
14133
14133
  });
14134
14134
  }
14135
14135
  var init_setup_prompts = __esm({
14136
- "packages/cli/src/setup-prompts.ts"() {
14136
+ "src/setup-prompts.ts"() {
14137
14137
  "use strict";
14138
14138
  }
14139
14139
  });
14140
14140
 
14141
- // packages/cli/src/upgrade-verify.ts
14141
+ // src/upgrade-verify.ts
14142
14142
  var upgrade_verify_exports = {};
14143
14143
  __export(upgrade_verify_exports, {
14144
14144
  ALLOW_SCRIPTS: () => ALLOW_SCRIPTS,
@@ -14163,7 +14163,7 @@ function verifyNativeModules(pkgRoot) {
14163
14163
  }
14164
14164
  var NATIVE_MODULE_SMOKES, ALLOW_SCRIPTS;
14165
14165
  var init_upgrade_verify = __esm({
14166
- "packages/cli/src/upgrade-verify.ts"() {
14166
+ "src/upgrade-verify.ts"() {
14167
14167
  "use strict";
14168
14168
  NATIVE_MODULE_SMOKES = [
14169
14169
  { name: "better-sqlite3", smoke: "new (require(process.argv[1]))(':memory:')" },
@@ -14173,7 +14173,7 @@ var init_upgrade_verify = __esm({
14173
14173
  }
14174
14174
  });
14175
14175
 
14176
- // packages/cli/src/render-md.ts
14176
+ // src/render-md.ts
14177
14177
  import { marked } from "marked";
14178
14178
  import { markedTerminal } from "marked-terminal";
14179
14179
  function renderMarkdown(text5) {
@@ -14181,14 +14181,14 @@ function renderMarkdown(text5) {
14181
14181
  return rendered.replace(/\n{3,}/g, "\n\n").trimEnd();
14182
14182
  }
14183
14183
  var init_render_md = __esm({
14184
- "packages/cli/src/render-md.ts"() {
14184
+ "src/render-md.ts"() {
14185
14185
  "use strict";
14186
14186
  marked.use(markedTerminal({ reflowText: true, width: Math.min(process.stdout.columns || 80, 120) }));
14187
14187
  marked.use({ breaks: true });
14188
14188
  }
14189
14189
  });
14190
14190
 
14191
- // packages/cli/src/resolve-refs.ts
14191
+ // src/resolve-refs.ts
14192
14192
  import fs28 from "node:fs";
14193
14193
  import path34 from "node:path";
14194
14194
  function resolveRefs(input, workspace) {
@@ -14267,7 +14267,7 @@ ${content}
14267
14267
  }
14268
14268
  var MAX_FILE_BYTES, MAX_IMAGE_BYTES, REF_PATTERN;
14269
14269
  var init_resolve_refs = __esm({
14270
- "packages/cli/src/resolve-refs.ts"() {
14270
+ "src/resolve-refs.ts"() {
14271
14271
  "use strict";
14272
14272
  init_dist();
14273
14273
  MAX_FILE_BYTES = 100 * 1024;
@@ -14276,7 +14276,7 @@ var init_resolve_refs = __esm({
14276
14276
  }
14277
14277
  });
14278
14278
 
14279
- // packages/cli/src/format-usage.ts
14279
+ // src/format-usage.ts
14280
14280
  function fmtK(n) {
14281
14281
  return `${(n / 1e3).toFixed(1)}K`;
14282
14282
  }
@@ -14320,7 +14320,7 @@ function formatUsageLine(event) {
14320
14320
  }
14321
14321
  var ANSI;
14322
14322
  var init_format_usage = __esm({
14323
- "packages/cli/src/format-usage.ts"() {
14323
+ "src/format-usage.ts"() {
14324
14324
  "use strict";
14325
14325
  ANSI = {
14326
14326
  reset: "\x1B[0m",
@@ -14334,7 +14334,7 @@ var init_format_usage = __esm({
14334
14334
  }
14335
14335
  });
14336
14336
 
14337
- // packages/cli/src/tui/components/banner.tsx
14337
+ // src/tui/components/banner.tsx
14338
14338
  import { Box, Text } from "ink";
14339
14339
  import { jsx } from "react/jsx-runtime";
14340
14340
  function Banner() {
@@ -14342,7 +14342,7 @@ function Banner() {
14342
14342
  }
14343
14343
  var LINES, COLORS;
14344
14344
  var init_banner = __esm({
14345
- "packages/cli/src/tui/components/banner.tsx"() {
14345
+ "src/tui/components/banner.tsx"() {
14346
14346
  "use strict";
14347
14347
  LINES = [
14348
14348
  " \u2588\u2588\u2557 \u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2557 ",
@@ -14356,7 +14356,7 @@ var init_banner = __esm({
14356
14356
  }
14357
14357
  });
14358
14358
 
14359
- // packages/cli/src/tui/components/messages.tsx
14359
+ // src/tui/components/messages.tsx
14360
14360
  import { Box as Box2, Static, Text as Text2 } from "ink";
14361
14361
  import { jsx as jsx2, jsxs } from "react/jsx-runtime";
14362
14362
  function Messages({ blocks }) {
@@ -14414,7 +14414,7 @@ function Block({ block }) {
14414
14414
  }
14415
14415
  var BANNER_ID;
14416
14416
  var init_messages = __esm({
14417
- "packages/cli/src/tui/components/messages.tsx"() {
14417
+ "src/tui/components/messages.tsx"() {
14418
14418
  "use strict";
14419
14419
  init_format_usage();
14420
14420
  init_banner();
@@ -14422,7 +14422,7 @@ var init_messages = __esm({
14422
14422
  }
14423
14423
  });
14424
14424
 
14425
- // packages/cli/src/tui/terminal-text.ts
14425
+ // src/tui/terminal-text.ts
14426
14426
  function sanitizeToolOutput(s) {
14427
14427
  return s.replace(ESCAPE_SEQ_RE, "").replace(/\r\n?/g, "\n").replace(/\t/g, " ").replace(C0_RE, "");
14428
14428
  }
@@ -14452,14 +14452,14 @@ function tailByRows(text5, cols, maxRows) {
14452
14452
  }
14453
14453
  var ESCAPE_SEQ_RE, C0_RE;
14454
14454
  var init_terminal_text = __esm({
14455
- "packages/cli/src/tui/terminal-text.ts"() {
14455
+ "src/tui/terminal-text.ts"() {
14456
14456
  "use strict";
14457
14457
  ESCAPE_SEQ_RE = /\x1b\][^\x07\n]*\x07|\x1b\[[0-9;?]*[ -/]*[@-~]|\x1b[@-Z\\-_]/g;
14458
14458
  C0_RE = /[\x00-\x09\x0b-\x1f\x7f]/g;
14459
14459
  }
14460
14460
  });
14461
14461
 
14462
- // packages/cli/src/tui/components/streaming.tsx
14462
+ // src/tui/components/streaming.tsx
14463
14463
  import { useEffect, useState } from "react";
14464
14464
  import { Box as Box3, Text as Text3, useStdout } from "ink";
14465
14465
  import Spinner from "ink-spinner";
@@ -14512,13 +14512,13 @@ function Streaming({ spinnerLabel, liveText, liveThinking, activeSubs, turnStart
14512
14512
  ] });
14513
14513
  }
14514
14514
  var init_streaming = __esm({
14515
- "packages/cli/src/tui/components/streaming.tsx"() {
14515
+ "src/tui/components/streaming.tsx"() {
14516
14516
  "use strict";
14517
14517
  init_terminal_text();
14518
14518
  }
14519
14519
  });
14520
14520
 
14521
- // packages/cli/src/tui/history.ts
14521
+ // src/tui/history.ts
14522
14522
  import fs29 from "node:fs";
14523
14523
  import path35 from "node:path";
14524
14524
  import os2 from "node:os";
@@ -14544,14 +14544,14 @@ function appendHistory(entry) {
14544
14544
  }
14545
14545
  var HISTORY_FILE, MAX_ENTRIES;
14546
14546
  var init_history = __esm({
14547
- "packages/cli/src/tui/history.ts"() {
14547
+ "src/tui/history.ts"() {
14548
14548
  "use strict";
14549
14549
  HISTORY_FILE = path35.join(os2.homedir(), ".halo", "global", "tui-history.json");
14550
14550
  MAX_ENTRIES = 100;
14551
14551
  }
14552
14552
  });
14553
14553
 
14554
- // packages/cli/src/tui/components/status-bar.tsx
14554
+ // src/tui/components/status-bar.tsx
14555
14555
  import { Box as Box4, Text as Text4 } from "ink";
14556
14556
  import { Fragment, jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
14557
14557
  function shortModel(modelId) {
@@ -14587,12 +14587,12 @@ function StatusBar({ agentName, modelId, contextPercent, workspace, sessionId, v
14587
14587
  ] });
14588
14588
  }
14589
14589
  var init_status_bar = __esm({
14590
- "packages/cli/src/tui/components/status-bar.tsx"() {
14590
+ "src/tui/components/status-bar.tsx"() {
14591
14591
  "use strict";
14592
14592
  }
14593
14593
  });
14594
14594
 
14595
- // packages/cli/src/tui/components/slash-suggest.tsx
14595
+ // src/tui/components/slash-suggest.tsx
14596
14596
  import { Box as Box5, Text as Text5 } from "ink";
14597
14597
  import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
14598
14598
  function SlashSuggest({ items, selectedIdx, maxWidth = 80 }) {
@@ -14619,12 +14619,12 @@ function SlashSuggest({ items, selectedIdx, maxWidth = 80 }) {
14619
14619
  ] });
14620
14620
  }
14621
14621
  var init_slash_suggest = __esm({
14622
- "packages/cli/src/tui/components/slash-suggest.tsx"() {
14622
+ "src/tui/components/slash-suggest.tsx"() {
14623
14623
  "use strict";
14624
14624
  }
14625
14625
  });
14626
14626
 
14627
- // packages/cli/src/tui/components/path-suggest.tsx
14627
+ // src/tui/components/path-suggest.tsx
14628
14628
  import { Box as Box6, Text as Text6 } from "ink";
14629
14629
  import { jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
14630
14630
  function PathSuggest({ items, selectedIdx, cwdLabel }) {
@@ -14651,12 +14651,12 @@ function PathSuggest({ items, selectedIdx, cwdLabel }) {
14651
14651
  ] });
14652
14652
  }
14653
14653
  var init_path_suggest = __esm({
14654
- "packages/cli/src/tui/components/path-suggest.tsx"() {
14654
+ "src/tui/components/path-suggest.tsx"() {
14655
14655
  "use strict";
14656
14656
  }
14657
14657
  });
14658
14658
 
14659
- // packages/cli/src/tui/path-suggest-engine.ts
14659
+ // src/tui/path-suggest-engine.ts
14660
14660
  import fs30 from "node:fs";
14661
14661
  import path36 from "node:path";
14662
14662
  function detectActiveRef(value) {
@@ -14742,13 +14742,13 @@ function applyPathPick(value, ref, pick) {
14742
14742
  return `${before}@${kind} ${path66}`;
14743
14743
  }
14744
14744
  var init_path_suggest_engine = __esm({
14745
- "packages/cli/src/tui/path-suggest-engine.ts"() {
14745
+ "src/tui/path-suggest-engine.ts"() {
14746
14746
  "use strict";
14747
14747
  init_dist();
14748
14748
  }
14749
14749
  });
14750
14750
 
14751
- // packages/cli/src/tui/line-editor.ts
14751
+ // src/tui/line-editor.ts
14752
14752
  function toGraphemes(s) {
14753
14753
  if (s === "") return [];
14754
14754
  return [...segmenter.segment(s)].map((seg) => seg.segment);
@@ -14802,13 +14802,13 @@ function deleteToEnd(e) {
14802
14802
  }
14803
14803
  var segmenter;
14804
14804
  var init_line_editor = __esm({
14805
- "packages/cli/src/tui/line-editor.ts"() {
14805
+ "src/tui/line-editor.ts"() {
14806
14806
  "use strict";
14807
14807
  segmenter = new Intl.Segmenter();
14808
14808
  }
14809
14809
  });
14810
14810
 
14811
- // packages/cli/src/tui/components/text-input.tsx
14811
+ // src/tui/components/text-input.tsx
14812
14812
  import { Text as Text7 } from "ink";
14813
14813
  import { jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
14814
14814
  function TextInputView({ value, cursor, placeholder }) {
@@ -14833,13 +14833,13 @@ function TextInputView({ value, cursor, placeholder }) {
14833
14833
  ] });
14834
14834
  }
14835
14835
  var init_text_input = __esm({
14836
- "packages/cli/src/tui/components/text-input.tsx"() {
14836
+ "src/tui/components/text-input.tsx"() {
14837
14837
  "use strict";
14838
14838
  init_line_editor();
14839
14839
  }
14840
14840
  });
14841
14841
 
14842
- // packages/cli/src/tui/components/input-box.tsx
14842
+ // src/tui/components/input-box.tsx
14843
14843
  import { useState as useState2, useEffect as useEffect2, useMemo, useRef } from "react";
14844
14844
  import { Box as Box7, Text as Text8, useInput, usePaste } from "ink";
14845
14845
  import { jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
@@ -15090,7 +15090,7 @@ function InputBox({ enabled, placeholder, history, onSubmit, hint, commands = []
15090
15090
  ] });
15091
15091
  }
15092
15092
  var init_input_box = __esm({
15093
- "packages/cli/src/tui/components/input-box.tsx"() {
15093
+ "src/tui/components/input-box.tsx"() {
15094
15094
  "use strict";
15095
15095
  init_slash_suggest();
15096
15096
  init_path_suggest();
@@ -15100,7 +15100,7 @@ var init_input_box = __esm({
15100
15100
  }
15101
15101
  });
15102
15102
 
15103
- // packages/cli/src/tui/components/log-navigator.tsx
15103
+ // src/tui/components/log-navigator.tsx
15104
15104
  import { useState as useState3, useMemo as useMemo2, useEffect as useEffect3 } from "react";
15105
15105
  import { Box as Box8, Text as Text9, useInput as useInput2 } from "ink";
15106
15106
  import { jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
@@ -15179,12 +15179,12 @@ function LogNavigator({ tree, onPick, onCancel }) {
15179
15179
  ] });
15180
15180
  }
15181
15181
  var init_log_navigator = __esm({
15182
- "packages/cli/src/tui/components/log-navigator.tsx"() {
15182
+ "src/tui/components/log-navigator.tsx"() {
15183
15183
  "use strict";
15184
15184
  }
15185
15185
  });
15186
15186
 
15187
- // packages/cli/src/tui/components/log-viewer.tsx
15187
+ // src/tui/components/log-viewer.tsx
15188
15188
  import { useState as useState4, useMemo as useMemo3, useEffect as useEffect4, useRef as useRef2 } from "react";
15189
15189
  import { Box as Box9, Text as Text10, useInput as useInput3, useStdout as useStdout2 } from "ink";
15190
15190
  import { jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
@@ -15257,12 +15257,12 @@ function LogViewer({ title, lines, live, onClose }) {
15257
15257
  ] });
15258
15258
  }
15259
15259
  var init_log_viewer = __esm({
15260
- "packages/cli/src/tui/components/log-viewer.tsx"() {
15260
+ "src/tui/components/log-viewer.tsx"() {
15261
15261
  "use strict";
15262
15262
  }
15263
15263
  });
15264
15264
 
15265
- // packages/cli/src/tui/app.tsx
15265
+ // src/tui/app.tsx
15266
15266
  import { useEffect as useEffect5, useMemo as useMemo4, useReducer, useState as useState5, useRef as useRef3 } from "react";
15267
15267
  import { Box as Box10, useApp, useInput as useInput4 } from "ink";
15268
15268
  import { jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
@@ -15972,7 +15972,7 @@ ${lines.join("\n")}` });
15972
15972
  }
15973
15973
  var MAX_CONTEXT_TOKENS_FALLBACK, blockSeq, ANSI2;
15974
15974
  var init_app = __esm({
15975
- "packages/cli/src/tui/app.tsx"() {
15975
+ "src/tui/app.tsx"() {
15976
15976
  "use strict";
15977
15977
  init_render_md();
15978
15978
  init_resolve_refs();
@@ -16000,7 +16000,7 @@ var init_app = __esm({
16000
16000
  }
16001
16001
  });
16002
16002
 
16003
- // packages/cli/src/tui.tsx
16003
+ // src/tui.tsx
16004
16004
  var tui_exports = {};
16005
16005
  __export(tui_exports, {
16006
16006
  runTui: () => runTui
@@ -16015,13 +16015,13 @@ async function runTui(harness, opts = {}) {
16015
16015
  await instance.waitUntilExit();
16016
16016
  }
16017
16017
  var init_tui = __esm({
16018
- "packages/cli/src/tui.tsx"() {
16018
+ "src/tui.tsx"() {
16019
16019
  "use strict";
16020
16020
  init_app();
16021
16021
  }
16022
16022
  });
16023
16023
 
16024
- // packages/cli/src/cli.ts
16024
+ // src/cli.ts
16025
16025
  var cli_exports = {};
16026
16026
  __export(cli_exports, {
16027
16027
  runCli: () => runCli
@@ -16051,12 +16051,12 @@ async function runCli(harness, message, opts) {
16051
16051
  }
16052
16052
  const resolvedMessage = ref.text;
16053
16053
  const resolvedImages = ref.images.length > 0 ? ref.images : void 0;
16054
- const chunks = [];
16054
+ let turnFinal = "";
16055
+ let turnAll = "";
16055
16056
  const toolCalls = [];
16056
16057
  let errorText = "";
16057
16058
  let usage = null;
16058
16059
  let lastToolName = "";
16059
- let hadOutput = false;
16060
16060
  let hadMeta = false;
16061
16061
  const agentNames = /* @__PURE__ */ new Map();
16062
16062
  let spinnerTimer = null;
@@ -16111,16 +16111,20 @@ async function runCli(harness, message, opts) {
16111
16111
  process.stderr.write("\n");
16112
16112
  hadMeta = false;
16113
16113
  }
16114
- if (event.taskId) {
16115
- 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
16116
16115
  `);
16117
- } else {
16118
- if (opts.format === "text") process.stdout.write(renderMarkdown(event.text) + "\n");
16119
- chunks.push(event.text);
16120
- hadOutput = true;
16116
+ if (!event.taskId) {
16117
+ turnAll += event.text;
16118
+ if (event.final) turnFinal += event.text;
16121
16119
  }
16122
16120
  }
16123
16121
  break;
16122
+ case "queued_message":
16123
+ if (!event.taskId) {
16124
+ turnFinal = "";
16125
+ turnAll = "";
16126
+ }
16127
+ break;
16124
16128
  case "thinking":
16125
16129
  if (opts.verbose && event.text) {
16126
16130
  stopSpinner();
@@ -16158,10 +16162,6 @@ async function runCli(harness, message, opts) {
16158
16162
  usage = event;
16159
16163
  if (opts.verbose) {
16160
16164
  stopSpinner();
16161
- if (hadOutput) {
16162
- process.stdout.write("\n");
16163
- hadOutput = false;
16164
- }
16165
16165
  process.stderr.write(`
16166
16166
  ${tag}${formatUsageLine(event)}
16167
16167
  `);
@@ -16181,13 +16181,15 @@ ${tag}${formatUsageLine(event)}
16181
16181
  }
16182
16182
  }
16183
16183
  stopSpinner();
16184
+ const answer = turnFinal || turnAll;
16184
16185
  if (opts.format === "text") {
16185
- if (chunks.length > 0 && !chunks[chunks.length - 1].endsWith("\n")) {
16186
- 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");
16187
16189
  }
16188
16190
  } else {
16189
16191
  const result = {
16190
- text: chunks.join(""),
16192
+ text: answer,
16191
16193
  sessionId: harness.sessionId,
16192
16194
  toolCalls,
16193
16195
  usage: usage ? {
@@ -16203,7 +16205,7 @@ ${tag}${formatUsageLine(event)}
16203
16205
  return errorText ? 1 : 0;
16204
16206
  }
16205
16207
  var init_cli = __esm({
16206
- "packages/cli/src/cli.ts"() {
16208
+ "src/cli.ts"() {
16207
16209
  "use strict";
16208
16210
  init_render_md();
16209
16211
  init_resolve_refs();
@@ -16211,7 +16213,7 @@ var init_cli = __esm({
16211
16213
  }
16212
16214
  });
16213
16215
 
16214
- // packages/server/dist/channels/shared/media.js
16216
+ // ../server/dist/channels/shared/media.js
16215
16217
  import path37 from "node:path";
16216
16218
  import os3 from "node:os";
16217
16219
  function tempDir() {
@@ -16252,7 +16254,7 @@ function classifyMedia(filePath) {
16252
16254
  }
16253
16255
  var MEDIA_MARKER_RE, VIDEO_EXTS, VOICE_EXTS;
16254
16256
  var init_media = __esm({
16255
- "packages/server/dist/channels/shared/media.js"() {
16257
+ "../server/dist/channels/shared/media.js"() {
16256
16258
  "use strict";
16257
16259
  init_dist();
16258
16260
  MEDIA_MARKER_RE = /^MEDIA:\s*(\S.*?)\s*$/gm;
@@ -16261,7 +16263,7 @@ var init_media = __esm({
16261
16263
  }
16262
16264
  });
16263
16265
 
16264
- // packages/server/dist/routes/workspace-path.js
16266
+ // ../server/dist/routes/workspace-path.js
16265
16267
  import fs31 from "node:fs/promises";
16266
16268
  import { existsSync as existsSync2, realpathSync as realpathSync3 } from "node:fs";
16267
16269
  import path38 from "node:path";
@@ -16305,12 +16307,12 @@ function isSafeIdSegment(id) {
16305
16307
  return /^[\w.:>\u4e00-\u9fff-]+$/.test(id);
16306
16308
  }
16307
16309
  var init_workspace_path = __esm({
16308
- "packages/server/dist/routes/workspace-path.js"() {
16310
+ "../server/dist/routes/workspace-path.js"() {
16309
16311
  "use strict";
16310
16312
  }
16311
16313
  });
16312
16314
 
16313
- // packages/server/dist/routes/files.js
16315
+ // ../server/dist/routes/files.js
16314
16316
  import { Hono } from "hono";
16315
16317
  import fs32 from "node:fs/promises";
16316
16318
  import { createReadStream } from "node:fs";
@@ -16850,7 +16852,7 @@ function createFileRoutes() {
16850
16852
  return app2;
16851
16853
  }
16852
16854
  var init_files = __esm({
16853
- "packages/server/dist/routes/files.js"() {
16855
+ "../server/dist/routes/files.js"() {
16854
16856
  "use strict";
16855
16857
  init_dist();
16856
16858
  init_media();
@@ -16858,7 +16860,7 @@ var init_files = __esm({
16858
16860
  }
16859
16861
  });
16860
16862
 
16861
- // packages/server/dist/routes/data-preview.js
16863
+ // ../server/dist/routes/data-preview.js
16862
16864
  import { Hono as Hono2 } from "hono";
16863
16865
  import fs33 from "node:fs/promises";
16864
16866
  import { createReadStream as createReadStream2 } from "node:fs";
@@ -17083,7 +17085,7 @@ function createDataPreviewRoutes() {
17083
17085
  }
17084
17086
  var DEFAULT_LIMIT, MAX_LIMIT, MAX_ROW_CHARS, QUOTE, CR, LF, COMMA, SEMI, TAB, CsvScanner;
17085
17087
  var init_data_preview = __esm({
17086
- "packages/server/dist/routes/data-preview.js"() {
17088
+ "../server/dist/routes/data-preview.js"() {
17087
17089
  "use strict";
17088
17090
  init_workspace_path();
17089
17091
  DEFAULT_LIMIT = 100;
@@ -17184,7 +17186,7 @@ var init_data_preview = __esm({
17184
17186
  }
17185
17187
  });
17186
17188
 
17187
- // packages/server/dist/git-credentials.js
17189
+ // ../server/dist/git-credentials.js
17188
17190
  import fs34 from "node:fs";
17189
17191
  import path41 from "node:path";
17190
17192
  import { homedir as homedir18 } from "node:os";
@@ -17259,13 +17261,13 @@ function deleteGitCredential(host) {
17259
17261
  }
17260
17262
  var GIT_CREDENTIALS_PATH;
17261
17263
  var init_git_credentials = __esm({
17262
- "packages/server/dist/git-credentials.js"() {
17264
+ "../server/dist/git-credentials.js"() {
17263
17265
  "use strict";
17264
17266
  GIT_CREDENTIALS_PATH = path41.join(homedir18(), ".git-credentials");
17265
17267
  }
17266
17268
  });
17267
17269
 
17268
- // packages/server/dist/git-ssh.js
17270
+ // ../server/dist/git-ssh.js
17269
17271
  import fs35 from "node:fs";
17270
17272
  import os4 from "node:os";
17271
17273
  import path42 from "node:path";
@@ -17442,7 +17444,7 @@ function getRemoteProtocol(projectRoot) {
17442
17444
  }
17443
17445
  var SSH_DIR, NON_KEY_NAMES, ownedAgentPid, ASKPASS_SCRIPT;
17444
17446
  var init_git_ssh = __esm({
17445
- "packages/server/dist/git-ssh.js"() {
17447
+ "../server/dist/git-ssh.js"() {
17446
17448
  "use strict";
17447
17449
  SSH_DIR = path42.join(os4.homedir(), ".ssh");
17448
17450
  NON_KEY_NAMES = /* @__PURE__ */ new Set(["known_hosts", "known_hosts2", "authorized_keys", "config"]);
@@ -17455,7 +17457,7 @@ printf '%s\\n' "$HALO_SSH_PASSPHRASE"
17455
17457
  }
17456
17458
  });
17457
17459
 
17458
- // packages/server/dist/routes/git.js
17460
+ // ../server/dist/routes/git.js
17459
17461
  import { Hono as Hono3 } from "hono";
17460
17462
  import os5 from "node:os";
17461
17463
  import path43 from "node:path";
@@ -17821,7 +17823,7 @@ function createGitRoutes() {
17821
17823
  return app2;
17822
17824
  }
17823
17825
  var init_git = __esm({
17824
- "packages/server/dist/routes/git.js"() {
17826
+ "../server/dist/routes/git.js"() {
17825
17827
  "use strict";
17826
17828
  init_dist();
17827
17829
  init_workspace_path();
@@ -17831,7 +17833,7 @@ var init_git = __esm({
17831
17833
  }
17832
17834
  });
17833
17835
 
17834
- // packages/server/dist/routes/mtime-cache.js
17836
+ // ../server/dist/routes/mtime-cache.js
17835
17837
  function createMtimeCache() {
17836
17838
  const entries = /* @__PURE__ */ new Map();
17837
17839
  return {
@@ -17846,12 +17848,12 @@ function createMtimeCache() {
17846
17848
  };
17847
17849
  }
17848
17850
  var init_mtime_cache = __esm({
17849
- "packages/server/dist/routes/mtime-cache.js"() {
17851
+ "../server/dist/routes/mtime-cache.js"() {
17850
17852
  "use strict";
17851
17853
  }
17852
17854
  });
17853
17855
 
17854
- // packages/server/dist/routes/agent-configs.js
17856
+ // ../server/dist/routes/agent-configs.js
17855
17857
  import { Hono as Hono4 } from "hono";
17856
17858
  import fs36 from "node:fs/promises";
17857
17859
  import path44 from "node:path";
@@ -18366,7 +18368,7 @@ ${body.description ?? ""}
18366
18368
  }
18367
18369
  var _cachedTools, GLOBAL_AGENTS_DIR4, FALLBACK_SCAFFOLD_PROVIDER, _yamlCache;
18368
18370
  var init_agent_configs = __esm({
18369
- "packages/server/dist/routes/agent-configs.js"() {
18371
+ "../server/dist/routes/agent-configs.js"() {
18370
18372
  "use strict";
18371
18373
  init_workspace_tools();
18372
18374
  init_draft_tool();
@@ -18382,7 +18384,7 @@ var init_agent_configs = __esm({
18382
18384
  }
18383
18385
  });
18384
18386
 
18385
- // packages/server/dist/routes/skills.js
18387
+ // ../server/dist/routes/skills.js
18386
18388
  import { Hono as Hono5 } from "hono";
18387
18389
  import fs37 from "node:fs/promises";
18388
18390
  import path45 from "node:path";
@@ -18577,7 +18579,7 @@ function createSkillRoutes() {
18577
18579
  }
18578
18580
  var GLOBAL_SETTINGS_PATH, _skillMdCache;
18579
18581
  var init_skills = __esm({
18580
- "packages/server/dist/routes/skills.js"() {
18582
+ "../server/dist/routes/skills.js"() {
18581
18583
  "use strict";
18582
18584
  init_agent_loader();
18583
18585
  init_db();
@@ -18588,7 +18590,7 @@ var init_skills = __esm({
18588
18590
  }
18589
18591
  });
18590
18592
 
18591
- // packages/server/dist/routes/settings.js
18593
+ // ../server/dist/routes/settings.js
18592
18594
  import { Hono as Hono6 } from "hono";
18593
18595
  import fs38 from "node:fs/promises";
18594
18596
  import path46 from "node:path";
@@ -18857,7 +18859,7 @@ function createSettingsRoutes() {
18857
18859
  }
18858
18860
  var GLOBAL_SETTINGS_PATH2, _changeListeners;
18859
18861
  var init_settings = __esm({
18860
- "packages/server/dist/routes/settings.js"() {
18862
+ "../server/dist/routes/settings.js"() {
18861
18863
  "use strict";
18862
18864
  init_settings_schema();
18863
18865
  init_workspace_path();
@@ -18866,7 +18868,7 @@ var init_settings = __esm({
18866
18868
  }
18867
18869
  });
18868
18870
 
18869
- // packages/server/dist/evolution/archive.js
18871
+ // ../server/dist/evolution/archive.js
18870
18872
  import fs39 from "node:fs";
18871
18873
  import path47 from "node:path";
18872
18874
  import { pipeline } from "node:stream/promises";
@@ -19033,7 +19035,7 @@ function stopArchiveDaemon() {
19033
19035
  }
19034
19036
  var TERMINAL_RUN_STATUSES, TERMINAL_APPLY_STATUSES, DAY_MS, ARCHIVE_AFTER_MS, PURGE_AFTER_MS, _archiveTimer, _startupTimer;
19035
19037
  var init_archive = __esm({
19036
- "packages/server/dist/evolution/archive.js"() {
19038
+ "../server/dist/evolution/archive.js"() {
19037
19039
  "use strict";
19038
19040
  init_evo_db();
19039
19041
  init_paths();
@@ -19047,7 +19049,7 @@ var init_archive = __esm({
19047
19049
  }
19048
19050
  });
19049
19051
 
19050
- // packages/server/dist/db/raw-sqlite.js
19052
+ // ../server/dist/db/raw-sqlite.js
19051
19053
  function rawSqlite(db) {
19052
19054
  const withClient = db;
19053
19055
  const client = withClient.$client ?? withClient.session?.client;
@@ -19056,12 +19058,12 @@ function rawSqlite(db) {
19056
19058
  return client;
19057
19059
  }
19058
19060
  var init_raw_sqlite = __esm({
19059
- "packages/server/dist/db/raw-sqlite.js"() {
19061
+ "../server/dist/db/raw-sqlite.js"() {
19060
19062
  "use strict";
19061
19063
  }
19062
19064
  });
19063
19065
 
19064
- // packages/server/dist/routes/evolution.js
19066
+ // ../server/dist/routes/evolution.js
19065
19067
  import { Hono as Hono7 } from "hono";
19066
19068
  import { eq as eq8, desc as desc2, lt as lt3, and as and6, or, sql } from "drizzle-orm";
19067
19069
  import fs40 from "node:fs/promises";
@@ -19319,7 +19321,7 @@ function extractText(content) {
19319
19321
  }
19320
19322
  var UNDELETABLE_RUN_STATUSES;
19321
19323
  var init_evolution = __esm({
19322
- "packages/server/dist/routes/evolution.js"() {
19324
+ "../server/dist/routes/evolution.js"() {
19323
19325
  "use strict";
19324
19326
  init_evo_db();
19325
19327
  init_archive();
@@ -19330,7 +19332,7 @@ var init_evolution = __esm({
19330
19332
  }
19331
19333
  });
19332
19334
 
19333
- // packages/server/dist/routes/sessions.js
19335
+ // ../server/dist/routes/sessions.js
19334
19336
  import { Hono as Hono8 } from "hono";
19335
19337
  import { eq as eq9 } from "drizzle-orm";
19336
19338
  function rawId() {
@@ -19587,7 +19589,7 @@ function createSessionRoutes(smRegistry) {
19587
19589
  }
19588
19590
  var msgCounter2;
19589
19591
  var init_sessions = __esm({
19590
- "packages/server/dist/routes/sessions.js"() {
19592
+ "../server/dist/routes/sessions.js"() {
19591
19593
  "use strict";
19592
19594
  init_db();
19593
19595
  init_schema();
@@ -19598,7 +19600,7 @@ var init_sessions = __esm({
19598
19600
  }
19599
19601
  });
19600
19602
 
19601
- // packages/server/dist/routes/session-archive.js
19603
+ // ../server/dist/routes/session-archive.js
19602
19604
  import { Hono as Hono9 } from "hono";
19603
19605
  function createSessionArchiveRoutes(smRegistry) {
19604
19606
  const app2 = new Hono9();
@@ -19631,7 +19633,7 @@ function createSessionArchiveRoutes(smRegistry) {
19631
19633
  return app2;
19632
19634
  }
19633
19635
  var init_session_archive2 = __esm({
19634
- "packages/server/dist/routes/session-archive.js"() {
19636
+ "../server/dist/routes/session-archive.js"() {
19635
19637
  "use strict";
19636
19638
  init_db();
19637
19639
  init_session_store();
@@ -19640,7 +19642,7 @@ var init_session_archive2 = __esm({
19640
19642
  }
19641
19643
  });
19642
19644
 
19643
- // packages/server/dist/db/channel-db.js
19645
+ // ../server/dist/db/channel-db.js
19644
19646
  import Database4 from "better-sqlite3";
19645
19647
  import { drizzle as drizzle3 } from "drizzle-orm/better-sqlite3";
19646
19648
  import { sqliteTable as sqliteTable3, text as text3, integer as integer3 } from "drizzle-orm/sqlite-core";
@@ -19665,7 +19667,7 @@ function getChannelDb() {
19665
19667
  }
19666
19668
  var channelAccounts, CREATE_SQL2, _channelDb;
19667
19669
  var init_channel_db = __esm({
19668
- "packages/server/dist/db/channel-db.js"() {
19670
+ "../server/dist/db/channel-db.js"() {
19669
19671
  "use strict";
19670
19672
  channelAccounts = sqliteTable3("channel_accounts", {
19671
19673
  accountId: text3("account_id").primaryKey(),
@@ -19698,7 +19700,7 @@ CREATE INDEX IF NOT EXISTS idx_channel_accounts_type ON channel_accounts(channel
19698
19700
  }
19699
19701
  });
19700
19702
 
19701
- // packages/server/dist/channels/shared/accounts.js
19703
+ // ../server/dist/channels/shared/accounts.js
19702
19704
  import fs42 from "node:fs";
19703
19705
  import path50 from "node:path";
19704
19706
  import { eq as eq10, and as and7 } from "drizzle-orm";
@@ -19806,7 +19808,7 @@ function deleteAccount(db, accountId) {
19806
19808
  }
19807
19809
  var ACCOUNT_ACCESS_LEVELS, CHAT_ACCESS_LEVELS, _lastActiveChatCache;
19808
19810
  var init_accounts = __esm({
19809
- "packages/server/dist/channels/shared/accounts.js"() {
19811
+ "../server/dist/channels/shared/accounts.js"() {
19810
19812
  "use strict";
19811
19813
  init_channel_db();
19812
19814
  init_init();
@@ -19816,7 +19818,7 @@ var init_accounts = __esm({
19816
19818
  }
19817
19819
  });
19818
19820
 
19819
- // packages/server/dist/channels/web/accounts.js
19821
+ // ../server/dist/channels/web/accounts.js
19820
19822
  function toWeb(a) {
19821
19823
  const c = a.config;
19822
19824
  return {
@@ -19879,14 +19881,14 @@ function deleteAccount2(db, accountId) {
19879
19881
  }
19880
19882
  var CH;
19881
19883
  var init_accounts2 = __esm({
19882
- "packages/server/dist/channels/web/accounts.js"() {
19884
+ "../server/dist/channels/web/accounts.js"() {
19883
19885
  "use strict";
19884
19886
  init_accounts();
19885
19887
  CH = "web";
19886
19888
  }
19887
19889
  });
19888
19890
 
19889
- // packages/server/dist/middleware/brute-force.js
19891
+ // ../server/dist/middleware/brute-force.js
19890
19892
  import { getConnInfo } from "@hono/node-server/conninfo";
19891
19893
  function bucket(name) {
19892
19894
  let b = buckets.get(name);
@@ -19937,7 +19939,7 @@ function clearFailures(bucketName, ip) {
19937
19939
  }
19938
19940
  var MAX_ATTEMPTS, LOCKOUT_MS, buckets;
19939
19941
  var init_brute_force = __esm({
19940
- "packages/server/dist/middleware/brute-force.js"() {
19942
+ "../server/dist/middleware/brute-force.js"() {
19941
19943
  "use strict";
19942
19944
  init_config();
19943
19945
  MAX_ATTEMPTS = 5;
@@ -19946,7 +19948,7 @@ var init_brute_force = __esm({
19946
19948
  }
19947
19949
  });
19948
19950
 
19949
- // packages/server/dist/middleware/web-token.js
19951
+ // ../server/dist/middleware/web-token.js
19950
19952
  function resolveTokenAuth(c, db) {
19951
19953
  const ip = getClientIp(c);
19952
19954
  if (isLockedOut(TOKEN_BUCKET, ip))
@@ -19968,7 +19970,7 @@ function tokenAuthJsonError(c, reason) {
19968
19970
  }
19969
19971
  var TOKEN_BUCKET, TOKEN_AUTH_STATUS, JSON_ERROR;
19970
19972
  var init_web_token = __esm({
19971
- "packages/server/dist/middleware/web-token.js"() {
19973
+ "../server/dist/middleware/web-token.js"() {
19972
19974
  "use strict";
19973
19975
  init_accounts2();
19974
19976
  init_brute_force();
@@ -19986,7 +19988,7 @@ var init_web_token = __esm({
19986
19988
  }
19987
19989
  });
19988
19990
 
19989
- // packages/server/dist/sessions/session-types.js
19991
+ // ../server/dist/sessions/session-types.js
19990
19992
  function messageToolCalls(msg) {
19991
19993
  if (msg.contentBlocks) {
19992
19994
  return msg.contentBlocks.filter((b) => b.type === "tool_call").map((b) => b.toolCall);
@@ -20011,12 +20013,12 @@ function inferMessageType(msg) {
20011
20013
  return "notification";
20012
20014
  }
20013
20015
  var init_session_types = __esm({
20014
- "packages/server/dist/sessions/session-types.js"() {
20016
+ "../server/dist/sessions/session-types.js"() {
20015
20017
  "use strict";
20016
20018
  }
20017
20019
  });
20018
20020
 
20019
- // packages/server/dist/routes/halo-city.js
20021
+ // ../server/dist/routes/halo-city.js
20020
20022
  import { Hono as Hono10 } from "hono";
20021
20023
  import fs43 from "node:fs";
20022
20024
  import path51 from "node:path";
@@ -20403,7 +20405,7 @@ function createShowRoutes(registry2) {
20403
20405
  }
20404
20406
  var SESSIONS_PER_WS, _skillCache, _metaCache, _roReaders, SESSION_LOG_MAX_MSGS, _birthCache;
20405
20407
  var init_halo_city = __esm({
20406
- "packages/server/dist/routes/halo-city.js"() {
20408
+ "../server/dist/routes/halo-city.js"() {
20407
20409
  "use strict";
20408
20410
  init_channel_db();
20409
20411
  init_web_token();
@@ -20420,7 +20422,7 @@ var init_halo_city = __esm({
20420
20422
  }
20421
20423
  });
20422
20424
 
20423
- // packages/server/dist/routes/metrics.js
20425
+ // ../server/dist/routes/metrics.js
20424
20426
  import { Hono as Hono11 } from "hono";
20425
20427
  function family(name, type, help, samples) {
20426
20428
  const lines = [`# HELP ${name} ${help}`, `# TYPE ${name} ${type}`];
@@ -20499,7 +20501,7 @@ function createMetricsRoutes(registry2) {
20499
20501
  }
20500
20502
  var TEXT_ERROR, SESSIONS_PER_WS2;
20501
20503
  var init_metrics = __esm({
20502
- "packages/server/dist/routes/metrics.js"() {
20504
+ "../server/dist/routes/metrics.js"() {
20503
20505
  "use strict";
20504
20506
  init_channel_db();
20505
20507
  init_web_token();
@@ -20513,7 +20515,7 @@ var init_metrics = __esm({
20513
20515
  }
20514
20516
  });
20515
20517
 
20516
- // packages/server/dist/routes/commands.js
20518
+ // ../server/dist/routes/commands.js
20517
20519
  import { Hono as Hono12 } from "hono";
20518
20520
  function createCommandRoutes(registry2, smRegistry) {
20519
20521
  const app2 = new Hono12();
@@ -20538,12 +20540,12 @@ function createCommandRoutes(registry2, smRegistry) {
20538
20540
  return app2;
20539
20541
  }
20540
20542
  var init_commands3 = __esm({
20541
- "packages/server/dist/routes/commands.js"() {
20543
+ "../server/dist/routes/commands.js"() {
20542
20544
  "use strict";
20543
20545
  }
20544
20546
  });
20545
20547
 
20546
- // packages/server/dist/routes/agentcore.js
20548
+ // ../server/dist/routes/agentcore.js
20547
20549
  import { Hono as Hono13 } from "hono";
20548
20550
  import path52 from "node:path";
20549
20551
  import fs44 from "node:fs";
@@ -20892,7 +20894,7 @@ ${fullText}`, images.length > 0 ? images : void 0);
20892
20894
  }
20893
20895
  var SESSION_HEADER, MAX_IMAGES_PER_MESSAGE, MAX_IMAGE_BASE64_LENGTH, MAX_PENDING_UPLOADS, MAX_CHUNKS_PER_UPLOAD, activeOverrides;
20894
20896
  var init_agentcore = __esm({
20895
- "packages/server/dist/routes/agentcore.js"() {
20897
+ "../server/dist/routes/agentcore.js"() {
20896
20898
  "use strict";
20897
20899
  init_commands2();
20898
20900
  init_ui_log_builder();
@@ -20907,7 +20909,7 @@ var init_agentcore = __esm({
20907
20909
  }
20908
20910
  });
20909
20911
 
20910
- // packages/server/dist/ws/file-watcher.js
20912
+ // ../server/dist/ws/file-watcher.js
20911
20913
  import fs45 from "node:fs";
20912
20914
  import path53 from "node:path";
20913
20915
  function enqueueNativeOp(op) {
@@ -20929,7 +20931,7 @@ function isUnwatchablePath(absPath) {
20929
20931
  }
20930
20932
  var IGNORED_SEGMENTS, IS_WIN32, IGNORED_SEGMENT_SET, NATIVE_IGNORE, nativeOpChain, WorkspaceWatcher;
20931
20933
  var init_file_watcher = __esm({
20932
- "packages/server/dist/ws/file-watcher.js"() {
20934
+ "../server/dist/ws/file-watcher.js"() {
20933
20935
  "use strict";
20934
20936
  IGNORED_SEGMENTS = [
20935
20937
  // VCS
@@ -21151,12 +21153,12 @@ var init_file_watcher = __esm({
21151
21153
  }
21152
21154
  });
21153
21155
 
21154
- // packages/server/dist/ws/git-dir-watcher.js
21156
+ // ../server/dist/ws/git-dir-watcher.js
21155
21157
  import fs46 from "node:fs";
21156
21158
  import path54 from "node:path";
21157
21159
  var GitDirWatcher;
21158
21160
  var init_git_dir_watcher = __esm({
21159
- "packages/server/dist/ws/git-dir-watcher.js"() {
21161
+ "../server/dist/ws/git-dir-watcher.js"() {
21160
21162
  "use strict";
21161
21163
  GitDirWatcher = class {
21162
21164
  watcher = null;
@@ -21275,7 +21277,7 @@ var init_git_dir_watcher = __esm({
21275
21277
  }
21276
21278
  });
21277
21279
 
21278
- // packages/server/dist/ws/event-processor.js
21280
+ // ../server/dist/ws/event-processor.js
21279
21281
  function sendJson(ws, data) {
21280
21282
  if (ws.readyState === ws.OPEN) {
21281
21283
  try {
@@ -21374,13 +21376,13 @@ function bufferDetachedNotification(event, pendingEvents) {
21374
21376
  }
21375
21377
  }
21376
21378
  var init_event_processor = __esm({
21377
- "packages/server/dist/ws/event-processor.js"() {
21379
+ "../server/dist/ws/event-processor.js"() {
21378
21380
  "use strict";
21379
21381
  init_ui_log_builder();
21380
21382
  }
21381
21383
  });
21382
21384
 
21383
- // packages/server/dist/ws/terminal-manager.js
21385
+ // ../server/dist/ws/terminal-manager.js
21384
21386
  import { homedir as homedir22 } from "node:os";
21385
21387
  import { basename } from "node:path";
21386
21388
  import { createRequire } from "node:module";
@@ -21411,7 +21413,7 @@ function attachListenersOnce(t2) {
21411
21413
  }
21412
21414
  var requireFromHere, ptyModule, TERMINAL_GRACE_MS, terminals, TerminalManager;
21413
21415
  var init_terminal_manager = __esm({
21414
- "packages/server/dist/ws/terminal-manager.js"() {
21416
+ "../server/dist/ws/terminal-manager.js"() {
21415
21417
  "use strict";
21416
21418
  init_config();
21417
21419
  init_event_processor();
@@ -21558,7 +21560,7 @@ var init_terminal_manager = __esm({
21558
21560
  }
21559
21561
  });
21560
21562
 
21561
- // packages/server/dist/ws/handler.js
21563
+ // ../server/dist/ws/handler.js
21562
21564
  import path55 from "node:path";
21563
21565
  function setupWebSocketHandler(deps) {
21564
21566
  const { wss: wss2, registry: registry2 } = deps;
@@ -22186,7 +22188,7 @@ ${msg.message}` : markers.join("\n");
22186
22188
  }
22187
22189
  var CLIENT_SILENCE_LIMIT_MS, detachedSessions;
22188
22190
  var init_handler = __esm({
22189
- "packages/server/dist/ws/handler.js"() {
22191
+ "../server/dist/ws/handler.js"() {
22190
22192
  "use strict";
22191
22193
  init_ui_log_builder();
22192
22194
  init_config();
@@ -22205,7 +22207,7 @@ var init_handler = __esm({
22205
22207
  }
22206
22208
  });
22207
22209
 
22208
- // packages/server/dist/db/cron-db.js
22210
+ // ../server/dist/db/cron-db.js
22209
22211
  import Database6 from "better-sqlite3";
22210
22212
  import { drizzle as drizzle4 } from "drizzle-orm/better-sqlite3";
22211
22213
  import { sqliteTable as sqliteTable4, text as text4, integer as integer4 } from "drizzle-orm/sqlite-core";
@@ -22240,7 +22242,7 @@ function getCronDb() {
22240
22242
  }
22241
22243
  var cronJobs, cronRuns, CREATE_SQL3, _cronDb;
22242
22244
  var init_cron_db = __esm({
22243
- "packages/server/dist/db/cron-db.js"() {
22245
+ "../server/dist/db/cron-db.js"() {
22244
22246
  "use strict";
22245
22247
  cronJobs = sqliteTable4("cron_jobs", {
22246
22248
  id: text4("id").primaryKey(),
@@ -22350,7 +22352,7 @@ CREATE INDEX IF NOT EXISTS idx_cron_runs_status ON cron_runs(status);
22350
22352
  }
22351
22353
  });
22352
22354
 
22353
- // packages/server/dist/cron/dispatcher.js
22355
+ // ../server/dist/cron/dispatcher.js
22354
22356
  function registerCronDispatcher(d) {
22355
22357
  _registry.set(d.channelType, d);
22356
22358
  }
@@ -22397,14 +22399,14 @@ async function dispatchToTargets(rawText, targets, workspacePath) {
22397
22399
  }
22398
22400
  var _registry;
22399
22401
  var init_dispatcher = __esm({
22400
- "packages/server/dist/cron/dispatcher.js"() {
22402
+ "../server/dist/cron/dispatcher.js"() {
22401
22403
  "use strict";
22402
22404
  init_media();
22403
22405
  _registry = /* @__PURE__ */ new Map();
22404
22406
  }
22405
22407
  });
22406
22408
 
22407
- // packages/server/dist/child-env.js
22409
+ // ../server/dist/child-env.js
22408
22410
  function cleanChildEnv() {
22409
22411
  const env = { ...process.env };
22410
22412
  delete env.HALO_PASSWORD;
@@ -22412,12 +22414,12 @@ function cleanChildEnv() {
22412
22414
  return env;
22413
22415
  }
22414
22416
  var init_child_env = __esm({
22415
- "packages/server/dist/child-env.js"() {
22417
+ "../server/dist/child-env.js"() {
22416
22418
  "use strict";
22417
22419
  }
22418
22420
  });
22419
22421
 
22420
- // packages/server/dist/cron/runner.js
22422
+ // ../server/dist/cron/runner.js
22421
22423
  import { spawn as spawn3, execFileSync } from "node:child_process";
22422
22424
  import fs48 from "node:fs";
22423
22425
  import path57 from "node:path";
@@ -22942,7 +22944,7 @@ function pruneOldLogs() {
22942
22944
  }
22943
22945
  var DAY_MS2, CLI_TIMEOUT_SEC, KILL_GRACE_SEC, RUNS_PER_JOB_KEEP, LOG_RETENTION_DAYS, _active, _inflight, _fingerprint, _daemonTimers, _lastCronDataVersion;
22944
22946
  var init_runner = __esm({
22945
- "packages/server/dist/cron/runner.js"() {
22947
+ "../server/dist/cron/runner.js"() {
22946
22948
  "use strict";
22947
22949
  init_cron_db();
22948
22950
  init_raw_sqlite();
@@ -22962,7 +22964,7 @@ var init_runner = __esm({
22962
22964
  }
22963
22965
  });
22964
22966
 
22965
- // packages/server/dist/routes/cron.js
22967
+ // ../server/dist/routes/cron.js
22966
22968
  import { Hono as Hono14 } from "hono";
22967
22969
  import { eq as eq12, desc as desc3, lt as lt5, and as and8 } from "drizzle-orm";
22968
22970
  import fs49 from "node:fs/promises";
@@ -23234,7 +23236,7 @@ function computeNextRun(j) {
23234
23236
  }
23235
23237
  var TIMEOUT_SEC_MIN, TIMEOUT_SEC_MAX;
23236
23238
  var init_cron = __esm({
23237
- "packages/server/dist/routes/cron.js"() {
23239
+ "../server/dist/routes/cron.js"() {
23238
23240
  "use strict";
23239
23241
  init_cron_db();
23240
23242
  init_runner();
@@ -23245,7 +23247,7 @@ var init_cron = __esm({
23245
23247
  }
23246
23248
  });
23247
23249
 
23248
- // packages/server/dist/evolution/ticker.js
23250
+ // ../server/dist/evolution/ticker.js
23249
23251
  import { eq as eq13, and as and9, or as or2, asc, isNull as isNull5, sql as sql2 } from "drizzle-orm";
23250
23252
  function setEvoSpawner(fn) {
23251
23253
  _spawner = fn;
@@ -23471,7 +23473,7 @@ function claimApply(id) {
23471
23473
  }
23472
23474
  var _lastRunStatus, _lastApplyStatus, _spawner, TICK_INTERVAL_MS, _interval, _startupTimer2;
23473
23475
  var init_ticker = __esm({
23474
- "packages/server/dist/evolution/ticker.js"() {
23476
+ "../server/dist/evolution/ticker.js"() {
23475
23477
  "use strict";
23476
23478
  init_config();
23477
23479
  init_evo_db();
@@ -23487,13 +23489,13 @@ var init_ticker = __esm({
23487
23489
  }
23488
23490
  });
23489
23491
 
23490
- // packages/server/dist/evolution/spawn.js
23492
+ // ../server/dist/evolution/spawn.js
23491
23493
  import path58 from "node:path";
23492
23494
  import { spawn as spawn4 } from "node:child_process";
23493
23495
  import { fileURLToPath as fileURLToPath2 } from "node:url";
23494
23496
  var __dirname2, WRAPPER_PATH, realEvoSpawner;
23495
23497
  var init_spawn = __esm({
23496
- "packages/server/dist/evolution/spawn.js"() {
23498
+ "../server/dist/evolution/spawn.js"() {
23497
23499
  "use strict";
23498
23500
  init_child_env();
23499
23501
  __dirname2 = path58.dirname(fileURLToPath2(import.meta.url));
@@ -23515,7 +23517,7 @@ var init_spawn = __esm({
23515
23517
  }
23516
23518
  });
23517
23519
 
23518
- // packages/server/dist/channels/registry.js
23520
+ // ../server/dist/channels/registry.js
23519
23521
  function bootChannels(app2, descriptors, deps) {
23520
23522
  for (const d of descriptors) {
23521
23523
  if (d.registerCronDispatcher)
@@ -23540,13 +23542,13 @@ async function shutdownChannels() {
23540
23542
  }
23541
23543
  var _running;
23542
23544
  var init_registry2 = __esm({
23543
- "packages/server/dist/channels/registry.js"() {
23545
+ "../server/dist/channels/registry.js"() {
23544
23546
  "use strict";
23545
23547
  _running = [];
23546
23548
  }
23547
23549
  });
23548
23550
 
23549
- // packages/server/dist/channels/telegram/accounts.js
23551
+ // ../server/dist/channels/telegram/accounts.js
23550
23552
  function toTelegram(a) {
23551
23553
  const c = a.config;
23552
23554
  return {
@@ -23620,18 +23622,40 @@ function deleteAccount3(db, accountId) {
23620
23622
  }
23621
23623
  var CH2;
23622
23624
  var init_accounts3 = __esm({
23623
- "packages/server/dist/channels/telegram/accounts.js"() {
23625
+ "../server/dist/channels/telegram/accounts.js"() {
23624
23626
  "use strict";
23625
23627
  init_accounts();
23626
23628
  CH2 = "telegram";
23627
23629
  }
23628
23630
  });
23629
23631
 
23630
- // 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
23631
23654
  var HARD_CHARS, TelegramResponder;
23632
23655
  var init_event_adapter = __esm({
23633
- "packages/server/dist/channels/telegram/event-adapter.js"() {
23656
+ "../server/dist/channels/telegram/event-adapter.js"() {
23634
23657
  "use strict";
23658
+ init_chunk();
23635
23659
  init_media();
23636
23660
  HARD_CHARS = 4e3;
23637
23661
  TelegramResponder = class {
@@ -23648,7 +23672,7 @@ var init_event_adapter = __esm({
23648
23672
  return;
23649
23673
  switch (event.type) {
23650
23674
  case "stream":
23651
- if (event.text)
23675
+ if (event.final && event.text)
23652
23676
  this.append(event.text);
23653
23677
  break;
23654
23678
  case "error":
@@ -23676,34 +23700,20 @@ var init_event_adapter = __esm({
23676
23700
  }
23677
23701
  append(text5) {
23678
23702
  this.buffer += text5;
23679
- while (this.buffer.length >= HARD_CHARS) {
23680
- const cut = this.findSplitPoint(this.buffer, HARD_CHARS);
23681
- const chunk = this.buffer.slice(0, cut);
23682
- 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)
23683
23708
  void this.dispatchChunk(chunk);
23684
- }
23685
23709
  }
23686
23710
  flushAll() {
23687
23711
  if (!this.buffer)
23688
23712
  return;
23689
- while (this.buffer.length > HARD_CHARS) {
23690
- const cut = this.findSplitPoint(this.buffer, HARD_CHARS);
23691
- const chunk = this.buffer.slice(0, cut);
23692
- this.buffer = this.buffer.slice(cut).trimStart();
23713
+ const chunks = splitText(this.buffer, HARD_CHARS);
23714
+ this.buffer = "";
23715
+ for (const chunk of chunks)
23693
23716
  void this.dispatchChunk(chunk);
23694
- }
23695
- if (this.buffer) {
23696
- const text5 = this.buffer;
23697
- this.buffer = "";
23698
- void this.dispatchChunk(text5);
23699
- }
23700
- }
23701
- findSplitPoint(text5, limit) {
23702
- const window = text5.slice(0, limit);
23703
- const lastPara = window.lastIndexOf("\n\n");
23704
- if (lastPara > limit / 2)
23705
- return lastPara + 2;
23706
- return limit;
23707
23717
  }
23708
23718
  async dispatchChunk(chunk) {
23709
23719
  const { text: text5, mediaPaths } = extractMediaMessage(chunk);
@@ -23726,7 +23736,7 @@ var init_event_adapter = __esm({
23726
23736
  }
23727
23737
  });
23728
23738
 
23729
- // packages/server/dist/channels/shared/busy-hint.js
23739
+ // ../server/dist/channels/shared/busy-hint.js
23730
23740
  function busyHint(sm, sessionId, lang) {
23731
23741
  if (sm.isSessionCompacting(sessionId))
23732
23742
  return t("handler.compacting", lang);
@@ -23735,13 +23745,13 @@ function busyHint(sm, sessionId, lang) {
23735
23745
  return null;
23736
23746
  }
23737
23747
  var init_busy_hint = __esm({
23738
- "packages/server/dist/channels/shared/busy-hint.js"() {
23748
+ "../server/dist/channels/shared/busy-hint.js"() {
23739
23749
  "use strict";
23740
23750
  init_i18n();
23741
23751
  }
23742
23752
  });
23743
23753
 
23744
- // packages/server/dist/channels/shared/inbound.js
23754
+ // ../server/dist/channels/shared/inbound.js
23745
23755
  function sessionAccess(accountAccessLevel) {
23746
23756
  return accountAccessLevel === "full" ? null : accountAccessLevel === "workspace" ? "workspace" : "readonly";
23747
23757
  }
@@ -23799,7 +23809,7 @@ async function dispatchChannelCommand(ctx, command, arg, opts) {
23799
23809
  }
23800
23810
  var InboundBridge;
23801
23811
  var init_inbound = __esm({
23802
- "packages/server/dist/channels/shared/inbound.js"() {
23812
+ "../server/dist/channels/shared/inbound.js"() {
23803
23813
  "use strict";
23804
23814
  init_goal_mode();
23805
23815
  init_accounts();
@@ -23869,17 +23879,17 @@ var init_inbound = __esm({
23869
23879
  }
23870
23880
  });
23871
23881
 
23872
- // packages/server/dist/channels/shared/session-prefix.js
23882
+ // ../server/dist/channels/shared/session-prefix.js
23873
23883
  function sessionPrefix(channel, userId) {
23874
23884
  return `${channel}_${userId}_`;
23875
23885
  }
23876
23886
  var init_session_prefix = __esm({
23877
- "packages/server/dist/channels/shared/session-prefix.js"() {
23887
+ "../server/dist/channels/shared/session-prefix.js"() {
23878
23888
  "use strict";
23879
23889
  }
23880
23890
  });
23881
23891
 
23882
- // packages/server/dist/channels/telegram/handler.js
23892
+ // ../server/dist/channels/telegram/handler.js
23883
23893
  import { Bot, InputFile } from "grammy";
23884
23894
  function inferMediaKind(filePath) {
23885
23895
  const cls = classifyMedia(filePath);
@@ -24266,7 +24276,7 @@ async function handleUserMessage(args) {
24266
24276
  }
24267
24277
  var MAX_TG_DOWNLOAD_BYTES;
24268
24278
  var init_handler2 = __esm({
24269
- "packages/server/dist/channels/telegram/handler.js"() {
24279
+ "../server/dist/channels/telegram/handler.js"() {
24270
24280
  "use strict";
24271
24281
  init_accounts3();
24272
24282
  init_event_adapter();
@@ -24281,7 +24291,7 @@ var init_handler2 = __esm({
24281
24291
  }
24282
24292
  });
24283
24293
 
24284
- // packages/server/dist/routes/telegram.js
24294
+ // ../server/dist/routes/telegram.js
24285
24295
  import { Hono as Hono15 } from "hono";
24286
24296
  import { Bot as Bot2 } from "grammy";
24287
24297
  import fs50 from "node:fs";
@@ -24400,14 +24410,14 @@ function createTelegramRoutes(deps) {
24400
24410
  return app2;
24401
24411
  }
24402
24412
  var init_telegram = __esm({
24403
- "packages/server/dist/routes/telegram.js"() {
24413
+ "../server/dist/routes/telegram.js"() {
24404
24414
  "use strict";
24405
24415
  init_accounts3();
24406
24416
  init_accounts();
24407
24417
  }
24408
24418
  });
24409
24419
 
24410
- // packages/server/dist/channels/telegram/cron-dispatcher.js
24420
+ // ../server/dist/channels/telegram/cron-dispatcher.js
24411
24421
  import { Bot as Bot3 } from "grammy";
24412
24422
  async function dispatch(accountId, text5, explicitChatId) {
24413
24423
  const acct = getAccount3(getChannelDb(), accountId);
@@ -24456,7 +24466,7 @@ function registerTelegramCronDispatcher() {
24456
24466
  registerCronDispatcher({ channelType: "telegram", dispatch, listTargets });
24457
24467
  }
24458
24468
  var init_cron_dispatcher = __esm({
24459
- "packages/server/dist/channels/telegram/cron-dispatcher.js"() {
24469
+ "../server/dist/channels/telegram/cron-dispatcher.js"() {
24460
24470
  "use strict";
24461
24471
  init_channel_db();
24462
24472
  init_accounts3();
@@ -24464,10 +24474,10 @@ var init_cron_dispatcher = __esm({
24464
24474
  }
24465
24475
  });
24466
24476
 
24467
- // packages/server/dist/channels/telegram/descriptor.js
24477
+ // ../server/dist/channels/telegram/descriptor.js
24468
24478
  var telegramDescriptor;
24469
24479
  var init_descriptor = __esm({
24470
- "packages/server/dist/channels/telegram/descriptor.js"() {
24480
+ "../server/dist/channels/telegram/descriptor.js"() {
24471
24481
  "use strict";
24472
24482
  init_handler2();
24473
24483
  init_telegram();
@@ -24482,7 +24492,7 @@ var init_descriptor = __esm({
24482
24492
  }
24483
24493
  });
24484
24494
 
24485
- // packages/server/dist/channels/wechat/api.js
24495
+ // ../server/dist/channels/wechat/api.js
24486
24496
  import crypto3 from "node:crypto";
24487
24497
  function buildClientVersion(version) {
24488
24498
  const [ma, mi, pa] = version.split(".").map((p) => parseInt(p, 10));
@@ -24627,7 +24637,7 @@ async function sendMessage(params) {
24627
24637
  try {
24628
24638
  const parsed = JSON.parse(raw);
24629
24639
  if (parsed.ret !== void 0 && parsed.ret !== 0 || parsed.errcode !== void 0 && parsed.errcode !== 0) {
24630
- 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)" : "";
24631
24641
  throw new Error(`[wechat:sendmessage] gateway error ret=${parsed.ret} errcode=${parsed.errcode} ${parsed.errmsg ?? ""}${hint}`);
24632
24642
  }
24633
24643
  } catch (err) {
@@ -24671,7 +24681,7 @@ async function notifyStop(params) {
24671
24681
  }
24672
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;
24673
24683
  var init_api = __esm({
24674
- "packages/server/dist/channels/wechat/api.js"() {
24684
+ "../server/dist/channels/wechat/api.js"() {
24675
24685
  "use strict";
24676
24686
  QR_BASE_URL = "https://ilinkai.weixin.qq.com";
24677
24687
  DEFAULT_BOT_TYPE = "3";
@@ -24683,10 +24693,10 @@ var init_api = __esm({
24683
24693
  }
24684
24694
  });
24685
24695
 
24686
- // packages/server/dist/channels/wechat/types.js
24696
+ // ../server/dist/channels/wechat/types.js
24687
24697
  var MessageItemType, MessageType, MessageState, UploadMediaType;
24688
24698
  var init_types = __esm({
24689
- "packages/server/dist/channels/wechat/types.js"() {
24699
+ "../server/dist/channels/wechat/types.js"() {
24690
24700
  "use strict";
24691
24701
  MessageItemType = {
24692
24702
  NONE: 0,
@@ -24715,7 +24725,7 @@ var init_types = __esm({
24715
24725
  }
24716
24726
  });
24717
24727
 
24718
- // packages/server/dist/channels/wechat/accounts.js
24728
+ // ../server/dist/channels/wechat/accounts.js
24719
24729
  function toWechat(a) {
24720
24730
  const c = a.config;
24721
24731
  return {
@@ -24797,24 +24807,27 @@ function saveSyncBuf(db, accountId, syncBuf) {
24797
24807
  }
24798
24808
  var CH3;
24799
24809
  var init_accounts4 = __esm({
24800
- "packages/server/dist/channels/wechat/accounts.js"() {
24810
+ "../server/dist/channels/wechat/accounts.js"() {
24801
24811
  "use strict";
24802
24812
  init_accounts();
24803
24813
  CH3 = "wechat";
24804
24814
  }
24805
24815
  });
24806
24816
 
24807
- // packages/server/dist/channels/wechat/event-adapter.js
24808
- var HARD_CHARS2, WechatResponder;
24817
+ // ../server/dist/channels/wechat/event-adapter.js
24818
+ var WECHAT_TEXT_LIMIT, WechatResponder;
24809
24819
  var init_event_adapter2 = __esm({
24810
- "packages/server/dist/channels/wechat/event-adapter.js"() {
24820
+ "../server/dist/channels/wechat/event-adapter.js"() {
24811
24821
  "use strict";
24822
+ init_chunk();
24812
24823
  init_media();
24813
- HARD_CHARS2 = 3500;
24824
+ WECHAT_TEXT_LIMIT = 3500;
24814
24825
  WechatResponder = class {
24815
24826
  buffer = "";
24816
24827
  deps;
24817
24828
  closed = false;
24829
+ /** Tail of the per-responder send chain — see `enqueueChunk`. */
24830
+ sendTail = Promise.resolve();
24818
24831
  constructor(deps) {
24819
24832
  this.deps = deps;
24820
24833
  }
@@ -24825,19 +24838,19 @@ var init_event_adapter2 = __esm({
24825
24838
  return;
24826
24839
  switch (event.type) {
24827
24840
  case "stream":
24828
- if (event.text)
24841
+ if (event.final && event.text)
24829
24842
  this.append(event.text);
24830
24843
  break;
24831
24844
  case "error":
24832
24845
  if (event.error) {
24833
24846
  this.flushAll();
24834
- void this.dispatchChunk(`\u274C ${event.error}`);
24847
+ this.enqueueChunk(`\u274C ${event.error}`);
24835
24848
  }
24836
24849
  break;
24837
24850
  case "system":
24838
24851
  if (event.text) {
24839
24852
  this.flushAll();
24840
- void this.dispatchChunk(`\u2139\uFE0F ${event.text}`);
24853
+ this.enqueueChunk(`\u2139\uFE0F ${event.text}`);
24841
24854
  }
24842
24855
  break;
24843
24856
  case "complete":
@@ -24845,46 +24858,43 @@ var init_event_adapter2 = __esm({
24845
24858
  break;
24846
24859
  }
24847
24860
  }
24861
+ /** Returns the drain promise so the bridge keeps the reply route alive
24862
+ * until the last queued chunk has actually been sent. */
24848
24863
  close() {
24849
24864
  if (this.closed)
24850
- return;
24865
+ return this.sendTail;
24851
24866
  this.flushAll();
24852
24867
  this.closed = true;
24868
+ return this.sendTail;
24853
24869
  }
24854
24870
  append(text5) {
24855
24871
  this.buffer += text5;
24856
- while (this.buffer.length >= HARD_CHARS2) {
24857
- const cut = this.findSplitPoint(this.buffer, HARD_CHARS2);
24858
- const chunk = this.buffer.slice(0, cut);
24859
- this.buffer = this.buffer.slice(cut).trimStart();
24860
- void this.dispatchChunk(chunk);
24861
- }
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);
24862
24878
  }
24863
24879
  flushAll() {
24864
24880
  if (!this.buffer)
24865
24881
  return;
24866
- while (this.buffer.length > HARD_CHARS2) {
24867
- const cut = this.findSplitPoint(this.buffer, HARD_CHARS2);
24868
- const chunk = this.buffer.slice(0, cut);
24869
- this.buffer = this.buffer.slice(cut).trimStart();
24870
- void this.dispatchChunk(chunk);
24871
- }
24872
- if (this.buffer) {
24873
- const text5 = this.buffer;
24874
- this.buffer = "";
24875
- void this.dispatchChunk(text5);
24876
- }
24882
+ const chunks = splitText(this.buffer, WECHAT_TEXT_LIMIT);
24883
+ this.buffer = "";
24884
+ for (const chunk of chunks)
24885
+ this.enqueueChunk(chunk);
24877
24886
  }
24878
24887
  /**
24879
- * Pick an index ≤ `limit` to split `text` at. Prefer the last paragraph
24880
- * 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).
24881
24894
  */
24882
- findSplitPoint(text5, limit) {
24883
- const window = text5.slice(0, limit);
24884
- const lastPara = window.lastIndexOf("\n\n");
24885
- if (lastPara > limit / 2)
24886
- return lastPara + 2;
24887
- return limit;
24895
+ enqueueChunk(chunk) {
24896
+ this.sendTail = this.sendTail.then(() => this.dispatchChunk(chunk)).catch(() => {
24897
+ });
24888
24898
  }
24889
24899
  /**
24890
24900
  * Extract MEDIA: lines, dispatching them as media sends. Remaining text
@@ -24911,7 +24921,7 @@ var init_event_adapter2 = __esm({
24911
24921
  }
24912
24922
  });
24913
24923
 
24914
- // packages/server/dist/channels/wechat/cdn.js
24924
+ // ../server/dist/channels/wechat/cdn.js
24915
24925
  import { createDecipheriv, createCipheriv, randomBytes as randomBytes2, createHash as createHash2 } from "node:crypto";
24916
24926
  function decryptAesEcb(ciphertext, key) {
24917
24927
  const decipher = createDecipheriv("aes-128-ecb", key, null);
@@ -25010,14 +25020,14 @@ async function uploadCiphertext(params) {
25010
25020
  }
25011
25021
  var CDN_BASE_URL, UPLOAD_MAX_RETRIES;
25012
25022
  var init_cdn = __esm({
25013
- "packages/server/dist/channels/wechat/cdn.js"() {
25023
+ "../server/dist/channels/wechat/cdn.js"() {
25014
25024
  "use strict";
25015
25025
  CDN_BASE_URL = "https://novac2c.cdn.weixin.qq.com/c2c";
25016
25026
  UPLOAD_MAX_RETRIES = 3;
25017
25027
  }
25018
25028
  });
25019
25029
 
25020
- // packages/server/dist/channels/wechat/send-media.js
25030
+ // ../server/dist/channels/wechat/send-media.js
25021
25031
  import fs51 from "node:fs/promises";
25022
25032
  import path59 from "node:path";
25023
25033
  function inferKind(filePath) {
@@ -25111,7 +25121,7 @@ function buildMessageItem(args) {
25111
25121
  };
25112
25122
  }
25113
25123
  var init_send_media = __esm({
25114
- "packages/server/dist/channels/wechat/send-media.js"() {
25124
+ "../server/dist/channels/wechat/send-media.js"() {
25115
25125
  "use strict";
25116
25126
  init_api();
25117
25127
  init_cdn();
@@ -25120,7 +25130,7 @@ var init_send_media = __esm({
25120
25130
  }
25121
25131
  });
25122
25132
 
25123
- // packages/server/dist/channels/wechat/login.js
25133
+ // ../server/dist/channels/wechat/login.js
25124
25134
  import { randomUUID as randomUUID2 } from "node:crypto";
25125
25135
  function isFresh(l) {
25126
25136
  return Date.now() - l.startedAt < ACTIVE_TTL_MS;
@@ -25222,7 +25232,7 @@ async function waitLogin(params) {
25222
25232
  }
25223
25233
  var ACTIVE_TTL_MS, MAX_QR_REFRESH, activeLogins;
25224
25234
  var init_login = __esm({
25225
- "packages/server/dist/channels/wechat/login.js"() {
25235
+ "../server/dist/channels/wechat/login.js"() {
25226
25236
  "use strict";
25227
25237
  init_api();
25228
25238
  ACTIVE_TTL_MS = 5 * 6e4;
@@ -25231,7 +25241,7 @@ var init_login = __esm({
25231
25241
  }
25232
25242
  });
25233
25243
 
25234
- // packages/server/dist/channels/wechat/handler.js
25244
+ // ../server/dist/channels/wechat/handler.js
25235
25245
  import fs52 from "node:fs";
25236
25246
  import path60 from "node:path";
25237
25247
  import QRCode from "qrcode";
@@ -25687,7 +25697,7 @@ function sleep2(ms, signal) {
25687
25697
  }
25688
25698
  var MAX_CONSECUTIVE_FAILURES, BACKOFF_DELAY_MS, RETRY_DELAY_MS;
25689
25699
  var init_handler3 = __esm({
25690
- "packages/server/dist/channels/wechat/handler.js"() {
25700
+ "../server/dist/channels/wechat/handler.js"() {
25691
25701
  "use strict";
25692
25702
  init_api();
25693
25703
  init_types();
@@ -25709,7 +25719,7 @@ var init_handler3 = __esm({
25709
25719
  }
25710
25720
  });
25711
25721
 
25712
- // packages/server/dist/routes/wechat.js
25722
+ // ../server/dist/routes/wechat.js
25713
25723
  import { Hono as Hono16 } from "hono";
25714
25724
  import path61 from "node:path";
25715
25725
  import fs53 from "node:fs";
@@ -25824,7 +25834,7 @@ function stripSecrets(acc) {
25824
25834
  return rest;
25825
25835
  }
25826
25836
  var init_wechat = __esm({
25827
- "packages/server/dist/routes/wechat.js"() {
25837
+ "../server/dist/routes/wechat.js"() {
25828
25838
  "use strict";
25829
25839
  init_login();
25830
25840
  init_accounts4();
@@ -25832,7 +25842,7 @@ var init_wechat = __esm({
25832
25842
  }
25833
25843
  });
25834
25844
 
25835
- // packages/server/dist/channels/wechat/cron-dispatcher.js
25845
+ // ../server/dist/channels/wechat/cron-dispatcher.js
25836
25846
  function readLastActiveChatId(accountId) {
25837
25847
  const acct = getAccount(getChannelDb(), accountId);
25838
25848
  if (!acct)
@@ -25852,7 +25862,14 @@ async function dispatch2(accountId, text5, explicitChatId, media) {
25852
25862
  }
25853
25863
  const out = [];
25854
25864
  if (text5) {
25855
- 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
+ }
25856
25873
  out.push({ channelType: "wechat", accountId, chatId, ok: true });
25857
25874
  }
25858
25875
  for (const filePath of media?.paths ?? []) {
@@ -25899,22 +25916,24 @@ function registerWechatCronDispatcher() {
25899
25916
  registerCronDispatcher({ channelType: "wechat", supportsMedia: true, dispatch: dispatch2, listTargets: listTargets2 });
25900
25917
  }
25901
25918
  var init_cron_dispatcher2 = __esm({
25902
- "packages/server/dist/channels/wechat/cron-dispatcher.js"() {
25919
+ "../server/dist/channels/wechat/cron-dispatcher.js"() {
25903
25920
  "use strict";
25904
25921
  init_channel_db();
25905
25922
  init_accounts();
25906
25923
  init_accounts4();
25907
25924
  init_handler3();
25908
25925
  init_send_media();
25926
+ init_event_adapter2();
25927
+ init_chunk();
25909
25928
  init_media();
25910
25929
  init_dispatcher();
25911
25930
  }
25912
25931
  });
25913
25932
 
25914
- // packages/server/dist/channels/wechat/descriptor.js
25933
+ // ../server/dist/channels/wechat/descriptor.js
25915
25934
  var wechatDescriptor;
25916
25935
  var init_descriptor2 = __esm({
25917
- "packages/server/dist/channels/wechat/descriptor.js"() {
25936
+ "../server/dist/channels/wechat/descriptor.js"() {
25918
25937
  "use strict";
25919
25938
  init_handler3();
25920
25939
  init_wechat();
@@ -25929,7 +25948,7 @@ var init_descriptor2 = __esm({
25929
25948
  }
25930
25949
  });
25931
25950
 
25932
- // packages/server/dist/channels/web/handler.js
25951
+ // ../server/dist/channels/web/handler.js
25933
25952
  function buildWebSessionPrefix(accountId) {
25934
25953
  return sessionPrefix("web", accountId);
25935
25954
  }
@@ -26312,7 +26331,7 @@ function createMediaBuffer() {
26312
26331
  };
26313
26332
  }
26314
26333
  var init_handler4 = __esm({
26315
- "packages/server/dist/channels/web/handler.js"() {
26334
+ "../server/dist/channels/web/handler.js"() {
26316
26335
  "use strict";
26317
26336
  init_ui_log_builder();
26318
26337
  init_accounts2();
@@ -26327,7 +26346,7 @@ var init_handler4 = __esm({
26327
26346
  }
26328
26347
  });
26329
26348
 
26330
- // packages/server/dist/routes/web.js
26349
+ // ../server/dist/routes/web.js
26331
26350
  import { Hono as Hono17 } from "hono";
26332
26351
  import { streamSSE } from "hono/streaming";
26333
26352
  import crypto4 from "node:crypto";
@@ -26524,7 +26543,7 @@ function createWebRoutes(deps) {
26524
26543
  return app2;
26525
26544
  }
26526
26545
  var init_web = __esm({
26527
- "packages/server/dist/routes/web.js"() {
26546
+ "../server/dist/routes/web.js"() {
26528
26547
  "use strict";
26529
26548
  init_dist();
26530
26549
  init_accounts2();
@@ -26533,10 +26552,10 @@ var init_web = __esm({
26533
26552
  }
26534
26553
  });
26535
26554
 
26536
- // packages/server/dist/channels/web/descriptor.js
26555
+ // ../server/dist/channels/web/descriptor.js
26537
26556
  var webDescriptor;
26538
26557
  var init_descriptor3 = __esm({
26539
- "packages/server/dist/channels/web/descriptor.js"() {
26558
+ "../server/dist/channels/web/descriptor.js"() {
26540
26559
  "use strict";
26541
26560
  init_handler4();
26542
26561
  init_web();
@@ -26552,7 +26571,7 @@ var init_descriptor3 = __esm({
26552
26571
  }
26553
26572
  });
26554
26573
 
26555
- // packages/server/dist/channels/slack/accounts.js
26574
+ // ../server/dist/channels/slack/accounts.js
26556
26575
  function toSlack(a) {
26557
26576
  const c = a.config;
26558
26577
  return {
@@ -26628,14 +26647,14 @@ function deleteAccount5(db, accountId) {
26628
26647
  }
26629
26648
  var CH4;
26630
26649
  var init_accounts5 = __esm({
26631
- "packages/server/dist/channels/slack/accounts.js"() {
26650
+ "../server/dist/channels/slack/accounts.js"() {
26632
26651
  "use strict";
26633
26652
  init_accounts();
26634
26653
  CH4 = "slack";
26635
26654
  }
26636
26655
  });
26637
26656
 
26638
- // packages/server/dist/channels/shared/markdown.js
26657
+ // ../server/dist/channels/shared/markdown.js
26639
26658
  function formatForSlack(input) {
26640
26659
  if (!input)
26641
26660
  return "";
@@ -26714,19 +26733,20 @@ function stripCommonMark(line) {
26714
26733
  return line;
26715
26734
  }
26716
26735
  var init_markdown = __esm({
26717
- "packages/server/dist/channels/shared/markdown.js"() {
26736
+ "../server/dist/channels/shared/markdown.js"() {
26718
26737
  "use strict";
26719
26738
  }
26720
26739
  });
26721
26740
 
26722
- // packages/server/dist/channels/slack/event-adapter.js
26723
- var HARD_CHARS3, SlackResponder;
26741
+ // ../server/dist/channels/slack/event-adapter.js
26742
+ var HARD_CHARS2, SlackResponder;
26724
26743
  var init_event_adapter3 = __esm({
26725
- "packages/server/dist/channels/slack/event-adapter.js"() {
26744
+ "../server/dist/channels/slack/event-adapter.js"() {
26726
26745
  "use strict";
26746
+ init_chunk();
26727
26747
  init_markdown();
26728
26748
  init_media();
26729
- HARD_CHARS3 = 35e3;
26749
+ HARD_CHARS2 = 35e3;
26730
26750
  SlackResponder = class {
26731
26751
  buffer = "";
26732
26752
  deps;
@@ -26743,7 +26763,7 @@ var init_event_adapter3 = __esm({
26743
26763
  return;
26744
26764
  switch (event.type) {
26745
26765
  case "stream":
26746
- if (event.text)
26766
+ if (event.final && event.text)
26747
26767
  this.buffer += event.text;
26748
26768
  break;
26749
26769
  case "system":
@@ -26775,24 +26795,10 @@ var init_event_adapter3 = __esm({
26775
26795
  flushBuffer() {
26776
26796
  if (!this.buffer)
26777
26797
  return;
26778
- while (this.buffer.length > HARD_CHARS3) {
26779
- const cut = this.findSplitPoint(this.buffer, HARD_CHARS3);
26780
- const chunk = this.buffer.slice(0, cut);
26781
- this.buffer = this.buffer.slice(cut).trimStart();
26798
+ const chunks = splitText(this.buffer, HARD_CHARS2);
26799
+ this.buffer = "";
26800
+ for (const chunk of chunks)
26782
26801
  this.enqueueChunk(chunk);
26783
- }
26784
- if (this.buffer) {
26785
- const text5 = this.buffer;
26786
- this.buffer = "";
26787
- this.enqueueChunk(text5);
26788
- }
26789
- }
26790
- findSplitPoint(text5, limit) {
26791
- const window = text5.slice(0, limit);
26792
- const lastPara = window.lastIndexOf("\n\n");
26793
- if (lastPara > limit / 2)
26794
- return lastPara + 2;
26795
- return limit;
26796
26802
  }
26797
26803
  /**
26798
26804
  * Serialize sends per responder. `flushBuffer` can produce several chunks
@@ -26828,7 +26834,7 @@ var init_event_adapter3 = __esm({
26828
26834
  }
26829
26835
  });
26830
26836
 
26831
- // packages/server/dist/channels/slack/api.js
26837
+ // ../server/dist/channels/slack/api.js
26832
26838
  async function slackPost(endpoint, token, body) {
26833
26839
  const isForm = body instanceof FormData;
26834
26840
  const res = await fetch(`${SLACK_API}/${endpoint}`, {
@@ -27016,13 +27022,13 @@ async function downloadFile(botToken, urlPrivate) {
27016
27022
  }
27017
27023
  var SLACK_API;
27018
27024
  var init_api2 = __esm({
27019
- "packages/server/dist/channels/slack/api.js"() {
27025
+ "../server/dist/channels/slack/api.js"() {
27020
27026
  "use strict";
27021
27027
  SLACK_API = "https://slack.com/api";
27022
27028
  }
27023
27029
  });
27024
27030
 
27025
- // packages/server/dist/channels/slack/handler.js
27031
+ // ../server/dist/channels/slack/handler.js
27026
27032
  import path62 from "node:path";
27027
27033
  import { WebSocket } from "ws";
27028
27034
  function slashToBang(text5, commandNames) {
@@ -27382,7 +27388,7 @@ function buildCmdCtx(args) {
27382
27388
  }
27383
27389
  var SLACK_EXTRA_COMMANDS, SEEN_EVENT_IDS, SEEN_EVENT_IDS_MAX;
27384
27390
  var init_handler5 = __esm({
27385
- "packages/server/dist/channels/slack/handler.js"() {
27391
+ "../server/dist/channels/slack/handler.js"() {
27386
27392
  "use strict";
27387
27393
  init_accounts5();
27388
27394
  init_event_adapter3();
@@ -27402,7 +27408,7 @@ var init_handler5 = __esm({
27402
27408
  }
27403
27409
  });
27404
27410
 
27405
- // packages/server/dist/routes/slack.js
27411
+ // ../server/dist/routes/slack.js
27406
27412
  import { Hono as Hono18 } from "hono";
27407
27413
  import fs55 from "node:fs";
27408
27414
  function createSlackRoutes(deps) {
@@ -27536,7 +27542,7 @@ function createSlackRoutes(deps) {
27536
27542
  return app2;
27537
27543
  }
27538
27544
  var init_slack = __esm({
27539
- "packages/server/dist/routes/slack.js"() {
27545
+ "../server/dist/routes/slack.js"() {
27540
27546
  "use strict";
27541
27547
  init_accounts5();
27542
27548
  init_accounts();
@@ -27544,7 +27550,7 @@ var init_slack = __esm({
27544
27550
  }
27545
27551
  });
27546
27552
 
27547
- // packages/server/dist/channels/slack/cron-dispatcher.js
27553
+ // ../server/dist/channels/slack/cron-dispatcher.js
27548
27554
  function parseChatId(raw) {
27549
27555
  const idx = raw.indexOf(":");
27550
27556
  if (idx < 0)
@@ -27608,7 +27614,7 @@ function registerSlackCronDispatcher() {
27608
27614
  registerCronDispatcher({ channelType: "slack", supportsMedia: true, dispatch: dispatch3, listTargets: listTargets3 });
27609
27615
  }
27610
27616
  var init_cron_dispatcher3 = __esm({
27611
- "packages/server/dist/channels/slack/cron-dispatcher.js"() {
27617
+ "../server/dist/channels/slack/cron-dispatcher.js"() {
27612
27618
  "use strict";
27613
27619
  init_channel_db();
27614
27620
  init_accounts5();
@@ -27618,10 +27624,10 @@ var init_cron_dispatcher3 = __esm({
27618
27624
  }
27619
27625
  });
27620
27626
 
27621
- // packages/server/dist/channels/slack/descriptor.js
27627
+ // ../server/dist/channels/slack/descriptor.js
27622
27628
  var slackDescriptor;
27623
27629
  var init_descriptor4 = __esm({
27624
- "packages/server/dist/channels/slack/descriptor.js"() {
27630
+ "../server/dist/channels/slack/descriptor.js"() {
27625
27631
  "use strict";
27626
27632
  init_handler5();
27627
27633
  init_slack();
@@ -27636,7 +27642,7 @@ var init_descriptor4 = __esm({
27636
27642
  }
27637
27643
  });
27638
27644
 
27639
- // packages/server/dist/channels/feishu/accounts.js
27645
+ // ../server/dist/channels/feishu/accounts.js
27640
27646
  function toFeishu(a) {
27641
27647
  const c = a.config;
27642
27648
  return {
@@ -27714,21 +27720,22 @@ function deleteAccount6(db, accountId) {
27714
27720
  }
27715
27721
  var CH5;
27716
27722
  var init_accounts6 = __esm({
27717
- "packages/server/dist/channels/feishu/accounts.js"() {
27723
+ "../server/dist/channels/feishu/accounts.js"() {
27718
27724
  "use strict";
27719
27725
  init_accounts();
27720
27726
  CH5 = "feishu";
27721
27727
  }
27722
27728
  });
27723
27729
 
27724
- // packages/server/dist/channels/feishu/event-adapter.js
27725
- var HARD_CHARS4, FeishuResponder;
27730
+ // ../server/dist/channels/feishu/event-adapter.js
27731
+ var HARD_CHARS3, FeishuResponder;
27726
27732
  var init_event_adapter4 = __esm({
27727
- "packages/server/dist/channels/feishu/event-adapter.js"() {
27733
+ "../server/dist/channels/feishu/event-adapter.js"() {
27728
27734
  "use strict";
27735
+ init_chunk();
27729
27736
  init_markdown();
27730
27737
  init_media();
27731
- HARD_CHARS4 = 4500;
27738
+ HARD_CHARS3 = 4500;
27732
27739
  FeishuResponder = class {
27733
27740
  buffer = "";
27734
27741
  deps;
@@ -27745,7 +27752,7 @@ var init_event_adapter4 = __esm({
27745
27752
  return;
27746
27753
  switch (event.type) {
27747
27754
  case "stream":
27748
- if (event.text)
27755
+ if (event.final && event.text)
27749
27756
  this.buffer += event.text;
27750
27757
  break;
27751
27758
  case "system":
@@ -27777,24 +27784,10 @@ var init_event_adapter4 = __esm({
27777
27784
  flushBuffer() {
27778
27785
  if (!this.buffer)
27779
27786
  return;
27780
- while (this.buffer.length > HARD_CHARS4) {
27781
- const cut = this.findSplitPoint(this.buffer, HARD_CHARS4);
27782
- const chunk = this.buffer.slice(0, cut);
27783
- this.buffer = this.buffer.slice(cut).trimStart();
27787
+ const chunks = splitText(this.buffer, HARD_CHARS3);
27788
+ this.buffer = "";
27789
+ for (const chunk of chunks)
27784
27790
  this.enqueueChunk(chunk);
27785
- }
27786
- if (this.buffer) {
27787
- const text5 = this.buffer;
27788
- this.buffer = "";
27789
- this.enqueueChunk(text5);
27790
- }
27791
- }
27792
- findSplitPoint(text5, limit) {
27793
- const window = text5.slice(0, limit);
27794
- const lastPara = window.lastIndexOf("\n\n");
27795
- if (lastPara > limit / 2)
27796
- return lastPara + 2;
27797
- return limit;
27798
27791
  }
27799
27792
  /**
27800
27793
  * Serialize sends per responder — same rationale as the Slack adapter
@@ -27830,7 +27823,7 @@ var init_event_adapter4 = __esm({
27830
27823
  }
27831
27824
  });
27832
27825
 
27833
- // packages/server/dist/channels/feishu/api.js
27826
+ // ../server/dist/channels/feishu/api.js
27834
27827
  async function getTenantAccessToken(args) {
27835
27828
  const cached = tokenCache.get(args.appId);
27836
27829
  if (cached && cached.expiresAt - Date.now() > 6e4)
@@ -28094,14 +28087,14 @@ async function searchFeishuTargets(args) {
28094
28087
  }
28095
28088
  var FEISHU_BASE, tokenCache;
28096
28089
  var init_api3 = __esm({
28097
- "packages/server/dist/channels/feishu/api.js"() {
28090
+ "../server/dist/channels/feishu/api.js"() {
28098
28091
  "use strict";
28099
28092
  FEISHU_BASE = "https://open.feishu.cn";
28100
28093
  tokenCache = /* @__PURE__ */ new Map();
28101
28094
  }
28102
28095
  });
28103
28096
 
28104
- // packages/server/dist/channels/feishu/handler.js
28097
+ // ../server/dist/channels/feishu/handler.js
28105
28098
  import path63 from "node:path";
28106
28099
  import * as Lark from "@larksuiteoapi/node-sdk";
28107
28100
  function buildSessionPrefixForThread2(chatId, rootId) {
@@ -28511,7 +28504,7 @@ function buildCmdCtx2(args) {
28511
28504
  };
28512
28505
  }
28513
28506
  var init_handler6 = __esm({
28514
- "packages/server/dist/channels/feishu/handler.js"() {
28507
+ "../server/dist/channels/feishu/handler.js"() {
28515
28508
  "use strict";
28516
28509
  init_accounts6();
28517
28510
  init_event_adapter4();
@@ -28526,7 +28519,7 @@ var init_handler6 = __esm({
28526
28519
  }
28527
28520
  });
28528
28521
 
28529
- // packages/server/dist/routes/feishu.js
28522
+ // ../server/dist/routes/feishu.js
28530
28523
  import { Hono as Hono19 } from "hono";
28531
28524
  import fs56 from "node:fs";
28532
28525
  function createFeishuRoutes(deps) {
@@ -28663,7 +28656,7 @@ function createFeishuRoutes(deps) {
28663
28656
  return app2;
28664
28657
  }
28665
28658
  var init_feishu = __esm({
28666
- "packages/server/dist/routes/feishu.js"() {
28659
+ "../server/dist/routes/feishu.js"() {
28667
28660
  "use strict";
28668
28661
  init_accounts6();
28669
28662
  init_accounts();
@@ -28671,7 +28664,7 @@ var init_feishu = __esm({
28671
28664
  }
28672
28665
  });
28673
28666
 
28674
- // packages/server/dist/channels/feishu/cron-dispatcher.js
28667
+ // ../server/dist/channels/feishu/cron-dispatcher.js
28675
28668
  function parseChatId2(raw) {
28676
28669
  const idx = raw.indexOf(":");
28677
28670
  return { chatId: idx < 0 ? raw : raw.slice(0, idx) };
@@ -28721,7 +28714,7 @@ function registerFeishuCronDispatcher() {
28721
28714
  registerCronDispatcher({ channelType: "feishu", dispatch: dispatch4, listTargets: listTargets4 });
28722
28715
  }
28723
28716
  var init_cron_dispatcher4 = __esm({
28724
- "packages/server/dist/channels/feishu/cron-dispatcher.js"() {
28717
+ "../server/dist/channels/feishu/cron-dispatcher.js"() {
28725
28718
  "use strict";
28726
28719
  init_channel_db();
28727
28720
  init_accounts6();
@@ -28730,10 +28723,10 @@ var init_cron_dispatcher4 = __esm({
28730
28723
  }
28731
28724
  });
28732
28725
 
28733
- // packages/server/dist/channels/feishu/descriptor.js
28726
+ // ../server/dist/channels/feishu/descriptor.js
28734
28727
  var feishuDescriptor;
28735
28728
  var init_descriptor5 = __esm({
28736
- "packages/server/dist/channels/feishu/descriptor.js"() {
28729
+ "../server/dist/channels/feishu/descriptor.js"() {
28737
28730
  "use strict";
28738
28731
  init_handler6();
28739
28732
  init_feishu();
@@ -28748,10 +28741,10 @@ var init_descriptor5 = __esm({
28748
28741
  }
28749
28742
  });
28750
28743
 
28751
- // packages/server/dist/channels/descriptors.js
28744
+ // ../server/dist/channels/descriptors.js
28752
28745
  var defaultChannelDescriptors;
28753
28746
  var init_descriptors = __esm({
28754
- "packages/server/dist/channels/descriptors.js"() {
28747
+ "../server/dist/channels/descriptors.js"() {
28755
28748
  "use strict";
28756
28749
  init_descriptor();
28757
28750
  init_descriptor2();
@@ -28768,7 +28761,7 @@ var init_descriptors = __esm({
28768
28761
  }
28769
28762
  });
28770
28763
 
28771
- // packages/server/dist/middleware/auth.js
28764
+ // ../server/dist/middleware/auth.js
28772
28765
  import { Hono as Hono20 } from "hono";
28773
28766
  import { getCookie, setCookie } from "hono/cookie";
28774
28767
  import crypto5 from "node:crypto";
@@ -28961,7 +28954,7 @@ function authMiddleware() {
28961
28954
  }
28962
28955
  var TOKEN_MAX_AGE, REFRESH_AFTER, COOKIE_NAME, ADMIN_LOGIN_BUCKET, isLockedOut2, recordFailure2, clearFailures2, PUBLIC_PATHS;
28963
28956
  var init_auth = __esm({
28964
- "packages/server/dist/middleware/auth.js"() {
28957
+ "../server/dist/middleware/auth.js"() {
28965
28958
  "use strict";
28966
28959
  init_config();
28967
28960
  init_password_hash();
@@ -28978,7 +28971,7 @@ var init_auth = __esm({
28978
28971
  }
28979
28972
  });
28980
28973
 
28981
- // packages/server/dist/index.js
28974
+ // ../server/dist/index.js
28982
28975
  var dist_exports = {};
28983
28976
  import { Hono as Hono21 } from "hono";
28984
28977
  import { cors } from "hono/cors";
@@ -29106,7 +29099,7 @@ async function gracefulShutdown(signal) {
29106
29099
  }
29107
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;
29108
29101
  var init_dist2 = __esm({
29109
- async "packages/server/dist/index.js"() {
29102
+ async "../server/dist/index.js"() {
29110
29103
  "use strict";
29111
29104
  init_files();
29112
29105
  init_data_preview();
@@ -29144,7 +29137,7 @@ var init_dist2 = __esm({
29144
29137
  init_git_ssh();
29145
29138
  __dirname3 = path64.dirname(fileURLToPath3(import.meta.url));
29146
29139
  PORT = config.server.port;
29147
- HALO_VERSION = "1.1.4";
29140
+ HALO_VERSION = "1.1.5";
29148
29141
  PROJECT_ROOT = findProjectRoot();
29149
29142
  HALO_HOME4 = path64.join(homedir24(), ".halo");
29150
29143
  GIT_SHA = readGitSha();
@@ -29321,7 +29314,7 @@ var init_dist2 = __esm({
29321
29314
  }
29322
29315
  });
29323
29316
 
29324
- // packages/acp-adapter/dist/halo-client.js
29317
+ // ../acp-adapter/dist/halo-client.js
29325
29318
  async function safeText(res) {
29326
29319
  try {
29327
29320
  return (await res.text()).slice(0, 500);
@@ -29364,7 +29357,7 @@ async function* parseSseStream(body) {
29364
29357
  }
29365
29358
  var HaloClient;
29366
29359
  var init_halo_client = __esm({
29367
- "packages/acp-adapter/dist/halo-client.js"() {
29360
+ "../acp-adapter/dist/halo-client.js"() {
29368
29361
  "use strict";
29369
29362
  HaloClient = class {
29370
29363
  opts;
@@ -29443,7 +29436,7 @@ var init_halo_client = __esm({
29443
29436
  }
29444
29437
  });
29445
29438
 
29446
- // packages/acp-adapter/dist/adapter.js
29439
+ // ../acp-adapter/dist/adapter.js
29447
29440
  function newError(message, code = -32603) {
29448
29441
  const e = new Error(message);
29449
29442
  e.code = code;
@@ -29451,7 +29444,7 @@ function newError(message, code = -32603) {
29451
29444
  }
29452
29445
  var AcpAdapter;
29453
29446
  var init_adapter = __esm({
29454
- "packages/acp-adapter/dist/adapter.js"() {
29447
+ "../acp-adapter/dist/adapter.js"() {
29455
29448
  "use strict";
29456
29449
  init_halo_client();
29457
29450
  AcpAdapter = class {
@@ -29740,10 +29733,10 @@ var init_adapter = __esm({
29740
29733
  }
29741
29734
  });
29742
29735
 
29743
- // packages/acp-adapter/dist/jsonrpc.js
29736
+ // ../acp-adapter/dist/jsonrpc.js
29744
29737
  var ERROR_PARSE, ERROR_METHOD_NOT_FOUND, ERROR_INTERNAL, JsonRpcConnection;
29745
29738
  var init_jsonrpc = __esm({
29746
- "packages/acp-adapter/dist/jsonrpc.js"() {
29739
+ "../acp-adapter/dist/jsonrpc.js"() {
29747
29740
  "use strict";
29748
29741
  ERROR_PARSE = -32700;
29749
29742
  ERROR_METHOD_NOT_FOUND = -32601;
@@ -29876,7 +29869,7 @@ var init_jsonrpc = __esm({
29876
29869
  }
29877
29870
  });
29878
29871
 
29879
- // packages/acp-adapter/dist/index.js
29872
+ // ../acp-adapter/dist/index.js
29880
29873
  var dist_exports2 = {};
29881
29874
  __export(dist_exports2, {
29882
29875
  main: () => main
@@ -29992,7 +29985,7 @@ function main(argv = process.argv.slice(2)) {
29992
29985
  }
29993
29986
  var HELP;
29994
29987
  var init_dist3 = __esm({
29995
- "packages/acp-adapter/dist/index.js"() {
29988
+ "../acp-adapter/dist/index.js"() {
29996
29989
  "use strict";
29997
29990
  init_adapter();
29998
29991
  init_jsonrpc();
@@ -30031,7 +30024,7 @@ Stdio:
30031
30024
  }
30032
30025
  });
30033
30026
 
30034
- // packages/cli/src/silence-warnings.ts
30027
+ // src/silence-warnings.ts
30035
30028
  var emit = process.emitWarning.bind(process);
30036
30029
  process.emitWarning = (warning, ...args) => {
30037
30030
  const opt = args[0];
@@ -30040,13 +30033,13 @@ process.emitWarning = (warning, ...args) => {
30040
30033
  return emit(warning, ...args);
30041
30034
  };
30042
30035
 
30043
- // packages/cli/src/index.ts
30036
+ // src/index.ts
30044
30037
  init_server_supervisor();
30045
30038
  import path65 from "node:path";
30046
30039
  import fs58 from "node:fs";
30047
30040
  import { homedir as homedir25 } from "node:os";
30048
30041
  import { parseArgs as parseArgs2 } from "node:util";
30049
- var VERSION = "1.1.4";
30042
+ var VERSION = "1.1.5";
30050
30043
  var HELP_TOP = `Usage: halo <command> [options]
30051
30044
 
30052
30045
  Commands: