@xopcai/xopc 0.0.46 → 0.0.47
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -2
- package/README.zh-CN.md +8 -2
- package/dist/extensions/dingtalk/src/plugin.js +1 -1
- package/dist/extensions/feishu/src/outbound/media-load.js +1 -1
- package/dist/extensions/telegram/src/plugin.js +1 -1
- package/dist/extensions/telegram/src/routing-integration.js +2 -2
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/extensions/weixin/src/api/api.js +2 -2
- package/dist/extensions/weixin/src/auth/accounts.js +1 -1
- package/dist/extensions/weixin/src/cdn/upload.js +1 -1
- package/dist/extensions/weixin/src/media/data-url.js +1 -1
- package/dist/extensions/weixin/src/messaging/debug-mode.js +1 -1
- package/dist/extensions/weixin/src/messaging/inbound.js +1 -1
- package/dist/extensions/weixin/src/messaging/process-message.js +1 -1
- package/dist/extensions/weixin/src/plugin.js +1 -1
- package/dist/extensions/weixin/src/storage/sync-buf.js +1 -1
- package/dist/gateway/static/root/assets/{agents-9tPOBNVa.js → agents-DdWPgyn-.js} +2 -2
- package/dist/gateway/static/root/assets/{agents-9tPOBNVa.js.map → agents-DdWPgyn-.js.map} +1 -1
- package/dist/gateway/static/root/assets/{apps-page-yjXMjZEY.js → apps-page-BTi_W1y1.js} +2 -2
- package/dist/gateway/static/root/assets/{apps-page-yjXMjZEY.js.map → apps-page-BTi_W1y1.js.map} +1 -1
- package/dist/gateway/static/root/assets/{channels-settings-B-vOBJmr.js → channels-settings-CjUmKQrC.js} +2 -2
- package/dist/gateway/static/root/assets/{channels-settings-B-vOBJmr.js.map → channels-settings-CjUmKQrC.js.map} +1 -1
- package/dist/gateway/static/root/assets/{cron-dreaming-jobs-CmdPJHC8.js → cron-dreaming-jobs-DinMur-Z.js} +2 -2
- package/dist/gateway/static/root/assets/{cron-dreaming-jobs-CmdPJHC8.js.map → cron-dreaming-jobs-DinMur-Z.js.map} +1 -1
- package/dist/gateway/static/root/assets/{cron-page-aS5nCGTE.js → cron-page-Bu05Z2oL.js} +2 -2
- package/dist/gateway/static/root/assets/{cron-page-aS5nCGTE.js.map → cron-page-Bu05Z2oL.js.map} +1 -1
- package/dist/gateway/static/root/assets/{dist-COrWk0va.js → dist-wDej8fSi.js} +2 -2
- package/dist/gateway/static/root/assets/{dist-COrWk0va.js.map → dist-wDej8fSi.js.map} +1 -1
- package/dist/gateway/static/root/assets/{extension-debug-page-p7Aufdiu.js → extension-debug-page-CZBu7-zM.js} +2 -2
- package/dist/gateway/static/root/assets/{extension-debug-page-p7Aufdiu.js.map → extension-debug-page-CZBu7-zM.js.map} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-Ca_H5bLy.js → extension-page-CnOyLPrh.js} +2 -2
- package/dist/gateway/static/root/assets/{extension-page-Ca_H5bLy.js.map → extension-page-CnOyLPrh.js.map} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-f8jERrXK.js → extension-settings-page-BOHn3S1a.js} +2 -2
- package/dist/gateway/static/root/assets/{extension-settings-page-f8jERrXK.js.map → extension-settings-page-BOHn3S1a.js.map} +1 -1
- package/dist/gateway/static/root/assets/{heartbeat-config-api-BC5dh16N.js → heartbeat-config-api-OqFXdrMO.js} +2 -2
- package/dist/gateway/static/root/assets/{heartbeat-config-api-BC5dh16N.js.map → heartbeat-config-api-OqFXdrMO.js.map} +1 -1
- package/dist/gateway/static/root/assets/{index-DRnjltLC.js → index-DeELk--t.js} +4 -4
- package/dist/gateway/static/root/assets/{index-DRnjltLC.js.map → index-DeELk--t.js.map} +1 -1
- package/dist/gateway/static/root/assets/{logs-page-CBHnie4a.js → logs-page-DiN42-yE.js} +2 -2
- package/dist/gateway/static/root/assets/{logs-page-CBHnie4a.js.map → logs-page-DiN42-yE.js.map} +1 -1
- package/dist/gateway/static/root/assets/{sessions-page-29vp15ci.js → sessions-page-B5oxRfRm.js} +2 -2
- package/dist/gateway/static/root/assets/{sessions-page-29vp15ci.js.map → sessions-page-B5oxRfRm.js.map} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-Bd1rO8dz.js → settings-page-DaRY3XEp.js} +2 -2
- package/dist/gateway/static/root/assets/{settings-page-Bd1rO8dz.js.map → settings-page-DaRY3XEp.js.map} +1 -1
- package/dist/gateway/static/root/assets/{skills-page-BYppQ88L.js → skills-page-BGDLiQZ6.js} +2 -2
- package/dist/gateway/static/root/assets/{skills-page-BYppQ88L.js.map → skills-page-BGDLiQZ6.js.map} +1 -1
- package/dist/gateway/static/root/assets/{use-image-provider-credentials-DlWCe2d_.js → use-image-provider-credentials-DcP2SYn3.js} +2 -2
- package/dist/gateway/static/root/assets/{use-image-provider-credentials-DlWCe2d_.js.map → use-image-provider-credentials-DcP2SYn3.js.map} +1 -1
- package/dist/gateway/static/root/index.html +1 -1
- package/dist/package.js +1 -1
- package/dist/src/agent/agent-manager.js +6 -6
- package/dist/src/agent/context/workspace-seed.js +2 -2
- package/dist/src/agent/goals/post-turn.js +1 -1
- package/dist/src/agent/image/load-image-media.js +1 -1
- package/dist/src/agent/ipc/bus.js +1 -1
- package/dist/src/agent/ipc/inbox.js +2 -2
- package/dist/src/agent/ipc/socket.js +1 -1
- package/dist/src/agent/memory/builtin-memory-store.js +1 -1
- package/dist/src/agent/memory/dreaming/deep-promotion.js +1 -1
- package/dist/src/agent/memory/dreaming/events.js +1 -1
- package/dist/src/agent/memory/dreaming/last-run.js +1 -1
- package/dist/src/agent/memory/dreaming/light-sweep.js +1 -1
- package/dist/src/agent/memory/dreaming/preview.js +1 -1
- package/dist/src/agent/memory/dreaming/rem-patterns.js +1 -1
- package/dist/src/agent/memory/dreaming/short-term-store.js +1 -1
- package/dist/src/agent/memory/dreaming/utils.js +1 -1
- package/dist/src/agent/memory/plugin-discovery.js +1 -1
- package/dist/src/agent/models/manager.js +1 -1
- package/dist/src/agent/prompt/service-prompt-builder.js +2 -2
- package/dist/src/agent/service.js +5 -5
- package/dist/src/agent/skills/config.js +1 -1
- package/dist/src/agent/skills/hub-hash.js +2 -2
- package/dist/src/agent/skills/hub-lock.js +1 -1
- package/dist/src/agent/skills/hub-pull.js +1 -1
- package/dist/src/agent/skills/index.js +1 -1
- package/dist/src/agent/skills/managed-store.js +1 -1
- package/dist/src/agent/skills/scanner.js +1 -1
- package/dist/src/agent/skills/skill-manage-ops.js +1 -1
- package/dist/src/agent/skills/skill-manager.js +1 -1
- package/dist/src/agent/tools/dreaming-tool.js +1 -1
- package/dist/src/agent/tools/factory.js +1 -1
- package/dist/src/agent/tools/image-generate-tool.js +1 -1
- package/dist/src/agent/tools/send-media.js +1 -1
- package/dist/src/agent/tools/skill-manage-tool.js +1 -1
- package/dist/src/agent/tools/write.js +1 -1
- package/dist/src/auth/credentials.js +3 -3
- package/dist/src/auth/profiles/store.js +1 -1
- package/dist/src/auth/sync-provider-auth.js +1 -1
- package/dist/src/channels/attachments/inbound-persist.js +1 -1
- package/dist/src/channels/attachments/outbound-tts-persist.js +1 -1
- package/dist/src/channels/outbound/persist-store.js +1 -1
- package/dist/src/channels/pairing/allow-from-file.js +1 -1
- package/dist/src/channels/pairing/pairing-store.js +2 -2
- package/dist/src/chat-commands/builtins/config.js +2 -2
- package/dist/src/chat-commands/context.js +1 -1
- package/dist/src/cli/bin.d.ts +7 -0
- package/dist/src/cli/bin.js +4 -0
- package/dist/src/cli/bootstrap-extensions.js +5 -1
- package/dist/src/cli/bootstrap-extensions.js.map +1 -1
- package/dist/src/cli/cli-log-level-preset.d.ts +7 -0
- package/dist/src/cli/cli-log-level-preset.js +13 -0
- package/dist/src/cli/cli-log-level-preset.js.map +1 -0
- package/dist/src/cli/commands/agent.js +2 -2
- package/dist/src/cli/commands/agents.js +1 -1
- package/dist/src/cli/commands/config.js +2 -2
- package/dist/src/cli/commands/doctor/checks/config-health.js +1 -1
- package/dist/src/cli/commands/doctor/checks/provider-auth.js +1 -1
- package/dist/src/cli/commands/doctor/checks/session-integrity.js +1 -1
- package/dist/src/cli/commands/doctor/checks/state-integrity.js +1 -1
- package/dist/src/cli/commands/doctor/checks/workspace-status.js +1 -1
- package/dist/src/cli/commands/extension-dev.js +1 -1
- package/dist/src/cli/commands/extension-marketplace.js +1 -1
- package/dist/src/cli/commands/extension-pack.js +1 -1
- package/dist/src/cli/commands/gateway.js +1 -1
- package/dist/src/cli/commands/image.js +1 -1
- package/dist/src/cli/commands/init.js +4 -4
- package/dist/src/cli/commands/models.js +1 -1
- package/dist/src/cli/commands/onboard.js +1 -1
- package/dist/src/cli/commands/update.js +1 -1
- package/dist/src/cli/index.d.ts +0 -1
- package/dist/src/cli/index.js +1 -1
- package/dist/src/cli/index.js.map +1 -1
- package/dist/src/cli/utils/init-workspace.js +2 -2
- package/dist/src/config/index.js +2 -2
- package/dist/src/config/loader.js +2 -2
- package/dist/src/config/models-json.js +2 -2
- package/dist/src/config/profile.js +2 -2
- package/dist/src/cron/executor.js +2 -2
- package/dist/src/cron/persistence.js +1 -1
- package/dist/src/cron/run-log-store.js +1 -1
- package/dist/src/daemon/launchd.js +2 -2
- package/dist/src/daemon/systemd.js +2 -2
- package/dist/src/extensions/health.js +1 -1
- package/dist/src/extensions/loader.d.ts +5 -0
- package/dist/src/extensions/loader.js +19 -3
- package/dist/src/extensions/loader.js.map +1 -1
- package/dist/src/extensions/lockfile.js +2 -2
- package/dist/src/gateway/agents-admin.js +2 -2
- package/dist/src/gateway/hono/lib/extension-store.js +1 -1
- package/dist/src/gateway/hono/lib/static-ui.js +1 -1
- package/dist/src/gateway/hono/oauth.js +1 -1
- package/dist/src/gateway/hono/routes/auth-registry-extensions.js +1 -1
- package/dist/src/gateway/hono/routes/config.js +1 -1
- package/dist/src/gateway/hono/routes/dreaming.js +1 -1
- package/dist/src/gateway/hono/routes/host-fs.js +1 -1
- package/dist/src/gateway/hono/routes/models.js +1 -1
- package/dist/src/gateway/hono/routes/workspace.js +3 -3
- package/dist/src/gateway/hono/sse.js +2 -2
- package/dist/src/gateway/lock.js +2 -2
- package/dist/src/gateway/service/run-gateway-agent.js +2 -2
- package/dist/src/gateway/service.js +5 -5
- package/dist/src/gateway/workspace-fs-file-list.js +1 -1
- package/dist/src/gateway/workspace-heartbeat-path.js +1 -1
- package/dist/src/infra/update-check.js +1 -1
- package/dist/src/infra/update-lock.js +3 -3
- package/dist/src/infra/update-runner.js +2 -2
- package/dist/src/infra/update-runner.js.map +1 -1
- package/dist/src/infra/update-startup.js +2 -2
- package/dist/src/infra/write-file-atomic.js +2 -2
- package/dist/src/providers/auth-runtime/auth-profile-store.js +1 -1
- package/dist/src/providers/index.js +2 -2
- package/dist/src/providers/model-registry.js +1 -1
- package/dist/src/session/config-store.js +2 -2
- package/dist/src/session/search-index-cache.js +1 -1
- package/dist/src/session/search-index.js +1 -1
- package/dist/src/session/session-title.js +1 -1
- package/dist/src/session/store.js +5 -5
- package/dist/src/tui/backends/embedded-backend.js +1 -1
- package/dist/src/tui/tui.js +1 -1
- package/dist/src/utils/logger/audit.js +1 -1
- package/dist/src/utils/logger/log-store.js +1 -1
- package/dist/src/utils/logger/rotation.js +1 -1
- package/dist/src/voice/tts/audio.js +1 -1
- package/dist/src/voice/tts/providers/edge-speech.js +1 -1
- package/package.json +7 -7
- package/dist/src/cli/agent-chat-log-level-preset.d.ts +0 -8
- package/dist/src/cli/agent-chat-log-level-preset.js +0 -25
- package/dist/src/cli/agent-chat-log-level-preset.js.map +0 -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 {
|
|
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,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();
|
|
@@ -5,15 +5,19 @@ import "../infra/bus/index.js";
|
|
|
5
5
|
import { collectConfiguredChannelIds } from "../extensions/activation-context.js";
|
|
6
6
|
import { ExtensionLoader } from "../extensions/loader.js";
|
|
7
7
|
import "../extensions/index.js";
|
|
8
|
+
import { createDefaultContext } from "./registry.js";
|
|
8
9
|
import "../config/index.js";
|
|
9
10
|
import { registerExtensionCliProgram } from "../extensions/sdk/channel-helpers.js";
|
|
10
|
-
import { createDefaultContext } from "./registry.js";
|
|
11
11
|
import { join } from "path";
|
|
12
12
|
//#region src/cli/bootstrap-extensions.ts
|
|
13
|
+
function argvRequestsVersionOnly(argv) {
|
|
14
|
+
return argv.includes("--version") || argv.includes("-V");
|
|
15
|
+
}
|
|
13
16
|
/**
|
|
14
17
|
* Load extensions that may register CLI commands (manifest-only skip when nothing would activate).
|
|
15
18
|
*/
|
|
16
19
|
async function registerExtensionCliCommands(program) {
|
|
20
|
+
if (argvRequestsVersionOnly(process.argv)) return;
|
|
17
21
|
const ctx = createDefaultContext(process.argv, {});
|
|
18
22
|
const config = loadConfig(ctx.configPath);
|
|
19
23
|
const workspace = getWorkspacePath(config) || ctx.workspacePath;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bootstrap-extensions.js","names":[],"sources":["../../../src/cli/bootstrap-extensions.ts"],"sourcesContent":["import { Command } from 'commander';\nimport { join } from 'path';\nimport { MessageBus } from '../infra/bus/index.js';\nimport { loadConfig, getWorkspacePath } from '../config/index.js';\nimport { collectConfiguredChannelIds } from '../extensions/activation-context.js';\nimport { ExtensionLoader } from '../extensions/index.js';\nimport { registerExtensionCliProgram } from '../extensions/sdk/channel-helpers.js';\nimport { createDefaultContext } from './registry.js';\n\n/**\n * Load extensions that may register CLI commands (manifest-only skip when nothing would activate).\n */\nexport async function registerExtensionCliCommands(program: Command): Promise<void> {\n const ctx = createDefaultContext(process.argv, {});\n const config = loadConfig(ctx.configPath);\n const workspace = getWorkspacePath(config) || ctx.workspacePath;\n\n const rawExt = (config as Record<string, unknown>).extensions;\n const extBlock =\n rawExt && typeof rawExt === 'object' && !Array.isArray(rawExt)\n ? (rawExt as Record<string, unknown>)\n : undefined;\n const enabledIds = Array.isArray(extBlock?.enabled)\n ? extBlock!.enabled.filter((x): x is string => typeof x === 'string')\n : [];\n\n const bus = new MessageBus();\n const loader = new ExtensionLoader({\n workspaceDir: workspace,\n extensionsDir: join(workspace, '.extensions'),\n });\n loader.setConfig(config as Parameters<ExtensionLoader['setConfig']>[0]);\n\n const registry = loader.buildManifestRegistry();\n const envWouldActivate = registry.detectAvailableByEnv(process.env).length > 0;\n const channelWouldActivate = (collectConfiguredChannelIds(config)?.length ?? 0) > 0;\n\n if (enabledIds.length === 0 && !channelWouldActivate && !envWouldActivate) {\n return;\n }\n\n loader.setRuntimeContext({ bus });\n await loader.loadByActivationPlan();\n registerExtensionCliProgram(program, loader.getRegistry());\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"bootstrap-extensions.js","names":[],"sources":["../../../src/cli/bootstrap-extensions.ts"],"sourcesContent":["import { Command } from 'commander';\nimport { join } from 'path';\nimport { MessageBus } from '../infra/bus/index.js';\nimport { loadConfig, getWorkspacePath } from '../config/index.js';\nimport { collectConfiguredChannelIds } from '../extensions/activation-context.js';\nimport { ExtensionLoader } from '../extensions/index.js';\nimport { registerExtensionCliProgram } from '../extensions/sdk/channel-helpers.js';\nimport { createDefaultContext } from './registry.js';\n\nfunction argvRequestsVersionOnly(argv: string[]): boolean {\n return argv.includes('--version') || argv.includes('-V');\n}\n\n/**\n * Load extensions that may register CLI commands (manifest-only skip when nothing would activate).\n */\nexport async function registerExtensionCliCommands(program: Command): Promise<void> {\n if (argvRequestsVersionOnly(process.argv)) {\n return;\n }\n\n const ctx = createDefaultContext(process.argv, {});\n const config = loadConfig(ctx.configPath);\n const workspace = getWorkspacePath(config) || ctx.workspacePath;\n\n const rawExt = (config as Record<string, unknown>).extensions;\n const extBlock =\n rawExt && typeof rawExt === 'object' && !Array.isArray(rawExt)\n ? (rawExt as Record<string, unknown>)\n : undefined;\n const enabledIds = Array.isArray(extBlock?.enabled)\n ? extBlock!.enabled.filter((x): x is string => typeof x === 'string')\n : [];\n\n const bus = new MessageBus();\n const loader = new ExtensionLoader({\n workspaceDir: workspace,\n extensionsDir: join(workspace, '.extensions'),\n });\n loader.setConfig(config as Parameters<ExtensionLoader['setConfig']>[0]);\n\n const registry = loader.buildManifestRegistry();\n const envWouldActivate = registry.detectAvailableByEnv(process.env).length > 0;\n const channelWouldActivate = (collectConfiguredChannelIds(config)?.length ?? 0) > 0;\n\n if (enabledIds.length === 0 && !channelWouldActivate && !envWouldActivate) {\n return;\n }\n\n loader.setRuntimeContext({ bus });\n await loader.loadByActivationPlan();\n registerExtensionCliProgram(program, loader.getRegistry());\n}\n"],"mappings":";;;;;;;;;;;;AASA,SAAS,wBAAwB,MAAyB;AACxD,QAAO,KAAK,SAAS,YAAY,IAAI,KAAK,SAAS,KAAK;;;;;AAM1D,eAAsB,6BAA6B,SAAiC;AAClF,KAAI,wBAAwB,QAAQ,KAAK,CACvC;CAGF,MAAM,MAAM,qBAAqB,QAAQ,MAAM,EAAE,CAAC;CAClD,MAAM,SAAS,WAAW,IAAI,WAAW;CACzC,MAAM,YAAY,iBAAiB,OAAO,IAAI,IAAI;CAElD,MAAM,SAAU,OAAmC;CACnD,MAAM,WACJ,UAAU,OAAO,WAAW,YAAY,CAAC,MAAM,QAAQ,OAAO,GACzD,SACD,KAAA;CACN,MAAM,aAAa,MAAM,QAAQ,UAAU,QAAQ,GAC/C,SAAU,QAAQ,QAAQ,MAAmB,OAAO,MAAM,SAAS,GACnE,EAAE;CAEN,MAAM,MAAM,IAAI,YAAY;CAC5B,MAAM,SAAS,IAAI,gBAAgB;EACjC,cAAc;EACd,eAAe,KAAK,WAAW,cAAc;EAC9C,CAAC;AACF,QAAO,UAAU,OAAsD;CAGvE,MAAM,mBADW,OAAO,uBACS,CAAC,qBAAqB,QAAQ,IAAI,CAAC,SAAS;CAC7E,MAAM,wBAAwB,4BAA4B,OAAO,EAAE,UAAU,KAAK;AAElF,KAAI,WAAW,WAAW,KAAK,CAAC,wBAAwB,CAAC,iBACvD;AAGF,QAAO,kBAAkB,EAAE,KAAK,CAAC;AACjC,OAAM,OAAO,sBAAsB;AACnC,6BAA4B,SAAS,OAAO,aAAa,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Default the CLI console to `warn` when no log level is set, so routine `info`
|
|
3
|
+
* output (extensions, diagnostics, etc.) does not clutter the terminal.
|
|
4
|
+
* Opt in with `XOPC_LOG_LEVEL`, `LOG_LEVEL`, `DEBUG`, or `--verbose` / `-v`.
|
|
5
|
+
* This module must load before any import of `../utils/logger.js`.
|
|
6
|
+
*/
|
|
7
|
+
declare const env: NodeJS.ProcessEnv;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
//#region src/cli/cli-log-level-preset.ts
|
|
2
|
+
/**
|
|
3
|
+
* Default the CLI console to `warn` when no log level is set, so routine `info`
|
|
4
|
+
* output (extensions, diagnostics, etc.) does not clutter the terminal.
|
|
5
|
+
* Opt in with `XOPC_LOG_LEVEL`, `LOG_LEVEL`, `DEBUG`, or `--verbose` / `-v`.
|
|
6
|
+
* This module must load before any import of `../utils/logger.js`.
|
|
7
|
+
*/
|
|
8
|
+
const env = process.env;
|
|
9
|
+
if (!env.VITEST && !env.TEST && !env.XOPC_LOG_LEVEL && !env.LOG_LEVEL && !env.DEBUG && !process.argv.includes("--verbose") && !process.argv.includes("-v")) env.XOPC_LOG_LEVEL = "warn";
|
|
10
|
+
//#endregion
|
|
11
|
+
export {};
|
|
12
|
+
|
|
13
|
+
//# sourceMappingURL=cli-log-level-preset.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli-log-level-preset.js","names":[],"sources":["../../../src/cli/cli-log-level-preset.ts"],"sourcesContent":["/**\n * Default the CLI console to `warn` when no log level is set, so routine `info`\n * output (extensions, diagnostics, etc.) does not clutter the terminal.\n * Opt in with `XOPC_LOG_LEVEL`, `LOG_LEVEL`, `DEBUG`, or `--verbose` / `-v`.\n * This module must load before any import of `../utils/logger.js`.\n */\nconst env = process.env;\nif (\n !env.VITEST &&\n !env.TEST &&\n !env.XOPC_LOG_LEVEL &&\n !env.LOG_LEVEL &&\n !env.DEBUG &&\n !process.argv.includes('--verbose') &&\n !process.argv.includes('-v')\n) {\n env.XOPC_LOG_LEVEL = 'warn';\n}\n"],"mappings":";;;;;;;AAMA,MAAM,MAAM,QAAQ;AACpB,IACE,CAAC,IAAI,UACL,CAAC,IAAI,QACL,CAAC,IAAI,kBACL,CAAC,IAAI,aACL,CAAC,IAAI,SACL,CAAC,QAAQ,KAAK,SAAS,YAAY,IACnC,CAAC,QAAQ,KAAK,SAAS,KAAK,CAE5B,KAAI,iBAAiB"}
|
|
@@ -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";
|
|
@@ -8,8 +8,8 @@ import { ExtensionLoader } from "../../extensions/loader.js";
|
|
|
8
8
|
import "../../extensions/index.js";
|
|
9
9
|
import { AgentService } from "../../agent/service.js";
|
|
10
10
|
import "../../agent/index.js";
|
|
11
|
-
import "../../config/index.js";
|
|
12
11
|
import { formatExamples, register } from "../registry.js";
|
|
12
|
+
import "../../config/index.js";
|
|
13
13
|
import { listSessions } from "./agent/sessions.js";
|
|
14
14
|
import { renderStreamToTerminal } from "./agent/stream-renderer.js";
|
|
15
15
|
import { startInteractiveChat } from "./agent/interactive.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,9 +1,9 @@
|
|
|
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
|
-
import "../../config/index.js";
|
|
6
5
|
import { formatExamples, register } from "../registry.js";
|
|
6
|
+
import "../../config/index.js";
|
|
7
7
|
import { existsSync } from "fs";
|
|
8
8
|
import { Command } from "commander";
|
|
9
9
|
//#region src/cli/commands/config.ts
|
|
@@ -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,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();
|
|
@@ -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
|
|
@@ -2,8 +2,8 @@ import { createLogger } from "../../utils/logger/index.js";
|
|
|
2
2
|
import { init_logger } from "../../utils/logger.js";
|
|
3
3
|
import { init_paths, resolveConfigPath } from "../../config/paths.js";
|
|
4
4
|
import { loadConfig } from "../../config/loader.js";
|
|
5
|
-
import "../../config/index.js";
|
|
6
5
|
import { formatExamples, register } from "../registry.js";
|
|
6
|
+
import "../../config/index.js";
|
|
7
7
|
import { seedMainAgentBootstrap } from "../../agent/context/workspace-seed.js";
|
|
8
8
|
import { initWorkspace } from "../utils/init-workspace.js";
|
|
9
9
|
import { GatewayServer } from "../../gateway/server.js";
|
|
@@ -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 {
|
|
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,7 +1,7 @@
|
|
|
1
1
|
import { loadConfig } from "../../config/loader.js";
|
|
2
2
|
import { getAllModels, getAvailableModels, getConfiguredProviders, init_providers, isProviderConfigured } from "../../providers/index.js";
|
|
3
|
-
import "../../config/index.js";
|
|
4
3
|
import { formatExamples, register } from "../registry.js";
|
|
4
|
+
import "../../config/index.js";
|
|
5
5
|
import { getContextWithOpts } from "../index.js";
|
|
6
6
|
import { Command } from "commander";
|
|
7
7
|
//#region src/cli/commands/models.ts
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ConfigSchema, init_schema } from "../../config/schema.js";
|
|
2
2
|
import { saveConfig } from "../../config/loader.js";
|
|
3
3
|
import { isWeixinOnboardConfigured } from "../../../extensions/weixin/src/adapters/onboard-cli.js";
|
|
4
|
-
import "../../config/index.js";
|
|
5
4
|
import { formatExamples, register } from "../registry.js";
|
|
5
|
+
import "../../config/index.js";
|
|
6
6
|
import { seedMainAgentBootstrap } from "../../agent/context/workspace-seed.js";
|
|
7
7
|
import { initWorkspace } from "../utils/init-workspace.js";
|
|
8
8
|
import { colors } from "../utils/colors.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { PACKAGE_VERSION, init_package_version } from "../../package-version.js";
|
|
2
2
|
import { loadConfig } from "../../config/loader.js";
|
|
3
|
-
import "../../config/index.js";
|
|
4
3
|
import { formatExamples, register } from "../registry.js";
|
|
4
|
+
import "../../config/index.js";
|
|
5
5
|
import { normalizeUpdateChannel } from "../../infra/update-channels.js";
|
|
6
6
|
import { compareSemver, detectInstallKind, resolveNpmChannelTag, resolvePackageRoot } from "../../infra/update-check.js";
|
|
7
7
|
import { Command } from "commander";
|
package/dist/src/cli/index.d.ts
CHANGED
package/dist/src/cli/index.js
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
import { version } from "../../package.js";
|
|
3
3
|
import { flushAndClose } from "../utils/logger/shutdown.js";
|
|
4
4
|
import { init_logger } from "../utils/logger.js";
|
|
5
|
-
import "./agent-chat-log-level-preset.js";
|
|
6
5
|
import { createDefaultContext, registry } from "./registry.js";
|
|
7
6
|
import { registerExtensionCliCommands } from "./bootstrap-extensions.js";
|
|
8
7
|
import "./commands/setup.js";
|
|
@@ -25,6 +24,7 @@ import "./commands/logs.js";
|
|
|
25
24
|
import { registerAgentsCli } from "./commands/agents.js";
|
|
26
25
|
import { Command } from "commander";
|
|
27
26
|
//#region src/cli/index.ts
|
|
27
|
+
/** Command wiring and `program.parse`; executable entry is `bin.ts` (log preset before logger init). */
|
|
28
28
|
init_logger();
|
|
29
29
|
let parsedOpts = {};
|
|
30
30
|
function getContextWithOpts(argv = process.argv) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["pkg.version"],"sources":["../../../src/cli/index.ts"],"sourcesContent":["#!/usr/bin/env node\
|
|
1
|
+
{"version":3,"file":"index.js","names":["pkg.version"],"sources":["../../../src/cli/index.ts"],"sourcesContent":["#!/usr/bin/env node\n/** Command wiring and `program.parse`; executable entry is `bin.ts` (log preset before logger init). */\nimport { Command } from 'commander';\nimport { registry, createDefaultContext, type CLIContext } from './registry.js';\nimport pkg from '../../package.json' with { type: 'json' };\nimport { flushAndClose } from '../utils/logger.js'; // Import flushAndClose for graceful shutdown\nimport { registerExtensionCliCommands } from './bootstrap-extensions.js';\n\n// Import order determines display order in help\nimport './commands/setup.js';\nimport './commands/onboard.js';\nimport './commands/agent.js';\nimport './commands/tui.js';\nimport './commands/gateway.js';\nimport './commands/session.js';\nimport './commands/cron.js';\nimport './commands/config.js';\nimport './commands/doctor/index.js';\nimport './commands/image.js';\nimport './commands/channels.js';\nimport './commands/models.js';\nimport { registerExtensionCommands } from './commands/extension.js';\nimport './commands/auth.js';\nimport './commands/skills.js';\nimport './commands/update.js';\nimport './commands/logs.js';\nimport { registerAgentsCli } from './commands/agents.js';\n\n// Global parsed options - updated before each command\nexport let parsedOpts: { config?: string; workspace?: string; verbose?: boolean } = {};\n\nexport function getContextWithOpts(argv: string[] = process.argv): CLIContext {\n return createDefaultContext(argv, parsedOpts);\n}\n\n// Long-running commands that should not auto-exit\nconst LONG_RUNNING_COMMANDS = new Set(['gateway', 'agent', 'tui', 'extension:dev']);\n\nconst program = new Command()\n .name('xopc')\n .description('Ultra-Lightweight Personal AI Assistant')\n .version(pkg.version)\n .option('--verbose', 'Enable verbose logging', false)\n .option('--config <path>', 'Config file path')\n .option('--workspace <path>', 'Workspace directory');\n\n// Hook to capture parsed options before each command runs\nprogram.hook('preAction', (thisCommand) => {\n parsedOpts = thisCommand.opts();\n});\n\n// Hook to ensure process exits after command completion\n// Second arg is the command whose action ran; the first is the ancestor that registered the hook\n// (often the root program), so using only the first arg mis-detects the subcommand as \"xopc\".\nprogram.hook('postAction', async (_hookOwner, actionCommand) => {\n const cmd = actionCommand ?? program;\n const args = cmd.args;\n const subCommandName = args.length > 0 ? args[0] : cmd.name();\n\n // Skip long-running commands (gateway foreground, agent interactive mode)\n if (LONG_RUNNING_COMMANDS.has(subCommandName)) {\n // For agent command, only skip exit if interactive mode (-i) is used\n if (subCommandName === 'agent') {\n const hasInteractiveFlag = process.argv.includes('-i') || process.argv.includes('--interactive');\n if (!hasInteractiveFlag) {\n // Agent in non-interactive mode should exit normally\n await flushAndClose();\n process.exit(0);\n }\n }\n // Gateway or agent -i: don't exit\n return;\n }\n // For all other commands, flush logs and exit\n await flushAndClose();\n process.exit(0);\n});\n\n// Create initial context (will use env vars and defaults)\nconst ctx = getContextWithOpts(process.argv);\nregistry.install(program, ctx);\nregisterAgentsCli(program);\nregisterExtensionCommands(program);\n\n// Only parse if this is the main module being executed directly\n// Skip parsing when imported as module (e.g., in tests)\nconst isTestEnv = !!process.env.VITEST || !!process.env.TEST || !!process.env.NODE_ENV?.includes('test');\nconst isMainModule = !isTestEnv && import.meta.url.startsWith('file:');\n\nif (isMainModule) {\n // Filter out standalone '--' separator (passed by pnpm run -- <cmd>)\n // npm removes it automatically, pnpm passes it through\n const argv = process.argv.filter((arg, index) => {\n if (arg !== '--') return true;\n // Only filter '--' if it's the separator between script and command\n // (i.e., comes after the script name and before actual args)\n return index < 2; // Keep '--' if it's a script argument (index 0 or 1)\n });\n void registerExtensionCliCommands(program).then(() => {\n program.parse(argv);\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;aAKmD;AAwBnD,IAAW,aAAyE,EAAE;AAEtF,SAAgB,mBAAmB,OAAiB,QAAQ,MAAkB;AAC5E,QAAO,qBAAqB,MAAM,WAAW;;AAI/C,MAAM,wBAAwB,IAAI,IAAI;CAAC;CAAW;CAAS;CAAO;CAAgB,CAAC;AAEnF,MAAM,UAAU,IAAI,SAAS,CAC1B,KAAK,OAAO,CACZ,YAAY,0CAA0C,CACtD,QAAQA,QAAY,CACpB,OAAO,aAAa,0BAA0B,MAAM,CACpD,OAAO,mBAAmB,mBAAmB,CAC7C,OAAO,sBAAsB,sBAAsB;AAGtD,QAAQ,KAAK,cAAc,gBAAgB;AACzC,cAAa,YAAY,MAAM;EAC/B;AAKF,QAAQ,KAAK,cAAc,OAAO,YAAY,kBAAkB;CAC9D,MAAM,MAAM,iBAAiB;CAC7B,MAAM,OAAO,IAAI;CACjB,MAAM,iBAAiB,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI,MAAM;AAG7D,KAAI,sBAAsB,IAAI,eAAe,EAAE;AAE7C,MAAI,mBAAmB;OAEjB,EADuB,QAAQ,KAAK,SAAS,KAAK,IAAI,QAAQ,KAAK,SAAS,gBAAgB,GACvE;AAEvB,UAAM,eAAe;AACrB,YAAQ,KAAK,EAAE;;;AAInB;;AAGF,OAAM,eAAe;AACrB,SAAQ,KAAK,EAAE;EACf;AAGF,MAAM,MAAM,mBAAmB,QAAQ,KAAK;AAC5C,SAAS,QAAQ,SAAS,IAAI;AAC9B,kBAAkB,QAAQ;AAC1B,0BAA0B,QAAQ;AAOlC,IAFqB,EADH,CAAC,CAAC,QAAQ,IAAI,UAAU,CAAC,CAAC,QAAQ,IAAI,QAAQ,CAAC,CAAA,cAAuB,SAAS,OAAO,KACrE,OAAO,KAAK,IAAI,WAAW,QAAQ,EAEpD;CAGhB,MAAM,OAAO,QAAQ,KAAK,QAAQ,KAAK,UAAU;AAC/C,MAAI,QAAQ,KAAM,QAAO;AAGzB,SAAO,QAAQ;GACf;AACG,8BAA6B,QAAQ,CAAC,WAAW;AACpD,UAAQ,MAAM,KAAK;GACnB"}
|