@knightcodeai/cli 0.18.2 → 0.18.4
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 +38 -0
- package/dist/bundle/chunks/{anthropic-messages-QIZAJBTA.js → anthropic-messages-VD2GN7C4.js} +1 -1
- package/dist/bundle/chunks/azure-openai-responses-6IJ5JZ3Y.js +2 -0
- package/dist/bundle/chunks/{chunk-IGNYWP4P.js → chunk-3PSTVJEH.js} +1 -1
- package/dist/bundle/chunks/chunk-3VVG5HD5.js +11 -0
- package/dist/bundle/chunks/{chunk-XZJICKQ6.js → chunk-4DOSUUX3.js} +2 -2
- package/dist/bundle/chunks/{chunk-YQ26QP2R.js → chunk-CRLO4X52.js} +1 -1
- package/dist/bundle/chunks/{chunk-7CWBI3GL.js → chunk-FG6M5B3F.js} +10 -10
- package/dist/bundle/chunks/{chunk-LA7DDYYM.js → chunk-GCXF7ZNR.js} +7 -6
- package/dist/bundle/chunks/{chunk-ZB5LGRB5.js → chunk-HRZGVTRM.js} +1 -1
- package/dist/bundle/chunks/{chunk-HNZSETB2.js → chunk-L2XRQUGK.js} +2 -2
- package/dist/bundle/chunks/chunk-SLWTIEJK.js +16 -0
- package/dist/bundle/chunks/{chunk-R2XYMDTS.js → chunk-T6M3FJYR.js} +1 -1
- package/dist/bundle/chunks/{chunk-55AAX2FB.js → chunk-XILUO467.js} +1 -1
- package/dist/bundle/chunks/{cli-66ZLURJW.js → cli-AMSWLH7A.js} +1 -1
- package/dist/bundle/chunks/{cloudflare-workers-ai-system-one-LA7TF5LV.js → cloudflare-workers-ai-system-one-JBMTTHVI.js} +1 -1
- package/dist/bundle/chunks/{easter-egg-3d-DQYQIGP2.js → easter-egg-3d-VH6SGOZS.js} +1 -1
- package/dist/bundle/chunks/{execute-KJDH5JWX.js → execute-4UQWU4SD.js} +9 -3
- package/dist/bundle/chunks/{google-generative-ai-GEBPSQBJ.js → google-generative-ai-QBWYWMCA.js} +1 -1
- package/dist/bundle/chunks/{google-vertex-BRMU44TN.js → google-vertex-4KVZWEAI.js} +1 -1
- package/dist/bundle/chunks/{mistral-conversations-FKYKJV7R.js → mistral-conversations-NUSSE6NX.js} +1 -1
- package/dist/bundle/chunks/openai-codex-responses-66UQNGWB.js +10 -0
- package/dist/bundle/chunks/{openai-completions-A6RD26ED.js → openai-completions-QTYKORY2.js} +2 -2
- package/dist/bundle/chunks/{openai-decisions-OBTJNBTE.js → openai-decisions-ENPSYANO.js} +1 -1
- package/dist/bundle/chunks/openai-responses-JSX72BKV.js +3 -0
- package/dist/bundle/chunks/{typesafe-system-one-FZHRNG67.js → typesafe-system-one-ETHWOYKC.js} +1 -1
- package/dist/bundle/chunks/virtual-modules-AK4BYDR6.js +2 -0
- package/dist/bundle/cli-runtime.js +1 -1
- package/dist/core/export-html/template.html +1 -0
- package/dist/core/export-html/template.js +2 -1
- package/dist/core/export-html/vendor/marked-cjk-friendly.min.js +6 -0
- package/dist/core/export-html/vendor/marked.min.js +30 -29
- package/docs/codemode.md +2 -2
- package/docs/environment-variables.md +1 -0
- package/docs/extensions.md +38 -21
- package/package.json +1 -1
- package/dist/bundle/chunks/azure-openai-responses-7R44RRTC.js +0 -2
- package/dist/bundle/chunks/chunk-76TARFPL.js +0 -11
- package/dist/bundle/chunks/chunk-T7XWBYOA.js +0 -11
- package/dist/bundle/chunks/openai-codex-responses-DAZKF6IV.js +0 -10
- package/dist/bundle/chunks/openai-responses-L3QPK3MQ.js +0 -3
- package/dist/bundle/chunks/virtual-modules-IKIDAUHO.js +0 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire as __kcCreateRequire } from "node:module"; const require = __kcCreateRequire(import.meta.url);
|
|
2
|
-
import{retryProviderRequest}from"./chunk-57BPR4HF.js";import{headersToRecord,providerHeadersToRecord}from"./chunk-DVFCXHT4.js";import{calculateCost}from"./chunk-
|
|
2
|
+
import{retryProviderRequest}from"./chunk-57BPR4HF.js";import{headersToRecord,providerHeadersToRecord}from"./chunk-DVFCXHT4.js";import{calculateCost}from"./chunk-3VVG5HD5.js";function httpError(label,response,body){let error=new Error(`${label} returned ${response.status}`);return error.status=response.status,error.headers=response.headers,error.body=body,error}function timeoutError(timeoutMs){let error=new Error(`Request timed out after ${timeoutMs}ms`);return error.name="TimeoutError",error.status=void 0,error.headers=void 0,error.body="",error}function isRecord(value){return typeof value=="object"&&value!==null&&!Array.isArray(value)}function requiredNumber(label,value,field){if(typeof value!="number"||!Number.isFinite(value))throw new Error(`${label} returned an invalid ${field}`);return value}function requestHeaders(model,apiKey,optionsHeaders){return providerHeadersToRecord({authorization:`Bearer ${apiKey}`,"content-type":"application/json"},model.headers,optionsHeaders)??{}}async function postClassifierRequest(label,url,model,body,options,noRetryStatuses){if(!options?.apiKey)throw new Error(`No API key for provider: ${model.provider}`);let apiKey=options.apiKey,payload=body,transformed=await options.onPayload?.(payload,model);transformed!==void 0&&(payload=transformed);let requestFetch=options.fetch??globalThis.fetch,{response,json}=await retryProviderRequest(async()=>{let timeoutSignal=options.timeoutMs!==void 0?AbortSignal.timeout(options.timeoutMs):void 0,signal=options.signal&&timeoutSignal?AbortSignal.any([options.signal,timeoutSignal]):options.signal??timeoutSignal;try{let next=await requestFetch(url,{method:"POST",headers:requestHeaders(model,apiKey,options.headers),body:JSON.stringify(payload),signal});if(!next.ok)throw httpError(label,next,await next.text());return{response:next,json:await next.json()}}catch(error){throw timeoutSignal?.aborted&&!options.signal?.aborted?timeoutError(options.timeoutMs):error}},{maxRetries:options.maxRetries??2,maxRetryDelayMs:options.maxRetryDelayMs,signal:options.signal,noRetryStatuses});return await options.onResponse?.({status:response.status,headers:headersToRecord(response.headers)},model),json}function tokenCount(value){return typeof value=="number"&&Number.isFinite(value)&&value>0?value:0}function parseClassifierUsage(value,model){if(!isRecord(value)||value.input_tokens===void 0&&value.output_tokens===void 0)return;let input=tokenCount(value.input_tokens),output=tokenCount(value.output_tokens),usage={input,output,cacheRead:0,cacheWrite:0,totalTokens:input+output,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}};return calculateCost(model,usage),usage}export{isRecord,requiredNumber,postClassifierRequest,parseClassifierUsage};
|