@cjhyy/code-shell 0.1.0-alpha.2 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +77 -0
- package/dist/anthropic-IBTI4WL2.cjs +10 -0
- package/dist/anthropic-PRZZKHEZ.js +10 -0
- package/dist/arena/index.cjs +7 -6
- package/dist/arena/index.js +6 -5
- package/dist/arena/model-presets.d.ts +10 -1
- package/dist/{arena-HHDYYVHJ.cjs → arena-KBQOPLFV.cjs} +25 -23
- package/dist/{arena-ENHBHB2W.js → arena-O2L4TN6A.js} +9 -7
- package/dist/{chunk-SW3L7HIM.js → chunk-2EP3CLEN.js} +2 -2
- package/dist/{chunk-EL2RL5DG.cjs → chunk-2YW4FPFG.cjs} +2 -2
- package/dist/chunk-3OA5G4TM.js +47 -0
- package/dist/chunk-52LGZKT3.cjs +47 -0
- package/dist/{chunk-KOGV6PDQ.cjs → chunk-55XGPMAP.cjs} +44 -9
- package/dist/chunk-5ECBT4YA.js +450 -0
- package/dist/{chunk-YD7XTI7T.cjs → chunk-6QVAYW7C.cjs} +116 -28
- package/dist/{chunk-SCDKLTN3.js → chunk-6S4BJ65N.js} +5 -4
- package/dist/{chunk-ZLPJJZUW.js → chunk-76HYEPDM.js} +2 -2
- package/dist/{chunk-FA5KD34T.js → chunk-76W334S4.js} +2 -2
- package/dist/{chunk-GZBD6QRS.cjs → chunk-7EG3V4JY.cjs} +13 -12
- package/dist/{chunk-LMEKCQX4.js → chunk-7JVTYEEC.js} +6 -6
- package/dist/{chunk-ID6EJUHP.js → chunk-7K6SDRRF.js} +1262 -212
- package/dist/{chunk-5C5HIOML.js → chunk-7Y6S3OCX.js} +109 -21
- package/dist/{chunk-G76E5FOB.cjs → chunk-A5LCRPDP.cjs} +4 -4
- package/dist/{chunk-F5BS3GUC.js → chunk-BSW22MPA.js} +39 -4
- package/dist/{chunk-VWFET3MG.cjs → chunk-BUU5PZK2.cjs} +1474 -423
- package/dist/{chunk-HOXQLX5R.cjs → chunk-BWTOS5BH.cjs} +444 -103
- package/dist/{chunk-ZRVPCXI7.js → chunk-BXCY2FSE.js} +2 -1
- package/dist/{chunk-Y7TSCDF6.js → chunk-C5YQBIRK.js} +347 -6
- package/dist/{chunk-C7C7ZZY4.cjs → chunk-HEKQCI7B.cjs} +10 -10
- package/dist/{chunk-JHXNOB5G.cjs → chunk-HS2MFNUC.cjs} +6 -6
- package/dist/{chunk-JHNCK7JP.cjs → chunk-IK4EWJBP.cjs} +4 -3
- package/dist/{chunk-M2QI5X3X.cjs → chunk-JMR33QVF.cjs} +2 -2
- package/dist/{chunk-YAFCN7ZW.cjs → chunk-KOVYSDHZ.cjs} +15 -15
- package/dist/{chunk-IJSHQGMP.cjs → chunk-KS3RYAYL.cjs} +4 -4
- package/dist/{chunk-DI7RDLOS.js → chunk-MD32R22I.js} +7 -4
- package/dist/chunk-MY5XHADU.cjs +216 -0
- package/dist/{chunk-OP57WUWQ.cjs → chunk-NUNC3VFB.cjs} +6 -6
- package/dist/{chunk-TATCTZSB.cjs → chunk-QRM7IF2S.cjs} +133 -175
- package/dist/chunk-R47ROHGL.cjs +298 -0
- package/dist/{chunk-OUC2DFA7.js → chunk-RMYKO74M.js} +3 -3
- package/dist/{chunk-FUOKLKR2.js → chunk-SFXHZSRF.js} +1 -1
- package/dist/{chunk-2EUAE7AY.js → chunk-SIHHIQLO.js} +2 -2
- package/dist/{chunk-3CAZIWUA.cjs → chunk-SNT563K3.cjs} +9 -9
- package/dist/{chunk-SK62UVS6.js → chunk-T6VYG46N.js} +1 -1
- package/dist/{chunk-3QR52LL5.cjs → chunk-TUY2T5KP.cjs} +2 -2
- package/dist/{chunk-I57ZD5IQ.js → chunk-VIAGTYYW.js} +1 -1
- package/dist/{chunk-X2DNIMPC.cjs → chunk-VYL4EFRC.cjs} +32 -32
- package/dist/chunk-W22P377T.js +299 -0
- package/dist/chunk-WASS5YWB.js +215 -0
- package/dist/{chunk-OMRGA6TI.js → chunk-XDIQWQJ4.js} +132 -174
- package/dist/{chunk-BUJ5KYCI.cjs → chunk-YIQBXAYU.cjs} +13 -13
- package/dist/{chunk-REFCCVDM.js → chunk-YJ77GQK5.js} +2 -2
- package/dist/chunk-YUI524OE.cjs +450 -0
- package/dist/{chunk-M2SVOKC6.js → chunk-ZBPSQCPU.js} +6 -6
- package/dist/cli/commands/builtin/export-md.d.ts +19 -0
- package/dist/cli/commands/builtin/init/detect.d.ts +25 -0
- package/dist/cli/commands/builtin/init/index.d.ts +19 -0
- package/dist/cli/main.cjs +2374 -1455
- package/dist/cli/main.js +2505 -1586
- package/dist/cli/migrate-models.d.ts +45 -0
- package/dist/cli/onboarding.d.ts +110 -5
- package/dist/cli/updater.d.ts +51 -4
- package/dist/client-base-HTF236ZD.cjs +9 -0
- package/dist/client-base-QKRKCOWB.js +9 -0
- package/dist/{compaction-YNWCEF7B.js → compaction-6VU2T643.js} +4 -2
- package/dist/compaction-OKUNTCA7.cjs +33 -0
- package/dist/context/compaction.d.ts +35 -3
- package/dist/context/manager.d.ts +40 -3
- package/dist/context/tool-result-storage.d.ts +96 -0
- package/dist/devtools-T2NIZBJK.cjs +6 -0
- package/dist/{devtools-IRQQPIRY.js → devtools-YXWHOVKR.js} +1 -1
- package/dist/engine/engine.d.ts +40 -0
- package/dist/engine/turn-loop.d.ts +6 -0
- package/dist/export-md-RXDW6F5W.cjs +135 -0
- package/dist/export-md-XXKZANW5.js +135 -0
- package/dist/file-history-KYPE3ECT.cjs +7 -0
- package/dist/file-history-LF4F7X26.js +7 -0
- package/dist/index.cjs +42 -22
- package/dist/index.d.ts +5 -2
- package/dist/index.js +40 -20
- package/dist/llm/client-base.d.ts +1 -1
- package/dist/llm/model-cache.d.ts +21 -0
- package/dist/llm/model-fetcher.d.ts +29 -0
- package/dist/llm/model-pool.d.ts +13 -0
- package/dist/llm/provider-catalog.d.ts +30 -0
- package/dist/llm/provider-kinds.d.ts +21 -0
- package/dist/llm/types.d.ts +8 -0
- package/dist/logging/session-recorder.d.ts +77 -0
- package/dist/manager-C2IUXKRC.js +7 -0
- package/dist/manager-YYKWYTRM.cjs +7 -0
- package/dist/mcp-manager-QMKWPBZ4.js +8 -0
- package/dist/mcp-manager-Z3OKI74O.cjs +8 -0
- package/dist/memory-5LWZ6FI2.cjs +9 -0
- package/dist/{memory-EPFDBPII.js → memory-VIJLBAMQ.js} +2 -2
- package/dist/model-cache-5KIYL5SL.js +13 -0
- package/dist/model-cache-OED3IM4R.cjs +13 -0
- package/dist/model-fetcher-HKGICACL.js +8 -0
- package/dist/model-fetcher-UR6WJOQP.cjs +8 -0
- package/dist/openai-JR2WEKOF.js +10 -0
- package/dist/openai-YBTOET4O.cjs +10 -0
- package/dist/openrouter-models-OU4GRZQY.cjs +15 -0
- package/dist/{openrouter-models-OL725CL6.js → openrouter-models-TGKDKY52.js} +2 -2
- package/dist/openrouter-sync-BBHUM3R6.cjs +11 -0
- package/dist/{openrouter-sync-CWD5VNW2.js → openrouter-sync-UXUSJCIR.js} +3 -3
- package/dist/product/index.cjs +17 -15
- package/dist/product/index.js +16 -14
- package/dist/protocol/server.d.ts +3 -1
- package/dist/protocol/types.d.ts +36 -2
- package/dist/run/index.cjs +17 -15
- package/dist/run/index.js +16 -14
- package/dist/services/index.d.ts +0 -1
- package/dist/session-manager-Q22BBMD3.js +8 -0
- package/dist/session-manager-XODQVL3C.cjs +8 -0
- package/dist/settings/schema.d.ts +267 -42
- package/dist/{tool-summary-RYNR4DDB.cjs → tool-summary-63DPIS7G.cjs} +4 -4
- package/dist/{tool-summary-2RUFL5QK.js → tool-summary-NP5CDBKG.js} +2 -2
- package/dist/tool-system/builtin/ask-user.d.ts +9 -1
- package/dist/tool-system/context.d.ts +31 -2
- package/dist/tool-system/executor.d.ts +4 -0
- package/dist/tool-system/investigation-guard.d.ts +37 -0
- package/dist/types.d.ts +13 -2
- package/dist/ui/components/AskUserPrompt.d.ts +8 -1
- package/dist/ui/components/DiffLine.d.ts +33 -0
- package/dist/ui/components/ModelManager.d.ts +34 -1
- package/dist/ui/components/OnboardingPrompt.d.ts +10 -1
- package/dist/ui/components/ProviderModelFlow.d.ts +58 -0
- package/dist/ui/components/UpdateBanner.d.ts +1 -0
- package/dist/updater-QW473OF4.cjs +17 -0
- package/dist/updater-VFUAHCVY.js +17 -0
- package/dist/utils/semver.d.ts +1 -0
- package/dist/utils/task-sanitizer.d.ts +6 -0
- package/package.json +4 -2
- package/scripts/check-node.cjs +21 -0
- package/dist/anthropic-P5VETAFI.cjs +0 -10
- package/dist/anthropic-W2GU3D76.js +0 -10
- package/dist/chunk-75E4BBFC.js +0 -224
- package/dist/chunk-FV2ARONZ.cjs +0 -224
- package/dist/client-base-TOVE25FA.js +0 -9
- package/dist/client-base-VDDIADAC.cjs +0 -9
- package/dist/compaction-D3KV2NWY.cjs +0 -31
- package/dist/devtools-WTC3NFNE.cjs +0 -6
- package/dist/file-history-HZWO2WQ5.js +0 -7
- package/dist/file-history-UQQILIY7.cjs +0 -7
- package/dist/manager-FWLOVEEK.cjs +0 -7
- package/dist/manager-GEXJLOIS.js +0 -7
- package/dist/mcp-manager-37GQLFGX.js +0 -8
- package/dist/mcp-manager-U77NEXBY.cjs +0 -8
- package/dist/memory-ADGOWADP.cjs +0 -9
- package/dist/openai-RXU5URYI.js +0 -10
- package/dist/openai-SQW4H2K4.cjs +0 -10
- package/dist/openrouter-models-UM3AOGZ4.cjs +0 -15
- package/dist/openrouter-sync-HYZZC6RX.cjs +0 -11
- package/dist/services/compact.d.ts +0 -56
- package/dist/session-manager-HRSKENKB.cjs +0 -8
- package/dist/session-manager-NEKFEHF3.js +0 -8
- package/dist/updater-M7L42ASZ.cjs +0 -183
- package/dist/updater-ZRTONIR4.js +0 -183
package/dist/chunk-FV2ARONZ.cjs
DELETED
|
@@ -1,224 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); var _class;
|
|
2
|
-
|
|
3
|
-
var _chunkIJSHQGMPcjs = require('./chunk-IJSHQGMP.cjs');
|
|
4
|
-
|
|
5
|
-
// src/settings/manager.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
|
-
|
|
11
|
-
// src/settings/schema.ts
|
|
12
|
-
_chunkIJSHQGMPcjs.init_cjs_shims.call(void 0, );
|
|
13
|
-
var _zod = require('zod');
|
|
14
|
-
var SettingsSchema = _zod.z.object({
|
|
15
|
-
agent: _zod.z.object({
|
|
16
|
-
// Use z.string() instead of z.enum() to allow custom presets registered via registerPreset()
|
|
17
|
-
preset: _zod.z.string().default("terminal-coding"),
|
|
18
|
-
enabledBuiltinTools: _zod.z.array(_zod.z.string()).default([]),
|
|
19
|
-
disabledBuiltinTools: _zod.z.array(_zod.z.string()).default([]),
|
|
20
|
-
customSystemPrompt: _zod.z.string().optional(),
|
|
21
|
-
appendSystemPrompt: _zod.z.string().optional()
|
|
22
|
-
}).default({}),
|
|
23
|
-
model: _zod.z.object({
|
|
24
|
-
provider: _zod.z.string().default("openai"),
|
|
25
|
-
name: _zod.z.string().default("anthropic/claude-opus-4-6"),
|
|
26
|
-
apiKey: _zod.z.string().optional(),
|
|
27
|
-
baseUrl: _zod.z.string().default("https://openrouter.ai/api/v1"),
|
|
28
|
-
temperature: _zod.z.number().min(0).max(2).default(0.3),
|
|
29
|
-
maxTokens: _zod.z.number().default(8192)
|
|
30
|
-
}).default({}),
|
|
31
|
-
models: _zod.z.array(
|
|
32
|
-
_zod.z.object({
|
|
33
|
-
key: _zod.z.string(),
|
|
34
|
-
label: _zod.z.string().optional(),
|
|
35
|
-
provider: _zod.z.string(),
|
|
36
|
-
model: _zod.z.string(),
|
|
37
|
-
baseUrl: _zod.z.string().optional(),
|
|
38
|
-
apiKey: _zod.z.string().optional(),
|
|
39
|
-
maxOutputTokens: _zod.z.number().optional(),
|
|
40
|
-
maxContextTokens: _zod.z.number().optional()
|
|
41
|
-
})
|
|
42
|
-
).default([]),
|
|
43
|
-
permissions: _zod.z.object({
|
|
44
|
-
defaultMode: _zod.z.enum(["default", "acceptEdits", "dontAsk", "bypassPermissions", "auto", "plan"]).default("default"),
|
|
45
|
-
rules: _zod.z.array(
|
|
46
|
-
_zod.z.object({
|
|
47
|
-
tool: _zod.z.string(),
|
|
48
|
-
argsPattern: _zod.z.record(_zod.z.string()).optional(),
|
|
49
|
-
decision: _zod.z.enum(["allow", "deny", "ask"]),
|
|
50
|
-
reason: _zod.z.string().optional()
|
|
51
|
-
})
|
|
52
|
-
).default([])
|
|
53
|
-
}).default({}),
|
|
54
|
-
context: _zod.z.object({
|
|
55
|
-
maxTokens: _zod.z.number().default(2e5),
|
|
56
|
-
compactAtRatio: _zod.z.number().default(0.6),
|
|
57
|
-
summarizeAtRatio: _zod.z.number().default(0.8)
|
|
58
|
-
}).default({}),
|
|
59
|
-
session: _zod.z.object({
|
|
60
|
-
storageDir: _zod.z.string().optional(),
|
|
61
|
-
maxHistory: _zod.z.number().default(100)
|
|
62
|
-
}).default({}),
|
|
63
|
-
mcpServers: _zod.z.record(
|
|
64
|
-
_zod.z.object({
|
|
65
|
-
name: _zod.z.string(),
|
|
66
|
-
command: _zod.z.string().optional(),
|
|
67
|
-
args: _zod.z.array(_zod.z.string()).optional(),
|
|
68
|
-
env: _zod.z.record(_zod.z.string()).optional(),
|
|
69
|
-
url: _zod.z.string().optional(),
|
|
70
|
-
transport: _zod.z.enum(["stdio", "sse", "streamable-http", "inprocess"]).optional(),
|
|
71
|
-
headers: _zod.z.record(_zod.z.string()).optional()
|
|
72
|
-
})
|
|
73
|
-
).default({}),
|
|
74
|
-
instructions: _zod.z.object({
|
|
75
|
-
fileName: _zod.z.string().default("CODESHELL.md"),
|
|
76
|
-
scanDirs: _zod.z.array(_zod.z.string()).default([]),
|
|
77
|
-
compatFileNames: _zod.z.array(_zod.z.string()).default(["CLAUDE.md", "AGENTS.md"]),
|
|
78
|
-
ignoreGitBoundary: _zod.z.boolean().default(false)
|
|
79
|
-
}).default({}),
|
|
80
|
-
arena: _zod.z.object({
|
|
81
|
-
participants: _zod.z.array(
|
|
82
|
-
_zod.z.union([
|
|
83
|
-
// Short form: just a model pool key
|
|
84
|
-
_zod.z.string(),
|
|
85
|
-
// Full form: explicit config (backward compat)
|
|
86
|
-
_zod.z.object({
|
|
87
|
-
name: _zod.z.string(),
|
|
88
|
-
model: _zod.z.string(),
|
|
89
|
-
provider: _zod.z.string().optional(),
|
|
90
|
-
apiKey: _zod.z.string().optional(),
|
|
91
|
-
baseUrl: _zod.z.string().optional()
|
|
92
|
-
})
|
|
93
|
-
])
|
|
94
|
-
).default([])
|
|
95
|
-
}).default({}),
|
|
96
|
-
search: _zod.z.object({
|
|
97
|
-
provider: _zod.z.enum(["serper", "tavily", "searxng"]).default("serper"),
|
|
98
|
-
apiKey: _zod.z.string().optional(),
|
|
99
|
-
baseUrl: _zod.z.string().optional()
|
|
100
|
-
}).default({}),
|
|
101
|
-
output: _zod.z.object({
|
|
102
|
-
format: _zod.z.enum(["text", "json", "jsonl", "stream-json"]).default("text")
|
|
103
|
-
}).default({})
|
|
104
|
-
}).passthrough();
|
|
105
|
-
function validateSettings(raw) {
|
|
106
|
-
return SettingsSchema.parse(raw);
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
// src/settings/manager.ts
|
|
110
|
-
var SettingsManager = (_class = class {
|
|
111
|
-
constructor(cwd = process.cwd()) {;_class.prototype.__init.call(this);_class.prototype.__init2.call(this);
|
|
112
|
-
this.cwd = cwd;
|
|
113
|
-
}
|
|
114
|
-
__init() {this.sources = []}
|
|
115
|
-
__init2() {this.merged = null}
|
|
116
|
-
/**
|
|
117
|
-
* Load settings from all sources.
|
|
118
|
-
*/
|
|
119
|
-
load(flagOverrides) {
|
|
120
|
-
this.sources = [];
|
|
121
|
-
this.loadJsonFile(_path.join.call(void 0, _os.homedir.call(void 0, ), ".code-shell", "settings.managed.json"), "managed", 0);
|
|
122
|
-
this.loadJsonFile(_path.join.call(void 0, _os.homedir.call(void 0, ), ".code-shell", "settings.json"), "user", 1);
|
|
123
|
-
this.loadJsonFile(_path.join.call(void 0, _os.homedir.call(void 0, ), ".claude", "settings.json"), "user", 1);
|
|
124
|
-
this.loadJsonFile(_path.join.call(void 0, this.cwd, ".code-shell", "settings.json"), "project", 2);
|
|
125
|
-
this.loadJsonFile(_path.join.call(void 0, this.cwd, ".claude", "settings.json"), "project", 2);
|
|
126
|
-
this.loadJsonFile(_path.join.call(void 0, this.cwd, ".code-shell", "settings.local.json"), "local", 3);
|
|
127
|
-
this.loadJsonFile(_path.join.call(void 0, this.cwd, ".claude", "settings.local.json"), "local", 3);
|
|
128
|
-
if (flagOverrides && Object.keys(flagOverrides).length > 0) {
|
|
129
|
-
this.sources.push({ name: "flag", priority: 4, data: flagOverrides });
|
|
130
|
-
}
|
|
131
|
-
this.sources.sort((a, b) => a.priority - b.priority);
|
|
132
|
-
const raw = this.deepMerge();
|
|
133
|
-
this.merged = validateSettings(raw);
|
|
134
|
-
return this.merged;
|
|
135
|
-
}
|
|
136
|
-
/**
|
|
137
|
-
* Get current effective settings.
|
|
138
|
-
*/
|
|
139
|
-
get() {
|
|
140
|
-
if (!this.merged) return this.load();
|
|
141
|
-
return this.merged;
|
|
142
|
-
}
|
|
143
|
-
/**
|
|
144
|
-
* Invalidate cached merge.
|
|
145
|
-
*/
|
|
146
|
-
invalidate() {
|
|
147
|
-
this.merged = null;
|
|
148
|
-
}
|
|
149
|
-
/**
|
|
150
|
-
* Persist a single setting (dotted key path) to the user-level config file
|
|
151
|
-
* at ~/.code-shell/settings.json. Other sources (project / local /
|
|
152
|
-
* managed) are intentionally untouched: writing back to project/local
|
|
153
|
-
* would surprise version control, and managed is read-only.
|
|
154
|
-
*
|
|
155
|
-
* The merged cache is invalidated so the next get() picks up the change.
|
|
156
|
-
*/
|
|
157
|
-
saveUserSetting(key, value) {
|
|
158
|
-
const path = _path.join.call(void 0, _os.homedir.call(void 0, ), ".code-shell", "settings.json");
|
|
159
|
-
let current = {};
|
|
160
|
-
if (_fs.existsSync.call(void 0, path)) {
|
|
161
|
-
try {
|
|
162
|
-
const raw = _fs.readFileSync.call(void 0, path, "utf-8");
|
|
163
|
-
const parsed = JSON.parse(raw);
|
|
164
|
-
if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
|
|
165
|
-
current = parsed;
|
|
166
|
-
}
|
|
167
|
-
} catch (e) {
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
const parts = key.split(".");
|
|
171
|
-
let target = current;
|
|
172
|
-
for (let i = 0; i < parts.length - 1; i++) {
|
|
173
|
-
const seg = parts[i];
|
|
174
|
-
const next = target[seg];
|
|
175
|
-
if (!next || typeof next !== "object" || Array.isArray(next)) {
|
|
176
|
-
target[seg] = {};
|
|
177
|
-
}
|
|
178
|
-
target = target[seg];
|
|
179
|
-
}
|
|
180
|
-
target[parts[parts.length - 1]] = value;
|
|
181
|
-
_fs.mkdirSync.call(void 0, _path.dirname.call(void 0, path), { recursive: true });
|
|
182
|
-
const tmp = `${path}.${process.pid}.${Date.now()}.tmp`;
|
|
183
|
-
_fs.writeFileSync.call(void 0, tmp, JSON.stringify(current, null, 2), "utf-8");
|
|
184
|
-
_fs.renameSync.call(void 0, tmp, path);
|
|
185
|
-
this.invalidate();
|
|
186
|
-
}
|
|
187
|
-
loadJsonFile(path, name, priority) {
|
|
188
|
-
if (!_fs.existsSync.call(void 0, path)) return;
|
|
189
|
-
try {
|
|
190
|
-
const content = _fs.readFileSync.call(void 0, path, "utf-8");
|
|
191
|
-
const data = JSON.parse(content);
|
|
192
|
-
if (typeof data === "object" && data !== null) {
|
|
193
|
-
this.sources.push({ name, priority, data });
|
|
194
|
-
}
|
|
195
|
-
} catch (e2) {
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
deepMerge() {
|
|
199
|
-
let result = {};
|
|
200
|
-
for (const source of this.sources) {
|
|
201
|
-
result = merge(result, source.data);
|
|
202
|
-
}
|
|
203
|
-
return result;
|
|
204
|
-
}
|
|
205
|
-
}, _class);
|
|
206
|
-
function merge(base, override) {
|
|
207
|
-
const result = { ...base };
|
|
208
|
-
for (const [key, value] of Object.entries(override)) {
|
|
209
|
-
if (value === null) {
|
|
210
|
-
delete result[key];
|
|
211
|
-
} else if (typeof value === "object" && !Array.isArray(value) && typeof result[key] === "object" && !Array.isArray(result[key]) && result[key] !== null) {
|
|
212
|
-
result[key] = merge(result[key], value);
|
|
213
|
-
} else {
|
|
214
|
-
result[key] = value;
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
return result;
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
exports.SettingsSchema = SettingsSchema; exports.validateSettings = validateSettings; exports.SettingsManager = SettingsManager;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
-
|
|
3
|
-
var _chunkGZBD6QRScjs = require('./chunk-GZBD6QRS.cjs');
|
|
4
|
-
require('./chunk-EL2RL5DG.cjs');
|
|
5
|
-
require('./chunk-JHNCK7JP.cjs');
|
|
6
|
-
require('./chunk-IJSHQGMP.cjs');
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
exports.LLMClientBase = _chunkGZBD6QRScjs.LLMClientBase;
|
|
@@ -1,31 +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 _chunkYD7XTI7Tcjs = require('./chunk-YD7XTI7T.cjs');
|
|
16
|
-
require('./chunk-IJSHQGMP.cjs');
|
|
17
|
-
_chunkYD7XTI7Tcjs.init_compaction.call(void 0, );
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
exports.adjustIndexToPreserveAPIInvariants = _chunkYD7XTI7Tcjs.adjustIndexToPreserveAPIInvariants; exports.applySummaryCompaction = _chunkYD7XTI7Tcjs.applySummaryCompaction; exports.applyToolResultBudget = _chunkYD7XTI7Tcjs.applyToolResultBudget; exports.buildSummarizationPrompt = _chunkYD7XTI7Tcjs.buildSummarizationPrompt; exports.dropOldestRounds = _chunkYD7XTI7Tcjs.dropOldestRounds; exports.estimateTokens = _chunkYD7XTI7Tcjs.estimateTokens; exports.extractReferencedFilePaths = _chunkYD7XTI7Tcjs.extractReferencedFilePaths; exports.groupMessagesByApiRound = _chunkYD7XTI7Tcjs.groupMessagesByApiRound; exports.microcompact = _chunkYD7XTI7Tcjs.microcompact; exports.snipCompact = _chunkYD7XTI7Tcjs.snipCompact; exports.truncateToolResult = _chunkYD7XTI7Tcjs.truncateToolResult; exports.windowCompact = _chunkYD7XTI7Tcjs.windowCompact;
|
package/dist/manager-GEXJLOIS.js
DELETED
package/dist/memory-ADGOWADP.cjs
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var _chunkM2QI5X3Xcjs = require('./chunk-M2QI5X3X.cjs');
|
|
5
|
-
require('./chunk-IJSHQGMP.cjs');
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
exports.MemoryManager = _chunkM2QI5X3Xcjs.MemoryManager; exports.resolveMemoryBaseDir = _chunkM2QI5X3Xcjs.resolveMemoryBaseDir;
|
package/dist/openai-RXU5URYI.js
DELETED
package/dist/openai-SQW4H2K4.cjs
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
-
|
|
3
|
-
var _chunkYAFCN7ZWcjs = require('./chunk-YAFCN7ZW.cjs');
|
|
4
|
-
require('./chunk-GZBD6QRS.cjs');
|
|
5
|
-
require('./chunk-EL2RL5DG.cjs');
|
|
6
|
-
require('./chunk-JHNCK7JP.cjs');
|
|
7
|
-
require('./chunk-IJSHQGMP.cjs');
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
exports.OpenAIClient = _chunkYAFCN7ZWcjs.OpenAIClient;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
var _chunkTATCTZSBcjs = require('./chunk-TATCTZSB.cjs');
|
|
8
|
-
require('./chunk-IJSHQGMP.cjs');
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
exports.findOpenRouterModel = _chunkTATCTZSBcjs.findOpenRouterModel; exports.getOpenRouterModels = _chunkTATCTZSBcjs.getOpenRouterModels; exports.getOpenRouterSnapshot = _chunkTATCTZSBcjs.getOpenRouterSnapshot; exports.listOpenRouterModelsByVendor = _chunkTATCTZSBcjs.listOpenRouterModelsByVendor; exports.setOpenRouterSnapshot = _chunkTATCTZSBcjs.setOpenRouterSnapshot;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
-
|
|
3
|
-
var _chunkG76E5FOBcjs = require('./chunk-G76E5FOB.cjs');
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
var _chunkTATCTZSBcjs = require('./chunk-TATCTZSB.cjs');
|
|
7
|
-
require('./chunk-IJSHQGMP.cjs');
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
exports.getOpenRouterSnapshot = _chunkTATCTZSBcjs.getOpenRouterSnapshot; exports.syncOpenRouterCatalog = _chunkG76E5FOBcjs.syncOpenRouterCatalog;
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Compaction service — context window management and auto-compaction.
|
|
3
|
-
*
|
|
4
|
-
* Provides microcompact (inline trimming), autocompact (threshold-based),
|
|
5
|
-
* and full compaction (LLM-based summarization) strategies.
|
|
6
|
-
*/
|
|
7
|
-
export interface CompactionConfig {
|
|
8
|
-
/** Max context tokens before triggering auto-compaction */
|
|
9
|
-
autoCompactThreshold: number;
|
|
10
|
-
/** Percentage of context to retain after compaction (0-1) */
|
|
11
|
-
retentionRatio: number;
|
|
12
|
-
/** Whether to preserve system messages during compaction */
|
|
13
|
-
preserveSystemMessages: boolean;
|
|
14
|
-
/** Whether auto-compaction is enabled */
|
|
15
|
-
autoCompactEnabled: boolean;
|
|
16
|
-
}
|
|
17
|
-
export interface CompactionResult {
|
|
18
|
-
/** Summary text that replaces the compacted content */
|
|
19
|
-
summary: string;
|
|
20
|
-
/** Number of messages removed */
|
|
21
|
-
messagesRemoved: number;
|
|
22
|
-
/** Tokens freed */
|
|
23
|
-
tokensFreed: number;
|
|
24
|
-
/** Strategy used */
|
|
25
|
-
strategy: "micro" | "auto" | "full";
|
|
26
|
-
}
|
|
27
|
-
export interface Message {
|
|
28
|
-
role: string;
|
|
29
|
-
content: string | unknown[];
|
|
30
|
-
tokenEstimate?: number;
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Micro-compaction: trim tool results and long messages inline.
|
|
34
|
-
*/
|
|
35
|
-
export declare function microCompact(messages: Message[], maxTokensPerMessage?: number): Message[];
|
|
36
|
-
/**
|
|
37
|
-
* Check if auto-compaction should be triggered.
|
|
38
|
-
*/
|
|
39
|
-
export declare function shouldAutoCompact(currentTokens: number, config?: CompactionConfig): boolean;
|
|
40
|
-
/**
|
|
41
|
-
* Build a compaction prompt for LLM-based summarization.
|
|
42
|
-
*/
|
|
43
|
-
export declare function buildCompactionPrompt(messages: Message[], customInstructions?: string): string;
|
|
44
|
-
/**
|
|
45
|
-
* Apply compaction by removing old messages and inserting a summary.
|
|
46
|
-
*/
|
|
47
|
-
export declare function applyCompaction(messages: Message[], summary: string, config?: CompactionConfig): {
|
|
48
|
-
messages: Message[];
|
|
49
|
-
result: CompactionResult;
|
|
50
|
-
};
|
|
51
|
-
export declare const compactionService: {
|
|
52
|
-
microCompact: typeof microCompact;
|
|
53
|
-
shouldAutoCompact: typeof shouldAutoCompact;
|
|
54
|
-
buildCompactionPrompt: typeof buildCompactionPrompt;
|
|
55
|
-
applyCompaction: typeof applyCompaction;
|
|
56
|
-
};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
-
|
|
3
|
-
var _chunkOP57WUWQcjs = require('./chunk-OP57WUWQ.cjs');
|
|
4
|
-
require('./chunk-EL2RL5DG.cjs');
|
|
5
|
-
require('./chunk-IJSHQGMP.cjs');
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
exports.SessionManager = _chunkOP57WUWQcjs.SessionManager;
|
|
@@ -1,183 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var _chunkIJSHQGMPcjs = require('./chunk-IJSHQGMP.cjs');
|
|
5
|
-
|
|
6
|
-
// package.json
|
|
7
|
-
var require_package = _chunkIJSHQGMPcjs.__commonJS.call(void 0, {
|
|
8
|
-
"package.json"(exports, module) {
|
|
9
|
-
module.exports = {
|
|
10
|
-
name: "@cjhyy/code-shell",
|
|
11
|
-
version: "0.1.0-alpha.2",
|
|
12
|
-
description: "Code Shell \u2014 general-purpose agent orchestration framework with a terminal coding preset",
|
|
13
|
-
type: "module",
|
|
14
|
-
main: "./dist/index.cjs",
|
|
15
|
-
module: "./dist/index.js",
|
|
16
|
-
types: "./dist/index.d.ts",
|
|
17
|
-
exports: {
|
|
18
|
-
".": {
|
|
19
|
-
types: "./dist/index.d.ts",
|
|
20
|
-
import: "./dist/index.js",
|
|
21
|
-
require: "./dist/index.cjs"
|
|
22
|
-
},
|
|
23
|
-
"./run": {
|
|
24
|
-
types: "./dist/run/index.d.ts",
|
|
25
|
-
import: "./dist/run/index.js",
|
|
26
|
-
require: "./dist/run/index.cjs"
|
|
27
|
-
},
|
|
28
|
-
"./arena": {
|
|
29
|
-
types: "./dist/arena/index.d.ts",
|
|
30
|
-
import: "./dist/arena/index.js",
|
|
31
|
-
require: "./dist/arena/index.cjs"
|
|
32
|
-
},
|
|
33
|
-
"./product": {
|
|
34
|
-
types: "./dist/product/index.d.ts",
|
|
35
|
-
import: "./dist/product/index.js",
|
|
36
|
-
require: "./dist/product/index.cjs"
|
|
37
|
-
},
|
|
38
|
-
"./package.json": "./package.json"
|
|
39
|
-
},
|
|
40
|
-
bin: {
|
|
41
|
-
"code-shell": "dist/cli/main.js"
|
|
42
|
-
},
|
|
43
|
-
repository: {
|
|
44
|
-
type: "git",
|
|
45
|
-
url: "git+https://github.com/cjhyy/codeshell.git"
|
|
46
|
-
},
|
|
47
|
-
homepage: "https://github.com/cjhyy/codeshell#readme",
|
|
48
|
-
bugs: {
|
|
49
|
-
url: "https://github.com/cjhyy/codeshell/issues"
|
|
50
|
-
},
|
|
51
|
-
publishConfig: {
|
|
52
|
-
access: "public"
|
|
53
|
-
},
|
|
54
|
-
scripts: {
|
|
55
|
-
build: "bun run sync-models && bun run tsup && bun run build:dts",
|
|
56
|
-
"build:dts": "tsc --emitDeclarationOnly --declaration --outDir dist || true",
|
|
57
|
-
"sync-models": "bun run scripts/sync-models.ts",
|
|
58
|
-
dev: "CODE_SHELL_DEV=1 bun run src/cli/main.ts",
|
|
59
|
-
test: "bun test",
|
|
60
|
-
"test:watch": "bun test --watch",
|
|
61
|
-
lint: "eslint src/",
|
|
62
|
-
format: "prettier --write 'src/**/*.ts'",
|
|
63
|
-
typecheck: "bun run tsc --noEmit",
|
|
64
|
-
prepublishOnly: "bun run build"
|
|
65
|
-
},
|
|
66
|
-
engines: {
|
|
67
|
-
node: ">=20"
|
|
68
|
-
},
|
|
69
|
-
files: [
|
|
70
|
-
"dist",
|
|
71
|
-
"README.md",
|
|
72
|
-
"LICENSE",
|
|
73
|
-
"CHANGELOG.md"
|
|
74
|
-
],
|
|
75
|
-
keywords: [
|
|
76
|
-
"ai",
|
|
77
|
-
"agent",
|
|
78
|
-
"orchestration",
|
|
79
|
-
"coding-assistant",
|
|
80
|
-
"cli",
|
|
81
|
-
"claude-code",
|
|
82
|
-
"mcp",
|
|
83
|
-
"llm"
|
|
84
|
-
],
|
|
85
|
-
author: "maki maki",
|
|
86
|
-
license: "MIT",
|
|
87
|
-
dependencies: {
|
|
88
|
-
"@alcalzone/ansi-tokenize": "^0.3.0",
|
|
89
|
-
"@anthropic-ai/sdk": "^0.39.0",
|
|
90
|
-
"@modelcontextprotocol/sdk": "^1.12.1",
|
|
91
|
-
asciichart: "^1.5.25",
|
|
92
|
-
"auto-bind": "^5.0.1",
|
|
93
|
-
"bidi-js": "^1.0.3",
|
|
94
|
-
chalk: "^5.4.1",
|
|
95
|
-
"cli-boxes": "^4.0.1",
|
|
96
|
-
"cli-highlight": "^2.1.11",
|
|
97
|
-
"code-excerpt": "^4.0.0",
|
|
98
|
-
commander: "^13.1.0",
|
|
99
|
-
diff: "^8.0.4",
|
|
100
|
-
"emoji-regex": "^10.6.0",
|
|
101
|
-
"get-east-asian-width": "^1.5.0",
|
|
102
|
-
glob: "^11.0.0",
|
|
103
|
-
"indent-string": "^5.0.0",
|
|
104
|
-
"lodash-es": "^4.17.23",
|
|
105
|
-
marked: "^17.0.5",
|
|
106
|
-
"marked-terminal": "^7.3.0",
|
|
107
|
-
nanoid: "^5.1.2",
|
|
108
|
-
openai: "^4.82.0",
|
|
109
|
-
ora: "^9.3.0",
|
|
110
|
-
"proper-lockfile": "^4.1.2",
|
|
111
|
-
react: "^19.2.4",
|
|
112
|
-
"react-reconciler": "^0.33.0",
|
|
113
|
-
semver: "^7.7.4",
|
|
114
|
-
"signal-exit": "^4.1.0",
|
|
115
|
-
"stack-utils": "^2.0.6",
|
|
116
|
-
"strip-ansi": "^7.2.0",
|
|
117
|
-
"supports-hyperlinks": "^4.4.0",
|
|
118
|
-
"type-fest": "^5.5.0",
|
|
119
|
-
"usehooks-ts": "^3.1.1",
|
|
120
|
-
"wrap-ansi": "^10.0.0",
|
|
121
|
-
yaml: "^2.7.0",
|
|
122
|
-
"yoga-layout": "^3.2.1",
|
|
123
|
-
zod: "^3.24.2"
|
|
124
|
-
},
|
|
125
|
-
devDependencies: {
|
|
126
|
-
"@eslint/js": "^10.0.1",
|
|
127
|
-
"@types/lodash": "^4.17.24",
|
|
128
|
-
"@types/lodash-es": "^4.17.12",
|
|
129
|
-
"@types/node": "^22.12.0",
|
|
130
|
-
"@types/react": "^19.2.14",
|
|
131
|
-
"@types/semver": "^7.7.1",
|
|
132
|
-
eslint: "^9.19.0",
|
|
133
|
-
prettier: "^3.4.2",
|
|
134
|
-
tsup: "^8.3.6",
|
|
135
|
-
typescript: "^5.7.3",
|
|
136
|
-
"typescript-eslint": "^8.59.0"
|
|
137
|
-
}
|
|
138
|
-
};
|
|
139
|
-
}
|
|
140
|
-
});
|
|
141
|
-
|
|
142
|
-
// src/cli/updater.ts
|
|
143
|
-
_chunkIJSHQGMPcjs.init_cjs_shims.call(void 0, );
|
|
144
|
-
var _child_process = require('child_process');
|
|
145
|
-
var _updateAvailable;
|
|
146
|
-
function checkForUpdate(packageName = "code-shell") {
|
|
147
|
-
try {
|
|
148
|
-
const currentVersion = getCurrentVersion();
|
|
149
|
-
const latestVersion = _child_process.execSync.call(void 0, `npm view ${packageName} version 2>/dev/null`, {
|
|
150
|
-
encoding: "utf-8",
|
|
151
|
-
timeout: 5e3
|
|
152
|
-
}).trim();
|
|
153
|
-
if (latestVersion && latestVersion !== currentVersion && compareVersions(latestVersion, currentVersion) > 0) {
|
|
154
|
-
_updateAvailable = latestVersion;
|
|
155
|
-
}
|
|
156
|
-
} catch (e) {
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
function getUpdateAvailable() {
|
|
160
|
-
return _updateAvailable;
|
|
161
|
-
}
|
|
162
|
-
function getCurrentVersion() {
|
|
163
|
-
try {
|
|
164
|
-
const pkg = require_package();
|
|
165
|
-
return _nullishCoalesce(pkg.version, () => ( "0.1.0"));
|
|
166
|
-
} catch (e2) {
|
|
167
|
-
return "0.1.0";
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
function compareVersions(a, b) {
|
|
171
|
-
const pa = a.split(".").map(Number);
|
|
172
|
-
const pb = b.split(".").map(Number);
|
|
173
|
-
for (let i = 0; i < 3; i++) {
|
|
174
|
-
const diff = (_nullishCoalesce(pa[i], () => ( 0))) - (_nullishCoalesce(pb[i], () => ( 0)));
|
|
175
|
-
if (diff !== 0) return diff;
|
|
176
|
-
}
|
|
177
|
-
return 0;
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
exports.checkForUpdate = checkForUpdate; exports.getCurrentVersion = getCurrentVersion; exports.getUpdateAvailable = getUpdateAvailable;
|