@cjhyy/code-shell 0.1.5 → 0.1.7
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 +30 -0
- package/dist/anthropic-UBSB5AQH.js +1 -0
- package/dist/arena/index.js +1 -104
- package/dist/arena-OW55ZCHT.js +3 -0
- package/dist/bwrap-PVZMLHZR.js +2 -0
- package/dist/chunk-2NS3JMNK.js +1 -0
- package/dist/chunk-3QP5BQ3L.js +1 -0
- package/dist/chunk-B7K2OWKC.js +2 -0
- package/dist/chunk-EWWK56K6.js +2 -0
- package/dist/chunk-FU7AHZNN.js +1 -0
- package/dist/chunk-HIJ2XXGX.js +1 -0
- package/dist/chunk-KCXSARAA.js +1 -0
- package/dist/chunk-NFH3UQ3E.js +2 -0
- package/dist/chunk-NMBYBGC7.js +250 -0
- package/dist/chunk-NVAZJ5XS.js +2 -0
- package/dist/chunk-O5HFCH2U.js +1 -0
- package/dist/chunk-P6JSTIFM.js +1 -0
- package/dist/chunk-PGANL6F2.js +3 -0
- package/dist/chunk-Q4O2HGWS.js +251 -0
- package/dist/chunk-QTWU7UNA.js +5 -0
- package/dist/chunk-RP26WO4R.js +1 -0
- package/dist/chunk-SNFAPSLA.js +1 -0
- package/dist/chunk-T222K6IV.js +18 -0
- package/dist/chunk-TKJA6W36.js +3 -0
- package/dist/chunk-UDPUTFQT.js +2 -0
- package/dist/chunk-W47Z7MGS.js +33 -0
- package/dist/chunk-WI6FSWGU.js +1 -0
- package/dist/chunk-WOP6MJKW.js +1 -0
- package/dist/chunk-XDOWC7EG.js +4 -0
- package/dist/chunk-Y2NS6HPO.js +641 -0
- package/dist/cli/main.js +303 -22037
- package/dist/cli/updater.d.ts +8 -0
- package/dist/client-base-6ZZJJYDY.js +1 -0
- package/dist/compaction-ECVQVOCT.js +1 -0
- package/dist/devtools-SGDUOOM4.js +1 -0
- package/dist/engine/engine.d.ts +15 -0
- package/dist/export-md-U72T7NW7.js +22 -0
- package/dist/file-history-7FQFEQOL.js +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -347
- package/dist/llm/token-counter.d.ts +17 -0
- package/dist/manager-C3TDN6MS.js +1 -0
- package/dist/mcp-manager-OP4XYV53.js +1 -0
- package/dist/memory-BNI4WEWL.js +1 -0
- package/dist/model-cache-HEDXI7UJ.js +1 -0
- package/dist/model-fetcher-BJ64META.js +1 -0
- package/dist/off-7SDVMMXW.js +1 -0
- package/dist/openai-KEWQ54TM.js +1 -0
- package/dist/openrouter-models-AM6M52D6.js +1 -0
- package/dist/openrouter-sync-5JNBL3Z6.js +1 -0
- package/dist/product/index.js +1 -21
- package/dist/run/index.js +1 -48
- package/dist/seatbelt-WBYROQT6.js +37 -0
- package/dist/session/session-manager.d.ts +2 -0
- package/dist/session-manager-AGWS5SMJ.js +1 -0
- package/dist/settings/schema.d.ts +72 -6
- package/dist/tool-summary-5UE62VU4.js +2 -0
- package/dist/tool-system/builtin/bash.d.ts +7 -1
- package/dist/tool-system/context.d.ts +7 -0
- package/dist/tool-system/investigation-guard.d.ts +9 -0
- package/dist/tool-system/sandbox/bwrap.d.ts +13 -0
- package/dist/tool-system/sandbox/index.d.ts +71 -0
- package/dist/tool-system/sandbox/off.d.ts +2 -0
- package/dist/tool-system/sandbox/seatbelt.d.ts +18 -0
- package/dist/types.d.ts +4 -0
- package/dist/ui/components/SessionPicker.d.ts +2 -0
- package/dist/ui/components/SpinnerWithVerb.d.ts +2 -2
- package/dist/ui/components/StatusLine.d.ts +2 -2
- package/dist/updater-OCNU2K2Z.js +1 -0
- package/package.json +8 -10
- package/skills-builtin/codeshell-help.md +135 -0
- package/dist/anthropic-IBTI4WL2.cjs +0 -10
- package/dist/anthropic-PRZZKHEZ.js +0 -10
- package/dist/arena/index.cjs +0 -104
- package/dist/arena-KBQOPLFV.cjs +0 -261
- package/dist/arena-O2L4TN6A.js +0 -261
- package/dist/chunk-2EP3CLEN.js +0 -44
- package/dist/chunk-2YW4FPFG.cjs +0 -101
- package/dist/chunk-3OA5G4TM.js +0 -47
- package/dist/chunk-52LGZKT3.cjs +0 -47
- package/dist/chunk-55XGPMAP.cjs +0 -146
- package/dist/chunk-5ECBT4YA.js +0 -450
- package/dist/chunk-6QVAYW7C.cjs +0 -438
- package/dist/chunk-6S4BJ65N.js +0 -113
- package/dist/chunk-76HYEPDM.js +0 -307
- package/dist/chunk-76W334S4.js +0 -54
- package/dist/chunk-7EG3V4JY.cjs +0 -113
- package/dist/chunk-7JVTYEEC.js +0 -340
- package/dist/chunk-7K6SDRRF.js +0 -9047
- package/dist/chunk-7Y6S3OCX.js +0 -438
- package/dist/chunk-A5LCRPDP.cjs +0 -54
- package/dist/chunk-BSW22MPA.js +0 -146
- package/dist/chunk-BUU5PZK2.cjs +0 -9048
- package/dist/chunk-BWTOS5BH.cjs +0 -5128
- package/dist/chunk-BXCY2FSE.js +0 -203
- package/dist/chunk-C5YQBIRK.js +0 -5128
- package/dist/chunk-HEKQCI7B.cjs +0 -224
- package/dist/chunk-HS2MFNUC.cjs +0 -44
- package/dist/chunk-IK4EWJBP.cjs +0 -203
- package/dist/chunk-JMR33QVF.cjs +0 -169
- package/dist/chunk-KOVYSDHZ.cjs +0 -340
- package/dist/chunk-KS3RYAYL.cjs +0 -45
- package/dist/chunk-MD32R22I.js +0 -50
- package/dist/chunk-MY5XHADU.cjs +0 -216
- package/dist/chunk-NUNC3VFB.cjs +0 -307
- package/dist/chunk-QRM7IF2S.cjs +0 -4711
- package/dist/chunk-R47ROHGL.cjs +0 -298
- package/dist/chunk-RMYKO74M.js +0 -1252
- package/dist/chunk-SFXHZSRF.js +0 -101
- package/dist/chunk-SIHHIQLO.js +0 -224
- package/dist/chunk-SNT563K3.cjs +0 -107
- package/dist/chunk-T6VYG46N.js +0 -105
- package/dist/chunk-TUY2T5KP.cjs +0 -105
- package/dist/chunk-VIAGTYYW.js +0 -169
- package/dist/chunk-VYL4EFRC.cjs +0 -1252
- package/dist/chunk-W22P377T.js +0 -299
- package/dist/chunk-WASS5YWB.js +0 -215
- package/dist/chunk-XDIQWQJ4.js +0 -4711
- package/dist/chunk-YIQBXAYU.cjs +0 -264
- package/dist/chunk-YJ77GQK5.js +0 -107
- package/dist/chunk-YUI524OE.cjs +0 -450
- package/dist/chunk-ZBPSQCPU.js +0 -264
- package/dist/cli/main.cjs +0 -22133
- package/dist/client-base-HTF236ZD.cjs +0 -9
- package/dist/client-base-QKRKCOWB.js +0 -9
- package/dist/compaction-6VU2T643.js +0 -33
- package/dist/compaction-OKUNTCA7.cjs +0 -33
- package/dist/devtools-T2NIZBJK.cjs +0 -6
- package/dist/devtools-YXWHOVKR.js +0 -6
- package/dist/export-md-RXDW6F5W.cjs +0 -135
- package/dist/export-md-XXKZANW5.js +0 -135
- package/dist/file-history-KYPE3ECT.cjs +0 -7
- package/dist/file-history-LF4F7X26.js +0 -7
- package/dist/index.cjs +0 -347
- package/dist/manager-C2IUXKRC.js +0 -7
- package/dist/manager-YYKWYTRM.cjs +0 -7
- package/dist/mcp-manager-QMKWPBZ4.js +0 -8
- package/dist/mcp-manager-Z3OKI74O.cjs +0 -8
- package/dist/memory-5LWZ6FI2.cjs +0 -9
- package/dist/memory-VIJLBAMQ.js +0 -9
- package/dist/model-cache-5KIYL5SL.js +0 -13
- package/dist/model-cache-OED3IM4R.cjs +0 -13
- package/dist/model-fetcher-HKGICACL.js +0 -8
- package/dist/model-fetcher-UR6WJOQP.cjs +0 -8
- package/dist/openai-JR2WEKOF.js +0 -10
- package/dist/openai-YBTOET4O.cjs +0 -10
- package/dist/openrouter-models-OU4GRZQY.cjs +0 -15
- package/dist/openrouter-models-TGKDKY52.js +0 -15
- package/dist/openrouter-sync-BBHUM3R6.cjs +0 -11
- package/dist/openrouter-sync-UXUSJCIR.js +0 -11
- package/dist/product/index.cjs +0 -21
- package/dist/run/index.cjs +0 -48
- package/dist/session-manager-Q22BBMD3.js +0 -8
- package/dist/session-manager-XODQVL3C.cjs +0 -8
- package/dist/tool-summary-63DPIS7G.cjs +0 -31
- package/dist/tool-summary-NP5CDBKG.js +0 -31
- package/dist/updater-QW473OF4.cjs +0 -17
- package/dist/updater-VFUAHCVY.js +0 -17
package/dist/cli/updater.d.ts
CHANGED
|
@@ -15,6 +15,14 @@
|
|
|
15
15
|
* Concurrency: multiple `code-shell` processes can run at once. A file lock
|
|
16
16
|
* at `~/.code-shell/.update.lock` prevents both from launching `npm i -g`
|
|
17
17
|
* simultaneously (which corrupts the install).
|
|
18
|
+
*
|
|
19
|
+
* Headless safety: `checkForUpdate()` and `scheduleAutoInstallOnExit()` are
|
|
20
|
+
* only invoked from the Ink-based UpdateBanner component, never from the
|
|
21
|
+
* `run` / `arena` headless code paths. Keep it that way — wiring the updater
|
|
22
|
+
* into bare CLI commands would surprise CI users with background `npm i -g`
|
|
23
|
+
* on every short-lived `code-shell run …` invocation. If you need updater
|
|
24
|
+
* behavior in a new headless entry point, gate it on something explicit
|
|
25
|
+
* (e.g. `--auto-update` flag) rather than calling it unconditionally.
|
|
18
26
|
*/
|
|
19
27
|
export interface UpdateInfo {
|
|
20
28
|
latestVersion: string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{a as LLMClientBase}from'./chunk-HIJ2XXGX.js';import'./chunk-FU7AHZNN.js';import'./chunk-B7K2OWKC.js';import'./chunk-3QP5BQ3L.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {o}from'./chunk-W47Z7MGS.js';export{e as COMPACTABLE_TOOL_NAMES,b as adjustIndexToPreserveAPIInvariants,j as applySummaryCompaction,g as applyToolResultBudget,i as buildSummarizationPrompt,l as dropOldestRounds,a as estimateTokens,m as extractReferencedFilePaths,k as groupMessagesByApiRound,f as microcompact,c as snipCompact,h as truncateToolResult,d as windowCompact}from'./chunk-W47Z7MGS.js';import'./chunk-3QP5BQ3L.js';o();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {h}from'./chunk-3QP5BQ3L.js';h();
|
package/dist/engine/engine.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ import type { HookHandler } from "../hooks/registry.js";
|
|
|
10
10
|
import { SessionManager } from "../session/session-manager.js";
|
|
11
11
|
import type { CostStateStore } from "./cost-store.js";
|
|
12
12
|
import type { AskUserFn } from "../tool-system/builtin/ask-user.js";
|
|
13
|
+
import { type SandboxConfig } from "../tool-system/sandbox/index.js";
|
|
13
14
|
import { type AgentPresetName } from "../preset/index.js";
|
|
14
15
|
import { ModelPool, type ModelEntry } from "../llm/model-pool.js";
|
|
15
16
|
export interface EngineConfig {
|
|
@@ -36,6 +37,20 @@ export interface EngineConfig {
|
|
|
36
37
|
* Engine doesn't persist cost state — it's a UI concern.
|
|
37
38
|
*/
|
|
38
39
|
costStore?: CostStateStore;
|
|
40
|
+
/**
|
|
41
|
+
* True when the Engine runs in a no-UI / one-shot context (e.g. the `run`
|
|
42
|
+
* command). Currently controls InvestigationGuard soft-mode: in headless
|
|
43
|
+
* we never hard-block a tool call because there is no human to retry.
|
|
44
|
+
* Defaults to false.
|
|
45
|
+
*/
|
|
46
|
+
headless?: boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Sandbox configuration for shell-tool execution. When omitted, headless
|
|
49
|
+
* runs default to "auto" (Seatbelt on macOS / bwrap on Linux when
|
|
50
|
+
* available) and interactive runs default to "off" because a human is in
|
|
51
|
+
* the loop to approve commands.
|
|
52
|
+
*/
|
|
53
|
+
sandbox?: SandboxConfig;
|
|
39
54
|
}
|
|
40
55
|
export interface EngineHookConfig {
|
|
41
56
|
event: HookEventName;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import {h as h$1,a}from'./chunk-3QP5BQ3L.js';import {join,basename}from'path';h$1();var h=2e3,_=800,w=/^[A-Za-z0-9_-]+$/;function R(n,r,e){if(!w.test(n))throw new Error(`renderSessionMarkdown: invalid sessionId ${JSON.stringify(n)} \u2014 expected [A-Za-z0-9_-]+`);let t=[],s=[],u=`session-${n}-attachments`;t.push(`# Session ${n}`),t.push("");let i=0;for(let d of r){let o=d;if(o.type!=="message")continue;i+=1;let $=o.data?.role??"unknown",a=o.data?.content;if(t.push(`## turn ${i} \xB7 ${$}`),t.push(""),typeof a=="string"){t.push(a),t.push("");continue}if(!Array.isArray(a)){t.push("```json"),t.push(JSON.stringify(a,null,2)),t.push("```"),t.push("");continue}let l=0;for(let m of a){l+=1;let g=I(m,{turnNumber:i,itemIdx:l,sidecarDir:u,cwd:e,sidecars:s});g&&(t.push(g),t.push(""));}}return {md:t.join(`
|
|
2
|
+
`),sidecars:s}}a(R,"renderSessionMarkdown");function I(n,r){let e=n.type;if(e==="reasoning"){let t=n.reasoningContent??"";return y("reasoning",t)}if(e==="text")return n.text??"";if(e==="tool_use"){let t=n.name??"?",s=JSON.stringify(n.input??{},null,2)??"{}",u=`**\u{1F6E0} tool_use** \xB7 \`${t}\``;return s.length<=_?`${u}
|
|
3
|
+
|
|
4
|
+
\`\`\`json
|
|
5
|
+
${s}
|
|
6
|
+
\`\`\``:y(`${t} args (${s.length} bytes)`,s,"json")}if(e==="tool_result"){let t=n.tool_use_id??n.id??"?",s=N(n.content);if(s.length<=h)return `**\u25C0 tool_result** \xB7 ${t}
|
|
7
|
+
|
|
8
|
+
\`\`\`
|
|
9
|
+
${s}
|
|
10
|
+
\`\`\``;let u=`t${r.turnNumber}-i${r.itemIdx}-${t.slice(0,12)}.txt`,i=join(r.cwd,r.sidecarDir,u);r.sidecars.push({path:i,content:s});let d=s.slice(0,h),o=join(r.sidecarDir,basename(i));return `**\u25C0 tool_result** \xB7 ${t} \xB7 ${s.length.toLocaleString()} bytes \xB7 [full \u2192 ${o}](./${o})
|
|
11
|
+
|
|
12
|
+
\`\`\`
|
|
13
|
+
${d}
|
|
14
|
+
\u2026(truncated, see sidecar)
|
|
15
|
+
\`\`\``}return "```json\n"+JSON.stringify(n,null,2)+"\n```"}a(I,"renderBlock");function y(n,r,e=""){let t=e?"```"+e:"```";return `<details><summary>${n}</summary>
|
|
16
|
+
|
|
17
|
+
${t}
|
|
18
|
+
${r}
|
|
19
|
+
\`\`\`
|
|
20
|
+
|
|
21
|
+
</details>`}a(y,"collapsible");function N(n){if(n==null)return "";if(typeof n=="string")return n;if(Array.isArray(n)){let r=[];for(let e of n)e&&typeof e=="object"&&"text"in e&&typeof e.text=="string"?r.push(e.text):r.push(JSON.stringify(e));return r.join(`
|
|
22
|
+
`)}return JSON.stringify(n,null,2)}a(N,"stringifyResult");export{R as renderSessionMarkdown};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{a as FileHistory}from'./chunk-WI6FSWGU.js';import'./chunk-3QP5BQ3L.js';
|
package/dist/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Public API exports.
|
|
5
5
|
*/
|
|
6
|
-
export declare const VERSION = "0.1.
|
|
6
|
+
export declare const VERSION = "0.1.7";
|
|
7
7
|
export type { Message, ContentBlock, ToolDefinition, ToolCall, ToolResult, RegisteredTool, TranscriptEvent, TranscriptEventType, SessionState, TokenUsage, CompiledInput, PermissionDecision, PermissionMode, PermissionRule, TurnPhase, TurnResult, TerminalReason, StreamEvent, StreamCallback, LLMConfig, LLMResponse, Settings, MCPServerConfig, } from "./types.js";
|
|
8
8
|
export { FrameworkError, LLMError, LLMRateLimitError, ContextLimitError, ToolError, ToolNotFoundError, ToolExecutionError, ToolTimeoutError, PermissionDeniedError, SessionError, TranscriptError, ConfigError, } from "./exceptions.js";
|
|
9
9
|
export { Engine } from "./engine/engine.js";
|
package/dist/index.js
CHANGED
|
@@ -1,347 +1 @@
|
|
|
1
|
-
import {
|
|
2
|
-
createRunManager
|
|
3
|
-
} from "./chunk-2EP3CLEN.js";
|
|
4
|
-
import {
|
|
5
|
-
defineProduct
|
|
6
|
-
} from "./chunk-YJ77GQK5.js";
|
|
7
|
-
import {
|
|
8
|
-
ArtifactTracker,
|
|
9
|
-
AutoApprovalBackend,
|
|
10
|
-
BUILTIN_AGENT_PRESETS,
|
|
11
|
-
BUILTIN_TOOLS,
|
|
12
|
-
CheckpointWriter,
|
|
13
|
-
CompositeEvaluator,
|
|
14
|
-
ContextManager,
|
|
15
|
-
DEFAULT_AGENT_PRESET,
|
|
16
|
-
DEFAULT_CLI_PRESET,
|
|
17
|
-
DEFAULT_PERSIST_THRESHOLD,
|
|
18
|
-
Engine,
|
|
19
|
-
EngineRunner,
|
|
20
|
-
FileRunStore,
|
|
21
|
-
HeadlessApprovalBackend,
|
|
22
|
-
Heartbeat,
|
|
23
|
-
HookRegistry,
|
|
24
|
-
NoopEvaluator,
|
|
25
|
-
PER_MESSAGE_AGGREGATE_CAP,
|
|
26
|
-
PREVIEW_SIZE,
|
|
27
|
-
PermissionClassifier,
|
|
28
|
-
PromptComposer,
|
|
29
|
-
RunApprovalBackend,
|
|
30
|
-
RunLock,
|
|
31
|
-
RunManager,
|
|
32
|
-
RunQueue,
|
|
33
|
-
SectionCache,
|
|
34
|
-
ToolExecutor,
|
|
35
|
-
ToolRegistry,
|
|
36
|
-
VALID_TRANSITIONS,
|
|
37
|
-
applyToolResultPersistence,
|
|
38
|
-
availableSections,
|
|
39
|
-
buildPresetSystemPrompt,
|
|
40
|
-
buildSkillListing,
|
|
41
|
-
combineInstructions,
|
|
42
|
-
createContentReplacementState,
|
|
43
|
-
createRunAskUserFn,
|
|
44
|
-
isPersistedReplacement,
|
|
45
|
-
listPresetNames,
|
|
46
|
-
loadSection,
|
|
47
|
-
loadSections,
|
|
48
|
-
matchSkillsByInput,
|
|
49
|
-
matchSkillsByTool,
|
|
50
|
-
reconstructContentReplacementState,
|
|
51
|
-
registerPreset,
|
|
52
|
-
registerSection,
|
|
53
|
-
resolveAgentPreset,
|
|
54
|
-
resolveBuiltinToolNames,
|
|
55
|
-
resolveToolResultsDir,
|
|
56
|
-
scanInstructions,
|
|
57
|
-
scanSkills,
|
|
58
|
-
taskManager
|
|
59
|
-
} from "./chunk-7K6SDRRF.js";
|
|
60
|
-
import {
|
|
61
|
-
ModelPool
|
|
62
|
-
} from "./chunk-BSW22MPA.js";
|
|
63
|
-
import "./chunk-3OA5G4TM.js";
|
|
64
|
-
import {
|
|
65
|
-
MCPManager
|
|
66
|
-
} from "./chunk-SIHHIQLO.js";
|
|
67
|
-
import {
|
|
68
|
-
COMPACTABLE_TOOL_NAMES,
|
|
69
|
-
applySummaryCompaction,
|
|
70
|
-
buildSummarizationPrompt,
|
|
71
|
-
estimateTokens,
|
|
72
|
-
init_compaction,
|
|
73
|
-
microcompact,
|
|
74
|
-
truncateToolResult,
|
|
75
|
-
windowCompact
|
|
76
|
-
} from "./chunk-7Y6S3OCX.js";
|
|
77
|
-
import {
|
|
78
|
-
MemoryManager
|
|
79
|
-
} from "./chunk-VIAGTYYW.js";
|
|
80
|
-
import {
|
|
81
|
-
SessionManager,
|
|
82
|
-
Transcript
|
|
83
|
-
} from "./chunk-76HYEPDM.js";
|
|
84
|
-
import {
|
|
85
|
-
SettingsManager,
|
|
86
|
-
SettingsSchema,
|
|
87
|
-
validateSettings
|
|
88
|
-
} from "./chunk-5ECBT4YA.js";
|
|
89
|
-
import {
|
|
90
|
-
FileHistory
|
|
91
|
-
} from "./chunk-T6VYG46N.js";
|
|
92
|
-
import {
|
|
93
|
-
IterativeArena,
|
|
94
|
-
codeFormat,
|
|
95
|
-
defaultConvergence,
|
|
96
|
-
diffRatio,
|
|
97
|
-
documentFormat,
|
|
98
|
-
getFormat
|
|
99
|
-
} from "./chunk-RMYKO74M.js";
|
|
100
|
-
import {
|
|
101
|
-
Arena,
|
|
102
|
-
ArenaLedger,
|
|
103
|
-
DiscussionStrategy,
|
|
104
|
-
MODEL_PRESETS,
|
|
105
|
-
PlanningStrategy,
|
|
106
|
-
ReviewStrategy,
|
|
107
|
-
applyReviewResult,
|
|
108
|
-
buildDigest,
|
|
109
|
-
collectEvidence,
|
|
110
|
-
createLLMClient,
|
|
111
|
-
formatDigest,
|
|
112
|
-
getMaxOutputTokens,
|
|
113
|
-
getStrategy,
|
|
114
|
-
getStrategyForPlan,
|
|
115
|
-
hasTools,
|
|
116
|
-
isTerminal,
|
|
117
|
-
markUnderReview,
|
|
118
|
-
markUnresolved,
|
|
119
|
-
planArena,
|
|
120
|
-
registerClaims,
|
|
121
|
-
registerProvider,
|
|
122
|
-
resolveClaimStatus,
|
|
123
|
-
selectClaimsForReview,
|
|
124
|
-
selectTools,
|
|
125
|
-
transitionClaim,
|
|
126
|
-
validTransitions
|
|
127
|
-
} from "./chunk-C5YQBIRK.js";
|
|
128
|
-
import "./chunk-XDIQWQJ4.js";
|
|
129
|
-
import {
|
|
130
|
-
AnthropicClient
|
|
131
|
-
} from "./chunk-ZBPSQCPU.js";
|
|
132
|
-
import {
|
|
133
|
-
OpenAIClient
|
|
134
|
-
} from "./chunk-7JVTYEEC.js";
|
|
135
|
-
import {
|
|
136
|
-
LLMClientBase
|
|
137
|
-
} from "./chunk-6S4BJ65N.js";
|
|
138
|
-
import {
|
|
139
|
-
ConfigError,
|
|
140
|
-
ContextLimitError,
|
|
141
|
-
FrameworkError,
|
|
142
|
-
LLMError,
|
|
143
|
-
LLMRateLimitError,
|
|
144
|
-
PermissionDeniedError,
|
|
145
|
-
SessionError,
|
|
146
|
-
ToolError,
|
|
147
|
-
ToolExecutionError,
|
|
148
|
-
ToolNotFoundError,
|
|
149
|
-
ToolTimeoutError,
|
|
150
|
-
TranscriptError
|
|
151
|
-
} from "./chunk-SFXHZSRF.js";
|
|
152
|
-
import {
|
|
153
|
-
logger
|
|
154
|
-
} from "./chunk-BXCY2FSE.js";
|
|
155
|
-
import {
|
|
156
|
-
init_esm_shims
|
|
157
|
-
} from "./chunk-MD32R22I.js";
|
|
158
|
-
|
|
159
|
-
// src/index.ts
|
|
160
|
-
init_esm_shims();
|
|
161
|
-
init_compaction();
|
|
162
|
-
|
|
163
|
-
// src/arena/detect-mode.ts
|
|
164
|
-
init_esm_shims();
|
|
165
|
-
var MODE_SIGNALS = {
|
|
166
|
-
review: [
|
|
167
|
-
{ patterns: [/\breview\b/i, /\baudit\b/i, /\binspect\b/i, /\bcheck\b/i], weight: 2 },
|
|
168
|
-
{ patterns: [/\bcode\s*quality\b/i, /\bbug\b/i, /\bvulnerab/i, /\bsecur/i] },
|
|
169
|
-
{ patterns: [/\bpr\b/i, /\bpull\s*request\b/i, /\bdiff\b/i, /\bchanges?\b/i] },
|
|
170
|
-
{ patterns: [/\brefactor/i, /\bclean\s*up\b/i, /\bimprove\b/i] }
|
|
171
|
-
],
|
|
172
|
-
discussion: [
|
|
173
|
-
{ patterns: [/\bdiscuss\b/i, /\bdebate\b/i, /\bcompare\b/i], weight: 2 },
|
|
174
|
-
{ patterns: [/\bpros?\s*(and|&|\/)\s*cons?\b/i, /\btrade\s*-?\s*offs?\b/i] },
|
|
175
|
-
{ patterns: [/\bshould\s+we\b/i, /\bwhich\s+(is|approach|way)\b/i, /\bvs\.?\b/i] },
|
|
176
|
-
{ patterns: [/\bopinion\b/i, /\bthoughts?\b/i, /\badvice\b/i] }
|
|
177
|
-
],
|
|
178
|
-
planning: [
|
|
179
|
-
{ patterns: [/\bplan\b/i, /\bplanning\b/i, /\broadmap\b/i, /\bstrategy\b/i], weight: 2 },
|
|
180
|
-
{ patterns: [/\barchitect/i, /\bdesign\b/i, /\bproposal\b/i] },
|
|
181
|
-
{ patterns: [/\bimplement(ation)?\s+(plan|strategy|approach)\b/i], weight: 2 },
|
|
182
|
-
{ patterns: [/\bphase\b/i, /\bmilestone\b/i, /\btimeline\b/i, /\bprioritiz/i] },
|
|
183
|
-
{ patterns: [/\bbuild\b/i, /\bcreate\b/i, /\bsetup\b/i, /\bbootstrap\b/i] }
|
|
184
|
-
]
|
|
185
|
-
};
|
|
186
|
-
var HIGH_CONFIDENCE_THRESHOLD = 3;
|
|
187
|
-
var MIN_LEAD = 2;
|
|
188
|
-
function detectArenaMode(topic) {
|
|
189
|
-
const scores = { review: 0, discussion: 0, planning: 0 };
|
|
190
|
-
for (const [mode, signals] of Object.entries(MODE_SIGNALS)) {
|
|
191
|
-
for (const signal of signals) {
|
|
192
|
-
const weight = signal.weight ?? 1;
|
|
193
|
-
for (const pattern of signal.patterns) {
|
|
194
|
-
if (pattern.test(topic)) {
|
|
195
|
-
scores[mode] += weight;
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
const ranked = Object.entries(scores).sort((a, b) => b[1] - a[1]);
|
|
201
|
-
const [bestMode, bestScore] = ranked[0];
|
|
202
|
-
const [, runnerUpScore] = ranked[1];
|
|
203
|
-
const lead = bestScore - runnerUpScore;
|
|
204
|
-
if (bestScore >= HIGH_CONFIDENCE_THRESHOLD && lead >= MIN_LEAD) {
|
|
205
|
-
return {
|
|
206
|
-
mode: bestMode,
|
|
207
|
-
confidence: "high",
|
|
208
|
-
reason: `Topic strongly matches "${bestMode}" (score: ${bestScore}, lead: +${lead})`
|
|
209
|
-
};
|
|
210
|
-
}
|
|
211
|
-
if (bestScore > 0 && lead > 0) {
|
|
212
|
-
return {
|
|
213
|
-
mode: bestMode,
|
|
214
|
-
confidence: "low",
|
|
215
|
-
reason: `Topic weakly matches "${bestMode}" (score: ${bestScore}, lead: +${lead})`
|
|
216
|
-
};
|
|
217
|
-
}
|
|
218
|
-
return {
|
|
219
|
-
mode: "review",
|
|
220
|
-
confidence: "low",
|
|
221
|
-
reason: "No strong mode signal detected, defaulting to review"
|
|
222
|
-
};
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
// src/index.ts
|
|
226
|
-
var VERSION = "0.1.0";
|
|
227
|
-
export {
|
|
228
|
-
AnthropicClient,
|
|
229
|
-
Arena,
|
|
230
|
-
ArenaLedger,
|
|
231
|
-
ArtifactTracker,
|
|
232
|
-
AutoApprovalBackend,
|
|
233
|
-
BUILTIN_AGENT_PRESETS,
|
|
234
|
-
BUILTIN_TOOLS,
|
|
235
|
-
COMPACTABLE_TOOL_NAMES,
|
|
236
|
-
CheckpointWriter,
|
|
237
|
-
CompositeEvaluator,
|
|
238
|
-
ConfigError,
|
|
239
|
-
ContextLimitError,
|
|
240
|
-
ContextManager,
|
|
241
|
-
DEFAULT_AGENT_PRESET,
|
|
242
|
-
DEFAULT_CLI_PRESET,
|
|
243
|
-
DEFAULT_PERSIST_THRESHOLD,
|
|
244
|
-
DiscussionStrategy,
|
|
245
|
-
Engine,
|
|
246
|
-
EngineRunner,
|
|
247
|
-
FileHistory,
|
|
248
|
-
FileRunStore,
|
|
249
|
-
FrameworkError,
|
|
250
|
-
HeadlessApprovalBackend,
|
|
251
|
-
Heartbeat,
|
|
252
|
-
HookRegistry,
|
|
253
|
-
IterativeArena,
|
|
254
|
-
LLMClientBase,
|
|
255
|
-
LLMError,
|
|
256
|
-
LLMRateLimitError,
|
|
257
|
-
MCPManager,
|
|
258
|
-
MODEL_PRESETS,
|
|
259
|
-
MemoryManager,
|
|
260
|
-
ModelPool,
|
|
261
|
-
NoopEvaluator,
|
|
262
|
-
OpenAIClient,
|
|
263
|
-
PER_MESSAGE_AGGREGATE_CAP,
|
|
264
|
-
PREVIEW_SIZE,
|
|
265
|
-
PermissionClassifier,
|
|
266
|
-
PermissionDeniedError,
|
|
267
|
-
PlanningStrategy,
|
|
268
|
-
PromptComposer,
|
|
269
|
-
ReviewStrategy,
|
|
270
|
-
RunApprovalBackend,
|
|
271
|
-
RunLock,
|
|
272
|
-
RunManager,
|
|
273
|
-
RunQueue,
|
|
274
|
-
SectionCache,
|
|
275
|
-
SessionError,
|
|
276
|
-
SessionManager,
|
|
277
|
-
SettingsManager,
|
|
278
|
-
SettingsSchema,
|
|
279
|
-
ToolError,
|
|
280
|
-
ToolExecutionError,
|
|
281
|
-
ToolExecutor,
|
|
282
|
-
ToolNotFoundError,
|
|
283
|
-
ToolRegistry,
|
|
284
|
-
ToolTimeoutError,
|
|
285
|
-
Transcript,
|
|
286
|
-
TranscriptError,
|
|
287
|
-
VALID_TRANSITIONS,
|
|
288
|
-
VERSION,
|
|
289
|
-
applyReviewResult,
|
|
290
|
-
applySummaryCompaction,
|
|
291
|
-
applyToolResultPersistence,
|
|
292
|
-
availableSections,
|
|
293
|
-
buildDigest,
|
|
294
|
-
buildPresetSystemPrompt,
|
|
295
|
-
buildSkillListing,
|
|
296
|
-
buildSummarizationPrompt,
|
|
297
|
-
collectEvidence,
|
|
298
|
-
combineInstructions,
|
|
299
|
-
createContentReplacementState,
|
|
300
|
-
createLLMClient,
|
|
301
|
-
createRunAskUserFn,
|
|
302
|
-
createRunManager,
|
|
303
|
-
defaultConvergence as defaultIterateConvergence,
|
|
304
|
-
defineProduct,
|
|
305
|
-
detectArenaMode,
|
|
306
|
-
estimateTokens,
|
|
307
|
-
formatDigest,
|
|
308
|
-
getFormat as getIterateFormat,
|
|
309
|
-
getMaxOutputTokens,
|
|
310
|
-
getStrategy,
|
|
311
|
-
getStrategyForPlan,
|
|
312
|
-
hasTools,
|
|
313
|
-
isPersistedReplacement,
|
|
314
|
-
isTerminal,
|
|
315
|
-
codeFormat as iterateCodeFormat,
|
|
316
|
-
diffRatio as iterateDiffRatio,
|
|
317
|
-
documentFormat as iterateDocumentFormat,
|
|
318
|
-
listPresetNames,
|
|
319
|
-
loadSection,
|
|
320
|
-
loadSections,
|
|
321
|
-
logger,
|
|
322
|
-
markUnderReview,
|
|
323
|
-
markUnresolved,
|
|
324
|
-
matchSkillsByInput,
|
|
325
|
-
matchSkillsByTool,
|
|
326
|
-
microcompact,
|
|
327
|
-
planArena,
|
|
328
|
-
reconstructContentReplacementState,
|
|
329
|
-
registerClaims,
|
|
330
|
-
registerPreset,
|
|
331
|
-
registerProvider,
|
|
332
|
-
registerSection,
|
|
333
|
-
resolveAgentPreset,
|
|
334
|
-
resolveBuiltinToolNames,
|
|
335
|
-
resolveClaimStatus,
|
|
336
|
-
resolveToolResultsDir,
|
|
337
|
-
scanInstructions,
|
|
338
|
-
scanSkills,
|
|
339
|
-
selectClaimsForReview,
|
|
340
|
-
selectTools,
|
|
341
|
-
taskManager,
|
|
342
|
-
transitionClaim,
|
|
343
|
-
truncateToolResult,
|
|
344
|
-
validTransitions,
|
|
345
|
-
validateSettings,
|
|
346
|
-
windowCompact
|
|
347
|
-
};
|
|
1
|
+
export{a as defineProduct}from'./chunk-KCXSARAA.js';export{a as createRunManager}from'./chunk-RP26WO4R.js';export{_ as ArtifactTracker,i as AutoApprovalBackend,I as BUILTIN_AGENT_PRESETS,e as BUILTIN_TOOLS,Z as CheckpointWriter,ca as CompositeEvaluator,w as ContextManager,J as DEFAULT_AGENT_PRESET,K as DEFAULT_CLI_PRESET,o as DEFAULT_PERSIST_THRESHOLD,T as Engine,da as EngineRunner,V as FileRunStore,h as HeadlessApprovalBackend,aa as Heartbeat,n as HookRegistry,ba as NoopEvaluator,p as PER_MESSAGE_AGGREGATE_CAP,q as PREVIEW_SIZE,m as PermissionClassifier,Q as PromptComposer,X as RunApprovalBackend,$ as RunLock,ea as RunManager,W as RunQueue,x as SectionCache,g as ToolExecutor,f as ToolRegistry,U as VALID_TRANSITIONS,u as applyToolResultPersistence,H as availableSections,O as buildPresetSystemPrompt,D as buildSkillListing,z as combineInstructions,r as createContentReplacementState,Y as createRunAskUserFn,v as isPersistedReplacement,M as listPresetNames,F as loadSection,G as loadSections,B as matchSkillsByInput,C as matchSkillsByTool,s as reconstructContentReplacementState,L as registerPreset,E as registerSection,N as resolveAgentPreset,P as resolveBuiltinToolNames,t as resolveToolResultsDir,y as scanInstructions,A as scanSkills,c as taskManager}from'./chunk-NMBYBGC7.js';export{a as ModelPool}from'./chunk-2NS3JMNK.js';export{a as FileHistory}from'./chunk-WI6FSWGU.js';import'./chunk-P6JSTIFM.js';import'./chunk-SNFAPSLA.js';export{a as MCPManager}from'./chunk-XDOWC7EG.js';import {o}from'./chunk-W47Z7MGS.js';export{e as COMPACTABLE_TOOL_NAMES,j as applySummaryCompaction,i as buildSummarizationPrompt,a as estimateTokens,f as microcompact,h as truncateToolResult,d as windowCompact}from'./chunk-W47Z7MGS.js';export{b as MemoryManager}from'./chunk-T222K6IV.js';export{b as SessionManager,a as Transcript}from'./chunk-QTWU7UNA.js';export{c as SettingsManager,a as SettingsSchema,b as validateSettings}from'./chunk-UDPUTFQT.js';export{j as IterativeArena,f as defaultIterateConvergence,i as getIterateFormat,g as iterateCodeFormat,e as iterateDiffRatio,h as iterateDocumentFormat}from'./chunk-Q4O2HGWS.js';export{J as Arena,I as ArenaLedger,e as DiscussionStrategy,Q as MODEL_PRESETS,f as PlanningStrategy,d as ReviewStrategy,z as applyReviewResult,u as buildDigest,n as collectEvidence,b as createLLMClient,v as formatDigest,R as getMaxOutputTokens,k as getStrategy,l as getStrategyForPlan,p as hasTools,B as isTerminal,y as markUnderReview,A as markUnresolved,m as planArena,s as registerClaims,a as registerProvider,x as resolveClaimStatus,t as selectClaimsForReview,o as selectTools,w as transitionClaim,C as validTransitions}from'./chunk-Y2NS6HPO.js';import'./chunk-NVAZJ5XS.js';export{a as AnthropicClient}from'./chunk-WOP6MJKW.js';export{a as OpenAIClient}from'./chunk-PGANL6F2.js';import'./chunk-O5HFCH2U.js';export{a as LLMClientBase}from'./chunk-HIJ2XXGX.js';export{l as ConfigError,d as ContextLimitError,a as FrameworkError,b as LLMError,c as LLMRateLimitError,i as PermissionDeniedError,j as SessionError,e as ToolError,g as ToolExecutionError,f as ToolNotFoundError,h as ToolTimeoutError,k as TranscriptError}from'./chunk-FU7AHZNN.js';export{b as logger}from'./chunk-B7K2OWKC.js';import {h,a}from'./chunk-3QP5BQ3L.js';h();o();h();var vt={review:[{patterns:[/\breview\b/i,/\baudit\b/i,/\binspect\b/i,/\bcheck\b/i],weight:2},{patterns:[/\bcode\s*quality\b/i,/\bbug\b/i,/\bvulnerab/i,/\bsecur/i]},{patterns:[/\bpr\b/i,/\bpull\s*request\b/i,/\bdiff\b/i,/\bchanges?\b/i]},{patterns:[/\brefactor/i,/\bclean\s*up\b/i,/\bimprove\b/i]}],discussion:[{patterns:[/\bdiscuss\b/i,/\bdebate\b/i,/\bcompare\b/i],weight:2},{patterns:[/\bpros?\s*(and|&|\/)\s*cons?\b/i,/\btrade\s*-?\s*offs?\b/i]},{patterns:[/\bshould\s+we\b/i,/\bwhich\s+(is|approach|way)\b/i,/\bvs\.?\b/i]},{patterns:[/\bopinion\b/i,/\bthoughts?\b/i,/\badvice\b/i]}],planning:[{patterns:[/\bplan\b/i,/\bplanning\b/i,/\broadmap\b/i,/\bstrategy\b/i],weight:2},{patterns:[/\barchitect/i,/\bdesign\b/i,/\bproposal\b/i]},{patterns:[/\bimplement(ation)?\s+(plan|strategy|approach)\b/i],weight:2},{patterns:[/\bphase\b/i,/\bmilestone\b/i,/\btimeline\b/i,/\bprioritiz/i]},{patterns:[/\bbuild\b/i,/\bcreate\b/i,/\bsetup\b/i,/\bbootstrap\b/i]}]},kt=3,Mt=2;function Pt(m){let a={review:0,discussion:0,planning:0};for(let[n,i]of Object.entries(vt))for(let p of i){let u=p.weight??1;for(let d of p.patterns)d.test(m)&&(a[n]+=u);}let s=Object.entries(a).sort((n,i)=>i[1]-n[1]),[t,e]=s[0],[,l]=s[1],r=e-l;return e>=kt&&r>=Mt?{mode:t,confidence:"high",reason:`Topic strongly matches "${t}" (score: ${e}, lead: +${r})`}:e>0&&r>0?{mode:t,confidence:"low",reason:`Topic weakly matches "${t}" (score: ${e}, lead: +${r})`}:{mode:"review",confidence:"low",reason:"No strong mode signal detected, defaulting to review"}}a(Pt,"detectArenaMode");var wt="0.1.7";export{wt as VERSION,Pt as detectArenaMode};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Token counter — best-effort live token count for streaming output.
|
|
3
|
+
*
|
|
4
|
+
* Uses gpt-tokenizer's cl100k_base encoding. It's exact for GPT-4 family and
|
|
5
|
+
* close enough (within ~10%) for Claude/DeepSeek/Qwen for the purpose of a
|
|
6
|
+
* live counter in the UI. The authoritative number is still the provider's
|
|
7
|
+
* `usage` field, captured at end-of-stream.
|
|
8
|
+
*
|
|
9
|
+
* The encoder is lazy-initialized on first use so we don't pay the cost on
|
|
10
|
+
* startup for sessions that never stream.
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* Count tokens in `text`. Synchronous. If the encoder isn't loaded yet,
|
|
14
|
+
* falls back to chars/4 — only happens for the very first stream chunk in a
|
|
15
|
+
* cold process.
|
|
16
|
+
*/
|
|
17
|
+
export declare function countTokens(text: string): number;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{c as SettingsManager}from'./chunk-UDPUTFQT.js';import'./chunk-3QP5BQ3L.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{a as MCPManager}from'./chunk-XDOWC7EG.js';import'./chunk-B7K2OWKC.js';import'./chunk-3QP5BQ3L.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{b as MemoryManager,a as resolveMemoryBaseDir}from'./chunk-T222K6IV.js';import'./chunk-3QP5BQ3L.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{d as defaultCacheDir,c as isStale,a as readCache,b as writeCache}from'./chunk-P6JSTIFM.js';import'./chunk-3QP5BQ3L.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{b as fetchModelList}from'./chunk-EWWK56K6.js';import'./chunk-P6JSTIFM.js';import'./chunk-3QP5BQ3L.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{a as createOffBackend}from'./chunk-SNFAPSLA.js';import'./chunk-3QP5BQ3L.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{a as OpenAIClient}from'./chunk-PGANL6F2.js';import'./chunk-O5HFCH2U.js';import'./chunk-HIJ2XXGX.js';import'./chunk-FU7AHZNN.js';import'./chunk-B7K2OWKC.js';import'./chunk-3QP5BQ3L.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{d as findOpenRouterModel,c as getOpenRouterModels,b as getOpenRouterSnapshot,e as listOpenRouterModelsByVendor,a as setOpenRouterSnapshot}from'./chunk-NVAZJ5XS.js';import'./chunk-3QP5BQ3L.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{a as syncOpenRouterCatalog}from'./chunk-NFH3UQ3E.js';export{b as getOpenRouterSnapshot}from'./chunk-NVAZJ5XS.js';import'./chunk-3QP5BQ3L.js';
|
package/dist/product/index.js
CHANGED
|
@@ -1,21 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
defineProduct
|
|
3
|
-
} from "../chunk-YJ77GQK5.js";
|
|
4
|
-
import "../chunk-7K6SDRRF.js";
|
|
5
|
-
import "../chunk-BSW22MPA.js";
|
|
6
|
-
import "../chunk-3OA5G4TM.js";
|
|
7
|
-
import "../chunk-SIHHIQLO.js";
|
|
8
|
-
import "../chunk-7Y6S3OCX.js";
|
|
9
|
-
import "../chunk-VIAGTYYW.js";
|
|
10
|
-
import "../chunk-76HYEPDM.js";
|
|
11
|
-
import "../chunk-5ECBT4YA.js";
|
|
12
|
-
import "../chunk-T6VYG46N.js";
|
|
13
|
-
import "../chunk-RMYKO74M.js";
|
|
14
|
-
import "../chunk-C5YQBIRK.js";
|
|
15
|
-
import "../chunk-XDIQWQJ4.js";
|
|
16
|
-
import "../chunk-SFXHZSRF.js";
|
|
17
|
-
import "../chunk-BXCY2FSE.js";
|
|
18
|
-
import "../chunk-MD32R22I.js";
|
|
19
|
-
export {
|
|
20
|
-
defineProduct
|
|
21
|
-
};
|
|
1
|
+
export{a as defineProduct}from'../chunk-KCXSARAA.js';import'../chunk-NMBYBGC7.js';import'../chunk-2NS3JMNK.js';import'../chunk-WI6FSWGU.js';import'../chunk-P6JSTIFM.js';import'../chunk-SNFAPSLA.js';import'../chunk-XDOWC7EG.js';import'../chunk-W47Z7MGS.js';import'../chunk-T222K6IV.js';import'../chunk-QTWU7UNA.js';import'../chunk-UDPUTFQT.js';import'../chunk-Q4O2HGWS.js';import'../chunk-Y2NS6HPO.js';import'../chunk-NVAZJ5XS.js';import'../chunk-FU7AHZNN.js';import'../chunk-B7K2OWKC.js';import'../chunk-3QP5BQ3L.js';
|
package/dist/run/index.js
CHANGED
|
@@ -1,48 +1 @@
|
|
|
1
|
-
|
|
2
|
-
createRunManager
|
|
3
|
-
} from "../chunk-2EP3CLEN.js";
|
|
4
|
-
import {
|
|
5
|
-
ArtifactTracker,
|
|
6
|
-
CheckpointWriter,
|
|
7
|
-
CompositeEvaluator,
|
|
8
|
-
EngineRunner,
|
|
9
|
-
FileRunStore,
|
|
10
|
-
Heartbeat,
|
|
11
|
-
NoopEvaluator,
|
|
12
|
-
RunApprovalBackend,
|
|
13
|
-
RunLock,
|
|
14
|
-
RunManager,
|
|
15
|
-
RunQueue,
|
|
16
|
-
VALID_TRANSITIONS,
|
|
17
|
-
createRunAskUserFn
|
|
18
|
-
} from "../chunk-7K6SDRRF.js";
|
|
19
|
-
import "../chunk-BSW22MPA.js";
|
|
20
|
-
import "../chunk-3OA5G4TM.js";
|
|
21
|
-
import "../chunk-SIHHIQLO.js";
|
|
22
|
-
import "../chunk-7Y6S3OCX.js";
|
|
23
|
-
import "../chunk-VIAGTYYW.js";
|
|
24
|
-
import "../chunk-76HYEPDM.js";
|
|
25
|
-
import "../chunk-5ECBT4YA.js";
|
|
26
|
-
import "../chunk-T6VYG46N.js";
|
|
27
|
-
import "../chunk-RMYKO74M.js";
|
|
28
|
-
import "../chunk-C5YQBIRK.js";
|
|
29
|
-
import "../chunk-XDIQWQJ4.js";
|
|
30
|
-
import "../chunk-SFXHZSRF.js";
|
|
31
|
-
import "../chunk-BXCY2FSE.js";
|
|
32
|
-
import "../chunk-MD32R22I.js";
|
|
33
|
-
export {
|
|
34
|
-
ArtifactTracker,
|
|
35
|
-
CheckpointWriter,
|
|
36
|
-
CompositeEvaluator,
|
|
37
|
-
EngineRunner,
|
|
38
|
-
FileRunStore,
|
|
39
|
-
Heartbeat,
|
|
40
|
-
NoopEvaluator,
|
|
41
|
-
RunApprovalBackend,
|
|
42
|
-
RunLock,
|
|
43
|
-
RunManager,
|
|
44
|
-
RunQueue,
|
|
45
|
-
VALID_TRANSITIONS,
|
|
46
|
-
createRunAskUserFn,
|
|
47
|
-
createRunManager
|
|
48
|
-
};
|
|
1
|
+
export{a as createRunManager}from'../chunk-RP26WO4R.js';export{_ as ArtifactTracker,Z as CheckpointWriter,ca as CompositeEvaluator,da as EngineRunner,V as FileRunStore,aa as Heartbeat,ba as NoopEvaluator,X as RunApprovalBackend,$ as RunLock,ea as RunManager,W as RunQueue,U as VALID_TRANSITIONS,Y as createRunAskUserFn}from'../chunk-NMBYBGC7.js';import'../chunk-2NS3JMNK.js';import'../chunk-WI6FSWGU.js';import'../chunk-P6JSTIFM.js';import'../chunk-SNFAPSLA.js';import'../chunk-XDOWC7EG.js';import'../chunk-W47Z7MGS.js';import'../chunk-T222K6IV.js';import'../chunk-QTWU7UNA.js';import'../chunk-UDPUTFQT.js';import'../chunk-Q4O2HGWS.js';import'../chunk-Y2NS6HPO.js';import'../chunk-NVAZJ5XS.js';import'../chunk-FU7AHZNN.js';import'../chunk-B7K2OWKC.js';import'../chunk-3QP5BQ3L.js';
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import {h,a}from'./chunk-3QP5BQ3L.js';import {mkdtempSync,writeFileSync}from'fs';import {tmpdir}from'os';import {join}from'path';h();function x(e){return {name:"seatbelt",wrap(o,l){let r=b(e),t=mkdtempSync(join(tmpdir(),"codeshell-sandbox-")),a=join(t,"profile.sb");return writeFileSync(a,r,"utf-8"),{file:"/usr/bin/sandbox-exec",args:["-f",a,l.shell,"-c",o]}},hintForBlockedOutput(o){if(/Operation not permitted|sandbox/.test(o))return `
|
|
2
|
+
[sandbox:seatbelt] A syscall was blocked by the sandbox. If this path should be writable or this network call legitimate, ask the user to update sandbox.writableRoots / sandbox.network in settings.json.`}}}a(x,"createSeatbeltBackend");function b(e){let o=e.writableRoots.map(t=>` (subpath ${d(t)})`).join(`
|
|
3
|
+
`),l=e.deniedReads.map(t=>` (subpath ${d(t)})`).join(`
|
|
4
|
+
`),r=e.network==="deny"?"(deny network-outbound)":"(allow network*)";return `(version 1)
|
|
5
|
+
(deny default)
|
|
6
|
+
|
|
7
|
+
;; Process control
|
|
8
|
+
(allow process-fork)
|
|
9
|
+
(allow process-exec)
|
|
10
|
+
(allow signal (target self))
|
|
11
|
+
(allow signal (target children))
|
|
12
|
+
|
|
13
|
+
;; Reads: broadly allowed, then explicit deny of sensitive paths
|
|
14
|
+
(allow file-read*)
|
|
15
|
+
${l?`(deny file-read*
|
|
16
|
+
${l})`:""}
|
|
17
|
+
|
|
18
|
+
;; Writes: workspace + listed roots only
|
|
19
|
+
(allow file-write*
|
|
20
|
+
${o})
|
|
21
|
+
(allow file-write-data
|
|
22
|
+
(literal "/dev/null")
|
|
23
|
+
(literal "/dev/zero")
|
|
24
|
+
(literal "/dev/random")
|
|
25
|
+
(literal "/dev/urandom")
|
|
26
|
+
(literal "/dev/dtracehelper"))
|
|
27
|
+
|
|
28
|
+
;; IPC & system services common tools need
|
|
29
|
+
(allow mach-lookup)
|
|
30
|
+
(allow ipc-posix-shm)
|
|
31
|
+
(allow sysctl-read)
|
|
32
|
+
(allow system-socket)
|
|
33
|
+
(allow iokit-open)
|
|
34
|
+
|
|
35
|
+
;; Network
|
|
36
|
+
${r}
|
|
37
|
+
`}a(b,"buildProfile");function d(e){return `"${e.replace(/"/g,'\\"')}"`}a(d,"quote");export{x as createSeatbeltBackend};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{b as SessionManager}from'./chunk-QTWU7UNA.js';import'./chunk-FU7AHZNN.js';import'./chunk-3QP5BQ3L.js';
|