@xopcai/xopc 0.0.42 → 0.0.43

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 (155) hide show
  1. package/dist/extensions/dingtalk/src/plugin.js +1 -1
  2. package/dist/extensions/feishu/src/outbound/media-load.js +1 -1
  3. package/dist/extensions/telegram/src/plugin.js +1 -1
  4. package/dist/extensions/telegram/src/routing-integration.js +2 -2
  5. package/dist/extensions/telegram/xopc.extension.json +1 -1
  6. package/dist/extensions/weixin/src/api/api.js +2 -2
  7. package/dist/extensions/weixin/src/auth/accounts.js +1 -1
  8. package/dist/extensions/weixin/src/cdn/upload.js +1 -1
  9. package/dist/extensions/weixin/src/media/data-url.js +1 -1
  10. package/dist/extensions/weixin/src/messaging/debug-mode.js +1 -1
  11. package/dist/extensions/weixin/src/messaging/inbound.js +1 -1
  12. package/dist/extensions/weixin/src/messaging/process-message.js +1 -1
  13. package/dist/extensions/weixin/src/plugin.js +1 -1
  14. package/dist/extensions/weixin/src/storage/sync-buf.js +1 -1
  15. package/dist/gateway/static/root/assets/{agents-DMW4-fH-.js → agents-BDhkkT2o.js} +2 -2
  16. package/dist/gateway/static/root/assets/{agents-DMW4-fH-.js.map → agents-BDhkkT2o.js.map} +1 -1
  17. package/dist/gateway/static/root/assets/{apps-page-DOHsxEjt.js → apps-page-Bco3oZzd.js} +2 -2
  18. package/dist/gateway/static/root/assets/{apps-page-DOHsxEjt.js.map → apps-page-Bco3oZzd.js.map} +1 -1
  19. package/dist/gateway/static/root/assets/{channels-settings-JVq31iIN.js → channels-settings-CpTZxCKG.js} +2 -2
  20. package/dist/gateway/static/root/assets/{channels-settings-JVq31iIN.js.map → channels-settings-CpTZxCKG.js.map} +1 -1
  21. package/dist/gateway/static/root/assets/{cron-api-BqeNAeYQ.js → cron-api-YLqLzMDN.js} +2 -2
  22. package/dist/gateway/static/root/assets/{cron-api-BqeNAeYQ.js.map → cron-api-YLqLzMDN.js.map} +1 -1
  23. package/dist/gateway/static/root/assets/{cron-page-ryZsTAOn.js → cron-page-aiDeJtJ-.js} +2 -2
  24. package/dist/gateway/static/root/assets/{cron-page-ryZsTAOn.js.map → cron-page-aiDeJtJ-.js.map} +1 -1
  25. package/dist/gateway/static/root/assets/{dist-zlgGKakL.js → dist-4ClCuR-G.js} +2 -2
  26. package/dist/gateway/static/root/assets/{dist-zlgGKakL.js.map → dist-4ClCuR-G.js.map} +1 -1
  27. package/dist/gateway/static/root/assets/{extension-debug-page-BAHhJLEv.js → extension-debug-page-yNO3rwBQ.js} +2 -2
  28. package/dist/gateway/static/root/assets/{extension-debug-page-BAHhJLEv.js.map → extension-debug-page-yNO3rwBQ.js.map} +1 -1
  29. package/dist/gateway/static/root/assets/{extension-page-9UNKgelu.js → extension-page-D0vOu9eC.js} +2 -2
  30. package/dist/gateway/static/root/assets/{extension-page-9UNKgelu.js.map → extension-page-D0vOu9eC.js.map} +1 -1
  31. package/dist/gateway/static/root/assets/{extension-settings-page-Mjv8LQCe.js → extension-settings-page-DqaNWoo7.js} +2 -2
  32. package/dist/gateway/static/root/assets/{extension-settings-page-Mjv8LQCe.js.map → extension-settings-page-DqaNWoo7.js.map} +1 -1
  33. package/dist/gateway/static/root/assets/{index-DLfAjBJz.js → index-KxjI2fjF.js} +4 -4
  34. package/dist/gateway/static/root/assets/{index-DLfAjBJz.js.map → index-KxjI2fjF.js.map} +1 -1
  35. package/dist/gateway/static/root/assets/{logs-page-XNnEW2Be.js → logs-page-DSdKuyeD.js} +2 -2
  36. package/dist/gateway/static/root/assets/{logs-page-XNnEW2Be.js.map → logs-page-DSdKuyeD.js.map} +1 -1
  37. package/dist/gateway/static/root/assets/{sessions-page-pgcikS9L.js → sessions-page-Bfb-hZJb.js} +2 -2
  38. package/dist/gateway/static/root/assets/{sessions-page-pgcikS9L.js.map → sessions-page-Bfb-hZJb.js.map} +1 -1
  39. package/dist/gateway/static/root/assets/{settings-page-CrXaEe86.js → settings-page-B7NZPSpO.js} +2 -2
  40. package/dist/gateway/static/root/assets/{settings-page-CrXaEe86.js.map → settings-page-B7NZPSpO.js.map} +1 -1
  41. package/dist/gateway/static/root/assets/{skills-page-Cq1gHbJ0.js → skills-page-D-AJTEVx.js} +2 -2
  42. package/dist/gateway/static/root/assets/{skills-page-Cq1gHbJ0.js.map → skills-page-D-AJTEVx.js.map} +1 -1
  43. package/dist/gateway/static/root/assets/{use-image-provider-credentials-BZcegAHq.js → use-image-provider-credentials-Cu5zeVdn.js} +2 -2
  44. package/dist/gateway/static/root/assets/{use-image-provider-credentials-BZcegAHq.js.map → use-image-provider-credentials-Cu5zeVdn.js.map} +1 -1
  45. package/dist/gateway/static/root/index.html +1 -1
  46. package/dist/package.js +1 -1
  47. package/dist/src/agent/agent-manager.js +6 -6
  48. package/dist/src/agent/context/workspace-seed.js +2 -2
  49. package/dist/src/agent/goals/post-turn.js +1 -1
  50. package/dist/src/agent/image/load-image-media.js +1 -1
  51. package/dist/src/agent/ipc/bus.js +1 -1
  52. package/dist/src/agent/ipc/inbox.js +2 -2
  53. package/dist/src/agent/ipc/socket.js +1 -1
  54. package/dist/src/agent/memory/builtin-memory-store.js +1 -1
  55. package/dist/src/agent/memory/dreaming/deep-promotion.js +1 -1
  56. package/dist/src/agent/memory/dreaming/events.js +1 -1
  57. package/dist/src/agent/memory/dreaming/last-run.js +1 -1
  58. package/dist/src/agent/memory/dreaming/light-sweep.js +1 -1
  59. package/dist/src/agent/memory/dreaming/preview.js +1 -1
  60. package/dist/src/agent/memory/dreaming/rem-patterns.js +1 -1
  61. package/dist/src/agent/memory/dreaming/short-term-store.js +1 -1
  62. package/dist/src/agent/memory/dreaming/utils.js +1 -1
  63. package/dist/src/agent/memory/plugin-discovery.js +1 -1
  64. package/dist/src/agent/models/manager.js +1 -1
  65. package/dist/src/agent/prompt/service-prompt-builder.js +2 -2
  66. package/dist/src/agent/service.js +5 -5
  67. package/dist/src/agent/skills/config.js +1 -1
  68. package/dist/src/agent/skills/hub-hash.js +2 -2
  69. package/dist/src/agent/skills/hub-lock.js +1 -1
  70. package/dist/src/agent/skills/hub-pull.js +1 -1
  71. package/dist/src/agent/skills/index.js +1 -1
  72. package/dist/src/agent/skills/managed-store.js +1 -1
  73. package/dist/src/agent/skills/scanner.js +1 -1
  74. package/dist/src/agent/skills/skill-manage-ops.js +1 -1
  75. package/dist/src/agent/skills/skill-manager.js +1 -1
  76. package/dist/src/agent/tools/dreaming-tool.js +1 -1
  77. package/dist/src/agent/tools/factory.js +1 -1
  78. package/dist/src/agent/tools/image-generate-tool.js +1 -1
  79. package/dist/src/agent/tools/send-media.js +1 -1
  80. package/dist/src/agent/tools/skill-manage-tool.js +1 -1
  81. package/dist/src/agent/tools/write.js +1 -1
  82. package/dist/src/auth/credentials.js +3 -3
  83. package/dist/src/auth/profiles/store.js +1 -1
  84. package/dist/src/auth/sync-provider-auth.js +1 -1
  85. package/dist/src/channels/attachments/inbound-persist.js +1 -1
  86. package/dist/src/channels/attachments/outbound-tts-persist.js +1 -1
  87. package/dist/src/channels/outbound/persist-store.js +1 -1
  88. package/dist/src/channels/pairing/allow-from-file.js +1 -1
  89. package/dist/src/channels/pairing/pairing-store.js +2 -2
  90. package/dist/src/chat-commands/builtins/config.js +2 -2
  91. package/dist/src/chat-commands/context.js +1 -1
  92. package/dist/src/cli/commands/agent.js +1 -1
  93. package/dist/src/cli/commands/agents.js +1 -1
  94. package/dist/src/cli/commands/config.js +1 -1
  95. package/dist/src/cli/commands/doctor/checks/config-health.js +1 -1
  96. package/dist/src/cli/commands/doctor/checks/provider-auth.js +1 -1
  97. package/dist/src/cli/commands/doctor/checks/session-integrity.js +1 -1
  98. package/dist/src/cli/commands/doctor/checks/state-integrity.js +1 -1
  99. package/dist/src/cli/commands/doctor/checks/workspace-status.js +1 -1
  100. package/dist/src/cli/commands/extension-dev.js +1 -1
  101. package/dist/src/cli/commands/extension-dev.js.map +1 -1
  102. package/dist/src/cli/commands/extension-marketplace.js +1 -1
  103. package/dist/src/cli/commands/extension-pack.js +1 -1
  104. package/dist/src/cli/commands/image.js +1 -1
  105. package/dist/src/cli/commands/init.js +4 -4
  106. package/dist/src/cli/utils/init-workspace.js +2 -2
  107. package/dist/src/config/index.js +2 -2
  108. package/dist/src/config/loader.js +2 -2
  109. package/dist/src/config/models-json.js +2 -2
  110. package/dist/src/config/profile.js +2 -2
  111. package/dist/src/cron/executor.js +2 -2
  112. package/dist/src/cron/persistence.js +1 -1
  113. package/dist/src/cron/run-log-store.js +1 -1
  114. package/dist/src/daemon/launchd.js +2 -2
  115. package/dist/src/daemon/systemd.js +2 -2
  116. package/dist/src/extensions/health.js +1 -1
  117. package/dist/src/extensions/loader.js +1 -1
  118. package/dist/src/extensions/lockfile.js +2 -2
  119. package/dist/src/gateway/agents-admin.js +2 -2
  120. package/dist/src/gateway/hono/lib/extension-store.js +1 -1
  121. package/dist/src/gateway/hono/lib/static-ui.js +1 -1
  122. package/dist/src/gateway/hono/oauth.js +1 -1
  123. package/dist/src/gateway/hono/routes/auth-registry-extensions.js +1 -1
  124. package/dist/src/gateway/hono/routes/config.js +1 -1
  125. package/dist/src/gateway/hono/routes/dreaming.js +1 -1
  126. package/dist/src/gateway/hono/routes/host-fs.js +1 -1
  127. package/dist/src/gateway/hono/routes/models.js +1 -1
  128. package/dist/src/gateway/hono/routes/workspace.js +3 -3
  129. package/dist/src/gateway/hono/sse.js +2 -2
  130. package/dist/src/gateway/lock.js +2 -2
  131. package/dist/src/gateway/service/run-gateway-agent.js +2 -2
  132. package/dist/src/gateway/service.js +5 -5
  133. package/dist/src/gateway/workspace-fs-file-list.js +1 -1
  134. package/dist/src/gateway/workspace-heartbeat-path.js +1 -1
  135. package/dist/src/infra/update-check.js +1 -1
  136. package/dist/src/infra/update-lock.js +3 -3
  137. package/dist/src/infra/update-runner.js +1 -1
  138. package/dist/src/infra/update-startup.js +2 -2
  139. package/dist/src/infra/write-file-atomic.js +2 -2
  140. package/dist/src/providers/auth-runtime/auth-profile-store.js +1 -1
  141. package/dist/src/providers/index.js +2 -2
  142. package/dist/src/providers/model-registry.js +1 -1
  143. package/dist/src/session/config-store.js +2 -2
  144. package/dist/src/session/search-index-cache.js +1 -1
  145. package/dist/src/session/search-index.js +1 -1
  146. package/dist/src/session/session-title.js +1 -1
  147. package/dist/src/session/store.js +5 -5
  148. package/dist/src/tui/backends/embedded-backend.js +1 -1
  149. package/dist/src/tui/tui.js +1 -1
  150. package/dist/src/utils/logger/audit.js +1 -1
  151. package/dist/src/utils/logger/log-store.js +1 -1
  152. package/dist/src/utils/logger/rotation.js +1 -1
  153. package/dist/src/voice/tts/audio.js +1 -1
  154. package/dist/src/voice/tts/providers/edge-speech.js +1 -1
  155. package/package.json +1 -1
