@turmind/halo 0.2.6 → 1.0.1

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.
Files changed (34) hide show
  1. package/README.md +5 -5
  2. package/admin-out/404.html +1 -1
  3. package/admin-out/_next/static/chunks/app/page-19d5f2a0a3412b4a.js +1 -0
  4. package/admin-out/_next/static/css/9e7dadb24830255a.css +3 -0
  5. package/admin-out/index.html +1 -1
  6. package/admin-out/index.txt +3 -3
  7. package/bundled-docs/design/agent.md +12 -2
  8. package/bundled-docs/design/session.md +9 -0
  9. package/bundled-docs/design/ws.md +4 -0
  10. package/bundled-docs/dev/add-model-provider.md +17 -9
  11. package/bundled-docs/dev/api.md +4 -0
  12. package/bundled-docs/dev/deploy.md +4 -8
  13. package/bundled-docs/dev/env.md +9 -4
  14. package/bundled-docs/dev/tools.md +4 -3
  15. package/bundled-docs/guide/cli.md +1 -0
  16. package/bundled-docs/requirements/chat.md +8 -1
  17. package/bundled-docs/requirements/session.md +2 -2
  18. package/dist/index.js +499 -430
  19. package/package.json +1 -1
  20. package/templates/models/anthropic.yaml +1 -0
  21. package/templates/models/aws-bedrock-claude-invoke.yaml +7 -0
  22. package/templates/models/aws-bedrock-mantle.yaml +51 -11
  23. package/templates/models/deepseek.yaml +2 -0
  24. package/templates/models/doubao.yaml +4 -0
  25. package/templates/models/hunyuan.yaml +1 -0
  26. package/templates/models/kimi.yaml +49 -13
  27. package/templates/models/mimo-token-plan-china.yaml +2 -0
  28. package/templates/models/minimax.yaml +37 -5
  29. package/templates/models/openai.yaml +1 -0
  30. package/templates/models/qwen.yaml +2 -0
  31. package/admin-out/_next/static/chunks/app/page-635d9668d47a2b9e.js +0 -1
  32. package/admin-out/_next/static/css/57622245d7724ee0.css +0 -3
  33. /package/admin-out/_next/static/{TmICbj6oGkbeEcs8tFjd3 → aWThs2cmYntOEy-YdkDPD}/_buildManifest.js +0 -0
  34. /package/admin-out/_next/static/{TmICbj6oGkbeEcs8tFjd3 → aWThs2cmYntOEy-YdkDPD}/_ssgManifest.js +0 -0
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
- // ../server/dist/prompts/md-loader.js
11
+ // packages/server/dist/prompts/md-loader.js
12
12
  import fs from "node:fs/promises";
13
13
  import fsSync from "node:fs";
14
14
  import path from "node:path";
@@ -150,13 +150,13 @@ function resolveMdFilePath(agentId, fileType, scope, workspaceRoot) {
150
150
  }
151
151
  var HALO_HOME;
