@cjhyy/code-shell 0.1.0-alpha.0 → 0.1.0-alpha.2
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/CHANGELOG.md +39 -0
- package/README.md +8 -0
- package/dist/anthropic-P5VETAFI.cjs +10 -0
- package/dist/{anthropic-NENYS535.js → anthropic-W2GU3D76.js} +3 -2
- package/dist/arena/context/context-tools.d.ts +1 -1
- package/dist/arena/index.cjs +4 -4
- package/dist/arena/index.js +3 -3
- package/dist/arena/providers/index.d.ts +19 -3
- package/dist/arena/strategies/utils.d.ts +6 -1
- package/dist/arena/types.d.ts +10 -1
- package/dist/{arena-46QQ6BZQ.js → arena-ENHBHB2W.js} +5 -7
- package/dist/{arena-HZZZ2GJH.cjs → arena-HHDYYVHJ.cjs} +19 -21
- package/dist/{chunk-BE6IPRDM.js → chunk-2EUAE7AY.js} +1 -1
- package/dist/{chunk-WFQF3RT4.cjs → chunk-3CAZIWUA.cjs} +11 -8
- package/dist/{chunk-J5XW6UYL.js → chunk-5C5HIOML.js} +63 -4
- package/dist/chunk-75E4BBFC.js +224 -0
- package/dist/{chunk-ZJV3YSY3.cjs → chunk-BUJ5KYCI.cjs} +53 -11
- package/dist/{chunk-BMH65OVB.cjs → chunk-C7C7ZZY4.cjs} +8 -8
- package/dist/{chunk-KO2FPF7G.js → chunk-F5BS3GUC.js} +20 -2
- package/dist/chunk-FA5KD34T.js +54 -0
- package/dist/chunk-FV2ARONZ.cjs +224 -0
- package/dist/chunk-G76E5FOB.cjs +54 -0
- package/dist/{chunk-DICG4AB7.cjs → chunk-GZBD6QRS.cjs} +42 -3
- package/dist/{chunk-FVP7XJGS.cjs → chunk-HOXQLX5R.cjs} +406 -196
- package/dist/{chunk-4PKZPFCD.js → chunk-I57ZD5IQ.js} +47 -14
- package/dist/{chunk-7RMAR2Y3.js → chunk-ID6EJUHP.js} +1959 -473
- package/dist/chunk-JHNCK7JP.cjs +202 -0
- package/dist/{chunk-R32DJSJE.cjs → chunk-JHXNOB5G.cjs} +8 -5
- package/dist/{chunk-UK2SU23S.cjs → chunk-KOGV6PDQ.cjs} +20 -2
- package/dist/{chunk-VKGNCYRL.js → chunk-LMEKCQX4.js} +95 -13
- package/dist/{chunk-3EAEC566.cjs → chunk-M2QI5X3X.cjs} +51 -18
- package/dist/{chunk-YZ25SSWJ.js → chunk-M2SVOKC6.js} +46 -4
- package/dist/chunk-OMRGA6TI.js +4753 -0
- package/dist/{chunk-NG73UR3L.cjs → chunk-OP57WUWQ.cjs} +23 -1
- package/dist/{chunk-ZXYDDJEJ.js → chunk-OUC2DFA7.js} +2 -2
- package/dist/{chunk-6JOOLG6F.js → chunk-REFCCVDM.js} +5 -2
- package/dist/{chunk-O6F2EF2Z.js → chunk-SCDKLTN3.js} +41 -2
- package/dist/{chunk-BHGIJ2DJ.js → chunk-SW3L7HIM.js} +6 -3
- package/dist/chunk-TATCTZSB.cjs +4753 -0
- package/dist/{chunk-QHDYFC5U.cjs → chunk-VWFET3MG.cjs} +2132 -646
- package/dist/{chunk-3EUDE77E.cjs → chunk-X2DNIMPC.cjs} +19 -19
- package/dist/{chunk-SQZHPD3S.js → chunk-Y7TSCDF6.js} +297 -87
- package/dist/{chunk-WHRTARDJ.cjs → chunk-YAFCN7ZW.cjs} +112 -30
- package/dist/{chunk-LRAY5IYC.cjs → chunk-YD7XTI7T.cjs} +65 -6
- package/dist/{chunk-S74VVJBF.js → chunk-ZLPJJZUW.js} +23 -1
- package/dist/chunk-ZRVPCXI7.js +202 -0
- package/dist/cli/commands/builtin/advanced-commands.d.ts +1 -1
- package/dist/cli/commands/builtin/extra-commands.d.ts +2 -2
- package/dist/cli/commands/builtin/more-commands.d.ts +1 -3
- package/dist/cli/commands/registry.d.ts +8 -0
- package/dist/cli/cost-tracker.d.ts +6 -0
- package/dist/cli/main.cjs +3576 -2036
- package/dist/cli/main.js +3613 -2073
- package/dist/cli/onboarding.d.ts +67 -14
- package/dist/client-base-TOVE25FA.js +9 -0
- package/dist/client-base-VDDIADAC.cjs +9 -0
- package/dist/compaction-D3KV2NWY.cjs +31 -0
- package/dist/{compaction-CCHWA4G6.js → compaction-YNWCEF7B.js} +1 -2
- package/dist/context/manager.d.ts +9 -0
- package/dist/data/openrouter-models.d.ts +35 -0
- package/dist/data/openrouter-sync.d.ts +16 -0
- package/dist/{devtools-KIY3LWQJ.js → devtools-IRQQPIRY.js} +1 -1
- package/dist/{devtools-LRP47DDV.cjs → devtools-WTC3NFNE.cjs} +1 -1
- package/dist/engine/engine.d.ts +39 -4
- package/dist/engine/turn-loop.d.ts +13 -4
- package/dist/engine/turn-state.d.ts +6 -0
- package/dist/index.cjs +19 -28
- package/dist/index.d.ts +1 -1
- package/dist/index.js +28 -37
- package/dist/llm/client-base.d.ts +7 -0
- package/dist/llm/model-pool.d.ts +4 -0
- package/dist/logging/logger.d.ts +69 -8
- package/dist/manager-FWLOVEEK.cjs +7 -0
- package/dist/manager-GEXJLOIS.js +7 -0
- package/dist/{mcp-manager-OKXHHWYR.js → mcp-manager-37GQLFGX.js} +2 -2
- package/dist/mcp-manager-U77NEXBY.cjs +8 -0
- package/dist/memory-ADGOWADP.cjs +9 -0
- package/dist/memory-EPFDBPII.js +9 -0
- package/dist/native-ts/yoga-layout/index.d.ts +2 -2
- package/dist/{openai-5HQGBL4L.js → openai-RXU5URYI.js} +3 -2
- package/dist/openai-SQW4H2K4.cjs +10 -0
- package/dist/openrouter-models-OL725CL6.js +15 -0
- package/dist/openrouter-models-UM3AOGZ4.cjs +15 -0
- package/dist/openrouter-sync-CWD5VNW2.js +11 -0
- package/dist/openrouter-sync-HYZZC6RX.cjs +11 -0
- package/dist/product/index.cjs +12 -16
- package/dist/product/index.js +11 -15
- package/dist/product/types.d.ts +2 -7
- package/dist/protocol/types.d.ts +11 -3
- package/dist/{ink → render}/hooks/use-input.d.ts +1 -1
- package/dist/run/EngineRunner.d.ts +3 -1
- package/dist/run/RunManager.d.ts +6 -0
- package/dist/run/factory.d.ts +7 -1
- package/dist/run/index.cjs +12 -16
- package/dist/run/index.js +11 -15
- package/dist/session/memory.d.ts +23 -3
- package/dist/session/session-manager.d.ts +4 -1
- package/dist/{session-manager-UQKB564H.cjs → session-manager-HRSKENKB.cjs} +2 -2
- package/dist/{session-manager-JIIBCFTC.js → session-manager-NEKFEHF3.js} +1 -1
- package/dist/settings/manager.d.ts +9 -0
- package/dist/settings/schema.d.ts +48 -39
- package/dist/{tool-summary-J2ICNMWP.js → tool-summary-2RUFL5QK.js} +1 -1
- package/dist/{tool-summary-5P2GKRA4.cjs → tool-summary-RYNR4DDB.cjs} +2 -2
- package/dist/tool-system/builtin/agent-registry.d.ts +36 -0
- package/dist/tool-system/builtin/agent.d.ts +7 -26
- package/dist/tool-system/builtin/apply-patch/applier.d.ts +26 -0
- package/dist/tool-system/builtin/apply-patch/index.d.ts +19 -0
- package/dist/tool-system/builtin/apply-patch/parser.d.ts +17 -0
- package/dist/tool-system/builtin/apply-patch/seek-sequence.d.ts +18 -0
- package/dist/tool-system/builtin/apply-patch/types.d.ts +49 -0
- package/dist/tool-system/builtin/arena.d.ts +18 -5
- package/dist/tool-system/builtin/ask-user.d.ts +6 -6
- package/dist/tool-system/builtin/index.d.ts +11 -1
- package/dist/tool-system/builtin/tool-search.d.ts +2 -3
- package/dist/tool-system/context.d.ts +74 -0
- package/dist/tool-system/executor.d.ts +16 -0
- package/dist/tool-system/permission.d.ts +40 -5
- package/dist/tool-system/registry.d.ts +8 -0
- package/dist/types.d.ts +34 -1
- package/dist/ui/App.d.ts +1 -1
- package/dist/ui/components/AgentBlock.d.ts +1 -1
- package/dist/ui/components/AskUserPrompt.d.ts +7 -0
- package/dist/ui/components/MessageContent.d.ts +7 -3
- package/dist/ui/components/ModelManager.d.ts +35 -0
- package/dist/ui/components/ModelSelector.d.ts +10 -0
- package/dist/ui/components/OnboardingPrompt.d.ts +7 -0
- package/dist/ui/components/PermissionPrompt.d.ts +5 -2
- package/dist/ui/components/SessionPicker.d.ts +14 -0
- package/dist/ui/components/StatusLine.d.ts +4 -2
- package/dist/ui/components/ThemedBox.d.ts +1 -1
- package/dist/ui/components/ToolCall.d.ts +8 -1
- package/dist/ui/components/WelcomeTips.d.ts +5 -0
- package/dist/ui/onboarding-runner.d.ts +2 -0
- package/dist/ui/store.d.ts +1 -0
- package/dist/{updater-URVNPDPW.cjs → updater-M7L42ASZ.cjs} +4 -4
- package/dist/{updater-AVD4LKTQ.js → updater-ZRTONIR4.js} +4 -4
- package/dist/utils/debug.d.ts +17 -33
- package/package.json +4 -4
- package/dist/anthropic-XMTTVNSH.cjs +0 -9
- package/dist/bridge-4ZRXVWBN.js +0 -98
- package/dist/bridge-W476QDFH.cjs +0 -98
- package/dist/chunk-4RRUP4MM.js +0 -86
- package/dist/chunk-4SFPFHMG.js +0 -132
- package/dist/chunk-5LHVI777.cjs +0 -246
- package/dist/chunk-6ZIROYXX.js +0 -207
- package/dist/chunk-C7JBCO5V.js +0 -80
- package/dist/chunk-CSO5EOEP.cjs +0 -132
- package/dist/chunk-FGZGCFJX.cjs +0 -207
- package/dist/chunk-HD7MT5XU.cjs +0 -86
- package/dist/chunk-IMMTBZ33.cjs +0 -63
- package/dist/chunk-JT2WSQSR.cjs +0 -335
- package/dist/chunk-NZ4DQ72D.cjs +0 -664
- package/dist/chunk-OG4MIQJ6.js +0 -335
- package/dist/chunk-WRZJUQ5Z.js +0 -664
- package/dist/chunk-X4HAERTQ.js +0 -63
- package/dist/chunk-XHC2JMEC.cjs +0 -80
- package/dist/chunk-ZRSSGYA5.js +0 -246
- package/dist/compaction-44I55TLI.cjs +0 -32
- package/dist/coordinator-5HY7ALO2.js +0 -7
- package/dist/coordinator-INDLPVMF.cjs +0 -7
- package/dist/cost-tracker-IWYAUPXH.js +0 -9
- package/dist/cost-tracker-JXTJQQWE.cjs +0 -9
- package/dist/loader-DXFSUB4R.cjs +0 -91
- package/dist/loader-J5UID6CV.js +0 -91
- package/dist/manager-ETWDOCHN.cjs +0 -9
- package/dist/manager-HGMQNEJB.cjs +0 -11
- package/dist/manager-HUAQOORS.js +0 -9
- package/dist/manager-VJIZ2CQC.js +0 -11
- package/dist/mcp-manager-G4G2QASE.cjs +0 -8
- package/dist/memory-AP747G5H.js +0 -7
- package/dist/memory-BH3BYUN5.cjs +0 -7
- package/dist/onboarding-6WEPV7C2.js +0 -11
- package/dist/onboarding-QM5DY2TU.cjs +0 -11
- package/dist/openai-656VWUQW.cjs +0 -9
- package/dist/skills-63RBYQRX.js +0 -13
- package/dist/skills-V3BPLW3D.cjs +0 -13
- package/dist/token-counter-CHAXW5O7.cjs +0 -13
- package/dist/token-counter-DSOZGZ5Q.js +0 -13
- package/dist/utils/log.d.ts +0 -56
- package/dist/voice-KTZ7PAGO.js +0 -80
- package/dist/voice-KZE25GKB.cjs +0 -80
- /package/dist/{ink → render}/Ansi.d.ts +0 -0
- /package/dist/{ink → render}/bidi.d.ts +0 -0
- /package/dist/{ink → render}/clearTerminal.d.ts +0 -0
- /package/dist/{ink → render}/colorize.d.ts +0 -0
- /package/dist/{ink → render}/components/AlternateScreen.d.ts +0 -0
- /package/dist/{ink → render}/components/App.d.ts +0 -0
- /package/dist/{ink → render}/components/AppContext.d.ts +0 -0
- /package/dist/{ink → render}/components/Box.d.ts +0 -0
- /package/dist/{ink → render}/components/Button.d.ts +0 -0
- /package/dist/{ink → render}/components/ClockContext.d.ts +0 -0
- /package/dist/{ink → render}/components/CursorDeclarationContext.d.ts +0 -0
- /package/dist/{ink → render}/components/ErrorOverview.d.ts +0 -0
- /package/dist/{ink → render}/components/Link.d.ts +0 -0
- /package/dist/{ink → render}/components/Newline.d.ts +0 -0
- /package/dist/{ink → render}/components/NoSelect.d.ts +0 -0
- /package/dist/{ink → render}/components/RawAnsi.d.ts +0 -0
- /package/dist/{ink → render}/components/ScrollBox.d.ts +0 -0
- /package/dist/{ink → render}/components/Spacer.d.ts +0 -0
- /package/dist/{ink → render}/components/StdinContext.d.ts +0 -0
- /package/dist/{ink → render}/components/TerminalFocusContext.d.ts +0 -0
- /package/dist/{ink → render}/components/TerminalSizeContext.d.ts +0 -0
- /package/dist/{ink → render}/components/Text.d.ts +0 -0
- /package/dist/{ink → render}/constants.d.ts +0 -0
- /package/dist/{ink → render}/cursor.d.ts +0 -0
- /package/dist/{ink → render}/devtools.d.ts +0 -0
- /package/dist/{ink → render}/dom.d.ts +0 -0
- /package/dist/{ink → render}/events/click-event.d.ts +0 -0
- /package/dist/{ink → render}/events/dispatcher.d.ts +0 -0
- /package/dist/{ink → render}/events/emitter.d.ts +0 -0
- /package/dist/{ink → render}/events/event-handlers.d.ts +0 -0
- /package/dist/{ink → render}/events/event.d.ts +0 -0
- /package/dist/{ink → render}/events/focus-event.d.ts +0 -0
- /package/dist/{ink → render}/events/input-event.d.ts +0 -0
- /package/dist/{ink → render}/events/keyboard-event.d.ts +0 -0
- /package/dist/{ink → render}/events/paste-event.d.ts +0 -0
- /package/dist/{ink → render}/events/resize-event.d.ts +0 -0
- /package/dist/{ink → render}/events/terminal-event.d.ts +0 -0
- /package/dist/{ink → render}/events/terminal-focus-event.d.ts +0 -0
- /package/dist/{ink → render}/focus.d.ts +0 -0
- /package/dist/{ink → render}/frame.d.ts +0 -0
- /package/dist/{ink → render}/get-max-width.d.ts +0 -0
- /package/dist/{ink → render}/hit-test.d.ts +0 -0
- /package/dist/{ink → render}/hooks/use-animation-frame.d.ts +0 -0
- /package/dist/{ink → render}/hooks/use-app.d.ts +0 -0
- /package/dist/{ink → render}/hooks/use-declared-cursor.d.ts +0 -0
- /package/dist/{ink → render}/hooks/use-interval.d.ts +0 -0
- /package/dist/{ink → render}/hooks/use-search-highlight.d.ts +0 -0
- /package/dist/{ink → render}/hooks/use-selection.d.ts +0 -0
- /package/dist/{ink → render}/hooks/use-stdin.d.ts +0 -0
- /package/dist/{ink → render}/hooks/use-tab-status.d.ts +0 -0
- /package/dist/{ink → render}/hooks/use-terminal-focus.d.ts +0 -0
- /package/dist/{ink → render}/hooks/use-terminal-title.d.ts +0 -0
- /package/dist/{ink → render}/hooks/use-terminal-viewport.d.ts +0 -0
- /package/dist/{ink → render}/index.d.ts +0 -0
- /package/dist/{ink → render}/ink.d.ts +0 -0
- /package/dist/{ink → render}/instances.d.ts +0 -0
- /package/dist/{ink → render}/layout/engine.d.ts +0 -0
- /package/dist/{ink → render}/layout/geometry.d.ts +0 -0
- /package/dist/{ink → render}/layout/node.d.ts +0 -0
- /package/dist/{ink → render}/layout/yoga.d.ts +0 -0
- /package/dist/{ink → render}/line-width-cache.d.ts +0 -0
- /package/dist/{ink → render}/log-update.d.ts +0 -0
- /package/dist/{ink → render}/measure-element.d.ts +0 -0
- /package/dist/{ink → render}/measure-text.d.ts +0 -0
- /package/dist/{ink → render}/node-cache.d.ts +0 -0
- /package/dist/{ink → render}/optimizer.d.ts +0 -0
- /package/dist/{ink → render}/output.d.ts +0 -0
- /package/dist/{ink → render}/parse-keypress.d.ts +0 -0
- /package/dist/{ink → render}/reconciler.d.ts +0 -0
- /package/dist/{ink → render}/render-border.d.ts +0 -0
- /package/dist/{ink → render}/render-node-to-output.d.ts +0 -0
- /package/dist/{ink → render}/render-to-screen.d.ts +0 -0
- /package/dist/{ink → render}/renderer.d.ts +0 -0
- /package/dist/{ink → render}/root.d.ts +0 -0
- /package/dist/{ink → render}/screen.d.ts +0 -0
- /package/dist/{ink → render}/searchHighlight.d.ts +0 -0
- /package/dist/{ink → render}/selection.d.ts +0 -0
- /package/dist/{ink → render}/squash-text-nodes.d.ts +0 -0
- /package/dist/{ink → render}/stringWidth.d.ts +0 -0
- /package/dist/{ink → render}/styles.d.ts +0 -0
- /package/dist/{ink → render}/supports-hyperlinks.d.ts +0 -0
- /package/dist/{ink → render}/tabstops.d.ts +0 -0
- /package/dist/{ink → render}/terminal-focus-state.d.ts +0 -0
- /package/dist/{ink → render}/terminal-querier.d.ts +0 -0
- /package/dist/{ink → render}/terminal.d.ts +0 -0
- /package/dist/{ink → render}/termio/ansi.d.ts +0 -0
- /package/dist/{ink → render}/termio/csi.d.ts +0 -0
- /package/dist/{ink → render}/termio/dec.d.ts +0 -0
- /package/dist/{ink → render}/termio/esc.d.ts +0 -0
- /package/dist/{ink → render}/termio/osc.d.ts +0 -0
- /package/dist/{ink → render}/termio/parser.d.ts +0 -0
- /package/dist/{ink → render}/termio/sgr.d.ts +0 -0
- /package/dist/{ink → render}/termio/tokenize.d.ts +0 -0
- /package/dist/{ink → render}/termio/types.d.ts +0 -0
- /package/dist/{ink → render}/termio.d.ts +0 -0
- /package/dist/{ink → render}/useTerminalNotification.d.ts +0 -0
- /package/dist/{ink → render}/warn.d.ts +0 -0
- /package/dist/{ink → render}/widest-line.d.ts +0 -0
- /package/dist/{ink → render}/wrap-text.d.ts +0 -0
- /package/dist/{ink → render}/wrapAnsi.d.ts +0 -0
package/dist/chunk-X4HAERTQ.js
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
init_esm_shims
|
|
3
|
-
} from "./chunk-DI7RDLOS.js";
|
|
4
|
-
|
|
5
|
-
// src/logging/logger.ts
|
|
6
|
-
init_esm_shims();
|
|
7
|
-
import { appendFileSync, mkdirSync, existsSync } from "fs";
|
|
8
|
-
import { join } from "path";
|
|
9
|
-
import { homedir } from "os";
|
|
10
|
-
var LEVEL_ORDER = {
|
|
11
|
-
debug: 0,
|
|
12
|
-
info: 1,
|
|
13
|
-
warn: 2,
|
|
14
|
-
error: 3
|
|
15
|
-
};
|
|
16
|
-
var Logger = class {
|
|
17
|
-
logDir;
|
|
18
|
-
minLevel;
|
|
19
|
-
enabled;
|
|
20
|
-
constructor() {
|
|
21
|
-
this.logDir = join(homedir(), ".code-shell", "logs");
|
|
22
|
-
this.minLevel = process.env.CODE_SHELL_LOG_LEVEL ?? "info";
|
|
23
|
-
this.enabled = process.env.CODE_SHELL_LOG !== "0";
|
|
24
|
-
}
|
|
25
|
-
debug(msg, data) {
|
|
26
|
-
this.log("debug", msg, data);
|
|
27
|
-
}
|
|
28
|
-
info(msg, data) {
|
|
29
|
-
this.log("info", msg, data);
|
|
30
|
-
}
|
|
31
|
-
warn(msg, data) {
|
|
32
|
-
this.log("warn", msg, data);
|
|
33
|
-
}
|
|
34
|
-
error(msg, data) {
|
|
35
|
-
this.log("error", msg, data);
|
|
36
|
-
}
|
|
37
|
-
log(level, msg, data) {
|
|
38
|
-
if (!this.enabled) return;
|
|
39
|
-
if (LEVEL_ORDER[level] < LEVEL_ORDER[this.minLevel]) return;
|
|
40
|
-
const now = /* @__PURE__ */ new Date();
|
|
41
|
-
const timestamp = now.toISOString();
|
|
42
|
-
const dateStr = timestamp.split("T")[0];
|
|
43
|
-
const entry = {
|
|
44
|
-
t: timestamp,
|
|
45
|
-
l: level,
|
|
46
|
-
msg
|
|
47
|
-
};
|
|
48
|
-
if (data) entry.d = data;
|
|
49
|
-
try {
|
|
50
|
-
if (!existsSync(this.logDir)) {
|
|
51
|
-
mkdirSync(this.logDir, { recursive: true });
|
|
52
|
-
}
|
|
53
|
-
const logFile = join(this.logDir, `${dateStr}.log`);
|
|
54
|
-
appendFileSync(logFile, JSON.stringify(entry) + "\n", "utf-8");
|
|
55
|
-
} catch {
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
};
|
|
59
|
-
var logger = new Logger();
|
|
60
|
-
|
|
61
|
-
export {
|
|
62
|
-
logger
|
|
63
|
-
};
|
package/dist/chunk-XHC2JMEC.cjs
DELETED
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } var _class;
|
|
2
|
-
|
|
3
|
-
var _chunkIJSHQGMPcjs = require('./chunk-IJSHQGMP.cjs');
|
|
4
|
-
|
|
5
|
-
// src/agent/coordinator.ts
|
|
6
|
-
_chunkIJSHQGMPcjs.init_cjs_shims.call(void 0, );
|
|
7
|
-
var AgentCoordinator = (_class = class {constructor() { _class.prototype.__init.call(this);_class.prototype.__init2.call(this); }
|
|
8
|
-
__init() {this.agents = /* @__PURE__ */ new Map()}
|
|
9
|
-
__init2() {this.inbox = /* @__PURE__ */ new Map()}
|
|
10
|
-
/** Register a named agent. */
|
|
11
|
-
register(id, name, description) {
|
|
12
|
-
this.agents.set(name, {
|
|
13
|
-
id,
|
|
14
|
-
name,
|
|
15
|
-
status: "running",
|
|
16
|
-
description,
|
|
17
|
-
startedAt: Date.now()
|
|
18
|
-
});
|
|
19
|
-
if (!this.inbox.has(name)) {
|
|
20
|
-
this.inbox.set(name, []);
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
/** Mark an agent as completed. */
|
|
24
|
-
complete(name, result) {
|
|
25
|
-
const agent = this.agents.get(name);
|
|
26
|
-
if (agent) {
|
|
27
|
-
agent.status = "completed";
|
|
28
|
-
agent.completedAt = Date.now();
|
|
29
|
-
agent.result = result;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
/** Mark an agent as failed. */
|
|
33
|
-
fail(name) {
|
|
34
|
-
const agent = this.agents.get(name);
|
|
35
|
-
if (agent) {
|
|
36
|
-
agent.status = "failed";
|
|
37
|
-
agent.completedAt = Date.now();
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
/** Get agent info by name. */
|
|
41
|
-
get(name) {
|
|
42
|
-
return this.agents.get(name);
|
|
43
|
-
}
|
|
44
|
-
/** List all agents. */
|
|
45
|
-
list() {
|
|
46
|
-
return [...this.agents.values()];
|
|
47
|
-
}
|
|
48
|
-
/** List active (running) agents. */
|
|
49
|
-
listActive() {
|
|
50
|
-
return [...this.agents.values()].filter((a) => a.status === "running");
|
|
51
|
-
}
|
|
52
|
-
/** Send a message to a named agent. */
|
|
53
|
-
send(from, to, content) {
|
|
54
|
-
if (!this.agents.has(to)) return false;
|
|
55
|
-
const messages = _nullishCoalesce(this.inbox.get(to), () => ( []));
|
|
56
|
-
messages.push({ from, to, content, timestamp: Date.now() });
|
|
57
|
-
this.inbox.set(to, messages);
|
|
58
|
-
return true;
|
|
59
|
-
}
|
|
60
|
-
/** Read messages for a named agent (drains the inbox). */
|
|
61
|
-
receive(name) {
|
|
62
|
-
const messages = _nullishCoalesce(this.inbox.get(name), () => ( []));
|
|
63
|
-
this.inbox.set(name, []);
|
|
64
|
-
return messages;
|
|
65
|
-
}
|
|
66
|
-
/** Peek at messages without draining. */
|
|
67
|
-
peek(name) {
|
|
68
|
-
return _nullishCoalesce(this.inbox.get(name), () => ( []));
|
|
69
|
-
}
|
|
70
|
-
/** Reset all state. */
|
|
71
|
-
reset() {
|
|
72
|
-
this.agents.clear();
|
|
73
|
-
this.inbox.clear();
|
|
74
|
-
}
|
|
75
|
-
}, _class);
|
|
76
|
-
var agentCoordinator = new AgentCoordinator();
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
exports.agentCoordinator = agentCoordinator;
|
package/dist/chunk-ZRSSGYA5.js
DELETED
|
@@ -1,246 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
init_esm_shims
|
|
3
|
-
} from "./chunk-DI7RDLOS.js";
|
|
4
|
-
|
|
5
|
-
// src/cli/cost-tracker.ts
|
|
6
|
-
init_esm_shims();
|
|
7
|
-
import chalk from "chalk";
|
|
8
|
-
function pricing(input, output) {
|
|
9
|
-
return { input, output, cacheRead: input * 0.1, cacheWrite: input * 1.25 };
|
|
10
|
-
}
|
|
11
|
-
var MODEL_PRICING = {
|
|
12
|
-
// Anthropic (per 1M tokens, USD)
|
|
13
|
-
"claude-opus-4.6": { input: 15, output: 75, cacheRead: 1.5, cacheWrite: 18.75 },
|
|
14
|
-
"claude-opus-4-6": { input: 15, output: 75, cacheRead: 1.5, cacheWrite: 18.75 },
|
|
15
|
-
// alias
|
|
16
|
-
"claude-opus-4.5": { input: 15, output: 75, cacheRead: 1.5, cacheWrite: 18.75 },
|
|
17
|
-
"claude-opus-4.1": { input: 15, output: 75, cacheRead: 1.5, cacheWrite: 18.75 },
|
|
18
|
-
"claude-opus-4": { input: 15, output: 75, cacheRead: 1.5, cacheWrite: 18.75 },
|
|
19
|
-
"claude-sonnet-4.6": { input: 3, output: 15, cacheRead: 0.3, cacheWrite: 3.75 },
|
|
20
|
-
"claude-sonnet-4-6": { input: 3, output: 15, cacheRead: 0.3, cacheWrite: 3.75 },
|
|
21
|
-
// alias
|
|
22
|
-
"claude-sonnet-4.5": { input: 3, output: 15, cacheRead: 0.3, cacheWrite: 3.75 },
|
|
23
|
-
"claude-sonnet-4": { input: 3, output: 15, cacheRead: 0.3, cacheWrite: 3.75 },
|
|
24
|
-
"claude-3.7-sonnet": { input: 3, output: 15, cacheRead: 0.3, cacheWrite: 3.75 },
|
|
25
|
-
"claude-3-7-sonnet": { input: 3, output: 15, cacheRead: 0.3, cacheWrite: 3.75 },
|
|
26
|
-
"claude-3.5-haiku": { input: 0.8, output: 4, cacheRead: 0.08, cacheWrite: 1 },
|
|
27
|
-
"claude-haiku-4.5": { input: 1, output: 5, cacheRead: 0.1, cacheWrite: 1.25 },
|
|
28
|
-
"claude-haiku-4-5": { input: 1, output: 5, cacheRead: 0.1, cacheWrite: 1.25 },
|
|
29
|
-
// alias
|
|
30
|
-
// OpenAI
|
|
31
|
-
"gpt-5.4": pricing(5, 20),
|
|
32
|
-
"gpt-5.4-mini": pricing(1.5, 6),
|
|
33
|
-
"gpt-5.4-pro": pricing(10, 40),
|
|
34
|
-
"gpt-5": pricing(5, 20),
|
|
35
|
-
"gpt-4o": pricing(2.5, 10),
|
|
36
|
-
"gpt-4o-mini": pricing(0.15, 0.6),
|
|
37
|
-
"gpt-4.1": pricing(2, 8),
|
|
38
|
-
"gpt-4.1-mini": pricing(0.4, 1.6),
|
|
39
|
-
"o4-mini": pricing(1.1, 4.4),
|
|
40
|
-
"o3": pricing(10, 40),
|
|
41
|
-
"o3-mini": pricing(1.1, 4.4),
|
|
42
|
-
// Google
|
|
43
|
-
"gemini-2.5-pro": pricing(1.25, 10),
|
|
44
|
-
"gemini-2.5-pro-preview": pricing(1.25, 10),
|
|
45
|
-
"gemini-2.5-flash": pricing(0.15, 0.6),
|
|
46
|
-
"gemini-3.1-pro-preview": pricing(2, 10),
|
|
47
|
-
"gemini-3-flash-preview": pricing(0.15, 0.6),
|
|
48
|
-
"gemini-2.0-flash": pricing(0.1, 0.4),
|
|
49
|
-
// DeepSeek
|
|
50
|
-
"deepseek-v3.2": pricing(0.14, 0.28),
|
|
51
|
-
"deepseek-chat": pricing(0.14, 0.28),
|
|
52
|
-
"deepseek-r1": pricing(0.55, 2.19),
|
|
53
|
-
"deepseek-reasoner": pricing(0.55, 2.19),
|
|
54
|
-
// Qwen
|
|
55
|
-
"qwen3-coder": pricing(0.3, 0.6),
|
|
56
|
-
"qwen3-235b-a22b": pricing(0.3, 1.2),
|
|
57
|
-
"qwen3-30b-a3b": pricing(0.1, 0.3),
|
|
58
|
-
"qwen3-max": pricing(0.5, 2),
|
|
59
|
-
// Meta
|
|
60
|
-
"llama-4-maverick": pricing(0.2, 0.8),
|
|
61
|
-
"llama-4-scout": pricing(0.15, 0.4),
|
|
62
|
-
// Mistral
|
|
63
|
-
"devstral-medium": pricing(0.5, 1.5),
|
|
64
|
-
"mistral-large": pricing(2, 6),
|
|
65
|
-
"devstral-small": pricing(0.1, 0.3)
|
|
66
|
-
};
|
|
67
|
-
var DEFAULT_PRICING = pricing(3, 15);
|
|
68
|
-
function getCanonicalName(model) {
|
|
69
|
-
const slashIdx = model.lastIndexOf("/");
|
|
70
|
-
const base = slashIdx >= 0 ? model.slice(slashIdx + 1) : model;
|
|
71
|
-
return base.replace(/-\d{8}$/, "");
|
|
72
|
-
}
|
|
73
|
-
var CostTracker = class {
|
|
74
|
-
records = [];
|
|
75
|
-
sessionStart = Date.now();
|
|
76
|
-
_hasUnknownModel = false;
|
|
77
|
-
record(model, promptTokens, completionTokens, isSubAgent = false, cacheReadTokens = 0, cacheWriteTokens = 0) {
|
|
78
|
-
const canonical = getCanonicalName(model);
|
|
79
|
-
if (!MODEL_PRICING[canonical] && !MODEL_PRICING[model]) {
|
|
80
|
-
this._hasUnknownModel = true;
|
|
81
|
-
}
|
|
82
|
-
this.records.push({
|
|
83
|
-
model: canonical,
|
|
84
|
-
promptTokens,
|
|
85
|
-
completionTokens,
|
|
86
|
-
cacheReadTokens,
|
|
87
|
-
cacheWriteTokens,
|
|
88
|
-
totalTokens: promptTokens + completionTokens,
|
|
89
|
-
timestamp: Date.now(),
|
|
90
|
-
isSubAgent
|
|
91
|
-
});
|
|
92
|
-
}
|
|
93
|
-
getTotalTokens() {
|
|
94
|
-
let prompt = 0;
|
|
95
|
-
let completion = 0;
|
|
96
|
-
for (const r of this.records) {
|
|
97
|
-
prompt += r.promptTokens;
|
|
98
|
-
completion += r.completionTokens;
|
|
99
|
-
}
|
|
100
|
-
return { prompt, completion, total: prompt + completion };
|
|
101
|
-
}
|
|
102
|
-
getEstimatedCost() {
|
|
103
|
-
let totalCost = 0;
|
|
104
|
-
for (const r of this.records) {
|
|
105
|
-
const p = MODEL_PRICING[r.model] ?? DEFAULT_PRICING;
|
|
106
|
-
const uncachedInput = Math.max(0, r.promptTokens - r.cacheReadTokens - r.cacheWriteTokens);
|
|
107
|
-
totalCost += uncachedInput / 1e6 * p.input;
|
|
108
|
-
totalCost += r.completionTokens / 1e6 * p.output;
|
|
109
|
-
totalCost += r.cacheReadTokens / 1e6 * p.cacheRead;
|
|
110
|
-
totalCost += r.cacheWriteTokens / 1e6 * p.cacheWrite;
|
|
111
|
-
}
|
|
112
|
-
return totalCost;
|
|
113
|
-
}
|
|
114
|
-
getRequestCount() {
|
|
115
|
-
return this.records.length;
|
|
116
|
-
}
|
|
117
|
-
getSessionDuration() {
|
|
118
|
-
return Date.now() - this.sessionStart;
|
|
119
|
-
}
|
|
120
|
-
/** Estimate cost for a specific set of tokens without recording them. */
|
|
121
|
-
estimateForTokens(model, promptTokens, completionTokens, cacheReadTokens = 0, cacheWriteTokens = 0) {
|
|
122
|
-
const canonical = getCanonicalName(model);
|
|
123
|
-
const p = MODEL_PRICING[canonical] ?? MODEL_PRICING[model] ?? DEFAULT_PRICING;
|
|
124
|
-
const uncachedInput = Math.max(0, promptTokens - cacheReadTokens - cacheWriteTokens);
|
|
125
|
-
return uncachedInput / 1e6 * p.input + completionTokens / 1e6 * p.output + cacheReadTokens / 1e6 * p.cacheRead + cacheWriteTokens / 1e6 * p.cacheWrite;
|
|
126
|
-
}
|
|
127
|
-
/**
|
|
128
|
-
* Get total cache token counts.
|
|
129
|
-
*/
|
|
130
|
-
getCacheTokens() {
|
|
131
|
-
let cacheRead = 0;
|
|
132
|
-
let cacheWrite = 0;
|
|
133
|
-
for (const r of this.records) {
|
|
134
|
-
cacheRead += r.cacheReadTokens;
|
|
135
|
-
cacheWrite += r.cacheWriteTokens;
|
|
136
|
-
}
|
|
137
|
-
return { cacheRead, cacheWrite };
|
|
138
|
-
}
|
|
139
|
-
/**
|
|
140
|
-
* Format a styled cost summary for terminal display.
|
|
141
|
-
*/
|
|
142
|
-
formatSummary() {
|
|
143
|
-
const tokens = this.getTotalTokens();
|
|
144
|
-
const cache = this.getCacheTokens();
|
|
145
|
-
const cost = this.getEstimatedCost();
|
|
146
|
-
const requests = this.getRequestCount();
|
|
147
|
-
const duration = this.getSessionDuration();
|
|
148
|
-
const lines = [];
|
|
149
|
-
lines.push(` ${chalk.bold.cyan("Cost Summary")}`);
|
|
150
|
-
lines.push(chalk.dim(" \u2500".repeat(25)));
|
|
151
|
-
lines.push(` ${chalk.dim("Requests:")} ${chalk.white(String(requests))}`);
|
|
152
|
-
lines.push(` ${chalk.dim("Input tokens:")} ${chalk.white(formatNumber(tokens.prompt))}`);
|
|
153
|
-
lines.push(` ${chalk.dim("Output tokens:")} ${chalk.white(formatNumber(tokens.completion))}`);
|
|
154
|
-
if (cache.cacheRead > 0 || cache.cacheWrite > 0) {
|
|
155
|
-
lines.push(` ${chalk.dim("Cache read:")} ${chalk.white(formatNumber(cache.cacheRead))}`);
|
|
156
|
-
lines.push(` ${chalk.dim("Cache write:")} ${chalk.white(formatNumber(cache.cacheWrite))}`);
|
|
157
|
-
}
|
|
158
|
-
lines.push(` ${chalk.dim("Total cost:")} ${chalk.green(formatCost(cost))}`);
|
|
159
|
-
lines.push(` ${chalk.dim("Duration:")} ${chalk.white(formatDuration(duration))}`);
|
|
160
|
-
const modelMap = /* @__PURE__ */ new Map();
|
|
161
|
-
for (const r of this.records) {
|
|
162
|
-
const existing = modelMap.get(r.model) ?? { prompt: 0, completion: 0, cacheRead: 0, cacheWrite: 0, count: 0 };
|
|
163
|
-
existing.prompt += r.promptTokens;
|
|
164
|
-
existing.completion += r.completionTokens;
|
|
165
|
-
existing.cacheRead += r.cacheReadTokens;
|
|
166
|
-
existing.cacheWrite += r.cacheWriteTokens;
|
|
167
|
-
existing.count++;
|
|
168
|
-
modelMap.set(r.model, existing);
|
|
169
|
-
}
|
|
170
|
-
if (modelMap.size >= 1) {
|
|
171
|
-
lines.push("");
|
|
172
|
-
lines.push(` ${chalk.dim("By model:")}`);
|
|
173
|
-
for (const [model, stats] of modelMap) {
|
|
174
|
-
const p = MODEL_PRICING[model] ?? DEFAULT_PRICING;
|
|
175
|
-
const uncachedInput = Math.max(0, stats.prompt - stats.cacheRead - stats.cacheWrite);
|
|
176
|
-
const modelCost = uncachedInput / 1e6 * p.input + stats.completion / 1e6 * p.output + stats.cacheRead / 1e6 * p.cacheRead + stats.cacheWrite / 1e6 * p.cacheWrite;
|
|
177
|
-
const tokenDetail = `${formatNumber(stats.prompt)} in, ${formatNumber(stats.completion)} out` + (stats.cacheRead > 0 ? `, ${formatNumber(stats.cacheRead)} cache` : "");
|
|
178
|
-
lines.push(
|
|
179
|
-
` ${chalk.dim(model)} \u2014 ${tokenDetail}, ${formatCost(modelCost)} (${stats.count} reqs)`
|
|
180
|
-
);
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
if (this._hasUnknownModel) {
|
|
184
|
-
lines.push("");
|
|
185
|
-
lines.push(chalk.dim(" (costs may be inaccurate due to usage of unknown models)"));
|
|
186
|
-
}
|
|
187
|
-
return lines.join("\n");
|
|
188
|
-
}
|
|
189
|
-
/**
|
|
190
|
-
* Format a compact one-line cost display for the prompt footer.
|
|
191
|
-
*/
|
|
192
|
-
formatCompact() {
|
|
193
|
-
const tokens = this.getTotalTokens();
|
|
194
|
-
const cost = this.getEstimatedCost();
|
|
195
|
-
return chalk.dim(
|
|
196
|
-
`tokens: ${formatNumber(tokens.total)} | cost: ${formatCost(cost)}`
|
|
197
|
-
);
|
|
198
|
-
}
|
|
199
|
-
reset() {
|
|
200
|
-
this.records = [];
|
|
201
|
-
this.sessionStart = Date.now();
|
|
202
|
-
}
|
|
203
|
-
/** Serialize cost state for session persistence. */
|
|
204
|
-
serialize() {
|
|
205
|
-
const tokens = this.getTotalTokens();
|
|
206
|
-
return {
|
|
207
|
-
records: this.records,
|
|
208
|
-
sessionStart: this.sessionStart,
|
|
209
|
-
totalPromptTokens: tokens.prompt,
|
|
210
|
-
totalCompletionTokens: tokens.completion,
|
|
211
|
-
estimatedCost: this.getEstimatedCost()
|
|
212
|
-
};
|
|
213
|
-
}
|
|
214
|
-
/** Restore cost state from a previous session. */
|
|
215
|
-
restore(state) {
|
|
216
|
-
this.records = state.records ?? [];
|
|
217
|
-
this.sessionStart = state.sessionStart ?? Date.now();
|
|
218
|
-
}
|
|
219
|
-
};
|
|
220
|
-
function formatCost(cost) {
|
|
221
|
-
if (cost >= 0.5) return `$${Math.round(cost * 100) / 100}`;
|
|
222
|
-
if (cost >= 0.01) return `$${cost.toFixed(4)}`;
|
|
223
|
-
if (cost > 0) return `$${cost.toFixed(6)}`;
|
|
224
|
-
return "$0.00";
|
|
225
|
-
}
|
|
226
|
-
function formatNumber(n) {
|
|
227
|
-
if (n >= 1e6) return (n / 1e6).toFixed(1) + "M";
|
|
228
|
-
if (n >= 1e3) return (n / 1e3).toFixed(1) + "K";
|
|
229
|
-
return String(n);
|
|
230
|
-
}
|
|
231
|
-
function formatDuration(ms) {
|
|
232
|
-
const s = Math.floor(ms / 1e3);
|
|
233
|
-
if (s < 60) return `${s}s`;
|
|
234
|
-
const m = Math.floor(s / 60);
|
|
235
|
-
const rs = s % 60;
|
|
236
|
-
if (m < 60) return `${m}m ${rs}s`;
|
|
237
|
-
const h = Math.floor(m / 60);
|
|
238
|
-
const rm = m % 60;
|
|
239
|
-
return `${h}h ${rm}m`;
|
|
240
|
-
}
|
|
241
|
-
var costTracker = new CostTracker();
|
|
242
|
-
|
|
243
|
-
export {
|
|
244
|
-
CostTracker,
|
|
245
|
-
costTracker
|
|
246
|
-
};
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
var _chunkLRAY5IYCcjs = require('./chunk-LRAY5IYC.cjs');
|
|
16
|
-
require('./chunk-HD7MT5XU.cjs');
|
|
17
|
-
require('./chunk-IJSHQGMP.cjs');
|
|
18
|
-
_chunkLRAY5IYCcjs.init_compaction.call(void 0, );
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
exports.adjustIndexToPreserveAPIInvariants = _chunkLRAY5IYCcjs.adjustIndexToPreserveAPIInvariants; exports.applySummaryCompaction = _chunkLRAY5IYCcjs.applySummaryCompaction; exports.applyToolResultBudget = _chunkLRAY5IYCcjs.applyToolResultBudget; exports.buildSummarizationPrompt = _chunkLRAY5IYCcjs.buildSummarizationPrompt; exports.dropOldestRounds = _chunkLRAY5IYCcjs.dropOldestRounds; exports.estimateTokens = _chunkLRAY5IYCcjs.estimateTokens; exports.extractReferencedFilePaths = _chunkLRAY5IYCcjs.extractReferencedFilePaths; exports.groupMessagesByApiRound = _chunkLRAY5IYCcjs.groupMessagesByApiRound; exports.microcompact = _chunkLRAY5IYCcjs.microcompact; exports.snipCompact = _chunkLRAY5IYCcjs.snipCompact; exports.truncateToolResult = _chunkLRAY5IYCcjs.truncateToolResult; exports.windowCompact = _chunkLRAY5IYCcjs.windowCompact;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var _chunk5LHVI777cjs = require('./chunk-5LHVI777.cjs');
|
|
5
|
-
require('./chunk-IJSHQGMP.cjs');
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
exports.CostTracker = _chunk5LHVI777cjs.CostTracker; exports.costTracker = _chunk5LHVI777cjs.costTracker;
|
package/dist/loader-DXFSUB4R.cjs
DELETED
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); var _class;
|
|
2
|
-
|
|
3
|
-
var _chunkIJSHQGMPcjs = require('./chunk-IJSHQGMP.cjs');
|
|
4
|
-
|
|
5
|
-
// src/plugins/loader.ts
|
|
6
|
-
_chunkIJSHQGMPcjs.init_cjs_shims.call(void 0, );
|
|
7
|
-
var _fs = require('fs');
|
|
8
|
-
var _path = require('path');
|
|
9
|
-
var _os = require('os');
|
|
10
|
-
var PluginLoader = (_class = class {constructor() { _class.prototype.__init.call(this); }
|
|
11
|
-
__init() {this.plugins = /* @__PURE__ */ new Map()}
|
|
12
|
-
/**
|
|
13
|
-
* Scan plugin directories and load manifests.
|
|
14
|
-
*/
|
|
15
|
-
scan(cwd) {
|
|
16
|
-
const dirs = [
|
|
17
|
-
_path.join.call(void 0, _os.homedir.call(void 0, ), ".code-shell", "plugins"),
|
|
18
|
-
_path.join.call(void 0, cwd, ".code-shell", "plugins")
|
|
19
|
-
];
|
|
20
|
-
for (const dir of dirs) {
|
|
21
|
-
if (!_fs.existsSync.call(void 0, dir)) continue;
|
|
22
|
-
try {
|
|
23
|
-
const entries = _fs.readdirSync.call(void 0, dir, { withFileTypes: true });
|
|
24
|
-
for (const entry of entries) {
|
|
25
|
-
if (!entry.isDirectory()) continue;
|
|
26
|
-
const pluginDir = _path.join.call(void 0, dir, entry.name);
|
|
27
|
-
this.loadPlugin(pluginDir);
|
|
28
|
-
}
|
|
29
|
-
} catch (e) {
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
return this.list();
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Load a single plugin from a directory.
|
|
36
|
-
*/
|
|
37
|
-
loadPlugin(pluginDir) {
|
|
38
|
-
const manifestPath = _path.join.call(void 0, pluginDir, "manifest.json");
|
|
39
|
-
if (!_fs.existsSync.call(void 0, manifestPath)) {
|
|
40
|
-
const pkgPath = _path.join.call(void 0, pluginDir, "package.json");
|
|
41
|
-
if (!_fs.existsSync.call(void 0, pkgPath)) return;
|
|
42
|
-
try {
|
|
43
|
-
const pkg = JSON.parse(_fs.readFileSync.call(void 0, pkgPath, "utf-8"));
|
|
44
|
-
if (!pkg.codeShellPlugin) return;
|
|
45
|
-
this.registerPlugin(pluginDir, pkg.codeShellPlugin);
|
|
46
|
-
} catch (e2) {
|
|
47
|
-
}
|
|
48
|
-
return;
|
|
49
|
-
}
|
|
50
|
-
try {
|
|
51
|
-
const manifest = JSON.parse(_fs.readFileSync.call(void 0, manifestPath, "utf-8"));
|
|
52
|
-
this.registerPlugin(pluginDir, manifest);
|
|
53
|
-
} catch (err) {
|
|
54
|
-
this.plugins.set(pluginDir, {
|
|
55
|
-
manifest: { name: pluginDir, version: "?", description: "Failed to load" },
|
|
56
|
-
path: pluginDir,
|
|
57
|
-
enabled: false,
|
|
58
|
-
error: err.message
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
registerPlugin(path, manifest) {
|
|
63
|
-
this.plugins.set(manifest.name, {
|
|
64
|
-
manifest,
|
|
65
|
-
path,
|
|
66
|
-
enabled: manifest.enabled !== false
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
/** Get a plugin by name. */
|
|
70
|
-
get(name) {
|
|
71
|
-
return this.plugins.get(name);
|
|
72
|
-
}
|
|
73
|
-
/** List all discovered plugins. */
|
|
74
|
-
list() {
|
|
75
|
-
return [...this.plugins.values()];
|
|
76
|
-
}
|
|
77
|
-
/** Enable/disable a plugin. */
|
|
78
|
-
setEnabled(name, enabled) {
|
|
79
|
-
const plugin = this.plugins.get(name);
|
|
80
|
-
if (!plugin) return false;
|
|
81
|
-
plugin.enabled = enabled;
|
|
82
|
-
return true;
|
|
83
|
-
}
|
|
84
|
-
/** Get all enabled plugins. */
|
|
85
|
-
getEnabled() {
|
|
86
|
-
return [...this.plugins.values()].filter((p) => p.enabled);
|
|
87
|
-
}
|
|
88
|
-
}, _class);
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
exports.PluginLoader = PluginLoader;
|
package/dist/loader-J5UID6CV.js
DELETED
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
init_esm_shims
|
|
3
|
-
} from "./chunk-DI7RDLOS.js";
|
|
4
|
-
|
|
5
|
-
// src/plugins/loader.ts
|
|
6
|
-
init_esm_shims();
|
|
7
|
-
import { existsSync, readdirSync, readFileSync } from "fs";
|
|
8
|
-
import { join } from "path";
|
|
9
|
-
import { homedir } from "os";
|
|
10
|
-
var PluginLoader = class {
|
|
11
|
-
plugins = /* @__PURE__ */ new Map();
|
|
12
|
-
/**
|
|
13
|
-
* Scan plugin directories and load manifests.
|
|
14
|
-
*/
|
|
15
|
-
scan(cwd) {
|
|
16
|
-
const dirs = [
|
|
17
|
-
join(homedir(), ".code-shell", "plugins"),
|
|
18
|
-
join(cwd, ".code-shell", "plugins")
|
|
19
|
-
];
|
|
20
|
-
for (const dir of dirs) {
|
|
21
|
-
if (!existsSync(dir)) continue;
|
|
22
|
-
try {
|
|
23
|
-
const entries = readdirSync(dir, { withFileTypes: true });
|
|
24
|
-
for (const entry of entries) {
|
|
25
|
-
if (!entry.isDirectory()) continue;
|
|
26
|
-
const pluginDir = join(dir, entry.name);
|
|
27
|
-
this.loadPlugin(pluginDir);
|
|
28
|
-
}
|
|
29
|
-
} catch {
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
return this.list();
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Load a single plugin from a directory.
|
|
36
|
-
*/
|
|
37
|
-
loadPlugin(pluginDir) {
|
|
38
|
-
const manifestPath = join(pluginDir, "manifest.json");
|
|
39
|
-
if (!existsSync(manifestPath)) {
|
|
40
|
-
const pkgPath = join(pluginDir, "package.json");
|
|
41
|
-
if (!existsSync(pkgPath)) return;
|
|
42
|
-
try {
|
|
43
|
-
const pkg = JSON.parse(readFileSync(pkgPath, "utf-8"));
|
|
44
|
-
if (!pkg.codeShellPlugin) return;
|
|
45
|
-
this.registerPlugin(pluginDir, pkg.codeShellPlugin);
|
|
46
|
-
} catch {
|
|
47
|
-
}
|
|
48
|
-
return;
|
|
49
|
-
}
|
|
50
|
-
try {
|
|
51
|
-
const manifest = JSON.parse(readFileSync(manifestPath, "utf-8"));
|
|
52
|
-
this.registerPlugin(pluginDir, manifest);
|
|
53
|
-
} catch (err) {
|
|
54
|
-
this.plugins.set(pluginDir, {
|
|
55
|
-
manifest: { name: pluginDir, version: "?", description: "Failed to load" },
|
|
56
|
-
path: pluginDir,
|
|
57
|
-
enabled: false,
|
|
58
|
-
error: err.message
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
registerPlugin(path, manifest) {
|
|
63
|
-
this.plugins.set(manifest.name, {
|
|
64
|
-
manifest,
|
|
65
|
-
path,
|
|
66
|
-
enabled: manifest.enabled !== false
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
/** Get a plugin by name. */
|
|
70
|
-
get(name) {
|
|
71
|
-
return this.plugins.get(name);
|
|
72
|
-
}
|
|
73
|
-
/** List all discovered plugins. */
|
|
74
|
-
list() {
|
|
75
|
-
return [...this.plugins.values()];
|
|
76
|
-
}
|
|
77
|
-
/** Enable/disable a plugin. */
|
|
78
|
-
setEnabled(name, enabled) {
|
|
79
|
-
const plugin = this.plugins.get(name);
|
|
80
|
-
if (!plugin) return false;
|
|
81
|
-
plugin.enabled = enabled;
|
|
82
|
-
return true;
|
|
83
|
-
}
|
|
84
|
-
/** Get all enabled plugins. */
|
|
85
|
-
getEnabled() {
|
|
86
|
-
return [...this.plugins.values()].filter((p) => p.enabled);
|
|
87
|
-
}
|
|
88
|
-
};
|
|
89
|
-
export {
|
|
90
|
-
PluginLoader
|
|
91
|
-
};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var _chunkFGZGCFJXcjs = require('./chunk-FGZGCFJX.cjs');
|
|
5
|
-
require('./chunk-IJSHQGMP.cjs');
|
|
6
|
-
_chunkFGZGCFJXcjs.init_manager.call(void 0, );
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
exports.SettingsManager = _chunkFGZGCFJXcjs.SettingsManager;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var _chunkJT2WSQSRcjs = require('./chunk-JT2WSQSR.cjs');
|
|
6
|
-
require('./chunk-IJSHQGMP.cjs');
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
exports.LSPServerManager = _chunkJT2WSQSRcjs.LSPServerManager; exports.getLSPManager = _chunkJT2WSQSRcjs.getLSPManager; exports.initializeLSPManager = _chunkJT2WSQSRcjs.initializeLSPManager;
|
package/dist/manager-HUAQOORS.js
DELETED