@@ -1,6 +1,6 @@
1
- import { join, relative } from "node:path";
2
- import { createReadStream, existsSync, readFileSync, readdirSync, statSync } from "node:fs";
3
1
  import { createHash } from "node:crypto";
2
+ import { createReadStream, existsSync, readFileSync, readdirSync, statSync } from "node:fs";
3
+ import { join, relative } from "node:path";
4
4
  //#region src/agent/skills/hub-hash.ts
5
5
  /**
6
6
  * Deterministic content hash for a skill directory (for hub lock / drift detection).
@@ -1,5 +1,5 @@
1
- import { init_paths, resolveSkillsLockPath } from "../../config/paths.js";
2
1
  import { init_write_file_atomic, writeTextAtomicSync } from "../../infra/write-file-atomic.js";
2
+ import { init_paths, resolveSkillsLockPath } from "../../config/paths.js";
3
3
  import { existsSync, readFileSync } from "node:fs";
4
4
  //#region src/agent/skills/hub-lock.ts
5
5
  /**
@@ -4,9 +4,9 @@ import { formatScanSummary, scanSkillDirectory } from "./scanner.js";
4
4
  import { getSkillsLockEntry, recordSkillsHubInstall } from "./hub-lock.js";
5
5
  import { installSkillFromZip, isValidSkillId } from "./managed-store.js";
6
6
  import { computeSkillTreeHashSync } from "./hub-hash.js";
7
+ import { cpSync, existsSync, mkdirSync, mkdtempSync, readFileSync, readdirSync, rmSync, statSync, writeFileSync } from "node:fs";
7
8
  import { basename, join, normalize, resolve, sep } from "node:path";
8
9
  import { tmpdir } from "node:os";
9
- import { cpSync, existsSync, mkdirSync, mkdtempSync, readFileSync, readdirSync, rmSync, statSync, writeFileSync } from "node:fs";
10
10
  import { fileURLToPath } from "node:url";
11
11
  import { fetch } from "undici";
12
12
  import { execFileSync } from "node:child_process";
@@ -1,6 +1,6 @@
1
- import { resolveStateDir } from "../../config/paths-state.js";
2
1
  import { createLogger } from "../../utils/logger/index.js";
3
2
  import { init_logger } from "../../utils/logger.js";
3
+ import { resolveStateDir } from "../../config/paths-state.js";
4
4
  import { init_paths } from "../../config/paths.js";
5
5
  import { parseFrontmatter } from "../../markdown/frontmatter.js";
6
6
  import { findInstallSpec, getDefaultInstallerPreferences, hasBinary, init_installer, installSkill } from "./installer.js";
@@ -1,8 +1,8 @@
1
1
  import { init_paths, resolveSkillsDir } from "../../config/paths.js";
2
2
  import { parseFrontmatter } from "../../markdown/frontmatter.js";
3
3
  import { loadSkillsLock } from "./hub-lock.js";
4
- import { dirname, join, resolve, sep } from "node:path";
5
4
  import { existsSync, mkdirSync, readFileSync, readdirSync, rmSync, writeFileSync } from "node:fs";
5
+ import { dirname, join, resolve, sep } from "node:path";
6
6
  import AdmZip from "adm-zip";
7
7
  //#region src/agent/skills/managed-store.ts
8
8
  /**
@@ -1,7 +1,7 @@
1
1
  import { createLogger } from "../../utils/logger/index.js";
2
2
  import { init_logger } from "../../utils/logger.js";
3
- import { join } from "path";
4
3
  import { readFile, readdir } from "fs/promises";
4
+ import { join } from "path";
5
5
  //#region src/agent/skills/scanner.ts
6
6
  /**
7
7
  * Skill security scanner — scans skill directories for potentially dangerous code patterns.
@@ -2,9 +2,9 @@ import { init_paths, resolveSkillsDir } from "../../config/paths.js";
2
2
  import { parseFrontmatter } from "../../markdown/frontmatter.js";
3
3
  import { formatScanSummary, scanSkillDirectory } from "./scanner.js";
4
4
  import { fuzzyFindText, normalizeForFuzzyMatch, normalizeToLF, restoreLineEndings } from "../tools/edit-diff.js";
5
+ import { mkdir, writeFile } from "fs/promises";
5
6
  import { join, resolve, sep } from "path";
6
7
  import { existsSync, realpathSync } from "fs";
7
- import { mkdir, writeFile } from "fs/promises";
8
8
  //#region src/agent/skills/skill-manage-ops.ts
9
9
  /**
10
10
  * Shared logic for the skill_manage agent tool (create / edit / patch / delete / write_file / remove_file).
@@ -1,6 +1,6 @@
1
- import { resolveStateDir } from "../../config/paths-state.js";
2
1
  import { createLogger } from "../../utils/logger/index.js";
3
2
  import { init_logger } from "../../utils/logger.js";
3
+ import { resolveStateDir } from "../../config/paths-state.js";
4
4
  import { init_paths, resolveBundledSkillsDir } from "../../config/paths.js";
5
5
  import { createSkillConfigManager, isSkillEnabled } from "./config.js";
6
6
  import { formatSkillsForPrompt, selectSkillsVisibleInPrompt } from "./format-skills-prompt.js";
@@ -3,8 +3,8 @@ import { init_logger } from "../../utils/logger.js";
3
3
  import { SHORT_TERM_PROMOTION_LOCK_RELATIVE, SHORT_TERM_RECALL_STORE_RELATIVE } from "../memory/dreaming/constants.js";
4
4
  import { loadDreamingStore, saveDreamingStore } from "../memory/dreaming/short-term-store.js";
5
5
  import { resolveDreamingConfig } from "../memory/dreaming/config.js";
6
- import path from "node:path";
7
6
  import fs from "node:fs/promises";
7
+ import path from "node:path";
8
8
  import { Type } from "@sinclair/typebox";
9
9
  //#region src/agent/tools/dreaming-tool.ts
10
10
  init_logger();
@@ -1,6 +1,6 @@
1
- import { init_session_key, parseSessionKey } from "../../routing/session-key.js";
2
1
  import { createLogger } from "../../utils/logger/index.js";
3
2
  import { init_logger } from "../../utils/logger.js";
3
+ import { init_session_key, parseSessionKey } from "../../routing/session-key.js";
4
4
  import { mergeTtsConfigFromAppConfig } from "../../voice/tts/merge-config.js";
5
5
  import { createReadFileTool } from "./read.js";
6
6
  import { createWriteFileTool } from "./write.js";
@@ -4,9 +4,9 @@ import { isFailoverError } from "../failover-error.js";
4
4
  import { imageAssetFromDataUrl, imageFileExtensionForMimeType, mimeTypeFromFileName, parseImageDataUrl, sniffImageMimeType } from "../image/generation/image-assets.js";
5
5
  import { getImageGenerationProvider } from "../image/generation/provider-registry.js";
6
6
  import { generateImage, listImageGenerationProvidersSummary } from "../image/generation/runtime.js";
7
- import path from "node:path";
8
7
  import { randomBytes } from "node:crypto";
9
8
  import { mkdir, readFile, writeFile } from "node:fs/promises";
9
+ import path from "node:path";
10
10
  import { Type } from "@sinclair/typebox";
11
11
  //#region src/agent/tools/image-generate-tool.ts
12
12
  const DEFAULT_COUNT = 1;
@@ -1,7 +1,7 @@
1
1
  import { checkFileSafety } from "../prompt/safety.js";
2
2
  import { resolvePathUnderWorkspace } from "./tool-paths.js";
3
- import { basename } from "node:path";
4
3
  import { readFile } from "fs/promises";
4
+ import { basename } from "node:path";
5
5
  import { Type } from "@sinclair/typebox";
6
6
  //#region src/agent/tools/send-media.ts
7
7
  const SendMediaSchema = Type.Object({
@@ -2,9 +2,9 @@ import { resolveStateDir } from "../../config/paths-state.js";
2
2
  import { init_paths } from "../../config/paths.js";
3
3
  import { createSkillConfigManager } from "../skills/config.js";
4
4
  import { applyPatchToContent, atomicWriteUtf8, effectiveAgentWritePolicy, ensureCategorySegment, isPathInsideDir, maxSkillMdChars, maxSupportFileBytes, mutatableSkillOrNull, resolveCreateSkillDir, scanSkillDirOrError, validateSkillMdContent, validateSkillNameSegment, validateSupportingRelativePath } from "../skills/skill-manage-ops.js";
5
+ import { readFile, rm } from "fs/promises";
5
6
  import { join } from "path";
6
7
  import { existsSync, rmSync } from "fs";
7
- import { readFile, rm } from "fs/promises";
8
8
  import { Type } from "@sinclair/typebox";
9
9
  //#region src/agent/tools/skill-manage-tool.ts
10
10
  init_paths();
@@ -1,7 +1,7 @@
1
1
  import { checkFileSafety } from "../prompt/safety.js";
2
2
  import { resolvePathUnderWorkspace } from "./tool-paths.js";
3
- import { dirname } from "path";
4
3
  import { mkdir, writeFile } from "fs/promises";
4
+ import { dirname } from "path";
5
5
  import { Type } from "@sinclair/typebox";
6
6
  //#region src/agent/tools/write.ts
7
7
  const MAX_FILE_SIZE = 10 * 1024 * 1024;
@@ -1,11 +1,11 @@
1
1
  import { __esmMin } from "../../_virtual/_rolldown/runtime.js";
2
+ import { init_write_file_atomic, writeTextAtomic } from "../infra/write-file-atomic.js";
2
3
  import { createLogger } from "../utils/logger/index.js";
3
4
  import { init_logger } from "../utils/logger.js";
4
- import { init_paths, resolveAgentAuthProfilesPath, resolveAuthProfilesPath, resolveCredentialsDir, resolveOAuthPath } from "../config/paths.js";
5
- import { init_write_file_atomic, writeTextAtomic } from "../infra/write-file-atomic.js";
6
5
  import { getApiKeyFromEnv, init_env_keys } from "../providers/env-keys.js";
7
- import { dirname, join } from "path";
6
+ import { init_paths, resolveAgentAuthProfilesPath, resolveAuthProfilesPath, resolveCredentialsDir, resolveOAuthPath } from "../config/paths.js";
8
7
  import { mkdir, readFile } from "fs/promises";
8
+ import { dirname, join } from "path";
9
9
  //#region src/auth/credentials.ts
10
10
  function getCredentialResolver(options) {
11
11
  return new CredentialResolver(options);
@@ -1,6 +1,6 @@
1
1
  import { init_write_file_atomic, writeTextAtomicSync } from "../../infra/write-file-atomic.js";
2
- import path from "node:path";
3
2
  import { chmodSync, existsSync, mkdirSync, readFileSync } from "node:fs";
3
+ import path from "node:path";
4
4
  import { homedir } from "os";
5
5
  //#region src/auth/profiles/store.ts
6
6
  /**
@@ -1,7 +1,7 @@
1
1
  import { __esmMin } from "../../_virtual/_rolldown/runtime.js";
2
- import { getDefaultAgentId, init_resolve_route } from "../routing/resolve-route.js";
3
2
  import { init_paths, resolveAgentAuthProfilesPath, resolveAuthProfilesPath, resolveOAuthPath } from "../config/paths.js";
4
3
  import { init_loader, loadConfig } from "../config/loader.js";
4
+ import { getDefaultAgentId, init_resolve_route } from "../routing/resolve-route.js";
5
5
  import { existsSync, readFileSync } from "node:fs";
6
6
  //#region src/auth/sync-provider-auth.ts
7
7
  /**
@@ -1,7 +1,7 @@
1
1
  import { createLogger } from "../../utils/logger/index.js";
2
2
  import { init_logger } from "../../utils/logger.js";
3
- import { join, resolve } from "path";
4
3
  import { mkdir, writeFile } from "fs/promises";
4
+ import { join, resolve } from "path";
5
5
  import { randomBytes } from "crypto";
6
6
  //#region src/channels/attachments/inbound-persist.ts
7
7
  /**
@@ -1,7 +1,7 @@
1
1
  import { createLogger } from "../../utils/logger/index.js";
2
2
  import { init_logger } from "../../utils/logger.js";
3
- import { join, resolve } from "path";
4
3
  import { mkdir, writeFile } from "fs/promises";
4
+ import { join, resolve } from "path";
5
5
  import { randomBytes } from "crypto";
6
6
  //#region src/channels/attachments/outbound-tts-persist.ts
7
7
  /**
@@ -1,7 +1,7 @@
1
1
  import { init_write_file_atomic, writeTextAtomicSync } from "../../infra/write-file-atomic.js";
2
+ import { randomUUID } from "node:crypto";
2
3
  import { join } from "path";
3
4
  import { existsSync, mkdirSync, readFileSync } from "fs";
4
- import { randomUUID } from "node:crypto";
5
5
  //#region src/channels/outbound/persist-store.ts
6
6
  /**
7
7
  * Durable outbound queue (crash recovery): JSON file under agent internal dir.
@@ -1,5 +1,5 @@
1
- import path from "node:path";
2
1
  import fsSync from "node:fs";
2
+ import path from "node:path";
3
3
  //#region src/channels/pairing/allow-from-file.ts
4
4
  function readAllowFromFile(filePath) {
5
5
  try {
@@ -1,7 +1,7 @@
1
1
  import { appendAllowFromIdSync } from "./allow-from-file.js";
2
- import path from "node:path";
3
- import fsSync from "node:fs";
4
2
  import crypto from "node:crypto";
3
+ import fsSync from "node:fs";
4
+ import path from "node:path";
5
5
  //#region src/channels/pairing/pairing-store.ts
6
6
  const PAIRING_CODE_LENGTH = 8;
7
7
  const PAIRING_CODE_ALPHABET = "ABCDEFGHJKLMNPQRSTUVWXYZ23456789";
@@ -1,9 +1,9 @@
1
- import { ConfigSchema, init_schema } from "../../config/schema.js";
2
- import { init_session_key, parseSessionKey } from "../../routing/session-key.js";
3
1
  import { createLogger } from "../../utils/logger/index.js";
4
2
  import { init_logger } from "../../utils/logger.js";
5
3
  import { init_paths, resolveConfigPath } from "../../config/paths.js";
4
+ import { ConfigSchema, init_schema } from "../../config/schema.js";
6
5
  import { init_loader, loadConfig, saveConfig } from "../../config/loader.js";
6
+ import { init_session_key, parseSessionKey } from "../../routing/session-key.js";
7
7
  import { commandRegistry } from "../registry.js";
8
8
  import { resolveAllowlistMatchSimple } from "../../channels/security.js";
9
9
  import { parseConfigValue } from "../config-value.js";
@@ -4,8 +4,8 @@ import { init_loader, saveConfig } from "../config/loader.js";
4
4
  import { effectiveWorkspacePathForSession } from "../session/session-workspace.js";
5
5
  import { getRoutingInfo, getSessionDisplayName } from "./session-key.js";
6
6
  import { wrapMarkdownExportAsHtml } from "../session/chat-export.js";
7
- import { join } from "path";
8
7
  import { mkdir, writeFile } from "fs/promises";
8
+ import { join } from "path";
9
9
  //#region src/chat-commands/context.ts
10
10
  init_logger();
11
11
  init_loader();
@@ -1,6 +1,6 @@
1
- import { getWorkspacePath } from "../../config/schema.js";
2
1
  import { createLogger } from "../../utils/logger/index.js";
3
2
  import { init_logger } from "../../utils/logger.js";
3
+ import { getWorkspacePath } from "../../config/schema.js";
4
4
  import { loadConfig } from "../../config/loader.js";
5
5
  import { MessageBus, MessageBusShutdownError } from "../../infra/bus/queue.js";
6
6
  import "../../infra/bus/index.js";
@@ -4,8 +4,8 @@ import { init_loader, loadConfig, saveConfig } from "../../config/loader.js";
4
4
  import { seedWorkspaceBootstrapFiles } from "../../agent/context/workspace-seed.js";
5
5
  import { colors } from "../utils/colors.js";
6
6
  import { applyAgentConfig, findAgentEntryIndex, pruneAgentConfig, removeAgentDirsFromDisk } from "../../commands/agents.config.js";
7
- import { join } from "node:path";
8
7
  import { mkdir } from "node:fs/promises";
8
+ import { join } from "node:path";
9
9
  //#region src/cli/commands/agents.ts
10
10
  /**
11
11
  * `agents` CLI: config is the source of truth for multi-agent paths.
@@ -1,6 +1,6 @@
1
+ import { init_write_file_atomic, writeTextAtomic } from "../../infra/write-file-atomic.js";
1
2
  import { createLogger } from "../../utils/logger/index.js";
2
3
  import { init_logger } from "../../utils/logger.js";
3
- import { init_write_file_atomic, writeTextAtomic } from "../../infra/write-file-atomic.js";
4
4
  import { loadConfig } from "../../config/loader.js";
5
5
  import "../../config/index.js";
6
6
  import { formatExamples, register } from "../registry.js";
@@ -1,7 +1,7 @@
1
1
  import { ConfigSchema, init_schema } from "../../../../config/schema.js";
2
2
  import { init_loader, loadConfig, saveConfig } from "../../../../config/loader.js";
3
- import { dirname } from "node:path";
4
3
  import { existsSync, mkdirSync, readFileSync } from "node:fs";
4
+ import { dirname } from "node:path";
5
5
  //#region src/cli/commands/doctor/checks/config-health.ts
6
6
  init_loader();
7
7
  init_schema();
@@ -1,6 +1,6 @@
1
+ import { PROVIDER_ENV_MAP, getApiKeyFromEnv, init_env_keys } from "../../../../providers/env-keys.js";
1
2
  import { getAgentDefaultModelRef, init_schema, parseModelRef } from "../../../../config/schema.js";
2
3
  import { init_loader, loadConfig } from "../../../../config/loader.js";
3
- import { PROVIDER_ENV_MAP, getApiKeyFromEnv, init_env_keys } from "../../../../providers/env-keys.js";
4
4
  import { existsSync } from "node:fs";
5
5
  //#region src/cli/commands/doctor/checks/provider-auth.ts
6
6
  init_loader();
@@ -2,8 +2,8 @@ import { init_agent_scope, resolveDefaultAgentId } from "../../../../agent/agent
2
2
  import { init_paths, resolveSessionsDir, resolveSessionsIndexPath } from "../../../../config/paths.js";
3
3
  import { init_loader, loadConfig } from "../../../../config/loader.js";
4
4
  import { resolveSessionShardRelativePath } from "../../../../session/shard-path.js";
5
- import { join } from "node:path";
6
5
  import { existsSync, readFileSync, readdirSync } from "node:fs";
6
+ import { join } from "node:path";
7
7
  //#region src/cli/commands/doctor/checks/session-integrity.ts
8
8
  init_agent_scope();
9
9
  init_loader();
@@ -1,5 +1,5 @@
1
- import { join } from "node:path";
2
1
  import { accessSync, chmodSync, constants, existsSync, mkdirSync, statSync } from "node:fs";
2
+ import { join } from "node:path";
3
3
  //#region src/cli/commands/doctor/checks/state-integrity.ts
4
4
  function isWritable(dir) {
5
5
  try {
@@ -1,8 +1,8 @@
1
1
  import { init_agent_scope, resolveAgentWorkspaceDir, resolveDefaultAgentId } from "../../../../agent/agent-scope.js";
2
2
  import { WORKSPACE_FILES, init_paths } from "../../../../config/paths.js";
3
3
  import { init_loader, loadConfig } from "../../../../config/loader.js";
4
- import { join } from "node:path";
5
4
  import { existsSync } from "node:fs";
5
+ import { join } from "node:path";
6
6
  //#region src/cli/commands/doctor/checks/workspace-status.ts
7
7
  init_agent_scope();
8
8
  init_loader();
@@ -12,8 +12,8 @@ import { GatewayServer } from "../../gateway/server.js";
12
12
  import { runGatewayLoop } from "../../gateway/run-loop.js";
13
13
  import "../../gateway/index.js";
14
14
  import { getContextWithOpts } from "../index.js";
15
- import { join, resolve } from "node:path";
16
15
  import { existsSync, mkdirSync, readFileSync, symlinkSync, unlinkSync, watch } from "node:fs";
16
+ import { join, resolve } from "node:path";
17
17
  import { Command } from "commander";
18
18
  //#region src/cli/commands/extension-dev.ts
19
19
  init_loader();
@@ -1 +1 @@
1
- {"version":3,"file":"extension-dev.js","names":[],"sources":["../../../../src/cli/commands/extension-dev.ts"],"sourcesContent":["import {\n existsSync,\n mkdirSync,\n readFileSync,\n symlinkSync,\n unlinkSync,\n watch,\n type FSWatcher,\n} from 'node:fs';\nimport { join, resolve } from 'node:path';\n\nimport { Command } from 'commander';\n\nimport { loadConfig } from '../../config/loader.js';\nimport { resolveConfigPath, resolveExtensionsDir } from '../../config/paths.js';\nimport { checkEngineCompatibility } from '../../extensions/engine-check.js';\nimport type { ExtensionManifest } from '../../extensions/types/index.js';\nimport { normalizeExtensionManifest } from '../../extensions/normalize-manifest.js';\nimport { GatewayServer } from '../../gateway/index.js';\nimport { runGatewayLoop } from '../../gateway/run-loop.js';\nimport { PACKAGE_VERSION } from '../../package-version.js';\nimport { createLogger } from '../../utils/logger.js';\nimport { colors } from '../utils/colors.js';\nimport { getContextWithOpts } from '../index.js';\nimport { initWorkspace } from '../utils/init-workspace.js';\nimport { seedMainAgentBootstrap } from '../../agent/context/workspace-seed.js';\n\nconst log = createLogger('ExtensionDev');\nconst MANIFEST = 'xopc.extension.json';\n\nfunction isRecord(x: unknown): x is Record<string, unknown> {\n return typeof x === 'object' && x !== null && !Array.isArray(x);\n}\n\nasync function ensureGatewayReady(\n configPath: string,\n workspacePath: string,\n gatewayHost: string,\n gatewayPort: number,\n): Promise<void> {\n const result = await initWorkspace({\n configPath,\n workspacePath,\n gatewayHost,\n gatewayPort,\n });\n\n if (result.configCreated || result.workspaceCreated) {\n console.log('');\n console.log('👋 First-time setup before starting the gateway...');\n console.log('');\n console.log('✅ Setup complete.');\n console.log(` Config: ${configPath}`);\n console.log(` Workspace: ${workspacePath}`);\n console.log('');\n seedMainAgentBootstrap(result.config);\n }\n}\n\nfunction loadAndValidateManifest(extensionDir: string): ExtensionManifest | null {\n const manifestPath = join(extensionDir, MANIFEST);\n if (!existsSync(manifestPath)) {\n console.error(colors.red('error:'), `Missing ${MANIFEST} in ${extensionDir}`);\n return null;\n }\n try {\n const raw = JSON.parse(readFileSync(manifestPath, 'utf-8') as string) as unknown;\n if (!isRecord(raw)) {\n console.error(colors.red('error:'), 'Manifest must be a JSON object');\n return null;\n }\n const manifest = normalizeExtensionManifest(raw);\n if (!manifest.id?.trim()) {\n console.error(colors.red('error:'), 'Manifest \"id\" is required');\n return null;\n }\n if (manifest.engines?.xopc) {\n const r = checkEngineCompatibility(PACKAGE_VERSION, manifest.engines.xopc);\n if (r.parseWarning) {\n console.log(\n colors.yellow('warning:'),\n r.reason ?? 'engines.xopc could not be fully parsed — continuing',\n );\n } else if (!r.compatible) {\n console.log(\n colors.yellow('warning:'),\n r.reason ?? `engines.xopc may not match xopc ${PACKAGE_VERSION} — continuing`,\n );\n }\n }\n return manifest;\n } catch (e) {\n log.error({ err: e }, 'Failed to read manifest');\n console.error(\n colors.red('error:'),\n e instanceof Error ? e.message : String(e),\n );\n return null;\n }\n}\n\nfunction setupDevSymlink(extensionDir: string, extensionsDir: string, extensionId: string): string {\n mkdirSync(extensionsDir, { recursive: true });\n const symlinkPath = join(extensionsDir, extensionId);\n if (existsSync(symlinkPath)) {\n unlinkSync(symlinkPath);\n }\n symlinkSync(extensionDir, symlinkPath, 'dir');\n return symlinkPath;\n}\n\nfunction cleanupSymlink(symlinkPath: string | null): void {\n if (!symlinkPath) return;\n try {\n if (existsSync(symlinkPath)) {\n unlinkSync(symlinkPath);\n }\n } catch (e) {\n log.warn({ err: e, symlinkPath }, 'Failed to remove dev symlink');\n }\n}\n\nfunction shouldIgnorePath(relativePath: string): boolean {\n const parts = relativePath.split(/[/\\\\]/);\n if (parts.some((p) => p === 'node_modules')) return true;\n if (parts.some((p) => p.startsWith('.'))) return true;\n return false;\n}\n\nexport function createExtensionDevCommand(): Command {\n return new Command('extension:dev')\n .alias('ext:dev')\n .description('Symlink an extension into the workspace for live development (optional file watch + gateway)')\n .argument('[dir]', 'Extension directory (default: current working directory)', '.')\n .option('--port <number>', 'Gateway port', '18790')\n .option('--host <address>', 'Gateway host', '127.0.0.1')\n .option('--no-gateway', 'Do not start the gateway (symlink only)')\n .option('--no-watch', 'Do not watch files for changes')\n .action(\n async (\n dir: string,\n options: { port: string; host: string; gateway: boolean; watch: boolean },\n ) => {\n const extensionDir = resolve(dir || '.');\n const manifest = loadAndValidateManifest(extensionDir);\n if (!manifest) {\n process.exit(1);\n }\n\n const ctx = getContextWithOpts();\n const config = loadConfig(ctx.configPath);\n const extensionsDir = resolveExtensionsDir();\n const symlinkPath = setupDevSymlink(extensionDir, extensionsDir, manifest.id);\n\n console.log(\n colors.green('✓'),\n `Dev symlink: ${symlinkPath} → ${extensionDir}`,\n );\n console.log(\n colors.cyan('Note:'),\n 'restart the gateway or trigger config hot-reload so the extension reload picks up changes.',\n );\n\n let debounce: ReturnType<typeof setTimeout> | null = null;\n let watcher: FSWatcher | null = null;\n\n if (options.watch) {\n try {\n watcher = watch(\n extensionDir,\n { recursive: true },\n (_event, filename) => {\n const rel = filename ? String(filename) : '';\n if (rel && shouldIgnorePath(rel)) return;\n if (debounce) clearTimeout(debounce);\n debounce = setTimeout(() => {\n const label = rel || '(unknown)';\n if (/(^|[\\\\/])xopc\\.extension\\.json$/.test(rel) || rel === MANIFEST) {\n console.log(colors.cyan('[watch]'), `manifest: ${label}`);\n } else if (/\\.(html?|css|mjs|js|tsx?|jsx|json)$/i.test(label)) {\n if (/^ui[\\\\/]/.test(rel) || /[\\\\/]ui[\\\\/]/.test(label)) {\n console.log(colors.cyan('[watch]'), `ui: ${label}`);\n } else {\n console.log(colors.cyan('[watch]'), `source: ${label}`);\n }\n } else {\n console.log(colors.cyan('[watch]'), `changed: ${label}`);\n }\n }, 300);\n },\n );\n } catch (e) {\n log.warn({ err: e }, 'fs.watch failed; continuing without watch');\n }\n }\n\n let cleaned = false;\n const cleanup = () => {\n if (cleaned) return;\n cleaned = true;\n if (debounce) clearTimeout(debounce);\n if (watcher) {\n try {\n watcher.close();\n } catch (e) {\n log.warn({ err: e }, 'watcher close failed');\n }\n }\n cleanupSymlink(symlinkPath);\n };\n\n for (const sig of ['SIGINT', 'SIGTERM'] as const) {\n process.on(sig, () => {\n cleanup();\n process.exit(0);\n });\n }\n\n if (!options.gateway) {\n if (options.watch) {\n console.log(colors.cyan('Watching…'), 'Ctrl+C to stop and remove symlink');\n } else {\n console.log(\n colors.cyan('Holding process…'),\n 'Ctrl+C to stop and remove symlink (no file watch)',\n );\n }\n await new Promise(() => {\n /* until SIGINT / SIGTERM */\n });\n return;\n }\n\n const port = parseInt(options.port, 10);\n const host = options.host;\n await ensureGatewayReady(ctx.configPath, ctx.workspacePath, host, port);\n const cfg = loadConfig(ctx.configPath);\n\n if (Number.isNaN(port)) {\n console.error(colors.red('error:'), 'Invalid --port');\n cleanup();\n process.exit(1);\n }\n\n console.log('');\n console.log('🚀 Starting gateway (extension dev)…');\n console.log(` Host: ${host}`);\n console.log(` Port: ${port}`);\n console.log('');\n\n try {\n await runGatewayLoop({\n configPath: ctx.configPath || resolveConfigPath(),\n port,\n start: async () => {\n const server = new GatewayServer({\n host,\n port,\n token: cfg?.gateway?.auth?.token,\n verbose: ctx.isVerbose,\n configPath: ctx.configPath,\n enableHotReload: true,\n });\n await server.start();\n const displayHost = host === '0.0.0.0' ? 'localhost' : host;\n const token = cfg?.gateway?.auth?.token;\n console.log('✅ Gateway started');\n console.log(` URL: http://${displayHost}:${port}`);\n if (token) {\n console.log(\n ` Token: ${String(token).slice(0, 8)}...${String(token).slice(-8)}`,\n );\n }\n console.log('');\n return server;\n },\n });\n } finally {\n cleanup();\n }\n },\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;aAaoD;YAC4B;sBAMrB;aACN;AAMrD,MAAM,MAAM,aAAa,eAAe;AACxC,MAAM,WAAW;AAEjB,SAAS,SAAS,GAA0C;AAC1D,QAAO,OAAO,MAAM,YAAY,MAAM,QAAQ,CAAC,MAAM,QAAQ,EAAE;;AAGjE,eAAe,mBACb,YACA,eACA,aACA,aACe;CACf,MAAM,SAAS,MAAM,cAAc;EACjC;EACA;EACA;EACA;EACD,CAAC;AAEF,KAAI,OAAO,iBAAiB,OAAO,kBAAkB;AACnD,UAAQ,IAAI,GAAG;AACf,UAAQ,IAAI,qDAAqD;AACjE,UAAQ,IAAI,GAAG;AACf,UAAQ,IAAI,oBAAoB;AAChC,UAAQ,IAAI,iBAAiB,aAAa;AAC1C,UAAQ,IAAI,iBAAiB,gBAAgB;AAC7C,UAAQ,IAAI,GAAG;AACf,yBAAuB,OAAO,OAAO;;;AAIzC,SAAS,wBAAwB,cAAgD;CAC/E,MAAM,eAAe,KAAK,cAAc,SAAS;AACjD,KAAI,CAAC,WAAW,aAAa,EAAE;AAC7B,UAAQ,MAAM,OAAO,IAAI,SAAS,EAAE,WAAW,SAAS,MAAM,eAAe;AAC7E,SAAO;;AAET,KAAI;EACF,MAAM,MAAM,KAAK,MAAM,aAAa,cAAc,QAAQ,CAAW;AACrE,MAAI,CAAC,SAAS,IAAI,EAAE;AAClB,WAAQ,MAAM,OAAO,IAAI,SAAS,EA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M,OAAO,OAAO;KACpB,MAAM,cAAc,SAAS,YAAY,cAAc;KACvD,MAAM,QAAQ,KAAK,SAAS,MAAM;AAClC,aAAQ,IAAI,oBAAoB;AAChC,aAAQ,IAAI,kBAAkB,YAAY,GAAG,OAAO;AACpD,SAAI,MACF,SAAQ,IACN,aAAa,OAAO,MAAM,CAAC,MAAM,GAAG,EAAE,CAAC,KAAK,OAAO,MAAM,CAAC,MAAM,GAAG,GACpE;AAEH,aAAQ,IAAI,GAAG;AACf,YAAO;;IAEV,CAAC;YACM;AACR,YAAS;;GAGd"}
1
+ {"version":3,"file":"extension-dev.js","names":[],"sources":["../../../../src/cli/commands/extension-dev.ts"],"sourcesContent":["import {\n existsSync,\n mkdirSync,\n readFileSync,\n symlinkSync,\n unlinkSync,\n watch,\n type FSWatcher,\n} from 'node:fs';\nimport { join, resolve } from 'node:path';\n\nimport { Command } from 'commander';\n\nimport { loadConfig } from '../../config/loader.js';\nimport { resolveConfigPath, resolveExtensionsDir } from '../../config/paths.js';\nimport { checkEngineCompatibility } from '../../extensions/engine-check.js';\nimport type { ExtensionManifest } from '../../extensions/types/index.js';\nimport { normalizeExtensionManifest } from '../../extensions/normalize-manifest.js';\nimport { GatewayServer } from '../../gateway/index.js';\nimport { runGatewayLoop } from '../../gateway/run-loop.js';\nimport { PACKAGE_VERSION } from '../../package-version.js';\nimport { createLogger } from '../../utils/logger.js';\nimport { colors } from '../utils/colors.js';\nimport { getContextWithOpts } from '../index.js';\nimport { initWorkspace } from '../utils/init-workspace.js';\nimport { seedMainAgentBootstrap } from '../../agent/context/workspace-seed.js';\n\nconst log = createLogger('ExtensionDev');\nconst MANIFEST = 'xopc.extension.json';\n\nfunction isRecord(x: unknown): x is Record<string, unknown> {\n return typeof x === 'object' && x !== null && !Array.isArray(x);\n}\n\nasync function ensureGatewayReady(\n configPath: string,\n workspacePath: string,\n gatewayHost: string,\n gatewayPort: number,\n): Promise<void> {\n const result = await initWorkspace({\n configPath,\n workspacePath,\n gatewayHost,\n gatewayPort,\n });\n\n if (result.configCreated || result.workspaceCreated) {\n console.log('');\n console.log('👋 First-time setup before starting the gateway...');\n console.log('');\n console.log('✅ Setup complete.');\n console.log(` Config: ${configPath}`);\n console.log(` Workspace: ${workspacePath}`);\n console.log('');\n seedMainAgentBootstrap(result.config);\n }\n}\n\nfunction loadAndValidateManifest(extensionDir: string): ExtensionManifest | null {\n const manifestPath = join(extensionDir, MANIFEST);\n if (!existsSync(manifestPath)) {\n console.error(colors.red('error:'), `Missing ${MANIFEST} in ${extensionDir}`);\n return null;\n }\n try {\n const raw = JSON.parse(readFileSync(manifestPath, 'utf-8') as string) as unknown;\n if (!isRecord(raw)) {\n console.error(colors.red('error:'), 'Manifest must be a JSON object');\n return null;\n }\n const manifest = normalizeExtensionManifest(raw);\n if (!manifest.id?.trim()) {\n console.error(colors.red('error:'), 'Manifest \"id\" is required');\n return null;\n }\n if (manifest.engines?.xopc) {\n const r = checkEngineCompatibility(PACKAGE_VERSION, manifest.engines.xopc);\n if (r.parseWarning) {\n console.log(\n colors.yellow('warning:'),\n r.reason ?? 'engines.xopc could not be fully parsed — continuing',\n );\n } else if (!r.compatible) {\n console.log(\n colors.yellow('warning:'),\n r.reason ?? `engines.xopc may not match xopc ${PACKAGE_VERSION} — continuing`,\n );\n }\n }\n return manifest;\n } catch (e) {\n log.error({ err: e }, 'Failed to read manifest');\n console.error(\n colors.red('error:'),\n e instanceof Error ? e.message : String(e),\n );\n return null;\n }\n}\n\nfunction setupDevSymlink(extensionDir: string, extensionsDir: string, extensionId: string): string {\n mkdirSync(extensionsDir, { recursive: true });\n const symlinkPath = join(extensionsDir, extensionId);\n if (existsSync(symlinkPath)) {\n unlinkSync(symlinkPath);\n }\n symlinkSync(extensionDir, symlinkPath, 'dir');\n return symlinkPath;\n}\n\nfunction cleanupSymlink(symlinkPath: string | null): void {\n if (!symlinkPath) return;\n try {\n if (existsSync(symlinkPath)) {\n unlinkSync(symlinkPath);\n }\n } catch (e) {\n log.warn({ err: e, symlinkPath }, 'Failed to remove dev symlink');\n }\n}\n\nfunction shouldIgnorePath(relativePath: string): boolean {\n const parts = relativePath.split(/[/\\\\]/);\n if (parts.some((p) => p === 'node_modules')) return true;\n if (parts.some((p) => p.startsWith('.'))) return true;\n return false;\n}\n\nexport function createExtensionDevCommand(): Command {\n return new Command('extension:dev')\n .alias('ext:dev')\n .description('Symlink an extension into the workspace for live development (optional file watch + gateway)')\n .argument('[dir]', 'Extension directory (default: current working directory)', '.')\n .option('--port <number>', 'Gateway port', '18790')\n .option('--host <address>', 'Gateway host', '127.0.0.1')\n .option('--no-gateway', 'Do not start the gateway (symlink only)')\n .option('--no-watch', 'Do not watch files for changes')\n .action(\n async (\n dir: string,\n options: { port: string; host: string; gateway: boolean; watch: boolean },\n ) => {\n const extensionDir = resolve(dir || '.');\n const manifest = loadAndValidateManifest(extensionDir);\n if (!manifest) {\n process.exit(1);\n }\n\n const ctx = getContextWithOpts();\n loadConfig(ctx.configPath);\n const extensionsDir = resolveExtensionsDir();\n const symlinkPath = setupDevSymlink(extensionDir, extensionsDir, manifest.id);\n\n console.log(\n colors.green('✓'),\n `Dev symlink: ${symlinkPath} → ${extensionDir}`,\n );\n console.log(\n colors.cyan('Note:'),\n 'restart the gateway or trigger config hot-reload so the extension reload picks up changes.',\n );\n\n let debounce: ReturnType<typeof setTimeout> | null = null;\n let watcher: FSWatcher | null = null;\n\n if (options.watch) {\n try {\n watcher = watch(\n extensionDir,\n { recursive: true },\n (_event, filename) => {\n const rel = filename ? String(filename) : '';\n if (rel && shouldIgnorePath(rel)) return;\n if (debounce) clearTimeout(debounce);\n debounce = setTimeout(() => {\n const label = rel || '(unknown)';\n if (/(^|[\\\\/])xopc\\.extension\\.json$/.test(rel) || rel === MANIFEST) {\n console.log(colors.cyan('[watch]'), `manifest: ${label}`);\n } else if (/\\.(html?|css|mjs|js|tsx?|jsx|json)$/i.test(label)) {\n if (/^ui[\\\\/]/.test(rel) || /[\\\\/]ui[\\\\/]/.test(label)) {\n console.log(colors.cyan('[watch]'), `ui: ${label}`);\n } else {\n console.log(colors.cyan('[watch]'), `source: ${label}`);\n }\n } else {\n console.log(colors.cyan('[watch]'), `changed: ${label}`);\n }\n }, 300);\n },\n );\n } catch (e) {\n log.warn({ err: e }, 'fs.watch failed; continuing without watch');\n }\n }\n\n let cleaned = false;\n const cleanup = () => {\n if (cleaned) return;\n cleaned = true;\n if (debounce) clearTimeout(debounce);\n if (watcher) {\n try {\n watcher.close();\n } catch (e) {\n log.warn({ err: e }, 'watcher close failed');\n }\n }\n cleanupSymlink(symlinkPath);\n };\n\n for (const sig of ['SIGINT', 'SIGTERM'] as const) {\n process.on(sig, () => {\n cleanup();\n process.exit(0);\n });\n }\n\n if (!options.gateway) {\n if (options.watch) {\n console.log(colors.cyan('Watching…'), 'Ctrl+C to stop and remove symlink');\n } else {\n console.log(\n colors.cyan('Holding process…'),\n 'Ctrl+C to stop and remove symlink (no file watch)',\n );\n }\n await new Promise(() => {\n /* until SIGINT / SIGTERM */\n });\n return;\n }\n\n const port = parseInt(options.port, 10);\n const host = options.host;\n await ensureGatewayReady(ctx.configPath, ctx.workspacePath, host, port);\n const cfg = loadConfig(ctx.configPath);\n\n if (Number.isNaN(port)) {\n console.error(colors.red('error:'), 'Invalid --port');\n cleanup();\n process.exit(1);\n }\n\n console.log('');\n console.log('🚀 Starting gateway (extension dev)…');\n console.log(` Host: ${host}`);\n console.log(` Port: ${port}`);\n console.log('');\n\n try {\n await runGatewayLoop({\n configPath: ctx.configPath || resolveConfigPath(),\n port,\n start: async () => {\n const server = new GatewayServer({\n host,\n port,\n token: cfg?.gateway?.auth?.token,\n verbose: ctx.isVerbose,\n configPath: ctx.configPath,\n enableHotReload: true,\n });\n await server.start();\n const displayHost = host === '0.0.0.0' ? 'localhost' : host;\n const token = cfg?.gateway?.auth?.token;\n console.log('✅ Gateway started');\n console.log(` URL: http://${displayHost}:${port}`);\n if (token) {\n console.log(\n ` Token: ${String(token).slice(0, 8)}...${String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AAC,MAAM,GAAG,GACpE;AAEH,aAAQ,IAAI,GAAG;AACf,YAAO;;IAEV,CAAC;YACM;AACR,YAAS;;GAGd"}
@@ -7,8 +7,8 @@ import { getExtensionLockfileManager } from "../../extensions/lockfile.js";
7
7
  import { downloadExtensionStoreZipBuffer, resolveExtensionZipDownloadUrl, resolveExtensionsStoreBaseUrl } from "../../agent/skills/marketplace/adapters/store/store-api-client.js";
8
8
  import { fetchRegistry, findExtension, getExtensionMarketplaceStoreBaseUrl, listExtensions, searchExtensions } from "../../extensions/marketplace.js";
9
9
  import { getContextWithOpts } from "../index.js";
10
- import { join, resolve } from "node:path";
11
10
  import { existsSync, readFileSync, rmSync, statSync } from "node:fs";
11
+ import { join, resolve } from "node:path";
12
12
  import { Command } from "commander";
13
13
  import { execSync } from "node:child_process";
14
14
  import semver from "semver";
@@ -4,8 +4,8 @@ import { init_logger } from "../../utils/logger.js";
4
4
  import { normalizeExtensionManifest } from "../../extensions/normalize-manifest.js";
5
5
  import { checkEngineCompatibility } from "../../extensions/engine-check.js";
6
6
  import { colors } from "../utils/colors.js";
7
- import { isAbsolute, join, resolve } from "node:path";
8
7
  import { existsSync, mkdirSync, readFileSync, readdirSync, renameSync, statSync } from "node:fs";
8
+ import { isAbsolute, join, resolve } from "node:path";
9
9
  import { Command } from "commander";
10
10
  import { execSync } from "node:child_process";
11
11
  //#region src/cli/commands/extension-pack.ts
@@ -8,8 +8,8 @@ import { formatExamples, register } from "../registry.js";
8
8
  import { colors } from "../utils/colors.js";
9
9
  import "../../agent/image/index.js";
10
10
  import { getContextWithOpts } from "../index.js";
11
- import { join, resolve } from "node:path";
12
11
  import { mkdir, writeFile } from "node:fs/promises";
12
+ import { join, resolve } from "node:path";
13
13
  import { Command } from "commander";
14
14
  //#region src/cli/commands/image.ts
15
15
  init_loader();
@@ -1,13 +1,13 @@
1
- import { resolveStateDir } from "../../config/paths-state.js";
2
- import { resolveAgentBootstrapDir, resolveAgentWorkspaceDir } from "../../agent/agent-scope.js";
1
+ import { init_write_file_atomic, writeTextAtomic } from "../../infra/write-file-atomic.js";
3
2
  import { createLogger } from "../../utils/logger/index.js";
4
3
  import { init_logger } from "../../utils/logger.js";
4
+ import { resolveStateDir } from "../../config/paths-state.js";
5
+ import { resolveAgentBootstrapDir, resolveAgentWorkspaceDir } from "../../agent/agent-scope.js";
5
6
  import { WORKSPACE_FILES, init_paths, resolveAgentDir, resolveAgentHomeDir, resolveAgentMetadataPath, resolveBinDir, resolveConfigPath, resolveCredentialsDir, resolveCronDir, resolveExtensionsDir, resolveInboxDir, resolveInboxPendingDir, resolveInboxProcessedDir, resolveLogsDir, resolveSessionsDir, resolveSkillsDir, resolveToolsDir, resolveWorkspaceStateDir, resolveWorkspaceStatePath } from "../../config/paths.js";
6
- import { init_write_file_atomic, writeTextAtomic } from "../../infra/write-file-atomic.js";
7
7
  import { init_loader, loadConfig, saveConfig } from "../../config/loader.js";
8
+ import { mkdir, writeFile } from "fs/promises";
8
9
  import { join } from "path";
9
10
  import { existsSync } from "fs";
10
- import { mkdir, writeFile } from "fs/promises";
11
11
  //#region src/cli/commands/init.ts
12
12
  init_write_file_atomic();
13
13
  init_logger();
@@ -1,8 +1,8 @@
1
1
  import { ConfigSchema, init_schema } from "../../config/schema.js";
2
2
  import { init_loader, loadConfig, saveConfig } from "../../config/loader.js";
3
- import { dirname, join } from "node:path";
4
- import { existsSync, mkdirSync, readFileSync } from "node:fs";
5
3
  import { randomBytes } from "node:crypto";
4
+ import { existsSync, mkdirSync, readFileSync } from "node:fs";
5
+ import { dirname, join } from "node:path";
6
6
  //#region src/cli/utils/init-workspace.ts
7
7
  init_schema();
8
8
  init_loader();
@@ -2,14 +2,14 @@ import { ENV_VARS, resolveHomeDir, resolveStateDir } from "./paths-state.js";
2
2
  import { expandWorkspacePathString, init_workspace_path, normalizeWorkspaceDir, resolveWorkspaceRoot } from "./workspace-path.js";
3
3
  import { resolveDefaultAgentWorkspaceDir } from "./workspace-defaults.js";
4
4
  import { resolveAgentBootstrapDir, resolveAgentDir as resolveAgentDir$1, resolveAgentHomeDir as resolveAgentHomeDir$1, resolveAgentWorkspaceDir, resolveSessionsDir as resolveSessionsDir$1 } from "../agent/agent-scope.js";
5
+ import { FILENAMES, WORKSPACE_FILES, existsSync, init_paths, resolveAgentAuthProfilesPath, resolveAgentCredentialsDir, resolveAgentDir, resolveAgentHomeDir, resolveAgentMetadataPath, resolveAuthProfilesPath, resolveBinDir, resolveBundledExtensionsDir, resolveBundledSkillsDir, resolveConfigPath, resolveCredentialsDir, resolveCronDir, resolveCronJobsPath, resolveCronLogPath, resolveCronLogsDir, resolveCronRunsDir, resolveExtensionSdkPath, resolveExtensionsDir, resolveExtensionsLockPath, resolveInboxDir, resolveInboxMessagePath, resolveInboxPendingDir, resolveInboxProcessedDir, resolveLogPath, resolveLogsDir, resolveMemoryDir, resolveMemoryPath, resolveModelsJsonPath, resolveNodeBinDir, resolveNodeBinPath, resolveNodeToolsDir, resolveNpmBinPath, resolveOAuthPath, resolvePidPath, resolveSessionTranscriptPath, resolveSessionTranscriptPathInDir, resolveSessionsArchiveDir, resolveSessionsDir, resolveSessionsIndexPath, resolveSkillPath, resolveSkillsCachePath, resolveSkillsDir, resolveSkillsLockPath, resolveSocketPath, resolveStatusPath, resolveToolsDir, resolveWorkspaceExtensionsDir, resolveWorkspaceFile, resolveWorkspaceStateDir, resolveWorkspaceStatePath, resolveXopcBinPath } from "./paths.js";
5
6
  import { TelegramAccountConfigSchema, TelegramConfigSchema, TelegramGroupConfigSchema, TelegramTopicConfigSchema } from "../../extensions/telegram/src/config-schema.js";
6
7
  import { WeixinAccountConfigSchema, WeixinConfigSchema } from "../../extensions/weixin/src/config-schema.js";
7
8
  import { DingtalkConfigSchema } from "../../extensions/dingtalk/src/config-schema.js";
8
9
  import { AgentConfigSchema, AgentDefaultsSchema, AgentImageGenerationModelSchema, AgentModelRefSchema, AgentsConfigSchema, BindingMatchSchema, BindingRuleSchema, BindingsConfigSchema, ChannelsConfigSchema, ConfigSchema, CronConfigSchema, ExtensionSecurityConfigSchema, ExtensionSlotsConfigSchema, ExtensionsConfigSchema, GatewayAuthRateLimitSchema, GatewayAuthSchema, GatewayChannelConnectDeferModeSchema, GatewayConfigSchema, GoalsConfigSchema, HeartbeatConfigSchema, MessagesConfigSchema, ModelsDevConfigSchema, ProviderAuthConfigSchema, ProviderAzureConfigSchema, ProviderRequestOverridesSchema, ProvidersConfigSchema, STTConfigSchema, STTFallbackConfigSchema, STTProviderConfigSchema, SearchProviderEntrySchema, SessionConfigSchema, SessionDmScopeSchema, SessionStorageConfigSchema, TTSConfigSchema, TTSEdgeConfigSchema, TTSFallbackConfigSchema, TTSModelOverridesConfigSchema, TTSProviderConfigSchema, TTSSummarizationConfigSchema, ToolsConfigSchema, ToolsMediaAudioConfigSchema, ToolsMediaConfigSchema, UpdateAutoConfigSchema, UpdateConfigSchema, WebSearchConfigSchema, WebToolsConfigSchema, WebsiteBlocklistSchema, getAgentDefaultModelRef, getWorkspacePath, init_schema, parseModelRef } from "./schema.js";
10
+ import { init_loader, loadConfig, registerChannelConfigValidator, saveConfig } from "./loader.js";
9
11
  import { applyConfigOverrides, getConfigOverrides, resetConfigOverrides, setConfigOverride, unsetConfigOverride } from "./runtime-overrides.js";
10
12
  import { extractProfileAgentId, resolveEffectiveAgentProfile, resolveEffectiveAgentProfileForSession } from "./agent-profile.js";
11
- import { FILENAMES, WORKSPACE_FILES, existsSync, init_paths, resolveAgentAuthProfilesPath, resolveAgentCredentialsDir, resolveAgentDir, resolveAgentHomeDir, resolveAgentMetadataPath, resolveAuthProfilesPath, resolveBinDir, resolveBundledExtensionsDir, resolveBundledSkillsDir, resolveConfigPath, resolveCredentialsDir, resolveCronDir, resolveCronJobsPath, resolveCronLogPath, resolveCronLogsDir, resolveCronRunsDir, resolveExtensionSdkPath, resolveExtensionsDir, resolveExtensionsLockPath, resolveInboxDir, resolveInboxMessagePath, resolveInboxPendingDir, resolveInboxProcessedDir, resolveLogPath, resolveLogsDir, resolveMemoryDir, resolveMemoryPath, resolveModelsJsonPath, resolveNodeBinDir, resolveNodeBinPath, resolveNodeToolsDir, resolveNpmBinPath, resolveOAuthPath, resolvePidPath, resolveSessionTranscriptPath, resolveSessionTranscriptPathInDir, resolveSessionsArchiveDir, resolveSessionsDir, resolveSessionsIndexPath, resolveSkillPath, resolveSkillsCachePath, resolveSkillsDir, resolveSkillsLockPath, resolveSocketPath, resolveStatusPath, resolveToolsDir, resolveWorkspaceExtensionsDir, resolveWorkspaceFile, resolveWorkspaceStateDir, resolveWorkspaceStatePath, resolveXopcBinPath } from "./paths.js";
12
- import { init_loader, loadConfig, registerChannelConfigValidator, saveConfig } from "./loader.js";
13
13
  import { clearConfigValueCache, getAllowedCommands, getCacheStats, init_resolve_config_value, resolveConfigValue, resolveHeaders, testApiKeyResolution } from "./resolve-config-value.js";
14
14
  import { CustomModelSchema, ModelOverrideSchema, ModelsJsonSchema, OpenAICompatSchema, OpenAICompletionsCompatSchema, OpenAIResponsesCompatSchema, OpenRouterRoutingSchema, ProviderConfigSchema, VercelGatewayRoutingSchema, getDefaultModelValues, init_models_json, loadModelsJson, modelsJsonExists, saveModelsJson, validateModelsConfig } from "./models-json.js";
15
15
  import { formatThinkingLevels, listThinkingLevels, normalizeElevatedMode, normalizeReasoningLevel, normalizeThinkLevel, normalizeVerboseLevel, thinkLevelToNumber } from "../agent/transcript/thinking-types.js";
@@ -1,9 +1,9 @@
1
1
  import { __esmMin } from "../../_virtual/_rolldown/runtime.js";
2
- import { ConfigSchema, init_schema } from "./schema.js";
2
+ import { init_write_file_atomic, writeTextAtomic } from "../infra/write-file-atomic.js";
3
3
  import { createLogger } from "../utils/logger/index.js";
4
4
  import { init_logger } from "../utils/logger.js";
5
5
  import { init_paths, resolveConfigPath } from "./paths.js";
6
- import { init_write_file_atomic, writeTextAtomic } from "../infra/write-file-atomic.js";
6
+ import { ConfigSchema, init_schema } from "./schema.js";
7
7
  import { dirname } from "path";
8
8
  import { existsSync, mkdirSync, promises, readFileSync } from "fs";
9
9
  import { config } from "dotenv";
@@ -1,8 +1,8 @@
1
1
  import { __esmMin } from "../../_virtual/_rolldown/runtime.js";
2
- import { init_paths, resolveModelsJsonPath } from "./paths.js";
3
2
  import { init_write_file_atomic, writeTextAtomicSync } from "../infra/write-file-atomic.js";
4
- import { z } from "zod";
3
+ import { init_paths, resolveModelsJsonPath } from "./paths.js";
5
4
  import { existsSync, readFileSync } from "fs";
5
+ import { z } from "zod";
6
6
  //#region src/config/models-json.ts
7
7
  /**
8
8
  * Models.json configuration types and schema
@@ -1,9 +1,9 @@
1
- import { ENV_VARS, init_paths_state, resolveHomeDir } from "./paths-state.js";
2
1
  import { createLogger } from "../utils/logger/index.js";
3
2
  import { init_logger } from "../utils/logger.js";
3
+ import { ENV_VARS, init_paths_state, resolveHomeDir } from "./paths-state.js";
4
+ import { mkdir, readdir, rm, stat } from "fs/promises";
4
5
  import { join } from "path";
5
6
  import { existsSync } from "fs";
6
- import { mkdir, readdir, rm, stat } from "fs/promises";
7
7
  //#region src/config/profile.ts
8
8
  init_logger();
9
9
  init_paths_state();
@@ -1,7 +1,7 @@
1
- import { init_agent_scope, normalizeAgentId } from "../agent/agent-scope.js";
2
- import { buildSessionKey, init_session_key } from "../routing/session-key.js";
3
1
  import { createLogger } from "../utils/logger/index.js";
4
2
  import { init_logger } from "../utils/logger.js";
3
+ import { init_agent_scope, normalizeAgentId } from "../agent/agent-scope.js";
4
+ import { buildSessionKey, init_session_key } from "../routing/session-key.js";
5
5
  import { bundledChannelPlugins } from "../generated/bundled-channel-plugins.js";
6
6
  import { shouldSilence, stripHeartbeatToken } from "../heartbeat/tokens.js";
7
7
  import { getChannelPlugin, listChannelPlugins, syncChannelPluginsFromManager } from "../channels/plugins/registry.js";
@@ -1,6 +1,6 @@
1
+ import { init_write_file_atomic, writeTextAtomic } from "../infra/write-file-atomic.js";
1
2
  import { createLogger } from "../utils/logger/index.js";
2
3
  import { init_logger } from "../utils/logger.js";
3
- import { init_write_file_atomic, writeTextAtomic } from "../infra/write-file-atomic.js";
4
4
  import { JobDataSchema } from "./validation.js";
5
5
  import { access, readFile } from "fs/promises";
6
6
  //#region src/cron/persistence.ts
@@ -1,8 +1,8 @@
1
1
  import { createLogger } from "../utils/logger/index.js";
2
2
  import { init_logger } from "../utils/logger.js";
3
3
  import { init_paths, resolveCronRunsDir } from "../config/paths.js";
4
- import { join } from "path";
5
4
  import { appendFile, mkdir, readFile, readdir, unlink, writeFile } from "fs/promises";
5
+ import { join } from "path";
6
6
  //#region src/cron/run-log-store.ts
7
7
  init_paths();
8
8
  init_logger();
@@ -1,10 +1,10 @@
1
1
  import { __esmMin, __exportAll } from "../../_virtual/_rolldown/runtime.js";
2
2
  import { createLogger } from "../utils/logger/index.js";
3
3
  import { init_logger } from "../utils/logger.js";
4
- import path from "node:path";
5
- import os from "node:os";
6
4
  import { existsSync } from "node:fs";
7
5
  import { access, constants as constants$1, mkdir, readFile, rm, writeFile } from "node:fs/promises";
6
+ import path from "node:path";
7
+ import os from "node:os";
8
8
  import { spawn, spawnSync } from "node:child_process";
9
9
  //#region src/daemon/launchd.ts
10
10
  /**