152
152
  var init_md_loader = __esm({
153
- "../server/dist/prompts/md-loader.js"() {
153
+ "packages/server/dist/prompts/md-loader.js"() {
154
154
  "use strict";
155
155
  HALO_HOME = path.join(homedir(), ".halo", "global");
156
156
  }
157
157
  });
158
158
 
159
- // ../server/dist/settings-schema.js
159
+ // packages/server/dist/settings-schema.js
160
160
  import fs2 from "node:fs";
161
161
  import path2 from "node:path";
162
162
  import { homedir as homedir2 } from "node:os";
@@ -409,7 +409,7 @@ function loadSettingsSchema(workspaceRoot) {
409
409
  }
410
410
  var GLOBAL_MODELS_DIR, GLOBAL_SKILLS_DIR, GLOBAL_AGENTS_DIR, VALID_TYPES;
411
411
  var init_settings_schema = __esm({
412
- "../server/dist/settings-schema.js"() {
412
+ "packages/server/dist/settings-schema.js"() {
413
413
  "use strict";
414
414
  GLOBAL_MODELS_DIR = path2.join(homedir2(), ".halo", "global", "models");
415
415
  GLOBAL_SKILLS_DIR = path2.join(homedir2(), ".halo", "global", "skills");
@@ -418,7 +418,7 @@ var init_settings_schema = __esm({
418
418
  }
419
419
  });
420
420
 
421
- // ../server/dist/config.js
421
+ // packages/server/dist/config.js
422
422
  var config_exports = {};
423
423
  __export(config_exports, {
424
424
  HALO_GLOBAL_DIR: () => HALO_GLOBAL_DIR,
@@ -433,6 +433,7 @@ __export(config_exports, {
433
433
  reloadSandboxConfig: () => reloadSandboxConfig,
434
434
  resolveApiKey: () => resolveApiKey,
435
435
  resolveAwsCredentials: () => resolveAwsCredentials,
436
+ resolveContextWindow: () => resolveContextWindow,
436
437
  resolveMaxOutputTokens: () => resolveMaxOutputTokens,
437
438
  resolveThinkingMode: () => resolveThinkingMode,
438
439
  resolveVerbosity: () => resolveVerbosity
@@ -656,6 +657,10 @@ function resolveMaxOutputTokens(modelId) {
656
657
  const entry = findModelEntry(modelId);
657
658
  return entry?.maxOutputTokens ?? 16384;
658
659
  }
660
+ function resolveContextWindow(modelId) {
661
+ const entry = findModelEntry(modelId);
662
+ return entry?.contextWindow;
663
+ }
659
664
  function resolveApiKey(providerId, workspaceRoot) {
660
665
  return getServerSecret(providerId, "api_key", workspaceRoot) || void 0;
661
666
  }
@@ -708,7 +713,7 @@ function getModelsRegistry() {
708
713
  }
709
714
  var HALO_HOME2, HALO_GLOBAL_DIR, HALO_SECRETS_DIR, _modelsRegistryCache, _systemConfig, SETTINGS_PATH, _settingsCache, _schemaDefaultsCache, ENV_PATTERN, _wsSettingsCache, config, HIDDEN_DIRS_DEFAULT, HIDDEN_FILES_DEFAULT;
710
715
  var init_config = __esm({
711
- "../server/dist/config.js"() {
716
+ "packages/server/dist/config.js"() {
712
717
  "use strict";
713
718
  init_settings_schema();
714
719
  HALO_HOME2 = path3.join(homedir3(), ".halo");
@@ -916,7 +921,7 @@ var init_config = __esm({
916
921
  }
917
922
  });
918
923
 
919
- // ../server/dist/agents/conversation-repair.js
924
+ // packages/server/dist/agents/conversation-repair.js
920
925
  function getToolUseId(block) {
921
926
  const b = block;
922
927
  if (b.type === "tool_use" && typeof b.id === "string")
@@ -1034,12 +1039,12 @@ function repairConversationMessages(raw, label = "[Repair]") {
1034
1039
  return messages2;
1035
1040
  }
1036
1041
  var init_conversation_repair = __esm({
1037
- "../server/dist/agents/conversation-repair.js"() {
1042
+ "packages/server/dist/agents/conversation-repair.js"() {
1038
1043
  "use strict";
1039
1044
  }
1040
1045
  });
1041
1046
 
1042
- // ../server/dist/agents/compact.js
1047
+ // packages/server/dist/agents/compact.js
1043
1048
  function splitForCompact(messages2) {
1044
1049
  const keepCount = config.compact.keep_messages;
1045
1050
  let cut = Math.max(0, messages2.length - keepCount);
@@ -1086,13 +1091,13 @@ ${summaryText}` }]
1086
1091
  return { compacted: true, messages: [summaryMsg, ...recentMsgs] };
1087
1092
  }
1088
1093
  var init_compact = __esm({
1089
- "../server/dist/agents/compact.js"() {
1094
+ "packages/server/dist/agents/compact.js"() {
1090
1095
  "use strict";
1091
1096
  init_config();
1092
1097
  }
1093
1098
  });
1094
1099
 
1095
- // ../server/dist/agents/micro-compact.js
1100
+ // packages/server/dist/agents/micro-compact.js
1096
1101
  function microCompactMessages(messages2, keepRecent = DEFAULT_KEEP_RECENT) {
1097
1102
  if (!messages2 || messages2.length === 0) {
1098
1103
  return { compacted: false, cleared: 0, messages: messages2 };
@@ -1140,7 +1145,7 @@ function microCompactMessages(messages2, keepRecent = DEFAULT_KEEP_RECENT) {
1140
1145
  }
1141
1146
  var MICRO_COMPACT_PLACEHOLDER, COMPACTABLE_TOOLS, DEFAULT_KEEP_RECENT;
1142
1147
  var init_micro_compact = __esm({
1143
- "../server/dist/agents/micro-compact.js"() {
1148
+ "packages/server/dist/agents/micro-compact.js"() {
1144
1149
  "use strict";
1145
1150
  MICRO_COMPACT_PLACEHOLDER = "[Old tool result content cleared]";
1146
1151
  COMPACTABLE_TOOLS = /* @__PURE__ */ new Set([
@@ -1157,10 +1162,10 @@ var init_micro_compact = __esm({
1157
1162
  }
1158
1163
  });
1159
1164
 
1160
- // ../server/dist/agents/agent-loop.js
1165
+ // packages/server/dist/agents/agent-loop.js
1161
1166
  var TOOL_ERROR_MARKER, TOOL_WARN_MARKER, MODEL_TIMEOUT_ERROR, AgentLoop;
1162
1167
  var init_agent_loop = __esm({
1163
- "../server/dist/agents/agent-loop.js"() {
1168
+ "packages/server/dist/agents/agent-loop.js"() {
1164
1169
  "use strict";
1165
1170
  init_config();
1166
1171
  TOOL_ERROR_MARKER = "__TOOL_ERROR__";
@@ -1322,7 +1327,7 @@ Error: ${err instanceof Error ? err.message : String(err)}`;
1322
1327
  }
1323
1328
  });
1324
1329
 
1325
- // ../server/dist/prompts/md-vars.js
1330
+ // packages/server/dist/prompts/md-vars.js
1326
1331
  var md_vars_exports = {};
1327
1332
  __export(md_vars_exports, {
1328
1333
  buildRenderContext: () => buildRenderContext,
@@ -1485,7 +1490,7 @@ async function buildRenderContext(opts) {
1485
1490
  }
1486
1491
  var PATTERN, ENV_PATTERN2, ARG_PATTERN, PARAM_PATH;
1487
1492
  var init_md_vars = __esm({
1488
- "../server/dist/prompts/md-vars.js"() {
1493
+ "packages/server/dist/prompts/md-vars.js"() {
1489
1494
  "use strict";
1490
1495
  PATTERN = /\{\{\s*([\w-][\w.-]*)\s*\}\}/g;
1491
1496
  ENV_PATTERN2 = /<<([A-Z_][A-Z0-9_]*)>>/g;
@@ -1494,7 +1499,7 @@ var init_md_vars = __esm({
1494
1499
  }
1495
1500
  });
1496
1501
 
1497
- // ../server/dist/agents/agent-loader.js
1502
+ // packages/server/dist/agents/agent-loader.js
1498
1503
  import fs5 from "node:fs/promises";
1499
1504
  import fsSync2 from "node:fs";
1500
1505
  import path5 from "node:path";
@@ -1768,7 +1773,7 @@ function isTeamMember(team, targetId) {
1768
1773
  }
1769
1774
  var GLOBAL_AGENTS_DIR2, GLOBAL_SKILLS_DIR2, SKILL_ID_RE, ACCESS_RANK;
1770
1775
  var init_agent_loader = __esm({
1771
- "../server/dist/agents/agent-loader.js"() {
1776
+ "packages/server/dist/agents/agent-loader.js"() {
1772
1777
  "use strict";
1773
1778
  init_agent_loop();
1774
1779
  GLOBAL_AGENTS_DIR2 = path5.join(homedir5(), ".halo", "global", "agents");
@@ -1783,7 +1788,7 @@ var init_agent_loader = __esm({
1783
1788
  }
1784
1789
  });
1785
1790
 
1786
- // ../server/dist/ws/broadcast.js
1791
+ // packages/server/dist/ws/broadcast.js
1787
1792
  function setBroadcastWss(wss2) {
1788
1793
  _wss = wss2;
1789
1794
  }
@@ -1804,13 +1809,13 @@ function broadcast(event) {
1804
1809
  }
1805
1810
  var _wss;
1806
1811
  var init_broadcast = __esm({
1807
- "../server/dist/ws/broadcast.js"() {
1812
+ "packages/server/dist/ws/broadcast.js"() {
1808
1813
  "use strict";
1809
1814
  _wss = null;
1810
1815
  }
1811
1816
  });
1812
1817
 
1813
- // ../server/dist/db/schema.js
1818
+ // packages/server/dist/db/schema.js
1814
1819
  var schema_exports = {};
1815
1820
  __export(schema_exports, {
1816
1821
  agentSessions: () => agentSessions,
@@ -1820,7 +1825,7 @@ __export(schema_exports, {
1820
1825
  import { sqliteTable, text, integer } from "drizzle-orm/sqlite-core";
1821
1826
  var sessions, agentSessions, disabledItems;
1822
1827
  var init_schema = __esm({
1823
- "../server/dist/db/schema.js"() {
1828
+ "packages/server/dist/db/schema.js"() {
1824
1829
  "use strict";
1825
1830
  sessions = sqliteTable("sessions", {
1826
1831
  id: text("id").primaryKey(),
@@ -1857,7 +1862,7 @@ var init_schema = __esm({
1857
1862
  }
1858
1863
  });
1859
1864
 
1860
- // ../server/dist/init.js
1865
+ // packages/server/dist/init.js
1861
1866
  var init_exports = {};
1862
1867
  __export(init_exports, {
1863
1868
  TEMPLATES_DIR: () => TEMPLATES_DIR,
@@ -2193,7 +2198,7 @@ function ensureWorkspaceHalo(workspaceRoot) {
2193
2198
  }
2194
2199
  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;
2195
2200
  var init_init = __esm({
2196
- "../server/dist/init.js"() {
2201
+ "packages/server/dist/init.js"() {
2197
2202
  "use strict";
2198
2203
  __dirname = path6.dirname(fileURLToPath(import.meta.url));
2199
2204
  TEMPLATES_DIR = path6.resolve(__dirname, "..", "templates");
@@ -2201,7 +2206,7 @@ var init_init = __esm({
2201
2206
  path6.resolve(__dirname, "..", "bundled-docs"),
2202
2207
  path6.resolve(__dirname, "..", "..", "..", ".halo", "docs")
2203
2208
  ];
2204
- TEMPLATE_VERSION = 44;
2209
+ TEMPLATE_VERSION = 47;
2205
2210
  VERSION_FILE = ".template-version";
2206
2211
  SKIP_NAMES = /* @__PURE__ */ new Set([".DS_Store", "schema.sql", "__pycache__", ".pytest_cache"]);
2207
2212
  BUILTIN_AGENT_IDS = /* @__PURE__ */ new Set([
@@ -2266,7 +2271,7 @@ var init_init = __esm({
2266
2271
  }
2267
2272
  });
2268
2273
 
2269
- // ../server/dist/db/index.js
2274
+ // packages/server/dist/db/index.js
2270
2275
  import Database from "better-sqlite3";
2271
2276
  import { drizzle } from "drizzle-orm/better-sqlite3";
2272
2277
  import { eq, and } from "drizzle-orm";
@@ -2325,7 +2330,7 @@ function toggleDisabled(db, itemType, itemId, scope) {
2325
2330
  }
2326
2331
  var SCHEMA_SQL_PATH, dbCache;
2327
2332
  var init_db = __esm({
2328
- "../server/dist/db/index.js"() {
2333
+ "packages/server/dist/db/index.js"() {
2329
2334
  "use strict";
2330
2335
  init_schema();
2331
2336
  init_init();
@@ -2334,7 +2339,7 @@ var init_db = __esm({
2334
2339
  }
2335
2340
  });
2336
2341
 
2337
- // ../server/dist/sessions/session-store.js
2342
+ // packages/server/dist/sessions/session-store.js
2338
2343
  import fsSync3 from "node:fs";
2339
2344
  import fs8 from "node:fs/promises";
2340
2345
  import path8 from "node:path";
@@ -2549,12 +2554,12 @@ function findAndUpdateSessionTitle(sessionId, title, projectPath) {
2549
2554
  return false;
2550
2555
  }
2551
2556
  var init_session_store = __esm({
2552
- "../server/dist/sessions/session-store.js"() {
2557
+ "packages/server/dist/sessions/session-store.js"() {
2553
2558
  "use strict";
2554
2559
  }
2555
2560
  });
2556
2561
 
2557
- // ../server/dist/agents/session-tools.js
2562
+ // packages/server/dist/agents/session-tools.js
2558
2563
  async function callerTeamFor(sm, sessionId) {
2559
2564
  const callerId = sm.sessions.get(sessionId)?.agentId;
2560
2565
  if (!callerId)
@@ -2817,7 +2822,7 @@ ${skillInfo}` : ""
2817
2822
  ];
2818
2823
  }
2819
2824
  var init_session_tools = __esm({
2820
- "../server/dist/agents/session-tools.js"() {
2825
+ "packages/server/dist/agents/session-tools.js"() {
2821
2826
  "use strict";
2822
2827
  init_config();
2823
2828
  init_agent_loader();
@@ -2826,7 +2831,7 @@ var init_session_tools = __esm({
2826
2831
  }
2827
2832
  });
2828
2833
 
2829
- // ../server/dist/agents/goal-mode.js
2834
+ // packages/server/dist/agents/goal-mode.js
2830
2835
  import fs9 from "node:fs";
2831
2836
  import path9 from "node:path";
2832
2837
  import { createHash } from "node:crypto";
@@ -3295,7 +3300,7 @@ function sweepActiveGoals(host) {
3295
3300
  }
3296
3301
  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;
3297
3302
  var init_goal_mode = __esm({
3298
- "../server/dist/agents/goal-mode.js"() {
3303
+ "packages/server/dist/agents/goal-mode.js"() {
3299
3304
  "use strict";
3300
3305
  init_schema();
3301
3306
  init_session_store();
@@ -3316,7 +3321,7 @@ var init_goal_mode = __esm({
3316
3321
  }
3317
3322
  });
3318
3323
 
3319
- // ../server/dist/agents/workspace-runtime-lock.js
3324
+ // packages/server/dist/agents/workspace-runtime-lock.js
3320
3325
  import fs10 from "node:fs";
3321
3326
  import path10 from "node:path";
3322
3327
  function isPidAlive(pid) {
@@ -3364,13 +3369,13 @@ function claimWorkspaceRuntime(workspaceRoot) {
3364
3369
  }
3365
3370
  var RUNTIME_LOCK_FILE;
3366
3371
  var init_workspace_runtime_lock = __esm({
3367
- "../server/dist/agents/workspace-runtime-lock.js"() {
3372
+ "packages/server/dist/agents/workspace-runtime-lock.js"() {
3368
3373
  "use strict";
3369
3374
  RUNTIME_LOCK_FILE = "runtime.lock";
3370
3375
  }
3371
3376
  });
3372
3377
 
3373
- // ../server/dist/db/evo-db.js
3378
+ // packages/server/dist/db/evo-db.js
3374
3379
  import Database2 from "better-sqlite3";
3375
3380
  import { drizzle as drizzle2 } from "drizzle-orm/better-sqlite3";
3376
3381
  import { sqliteTable as sqliteTable2, text as text2, integer as integer2 } from "drizzle-orm/sqlite-core";
@@ -3394,7 +3399,7 @@ function getEvoDb() {
3394
3399
  }
3395
3400
  var evolutionRuns, evolutionApplies, CREATE_SQL, _evoDb;
3396
3401
  var init_evo_db = __esm({
3397
- "../server/dist/db/evo-db.js"() {
3402
+ "packages/server/dist/db/evo-db.js"() {
3398
3403
  "use strict";
3399
3404
  evolutionRuns = sqliteTable2("evolution_runs", {
3400
3405
  id: text2("id").primaryKey(),
@@ -3476,7 +3481,7 @@ CREATE INDEX IF NOT EXISTS idx_evo_applies_archived ON evolution_applies(archive
3476
3481
  }
3477
3482
  });
3478
3483
 
3479
- // ../server/dist/evolution/enqueue.js
3484
+ // packages/server/dist/evolution/enqueue.js
3480
3485
  import fs12 from "node:fs";
3481
3486
  import path12 from "node:path";
3482
3487
  import { homedir as homedir7 } from "node:os";
@@ -3761,13 +3766,91 @@ function enqueueEvoRun(input) {
3761
3766
  return { ok: true, runId, runDir };
3762
3767
  }
3763
3768
  var init_enqueue = __esm({
3764
- "../server/dist/evolution/enqueue.js"() {
3769
+ "packages/server/dist/evolution/enqueue.js"() {
3765
3770
  "use strict";
3766
3771
  init_evo_db();
3767
3772
  }
3768
3773
  });
3769
3774
 
3770
- // ../server/dist/sessions/ui-log-builder.js
3775
+ // packages/server/dist/channels/shared/media-store.js
3776
+ import fs13 from "node:fs/promises";
3777
+ import path13 from "node:path";
3778
+ import { randomBytes } from "node:crypto";
3779
+ function inferImageMime(buf) {
3780
+ if (buf.length >= 4 && buf[0] === 255 && buf[1] === 216)
3781
+ return "image/jpeg";
3782
+ if (buf.length >= 8 && buf[0] === 137 && buf[1] === 80 && buf[2] === 78 && buf[3] === 71)
3783
+ return "image/png";
3784
+ if (buf.length >= 6 && buf[0] === 71 && buf[1] === 73 && buf[2] === 70)
3785
+ return "image/gif";
3786
+ if (buf.length >= 12 && buf.subarray(8, 12).toString("ascii") === "WEBP")
3787
+ return "image/webp";
3788
+ return "image/jpeg";
3789
+ }
3790
+ function inferExtFromBytes(buf) {
3791
+ if (buf.length >= 4 && buf[0] === 255 && buf[1] === 216)
3792
+ return ".jpg";
3793
+ if (buf.length >= 8 && buf[0] === 137 && buf[1] === 80 && buf[2] === 78 && buf[3] === 71)
3794
+ return ".png";
3795
+ if (buf.length >= 6 && buf[0] === 71 && buf[1] === 73 && buf[2] === 70)
3796
+ return ".gif";
3797
+ if (buf.length >= 12 && buf.subarray(8, 12).toString("ascii") === "WEBP")
3798
+ return ".webp";
3799
+ if (buf.length >= 4 && buf.subarray(0, 4).toString("ascii") === "RIFF")
3800
+ return ".wav";
3801
+ if (buf.length >= 9 && buf.subarray(0, 9).toString("ascii") === "#!SILK_V3")
3802
+ return ".silk";
3803
+ if (buf.length >= 10 && buf[0] === 2 && buf.subarray(1, 10).toString("ascii") === "#!SILK_V3")
3804
+ return ".silk";
3805
+ return ".bin";
3806
+ }
3807
+ function sanitizeFilename(name) {
3808
+ return name.replace(/[^\w.-]+/g, "_").slice(0, 120) || "file";
3809
+ }
3810
+ async function saveInboundMedia(params) {
3811
+ const date = /* @__PURE__ */ new Date();
3812
+ const yyyy = date.getFullYear();
3813
+ const mm = String(date.getMonth() + 1).padStart(2, "0");
3814
+ const dd = String(date.getDate()).padStart(2, "0");
3815
+ const channel = params.channel ?? "weixin";
3816
+ const dir = path13.join(params.workspacePath, ".halo", "assets", channel, "inbound", params.accountId, `${yyyy}-${mm}-${dd}`);
3817
+ await fs13.mkdir(dir, { recursive: true });
3818
+ const ts = `${date.getHours().toString().padStart(2, "0")}${date.getMinutes().toString().padStart(2, "0")}${date.getSeconds().toString().padStart(2, "0")}`;
3819
+ const suffix = randomBytes(3).toString("hex");
3820
+ let filename;
3821
+ if (params.originalFilename) {
3822
+ filename = `${ts}_${suffix}_${sanitizeFilename(params.originalFilename)}`;
3823
+ } else {
3824
+ const ext = params.mimeType ? EXT_BY_MIME[params.mimeType] ?? inferExtFromBytes(params.buffer) : inferExtFromBytes(params.buffer);
3825
+ filename = `${params.kind}_${ts}_${suffix}${ext}`;
3826
+ }
3827
+ const fullPath = path13.join(dir, filename);
3828
+ await fs13.writeFile(fullPath, params.buffer);
3829
+ return fullPath;
3830
+ }
3831
+ var VISION_IMAGE_MIME_TYPES, EXT_BY_MIME;
3832
+ var init_media_store = __esm({
3833
+ "packages/server/dist/channels/shared/media-store.js"() {
3834
+ "use strict";
3835
+ VISION_IMAGE_MIME_TYPES = ["image/jpeg", "image/png", "image/gif", "image/webp"];
3836
+ EXT_BY_MIME = {
3837
+ "image/jpeg": ".jpg",
3838
+ "image/png": ".png",
3839
+ "image/gif": ".gif",
3840
+ "image/webp": ".webp",
3841
+ "video/mp4": ".mp4",
3842
+ "audio/silk": ".silk",
3843
+ "audio/wav": ".wav",
3844
+ "audio/amr": ".amr",
3845
+ "audio/webm": ".webm",
3846
+ "audio/ogg": ".ogg",
3847
+ "audio/mp4": ".m4a",
3848
+ "application/pdf": ".pdf"
3849
+ };
3850
+ }
3851
+ });
3852
+
3853
+ // packages/server/dist/sessions/ui-log-builder.js
3771
3854
  import { randomUUID } from "node:crypto";
3772
3855
  function createEmptyUIState() {
3773
3856
  return {
@@ -4183,19 +4266,19 @@ function applyEvent(state, event) {
4183
4266
  }
4184
4267
  var msgCounter;
4185
4268
  var init_ui_log_builder = __esm({
4186
- "../server/dist/sessions/ui-log-builder.js"() {
4269
+ "packages/server/dist/sessions/ui-log-builder.js"() {
4187
4270
  "use strict";
4188
4271
  msgCounter = 0;
4189
4272
  }
4190
4273
  });
4191
4274
 
4192
- // ../server/dist/agents/session-ui-store.js
4275
+ // packages/server/dist/agents/session-ui-store.js
4193
4276
  import fsSync4 from "node:fs";
4194
- import path13 from "node:path";
4277
+ import path14 from "node:path";
4195
4278
  import { eq as eq3 } from "drizzle-orm";
4196
4279
  var SessionUIStore;
4197
4280
  var init_session_ui_store = __esm({
4198
- "../server/dist/agents/session-ui-store.js"() {
4281
+ "packages/server/dist/agents/session-ui-store.js"() {
4199
4282
  "use strict";
4200
4283
  init_broadcast();
4201
4284
  init_schema();
@@ -4371,7 +4454,7 @@ var init_session_ui_store = __esm({
4371
4454
  if (messages2.length > 0)
4372
4455
  state.messageLog = messages2;
4373
4456
  try {
4374
- const filePath = path13.join(getSessionDir(row.agentId, this.host.workspaceRoot), `${fileSegment(rootId)}.json`);
4457
+ const filePath = path14.join(getSessionDir(row.agentId, this.host.workspaceRoot), `${fileSegment(rootId)}.json`);
4375
4458
  const data = JSON.parse(fsSync4.readFileSync(filePath, "utf-8"));
4376
4459
  state.contextTokens = data.contextTokens ?? 0;
4377
4460
  state.outputTokens = data.totalOutputTokens ?? 0;
@@ -4571,11 +4654,11 @@ var init_session_ui_store = __esm({
4571
4654
  }
4572
4655
  });
4573
4656
 
4574
- // ../server/dist/agents/session-query-store.js
4657
+ // packages/server/dist/agents/session-query-store.js
4575
4658
  import { eq as eq4, and as and3, isNull as isNull2, desc, lt, gte, inArray } from "drizzle-orm";
4576
4659
  var SessionQueryStore;
4577
4660
  var init_session_query_store = __esm({
4578
- "../server/dist/agents/session-query-store.js"() {
4661
+ "packages/server/dist/agents/session-query-store.js"() {
4579
4662
  "use strict";
4580
4663
  init_schema();
4581
4664
  init_session_store();
@@ -4786,7 +4869,7 @@ var init_session_query_store = __esm({
4786
4869
  }
4787
4870
  });
4788
4871
 
4789
- // ../server/dist/agents/bedrock-agent.js
4872
+ // packages/server/dist/agents/bedrock-agent.js
4790
4873
  import { BedrockRuntimeClient, InvokeModelCommand } from "@aws-sdk/client-bedrock-runtime";
4791
4874
  function effortToBudget(effort, maxTokens) {
4792
4875
  const table = {
@@ -4808,7 +4891,7 @@ function extractRegionFromEndpoint(endpoint) {
4808
4891
  }
4809
4892
  var BedrockAgent;
4810
4893
  var init_bedrock_agent = __esm({
4811
- "../server/dist/agents/bedrock-agent.js"() {
4894
+ "packages/server/dist/agents/bedrock-agent.js"() {
4812
4895
  "use strict";
4813
4896
  init_config();
4814
4897
  init_agent_loop();
@@ -4937,7 +5020,7 @@ var init_bedrock_agent = __esm({
4937
5020
  }
4938
5021
  });
4939
5022
 
4940
- // ../server/dist/agents/deepseek-agent.js
5023
+ // packages/server/dist/agents/deepseek-agent.js
4941
5024
  function safeParse(json) {
4942
5025
  try {
4943
5026
  return JSON.parse(json || "{}");
@@ -4947,7 +5030,7 @@ function safeParse(json) {
4947
5030
  }
4948
5031
  var DeepSeekAgent;
4949
5032
  var init_deepseek_agent = __esm({
4950
- "../server/dist/agents/deepseek-agent.js"() {
5033
+ "packages/server/dist/agents/deepseek-agent.js"() {
4951
5034
  "use strict";
4952
5035
  init_config();
4953
5036
  init_agent_loop();
@@ -5127,7 +5210,7 @@ var init_deepseek_agent = __esm({
5127
5210
  }
5128
5211
  });
5129
5212
 
5130
- // ../server/dist/agents/kimi-agent.js
5213
+ // packages/server/dist/agents/kimi-agent.js
5131
5214
  function safeParse2(json) {
5132
5215
  try {
5133
5216
  return JSON.parse(json || "{}");
@@ -5137,7 +5220,7 @@ function safeParse2(json) {
5137
5220
  }
5138
5221
  var KimiAgent;
5139
5222
  var init_kimi_agent = __esm({
5140
- "../server/dist/agents/kimi-agent.js"() {
5223
+ "packages/server/dist/agents/kimi-agent.js"() {
5141
5224
  "use strict";
5142
5225
  init_config();
5143
5226
  init_agent_loop();
@@ -5160,8 +5243,14 @@ var init_kimi_agent = __esm({
5160
5243
  ...tools.length > 0 ? { tools } : {},
5161
5244
  prompt_cache_key: this.config.cacheKey ?? void 0
5162
5245
  };
5163
- if (this.config.thinking?.effort === "disabled") {
5164
- body.thinking = { type: "disabled" };
5246
+ if (this.config.modelId.startsWith("kimi-k3")) {
5247
+ if (this.config.thinking?.enabled) {
5248
+ body.reasoning_effort = "max";
5249
+ }
5250
+ } else {
5251
+ if (this.config.thinking?.effort === "disabled") {
5252
+ body.thinking = { type: "disabled" };
5253
+ }
5165
5254
  }
5166
5255
  const response = await fetch(url, {
5167
5256
  method: "POST",
@@ -5327,7 +5416,7 @@ var init_kimi_agent = __esm({
5327
5416
  }
5328
5417
  });
5329
5418
 
5330
- // ../server/dist/agents/minimax-agent.js
5419
+ // packages/server/dist/agents/minimax-agent.js
5331
5420
  function effortToBudget2(effort, maxTokens) {
5332
5421
  const table = {
5333
5422
  low: 2048,
@@ -5344,7 +5433,7 @@ function effortToBudget2(effort, maxTokens) {
5344
5433
  }
5345
5434
  var MiniMaxAgent;
5346
5435
  var init_minimax_agent = __esm({
5347
- "../server/dist/agents/minimax-agent.js"() {
5436
+ "packages/server/dist/agents/minimax-agent.js"() {
5348
5437
  "use strict";
5349
5438
  init_config();
5350
5439
  init_agent_loop();
@@ -5452,9 +5541,13 @@ var init_minimax_agent = __esm({
5452
5541
  body.messages = msgs;
5453
5542
  }
5454
5543
  if (this.config.thinking?.enabled && this.config.thinking.effort) {
5455
- const budget = this.config.thinkingBudgetTokens ?? effortToBudget2(this.config.thinking.effort, this.config.maxTokens);
5456
- const cappedBudget = typeof this.config.maxTokens === "number" && this.config.maxTokens > 0 ? Math.min(budget, Math.max(1024, Math.floor(this.config.maxTokens / 2))) : budget;
5457
- body.thinking = { type: "enabled", budget_tokens: cappedBudget };
5544
+ if (this.config.thinkingMode === "adaptive") {
5545
+ body.thinking = { type: "adaptive" };
5546
+ } else {
5547
+ const budget = this.config.thinkingBudgetTokens ?? effortToBudget2(this.config.thinking.effort, this.config.maxTokens);
5548
+ const cappedBudget = typeof this.config.maxTokens === "number" && this.config.maxTokens > 0 ? Math.min(budget, Math.max(1024, Math.floor(this.config.maxTokens / 2))) : budget;
5549
+ body.thinking = { type: "enabled", budget_tokens: cappedBudget };
5550
+ }
5458
5551
  }
5459
5552
  return body;
5460
5553
  }
@@ -5462,7 +5555,7 @@ var init_minimax_agent = __esm({
5462
5555
  }
5463
5556
  });
5464
5557
 
5465
- // ../server/dist/agents/qwen-agent.js
5558
+ // packages/server/dist/agents/qwen-agent.js
5466
5559
  function effortToBudget3(effort, maxTokens) {
5467
5560
  const table = {
5468
5561
  low: 2048,
@@ -5479,7 +5572,7 @@ function effortToBudget3(effort, maxTokens) {
5479
5572
  }
5480
5573
  var QwenAgent;
5481
5574
  var init_qwen_agent = __esm({
5482
- "../server/dist/agents/qwen-agent.js"() {
5575
+ "packages/server/dist/agents/qwen-agent.js"() {
5483
5576
  "use strict";
5484
5577
  init_config();
5485
5578
  init_agent_loop();
@@ -5597,7 +5690,7 @@ var init_qwen_agent = __esm({
5597
5690
  }
5598
5691
  });
5599
5692
 
5600
- // ../server/dist/agents/hunyuan-agent.js
5693
+ // packages/server/dist/agents/hunyuan-agent.js
5601
5694
  function safeParse3(json) {
5602
5695
  try {
5603
5696
  return JSON.parse(json || "{}");
@@ -5607,7 +5700,7 @@ function safeParse3(json) {
5607
5700
  }
5608
5701
  var HunyuanAgent;
5609
5702
  var init_hunyuan_agent = __esm({
5610
- "../server/dist/agents/hunyuan-agent.js"() {
5703
+ "packages/server/dist/agents/hunyuan-agent.js"() {
5611
5704
  "use strict";
5612
5705
  init_config();
5613
5706
  init_agent_loop();
@@ -5778,7 +5871,7 @@ var init_hunyuan_agent = __esm({
5778
5871
  }
5779
5872
  });
5780
5873
 
5781
- // ../server/dist/agents/doubao-agent.js
5874
+ // packages/server/dist/agents/doubao-agent.js
5782
5875
  function safeParse4(json) {
5783
5876
  try {
5784
5877
  return JSON.parse(json || "{}");
@@ -5788,7 +5881,7 @@ function safeParse4(json) {
5788
5881
  }
5789
5882
  var DoubaoAgent;
5790
5883
  var init_doubao_agent = __esm({
5791
- "../server/dist/agents/doubao-agent.js"() {
5884
+ "packages/server/dist/agents/doubao-agent.js"() {
5792
5885
  "use strict";
5793
5886
  init_config();
5794
5887
  init_agent_loop();
@@ -5959,7 +6052,7 @@ var init_doubao_agent = __esm({
5959
6052
  }
5960
6053
  });
5961
6054
 
5962
- // ../server/dist/agents/openai-agent.js
6055
+ // packages/server/dist/agents/openai-agent.js
5963
6056
  function safeParse5(json) {
5964
6057
  try {
5965
6058
  return JSON.parse(json || "{}");
@@ -5969,7 +6062,7 @@ function safeParse5(json) {
5969
6062
  }
5970
6063
  var OpenAIAgent;
5971
6064
  var init_openai_agent = __esm({
5972
- "../server/dist/agents/openai-agent.js"() {
6065
+ "packages/server/dist/agents/openai-agent.js"() {
5973
6066
  "use strict";
5974
6067
  init_config();
5975
6068
  init_agent_loop();
@@ -6141,7 +6234,7 @@ var init_openai_agent = __esm({
6141
6234
  }
6142
6235
  });
6143
6236
 
6144
- // ../server/dist/agents/mantle-agent.js
6237
+ // packages/server/dist/agents/mantle-agent.js
6145
6238
  import { SignatureV4 } from "@smithy/signature-v4";
6146
6239
  import { Sha256 } from "@aws-crypto/sha256-js";
6147
6240
  import { defaultProvider } from "@aws-sdk/credential-provider-node";
@@ -6149,19 +6242,16 @@ function extractRegionFromHost(hostname) {
6149
6242
  const m = hostname.match(/bedrock-mantle\.([a-z0-9-]+)\.api\.aws/);
6150
6243
  return m?.[1] ?? "us-east-2";
6151
6244
  }
6152
- function strictParseOrNull(json) {
6153
- const trimmed = (json ?? "").trim();
6154
- if (trimmed === "")
6155
- return {};
6245
+ function safeParse6(json) {
6156
6246
  try {
6157
- return JSON.parse(trimmed);
6247
+ return JSON.parse(json || "{}");
6158
6248
  } catch {
6159
- return null;
6249
+ return {};
6160
6250
  }
6161
6251
  }
6162
6252
  var MantleAgent;
6163
6253
  var init_mantle_agent = __esm({
6164
- "../server/dist/agents/mantle-agent.js"() {
6254
+ "packages/server/dist/agents/mantle-agent.js"() {
6165
6255
  "use strict";
6166
6256
  init_config();
6167
6257
  init_agent_loop();
@@ -6208,15 +6298,12 @@ var init_mantle_agent = __esm({
6208
6298
  for (const item of output) {
6209
6299
  const itemType = item.type;
6210
6300
  if (itemType === "message") {
6211
- let itemText = "";
6212
6301
  const content = item.content ?? [];
6213
6302
  for (const part of content) {
6214
6303
  if (part.type === "output_text" && typeof part.text === "string") {
6215
- itemText += part.text;
6304
+ text5 += part.text;
6216
6305
  }
6217
6306
  }
6218
- if (itemText)
6219
- text5 = itemText;
6220
6307
  } else if (itemType === "reasoning") {
6221
6308
  const summary = item.summary ?? [];
6222
6309
  for (const part of summary) {
@@ -6227,11 +6314,9 @@ var init_mantle_agent = __esm({
6227
6314
  const callId = item.call_id ?? item.id ?? "";
6228
6315
  const name = item.name ?? "";
6229
6316
  const args = item.arguments ?? "{}";
6230
- const parsed = strictParseOrNull(args);
6231
- if (parsed === null)
6232
- continue;
6233
- toolCalls.push({ id: callId, name, input: parsed });
6234
- assistantBlocks.push({ type: "tool_use", id: callId, name, input: parsed });
6317
+ const input2 = safeParse6(args);
6318
+ toolCalls.push({ id: callId, name, input: input2 });
6319
+ assistantBlocks.push({ type: "tool_use", id: callId, name, input: input2 });
6235
6320
  }
6236
6321
  }
6237
6322
  if (output.length === 0 && !text5 && toolCalls.length === 0) {
@@ -6384,10 +6469,10 @@ var init_mantle_agent = __esm({
6384
6469
  }
6385
6470
  });
6386
6471
 
6387
- // ../server/dist/agents/anthropic-agent.js
6472
+ // packages/server/dist/agents/anthropic-agent.js
6388
6473
  var AnthropicAgent;
6389
6474
  var init_anthropic_agent = __esm({
6390
- "../server/dist/agents/anthropic-agent.js"() {
6475
+ "packages/server/dist/agents/anthropic-agent.js"() {
6391
6476
  "use strict";
6392
6477
  init_config();
6393
6478
  init_agent_loop();
@@ -6510,7 +6595,7 @@ var init_anthropic_agent = __esm({
6510
6595
  }
6511
6596
  });
6512
6597
 
6513
- // ../server/dist/agents/model-runtime.js
6598
+ // packages/server/dist/agents/model-runtime.js
6514
6599
  function createModelRuntime(providerId, cfg) {
6515
6600
  switch (providerId) {
6516
6601
  case "aws-bedrock-claude-invoke":
@@ -6557,6 +6642,7 @@ function createModelRuntime(providerId, cfg) {
6557
6642
  maxTokens: cfg.maxTokens,
6558
6643
  promptCaching: cfg.promptCaching,
6559
6644
  thinking: cfg.thinking,
6645
+ thinkingMode: cfg.thinkingMode,
6560
6646
  thinkingBudgetTokens: cfg.thinkingBudgetTokens
6561
6647
  });
6562
6648
  case "qwen":
@@ -6644,7 +6730,7 @@ function createModelRuntime(providerId, cfg) {
6644
6730
  }
6645
6731
  }
6646
6732
  var init_model_runtime = __esm({
6647
- "../server/dist/agents/model-runtime.js"() {
6733
+ "packages/server/dist/agents/model-runtime.js"() {
6648
6734
  "use strict";
6649
6735
  init_bedrock_agent();
6650
6736
  init_deepseek_agent();
@@ -6659,10 +6745,10 @@ var init_model_runtime = __esm({
6659
6745
  }
6660
6746
  });
6661
6747
 
6662
- // ../server/dist/tools/sandbox.js
6748
+ // packages/server/dist/tools/sandbox.js
6663
6749
  import { exec, execFile, spawn } from "node:child_process";
6664
6750
  import { promisify } from "node:util";
6665
- import path14 from "node:path";
6751
+ import path15 from "node:path";
6666
6752
  import { homedir as homedir8 } from "node:os";
6667
6753
  import { existsSync, realpathSync } from "node:fs";
6668
6754
  function decodeWinOutput(buf) {
@@ -6817,7 +6903,7 @@ async function initBwrapCheck() {
6817
6903
  return isBwrapAvailable();
6818
6904
  }
6819
6905
  function expandTilde(p) {
6820
- return p.startsWith("~/") ? path14.join(HOME, p.slice(2)) : p;
6906
+ return p.startsWith("~/") ? path15.join(HOME, p.slice(2)) : p;
6821
6907
  }
6822
6908
  function setSandboxHiddenPaths(dirs, files, writableDirs = []) {
6823
6909
  _hiddenDirs = dirs;
@@ -6858,13 +6944,13 @@ function buildBwrapArgs(opts) {
6858
6944
  return args;
6859
6945
  }
6860
6946
  function realpathBounded(filePath) {
6861
- let prefix = path14.resolve(filePath);
6947
+ let prefix = path15.resolve(filePath);
6862
6948
  const tail = [];
6863
6949
  while (!existsSync(prefix)) {
6864
- const parent = path14.dirname(prefix);
6950
+ const parent = path15.dirname(prefix);
6865
6951
  if (parent === prefix)
6866
6952
  break;
6867
- tail.unshift(path14.basename(prefix));
6953
+ tail.unshift(path15.basename(prefix));
6868
6954
  prefix = parent;
6869
6955
  }
6870
6956
  let realPrefix;
@@ -6873,12 +6959,12 @@ function realpathBounded(filePath) {
6873
6959
  } catch {
6874
6960
  realPrefix = prefix;
6875
6961
  }
6876
- return tail.length > 0 ? path14.join(realPrefix, ...tail) : realPrefix;
6962
+ return tail.length > 0 ? path15.join(realPrefix, ...tail) : realPrefix;
6877
6963
  }
6878
6964
  function assertPathAllowed(filePath, opts, write = false) {
6879
6965
  opts = normalizeOptsForPlatform(opts);
6880
6966
  if (opts.accessLevel === "full")
6881
- return path14.resolve(filePath);
6967
+ return path15.resolve(filePath);
6882
6968
  const resolved = realpathBounded(filePath);
6883
6969
  const wsRoot = realpathBounded(opts.workspaceRoot);
6884
6970
  if (resolved === wsRoot || resolved.startsWith(wsRoot + "/")) {
@@ -7044,7 +7130,7 @@ async function sandboxWriteFile(filePath, content, opts) {
7044
7130
  opts = normalizeOptsForPlatform(opts);
7045
7131
  if (opts.accessLevel === "full") {
7046
7132
  const fsP = await import("node:fs/promises");
7047
- await fsP.mkdir(path14.dirname(filePath), { recursive: true });
7133
+ await fsP.mkdir(path15.dirname(filePath), { recursive: true });
7048
7134
  await fsP.writeFile(filePath, content, "utf-8");
7049
7135
  return;
7050
7136
  }
@@ -7052,7 +7138,7 @@ async function sandboxWriteFile(filePath, content, opts) {
7052
7138
  if (!bwrapOk) {
7053
7139
  const safe = assertPathAllowed(filePath, opts, true);
7054
7140
  const fsP = await import("node:fs/promises");
7055
- await fsP.mkdir(path14.dirname(safe), { recursive: true });
7141
+ await fsP.mkdir(path15.dirname(safe), { recursive: true });
7056
7142
  await fsP.writeFile(safe, content, "utf-8");
7057
7143
  return;
7058
7144
  }
@@ -7109,13 +7195,13 @@ async function sandboxReaddir(dirPath, opts) {
7109
7195
  }
7110
7196
  var execAsync, execFileAsync, HOME, HALO_HOME3, GLOBAL_DIR, KILL_GRACE_MS, _bwrapAvailable, DEFAULT_HIDDEN_DIRS, DEFAULT_HIDDEN_FILES, _hiddenDirs, _hiddenFiles, _writableDirs;
7111
7197
  var init_sandbox = __esm({
7112
- "../server/dist/tools/sandbox.js"() {
7198
+ "packages/server/dist/tools/sandbox.js"() {
7113
7199
  "use strict";
7114
7200
  execAsync = promisify(exec);
7115
7201
  execFileAsync = promisify(execFile);
7116
7202
  HOME = homedir8();
7117
- HALO_HOME3 = path14.join(HOME, ".halo");
7118
- GLOBAL_DIR = path14.join(HALO_HOME3, "global");
7203
+ HALO_HOME3 = path15.join(HOME, ".halo");
7204
+ GLOBAL_DIR = path15.join(HALO_HOME3, "global");
7119
7205
  KILL_GRACE_MS = 2e3;
7120
7206
  _bwrapAvailable = null;
7121
7207
  DEFAULT_HIDDEN_DIRS = [
@@ -7156,84 +7242,7 @@ var init_sandbox = __esm({
7156
7242
  }
7157
7243
  });
7158
7244
 
7159
- // ../server/dist/channels/shared/media-store.js
7160
- import fs13 from "node:fs/promises";
7161
- import path15 from "node:path";
7162
- import { randomBytes } from "node:crypto";
7163
- function inferImageMime(buf) {
7164
- if (buf.length >= 4 && buf[0] === 255 && buf[1] === 216)
7165
- return "image/jpeg";
7166
- if (buf.length >= 8 && buf[0] === 137 && buf[1] === 80 && buf[2] === 78 && buf[3] === 71)
7167
- return "image/png";
7168
- if (buf.length >= 6 && buf[0] === 71 && buf[1] === 73 && buf[2] === 70)
7169
- return "image/gif";
7170
- if (buf.length >= 12 && buf.subarray(8, 12).toString("ascii") === "WEBP")
7171
- return "image/webp";
7172
- return "image/jpeg";
7173
- }
7174
- function inferExtFromBytes(buf) {
7175
- if (buf.length >= 4 && buf[0] === 255 && buf[1] === 216)
7176
- return ".jpg";
7177
- if (buf.length >= 8 && buf[0] === 137 && buf[1] === 80 && buf[2] === 78 && buf[3] === 71)
7178
- return ".png";
7179
- if (buf.length >= 6 && buf[0] === 71 && buf[1] === 73 && buf[2] === 70)
7180
- return ".gif";
7181
- if (buf.length >= 12 && buf.subarray(8, 12).toString("ascii") === "WEBP")
7182
- return ".webp";
7183
- if (buf.length >= 4 && buf.subarray(0, 4).toString("ascii") === "RIFF")
7184
- return ".wav";
7185
- if (buf.length >= 9 && buf.subarray(0, 9).toString("ascii") === "#!SILK_V3")
7186
- return ".silk";
7187
- if (buf.length >= 10 && buf[0] === 2 && buf.subarray(1, 10).toString("ascii") === "#!SILK_V3")
7188
- return ".silk";
7189
- return ".bin";
7190
- }
7191
- function sanitizeFilename(name) {
7192
- return name.replace(/[^\w.-]+/g, "_").slice(0, 120) || "file";
7193
- }
7194
- async function saveInboundMedia(params) {
7195
- const date = /* @__PURE__ */ new Date();
7196
- const yyyy = date.getFullYear();
7197
- const mm = String(date.getMonth() + 1).padStart(2, "0");
7198
- const dd = String(date.getDate()).padStart(2, "0");
7199
- const channel = params.channel ?? "weixin";
7200
- const dir = path15.join(params.workspacePath, ".halo", "assets", channel, "inbound", params.accountId, `${yyyy}-${mm}-${dd}`);
7201
- await fs13.mkdir(dir, { recursive: true });
7202
- const ts = `${date.getHours().toString().padStart(2, "0")}${date.getMinutes().toString().padStart(2, "0")}${date.getSeconds().toString().padStart(2, "0")}`;
7203
- const suffix = randomBytes(3).toString("hex");
7204
- let filename;
7205
- if (params.originalFilename) {
7206
- filename = `${ts}_${suffix}_${sanitizeFilename(params.originalFilename)}`;
7207
- } else {
7208
- const ext = params.mimeType ? EXT_BY_MIME[params.mimeType] ?? inferExtFromBytes(params.buffer) : inferExtFromBytes(params.buffer);
7209
- filename = `${params.kind}_${ts}_${suffix}${ext}`;
7210
- }
7211
- const fullPath = path15.join(dir, filename);
7212
- await fs13.writeFile(fullPath, params.buffer);
7213
- return fullPath;
7214
- }
7215
- var EXT_BY_MIME;
7216
- var init_media_store = __esm({
7217
- "../server/dist/channels/shared/media-store.js"() {
7218
- "use strict";
7219
- EXT_BY_MIME = {
7220
- "image/jpeg": ".jpg",
7221
- "image/png": ".png",
7222
- "image/gif": ".gif",
7223
- "image/webp": ".webp",
7224
- "video/mp4": ".mp4",
7225
- "audio/silk": ".silk",
7226
- "audio/wav": ".wav",
7227
- "audio/amr": ".amr",
7228
- "audio/webm": ".webm",
7229
- "audio/ogg": ".ogg",
7230
- "audio/mp4": ".m4a",
7231
- "application/pdf": ".pdf"
7232
- };
7233
- }
7234
- });
7235
-
7236
- // ../server/dist/tools/workspace-tools.js
7245
+ // packages/server/dist/tools/workspace-tools.js
7237
7246
  import fs14 from "node:fs/promises";
7238
7247
  import path16 from "node:path";
7239
7248
  import crypto from "node:crypto";
@@ -7950,7 +7959,7 @@ function imageDimensions(buf, mediaType) {
7950
7959
  }
7951
7960
  var SKIP_DIRS, GLOB_MAX_RESULTS, HOME2, PARAMS_PATTERN, ENV_PATTERN3;
7952
7961
  var init_workspace_tools = __esm({
7953
- "../server/dist/tools/workspace-tools.js"() {
7962
+ "packages/server/dist/tools/workspace-tools.js"() {
7954
7963
  "use strict";
7955
7964
  init_config();
7956
7965
  init_sandbox();
@@ -7966,7 +7975,7 @@ var init_workspace_tools = __esm({
7966
7975
  }
7967
7976
  });
7968
7977
 
7969
- // ../server/dist/tools/draft-tool.js
7978
+ // packages/server/dist/tools/draft-tool.js
7970
7979
  function createDraftTool() {
7971
7980
  let drafts = 0;
7972
7981
  const tool = {
@@ -8001,7 +8010,7 @@ Error: draft requires non-empty \`content\` \u2014 put your full draft answer th
8001
8010
  }
8002
8011
  var MAX_DRAFTS, REVIEW_CHECKLIST;
8003
8012
  var init_draft_tool = __esm({
8004
- "../server/dist/tools/draft-tool.js"() {
8013
+ "packages/server/dist/tools/draft-tool.js"() {
8005
8014
  "use strict";
8006
8015
  init_agent_loop();
8007
8016
  MAX_DRAFTS = 3;
@@ -8015,7 +8024,7 @@ If the draft clears all three, write the final answer now. If not, fix it (gathe
8015
8024
  }
8016
8025
  });
8017
8026
 
8018
- // ../server/dist/prompts/system-prompts.js
8027
+ // packages/server/dist/prompts/system-prompts.js
8019
8028
  import fs15 from "node:fs/promises";
8020
8029
  import path17 from "node:path";
8021
8030
  import { homedir as homedir10 } from "node:os";
@@ -8101,17 +8110,17 @@ async function loadSystemPrompts(workspaceRoot) {
8101
8110
  }
8102
8111
  var GLOBAL_PROMPTS_DIR;
8103
8112
  var init_system_prompts = __esm({
8104
- "../server/dist/prompts/system-prompts.js"() {
8113
+ "packages/server/dist/prompts/system-prompts.js"() {
8105
8114
  "use strict";
8106
8115
  GLOBAL_PROMPTS_DIR = path17.join(homedir10(), ".halo", "global", "prompts");
8107
8116
  }
8108
8117
  });
8109
8118
 
8110
- // ../server/dist/agents/session-agent-builder.js
8119
+ // packages/server/dist/agents/session-agent-builder.js
8111
8120
  import path18 from "node:path";
8112
8121
  var SessionAgentBuilder;
8113
8122
  var init_session_agent_builder = __esm({
8114
- "../server/dist/agents/session-agent-builder.js"() {
8123
+ "packages/server/dist/agents/session-agent-builder.js"() {
8115
8124
  "use strict";
8116
8125
  init_model_runtime();
8117
8126
  init_workspace_tools();
@@ -8418,7 +8427,8 @@ do delegate, say so in one line and keep going.`;
8418
8427
  buildModelRuntime(args) {
8419
8428
  const { yamlConfig, modelId, endpoint, providerId, sessionId, systemPrompt, tools } = args;
8420
8429
  const contextConfig = {
8421
- maxTokens: yamlConfig?.context?.maxTokens ?? config.model.maxContextTokens,
8430
+ // Priority: explicit agent.yaml config > model registry contextWindow > global default (200K).
8431
+ maxTokens: yamlConfig?.context?.maxTokens ?? resolveContextWindow(modelId) ?? config.model.maxContextTokens,
8422
8432
  compressAt: yamlConfig?.context?.compressAt ?? config.model.compressAt
8423
8433
  };
8424
8434
  const rawCaching = yamlConfig?.model?.promptCaching;
@@ -8505,10 +8515,10 @@ do delegate, say so in one line and keep going.`;
8505
8515
  }
8506
8516
  });
8507
8517
 
8508
- // ../server/dist/commands/registry.js
8518
+ // packages/server/dist/commands/registry.js
8509
8519
  var CommandRegistry;
8510
8520
  var init_registry = __esm({
8511
- "../server/dist/commands/registry.js"() {
8521
+ "packages/server/dist/commands/registry.js"() {
8512
8522
  "use strict";
8513
8523
  CommandRegistry = class {
8514
8524
  descriptors = /* @__PURE__ */ new Map();
@@ -8522,13 +8532,13 @@ var init_registry = __esm({
8522
8532
  }
8523
8533
  });
8524
8534
 
8525
- // ../server/dist/commands/index.js
8535
+ // packages/server/dist/commands/index.js
8526
8536
  function builtinCommandNames() {
8527
8537
  return commandRegistry.listDescriptors().filter((d) => d.source === "builtin").map((d) => d.name);
8528
8538
  }
8529
8539
  var commandRegistry;
8530
8540
  var init_commands = __esm({
8531
- "../server/dist/commands/index.js"() {
8541
+ "packages/server/dist/commands/index.js"() {
8532
8542
  "use strict";
8533
8543
  init_registry();
8534
8544
  commandRegistry = new CommandRegistry();
@@ -8578,7 +8588,7 @@ var init_commands = __esm({
8578
8588
  }
8579
8589
  });
8580
8590
 
8581
- // ../server/dist/channels/shared/i18n.js
8591
+ // packages/server/dist/channels/shared/i18n.js
8582
8592
  function getLang(account) {
8583
8593
  const v = account.language;
8584
8594
  return v === "en" || v === "zh" ? v : "en";
@@ -8597,7 +8607,7 @@ function t(key, lang, params) {
8597
8607
  }
8598
8608
  var messages;
8599
8609
  var init_i18n = __esm({
8600
- "../server/dist/channels/shared/i18n.js"() {
8610
+ "packages/server/dist/channels/shared/i18n.js"() {
8601
8611
  "use strict";
8602
8612
  messages = {
8603
8613
  // ── /help ──
@@ -8756,7 +8766,7 @@ var init_i18n = __esm({
8756
8766
  }
8757
8767
  });
8758
8768
 
8759
- // ../server/dist/commands/skill-command.js
8769
+ // packages/server/dist/commands/skill-command.js
8760
8770
  import fs16 from "node:fs/promises";
8761
8771
  import path19 from "node:path";
8762
8772
  async function scanDir(dir) {
@@ -8898,7 +8908,7 @@ ${body}`;
8898
8908
  }
8899
8909
  var cachedEntries;
8900
8910
  var init_skill_command = __esm({
8901
- "../server/dist/commands/skill-command.js"() {
8911
+ "packages/server/dist/commands/skill-command.js"() {
8902
8912
  "use strict";
8903
8913
  init_commands();
8904
8914
  init_agent_loader();
@@ -8909,7 +8919,7 @@ var init_skill_command = __esm({
8909
8919
  }
8910
8920
  });
8911
8921
 
8912
- // ../server/dist/agents/session-skill-commands.js
8922
+ // packages/server/dist/agents/session-skill-commands.js
8913
8923
  import { eq as eq5 } from "drizzle-orm";
8914
8924
  function commandVisibilityGate(d) {
8915
8925
  if (!d.verbs || d.verbs.length === 0)
@@ -8926,7 +8936,7 @@ function commandVisibilityGate(d) {
8926
8936
  }
8927
8937
  var VIS_RANK, SessionSkillCommands;
8928
8938
  var init_session_skill_commands = __esm({
8929
- "../server/dist/agents/session-skill-commands.js"() {
8939
+ "packages/server/dist/agents/session-skill-commands.js"() {
8930
8940
  "use strict";
8931
8941
  init_db();
8932
8942
  init_schema();
@@ -8993,12 +9003,12 @@ var init_session_skill_commands = __esm({
8993
9003
  }
8994
9004
  });
8995
9005
 
8996
- // ../server/dist/agents/session-state-store.js
9006
+ // packages/server/dist/agents/session-state-store.js
8997
9007
  import fsSync5 from "node:fs";
8998
9008
  import path20 from "node:path";
8999
9009
  var SessionStateStore;
9000
9010
  var init_session_state_store = __esm({
9001
- "../server/dist/agents/session-state-store.js"() {
9011
+ "packages/server/dist/agents/session-state-store.js"() {
9002
9012
  "use strict";
9003
9013
  init_session_store();
9004
9014
  SessionStateStore = class {
@@ -9062,7 +9072,7 @@ var init_session_state_store = __esm({
9062
9072
  }
9063
9073
  });
9064
9074
 
9065
- // ../server/dist/agents/session-manager.js
9075
+ // packages/server/dist/agents/session-manager.js
9066
9076
  import fsSync6 from "node:fs";
9067
9077
  import path21 from "node:path";
9068
9078
  import { eq as eq6, and as and4, isNull as isNull3, isNotNull as isNotNull2 } from "drizzle-orm";
@@ -9076,6 +9086,9 @@ function simpleHash(str) {
9076
9086
  function sleep(ms) {
9077
9087
  return new Promise((resolve2) => setTimeout(resolve2, ms));
9078
9088
  }
9089
+ function abortReason(reason) {
9090
+ return new DOMException(reason, "AbortError");
9091
+ }
9079
9092
  function estimateMessageTokens(messages2) {
9080
9093
  let chars = 0;
9081
9094
  for (const m of messages2) {
@@ -9105,6 +9118,34 @@ function isRawTurnStart(msg) {
9105
9118
  function stripImageMarkers(s) {
9106
9119
  return s.replace(/\[图片已保存: [^\]]*\]\n?/g, "").trim();
9107
9120
  }
9121
+ function replaceImageBlocks(messages2, reason) {
9122
+ let replaced = 0;
9123
+ const placeholder = () => ({ type: "text", text: `[image removed: ${reason}]` });
9124
+ for (const m of messages2) {
9125
+ if (!Array.isArray(m.content))
9126
+ continue;
9127
+ m.content = m.content.map((b) => {
9128
+ if (b.type === "image") {
9129
+ replaced++;
9130
+ return placeholder();
9131
+ }
9132
+ if (b.type === "tool_result" && Array.isArray(b.content)) {
9133
+ return {
9134
+ ...b,
9135
+ content: b.content.map((ib) => {
9136
+ if (ib.type === "image") {
9137
+ replaced++;
9138
+ return { type: "text", text: `[image removed: ${reason}]` };
9139
+ }
9140
+ return ib;
9141
+ })
9142
+ };
9143
+ }
9144
+ return b;
9145
+ });
9146
+ }
9147
+ return replaced;
9148
+ }
9108
9149
  function generateSessionId() {
9109
9150
  const ts = Date.now().toString(36);
9110
9151
  const rand = Math.random().toString(36).slice(2, 8);
@@ -9112,7 +9153,7 @@ function generateSessionId() {
9112
9153
  }
9113
9154
  var SessionManager;
9114
9155
  var init_session_manager = __esm({
9115
- "../server/dist/agents/session-manager.js"() {
9156
+ "packages/server/dist/agents/session-manager.js"() {
9116
9157
  "use strict";
9117
9158
  init_md_loader();
9118
9159
  init_config();
@@ -9128,6 +9169,7 @@ var init_session_manager = __esm({
9128
9169
  init_workspace_runtime_lock();
9129
9170
  init_enqueue();
9130
9171
  init_session_store();
9172
+ init_media_store();
9131
9173
  init_ui_log_builder();
9132
9174
  init_session_ui_store();
9133
9175
  init_session_query_store();
@@ -9790,7 +9832,7 @@ var init_session_manager = __esm({
9790
9832
  this.processSessionEvent(session, event);
9791
9833
  if (session.interruptRequested && event.type === "tool_result") {
9792
9834
  console.debug(`[SessionManager] Graceful interrupt after tool result in ${session.id}`);
9793
- session.abortController?.abort("interrupt");
9835
+ session.abortController?.abort(abortReason("interrupt"));
9794
9836
  this.markPendingToolCallsInterrupted(session.id);
9795
9837
  }
9796
9838
  }
@@ -9877,6 +9919,20 @@ var init_session_manager = __esm({
9877
9919
  }
9878
9920
  this.emitEvent(session.id, { type: "system", text: "Conversation repair failed. Use /new to start a fresh session." });
9879
9921
  }
9922
+ if (httpStatus !== void 0 && httpStatus >= 400 && httpStatus < 500 && (msg.includes("Multimodal data is corrupted") || msg.includes("Could not process image"))) {
9923
+ const replaced = replaceImageBlocks(session.agent.messages, "rejected by model provider");
9924
+ if (replaced > 0) {
9925
+ if (Array.isArray(message)) {
9926
+ message = message.map((b) => b.type === "image" ? { type: "text", text: "[image removed: rejected by model provider]" } : b);
9927
+ }
9928
+ this.saveAgentState(session);
9929
+ console.warn(`[SessionManager] Session ${session.id} multimodal 4xx \u2014 replaced ${replaced} image block(s) with placeholders (attempt ${attempt + 1}/${maxRetries})`);
9930
+ if (attempt + 1 < maxRetries) {
9931
+ this.emitEvent(session.id, { type: "system", text: `Model rejected image data \u2014 removed ${replaced} image(s) from history, retrying...` });
9932
+ continue;
9933
+ }
9934
+ }
9935
+ }
9880
9936
  const errDetail = [errName, httpStatus ? `HTTP ${httpStatus}` : ""].filter(Boolean).join(" ");
9881
9937
  console.error(`[SessionManager] Session ${session.id} error (attempt ${attempt + 1}/${maxRetries})${errDetail ? ` [${errDetail}]` : ""}: ${msg}`);
9882
9938
  this.emitEvent(session.id, { type: "error", error: msg, agentName: session.agentName, taskId: session.parentId ? session.id : void 0 });
@@ -10113,7 +10169,7 @@ ${q.text}` : q.text).join("\n\n");
10113
10169
  if (!session?.abortController)
10114
10170
  return;
10115
10171
  session.interruptRequested = true;
10116
- session.abortController.abort("interrupt");
10172
+ session.abortController.abort(abortReason("interrupt"));
10117
10173
  session.abortController = null;
10118
10174
  this.markPendingToolCallsInterrupted(sessionId);
10119
10175
  console.debug(`[SessionManager] Interrupted session ${sessionId}`);
@@ -10164,7 +10220,7 @@ ${q.text}` : q.text);
10164
10220
  session.messageQueue = [];
10165
10221
  session.interruptRequested = false;
10166
10222
  if (session.abortController) {
10167
- session.abortController.abort("stop");
10223
+ session.abortController.abort(abortReason("stop"));
10168
10224
  session.abortController = null;
10169
10225
  this.markPendingToolCallsInterrupted(id);
10170
10226
  }
@@ -10338,8 +10394,18 @@ ${cleaned}` : cleaned;
10338
10394
  if (!supportsImage) {
10339
10395
  return text5 + "\n\n[\u6CE8\u610F\uFF1A\u7528\u6237\u53D1\u9001\u4E86\u56FE\u7247\uFF0C\u4F46\u5F53\u524D\u6A21\u578B\u4E0D\u652F\u6301\u89C6\u89C9\u8F93\u5165\uFF0C\u56FE\u7247\u5DF2\u88AB\u5FFD\u7565]";
10340
10396
  }
10397
+ const accepted = images.filter((img) => VISION_IMAGE_MIME_TYPES.includes(img.mimeType));
10398
+ const dropped = images.length - accepted.length;
10399
+ if (dropped > 0) {
10400
+ console.warn(`[SessionManager] buildInput: dropped ${dropped} image(s) with unsupported media_type (${images.filter((i) => !VISION_IMAGE_MIME_TYPES.includes(i.mimeType)).map((i) => i.mimeType || "(empty)").join(", ")})`);
10401
+ text5 += `
10402
+
10403
+ [\u6CE8\u610F\uFF1A${dropped} \u5F20\u56FE\u7247\u683C\u5F0F\u4E0D\u53D7\u652F\u6301\uFF08\u4EC5\u652F\u6301 jpeg/png/gif/webp\uFF09\uFF0C\u5DF2\u88AB\u5FFD\u7565]`;
10404
+ }
10405
+ if (accepted.length === 0)
10406
+ return text5;
10341
10407
  const contentBlocks = [];
10342
- for (const img of images) {
10408
+ for (const img of accepted) {
10343
10409
  contentBlocks.push({
10344
10410
  type: "image",
10345
10411
  source: { type: "base64", media_type: img.mimeType, data: img.data }
@@ -10449,7 +10515,10 @@ ${result.summary}`, agentName: "user", report: true, taskId });
10449
10515
  return { maxTokens: config.model.maxContextTokens, compressAt: config.model.compressAt };
10450
10516
  const yamlConfig = await loadAgentYaml(row.agentId, this.workspaceRoot);
10451
10517
  return {
10452
- maxTokens: yamlConfig?.context?.maxTokens ?? config.model.maxContextTokens,
10518
+ // Same priority as buildModelRuntime: agent.yaml > model registry
10519
+ // contextWindow > global default — keeps the cold-session display in
10520
+ // sync with what actually takes effect on resume.
10521
+ maxTokens: yamlConfig?.context?.maxTokens ?? (yamlConfig?.model?.id ? resolveContextWindow(yamlConfig.model.id) : void 0) ?? config.model.maxContextTokens,
10453
10522
  compressAt: yamlConfig?.context?.compressAt ?? config.model.compressAt
10454
10523
  };
10455
10524
  }
@@ -11002,11 +11071,11 @@ ${q.text}` : q.text);
11002
11071
  }
11003
11072
  });
11004
11073
 
11005
- // ../server/dist/agents/session-manager-registry.js
11074
+ // packages/server/dist/agents/session-manager-registry.js
11006
11075
  import fs17 from "node:fs";
11007
11076
  var SessionManagerRegistry;
11008
11077
  var init_session_manager_registry = __esm({
11009
- "../server/dist/agents/session-manager-registry.js"() {
11078
+ "packages/server/dist/agents/session-manager-registry.js"() {
11010
11079
  "use strict";
11011
11080
  init_session_manager();
11012
11081
  init_init();
@@ -11061,7 +11130,7 @@ var init_session_manager_registry = __esm({
11061
11130
  }
11062
11131
  });
11063
11132
 
11064
- // ../server/dist/logger.js
11133
+ // packages/server/dist/logger.js
11065
11134
  import fs18 from "node:fs";
11066
11135
  import path22 from "node:path";
11067
11136
  import { homedir as homedir11 } from "node:os";
@@ -11161,7 +11230,7 @@ function initLogger() {
11161
11230
  }
11162
11231
  var LOG_FILENAME, logDir, logFile, currentSize, LEVEL_ORDER;
11163
11232
  var init_logger = __esm({
11164
- "../server/dist/logger.js"() {
11233
+ "packages/server/dist/logger.js"() {
11165
11234
  "use strict";
11166
11235
  init_config();
11167
11236
  LOG_FILENAME = "server.log";
@@ -11172,7 +11241,7 @@ var init_logger = __esm({
11172
11241
  }
11173
11242
  });
11174
11243
 
11175
- // ../server/dist/channels/shared/commands.js
11244
+ // packages/server/dist/channels/shared/commands.js
11176
11245
  import fs19 from "node:fs";
11177
11246
  import path23 from "node:path";
11178
11247
  import os from "node:os";
@@ -11898,7 +11967,7 @@ function execWsSwitch(ctx, arg) {
11898
11967
  }
11899
11968
  var ALIASES_FILE, aliasCache, CHANNEL_LIST_LIMIT, DISPATCH_COMMANDS, NOT_ROUTED, SUBCOMMAND_ROUTES, RANK;
11900
11969
  var init_commands2 = __esm({
11901
- "../server/dist/channels/shared/commands.js"() {
11970
+ "packages/server/dist/channels/shared/commands.js"() {
11902
11971
  "use strict";
11903
11972
  init_agent_loader();
11904
11973
  init_init();
@@ -11974,7 +12043,7 @@ var init_commands2 = __esm({
11974
12043
  }
11975
12044
  });
11976
12045
 
11977
- // src/harness.ts
12046
+ // packages/cli/src/harness.ts
11978
12047
  var harness_exports = {};
11979
12048
  __export(harness_exports, {
11980
12049
  createHarness: () => createHarness,
@@ -12216,7 +12285,7 @@ async function createHarness(opts) {
12216
12285
  }
12217
12286
  var SESSION_PREFIX, USER_ID;
12218
12287
  var init_harness = __esm({
12219
- "src/harness.ts"() {
12288
+ "packages/cli/src/harness.ts"() {
12220
12289
  "use strict";
12221
12290
  init_session_manager();
12222
12291
  init_session_manager_registry();
@@ -12233,7 +12302,7 @@ var init_harness = __esm({
12233
12302
  }
12234
12303
  });
12235
12304
 
12236
- // ../server/dist/middleware/password-hash.js
12305
+ // packages/server/dist/middleware/password-hash.js
12237
12306
  var password_hash_exports = {};
12238
12307
  __export(password_hash_exports, {
12239
12308
  generateJwtSecret: () => generateJwtSecret,
@@ -12283,7 +12352,7 @@ function generateJwtSecret() {
12283
12352
  }
12284
12353
  var scryptAsync, COST, KEY_LEN;
12285
12354
  var init_password_hash = __esm({
12286
- "../server/dist/middleware/password-hash.js"() {
12355
+ "packages/server/dist/middleware/password-hash.js"() {
12287
12356
  "use strict";
12288
12357
  scryptAsync = promisify2(crypto2.scrypt);
12289
12358
  COST = { N: 16384, r: 8, p: 1 };
@@ -12291,7 +12360,7 @@ var init_password_hash = __esm({
12291
12360
  }
12292
12361
  });
12293
12362
 
12294
- // ../server/dist/setup-config.js
12363
+ // packages/server/dist/setup-config.js
12295
12364
  var setup_config_exports = {};
12296
12365
  __export(setup_config_exports, {
12297
12366
  configLeafSet: () => configLeafSet,
@@ -12332,13 +12401,13 @@ function configLeafSet(dotPath) {
12332
12401
  }
12333
12402
  var CONFIG_PATH;
12334
12403
  var init_setup_config = __esm({
12335
- "../server/dist/setup-config.js"() {
12404
+ "packages/server/dist/setup-config.js"() {
12336
12405
  "use strict";
12337
12406
  CONFIG_PATH = path25.join(homedir12(), ".halo", "secrets", "config.yaml");
12338
12407
  }
12339
12408
  });
12340
12409
 
12341
- // ../server/dist/setup-settings.js
12410
+ // packages/server/dist/setup-settings.js
12342
12411
  var setup_settings_exports = {};
12343
12412
  __export(setup_settings_exports, {
12344
12413
  maskSecret: () => maskSecret,
@@ -12417,13 +12486,13 @@ function maskSecret(value) {
12417
12486
  }
12418
12487
  var SETTINGS_PATH2;
12419
12488
  var init_setup_settings = __esm({
12420
- "../server/dist/setup-settings.js"() {
12489
+ "packages/server/dist/setup-settings.js"() {
12421
12490
  "use strict";
12422
12491
  SETTINGS_PATH2 = path26.join(homedir13(), ".halo", "secrets", "settings.yaml");
12423
12492
  }
12424
12493
  });
12425
12494
 
12426
- // ../server/dist/setup-providers.js
12495
+ // packages/server/dist/setup-providers.js
12427
12496
  var setup_providers_exports = {};
12428
12497
  __export(setup_providers_exports, {
12429
12498
  AWS_CREDENTIAL_CHAIN_PROVIDER: () => AWS_CREDENTIAL_CHAIN_PROVIDER,
@@ -12629,7 +12698,7 @@ function listRequiredSkillsWithSecrets() {
12629
12698
  }
12630
12699
  var AWS_CREDENTIAL_CHAIN_PROVIDER, REBIND_BUILTIN_AGENT_IDS, GLOBAL_AGENTS_DIR3;
12631
12700
  var init_setup_providers = __esm({
12632
- "../server/dist/setup-providers.js"() {
12701
+ "packages/server/dist/setup-providers.js"() {
12633
12702
  "use strict";
12634
12703
  init_init();
12635
12704
  init_setup_settings();
@@ -12639,7 +12708,7 @@ var init_setup_providers = __esm({
12639
12708
  }
12640
12709
  });
12641
12710
 
12642
- // src/setup-bind-provider.ts
12711
+ // packages/cli/src/setup-bind-provider.ts
12643
12712
  var setup_bind_provider_exports = {};
12644
12713
  __export(setup_bind_provider_exports, {
12645
12714
  AWS_CHAIN_PROVIDER: () => AWS_CHAIN_PROVIDER,
@@ -12679,14 +12748,14 @@ function buildBindProviderPlan(configured, currentProvider, currentProviderHasKe
12679
12748
  }
12680
12749
  var AWS_CHAIN_PROVIDER, KEEP_CURRENT;
12681
12750
  var init_setup_bind_provider = __esm({
12682
- "src/setup-bind-provider.ts"() {
12751
+ "packages/cli/src/setup-bind-provider.ts"() {
12683
12752
  "use strict";
12684
12753
  AWS_CHAIN_PROVIDER = "aws-bedrock-claude-invoke";
12685
12754
  KEEP_CURRENT = "__keep__";
12686
12755
  }
12687
12756
  });
12688
12757
 
12689
- // src/setup-prompts.ts
12758
+ // packages/cli/src/setup-prompts.ts
12690
12759
  var setup_prompts_exports = {};
12691
12760
  __export(setup_prompts_exports, {
12692
12761
  promptMultiSelect: () => promptMultiSelect,
@@ -12972,12 +13041,12 @@ function promptMultiSelectRich(question, options) {
12972
13041
  });
12973
13042
  }
12974
13043
  var init_setup_prompts = __esm({
12975
- "src/setup-prompts.ts"() {
13044
+ "packages/cli/src/setup-prompts.ts"() {
12976
13045
  "use strict";
12977
13046
  }
12978
13047
  });
12979
13048
 
12980
- // src/render-md.ts
13049
+ // packages/cli/src/render-md.ts
12981
13050
  import { marked } from "marked";
12982
13051
  import { markedTerminal } from "marked-terminal";
12983
13052
  function renderMarkdown(text5) {
@@ -12985,14 +13054,14 @@ function renderMarkdown(text5) {
12985
13054
  return rendered.replace(/\n{3,}/g, "\n\n").trimEnd();
12986
13055
  }
12987
13056
  var init_render_md = __esm({
12988
- "src/render-md.ts"() {
13057
+ "packages/cli/src/render-md.ts"() {
12989
13058
  "use strict";
12990
13059
  marked.use(markedTerminal({ reflowText: true, width: Math.min(process.stdout.columns || 80, 120) }));
12991
13060
  marked.use({ breaks: true });
12992
13061
  }
12993
13062
  });
12994
13063
 
12995
- // src/resolve-refs.ts
13064
+ // packages/cli/src/resolve-refs.ts
12996
13065
  import fs24 from "node:fs";
12997
13066
  import path28 from "node:path";
12998
13067
  function mimeFromExt(ext) {
@@ -13074,7 +13143,7 @@ ${content}
13074
13143
  }
13075
13144
  var IMAGE_EXTS, MAX_FILE_BYTES, MAX_IMAGE_BYTES, REF_PATTERN;
13076
13145
  var init_resolve_refs = __esm({
13077
- "src/resolve-refs.ts"() {
13146
+ "packages/cli/src/resolve-refs.ts"() {
13078
13147
  "use strict";
13079
13148
  IMAGE_EXTS = /* @__PURE__ */ new Set([".png", ".jpg", ".jpeg", ".gif", ".webp", ".bmp"]);
13080
13149
  MAX_FILE_BYTES = 100 * 1024;
@@ -13083,7 +13152,7 @@ var init_resolve_refs = __esm({
13083
13152
  }
13084
13153
  });
13085
13154
 
13086
- // src/format-usage.ts
13155
+ // packages/cli/src/format-usage.ts
13087
13156
  function fmtK(n) {
13088
13157
  return `${(n / 1e3).toFixed(1)}K`;
13089
13158
  }
@@ -13127,7 +13196,7 @@ function formatUsageLine(event) {
13127
13196
  }
13128
13197
  var ANSI;
13129
13198
  var init_format_usage = __esm({
13130
- "src/format-usage.ts"() {
13199
+ "packages/cli/src/format-usage.ts"() {
13131
13200
  "use strict";
13132
13201
  ANSI = {
13133
13202
  reset: "\x1B[0m",
@@ -13141,7 +13210,7 @@ var init_format_usage = __esm({
13141
13210
  }
13142
13211
  });
13143
13212
 
13144
- // src/tui/components/banner.tsx
13213
+ // packages/cli/src/tui/components/banner.tsx
13145
13214
  import { Box, Text } from "ink";
13146
13215
  import { jsx } from "react/jsx-runtime";
13147
13216
  function Banner() {
@@ -13149,7 +13218,7 @@ function Banner() {
13149
13218
  }
13150
13219
  var LINES, COLORS;
13151
13220
  var init_banner = __esm({
13152
- "src/tui/components/banner.tsx"() {
13221
+ "packages/cli/src/tui/components/banner.tsx"() {
13153
13222
  "use strict";
13154
13223
  LINES = [
13155
13224
  " \u2588\u2588\u2557 \u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2557 ",
@@ -13163,7 +13232,7 @@ var init_banner = __esm({
13163
13232
  }
13164
13233
  });
13165
13234
 
13166
- // src/tui/components/messages.tsx
13235
+ // packages/cli/src/tui/components/messages.tsx
13167
13236
  import { Box as Box2, Static, Text as Text2 } from "ink";
13168
13237
  import { jsx as jsx2, jsxs } from "react/jsx-runtime";
13169
13238
  function Messages({ blocks }) {
@@ -13221,7 +13290,7 @@ function Block({ block }) {
13221
13290
  }
13222
13291
  var BANNER_ID;
13223
13292
  var init_messages = __esm({
13224
- "src/tui/components/messages.tsx"() {
13293
+ "packages/cli/src/tui/components/messages.tsx"() {
13225
13294
  "use strict";
13226
13295
  init_format_usage();
13227
13296
  init_banner();
@@ -13229,7 +13298,7 @@ var init_messages = __esm({
13229
13298
  }
13230
13299
  });
13231
13300
 
13232
- // src/tui/components/streaming.tsx
13301
+ // packages/cli/src/tui/components/streaming.tsx
13233
13302
  import { useEffect, useState } from "react";
13234
13303
  import { Box as Box3, Text as Text3 } from "ink";
13235
13304
  import Spinner from "ink-spinner";
@@ -13278,12 +13347,12 @@ function Streaming({ spinnerLabel, liveText, liveThinking, activeSubs, turnStart
13278
13347
  ] });
13279
13348
  }
13280
13349
  var init_streaming = __esm({
13281
- "src/tui/components/streaming.tsx"() {
13350
+ "packages/cli/src/tui/components/streaming.tsx"() {
13282
13351
  "use strict";
13283
13352
  }
13284
13353
  });
13285
13354
 
13286
- // src/tui/history.ts
13355
+ // packages/cli/src/tui/history.ts
13287
13356
  import fs25 from "node:fs";
13288
13357
  import path29 from "node:path";
13289
13358
  import os2 from "node:os";
@@ -13309,14 +13378,14 @@ function appendHistory(entry) {
13309
13378
  }
13310
13379
  var HISTORY_FILE, MAX_ENTRIES;
13311
13380
  var init_history = __esm({
13312
- "src/tui/history.ts"() {
13381
+ "packages/cli/src/tui/history.ts"() {
13313
13382
  "use strict";
13314
13383
  HISTORY_FILE = path29.join(os2.homedir(), ".halo", "global", "tui-history.json");
13315
13384
  MAX_ENTRIES = 100;
13316
13385
  }
13317
13386
  });
13318
13387
 
13319
- // src/tui/components/status-bar.tsx
13388
+ // packages/cli/src/tui/components/status-bar.tsx
13320
13389
  import { Box as Box4, Text as Text4 } from "ink";
13321
13390
  import { Fragment, jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
13322
13391
  function shortModel(modelId) {
@@ -13352,12 +13421,12 @@ function StatusBar({ agentName, modelId, contextPercent, workspace, sessionId, v
13352
13421
  ] });
13353
13422
  }
13354
13423
  var init_status_bar = __esm({
13355
- "src/tui/components/status-bar.tsx"() {
13424
+ "packages/cli/src/tui/components/status-bar.tsx"() {
13356
13425
  "use strict";
13357
13426
  }
13358
13427
  });
13359
13428
 
13360
- // src/tui/components/slash-suggest.tsx
13429
+ // packages/cli/src/tui/components/slash-suggest.tsx
13361
13430
  import { Box as Box5, Text as Text5 } from "ink";
13362
13431
  import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
13363
13432
  function SlashSuggest({ items, selectedIdx, maxWidth = 80 }) {
@@ -13384,12 +13453,12 @@ function SlashSuggest({ items, selectedIdx, maxWidth = 80 }) {
13384
13453
  ] });
13385
13454
  }
13386
13455
  var init_slash_suggest = __esm({
13387
- "src/tui/components/slash-suggest.tsx"() {
13456
+ "packages/cli/src/tui/components/slash-suggest.tsx"() {
13388
13457
  "use strict";
13389
13458
  }
13390
13459
  });
13391
13460
 
13392
- // src/tui/components/path-suggest.tsx
13461
+ // packages/cli/src/tui/components/path-suggest.tsx
13393
13462
  import { Box as Box6, Text as Text6 } from "ink";
13394
13463
  import { jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
13395
13464
  function PathSuggest({ items, selectedIdx, cwdLabel }) {
@@ -13416,12 +13485,12 @@ function PathSuggest({ items, selectedIdx, cwdLabel }) {
13416
13485
  ] });
13417
13486
  }
13418
13487
  var init_path_suggest = __esm({
13419
- "src/tui/components/path-suggest.tsx"() {
13488
+ "packages/cli/src/tui/components/path-suggest.tsx"() {
13420
13489
  "use strict";
13421
13490
  }
13422
13491
  });
13423
13492
 
13424
- // src/tui/path-suggest-engine.ts
13493
+ // packages/cli/src/tui/path-suggest-engine.ts
13425
13494
  import fs26 from "node:fs";
13426
13495
  import path30 from "node:path";
13427
13496
  function detectActiveRef(value) {
@@ -13508,13 +13577,13 @@ function applyPathPick(value, ref, pick) {
13508
13577
  }
13509
13578
  var IMAGE_EXTS2;
13510
13579
  var init_path_suggest_engine = __esm({
13511
- "src/tui/path-suggest-engine.ts"() {
13580
+ "packages/cli/src/tui/path-suggest-engine.ts"() {
13512
13581
  "use strict";
13513
13582
  IMAGE_EXTS2 = /* @__PURE__ */ new Set([".png", ".jpg", ".jpeg", ".gif", ".webp", ".bmp"]);
13514
13583
  }
13515
13584
  });
13516
13585
 
13517
- // src/tui/line-editor.ts
13586
+ // packages/cli/src/tui/line-editor.ts
13518
13587
  function toGraphemes(s) {
13519
13588
  if (s === "") return [];
13520
13589
  return [...segmenter.segment(s)].map((seg) => seg.segment);
@@ -13568,13 +13637,13 @@ function deleteToEnd(e) {
13568
13637
  }
13569
13638
  var segmenter;
13570
13639
  var init_line_editor = __esm({
13571
- "src/tui/line-editor.ts"() {
13640
+ "packages/cli/src/tui/line-editor.ts"() {
13572
13641
  "use strict";
13573
13642
  segmenter = new Intl.Segmenter();
13574
13643
  }
13575
13644
  });
13576
13645
 
13577
- // src/tui/components/text-input.tsx
13646
+ // packages/cli/src/tui/components/text-input.tsx
13578
13647
  import { Text as Text7 } from "ink";
13579
13648
  import { jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
13580
13649
  function TextInputView({ value, cursor, placeholder }) {
@@ -13599,13 +13668,13 @@ function TextInputView({ value, cursor, placeholder }) {
13599
13668
  ] });
13600
13669
  }
13601
13670
  var init_text_input = __esm({
13602
- "src/tui/components/text-input.tsx"() {
13671
+ "packages/cli/src/tui/components/text-input.tsx"() {
13603
13672
  "use strict";
13604
13673
  init_line_editor();
13605
13674
  }
13606
13675
  });
13607
13676
 
13608
- // src/tui/components/input-box.tsx
13677
+ // packages/cli/src/tui/components/input-box.tsx
13609
13678
  import { useState as useState2, useEffect as useEffect2, useMemo, useRef } from "react";
13610
13679
  import { Box as Box7, Text as Text8, useInput, usePaste } from "ink";
13611
13680
  import { jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
@@ -13852,7 +13921,7 @@ function InputBox({ enabled, placeholder, history, onSubmit, hint, commands = []
13852
13921
  ] });
13853
13922
  }
13854
13923
  var init_input_box = __esm({
13855
- "src/tui/components/input-box.tsx"() {
13924
+ "packages/cli/src/tui/components/input-box.tsx"() {
13856
13925
  "use strict";
13857
13926
  init_slash_suggest();
13858
13927
  init_path_suggest();
@@ -13862,7 +13931,7 @@ var init_input_box = __esm({
13862
13931
  }
13863
13932
  });
13864
13933
 
13865
- // src/tui/components/log-navigator.tsx
13934
+ // packages/cli/src/tui/components/log-navigator.tsx
13866
13935
  import { useState as useState3, useMemo as useMemo2, useEffect as useEffect3 } from "react";
13867
13936
  import { Box as Box8, Text as Text9, useInput as useInput2 } from "ink";
13868
13937
  import { jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
@@ -13941,12 +14010,12 @@ function LogNavigator({ tree, onPick, onCancel }) {
13941
14010
  ] });
13942
14011
  }
13943
14012
  var init_log_navigator = __esm({
13944
- "src/tui/components/log-navigator.tsx"() {
14013
+ "packages/cli/src/tui/components/log-navigator.tsx"() {
13945
14014
  "use strict";
13946
14015
  }
13947
14016
  });
13948
14017
 
13949
- // src/tui/components/log-viewer.tsx
14018
+ // packages/cli/src/tui/components/log-viewer.tsx
13950
14019
  import { useState as useState4, useMemo as useMemo3, useEffect as useEffect4, useRef as useRef2 } from "react";
13951
14020
  import { Box as Box9, Text as Text10, useInput as useInput3, useStdout } from "ink";
13952
14021
  import { jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
@@ -14030,13 +14099,13 @@ function truncateForCols(s, cols) {
14030
14099
  }
14031
14100
  var ANSI_RE;
14032
14101
  var init_log_viewer = __esm({
14033
- "src/tui/components/log-viewer.tsx"() {
14102
+ "packages/cli/src/tui/components/log-viewer.tsx"() {
14034
14103
  "use strict";
14035
14104
  ANSI_RE = /\x1b\[[0-9;]*m/g;
14036
14105
  }
14037
14106
  });
14038
14107
 
14039
- // src/tui/app.tsx
14108
+ // packages/cli/src/tui/app.tsx
14040
14109
  import { useEffect as useEffect5, useMemo as useMemo4, useReducer, useState as useState5, useRef as useRef3 } from "react";
14041
14110
  import { Box as Box10, useApp, useInput as useInput4 } from "ink";
14042
14111
  import { jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
@@ -14744,7 +14813,7 @@ ${lines.join("\n")}` });
14744
14813
  }
14745
14814
  var MAX_CONTEXT_TOKENS_FALLBACK, blockSeq, ANSI2;
14746
14815
  var init_app = __esm({
14747
- "src/tui/app.tsx"() {
14816
+ "packages/cli/src/tui/app.tsx"() {
14748
14817
  "use strict";
14749
14818
  init_render_md();
14750
14819
  init_resolve_refs();
@@ -14771,7 +14840,7 @@ var init_app = __esm({
14771
14840
  }
14772
14841
  });
14773
14842
 
14774
- // src/tui.tsx
14843
+ // packages/cli/src/tui.tsx
14775
14844
  var tui_exports = {};
14776
14845
  __export(tui_exports, {
14777
14846
  runTui: () => runTui
@@ -14786,13 +14855,13 @@ async function runTui(harness, opts = {}) {
14786
14855
  await instance.waitUntilExit();
14787
14856
  }
14788
14857
  var init_tui = __esm({
14789
- "src/tui.tsx"() {
14858
+ "packages/cli/src/tui.tsx"() {
14790
14859
  "use strict";
14791
14860
  init_app();
14792
14861
  }
14793
14862
  });
14794
14863
 
14795
- // src/cli.ts
14864
+ // packages/cli/src/cli.ts
14796
14865
  var cli_exports = {};
14797
14866
  __export(cli_exports, {
14798
14867
  runCli: () => runCli
@@ -14974,7 +15043,7 @@ ${tag}${formatUsageLine(event)}
14974
15043
  return errorText ? 1 : 0;
14975
15044
  }
14976
15045
  var init_cli = __esm({
14977
- "src/cli.ts"() {
15046
+ "packages/cli/src/cli.ts"() {
14978
15047
  "use strict";
14979
15048
  init_render_md();
14980
15049
  init_resolve_refs();
@@ -14982,13 +15051,13 @@ var init_cli = __esm({
14982
15051
  }
14983
15052
  });
14984
15053
 
14985
- // ../core/dist/workspace/workspace.js
15054
+ // packages/core/dist/workspace/workspace.js
14986
15055
  import { readFile, writeFile, mkdir, readdir, access } from "node:fs/promises";
14987
15056
  import { realpathSync as realpathSync2 } from "node:fs";
14988
15057
  import { resolve, relative, join, isAbsolute, sep } from "node:path";
14989
15058
  var WorkspaceError, SKIP_DIRS2, Workspace;
14990
15059
  var init_workspace = __esm({
14991
- "../core/dist/workspace/workspace.js"() {
15060
+ "packages/core/dist/workspace/workspace.js"() {
14992
15061
  "use strict";
14993
15062
  WorkspaceError = class extends Error {
14994
15063
  constructor(message) {
@@ -15097,13 +15166,13 @@ None yet.
15097
15166
  }
15098
15167
  });
15099
15168
 
15100
- // ../core/dist/workspace/git-manager.js
15169
+ // packages/core/dist/workspace/git-manager.js
15101
15170
  import path31 from "node:path";
15102
15171
  import { promises as fs27 } from "node:fs";
15103
15172
  import simpleGit from "simple-git";
15104
15173
  var GitManagerError, GitManager;
15105
15174
  var init_git_manager = __esm({
15106
- "../core/dist/workspace/git-manager.js"() {
15175
+ "packages/core/dist/workspace/git-manager.js"() {
15107
15176
  "use strict";
15108
15177
  GitManagerError = class extends Error {
15109
15178
  constructor(message) {
@@ -15470,16 +15539,16 @@ var init_git_manager = __esm({
15470
15539
  }
15471
15540
  });
15472
15541
 
15473
- // ../core/dist/index.js
15542
+ // packages/core/dist/index.js
15474
15543
  var init_dist = __esm({
15475
- "../core/dist/index.js"() {
15544
+ "packages/core/dist/index.js"() {
15476
15545
  "use strict";
15477
15546
  init_workspace();
15478
15547
  init_git_manager();
15479
15548
  }
15480
15549
  });
15481
15550
 
15482
- // ../server/dist/channels/shared/media.js
15551
+ // packages/server/dist/channels/shared/media.js
15483
15552
  import path32 from "node:path";
15484
15553
  import os3 from "node:os";
15485
15554
  function tempDir() {
@@ -15502,7 +15571,7 @@ function classifyMedia(filePath) {
15502
15571
  }
15503
15572
  var IMAGE_EXTS3, VIDEO_EXTS, VOICE_EXTS;
15504
15573
  var init_media = __esm({
15505
- "../server/dist/channels/shared/media.js"() {
15574
+ "packages/server/dist/channels/shared/media.js"() {
15506
15575
  "use strict";
15507
15576
  IMAGE_EXTS3 = /* @__PURE__ */ new Set([".jpg", ".jpeg", ".png", ".gif", ".webp", ".bmp"]);
15508
15577
  VIDEO_EXTS = /* @__PURE__ */ new Set([".mp4", ".mov", ".m4v", ".webm", ".avi"]);
@@ -15510,7 +15579,7 @@ var init_media = __esm({
15510
15579
  }
15511
15580
  });
15512
15581
 
15513
- // ../server/dist/routes/files.js
15582
+ // packages/server/dist/routes/files.js
15514
15583
  import { Hono } from "hono";
15515
15584
  import fs28 from "node:fs/promises";
15516
15585
  import { createReadStream } from "node:fs";
@@ -16102,14 +16171,14 @@ function createFileRoutes() {
16102
16171
  return app2;
16103
16172
  }
16104
16173
  var init_files = __esm({
16105
- "../server/dist/routes/files.js"() {
16174
+ "packages/server/dist/routes/files.js"() {
16106
16175
  "use strict";
16107
16176
  init_dist();
16108
16177
  init_media();
16109
16178
  }
16110
16179
  });
16111
16180
 
16112
- // ../server/dist/git-credentials.js
16181
+ // packages/server/dist/git-credentials.js
16113
16182
  import fs29 from "node:fs";
16114
16183
  import path34 from "node:path";
16115
16184
  import { homedir as homedir16 } from "node:os";
@@ -16184,13 +16253,13 @@ function deleteGitCredential(host) {
16184
16253
  }
16185
16254
  var GIT_CREDENTIALS_PATH;
16186
16255
  var init_git_credentials = __esm({
16187
- "../server/dist/git-credentials.js"() {
16256
+ "packages/server/dist/git-credentials.js"() {
16188
16257
  "use strict";
16189
16258
  GIT_CREDENTIALS_PATH = path34.join(homedir16(), ".git-credentials");
16190
16259
  }
16191
16260
  });
16192
16261
 
16193
- // ../server/dist/git-ssh.js
16262
+ // packages/server/dist/git-ssh.js
16194
16263
  import fs30 from "node:fs";
16195
16264
  import os4 from "node:os";
16196
16265
  import path35 from "node:path";
@@ -16367,7 +16436,7 @@ function getRemoteProtocol(projectRoot) {
16367
16436
  }
16368
16437
  var SSH_DIR, NON_KEY_NAMES, ownedAgentPid, ASKPASS_SCRIPT;
16369
16438
  var init_git_ssh = __esm({
16370
- "../server/dist/git-ssh.js"() {
16439
+ "packages/server/dist/git-ssh.js"() {
16371
16440
  "use strict";
16372
16441
  SSH_DIR = path35.join(os4.homedir(), ".ssh");
16373
16442
  NON_KEY_NAMES = /* @__PURE__ */ new Set(["known_hosts", "known_hosts2", "authorized_keys", "config"]);
@@ -16380,7 +16449,7 @@ printf '%s\\n' "$HALO_SSH_PASSPHRASE"
16380
16449
  }
16381
16450
  });
16382
16451
 
16383
- // ../server/dist/routes/git.js
16452
+ // packages/server/dist/routes/git.js
16384
16453
  import { Hono as Hono2 } from "hono";
16385
16454
  import fs31 from "node:fs/promises";
16386
16455
  import os5 from "node:os";
@@ -16734,7 +16803,7 @@ function createGitRoutes() {
16734
16803
  return app2;
16735
16804
  }
16736
16805
  var init_git = __esm({
16737
- "../server/dist/routes/git.js"() {
16806
+ "packages/server/dist/routes/git.js"() {
16738
16807
  "use strict";
16739
16808
  init_dist();
16740
16809
  init_git_credentials();
@@ -16743,7 +16812,7 @@ var init_git = __esm({
16743
16812
  }
16744
16813
  });
16745
16814
 
16746
- // ../server/dist/routes/agent-configs.js
16815
+ // packages/server/dist/routes/agent-configs.js
16747
16816
  import { Hono as Hono3 } from "hono";
16748
16817
  import fs32 from "node:fs/promises";
16749
16818
  import path37 from "node:path";
@@ -17236,7 +17305,7 @@ ${body.description ?? ""}
17236
17305
  }
17237
17306
  var _cachedTools, GLOBAL_AGENTS_DIR4, FALLBACK_SCAFFOLD_PROVIDER, _yamlCache;
17238
17307
  var init_agent_configs = __esm({
17239
- "../server/dist/routes/agent-configs.js"() {
17308
+ "packages/server/dist/routes/agent-configs.js"() {
17240
17309
  "use strict";
17241
17310
  init_workspace_tools();
17242
17311
  init_draft_tool();
@@ -17250,7 +17319,7 @@ var init_agent_configs = __esm({
17250
17319
  }
17251
17320
  });
17252
17321
 
17253
- // ../server/dist/routes/skills.js
17322
+ // packages/server/dist/routes/skills.js
17254
17323
  import { Hono as Hono4 } from "hono";
17255
17324
  import fs33 from "node:fs/promises";
17256
17325
  import path38 from "node:path";
@@ -17448,7 +17517,7 @@ function createSkillRoutes() {
17448
17517
  }
17449
17518
  var GLOBAL_SETTINGS_PATH, _skillMdCache;
17450
17519
  var init_skills = __esm({
17451
- "../server/dist/routes/skills.js"() {
17520
+ "packages/server/dist/routes/skills.js"() {
17452
17521
  "use strict";
17453
17522
  init_agent_loader();
17454
17523
  init_db();
@@ -17457,7 +17526,7 @@ var init_skills = __esm({
17457
17526
  }
17458
17527
  });
17459
17528
 
17460
- // ../server/dist/routes/settings.js
17529
+ // packages/server/dist/routes/settings.js
17461
17530
  import { Hono as Hono5 } from "hono";
17462
17531
  import fs34 from "node:fs/promises";
17463
17532
  import path39 from "node:path";
@@ -17710,7 +17779,7 @@ function createSettingsRoutes() {
17710
17779
  }
17711
17780
  var GLOBAL_SETTINGS_PATH2, _changeListeners;
17712
17781
  var init_settings = __esm({
17713
- "../server/dist/routes/settings.js"() {
17782
+ "packages/server/dist/routes/settings.js"() {
17714
17783
  "use strict";
17715
17784
  init_settings_schema();
17716
17785
  GLOBAL_SETTINGS_PATH2 = path39.join(homedir19(), ".halo", "secrets", "settings.yaml");
@@ -17718,7 +17787,7 @@ var init_settings = __esm({
17718
17787
  }
17719
17788
  });
17720
17789
 
17721
- // ../server/dist/paths.js
17790
+ // packages/server/dist/paths.js
17722
17791
  import path40 from "node:path";
17723
17792
  import { homedir as homedir20 } from "node:os";
17724
17793
  function haloHome() {
@@ -17749,12 +17818,12 @@ function evoApplyLogFile(applyId) {
17749
17818
  return path40.join(evoLogsDir(), `apply-${applyId}.log`);
17750
17819
  }
17751
17820
  var init_paths = __esm({
17752
- "../server/dist/paths.js"() {
17821
+ "packages/server/dist/paths.js"() {
17753
17822
  "use strict";
17754
17823
  }
17755
17824
  });
17756
17825
 
17757
- // ../server/dist/evolution/archive.js
17826
+ // packages/server/dist/evolution/archive.js
17758
17827
  import fs35 from "node:fs";
17759
17828
  import path41 from "node:path";
17760
17829
  import { spawnSync as spawnSync3 } from "node:child_process";
@@ -17898,7 +17967,7 @@ function stopArchiveDaemon() {
17898
17967
  }
17899
17968
  var TERMINAL_RUN_STATUSES, TERMINAL_APPLY_STATUSES, DAY_MS, ARCHIVE_AFTER_MS, PURGE_AFTER_MS, _archiveTimer;
17900
17969
  var init_archive = __esm({
17901
- "../server/dist/evolution/archive.js"() {
17970
+ "packages/server/dist/evolution/archive.js"() {
17902
17971
  "use strict";
17903
17972
  init_evo_db();
17904
17973
  init_paths();
@@ -17911,7 +17980,7 @@ var init_archive = __esm({
17911
17980
  }
17912
17981
  });
17913
17982
 
17914
- // ../server/dist/routes/evolution.js
17983
+ // packages/server/dist/routes/evolution.js
17915
17984
  import { Hono as Hono6 } from "hono";
17916
17985
  import { eq as eq8, desc as desc2, asc, inArray as inArray2, lt as lt3, and as and6, or, sql } from "drizzle-orm";
17917
17986
  import fs36 from "node:fs/promises";
@@ -18171,7 +18240,7 @@ function extractText(content) {
18171
18240
  }
18172
18241
  var UNDELETABLE_RUN_STATUSES;
18173
18242
  var init_evolution = __esm({
18174
- "../server/dist/routes/evolution.js"() {
18243
+ "packages/server/dist/routes/evolution.js"() {
18175
18244
  "use strict";
18176
18245
  init_evo_db();
18177
18246
  init_archive();
@@ -18180,7 +18249,7 @@ var init_evolution = __esm({
18180
18249
  }
18181
18250
  });
18182
18251
 
18183
- // ../server/dist/routes/sessions.js
18252
+ // packages/server/dist/routes/sessions.js
18184
18253
  import { Hono as Hono7 } from "hono";
18185
18254
  import { eq as eq9, desc as desc3 } from "drizzle-orm";
18186
18255
  function rawId() {
@@ -18466,7 +18535,7 @@ function createSessionRoutes(smRegistry) {
18466
18535
  }
18467
18536
  var msgCounter2;
18468
18537
  var init_sessions = __esm({
18469
- "../server/dist/routes/sessions.js"() {
18538
+ "packages/server/dist/routes/sessions.js"() {
18470
18539
  "use strict";
18471
18540
  init_db();
18472
18541
  init_schema();
@@ -18477,7 +18546,7 @@ var init_sessions = __esm({
18477
18546
  }
18478
18547
  });
18479
18548
 
18480
- // ../server/dist/db/channel-db.js
18549
+ // packages/server/dist/db/channel-db.js
18481
18550
  import Database3 from "better-sqlite3";
18482
18551
  import { drizzle as drizzle3 } from "drizzle-orm/better-sqlite3";
18483
18552
  import { sqliteTable as sqliteTable3, text as text3, integer as integer3 } from "drizzle-orm/sqlite-core";
@@ -18502,7 +18571,7 @@ function getChannelDb() {
18502
18571
  }
18503
18572
  var channelAccounts, CREATE_SQL2, _channelDb;
18504
18573
  var init_channel_db = __esm({
18505
- "../server/dist/db/channel-db.js"() {
18574
+ "packages/server/dist/db/channel-db.js"() {
18506
18575
  "use strict";
18507
18576
  channelAccounts = sqliteTable3("channel_accounts", {
18508
18577
  accountId: text3("account_id").primaryKey(),
@@ -18535,7 +18604,7 @@ CREATE INDEX IF NOT EXISTS idx_channel_accounts_type ON channel_accounts(channel
18535
18604
  }
18536
18605
  });
18537
18606
 
18538
- // ../server/dist/channels/shared/accounts.js
18607
+ // packages/server/dist/channels/shared/accounts.js
18539
18608
  import fs38 from "node:fs";
18540
18609
  import { eq as eq10, and as and7 } from "drizzle-orm";
18541
18610
  function resolveAccountWorkspace(account) {
@@ -18627,7 +18696,7 @@ function deleteAccount(db, accountId) {
18627
18696
  }
18628
18697
  var _lastActiveChatCache;
18629
18698
  var init_accounts = __esm({
18630
- "../server/dist/channels/shared/accounts.js"() {
18699
+ "packages/server/dist/channels/shared/accounts.js"() {
18631
18700
  "use strict";
18632
18701
  init_channel_db();
18633
18702
  init_init();
@@ -18635,7 +18704,7 @@ var init_accounts = __esm({
18635
18704
  }
18636
18705
  });
18637
18706
 
18638
- // ../server/dist/channels/web/accounts.js
18707
+ // packages/server/dist/channels/web/accounts.js
18639
18708
  function toWeb(a) {
18640
18709
  const c = a.config;
18641
18710
  return {
@@ -18698,14 +18767,14 @@ function deleteAccount2(db, accountId) {
18698
18767
  }
18699
18768
  var CH;
18700
18769
  var init_accounts2 = __esm({
18701
- "../server/dist/channels/web/accounts.js"() {
18770
+ "packages/server/dist/channels/web/accounts.js"() {
18702
18771
  "use strict";
18703
18772
  init_accounts();
18704
18773
  CH = "web";
18705
18774
  }
18706
18775
  });
18707
18776
 
18708
- // ../server/dist/middleware/brute-force.js
18777
+ // packages/server/dist/middleware/brute-force.js
18709
18778
  import { getConnInfo } from "@hono/node-server/conninfo";
18710
18779
  function bucket(name) {
18711
18780
  let b = buckets.get(name);
@@ -18756,7 +18825,7 @@ function clearFailures(bucketName, ip) {
18756
18825
  }
18757
18826
  var MAX_ATTEMPTS, LOCKOUT_MS, buckets;
18758
18827
  var init_brute_force = __esm({
18759
- "../server/dist/middleware/brute-force.js"() {
18828
+ "packages/server/dist/middleware/brute-force.js"() {
18760
18829
  "use strict";
18761
18830
  init_config();
18762
18831
  MAX_ATTEMPTS = 5;
@@ -18765,7 +18834,7 @@ var init_brute_force = __esm({
18765
18834
  }
18766
18835
  });
18767
18836
 
18768
- // ../server/dist/routes/show.js
18837
+ // packages/server/dist/routes/show.js
18769
18838
  import { Hono as Hono8 } from "hono";
18770
18839
  import fs39 from "node:fs";
18771
18840
  import path44 from "node:path";
@@ -19163,7 +19232,7 @@ function createShowRoutes(registry2) {
19163
19232
  }
19164
19233
  var TOKEN_BUCKET, SESSIONS_PER_WS, _skillCache, _metaCache, _roReaders, SESSION_LOG_MAX_MSGS, _birthCache;
19165
19234
  var init_show = __esm({
19166
- "../server/dist/routes/show.js"() {
19235
+ "packages/server/dist/routes/show.js"() {
19167
19236
  "use strict";
19168
19237
  init_channel_db();
19169
19238
  init_accounts2();
@@ -19180,7 +19249,7 @@ var init_show = __esm({
19180
19249
  }
19181
19250
  });
19182
19251
 
19183
- // ../server/dist/routes/metrics.js
19252
+ // packages/server/dist/routes/metrics.js
19184
19253
  import { Hono as Hono9 } from "hono";
19185
19254
  import fs40 from "node:fs";
19186
19255
  function family(name, type, help, samples) {
@@ -19285,7 +19354,7 @@ function createMetricsRoutes(registry2) {
19285
19354
  }
19286
19355
  var TOKEN_BUCKET2, SESSIONS_PER_WS2;
19287
19356
  var init_metrics = __esm({
19288
- "../server/dist/routes/metrics.js"() {
19357
+ "packages/server/dist/routes/metrics.js"() {
19289
19358
  "use strict";
19290
19359
  init_channel_db();
19291
19360
  init_accounts2();
@@ -19296,7 +19365,7 @@ var init_metrics = __esm({
19296
19365
  }
19297
19366
  });
19298
19367
 
19299
- // ../server/dist/routes/commands.js
19368
+ // packages/server/dist/routes/commands.js
19300
19369
  import { Hono as Hono10 } from "hono";
19301
19370
  function createCommandRoutes(registry2, smRegistry) {
19302
19371
  const app2 = new Hono10();
@@ -19321,12 +19390,12 @@ function createCommandRoutes(registry2, smRegistry) {
19321
19390
  return app2;
19322
19391
  }
19323
19392
  var init_commands3 = __esm({
19324
- "../server/dist/routes/commands.js"() {
19393
+ "packages/server/dist/routes/commands.js"() {
19325
19394
  "use strict";
19326
19395
  }
19327
19396
  });
19328
19397
 
19329
- // ../server/dist/sessions/session-types.js
19398
+ // packages/server/dist/sessions/session-types.js
19330
19399
  function inferMessageType(msg) {
19331
19400
  if (msg.type)
19332
19401
  return msg.type;
@@ -19345,12 +19414,12 @@ function inferMessageType(msg) {
19345
19414
  return "notification";
19346
19415
  }
19347
19416
  var init_session_types = __esm({
19348
- "../server/dist/sessions/session-types.js"() {
19417
+ "packages/server/dist/sessions/session-types.js"() {
19349
19418
  "use strict";
19350
19419
  }
19351
19420
  });
19352
19421
 
19353
- // ../server/dist/routes/agentcore.js
19422
+ // packages/server/dist/routes/agentcore.js
19354
19423
  import { Hono as Hono11 } from "hono";
19355
19424
  import path45 from "node:path";
19356
19425
  import fs41 from "node:fs";
@@ -19600,7 +19669,7 @@ ${text5}`);
19600
19669
  }
19601
19670
  var SESSION_HEADER, activeOverrides;
19602
19671
  var init_agentcore = __esm({
19603
- "../server/dist/routes/agentcore.js"() {
19672
+ "packages/server/dist/routes/agentcore.js"() {
19604
19673
  "use strict";
19605
19674
  init_commands2();
19606
19675
  init_ui_log_builder();
@@ -19610,7 +19679,7 @@ var init_agentcore = __esm({
19610
19679
  }
19611
19680
  });
19612
19681
 
19613
- // ../server/dist/ws/file-watcher.js
19682
+ // packages/server/dist/ws/file-watcher.js
19614
19683
  import fs42 from "node:fs";
19615
19684
  import path46 from "node:path";
19616
19685
  function enqueueNativeOp(op) {
@@ -19632,7 +19701,7 @@ function isUnwatchablePath(absPath) {
19632
19701
  }
19633
19702
  var IGNORED_SEGMENTS, IS_WIN32, IGNORED_SEGMENT_SET, NATIVE_IGNORE, nativeOpChain, WorkspaceWatcher;
19634
19703
  var init_file_watcher = __esm({
19635
- "../server/dist/ws/file-watcher.js"() {
19704
+ "packages/server/dist/ws/file-watcher.js"() {
19636
19705
  "use strict";
19637
19706
  IGNORED_SEGMENTS = [
19638
19707
  // VCS
@@ -19854,12 +19923,12 @@ var init_file_watcher = __esm({
19854
19923
  }
19855
19924
  });
19856
19925
 
19857
- // ../server/dist/ws/git-dir-watcher.js
19926
+ // packages/server/dist/ws/git-dir-watcher.js
19858
19927
  import fs43 from "node:fs";
19859
19928
  import path47 from "node:path";
19860
19929
  var GitDirWatcher;
19861
19930
  var init_git_dir_watcher = __esm({
19862
- "../server/dist/ws/git-dir-watcher.js"() {
19931
+ "packages/server/dist/ws/git-dir-watcher.js"() {
19863
19932
  "use strict";
19864
19933
  GitDirWatcher = class {
19865
19934
  watcher = null;
@@ -19978,7 +20047,7 @@ var init_git_dir_watcher = __esm({
19978
20047
  }
19979
20048
  });
19980
20049
 
19981
- // ../server/dist/ws/event-processor.js
20050
+ // packages/server/dist/ws/event-processor.js
19982
20051
  function sendJson(ws, data) {
19983
20052
  if (ws.readyState === ws.OPEN) {
19984
20053
  try {
@@ -20077,13 +20146,13 @@ function bufferDetachedNotification(event, pendingEvents) {
20077
20146
  }
20078
20147
  }
20079
20148
  var init_event_processor = __esm({
20080
- "../server/dist/ws/event-processor.js"() {
20149
+ "packages/server/dist/ws/event-processor.js"() {
20081
20150
  "use strict";
20082
20151
  init_ui_log_builder();
20083
20152
  }
20084
20153
  });
20085
20154
 
20086
- // ../server/dist/ws/terminal-manager.js
20155
+ // packages/server/dist/ws/terminal-manager.js
20087
20156
  import { homedir as homedir22 } from "node:os";
20088
20157
  import { basename } from "node:path";
20089
20158
  import { createRequire } from "node:module";
@@ -20114,7 +20183,7 @@ function attachListenersOnce(t2) {
20114
20183
  }
20115
20184
  var requireFromHere, ptyModule, TERMINAL_GRACE_MS, terminals, TerminalManager;
20116
20185
  var init_terminal_manager = __esm({
20117
- "../server/dist/ws/terminal-manager.js"() {
20186
+ "packages/server/dist/ws/terminal-manager.js"() {
20118
20187
  "use strict";
20119
20188
  init_config();
20120
20189
  init_event_processor();
@@ -20247,7 +20316,7 @@ var init_terminal_manager = __esm({
20247
20316
  }
20248
20317
  });
20249
20318
 
20250
- // ../server/dist/ws/handler.js
20319
+ // packages/server/dist/ws/handler.js
20251
20320
  import path48 from "node:path";
20252
20321
  function setupWebSocketHandler(deps) {
20253
20322
  const { wss: wss2, registry: registry2 } = deps;
@@ -20836,7 +20905,7 @@ ${msg.message}` : markers.join("\n");
20836
20905
  }
20837
20906
  var detachedSessions;
20838
20907
  var init_handler = __esm({
20839
- "../server/dist/ws/handler.js"() {
20908
+ "packages/server/dist/ws/handler.js"() {
20840
20909
  "use strict";
20841
20910
  init_ui_log_builder();
20842
20911
  init_config();
@@ -20851,7 +20920,7 @@ var init_handler = __esm({
20851
20920
  }
20852
20921
  });
20853
20922
 
20854
- // ../server/dist/db/cron-db.js
20923
+ // packages/server/dist/db/cron-db.js
20855
20924
  import Database5 from "better-sqlite3";
20856
20925
  import { drizzle as drizzle4 } from "drizzle-orm/better-sqlite3";
20857
20926
  import { sqliteTable as sqliteTable4, text as text4, integer as integer4 } from "drizzle-orm/sqlite-core";
@@ -20883,7 +20952,7 @@ function getCronDb() {
20883
20952
  }
20884
20953
  var cronJobs, cronRuns, CREATE_SQL3, _cronDb;
20885
20954
  var init_cron_db = __esm({
20886
- "../server/dist/db/cron-db.js"() {
20955
+ "packages/server/dist/db/cron-db.js"() {
20887
20956
  "use strict";
20888
20957
  cronJobs = sqliteTable4("cron_jobs", {
20889
20958
  id: text4("id").primaryKey(),
@@ -20988,7 +21057,7 @@ CREATE INDEX IF NOT EXISTS idx_cron_runs_status ON cron_runs(status);
20988
21057
  }
20989
21058
  });
20990
21059
 
20991
- // ../server/dist/cron/dispatcher.js
21060
+ // packages/server/dist/cron/dispatcher.js
20992
21061
  function registerCronDispatcher(d) {
20993
21062
  _registry.set(d.channelType, d);
20994
21063
  }
@@ -21033,13 +21102,13 @@ async function dispatchToTargets(text5, targets) {
21033
21102
  }
21034
21103
  var _registry;
21035
21104
  var init_dispatcher = __esm({
21036
- "../server/dist/cron/dispatcher.js"() {
21105
+ "packages/server/dist/cron/dispatcher.js"() {
21037
21106
  "use strict";
21038
21107
  _registry = /* @__PURE__ */ new Map();
21039
21108
  }
21040
21109
  });
21041
21110
 
21042
- // ../server/dist/child-env.js
21111
+ // packages/server/dist/child-env.js
21043
21112
  function cleanChildEnv() {
21044
21113
  const env = { ...process.env };
21045
21114
  delete env.HALO_PASSWORD;
@@ -21047,12 +21116,12 @@ function cleanChildEnv() {
21047
21116
  return env;
21048
21117
  }
21049
21118
  var init_child_env = __esm({
21050
- "../server/dist/child-env.js"() {
21119
+ "packages/server/dist/child-env.js"() {
21051
21120
  "use strict";
21052
21121
  }
21053
21122
  });
21054
21123
 
21055
- // ../server/dist/cron/runner.js
21124
+ // packages/server/dist/cron/runner.js
21056
21125
  import { spawn as spawn2, execFileSync } from "node:child_process";
21057
21126
  import fs45 from "node:fs";
21058
21127
  import path50 from "node:path";
@@ -21566,7 +21635,7 @@ function pruneOldLogs() {
21566
21635
  }
21567
21636
  var DAY_MS2, CLI_TIMEOUT_SEC, KILL_GRACE_SEC, RUNS_PER_JOB_KEEP, LOG_RETENTION_DAYS, _active, _inflight, _fingerprint, _lastCronDataVersion;
21568
21637
  var init_runner = __esm({
21569
- "../server/dist/cron/runner.js"() {
21638
+ "packages/server/dist/cron/runner.js"() {
21570
21639
  "use strict";
21571
21640
  init_cron_db();
21572
21641
  init_dispatcher();
@@ -21584,7 +21653,7 @@ var init_runner = __esm({
21584
21653
  }
21585
21654
  });
21586
21655
 
21587
- // ../server/dist/routes/cron.js
21656
+ // packages/server/dist/routes/cron.js
21588
21657
  import { Hono as Hono12 } from "hono";
21589
21658
  import { eq as eq12, desc as desc4, lt as lt5, and as and8 } from "drizzle-orm";
21590
21659
  import fs46 from "node:fs/promises";
@@ -21814,7 +21883,7 @@ function computeNextRun(j) {
21814
21883
  }
21815
21884
  }
21816
21885
  var init_cron = __esm({
21817
- "../server/dist/routes/cron.js"() {
21886
+ "packages/server/dist/routes/cron.js"() {
21818
21887
  "use strict";
21819
21888
  init_cron_db();
21820
21889
  init_runner();
@@ -21823,7 +21892,7 @@ var init_cron = __esm({
21823
21892
  }
21824
21893
  });
21825
21894
 
21826
- // ../server/dist/evolution/ticker.js
21895
+ // packages/server/dist/evolution/ticker.js
21827
21896
  import { eq as eq13, and as and9, or as or2, lt as lt6, asc as asc2, isNull as isNull5, sql as sql2 } from "drizzle-orm";
21828
21897
  function setEvoSpawner(fn) {
21829
21898
  _spawner = fn;
@@ -22044,7 +22113,7 @@ function claimApply(id) {
22044
22113
  }
22045
22114
  var _lastRunStatus, _lastApplyStatus, _spawner, TICK_INTERVAL_MS, _interval;
22046
22115
  var init_ticker = __esm({
22047
- "../server/dist/evolution/ticker.js"() {
22116
+ "packages/server/dist/evolution/ticker.js"() {
22048
22117
  "use strict";
22049
22118
  init_config();
22050
22119
  init_evo_db();
@@ -22059,13 +22128,13 @@ var init_ticker = __esm({
22059
22128
  }
22060
22129
  });
22061
22130
 
22062
- // ../server/dist/evolution/spawn.js
22131
+ // packages/server/dist/evolution/spawn.js
22063
22132
  import path51 from "node:path";
22064
22133
  import { spawn as spawn3 } from "node:child_process";
22065
22134
  import { fileURLToPath as fileURLToPath2 } from "node:url";
22066
22135
  var __dirname2, WRAPPER_PATH, realEvoSpawner;
22067
22136
  var init_spawn = __esm({
22068
- "../server/dist/evolution/spawn.js"() {
22137
+ "packages/server/dist/evolution/spawn.js"() {
22069
22138
  "use strict";
22070
22139
  init_child_env();
22071
22140
  __dirname2 = path51.dirname(fileURLToPath2(import.meta.url));
@@ -22087,7 +22156,7 @@ var init_spawn = __esm({
22087
22156
  }
22088
22157
  });
22089
22158
 
22090
- // ../server/dist/channels/registry.js
22159
+ // packages/server/dist/channels/registry.js
22091
22160
  function bootChannels(app2, descriptors, deps) {
22092
22161
  for (const d of descriptors) {
22093
22162
  if (d.registerCronDispatcher)
@@ -22112,13 +22181,13 @@ async function shutdownChannels() {
22112
22181
  }
22113
22182
  var _running;
22114
22183
  var init_registry2 = __esm({
22115
- "../server/dist/channels/registry.js"() {
22184
+ "packages/server/dist/channels/registry.js"() {
22116
22185
  "use strict";
22117
22186
  _running = [];
22118
22187
  }
22119
22188
  });
22120
22189
 
22121
- // ../server/dist/channels/telegram/accounts.js
22190
+ // packages/server/dist/channels/telegram/accounts.js
22122
22191
  function toTelegram(a) {
22123
22192
  const c = a.config;
22124
22193
  return {
@@ -22192,17 +22261,17 @@ function deleteAccount3(db, accountId) {
22192
22261
  }
22193
22262
  var CH2;
22194
22263
  var init_accounts3 = __esm({
22195
- "../server/dist/channels/telegram/accounts.js"() {
22264
+ "packages/server/dist/channels/telegram/accounts.js"() {
22196
22265
  "use strict";
22197
22266
  init_accounts();
22198
22267
  CH2 = "telegram";
22199
22268
  }
22200
22269
  });
22201
22270
 
22202
- // ../server/dist/channels/telegram/event-adapter.js
22271
+ // packages/server/dist/channels/telegram/event-adapter.js
22203
22272
  var HARD_CHARS, MEDIA_MARKER_RE, TelegramResponder;
22204
22273
  var init_event_adapter = __esm({
22205
- "../server/dist/channels/telegram/event-adapter.js"() {
22274
+ "packages/server/dist/channels/telegram/event-adapter.js"() {
22206
22275
  "use strict";
22207
22276
  HARD_CHARS = 4e3;
22208
22277
  MEDIA_MARKER_RE = /^MEDIA:\s*(\S.*?)\s*$/gm;
@@ -22303,17 +22372,17 @@ var init_event_adapter = __esm({
22303
22372
  }
22304
22373
  });
22305
22374
 
22306
- // ../server/dist/channels/shared/session-prefix.js
22375
+ // packages/server/dist/channels/shared/session-prefix.js
22307
22376
  function sessionPrefix(channel, userId) {
22308
22377
  return `${channel}_${userId}_`;
22309
22378
  }
22310
22379
  var init_session_prefix = __esm({
22311
- "../server/dist/channels/shared/session-prefix.js"() {
22380
+ "packages/server/dist/channels/shared/session-prefix.js"() {
22312
22381
  "use strict";
22313
22382
  }
22314
22383
  });
22315
22384
 
22316
- // ../server/dist/channels/telegram/handler.js
22385
+ // packages/server/dist/channels/telegram/handler.js
22317
22386
  import { Bot, InputFile } from "grammy";
22318
22387
  import path52 from "node:path";
22319
22388
  function inferMediaKind(filePath) {
@@ -22656,7 +22725,7 @@ async function getOrCreateActiveSession(sm, userId, activeOverrides2, accessLeve
22656
22725
  return newId;
22657
22726
  }
22658
22727
  var init_handler2 = __esm({
22659
- "../server/dist/channels/telegram/handler.js"() {
22728
+ "packages/server/dist/channels/telegram/handler.js"() {
22660
22729
  "use strict";
22661
22730
  init_accounts3();
22662
22731
  init_event_adapter();
@@ -22671,7 +22740,7 @@ var init_handler2 = __esm({
22671
22740
  }
22672
22741
  });
22673
22742
 
22674
- // ../server/dist/routes/telegram.js
22743
+ // packages/server/dist/routes/telegram.js
22675
22744
  import { Hono as Hono13 } from "hono";
22676
22745
  import path53 from "node:path";
22677
22746
  import { Bot as Bot2 } from "grammy";
@@ -22787,14 +22856,14 @@ function createTelegramRoutes(deps) {
22787
22856
  return app2;
22788
22857
  }
22789
22858
  var init_telegram = __esm({
22790
- "../server/dist/routes/telegram.js"() {
22859
+ "packages/server/dist/routes/telegram.js"() {
22791
22860
  "use strict";
22792
22861
  init_accounts3();
22793
22862
  init_init();
22794
22863
  }
22795
22864
  });
22796
22865
 
22797
- // ../server/dist/channels/telegram/cron-dispatcher.js
22866
+ // packages/server/dist/channels/telegram/cron-dispatcher.js
22798
22867
  import { Bot as Bot3 } from "grammy";
22799
22868
  async function dispatch(accountId, text5, explicitChatId) {
22800
22869
  const acct = getAccount3(getChannelDb(), accountId);
@@ -22843,7 +22912,7 @@ function registerTelegramCronDispatcher() {
22843
22912
  registerCronDispatcher({ channelType: "telegram", dispatch, listTargets });
22844
22913
  }
22845
22914
  var init_cron_dispatcher = __esm({
22846
- "../server/dist/channels/telegram/cron-dispatcher.js"() {
22915
+ "packages/server/dist/channels/telegram/cron-dispatcher.js"() {
22847
22916
  "use strict";
22848
22917
  init_channel_db();
22849
22918
  init_accounts3();
@@ -22851,10 +22920,10 @@ var init_cron_dispatcher = __esm({
22851
22920
  }
22852
22921
  });
22853
22922
 
22854
- // ../server/dist/channels/telegram/descriptor.js
22923
+ // packages/server/dist/channels/telegram/descriptor.js
22855
22924
  var telegramDescriptor;
22856
22925
  var init_descriptor = __esm({
22857
- "../server/dist/channels/telegram/descriptor.js"() {
22926
+ "packages/server/dist/channels/telegram/descriptor.js"() {
22858
22927
  "use strict";
22859
22928
  init_handler2();
22860
22929
  init_telegram();
@@ -22869,7 +22938,7 @@ var init_descriptor = __esm({
22869
22938
  }
22870
22939
  });
22871
22940
 
22872
- // ../server/dist/channels/wechat/api.js
22941
+ // packages/server/dist/channels/wechat/api.js
22873
22942
  import crypto3 from "node:crypto";
22874
22943
  function buildClientVersion(version) {
22875
22944
  const [ma, mi, pa] = version.split(".").map((p) => parseInt(p, 10));
@@ -23058,7 +23127,7 @@ async function notifyStop(params) {
23058
23127
  }
23059
23128
  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;
23060
23129
  var init_api = __esm({
23061
- "../server/dist/channels/wechat/api.js"() {
23130
+ "packages/server/dist/channels/wechat/api.js"() {
23062
23131
  "use strict";
23063
23132
  QR_BASE_URL = "https://ilinkai.weixin.qq.com";
23064
23133
  DEFAULT_BOT_TYPE = "3";
@@ -23070,10 +23139,10 @@ var init_api = __esm({
23070
23139
  }
23071
23140
  });
23072
23141
 
23073
- // ../server/dist/channels/wechat/types.js
23142
+ // packages/server/dist/channels/wechat/types.js
23074
23143
  var MessageItemType, MessageType, MessageState, UploadMediaType;
23075
23144
  var init_types = __esm({
23076
- "../server/dist/channels/wechat/types.js"() {
23145
+ "packages/server/dist/channels/wechat/types.js"() {
23077
23146
  "use strict";
23078
23147
  MessageItemType = {
23079
23148
  NONE: 0,
@@ -23102,7 +23171,7 @@ var init_types = __esm({
23102
23171
  }
23103
23172
  });
23104
23173
 
23105
- // ../server/dist/channels/wechat/accounts.js
23174
+ // packages/server/dist/channels/wechat/accounts.js
23106
23175
  function toWeixin(a) {
23107
23176
  const c = a.config;
23108
23177
  return {
@@ -23184,17 +23253,17 @@ function saveSyncBuf(db, accountId, syncBuf) {
23184
23253
  }
23185
23254
  var CH3;
23186
23255
  var init_accounts4 = __esm({
23187
- "../server/dist/channels/wechat/accounts.js"() {
23256
+ "packages/server/dist/channels/wechat/accounts.js"() {
23188
23257
  "use strict";
23189
23258
  init_accounts();
23190
23259
  CH3 = "wechat";
23191
23260
  }
23192
23261
  });
23193
23262
 
23194
- // ../server/dist/channels/wechat/event-adapter.js
23263
+ // packages/server/dist/channels/wechat/event-adapter.js
23195
23264
  var HARD_CHARS2, MEDIA_MARKER_RE2, WeixinResponder;
23196
23265
  var init_event_adapter2 = __esm({
23197
- "../server/dist/channels/wechat/event-adapter.js"() {
23266
+ "packages/server/dist/channels/wechat/event-adapter.js"() {
23198
23267
  "use strict";
23199
23268
  HARD_CHARS2 = 3500;
23200
23269
  MEDIA_MARKER_RE2 = /^MEDIA:\s*(\S.*?)\s*$/gm;
@@ -23303,7 +23372,7 @@ var init_event_adapter2 = __esm({
23303
23372
  }
23304
23373
  });
23305
23374
 
23306
- // ../server/dist/channels/wechat/cdn.js
23375
+ // packages/server/dist/channels/wechat/cdn.js
23307
23376
  import { createDecipheriv, createCipheriv, randomBytes as randomBytes2, createHash as createHash2 } from "node:crypto";
23308
23377
  function decryptAesEcb(ciphertext, key) {
23309
23378
  const decipher = createDecipheriv("aes-128-ecb", key, null);
@@ -23402,14 +23471,14 @@ async function uploadCiphertext(params) {
23402
23471
  }
23403
23472
  var CDN_BASE_URL, UPLOAD_MAX_RETRIES;
23404
23473
  var init_cdn = __esm({
23405
- "../server/dist/channels/wechat/cdn.js"() {
23474
+ "packages/server/dist/channels/wechat/cdn.js"() {
23406
23475
  "use strict";
23407
23476
  CDN_BASE_URL = "https://novac2c.cdn.weixin.qq.com/c2c";
23408
23477
  UPLOAD_MAX_RETRIES = 3;
23409
23478
  }
23410
23479
  });
23411
23480
 
23412
- // ../server/dist/channels/wechat/send-media.js
23481
+ // packages/server/dist/channels/wechat/send-media.js
23413
23482
  import fs48 from "node:fs/promises";
23414
23483
  import path54 from "node:path";
23415
23484
  function inferKind(filePath) {
@@ -23503,7 +23572,7 @@ function buildMessageItem(args) {
23503
23572
  };
23504
23573
  }
23505
23574
  var init_send_media = __esm({
23506
- "../server/dist/channels/wechat/send-media.js"() {
23575
+ "packages/server/dist/channels/wechat/send-media.js"() {
23507
23576
  "use strict";
23508
23577
  init_api();
23509
23578
  init_cdn();
@@ -23512,7 +23581,7 @@ var init_send_media = __esm({
23512
23581
  }
23513
23582
  });
23514
23583
 
23515
- // ../server/dist/channels/wechat/login.js
23584
+ // packages/server/dist/channels/wechat/login.js
23516
23585
  import { randomUUID as randomUUID2 } from "node:crypto";
23517
23586
  function isFresh(l) {
23518
23587
  return Date.now() - l.startedAt < ACTIVE_TTL_MS;
@@ -23614,7 +23683,7 @@ async function waitLogin(params) {
23614
23683
  }
23615
23684
  var ACTIVE_TTL_MS, MAX_QR_REFRESH, activeLogins;
23616
23685
  var init_login = __esm({
23617
- "../server/dist/channels/wechat/login.js"() {
23686
+ "packages/server/dist/channels/wechat/login.js"() {
23618
23687
  "use strict";
23619
23688
  init_api();
23620
23689
  ACTIVE_TTL_MS = 5 * 6e4;
@@ -23623,7 +23692,7 @@ var init_login = __esm({
23623
23692
  }
23624
23693
  });
23625
23694
 
23626
- // ../server/dist/channels/wechat/handler.js
23695
+ // packages/server/dist/channels/wechat/handler.js
23627
23696
  import fs49 from "node:fs";
23628
23697
  import path55 from "node:path";
23629
23698
  import QRCode from "qrcode";
@@ -24131,7 +24200,7 @@ function sleep2(ms, signal) {
24131
24200
  }
24132
24201
  var MAX_CONSECUTIVE_FAILURES, BACKOFF_DELAY_MS, RETRY_DELAY_MS;
24133
24202
  var init_handler3 = __esm({
24134
- "../server/dist/channels/wechat/handler.js"() {
24203
+ "packages/server/dist/channels/wechat/handler.js"() {
24135
24204
  "use strict";
24136
24205
  init_api();
24137
24206
  init_types();
@@ -24153,7 +24222,7 @@ var init_handler3 = __esm({
24153
24222
  }
24154
24223
  });
24155
24224
 
24156
- // ../server/dist/routes/weixin.js
24225
+ // packages/server/dist/routes/weixin.js
24157
24226
  import { Hono as Hono14 } from "hono";
24158
24227
  import path56 from "node:path";
24159
24228
  import fs50 from "node:fs";
@@ -24268,7 +24337,7 @@ function stripSecrets(acc) {
24268
24337
  return rest;
24269
24338
  }
24270
24339
  var init_weixin = __esm({
24271
- "../server/dist/routes/weixin.js"() {
24340
+ "packages/server/dist/routes/weixin.js"() {
24272
24341
  "use strict";
24273
24342
  init_login();
24274
24343
  init_accounts4();
@@ -24276,7 +24345,7 @@ var init_weixin = __esm({
24276
24345
  }
24277
24346
  });
24278
24347
 
24279
- // ../server/dist/channels/wechat/cron-dispatcher.js
24348
+ // packages/server/dist/channels/wechat/cron-dispatcher.js
24280
24349
  function readLastActiveChatId(accountId) {
24281
24350
  const acct = getAccount(getChannelDb(), accountId);
24282
24351
  if (!acct)
@@ -24319,7 +24388,7 @@ function registerWechatCronDispatcher() {
24319
24388
  registerCronDispatcher({ channelType: "wechat", dispatch: dispatch2, listTargets: listTargets2 });
24320
24389
  }
24321
24390
  var init_cron_dispatcher2 = __esm({
24322
- "../server/dist/channels/wechat/cron-dispatcher.js"() {
24391
+ "packages/server/dist/channels/wechat/cron-dispatcher.js"() {
24323
24392
  "use strict";
24324
24393
  init_channel_db();
24325
24394
  init_accounts();
@@ -24329,10 +24398,10 @@ var init_cron_dispatcher2 = __esm({
24329
24398
  }
24330
24399
  });
24331
24400
 
24332
- // ../server/dist/channels/wechat/descriptor.js
24401
+ // packages/server/dist/channels/wechat/descriptor.js
24333
24402
  var wechatDescriptor;
24334
24403
  var init_descriptor2 = __esm({
24335
- "../server/dist/channels/wechat/descriptor.js"() {
24404
+ "packages/server/dist/channels/wechat/descriptor.js"() {
24336
24405
  "use strict";
24337
24406
  init_handler3();
24338
24407
  init_weixin();
@@ -24347,7 +24416,7 @@ var init_descriptor2 = __esm({
24347
24416
  }
24348
24417
  });
24349
24418
 
24350
- // ../server/dist/channels/web/handler.js
24419
+ // packages/server/dist/channels/web/handler.js
24351
24420
  function buildWebSessionPrefix(accountId) {
24352
24421
  return sessionPrefix("web", accountId);
24353
24422
  }
@@ -24496,7 +24565,7 @@ function createWebChannel(deps) {
24496
24565
  resolve2 = null;
24497
24566
  }
24498
24567
  });
24499
- const imageTypes = ["image/jpeg", "image/png", "image/gif", "image/webp"];
24568
+ const imageTypes = VISION_IMAGE_MIME_TYPES;
24500
24569
  const realImages = [];
24501
24570
  const savedPaths = [];
24502
24571
  if (images && images.length > 0) {
@@ -24735,7 +24804,7 @@ function createMediaBuffer() {
24735
24804
  }
24736
24805
  var MEDIA_MARKER_RE3;
24737
24806
  var init_handler4 = __esm({
24738
- "../server/dist/channels/web/handler.js"() {
24807
+ "packages/server/dist/channels/web/handler.js"() {
24739
24808
  "use strict";
24740
24809
  init_ui_log_builder();
24741
24810
  init_accounts2();
@@ -24750,7 +24819,7 @@ var init_handler4 = __esm({
24750
24819
  }
24751
24820
  });
24752
24821
 
24753
- // ../server/dist/routes/web.js
24822
+ // packages/server/dist/routes/web.js
24754
24823
  import { Hono as Hono15 } from "hono";
24755
24824
  import { streamSSE } from "hono/streaming";
24756
24825
  import crypto4 from "node:crypto";
@@ -24962,7 +25031,7 @@ function createWebRoutes(deps) {
24962
25031
  }
24963
25032
  var TOKEN_BUCKET3;
24964
25033
  var init_web = __esm({
24965
- "../server/dist/routes/web.js"() {
25034
+ "packages/server/dist/routes/web.js"() {
24966
25035
  "use strict";
24967
25036
  init_accounts2();
24968
25037
  init_init();
@@ -24971,10 +25040,10 @@ var init_web = __esm({
24971
25040
  }
24972
25041
  });
24973
25042
 
24974
- // ../server/dist/channels/web/descriptor.js
25043
+ // packages/server/dist/channels/web/descriptor.js
24975
25044
  var webDescriptor;
24976
25045
  var init_descriptor3 = __esm({
24977
- "../server/dist/channels/web/descriptor.js"() {
25046
+ "packages/server/dist/channels/web/descriptor.js"() {
24978
25047
  "use strict";
24979
25048
  init_handler4();
24980
25049
  init_web();
@@ -24990,7 +25059,7 @@ var init_descriptor3 = __esm({
24990
25059
  }
24991
25060
  });
24992
25061
 
24993
- // ../server/dist/channels/slack/accounts.js
25062
+ // packages/server/dist/channels/slack/accounts.js
24994
25063
  function toSlack(a) {
24995
25064
  const c = a.config;
24996
25065
  return {
@@ -25066,14 +25135,14 @@ function deleteAccount5(db, accountId) {
25066
25135
  }
25067
25136
  var CH4;
25068
25137
  var init_accounts5 = __esm({
25069
- "../server/dist/channels/slack/accounts.js"() {
25138
+ "packages/server/dist/channels/slack/accounts.js"() {
25070
25139
  "use strict";
25071
25140
  init_accounts();
25072
25141
  CH4 = "slack";
25073
25142
  }
25074
25143
  });
25075
25144
 
25076
- // ../server/dist/channels/shared/markdown.js
25145
+ // packages/server/dist/channels/shared/markdown.js
25077
25146
  function formatForSlack(input) {
25078
25147
  if (!input)
25079
25148
  return "";
@@ -25152,15 +25221,15 @@ function stripCommonMark(line) {
25152
25221
  return line;
25153
25222
  }
25154
25223
  var init_markdown = __esm({
25155
- "../server/dist/channels/shared/markdown.js"() {
25224
+ "packages/server/dist/channels/shared/markdown.js"() {
25156
25225
  "use strict";
25157
25226
  }
25158
25227
  });
25159
25228
 
25160
- // ../server/dist/channels/slack/event-adapter.js
25229
+ // packages/server/dist/channels/slack/event-adapter.js
25161
25230
  var HARD_CHARS3, MEDIA_MARKER_RE4, SlackResponder;
25162
25231
  var init_event_adapter3 = __esm({
25163
- "../server/dist/channels/slack/event-adapter.js"() {
25232
+ "packages/server/dist/channels/slack/event-adapter.js"() {
25164
25233
  "use strict";
25165
25234
  init_markdown();
25166
25235
  HARD_CHARS3 = 35e3;
@@ -25254,7 +25323,7 @@ var init_event_adapter3 = __esm({
25254
25323
  }
25255
25324
  });
25256
25325
 
25257
- // ../server/dist/channels/slack/api.js
25326
+ // packages/server/dist/channels/slack/api.js
25258
25327
  async function slackPost(endpoint, token, body) {
25259
25328
  const isForm = body instanceof FormData;
25260
25329
  const res = await fetch(`${SLACK_API}/${endpoint}`, {
@@ -25442,13 +25511,13 @@ async function downloadFile(botToken, urlPrivate) {
25442
25511
  }
25443
25512
  var SLACK_API;
25444
25513
  var init_api2 = __esm({
25445
- "../server/dist/channels/slack/api.js"() {
25514
+ "packages/server/dist/channels/slack/api.js"() {
25446
25515
  "use strict";
25447
25516
  SLACK_API = "https://slack.com/api";
25448
25517
  }
25449
25518
  });
25450
25519
 
25451
- // ../server/dist/channels/slack/handler.js
25520
+ // packages/server/dist/channels/slack/handler.js
25452
25521
  import path58 from "node:path";
25453
25522
  import { WebSocket } from "ws";
25454
25523
  function slashToBang(text5, commandNames) {
@@ -25807,7 +25876,7 @@ async function getOrCreateSessionForThread(args) {
25807
25876
  }
25808
25877
  var SLACK_EXTRA_COMMANDS, SEEN_EVENT_IDS, SEEN_EVENT_IDS_MAX;
25809
25878
  var init_handler5 = __esm({
25810
- "../server/dist/channels/slack/handler.js"() {
25879
+ "packages/server/dist/channels/slack/handler.js"() {
25811
25880
  "use strict";
25812
25881
  init_accounts5();
25813
25882
  init_event_adapter3();
@@ -25827,7 +25896,7 @@ var init_handler5 = __esm({
25827
25896
  }
25828
25897
  });
25829
25898
 
25830
- // ../server/dist/routes/slack.js
25899
+ // packages/server/dist/routes/slack.js
25831
25900
  import { Hono as Hono16 } from "hono";
25832
25901
  import fs52 from "node:fs";
25833
25902
  import path59 from "node:path";
@@ -25958,7 +26027,7 @@ function createSlackRoutes(deps) {
25958
26027
  return app2;
25959
26028
  }
25960
26029
  var init_slack = __esm({
25961
- "../server/dist/routes/slack.js"() {
26030
+ "packages/server/dist/routes/slack.js"() {
25962
26031
  "use strict";
25963
26032
  init_accounts5();
25964
26033
  init_api2();
@@ -25966,7 +26035,7 @@ var init_slack = __esm({
25966
26035
  }
25967
26036
  });
25968
26037
 
25969
- // ../server/dist/channels/slack/cron-dispatcher.js
26038
+ // packages/server/dist/channels/slack/cron-dispatcher.js
25970
26039
  function parseChatId(raw) {
25971
26040
  const idx = raw.indexOf(":");
25972
26041
  if (idx < 0)
@@ -26011,7 +26080,7 @@ function registerSlackCronDispatcher() {
26011
26080
  registerCronDispatcher({ channelType: "slack", dispatch: dispatch3, listTargets: listTargets3 });
26012
26081
  }
26013
26082
  var init_cron_dispatcher3 = __esm({
26014
- "../server/dist/channels/slack/cron-dispatcher.js"() {
26083
+ "packages/server/dist/channels/slack/cron-dispatcher.js"() {
26015
26084
  "use strict";
26016
26085
  init_channel_db();
26017
26086
  init_accounts5();
@@ -26020,10 +26089,10 @@ var init_cron_dispatcher3 = __esm({
26020
26089
  }
26021
26090
  });
26022
26091
 
26023
- // ../server/dist/channels/slack/descriptor.js
26092
+ // packages/server/dist/channels/slack/descriptor.js
26024
26093
  var slackDescriptor;
26025
26094
  var init_descriptor4 = __esm({
26026
- "../server/dist/channels/slack/descriptor.js"() {
26095
+ "packages/server/dist/channels/slack/descriptor.js"() {
26027
26096
  "use strict";
26028
26097
  init_handler5();
26029
26098
  init_slack();
@@ -26038,7 +26107,7 @@ var init_descriptor4 = __esm({
26038
26107
  }
26039
26108
  });
26040
26109
 
26041
- // ../server/dist/channels/feishu/accounts.js
26110
+ // packages/server/dist/channels/feishu/accounts.js
26042
26111
  function toFeishu(a) {
26043
26112
  const c = a.config;
26044
26113
  return {
@@ -26116,17 +26185,17 @@ function deleteAccount6(db, accountId) {
26116
26185
  }
26117
26186
  var CH5;
26118
26187
  var init_accounts6 = __esm({
26119
- "../server/dist/channels/feishu/accounts.js"() {
26188
+ "packages/server/dist/channels/feishu/accounts.js"() {
26120
26189
  "use strict";
26121
26190
  init_accounts();
26122
26191
  CH5 = "feishu";
26123
26192
  }
26124
26193
  });
26125
26194
 
26126
- // ../server/dist/channels/feishu/event-adapter.js
26195
+ // packages/server/dist/channels/feishu/event-adapter.js
26127
26196
  var HARD_CHARS4, MEDIA_MARKER_RE5, FeishuResponder;
26128
26197
  var init_event_adapter4 = __esm({
26129
- "../server/dist/channels/feishu/event-adapter.js"() {
26198
+ "packages/server/dist/channels/feishu/event-adapter.js"() {
26130
26199
  "use strict";
26131
26200
  init_markdown();
26132
26201
  HARD_CHARS4 = 4500;
@@ -26220,7 +26289,7 @@ var init_event_adapter4 = __esm({
26220
26289
  }
26221
26290
  });
26222
26291
 
26223
- // ../server/dist/channels/feishu/api.js
26292
+ // packages/server/dist/channels/feishu/api.js
26224
26293
  async function getTenantAccessToken(args) {
26225
26294
  const cached = tokenCache.get(args.appId);
26226
26295
  if (cached && cached.expiresAt - Date.now() > 6e4)
@@ -26484,14 +26553,14 @@ async function searchFeishuTargets(args) {
26484
26553
  }
26485
26554
  var FEISHU_BASE, tokenCache;
26486
26555
  var init_api3 = __esm({
26487
- "../server/dist/channels/feishu/api.js"() {
26556
+ "packages/server/dist/channels/feishu/api.js"() {
26488
26557
  "use strict";
26489
26558
  FEISHU_BASE = "https://open.feishu.cn";
26490
26559
  tokenCache = /* @__PURE__ */ new Map();
26491
26560
  }
26492
26561
  });
26493
26562
 
26494
- // ../server/dist/channels/feishu/handler.js
26563
+ // packages/server/dist/channels/feishu/handler.js
26495
26564
  import path60 from "node:path";
26496
26565
  import * as Lark from "@larksuiteoapi/node-sdk";
26497
26566
  function isPathAllowed3(filePath, workspacePath) {
@@ -26911,7 +26980,7 @@ async function getOrCreateSessionForThread2(args) {
26911
26980
  return newId;
26912
26981
  }
26913
26982
  var init_handler6 = __esm({
26914
- "../server/dist/channels/feishu/handler.js"() {
26983
+ "packages/server/dist/channels/feishu/handler.js"() {
26915
26984
  "use strict";
26916
26985
  init_accounts6();
26917
26986
  init_event_adapter4();
@@ -26927,7 +26996,7 @@ var init_handler6 = __esm({
26927
26996
  }
26928
26997
  });
26929
26998
 
26930
- // ../server/dist/routes/feishu.js
26999
+ // packages/server/dist/routes/feishu.js
26931
27000
  import { Hono as Hono17 } from "hono";
26932
27001
  import fs53 from "node:fs";
26933
27002
  import path61 from "node:path";
@@ -27061,7 +27130,7 @@ function createFeishuRoutes(deps) {
27061
27130
  return app2;
27062
27131
  }
27063
27132
  var init_feishu = __esm({
27064
- "../server/dist/routes/feishu.js"() {
27133
+ "packages/server/dist/routes/feishu.js"() {
27065
27134
  "use strict";
27066
27135
  init_accounts6();
27067
27136
  init_api3();
@@ -27069,7 +27138,7 @@ var init_feishu = __esm({
27069
27138
  }
27070
27139
  });
27071
27140
 
27072
- // ../server/dist/channels/feishu/cron-dispatcher.js
27141
+ // packages/server/dist/channels/feishu/cron-dispatcher.js
27073
27142
  function parseChatId2(raw) {
27074
27143
  const idx = raw.indexOf(":");
27075
27144
  return { chatId: idx < 0 ? raw : raw.slice(0, idx) };
@@ -27119,7 +27188,7 @@ function registerFeishuCronDispatcher() {
27119
27188
  registerCronDispatcher({ channelType: "feishu", dispatch: dispatch4, listTargets: listTargets4 });
27120
27189
  }
27121
27190
  var init_cron_dispatcher4 = __esm({
27122
- "../server/dist/channels/feishu/cron-dispatcher.js"() {
27191
+ "packages/server/dist/channels/feishu/cron-dispatcher.js"() {
27123
27192
  "use strict";
27124
27193
  init_channel_db();
27125
27194
  init_accounts6();
@@ -27128,10 +27197,10 @@ var init_cron_dispatcher4 = __esm({
27128
27197
  }
27129
27198
  });
27130
27199
 
27131
- // ../server/dist/channels/feishu/descriptor.js
27200
+ // packages/server/dist/channels/feishu/descriptor.js
27132
27201
  var feishuDescriptor;
27133
27202
  var init_descriptor5 = __esm({
27134
- "../server/dist/channels/feishu/descriptor.js"() {
27203
+ "packages/server/dist/channels/feishu/descriptor.js"() {
27135
27204
  "use strict";
27136
27205
  init_handler6();
27137
27206
  init_feishu();
@@ -27146,10 +27215,10 @@ var init_descriptor5 = __esm({
27146
27215
  }
27147
27216
  });
27148
27217
 
27149
- // ../server/dist/channels/descriptors.js
27218
+ // packages/server/dist/channels/descriptors.js
27150
27219
  var defaultChannelDescriptors;
27151
27220
  var init_descriptors = __esm({
27152
- "../server/dist/channels/descriptors.js"() {
27221
+ "packages/server/dist/channels/descriptors.js"() {
27153
27222
  "use strict";
27154
27223
  init_descriptor();
27155
27224
  init_descriptor2();
@@ -27166,7 +27235,7 @@ var init_descriptors = __esm({
27166
27235
  }
27167
27236
  });
27168
27237
 
27169
- // ../server/dist/middleware/auth.js
27238
+ // packages/server/dist/middleware/auth.js
27170
27239
  import { Hono as Hono18 } from "hono";
27171
27240
  import { getCookie, setCookie } from "hono/cookie";
27172
27241
  import crypto5 from "node:crypto";
@@ -27331,7 +27400,7 @@ function authMiddleware() {
27331
27400
  }
27332
27401
  var TOKEN_MAX_AGE, REFRESH_AFTER, COOKIE_NAME, ADMIN_LOGIN_BUCKET, isLockedOut2, recordFailure2, clearFailures2, PUBLIC_PATHS;
27333
27402
  var init_auth = __esm({
27334
- "../server/dist/middleware/auth.js"() {
27403
+ "packages/server/dist/middleware/auth.js"() {
27335
27404
  "use strict";
27336
27405
  init_config();
27337
27406
  init_password_hash();
@@ -27347,7 +27416,7 @@ var init_auth = __esm({
27347
27416
  }
27348
27417
  });
27349
27418
 
27350
- // ../server/dist/index.js
27419
+ // packages/server/dist/index.js
27351
27420
  var dist_exports = {};
27352
27421
  import { Hono as Hono19 } from "hono";
27353
27422
  import { cors } from "hono/cors";
@@ -27473,7 +27542,7 @@ async function gracefulShutdown(signal) {
27473
27542
  }
27474
27543
  var __dirname3, PORT, HALO_VERSION, PROJECT_ROOT, HALO_HOME4, GIT_SHA, AGENTCORE, app, allowlist, authRoutes, fileRoutes, gitRoutes, agentConfigRoutes, skillRoutes, settingsRoutes, evolutionRoutes, cronRoutes, channelDb, registry, sessionRoutes, showRoutes, metricsRoutes, commandRoutes, FRONTEND_DIR, server, wss;
27475
27544
  var init_dist2 = __esm({
27476
- async "../server/dist/index.js"() {
27545
+ async "packages/server/dist/index.js"() {
27477
27546
  "use strict";
27478
27547
  init_files();
27479
27548
  init_git();
@@ -27509,7 +27578,7 @@ var init_dist2 = __esm({
27509
27578
  init_git_ssh();
27510
27579
  __dirname3 = path62.dirname(fileURLToPath3(import.meta.url));
27511
27580
  PORT = config.server.port;
27512
- HALO_VERSION = "0.2.6";
27581
+ HALO_VERSION = "1.0.1";
27513
27582
  PROJECT_ROOT = findProjectRoot();
27514
27583
  HALO_HOME4 = path62.join(homedir24(), ".halo");
27515
27584
  GIT_SHA = readGitSha();
@@ -27680,7 +27749,7 @@ var init_dist2 = __esm({
27680
27749
  }
27681
27750
  });
27682
27751
 
27683
- // ../acp-adapter/dist/halo-client.js
27752
+ // packages/acp-adapter/dist/halo-client.js
27684
27753
  async function safeText(res) {
27685
27754
  try {
27686
27755
  return (await res.text()).slice(0, 500);
@@ -27723,7 +27792,7 @@ async function* parseSseStream(body) {
27723
27792
  }
27724
27793
  var HaloClient;
27725
27794
  var init_halo_client = __esm({
27726
- "../acp-adapter/dist/halo-client.js"() {
27795
+ "packages/acp-adapter/dist/halo-client.js"() {
27727
27796
  "use strict";
27728
27797
  HaloClient = class {
27729
27798
  opts;
@@ -27802,7 +27871,7 @@ var init_halo_client = __esm({
27802
27871
  }
27803
27872
  });
27804
27873
 
27805
- // ../acp-adapter/dist/adapter.js
27874
+ // packages/acp-adapter/dist/adapter.js
27806
27875
  function newError(message, code = -32603) {
27807
27876
  const e = new Error(message);
27808
27877
  e.code = code;
@@ -27810,7 +27879,7 @@ function newError(message, code = -32603) {
27810
27879
  }
27811
27880
  var AcpAdapter;
27812
27881
  var init_adapter = __esm({
27813
- "../acp-adapter/dist/adapter.js"() {
27882
+ "packages/acp-adapter/dist/adapter.js"() {
27814
27883
  "use strict";
27815
27884
  init_halo_client();
27816
27885
  AcpAdapter = class {
@@ -28099,10 +28168,10 @@ var init_adapter = __esm({
28099
28168
  }
28100
28169
  });
28101
28170
 
28102
- // ../acp-adapter/dist/jsonrpc.js
28171
+ // packages/acp-adapter/dist/jsonrpc.js
28103
28172
  var ERROR_PARSE, ERROR_METHOD_NOT_FOUND, ERROR_INTERNAL, JsonRpcConnection;
28104
28173
  var init_jsonrpc = __esm({
28105
- "../acp-adapter/dist/jsonrpc.js"() {
28174
+ "packages/acp-adapter/dist/jsonrpc.js"() {
28106
28175
  "use strict";
28107
28176
  ERROR_PARSE = -32700;
28108
28177
  ERROR_METHOD_NOT_FOUND = -32601;
@@ -28235,7 +28304,7 @@ var init_jsonrpc = __esm({
28235
28304
  }
28236
28305
  });
28237
28306
 
28238
- // ../acp-adapter/dist/index.js
28307
+ // packages/acp-adapter/dist/index.js
28239
28308
  var dist_exports2 = {};
28240
28309
  __export(dist_exports2, {
28241
28310
  main: () => main
@@ -28351,7 +28420,7 @@ function main(argv = process.argv.slice(2)) {
28351
28420
  }
28352
28421
  var HELP;
28353
28422
  var init_dist3 = __esm({
28354
- "../acp-adapter/dist/index.js"() {
28423
+ "packages/acp-adapter/dist/index.js"() {
28355
28424
  "use strict";
28356
28425
  init_adapter();
28357
28426
  init_jsonrpc();
@@ -28390,7 +28459,7 @@ Stdio:
28390
28459
  }
28391
28460
  });
28392
28461
 
28393
- // src/silence-warnings.ts
28462
+ // packages/cli/src/silence-warnings.ts
28394
28463
  var emit = process.emitWarning.bind(process);
28395
28464
  process.emitWarning = (warning, ...args) => {
28396
28465
  const opt = args[0];
@@ -28399,12 +28468,12 @@ process.emitWarning = (warning, ...args) => {
28399
28468
  return emit(warning, ...args);
28400
28469
  };
28401
28470
 
28402
- // src/index.ts
28471
+ // packages/cli/src/index.ts
28403
28472
  import path63 from "node:path";
28404
28473
  import fs55 from "node:fs";
28405
28474
  import { homedir as homedir25 } from "node:os";
28406
28475
  import { parseArgs as parseArgs2 } from "node:util";
28407
- var VERSION = "0.2.6";
28476
+ var VERSION = "1.0.1";
28408
28477
  var HELP_TOP = `Usage: halo <command> [options]
28409
28478
 
28410
28479
  Commands: