@cjhyy/code-shell 0.1.6 → 0.2.0
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/dist/anthropic-OVRWAZRD.js +1 -0
- package/dist/arena/index.js +1 -104
- package/dist/arena-64T2EQD4.js +3 -0
- package/dist/bwrap-PVZMLHZR.js +2 -0
- package/dist/chunk-2EUIMKJA.js +1 -0
- package/dist/chunk-2GJ7H5NC.js +641 -0
- package/dist/chunk-2OD6VR4N.js +2 -0
- package/dist/chunk-3QP5BQ3L.js +1 -0
- package/dist/chunk-A4M2Y42L.js +2 -0
- package/dist/chunk-DEYFK6FP.js +1 -0
- package/dist/chunk-DTPABBSV.js +2 -0
- package/dist/chunk-EU3J7TBP.js +1 -0
- package/dist/chunk-FU7AHZNN.js +1 -0
- package/dist/chunk-L7B2ORID.js +4 -0
- package/dist/chunk-M7VU4YVY.js +49 -0
- package/dist/chunk-MGP35GKD.js +254 -0
- package/dist/chunk-MLCTC53I.js +1 -0
- package/dist/chunk-O5HFCH2U.js +1 -0
- package/dist/chunk-P6JSTIFM.js +1 -0
- package/dist/chunk-Q3RSX66I.js +1 -0
- package/dist/chunk-QTWU7UNA.js +5 -0
- package/dist/chunk-RERBX75D.js +251 -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-VKKU4LOM.js +3 -0
- package/dist/chunk-WI6FSWGU.js +1 -0
- package/dist/chunk-XXCZE2U2.js +2 -0
- package/dist/chunk-ZSAONDT6.js +2 -0
- package/dist/cli/main.js +303 -22060
- package/dist/cli/onboarding.d.ts +7 -2
- package/dist/client-base-F5FCRSB3.js +1 -0
- package/dist/compaction-L3Y6NG4N.js +1 -0
- package/dist/context/compaction.d.ts +2 -1
- package/dist/data/static-catalogs.d.ts +25 -0
- package/dist/devtools-SGDUOOM4.js +1 -0
- package/dist/engine/engine.d.ts +24 -0
- package/dist/engine/turn-loop.d.ts +20 -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/capabilities/index.d.ts +20 -0
- package/dist/llm/capabilities/rules.d.ts +26 -0
- package/dist/llm/capabilities/types.d.ts +108 -0
- package/dist/llm/model-pool.d.ts +7 -0
- package/dist/llm/provider-catalog.d.ts +2 -0
- package/dist/llm/provider-kinds.d.ts +1 -1
- package/dist/llm/providers/openai.d.ts +22 -0
- package/dist/llm/token-counter.d.ts +17 -0
- package/dist/llm/types.d.ts +8 -0
- package/dist/logging/logger.d.ts +10 -2
- package/dist/logging/session-recorder.d.ts +16 -3
- package/dist/manager-J6FXEUEK.js +1 -0
- package/dist/mcp-manager-27EVBKRT.js +1 -0
- package/dist/memory-BNI4WEWL.js +1 -0
- package/dist/model-cache-HEDXI7UJ.js +1 -0
- package/dist/model-fetcher-X5W5EASG.js +1 -0
- package/dist/off-7SDVMMXW.js +1 -0
- package/dist/openai-3QEADSYL.js +1 -0
- package/dist/openrouter-models-GZVCRWD2.js +1 -0
- package/dist/openrouter-sync-WG4AG5NC.js +1 -0
- package/dist/product/index.js +1 -21
- package/dist/protocol/client.d.ts +1 -1
- package/dist/run/index.js +1 -48
- package/dist/seatbelt-L54CNI2Y.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 +147 -21
- package/dist/tool-summary-V2B3MD5N.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/executor.d.ts +4 -0
- package/dist/tool-system/sandbox/bwrap.d.ts +13 -0
- package/dist/tool-system/sandbox/index.d.ts +78 -0
- package/dist/tool-system/sandbox/off.d.ts +2 -0
- package/dist/tool-system/sandbox/seatbelt.d.ts +18 -0
- package/dist/tool-system/task-guard.d.ts +30 -0
- package/dist/types.d.ts +17 -0
- package/dist/ui/components/SessionPicker.d.ts +2 -0
- package/dist/ui/components/SpinnerWithVerb.d.ts +7 -2
- package/dist/ui/components/StatusLine.d.ts +7 -3
- package/dist/updater-OCNU2K2Z.js +1 -0
- package/package.json +7 -10
- package/dist/anthropic-IBTI4WL2.cjs +0 -10
- package/dist/anthropic-PRZZKHEZ.js +0 -10
- package/dist/arena/index.cjs +0 -104
- package/dist/arena-2LTLIXOL.js +0 -261
- package/dist/arena-ADB7DRFI.cjs +0 -261
- package/dist/chunk-2YW4FPFG.cjs +0 -101
- package/dist/chunk-3OA5G4TM.js +0 -47
- package/dist/chunk-3QO25N6E.js +0 -4711
- package/dist/chunk-3SBSUOWZ.js +0 -447
- package/dist/chunk-52LGZKT3.cjs +0 -47
- package/dist/chunk-55XGPMAP.cjs +0 -146
- package/dist/chunk-6QVAYW7C.cjs +0 -438
- package/dist/chunk-6S4BJ65N.js +0 -113
- package/dist/chunk-76HYEPDM.js +0 -307
- package/dist/chunk-7BI3V74Y.cjs +0 -447
- package/dist/chunk-7EG3V4JY.cjs +0 -113
- package/dist/chunk-7JVTYEEC.js +0 -340
- package/dist/chunk-7QIM3BKD.js +0 -44
- package/dist/chunk-7Y6S3OCX.js +0 -438
- package/dist/chunk-ABRRONJ7.js +0 -107
- package/dist/chunk-BSW22MPA.js +0 -146
- package/dist/chunk-BXCY2FSE.js +0 -203
- package/dist/chunk-BZ5TNE7L.js +0 -5128
- package/dist/chunk-DDB6QOKJ.cjs +0 -1252
- package/dist/chunk-HEKQCI7B.cjs +0 -224
- package/dist/chunk-IK4EWJBP.cjs +0 -203
- package/dist/chunk-ILHE7XLT.cjs +0 -107
- package/dist/chunk-JMR33QVF.cjs +0 -169
- package/dist/chunk-KAQHULYN.js +0 -54
- package/dist/chunk-KE4EQOWA.js +0 -294
- package/dist/chunk-KOVYSDHZ.cjs +0 -340
- package/dist/chunk-KS3RYAYL.cjs +0 -45
- package/dist/chunk-MD32R22I.js +0 -50
- package/dist/chunk-MV7YI4WO.cjs +0 -293
- package/dist/chunk-MY5XHADU.cjs +0 -216
- package/dist/chunk-NUNC3VFB.cjs +0 -307
- package/dist/chunk-PKGRTCCY.js +0 -9092
- package/dist/chunk-QARL3IDQ.js +0 -1252
- package/dist/chunk-S754JHLR.cjs +0 -54
- package/dist/chunk-SFXHZSRF.js +0 -101
- package/dist/chunk-SIHHIQLO.js +0 -224
- package/dist/chunk-T6VYG46N.js +0 -105
- package/dist/chunk-TNLGBJYS.cjs +0 -44
- package/dist/chunk-TUY2T5KP.cjs +0 -105
- package/dist/chunk-UXOCVJJ6.cjs +0 -9092
- package/dist/chunk-VIAGTYYW.js +0 -169
- package/dist/chunk-WASS5YWB.js +0 -215
- package/dist/chunk-WZJV6DJC.cjs +0 -5128
- package/dist/chunk-YIQBXAYU.cjs +0 -264
- package/dist/chunk-YKIAELDZ.cjs +0 -4711
- package/dist/chunk-ZBPSQCPU.js +0 -264
- package/dist/cli/main.cjs +0 -22156
- 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-D65VFAPX.js +0 -7
- package/dist/manager-TTF5VHJC.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-H56GHBHN.js +0 -15
- package/dist/openrouter-models-TWUFWZ5T.cjs +0 -15
- package/dist/openrouter-sync-5VMGN6C2.cjs +0 -11
- package/dist/openrouter-sync-ALEMF5IU.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-I7QBW4DP.cjs +0 -17
- package/dist/updater-NVME5S3Z.js +0 -17
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{a as AnthropicClient}from'./chunk-DEYFK6FP.js';import'./chunk-O5HFCH2U.js';import'./chunk-2EUIMKJA.js';import'./chunk-FU7AHZNN.js';import'./chunk-ZSAONDT6.js';import'./chunk-3QP5BQ3L.js';
|
package/dist/arena/index.js
CHANGED
|
@@ -1,104 +1 @@
|
|
|
1
|
-
|
|
2
|
-
IterativeArena,
|
|
3
|
-
codeFormat,
|
|
4
|
-
defaultConvergence,
|
|
5
|
-
diffRatio,
|
|
6
|
-
documentFormat,
|
|
7
|
-
getFormat
|
|
8
|
-
} from "../chunk-QARL3IDQ.js";
|
|
9
|
-
import {
|
|
10
|
-
Arena,
|
|
11
|
-
ArenaLedger,
|
|
12
|
-
DiscussionStrategy,
|
|
13
|
-
LENS_NAMES,
|
|
14
|
-
MODEL_PRESETS,
|
|
15
|
-
PlanningStrategy,
|
|
16
|
-
ReviewStrategy,
|
|
17
|
-
applyReviewResult,
|
|
18
|
-
buildConsensus,
|
|
19
|
-
buildDigest,
|
|
20
|
-
buildLensPrompt,
|
|
21
|
-
collectEvidence,
|
|
22
|
-
createProgressRenderer,
|
|
23
|
-
formatArenaResult,
|
|
24
|
-
formatArenaResultForSession,
|
|
25
|
-
formatDigest,
|
|
26
|
-
getLens,
|
|
27
|
-
getMaxOutputTokens,
|
|
28
|
-
getStrategy,
|
|
29
|
-
getStrategyForPlan,
|
|
30
|
-
hasTools,
|
|
31
|
-
isStrategyV2,
|
|
32
|
-
isTerminal,
|
|
33
|
-
markUnderReview,
|
|
34
|
-
markUnresolved,
|
|
35
|
-
planArena,
|
|
36
|
-
printArenaResult,
|
|
37
|
-
registerClaims,
|
|
38
|
-
renderProgress,
|
|
39
|
-
resolveClaimStatus,
|
|
40
|
-
resolveLenses,
|
|
41
|
-
runAdjudication,
|
|
42
|
-
runCrossReview,
|
|
43
|
-
runDebateRounds,
|
|
44
|
-
runParticipantResearch,
|
|
45
|
-
runParticipantResearchWithDossiers,
|
|
46
|
-
runVerificationReview,
|
|
47
|
-
selectClaimsForReview,
|
|
48
|
-
selectTools,
|
|
49
|
-
transitionClaim,
|
|
50
|
-
validTransitions
|
|
51
|
-
} from "../chunk-BZ5TNE7L.js";
|
|
52
|
-
import "../chunk-3QO25N6E.js";
|
|
53
|
-
import "../chunk-SFXHZSRF.js";
|
|
54
|
-
import "../chunk-BXCY2FSE.js";
|
|
55
|
-
import "../chunk-MD32R22I.js";
|
|
56
|
-
export {
|
|
57
|
-
Arena,
|
|
58
|
-
ArenaLedger,
|
|
59
|
-
DiscussionStrategy,
|
|
60
|
-
IterativeArena,
|
|
61
|
-
LENS_NAMES,
|
|
62
|
-
MODEL_PRESETS,
|
|
63
|
-
PlanningStrategy,
|
|
64
|
-
ReviewStrategy,
|
|
65
|
-
applyReviewResult,
|
|
66
|
-
buildConsensus,
|
|
67
|
-
buildDigest,
|
|
68
|
-
buildLensPrompt,
|
|
69
|
-
collectEvidence,
|
|
70
|
-
createProgressRenderer,
|
|
71
|
-
defaultConvergence as defaultIterateConvergence,
|
|
72
|
-
formatArenaResult,
|
|
73
|
-
formatArenaResultForSession,
|
|
74
|
-
formatDigest,
|
|
75
|
-
getFormat as getIterateFormat,
|
|
76
|
-
getLens,
|
|
77
|
-
getMaxOutputTokens,
|
|
78
|
-
getStrategy,
|
|
79
|
-
getStrategyForPlan,
|
|
80
|
-
hasTools,
|
|
81
|
-
isStrategyV2,
|
|
82
|
-
isTerminal,
|
|
83
|
-
codeFormat as iterateCodeFormat,
|
|
84
|
-
diffRatio as iterateDiffRatio,
|
|
85
|
-
documentFormat as iterateDocumentFormat,
|
|
86
|
-
markUnderReview,
|
|
87
|
-
markUnresolved,
|
|
88
|
-
planArena,
|
|
89
|
-
printArenaResult,
|
|
90
|
-
registerClaims,
|
|
91
|
-
renderProgress,
|
|
92
|
-
resolveClaimStatus,
|
|
93
|
-
resolveLenses,
|
|
94
|
-
runAdjudication,
|
|
95
|
-
runCrossReview,
|
|
96
|
-
runDebateRounds,
|
|
97
|
-
runParticipantResearch,
|
|
98
|
-
runParticipantResearchWithDossiers,
|
|
99
|
-
runVerificationReview,
|
|
100
|
-
selectClaimsForReview,
|
|
101
|
-
selectTools,
|
|
102
|
-
transitionClaim,
|
|
103
|
-
validTransitions
|
|
104
|
-
};
|
|
1
|
+
export{j as IterativeArena,f as defaultIterateConvergence,i as getIterateFormat,g as iterateCodeFormat,e as iterateDiffRatio,h as iterateDocumentFormat}from'../chunk-RERBX75D.js';export{J as Arena,I as ArenaLedger,e as DiscussionStrategy,j as LENS_NAMES,Q as MODEL_PRESETS,f as PlanningStrategy,d as ReviewStrategy,z as applyReviewResult,H as buildConsensus,u as buildDigest,i as buildLensPrompt,n as collectEvidence,U as createProgressRenderer,S as formatArenaResult,W as formatArenaResultForSession,v as formatDigest,g as getLens,R as getMaxOutputTokens,k as getStrategy,l as getStrategyForPlan,p as hasTools,c as isStrategyV2,B as isTerminal,y as markUnderReview,A as markUnresolved,m as planArena,T as printArenaResult,s as registerClaims,V as renderProgress,x as resolveClaimStatus,h as resolveLenses,G as runAdjudication,D as runCrossReview,F as runDebateRounds,q as runParticipantResearch,r as runParticipantResearchWithDossiers,E as runVerificationReview,t as selectClaimsForReview,o as selectTools,w as transitionClaim,C as validTransitions}from'../chunk-2GJ7H5NC.js';import'../chunk-A4M2Y42L.js';import'../chunk-FU7AHZNN.js';import'../chunk-ZSAONDT6.js';import'../chunk-3QP5BQ3L.js';
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import {a as a$1}from'./chunk-MLCTC53I.js';import'./chunk-P6JSTIFM.js';import {c as c$1}from'./chunk-DTPABBSV.js';import {U,V,J,W,T as T$1,R as R$1,Q as Q$1}from'./chunk-2GJ7H5NC.js';export{W as formatArenaResultForSession}from'./chunk-2GJ7H5NC.js';import'./chunk-A4M2Y42L.js';import'./chunk-FU7AHZNN.js';import'./chunk-ZSAONDT6.js';import {h,a}from'./chunk-3QP5BQ3L.js';import l from'chalk';h();async function Q(e,s,a){let{models:n,mode:i,base:m,head:r,topic:t}=E(e),o=a?.output??(d=>console.log(d));if(!t){o(R());return}let f=j(s,n);if(f.length<2){o(L());return}let P=i?i.charAt(0).toUpperCase()+i.slice(1):"Auto";o(l.bold(`\u2550\u2550\u2550 Arena ${P} \u2550\u2550\u2550`)),o(l.dim(`Topic: ${t}`)),o(l.dim(`Models: ${f.map(d=>d.name).join(" vs ")}`));let x=a?.output?U(a.output):V,O=new J({participants:f,mode:i,enableContextTools:true,onProgress:x});try{let d=await O.run(t,{mode:i,base:m,head:r}),y=a?.outputMessage??a?.output;return y?y(W(d)):T$1(d),d}catch(d){o(l.red(`Arena failed: ${d.message}`));return}}a(Q,"runArenaReview");function T(e){let s=new a$1;try{let a=new c$1(process.cwd()).get();if(a.models?.length)for(let n of a.models)s.register({key:n.key,label:n.label,provider:n.provider??"",model:n.model,baseUrl:n.baseUrl??e.llm.baseUrl,apiKey:n.apiKey??e.llm.apiKey,maxOutputTokens:n.maxOutputTokens});}catch{}return s}a(T,"buildModelPool");function K(e,s,a){if(typeof e=="string"){let n=s.get(e);return n?{name:n.label??c(n.model),llm:{provider:n.provider,model:n.model,apiKey:n.apiKey??a.llm.apiKey,baseUrl:n.baseUrl??a.llm.baseUrl,temperature:.3,maxTokens:n.maxOutputTokens??R$1(n.model),enableStreaming:false}}:void 0}return {name:e.name,llm:{provider:e.provider??a.llm.provider,model:e.model,apiKey:e.apiKey??a.llm.apiKey,baseUrl:e.baseUrl??a.llm.baseUrl,temperature:.3,maxTokens:R$1(e.model),enableStreaming:false}}}a(K,"resolveOneParticipant");function j(e,s){let a=T(e);if(s)return s.split(",").map(r=>r.trim().toLowerCase()).map(r=>{let t=a.get(r);if(t)return {name:t.label??c(t.model),llm:{provider:t.provider,model:t.model,apiKey:t.apiKey??e.llm.apiKey,baseUrl:t.baseUrl??e.llm.baseUrl,temperature:.3,maxTokens:t.maxOutputTokens??R$1(t.model),enableStreaming:false}};let o=Q$1[r];return o?{name:c(o.model),llm:{provider:o.provider,model:o.model,apiKey:e.llm.apiKey,baseUrl:e.llm.baseUrl,temperature:.3,maxTokens:o.maxOutputTokens,enableStreaming:false}}:{name:c(r),llm:{...e.llm,model:r,enableStreaming:false}}});let n=new c$1(process.cwd()).get();if(n.arena?.participants?.length>=2){let m=n.arena.participants.map(r=>K(r,a,e)).filter(r=>r!==void 0);if(m.length>=2)return m}let i=[{name:c(e.llm.model),llm:{...e.llm,maxTokens:R$1(e.llm.model),enableStreaming:false}}];if(e.llm.baseUrl?.includes("openrouter")){let r=e.llm.model.includes("claude")?"openai/gpt-5.4":"anthropic/claude-opus-4.6";i.push({name:c(r),llm:{...e.llm,model:r,maxTokens:R$1(r),enableStreaming:false}});}return i}a(j,"resolveParticipants");var S=["review","discussion","planning"];function E(e){let s,a,n,i,m=[],r=e.split(/\s+/);for(let t=0;t<r.length;t++)if(r[t]==="--models"&&r[t+1])s=r[++t];else if(r[t]==="--mode"&&r[t+1]){let o=r[++t].toLowerCase();S.includes(o)?a=o:console.log(l.yellow(` Unknown mode "${o}", valid: ${S.join(", ")}`));}else r[t]==="--base"&&r[t+1]?n=r[++t]:r[t]==="--head"&&r[t+1]?i=r[++t]:m.push(r[t]);return {models:s,mode:a,base:n,head:i,topic:m.join(" ").trim()}}a(E,"parseFlags");function R(){return [l.bold("Arena \u2014 Multi-model collaborative analysis"),"",l.dim("Usage:")," /arena review the authentication module"," /arena --models claude,gpt4o is the error handling correct?"," /arena --mode planning design the new auth system"," /arena --mode discussion should we use REST or GraphQL"," /arena --base main review changes since main",' code-shell arena "review my latest changes"',"",`${l.dim("Modes:")} review (default), discussion, planning`,l.dim("Mode is auto-detected from the topic if --mode is not specified."),"",l.dim("Flags:")," --base <ref> Base branch/ref for comparison"," --head <ref> Head branch/ref (default: HEAD)","",`${l.dim("Available model presets:")} ${Object.keys(Q$1).join(", ")}`].join(`
|
|
2
|
+
`)}a(R,"formatUsage");function L(e){return [l.red("Arena needs at least 2 models."),"","Use --models to specify:"," /arena --models claude,gpt4o review the code","","Or configure in ~/.code-shell/settings.json:",' "arena": { "participants": [',' { "name": "Claude", "model": "anthropic/claude-sonnet-4-20250514" },',' { "name": "GPT-4o", "model": "openai/gpt-4o" }'," ]}"].join(`
|
|
3
|
+
`)}a(L,"formatModelHelp");function c(e){return (e.split("/").pop()??e).replace(/-\d.*$/,"").split("-").map(a=>a.charAt(0).toUpperCase()+a.slice(1)).join(" ")}a(c,"modelDisplayName");export{Q as runArenaReview};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import {h,a}from'./chunk-3QP5BQ3L.js';h();function p(n){return {name:"bwrap",wrap(s,t){let e=[];e.push("--ro-bind","/","/"),e.push("--dev","/dev"),e.push("--proc","/proc"),e.push("--tmpfs","/tmp");for(let r of n.writableRoots)e.push("--bind-try",r,r);for(let r of n.deniedReads)e.push("--ro-bind-try","/dev/null",r);return e.push("--unshare-pid","--unshare-ipc","--unshare-uts","--unshare-cgroup"),n.network==="deny"&&e.push("--unshare-net"),e.push("--die-with-parent"),e.push("--chdir",t.cwd),e.push(t.shell,"-c",s),{file:"bwrap",args:e}},hintForBlockedOutput(s){if(/Permission denied|No such file or directory.*bwrap/i.test(s))return `
|
|
2
|
+
[sandbox:bwrap] A path access was blocked by the sandbox. If this path should be writable, ask the user to update sandbox.writableRoots in settings.json.`}}}a(p,"createBwrapBackend");export{p as createBwrapBackend};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {d,c as c$1,b as b$1}from'./chunk-FU7AHZNN.js';import {b}from'./chunk-ZSAONDT6.js';import {h,a}from'./chunk-3QP5BQ3L.js';h();var c=class g{constructor(e){this.config=e;this.provider=e.provider,this.model=e.model,this.temperature=e.temperature??.3,this.maxTokens=e.maxTokens??8192,this.timeout=e.timeout??12e4,this.retryMaxAttempts=e.retryMaxAttempts??3,this.enableStreaming=e.enableStreaming??true,this.initClient();}static{a(this,"LLMClientBase");}provider;model;temperature;maxTokens;timeout;retryMaxAttempts;enableStreaming;static onUsage;usage={records:[],totalPromptTokens:0,totalCompletionTokens:0,totalTokens:0,requestCount:0};recordUsage(e,i){i?.recordUsage!==false&&(this.usage.records.push(e),this.usage.totalPromptTokens+=e.promptTokens,this.usage.totalCompletionTokens+=e.completionTokens,this.usage.totalTokens+=e.totalTokens,this.usage.requestCount++,g.onUsage?.(this.model,e));}getUsage(){return {...this.usage}}async withRetry(e,i){let o=i??this.retryMaxAttempts,n;for(let t=1;t<=o;t++)try{return await e()}catch(r){if(n=r,r instanceof d)throw r;if(r instanceof c$1){let s=(r.retryAfter??t*2)*1e3;b.warn("llm.retry",{cat:"llm",provider:this.provider,model:this.model,attempt:t,of:o,reason:"rate_limit",waitMs:s}),await new Promise(T=>setTimeout(T,s));continue}if(t===o){b.error("llm.exhausted",{cat:"llm",provider:this.provider,model:this.model,attempts:o,error:r.message});break}let m=Math.min(1e3*Math.pow(2,t-1),3e4);b.warn("llm.retry",{cat:"llm",provider:this.provider,model:this.model,attempt:t,of:o,reason:"error",error:r.message,backoffMs:m}),await new Promise(s=>setTimeout(s,m));}throw n??new b$1("Unknown LLM error")}};export{c as a};
|