dal-code 1.0.30 → 1.0.31
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 +6 -0
- package/dist/node_modules/@dalcode/dal-bridge/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-gateway/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-guard/package.json +4 -4
- package/dist/node_modules/@dalcode/dal-halo/package.json +1 -1
- package/dist/node_modules/@dalcode/dal-interactive/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-lang/package.json +3 -3
- package/dist/node_modules/@dalcode/dal-lsp/package.json +3 -3
- package/dist/node_modules/@dalcode/dal-mcp/package.json +5 -5
- package/dist/node_modules/@dalcode/dal-office/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-pi-kit/dist/i18n.js +1 -1
- package/dist/node_modules/@dalcode/dal-pi-kit/package.json +1 -1
- package/dist/node_modules/@dalcode/dal-pi-kit/src/i18n.js +1 -1
- package/dist/node_modules/@dalcode/dal-plugins/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-review/package.json +3 -3
- package/dist/node_modules/@dalcode/dal-rewind/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-router/package.json +4 -4
- package/dist/node_modules/@dalcode/dal-skills/package.json +4 -3
- package/dist/node_modules/@dalcode/dal-skills/src/catalog.js +2 -0
- package/dist/node_modules/@dalcode/dal-skills/src/index.js +12 -11
- package/dist/node_modules/@dalcode/dal-subagent/package.json +5 -5
- package/dist/node_modules/@dalcode/dal-telemetry/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-terminal/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-tool-catalog/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-web/package.json +3 -3
- package/dist/node_modules/@dalcode/dal-workflow/package.json +2 -2
- package/dist/node_modules/@dalcode/deepailab/package.json +3 -3
- package/dist/node_modules/@earendil-works/chord/package.json +1 -1
- package/dist/node_modules/@earendil-works/pi-agent-core/package.json +2 -2
- package/dist/node_modules/@earendil-works/pi-ai/dist/cli.js +0 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/.manifest.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/cloudflare-ai-gateway.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/github-copilot.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/google-vertex.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/google.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/meta.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/opencode-go.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/opencode.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/openrouter.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/radius.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/vercel-ai-gateway.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/opencode-go.js +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/package.json +2 -2
- package/dist/node_modules/@earendil-works/pi-client/package.json +3 -3
- package/dist/node_modules/@earendil-works/pi-codemode/package.json +1 -1
- package/dist/node_modules/@earendil-works/pi-coding-agent/package.json +1 -1
- package/dist/node_modules/@earendil-works/pi-mcp/package.json +1 -1
- package/dist/node_modules/@earendil-works/pi-protocol/package.json +2 -2
- package/dist/node_modules/@earendil-works/pi-server/package.json +3 -3
- package/dist/node_modules/@earendil-works/pi-telemetry/package.json +1 -1
- package/dist/node_modules/@earendil-works/pi-tui/package.json +1 -1
- package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
- package/examples/extensions/custom-provider-anthropic/package.json +1 -1
- package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
- package/examples/extensions/gondolin/package-lock.json +2 -2
- package/examples/extensions/gondolin/package.json +1 -1
- package/examples/extensions/sandbox/package-lock.json +2 -2
- package/examples/extensions/sandbox/package.json +1 -1
- package/examples/extensions/with-deps/package-lock.json +2 -2
- package/examples/extensions/with-deps/package.json +1 -1
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
- package/dist/bundle/chunks/anthropic-messages-AZKHNVAG.js +0 -5
- package/dist/bundle/chunks/anthropic.js +0 -74
- package/dist/bundle/chunks/azure-openai-responses-LA3FYF3J.js +0 -1
- package/dist/bundle/chunks/bedrock-converse-stream.js +0 -82
- package/dist/bundle/chunks/chunk-4HEMJ3PG.js +0 -1140
- package/dist/bundle/chunks/chunk-4L3WN2XY.js +0 -1
- package/dist/bundle/chunks/chunk-4UTLMBZZ.js +0 -13
- package/dist/bundle/chunks/chunk-4XT6IQQ6.js +0 -1
- package/dist/bundle/chunks/chunk-5M7W2EDY.js +0 -3
- package/dist/bundle/chunks/chunk-5ULSWE2O.js +0 -43
- package/dist/bundle/chunks/chunk-6CYCI3EJ.js +0 -11
- package/dist/bundle/chunks/chunk-7ZC4UXSL.js +0 -1
- package/dist/bundle/chunks/chunk-ABVPQ2YN.js +0 -14
- package/dist/bundle/chunks/chunk-DRQDKNXA.js +0 -1
- package/dist/bundle/chunks/chunk-F5ZABL6Z.js +0 -19
- package/dist/bundle/chunks/chunk-GYI2XXNW.js +0 -10
- package/dist/bundle/chunks/chunk-H3QXYIF7.js +0 -30
- package/dist/bundle/chunks/chunk-HC56T2OZ.js +0 -134
- package/dist/bundle/chunks/chunk-HMFU7ZIF.js +0 -1
- package/dist/bundle/chunks/chunk-JEMNLK2O.js +0 -10
- package/dist/bundle/chunks/chunk-L2ZPNLYD.js +0 -1
- package/dist/bundle/chunks/chunk-LPXNMA2W.js +0 -1
- package/dist/bundle/chunks/chunk-PGXDEOVV.js +0 -1
- package/dist/bundle/chunks/chunk-PJACZCIR.js +0 -1
- package/dist/bundle/chunks/chunk-PMRZO46Y.js +0 -1
- package/dist/bundle/chunks/chunk-PRRNXB7S.js +0 -1
- package/dist/bundle/chunks/chunk-PRXLTI3Y.js +0 -81
- package/dist/bundle/chunks/chunk-Q6IMZXWD.js +0 -129
- package/dist/bundle/chunks/chunk-R4YWRKK4.js +0 -7
- package/dist/bundle/chunks/chunk-RDZVAGPR.js +0 -1
- package/dist/bundle/chunks/chunk-S3GGRYIO.js +0 -5
- package/dist/bundle/chunks/chunk-TEPMHNKQ.js +0 -1
- package/dist/bundle/chunks/chunk-TRDNDS6A.js +0 -3
- package/dist/bundle/chunks/chunk-USJZMAIR.js +0 -1
- package/dist/bundle/chunks/chunk-UTB4DTYQ.js +0 -1
- package/dist/bundle/chunks/chunk-WXULTH2D.js +0 -1
- package/dist/bundle/chunks/chunk-YKF7PQCJ.js +0 -1
- package/dist/bundle/chunks/chunk-YTERFI73.js +0 -1
- package/dist/bundle/chunks/chunk-ZBURYEWF.js +0 -1
- package/dist/bundle/chunks/chunk-ZKDITC7J.js +0 -35
- package/dist/bundle/chunks/cli-2LJMKSUZ.js +0 -50
- package/dist/bundle/chunks/cloudflare-workers-ai-system-one-6WEJUIW2.js +0 -1
- package/dist/bundle/chunks/codemode-worker.js +0 -470
- package/dist/bundle/chunks/dist-37IE4EWG.js +0 -10
- package/dist/bundle/chunks/easter-egg-3d-GHWWTBZN.js +0 -1
- package/dist/bundle/chunks/execute-JU22LJZT.js +0 -489
- package/dist/bundle/chunks/github-copilot.js +0 -1
- package/dist/bundle/chunks/google-generative-ai-RFPHNE43.js +0 -1
- package/dist/bundle/chunks/google-vertex-QDNCMHLE.js +0 -1
- package/dist/bundle/chunks/http-proxy-6TR4MP55.js +0 -1
- package/dist/bundle/chunks/https-proxy-agent-2VXB7436.js +0 -12
- package/dist/bundle/chunks/image-resize-worker.js +0 -1
- package/dist/bundle/chunks/jiti-loader-C3NU2SDH.js +0 -20
- package/dist/bundle/chunks/jiti-static-loader-E6ANQD5T.js +0 -1
- package/dist/bundle/chunks/kimi-coding.js +0 -1
- package/dist/bundle/chunks/lib-TEDK3E5I.js +0 -8
- package/dist/bundle/chunks/llama-cpp-classify-FYN623RH.js +0 -21
- package/dist/bundle/chunks/meta.js +0 -1
- package/dist/bundle/chunks/mistral-conversations-YHX5TRKG.js +0 -4
- package/dist/bundle/chunks/multipart-parser-SQ6GDJL7.js +0 -2
- package/dist/bundle/chunks/node-N5BSDOA5.js +0 -15
- package/dist/bundle/chunks/node-TWVVAGPO.js +0 -1
- package/dist/bundle/chunks/openai-chatgpt.js +0 -74
- package/dist/bundle/chunks/openai-codex-responses-UZEMMAYZ.js +0 -9
- package/dist/bundle/chunks/openai-codex.js +0 -74
- package/dist/bundle/chunks/openai-completions-H6WMELZZ.js +0 -6
- package/dist/bundle/chunks/openai-decisions-URHWCZPN.js +0 -4
- package/dist/bundle/chunks/openai-responses-7X65PCAB.js +0 -2
- package/dist/bundle/chunks/openrouter-images-DUPG5DZO.js +0 -1
- package/dist/bundle/chunks/openrouter.js +0 -74
- package/dist/bundle/chunks/pi-messages-YHKPQIHC.js +0 -7
- package/dist/bundle/chunks/radius.js +0 -74
- package/dist/bundle/chunks/runtime-LLITCT4N.js +0 -1
- package/dist/bundle/chunks/src-UK77SYZE.js +0 -3
- package/dist/bundle/chunks/typesafe-system-one-N7PKHI2N.js +0 -1
- package/dist/bundle/chunks/virtual-modules-H32OTUCD.js +0 -1
- package/dist/bundle/chunks/xai.js +0 -1
- package/dist/bundle/cli-runtime.js +0 -2
- package/dist/bundle/cli.js +0 -2
- package/dist/bundle/index.js +0 -1
- package/dist/bundle/rpc-entry.js +0 -2
- package/dist/core/key-id-schema.js +0 -1
- package/dist/core/keybindings-schema.js +0 -1
- package/dist/core/settings-defaults.js +0 -1
- package/dist/core/settings-schema.js +0 -1
- package/dist/modes/interactive/components/daxnuts.js +0 -1
- package/dist/modes/interactive/theme/theme-schema.js +0 -12
- package/dist/modes/interactive/theme/theme-tokens.js +0 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/compat-schema.js +0 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/model-schema.js +0 -1
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
var $=Object.defineProperty;var n=(r,t)=>$(r,"name",{value:t,configurable:!0});import{createRequire as y}from"node:module";const S=y(import.meta.url);import{isRecord as p,parseClassifierUsage as b,postClassifierRequest as m,requiredNumber as c}from"./chunk-HMFU7ZIF.js";import{formatProviderError as w,normalizeProviderError as h}from"./chunk-TEPMHNKQ.js";import"./chunk-PMRZO46Y.js";import"./chunk-UTB4DTYQ.js";import"./chunk-GYI2XXNW.js";import"./chunk-LPXNMA2W.js";import"./chunk-4L3WN2XY.js";var o="OpenAI Decisions",u=128;function d(r){let t=[r.criteria.true?`True means: ${r.criteria.true}`:"",r.criteria.false?`False means: ${r.criteria.false}`:""].filter(Boolean);return t.length>0?`${r.instructions}
|
|
2
|
-
|
|
3
|
-
${t.join(`
|
|
4
|
-
`)}`:r.instructions}n(d,"predicateInstructions");function g(r,t){return t.type==="choice"?{type:"choice",name:r,instructions:t.instructions,choices:Object.entries(t.criteria).map(([e,i])=>i?{value:e,description:i}:{value:e})}:t.type==="score"?{type:"score",name:r,instructions:t.instructions,levels:t.criteria.map(e=>({label:e}))}:{type:"predicate",name:r,instructions:d(t)}}n(g,"wireQuestion");function E(r){let t=JSON.stringify(r.state),e=r.images??[];if(e.length===0)return t;if(e.length>u)throw new Error(`${o} accepts at most ${u} images, got ${e.length}`);return[{role:"user",content:[{type:"input_text",text:t},...e.map(i=>({type:"input_image",image_url:`data:${i.mimeType};base64,${i.data}`}))]}]}n(E,"wireInput");function A(r,t){if(!Array.isArray(r))throw new Error(`${o} returned invalid probabilities for ${t}`);return Object.fromEntries(r.map(e=>{if(!p(e)||typeof e.value!="string")throw new Error(`${o} returned invalid probabilities for ${t}`);return[e.value,c(o,e.probability,`probability for ${t}.${e.value}`)]}))}n(A,"choiceProbabilities");function v(r,t,e){if(e.type==="refusal")throw new Error(`${o} refused to answer ${r}`);if(t.type==="choice"){if(e.type!=="choice"||typeof e.choice!="string")throw new Error(`${o} did not return a choice answer for ${r}`);return{type:"choice",choice:e.choice,probabilities:A(e.probabilities,r),confidence:c(o,e.confidence,`confidence for ${r}`)}}if(t.type==="score"){if(e.type!=="score")throw new Error(`${o} did not return a score answer for ${r}`);return{type:"score",score:c(o,e.score,`score for ${r}`),confidence:c(o,e.confidence,`confidence for ${r}`)}}if(e.type!=="predicate")throw new Error(`${o} did not return a predicate answer for ${r}`);return{type:"bool",probability:c(o,e.probability,`probability for ${r}`)}}n(v,"parseAnswer");function R(r,t){if(!Array.isArray(r))throw new Error(`${o} returned an unexpected response`);let e=new Map;for(let i of r)p(i)&&typeof i.name=="string"&&e.set(i.name,i);return Object.fromEntries(Object.entries(t.questions).map(([i,s])=>{let a=e.get(i);if(!a)throw new Error(`${o} did not return an answer for ${i}`);return[i,v(i,s,a)]}))}n(R,"parseAnswers");var O=[504];function _(r){return r.status===504?`${o} error (504): the request timed out at the gateway. Very large inputs (above roughly 600K tokens) currently exceed its time limit.`:w(h(r),`${o} error`)}n(_,"errorMessage");var j=n(async(r,t,e)=>{let i={api:r.api,provider:r.provider,model:r.id,answers:{},stopReason:"stop",timestamp:Date.now()};try{if(r.api!=="openai-decisions")throw new Error(`Unsupported classifier API: ${r.api}`);let s=await m(o,new URL("decisions",`${r.baseUrl.replace(/\/+$/u,"")}/`),r,{model:r.id,input:E(t),questions:Object.entries(t.questions).map(([f,l])=>g(f,l))},e,O);if(!p(s))throw new Error(`${o} returned an unexpected response`);let a=b(s.usage,r);return a&&(i.usage=a),i.answers=R(s.answers,t),i}catch(s){return i.answers={},i.stopReason=e?.signal?.aborted?"aborted":"error",i.errorMessage=_(s),i}},"classify");export{j as classify};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
var O=Object.defineProperty;var n=(e,s)=>O(e,"name",{value:s,configurable:!0});import{createRequire as E}from"node:module";const ne=E(import.meta.url);import{buildCopilotDynamicHeaders as _,hasCopilotVisionInput as I}from"./chunk-PGXDEOVV.js";import{convertResponsesMessages as w,convertResponsesTools as x,processResponsesStream as b}from"./chunk-JEMNLK2O.js";import{clampOpenAIPromptCacheKey as k}from"./chunk-PRRNXB7S.js";import{OpenAI as L}from"./chunk-H3QXYIF7.js";import{formatProviderError as G,normalizeProviderError as U}from"./chunk-TEPMHNKQ.js";import"./chunk-PJACZCIR.js";import{retryProviderRequest as q}from"./chunk-PMRZO46Y.js";import{buildBaseOptions as D,createGrammarToolInputProperties as h,getPiUserAgent as N,resolveSamplingParams as F}from"./chunk-4XT6IQQ6.js";import"./chunk-L2ZPNLYD.js";import{headersToRecord as K}from"./chunk-UTB4DTYQ.js";import{getProviderEnvValue as H}from"./chunk-DRQDKNXA.js";import"./chunk-TRDNDS6A.js";import{clampThinkingLevel as W,getDeclaredTools as v,resolveTranscript as j,resolveTranscriptTools as z}from"./chunk-GYI2XXNW.js";import{AssistantMessageEventStream as $}from"./chunk-LPXNMA2W.js";import"./chunk-4L3WN2XY.js";var V=new Set(["openai","openai-codex","opencode"]),B=16,J="https://chatgpt.com/settings/usage";function Q(e,s){return e.provider==="openai"&&e.baseUrl==="https://api.openai.com/v1"&&s!==void 0&&!s.startsWith("sk-")}n(Q,"isChatGPTSignIn");function T(e,s){if(!e)return!1;let r=s.toLowerCase();for(let[t,p]of Object.entries(e))if(t.toLowerCase()===r&&p!==null&&p.trim().length>0)return!0;return!1}n(T,"hasHeader");function R(e,s,r){if(s)return s;if(T(r,"authorization")||T(r,"cf-aig-authorization"))return"unused";throw new Error(`No API key for provider: ${e}`)}n(R,"getClientApiKey");function X(e){return e.provider==="openrouter"||e.baseUrl.includes("openrouter.ai")?"openrouter":"openai"}n(X,"detectSessionAffinityFormat");function y(e,s){return e||(H("PI_CACHE_RETENTION",s)==="long"?"long":"short")}n(y,"resolveCacheRetention");function f(e){return{supportsDeveloperRole:e.compat?.supportsDeveloperRole??!0,supportsMidConvoSystemMessages:e.compat?.supportsMidConvoSystemMessages??!1,sessionAffinityFormat:e.compat?.sessionAffinityFormat??X(e),supportsLongCacheRetention:e.compat?.supportsLongCacheRetention??!0,supportsStrictMode:e.compat?.supportsStrictMode??!1,supportsOpenAIGrammarTools:e.compat?.supportsOpenAIGrammarTools??!1,supportsAdditionalTools:e.compat?.supportsAdditionalTools??!1,supportsToolSearch:e.compat?.supportsToolSearch??!1,supportsExplicitPromptCacheMode:e.compat?.supportsExplicitPromptCacheMode??!1,supportsMaxOutputTokens:e.compat?.supportsMaxOutputTokens??!0}}n(f,"getCompat");function Y(e,s){return s==="long"&&e.supportsLongCacheRetention&&!e.supportsExplicitPromptCacheMode?"24h":void 0}n(Y,"getPromptCacheRetention");function Z(e,s){if(e.supportsExplicitPromptCacheMode){if(s==="none")return{mode:"explicit"};if(s==="long"&&e.supportsLongCacheRetention)return{ttl:"30m"}}}n(Z,"getPromptCacheOptions");var C=n((e,s,r)=>{let t=new $,p=j(s,f(e).supportsMidConvoSystemMessages);return(async()=>{let o={role:"assistant",content:[],api:e.api,provider:e.provider,model:e.id,usage:{input:0,output:0,cacheRead:0,cacheWrite:0,totalTokens:0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},stopReason:"pending",timestamp:Date.now()};try{let c=R(e.provider,r?.apiKey,r?.headers),a=y(r?.cacheRetention,r?.env)==="none"?void 0:r?.sessionId,u=f(e),i=h(v(p.messages),u.supportsOpenAIGrammarTools),m=re(e,p,c,r?.headers,r?.fetch,a),l=te(e,p,r,u,i),d=await r?.onPayload?.(l,e);d!==void 0&&(l=d);let M={...r?.signal?{signal:r.signal}:{},...r?.timeoutMs!==void 0?{timeout:r.timeoutMs}:{},maxRetries:0},{data:S,response:g}=await q(()=>m.responses.create(l,M).withResponse(),{maxRetries:r?.maxRetries,maxRetryDelayMs:r?.maxRetryDelayMs,signal:r?.signal});if(await r?.onResponse?.({status:g.status,headers:K(g.headers)},e),t.push({type:"start",partial:o}),await b(S,o,t,e,{onProviderStreamEvent:r?.onProviderStreamEvent,serviceTier:r?.serviceTier,grammarToolInputProperties:i,applyServiceTierPricing:n((A,P)=>oe(A,P,e),"applyServiceTierPricing")}),r?.signal?.aborted)throw new Error("Request was aborted");if(o.stopReason==="pending")throw new Error("OpenAI Responses stream ended without a stop reason");if(o.stopReason==="aborted"||o.stopReason==="error")throw new Error(o.errorMessage||"An unknown error occurred");t.push({type:"done",reason:o.stopReason,message:o}),t.end()}catch(c){for(let u of o.content)delete u.index,delete u.partialJson,delete u.customInput;o.stopReason=r?.signal?.aborted?"aborted":"error";let a=G(U(c),`${e.provider==="openai"?"OpenAI":e.provider} API error`);o.errorMessage=a.includes("subscription_sharing_usage_limit_exceeded")?`${a}
|
|
2
|
-
Check your ChatGPT usage: ${J}`:a,t.push({type:"error",reason:o.stopReason,error:o}),t.end()}})(),t},"stream"),ee=n((e,s,r)=>{R(e.provider,r?.apiKey,r?.headers);let t={...D(e,s,r,r?.apiKey),toolChoice:r?.toolChoice},p=r?.reasoning?W(e,r.reasoning):void 0;return C(e,s,{...t,reasoningEffort:p==="off"?void 0:p})},"streamSimple");function re(e,s,r,t,p,o){let c=f(e),a={"User-Agent":N(),...e.headers};if(e.provider==="github-copilot"){let u=I(s.messages),i=_({messages:s.messages,hasImages:u});Object.assign(a,i)}return o&&(c.sessionAffinityFormat==="openrouter"?a["x-session-id"]=o:(c.sessionAffinityFormat==="openai"&&(a.session_id=o),a["x-client-request-id"]=o)),t&&Object.assign(a,t),new L({apiKey:r,baseURL:e.baseUrl,dangerouslyAllowBrowser:!0,fetch:p,defaultHeaders:a})}n(re,"createClient");function te(e,s,r,t=f(e),p=h(v(s.messages),t.supportsOpenAIGrammarTools)){let o=z(s.messages,t.supportsAdditionalTools||t.supportsToolSearch),c=w(e,s,V,{grammarToolInputProperties:p,supportsMidConvoSystemMessages:t.supportsMidConvoSystemMessages,supportsAdditionalTools:t.supportsAdditionalTools,supportsToolSearch:t.supportsToolSearch,toolOptions:{supportsStrictMode:t.supportsStrictMode,supportsOpenAIGrammarTools:t.supportsOpenAIGrammarTools}}),a=y(r?.cacheRetention,r?.env),u=Q(e,r?.apiKey),i={model:e.id,input:c,stream:!0,prompt_cache_key:a==="none"?void 0:k(r?.sessionId),prompt_cache_retention:u?void 0:Y(t,a),prompt_cache_options:u?void 0:Z(t,a),store:!1};r?.maxTokens&&t.supportsMaxOutputTokens&&!u&&(i.max_output_tokens=Math.max(r.maxTokens,B)),r?.temperature!==void 0&&!u&&(i.temperature=r?.temperature),r?.serviceTier!==void 0&&(i.service_tier=r.serviceTier),o.requestTools.length>0&&(i.tools=x(o.requestTools,{supportsStrictMode:t.supportsStrictMode,supportsOpenAIGrammarTools:t.supportsOpenAIGrammarTools})),r?.toolChoice!==void 0&&(i.tool_choice=r.toolChoice);let m=r?.reasoningEffort??(r?.reasoningSummary?"medium":void 0);if(e.reasoning){if(m){let d=r?.reasoningEffort?e.thinkingLevelMap?.[r.reasoningEffort]??r.reasoningEffort:m;i.reasoning={effort:d,summary:r?.reasoningSummary||"auto"},i.include=["reasoning.encrypted_content"]}else e.provider!=="github-copilot"&&e.thinkingLevelMap?.off!==null&&(i.reasoning={effort:e.thinkingLevelMap?.off??"none"});e.provider==="xai"&&(i.include=["reasoning.encrypted_content"])}let l=F(e,m??"off",r?.samplingParams);return l&&Object.assign(i,l),i}n(te,"buildParams");function se(e,s){switch(s){case"flex":return .5;case"priority":case"fast":return e.id==="gpt-5.5"?2.5:2;default:return 1}}n(se,"getServiceTierCostMultiplier");function oe(e,s,r){let t=se(r,s);t!==1&&(e.cost.input*=t,e.cost.output*=t,e.cost.cacheRead*=t,e.cost.cacheWrite*=t,e.cost.total=e.cost.input+e.cost.output+e.cost.cacheRead+e.cost.cacheWrite)}n(oe,"applyServiceTierPricing");export{C as stream,ee as streamSimple};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var f=Object.defineProperty;var n=(e,a)=>f(e,"name",{value:a,configurable:!0});import{createRequire as x}from"node:module";const C=x(import.meta.url);import{OpenAI as _}from"./chunk-H3QXYIF7.js";import{formatProviderError as k,normalizeProviderError as v}from"./chunk-TEPMHNKQ.js";import{retryProviderRequest as w}from"./chunk-PMRZO46Y.js";import{sanitizeSurrogates as T}from"./chunk-L2ZPNLYD.js";import{headersToRecord as b,providerHeadersToRecord as M}from"./chunk-UTB4DTYQ.js";import"./chunk-4L3WN2XY.js";var P=n(async(e,a,t)=>{let r={api:e.api,provider:e.provider,model:e.id,output:[],stopReason:"stop",timestamp:Date.now()};try{let s=t?.apiKey;if(!s)throw new Error(`No API key for provider: ${e.provider}`);let c=W(e,s,t?.headers,t?.fetch),i=q(e,a),u=await t?.onPayload?.(i,e);u!==void 0&&(i=u);let o={...t?.signal?{signal:t.signal}:{},...t?.timeoutMs!==void 0?{timeout:t.timeoutMs}:{},maxRetries:0},{data:y,response:g}=await w(()=>c.chat.completions.create(i,o).withResponse(),{maxRetries:t?.maxRetries,maxRetryDelayMs:t?.maxRetryDelayMs,signal:t?.signal});await t?.onResponse?.({status:g.status,headers:b(g.headers)},e);let p=y;r.responseId=p.id,p.usage&&(r.usage=I(p.usage,e));let m=p.choices[0];if(m){let l=m.message.content;typeof l=="string"&&l.length>0&&r.output.push({type:"text",text:l});for(let d of m.message.images??[]){let R=typeof d.image_url=="string"?d.image_url:d.image_url?.url;if(!R?.startsWith("data:"))continue;let h=R.match(/^data:([^;]+);base64,(.+)$/);h&&r.output.push({type:"image",mimeType:h[1],data:h[2]})}}return r}catch(s){return r.stopReason=t?.signal?.aborted?"aborted":"error",r.errorMessage=k(v(s)),r}},"generateImages");function W(e,a,t,r){return new _({apiKey:a,baseURL:e.baseUrl,dangerouslyAllowBrowser:!0,fetch:r,defaultHeaders:M({...e.headers,...t})})}n(W,"createClient");function q(e,a){let t=a.input.map(r=>r.type==="text"?{type:"text",text:T(r.text)}:{type:"image_url",image_url:{url:`data:${r.mimeType};base64,${r.data}`}});return{model:e.id,messages:[{role:"user",content:t}],stream:!1,modalities:e.output.includes("text")?["image","text"]:["image"]}}n(q,"buildParams");function I(e,a){let t=e.prompt_tokens||0,r=e.prompt_tokens_details?.cached_tokens||0,s=e.prompt_tokens_details?.cache_write_tokens||0,c=s>0?Math.max(0,r-s):r,i=Math.max(0,t-c-s),u=e.completion_tokens||0,o={input:i,output:u,cacheRead:c,cacheWrite:s,totalTokens:i+u+c+s,cost:{input:a.cost.input/1e6*i,output:a.cost.output/1e6*u,cacheRead:a.cost.cacheRead/1e6*c,cacheWrite:a.cost.cacheWrite/1e6*s,total:0}};return o.cost.total=o.cost.input+o.cost.output+o.cost.cacheRead+o.cost.cacheWrite,o}n(I,"parseUsage");export{P as generateImages};
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
var L=Object.defineProperty;var t=(e,r)=>L(e,"name",{value:r,configurable:!0});import{createRequire as H}from"node:module";const m=H(import.meta.url);var C=(e=>typeof m<"u"?m:typeof Proxy<"u"?new Proxy(e,{get:t((r,a)=>(typeof m<"u"?m:r)[a],"get")}):e)(function(e){if(typeof m<"u")return m.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')}),v=null;function P(e){if(!(typeof process>"u"||!process.versions?.bun||Object.keys(process.env).length>0)){if(v===null){v=new Map;try{let{readFileSync:r}=C("node:fs"),a=r("/proc/self/environ","utf-8");for(let n of a.split("\0")){let o=n.indexOf("=");o>0&&v.set(n.slice(0,o),n.slice(o+1))}}catch{}}return v.get(e)}}t(P,"getBunSandboxEnvValue");function T(e,r){return r?.[e]||(typeof process<"u"?process.env[e]:void 0)||P(e)||void 0}t(T,"getProviderEnvValue");import{createServer as $}from"node:http";var M='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 800 800" aria-hidden="true"><path fill="#F09082" d="M165.29 165.29H517.36V400H400V282.65H165.29Z"/><path fill="#4D9ABF" d="M165.29 282.65H282.65V400H400V517.36H282.65V634.72H165.29Z"/><path fill="#F1BE58" d="M517.36 400H634.72V634.72H517.36Z"/></svg>';function b(e){return e.replaceAll("&","&").replaceAll("<","<").replaceAll(">",">").replaceAll('"',""").replaceAll("'","'")}t(b,"escapeHtml");function k(e){let r=b(e.title),a=b(e.heading),n=b(e.message),o=e.details?b(e.details):void 0;return`<!doctype html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="utf-8" />
|
|
5
|
-
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
6
|
-
<title>${r}</title>
|
|
7
|
-
<style>
|
|
8
|
-
:root {
|
|
9
|
-
--text: #fafafa;
|
|
10
|
-
--text-dim: #a1a1aa;
|
|
11
|
-
--page-bg: #09090b;
|
|
12
|
-
--font-sans: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
|
|
13
|
-
--font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
|
|
14
|
-
}
|
|
15
|
-
* { box-sizing: border-box; }
|
|
16
|
-
html { color-scheme: dark; }
|
|
17
|
-
body {
|
|
18
|
-
margin: 0;
|
|
19
|
-
min-height: 100vh;
|
|
20
|
-
display: flex;
|
|
21
|
-
align-items: center;
|
|
22
|
-
justify-content: center;
|
|
23
|
-
padding: 24px;
|
|
24
|
-
background: var(--page-bg);
|
|
25
|
-
color: var(--text);
|
|
26
|
-
font-family: var(--font-sans);
|
|
27
|
-
text-align: center;
|
|
28
|
-
}
|
|
29
|
-
main {
|
|
30
|
-
width: 100%;
|
|
31
|
-
max-width: 560px;
|
|
32
|
-
display: flex;
|
|
33
|
-
flex-direction: column;
|
|
34
|
-
align-items: center;
|
|
35
|
-
justify-content: center;
|
|
36
|
-
}
|
|
37
|
-
.logo {
|
|
38
|
-
width: 72px;
|
|
39
|
-
height: 72px;
|
|
40
|
-
display: block;
|
|
41
|
-
margin-bottom: 24px;
|
|
42
|
-
}
|
|
43
|
-
h1 {
|
|
44
|
-
margin: 0 0 10px;
|
|
45
|
-
font-size: 28px;
|
|
46
|
-
line-height: 1.15;
|
|
47
|
-
font-weight: 650;
|
|
48
|
-
color: var(--text);
|
|
49
|
-
}
|
|
50
|
-
p {
|
|
51
|
-
margin: 0;
|
|
52
|
-
line-height: 1.7;
|
|
53
|
-
color: var(--text-dim);
|
|
54
|
-
font-size: 15px;
|
|
55
|
-
}
|
|
56
|
-
.details {
|
|
57
|
-
margin-top: 16px;
|
|
58
|
-
font-family: var(--font-mono);
|
|
59
|
-
font-size: 13px;
|
|
60
|
-
color: var(--text-dim);
|
|
61
|
-
white-space: pre-wrap;
|
|
62
|
-
word-break: break-word;
|
|
63
|
-
}
|
|
64
|
-
</style>
|
|
65
|
-
</head>
|
|
66
|
-
<body>
|
|
67
|
-
<main>
|
|
68
|
-
<div class="logo">${M}</div>
|
|
69
|
-
<h1>${a}</h1>
|
|
70
|
-
<p>${n}</p>
|
|
71
|
-
${o?`<div class="details">${o}</div>`:""}
|
|
72
|
-
</main>
|
|
73
|
-
</body>
|
|
74
|
-
</html>`}t(k,"renderPage");function I(e){return k({title:"Authentication successful",heading:"Authentication successful",message:e})}t(I,"oauthSuccessHtml");function y(e,r){return k({title:"Authentication failed",heading:"Authentication failed",message:e,details:r})}t(y,"oauthErrorHtml");function g(e,r,a){e.writeHead(r,{"content-type":"text/html; charset=utf-8","cache-control":"no-store"}),e.end(a)}t(g,"sendPage");async function N(e){let{providerName:r,signal:a}=e;if(a?.aborted)throw new Error("Login cancelled");let n=t(()=>{},"resolveWait"),o=t(()=>{},"rejectWait"),h=new Promise((c,s)=>{n=c,o=s});h.catch(()=>{});let i=!1,u=!1,l,x=t(()=>d({error:new Error("Login cancelled")}),"onAbort"),d=t(c=>{u||(u=!0,l&&clearTimeout(l),a?.removeEventListener("abort",x),"error"in c?o(c.error):n(c.value))},"finish"),p=$((c,s)=>{(async()=>{let w=new URL(c.url??"/","http://localhost");if(c.method!=="GET"||w.pathname!==e.path){g(s,404,y("Callback route not found."));return}if(e.state!==void 0&&w.searchParams.get("state")!==e.state){g(s,400,y("State mismatch."));return}if(i||u){g(s,409,y("This sign-in has already been handled."));return}let O=w.searchParams.get("error");if(O){let f=w.searchParams.get("error_description")??O;g(s,400,y(`${r} authorization failed.`,f)),d({error:new Error(`${r} authorization failed: ${f}`)});return}let S=w.searchParams.get("code");if(!S){g(s,400,y("Missing authorization code."));return}i=!0;try{let f=await e.complete(S);g(s,200,I(`Signed in to ${r}. You may now close this page.`)),d({value:f})}catch(f){let _=f instanceof Error?f:new Error(String(f));g(s,502,y(`${r} sign-in failed.`,_.message)),d({error:_})}})()});await new Promise((c,s)=>{p.once("error",s),p.listen(e.port,e.host,()=>{p.off("error",s),c()})});let E=p.address();if(!E||typeof E=="string")throw p.close(),new Error("OAuth callback server did not bind to TCP");p.on("error",c=>d({error:c})),a?.addEventListener("abort",x,{once:!0}),e.timeoutMs!==void 0&&(l=setTimeout(()=>d({error:new Error(`${r} sign-in timed out`)}),e.timeoutMs));let A=e.redirectHost??e.host;return{redirectUri:`http://${A.includes(":")?`[${A}]`:A}:${E.port}${e.path}`,wait:t(()=>h,"wait"),cancel:t(()=>{i||d({value:void 0})},"cancel"),close:t(()=>{d({error:new Error("OAuth callback server closed")}),p.close()},"close")}}t(N,"startOAuthCallbackServer");async function z(e,r,a){let n=new AbortController,o,h=e.prompt({type:"manual_code",...a,signal:n.signal}).then(i=>(r?.cancel(),i)).catch(i=>{o=i instanceof Error?i:new Error(String(i)),r?.cancel()});try{let i=await r?.wait();if(o)throw o;if(i!==void 0)return{type:"callback",value:i};let u=await h;if(o)throw o;return{type:"manual",input:u??""}}finally{n.abort()}}t(z,"waitForCallbackOrManualInput");function R(e){let r="";for(let a of e)r+=String.fromCharCode(a);return btoa(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}t(R,"base64urlEncode");async function j(){let e=new Uint8Array(32);crypto.getRandomValues(e);let r=R(e),a=new TextEncoder().encode(r),n=await crypto.subtle.digest("SHA-256",a),o=R(new Uint8Array(n));return{verifier:r,challenge:o}}t(j,"generatePKCE");var V="https://openrouter.ai/auth",B="https://openrouter.ai/api/v1/auth/keys",F=300*1e3,G=3e4;function q(){return T("PI_OAUTH_CALLBACK_HOST")||"127.0.0.1"}t(q,"getCallbackHost");function K(e){let r=e.trim();if(r){try{return new URL(r).searchParams.get("code")??void 0}catch{}return r.includes("code=")?new URLSearchParams(r).get("code")??void 0:r}}t(K,"parseAuthorizationInput");function D(e){if(typeof e.error_description=="string")return e.error_description;if(typeof e.message=="string")return e.message;if(typeof e.error=="string")return e.error;if(e.error&&typeof e.error=="object"&&!Array.isArray(e.error)){let r=e.error.message;if(typeof r=="string")return r}}t(D,"errorDetail");async function U(e,r,a){if(a.aborted)throw new Error("Login cancelled");let n=new AbortController,o=t(()=>n.abort(a.reason),"onAbort");a.addEventListener("abort",o,{once:!0});let h=setTimeout(()=>n.abort(new Error("OpenRouter OAuth token exchange timed out")),G),i,u={};try{i=await fetch(B,{method:"POST",headers:{accept:"application/json","content-type":"application/json"},body:JSON.stringify({code:e,code_verifier:r,code_challenge_method:"S256"}),signal:n.signal});try{let l=await i.json();l&&typeof l=="object"&&!Array.isArray(l)&&(u=l)}catch{if(i.ok)throw new Error("OpenRouter OAuth returned invalid JSON")}}catch(l){throw a.aborted?new Error("Login cancelled"):n.signal.aborted?new Error("OpenRouter OAuth token exchange timed out"):l}finally{clearTimeout(h),a.removeEventListener("abort",o)}if(!i.ok){let l=D(u);throw new Error(`OpenRouter OAuth key exchange failed (HTTP ${i.status})${l?`: ${l}`:""}`)}if(typeof u.key!="string"||u.key.length===0)throw new Error('OpenRouter OAuth response carries no "key"');return{type:"oauth",access:u.key,refresh:"",expires:Number.MAX_SAFE_INTEGER}}t(U,"exchangeAuthorizationCode");async function Z(e){let{verifier:r,challenge:a}=await j(),n=await N({providerName:"OpenRouter",host:q(),port:0,path:`/oauth/callback/${crypto.randomUUID()}`,complete:t(o=>U(o,r,e.signal),"complete"),signal:e.signal,timeoutMs:F});try{let o=new URL(V);o.search=new URLSearchParams({callback_url:n.redirectUri,code_challenge:a,code_challenge_method:"S256"}).toString(),e.notify({type:"progress",message:`Listening for OpenRouter OAuth callback on ${n.redirectUri}`}),e.notify({type:"auth_url",url:o.toString(),instructions:"Complete sign-in in your browser. If the browser is on another machine, paste the final redirect URL here."});let h=await z(e,n,{message:"Complete sign-in in your browser, or paste the authorization code / redirect URL here:",placeholder:n.redirectUri});if(h.type==="callback")return h.value;let i=K(h.input);if(!i)throw new Error("Missing authorization code");return e.notify({type:"progress",message:"Exchanging authorization code for an API key..."}),await U(i,r,e.signal)}finally{n.close()}}t(Z,"loginOpenRouter");var J={name:"OpenRouter OAuth",loginLabel:"Sign in with OpenRouter",login:Z,async refresh(e,r){return e},async toAuth(e){return{apiKey:e.access}}};export{J as openRouterOAuth};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
var k=Object.defineProperty;var s=(a,t)=>k(a,"name",{value:t,configurable:!0});import{createRequire as b}from"node:module";const A=b(import.meta.url);import{headersToRecord as w,providerHeadersToRecord as E}from"./chunk-UTB4DTYQ.js";import{getProviderEnvValue as I}from"./chunk-DRQDKNXA.js";import{parseStreamingJson as R}from"./chunk-TRDNDS6A.js";import{AssistantMessageEventStream as T,appendAssistantMessageDiagnostic as h,createAssistantMessageDiagnostic as _}from"./chunk-LPXNMA2W.js";import"./chunk-4L3WN2XY.js";var p=class extends Error{static{s(this,"PiMessagesResponseError")}code;diagnosticDetails;constructor(a,t,r){super(a),this.name="PiMessagesResponseError",this.code=t,this.diagnosticDetails=r}};function S(a){try{let t=JSON.parse(a),r=t?.error;return t&&typeof r=="object"&&r!==null&&!Array.isArray(r)?t:void 0}catch{return}}s(S,"parsePiMessagesErrorBody");function M(a){return a.length>8192?`${a.slice(0,8192)}\u2026`:a}s(M,"truncateDiagnosticString");function v(a,t,r){let e=typeof r?.error?.message=="string"?r.error.message:void 0,n=typeof r?.error?.code=="string"?r.error.code:void 0,o=e??t,i=n?` (${n})`:"";return`${a.status} ${a.statusText}: ${o}${i}`}s(v,"formatPiMessagesResponseError");function P(a,t,r,e){let n=S(e),o=typeof n?.error?.code=="string"?n.error.code:void 0;return new p(v(r,e,n),o,{version:1,provider:a.provider,model:a.id,url:t.toString(),status:r.status,statusText:r.statusText,...n?.error===void 0?{}:{error:n.error},...n?{}:{body:M(e)},timestampMs:Date.now()})}s(P,"createPiMessagesResponseError");function f(){return{input:0,output:0,cacheRead:0,cacheWrite:0,totalTokens:0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}}}s(f,"createEmptyUsage");function m(a,t){t&&h(a,{type:"pi_messages_rewrite",timestamp:Date.now(),details:{...t}})}s(m,"appendRewriteDiagnostic");function $(a){let t={role:"assistant",content:[],api:a.api,provider:a.provider,model:a.id,usage:f(),stopReason:"pending",timestamp:Date.now()},r=new Map;return e=>{switch(e.type){case"done":return Object.assign(t,{stopReason:e.reason,usage:e.usage,responseId:e.responseId}),e.providerThinkingLevel!==void 0&&(t.providerThinkingLevel=e.providerThinkingLevel),m(t,e.rewrite),{type:"done",reason:e.reason,message:t};case"error":return Object.assign(t,{stopReason:e.reason,usage:e.usage,errorMessage:e.errorMessage,responseId:e.responseId}),e.providerThinkingLevel!==void 0&&(t.providerThinkingLevel=e.providerThinkingLevel),m(t,e.rewrite),{type:"error",reason:e.reason,error:t};case"start":break;case"text_start":t.content[e.contentIndex]={type:"text",text:""};break;case"text_delta":t.content[e.contentIndex].text+=e.delta;break;case"text_end":Object.assign(t.content[e.contentIndex],{text:e.content,textSignature:e.contentSignature});break;case"thinking_start":t.content[e.contentIndex]={type:"thinking",thinking:""};break;case"thinking_delta":t.content[e.contentIndex].thinking+=e.delta;break;case"thinking_end":Object.assign(t.content[e.contentIndex],{thinking:e.content,thinkingSignature:e.contentSignature,redacted:e.redacted});break;case"toolcall_start":t.content[e.contentIndex]={type:"toolCall",id:e.id,name:e.toolName,arguments:{}},r.set(e.contentIndex,"");break;case"toolcall_delta":{let n=`${r.get(e.contentIndex)??""}${e.delta}`;r.set(e.contentIndex,n),t.content[e.contentIndex].arguments=R(n);break}case"toolcall_end":return Object.assign(t.content[e.contentIndex],e.toolCall),r.delete(e.contentIndex),{type:"toolcall_end",contentIndex:e.contentIndex,toolCall:t.content[e.contentIndex],partial:t}}return{...e,partial:t}}}s($,"createEventConverter");async function*D(a){let t=new TextDecoder,r=a.getReader(),e="";try{for(;;){let{done:n,value:o}=await r.read();e+=n?t.decode():t.decode(o,{stream:!0}),e=e.replace(/\r\n/g,`
|
|
2
|
-
`);let i=e.indexOf(`
|
|
3
|
-
|
|
4
|
-
`);for(;i!==-1;){let d=x(e.slice(0,i));d&&(yield d),e=e.slice(i+2),i=e.indexOf(`
|
|
5
|
-
|
|
6
|
-
`)}if(n)break}if(e.trim()){let n=x(e);n&&(yield n)}}finally{r.releaseLock()}}s(D,"readPiMessagesEvents");function x(a){let t=a.split(`
|
|
7
|
-
`).find(r=>r.startsWith("data:"))?.slice(5).trim();return t&&t!=="[DONE]"?JSON.parse(t):void 0}s(x,"parsePiMessagesEvent");function O(a,t,r){let e=r?"aborted":"error",n={role:"assistant",content:[],api:a.api,provider:a.provider,model:a.id,usage:f(),stopReason:e,errorMessage:t instanceof Error?t.message:String(t),timestamp:Date.now()};return!r&&t instanceof p&&h(n,_("pi_messages_response_failure",t,t.diagnosticDetails)),{type:"error",reason:e,error:n}}s(O,"createErrorEvent");function C(a,t){return a||(I("PI_CACHE_RETENTION",t)==="long"?"long":void 0)}s(C,"resolveCacheRetention");var y=s((a,t,r)=>{let e=new T,n=$(a);return(async()=>{try{let o=r?.apiKey;if(!o)throw new Error(`No API key provided for provider "${a.provider}"`);let i=new URL(`${a.baseUrl.replace(/\/+$/u,"")}/messages`);r?.debug&&i.searchParams.set("debug","1");let d={model:a.id,context:t,options:{temperature:r?.temperature,maxTokens:r?.maxTokens,reasoning:r?.reasoning,cacheRetention:C(r?.cacheRetention,r?.env),sessionId:r?.sessionId,toolChoice:r?.toolChoice}},u=await r?.onPayload?.(d,a);u!==void 0&&(d=u);let c=await(r?.fetch??globalThis.fetch)(i,{method:"POST",headers:{authorization:`Bearer ${o}`,accept:"text/event-stream","content-type":"application/json",...E(r?.headers)},body:JSON.stringify(d),signal:r?.signal});if(await r?.onResponse?.({status:c.status,headers:w(c.headers)},a),!c.ok){let l=await c.text();throw P(a,i,c,l)}if(!c.body)throw new Error(`${a.provider} response has no body`);for await(let l of D(c.body)){await r?.onProviderStreamEvent?.(l,a);let g=n(l);if(e.push(g),g.type==="done"||g.type==="error")return}throw new Error(`${a.provider} stream ended without a terminal event`)}catch(o){e.push(O(a,o,r?.signal?.aborted??!1))}})(),e},"stream"),j=s((a,t,r)=>{let e=r;return y(a,t,{...r,reasoning:r?.reasoning,toolChoice:r?.toolChoice,debug:e?.debug})},"streamSimple");export{p as PiMessagesResponseError,y as stream,j as streamSimple};
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
var N=Object.defineProperty;var o=(e,r)=>N(e,"name",{value:r,configurable:!0});import{createRequire as V}from"node:module";const ne=V(import.meta.url);function B(e){return(/^https?:\/\//iu.test(e)?e:`https://${e}`).replace(/\/+$/u,"")}o(B,"normalizeRadiusGatewayUrl");import{createServer as j}from"node:http";var G='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 800 800" aria-hidden="true"><path fill="#F09082" d="M165.29 165.29H517.36V400H400V282.65H165.29Z"/><path fill="#4D9ABF" d="M165.29 282.65H282.65V400H400V517.36H282.65V634.72H165.29Z"/><path fill="#F1BE58" d="M517.36 400H634.72V634.72H517.36Z"/></svg>';function _(e){return e.replaceAll("&","&").replaceAll("<","<").replaceAll(">",">").replaceAll('"',""").replaceAll("'","'")}o(_,"escapeHtml");function $(e){let r=_(e.title),t=_(e.heading),a=_(e.message),i=e.details?_(e.details):void 0;return`<!doctype html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="utf-8" />
|
|
5
|
-
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
6
|
-
<title>${r}</title>
|
|
7
|
-
<style>
|
|
8
|
-
:root {
|
|
9
|
-
--text: #fafafa;
|
|
10
|
-
--text-dim: #a1a1aa;
|
|
11
|
-
--page-bg: #09090b;
|
|
12
|
-
--font-sans: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
|
|
13
|
-
--font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
|
|
14
|
-
}
|
|
15
|
-
* { box-sizing: border-box; }
|
|
16
|
-
html { color-scheme: dark; }
|
|
17
|
-
body {
|
|
18
|
-
margin: 0;
|
|
19
|
-
min-height: 100vh;
|
|
20
|
-
display: flex;
|
|
21
|
-
align-items: center;
|
|
22
|
-
justify-content: center;
|
|
23
|
-
padding: 24px;
|
|
24
|
-
background: var(--page-bg);
|
|
25
|
-
color: var(--text);
|
|
26
|
-
font-family: var(--font-sans);
|
|
27
|
-
text-align: center;
|
|
28
|
-
}
|
|
29
|
-
main {
|
|
30
|
-
width: 100%;
|
|
31
|
-
max-width: 560px;
|
|
32
|
-
display: flex;
|
|
33
|
-
flex-direction: column;
|
|
34
|
-
align-items: center;
|
|
35
|
-
justify-content: center;
|
|
36
|
-
}
|
|
37
|
-
.logo {
|
|
38
|
-
width: 72px;
|
|
39
|
-
height: 72px;
|
|
40
|
-
display: block;
|
|
41
|
-
margin-bottom: 24px;
|
|
42
|
-
}
|
|
43
|
-
h1 {
|
|
44
|
-
margin: 0 0 10px;
|
|
45
|
-
font-size: 28px;
|
|
46
|
-
line-height: 1.15;
|
|
47
|
-
font-weight: 650;
|
|
48
|
-
color: var(--text);
|
|
49
|
-
}
|
|
50
|
-
p {
|
|
51
|
-
margin: 0;
|
|
52
|
-
line-height: 1.7;
|
|
53
|
-
color: var(--text-dim);
|
|
54
|
-
font-size: 15px;
|
|
55
|
-
}
|
|
56
|
-
.details {
|
|
57
|
-
margin-top: 16px;
|
|
58
|
-
font-family: var(--font-mono);
|
|
59
|
-
font-size: 13px;
|
|
60
|
-
color: var(--text-dim);
|
|
61
|
-
white-space: pre-wrap;
|
|
62
|
-
word-break: break-word;
|
|
63
|
-
}
|
|
64
|
-
</style>
|
|
65
|
-
</head>
|
|
66
|
-
<body>
|
|
67
|
-
<main>
|
|
68
|
-
<div class="logo">${G}</div>
|
|
69
|
-
<h1>${t}</h1>
|
|
70
|
-
<p>${a}</p>
|
|
71
|
-
${i?`<div class="details">${i}</div>`:""}
|
|
72
|
-
</main>
|
|
73
|
-
</body>
|
|
74
|
-
</html>`}o($,"renderPage");function F(e){return $({title:"Authentication successful",heading:"Authentication successful",message:e})}o(F,"oauthSuccessHtml");function p(e,r){return $({title:"Authentication failed",heading:"Authentication failed",message:e,details:r})}o(p,"oauthErrorHtml");function w(e,r,t){e.writeHead(r,{"content-type":"text/html; charset=utf-8","cache-control":"no-store"}),e.end(t)}o(w,"sendPage");async function W(e){let{providerName:r,signal:t}=e;if(t?.aborted)throw new Error("Login cancelled");let a=o(()=>{},"resolveWait"),i=o(()=>{},"rejectWait"),n=new Promise((s,c)=>{a=s,i=c});n.catch(()=>{});let l=!1,m=!1,d,A=o(()=>u({error:new Error("Login cancelled")}),"onAbort"),u=o(s=>{m||(m=!0,d&&clearTimeout(d),t?.removeEventListener("abort",A),"error"in s?i(s.error):a(s.value))},"finish"),f=j((s,c)=>{(async()=>{let g=new URL(s.url??"/","http://localhost");if(s.method!=="GET"||g.pathname!==e.path){w(c,404,p("Callback route not found."));return}if(e.state!==void 0&&g.searchParams.get("state")!==e.state){w(c,400,p("State mismatch."));return}if(l||m){w(c,409,p("This sign-in has already been handled."));return}let O=g.searchParams.get("error");if(O){let h=g.searchParams.get("error_description")??O;w(c,400,p(`${r} authorization failed.`,h)),u({error:new Error(`${r} authorization failed: ${h}`)});return}let R=g.searchParams.get("code");if(!R){w(c,400,p("Missing authorization code."));return}l=!0;try{let h=await e.complete(R);w(c,200,F(`Signed in to ${r}. You may now close this page.`)),u({value:h})}catch(h){let L=h instanceof Error?h:new Error(String(h));w(c,502,p(`${r} sign-in failed.`,L.message)),u({error:L})}})()});await new Promise((s,c)=>{f.once("error",c),f.listen(e.port,e.host,()=>{f.off("error",c),s()})});let y=f.address();if(!y||typeof y=="string")throw f.close(),new Error("OAuth callback server did not bind to TCP");f.on("error",s=>u({error:s})),t?.addEventListener("abort",A,{once:!0}),e.timeoutMs!==void 0&&(d=setTimeout(()=>u({error:new Error(`${r} sign-in timed out`)}),e.timeoutMs));let E=e.redirectHost??e.host;return{redirectUri:`http://${E.includes(":")?`[${E}]`:E}:${y.port}${e.path}`,wait:o(()=>n,"wait"),cancel:o(()=>{l||u({value:void 0})},"cancel"),close:o(()=>{u({error:new Error("OAuth callback server closed")}),f.close()},"close")}}o(W,"startOAuthCallbackServer");var b="Login cancelled",q="Device flow timed out",K="Device flow timed out after one or more slow_down responses. This is often caused by clock drift in WSL or VM environments. Please sync or restart the VM clock and try again.";function C(e,r,t){return new Promise((a,i)=>{if(r.aborted){i(new Error(t));return}let n=o(()=>{clearTimeout(l),i(new Error(t))},"onAbort"),l=setTimeout(()=>{r.removeEventListener("abort",n),a()},e);r.addEventListener("abort",n,{once:!0})})}o(C,"abortableSleep");async function Y(e){let r=typeof e.expiresInSeconds=="number"?Date.now()+e.expiresInSeconds*1e3:Number.POSITIVE_INFINITY,t=Math.max(1e3,Math.floor((e.intervalSeconds??5)*1e3)),a=0;if(e.waitBeforeFirstPoll){let i=r-Date.now();i>0&&await C(Math.min(t,i),e.signal,b)}for(;Date.now()<r;){if(e.signal.aborted)throw new Error(b);let i=await e.poll();if(i.status==="complete")return i.value;if(i.status==="failed")throw new Error(i.message);i.status==="slow_down"&&(a+=1,t=typeof i.intervalSeconds=="number"&&Number.isFinite(i.intervalSeconds)&&i.intervalSeconds>0?Math.max(1e3,Math.floor(i.intervalSeconds*1e3)):Math.max(1e3,t+5e3));let n=r-Date.now();if(n<=0)break;await C(Math.min(t,n),e.signal,b)}throw new Error(a>0?K:q)}o(Y,"pollOAuthDeviceCodeFlow");function M(e){let r="";for(let t of e)r+=String.fromCharCode(t);return btoa(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}o(M,"base64urlEncode");async function Z(){let e=new Uint8Array(32);crypto.getRandomValues(e);let r=M(e),t=new TextEncoder().encode(r),a=await crypto.subtle.digest("SHA-256",t),i=M(new Uint8Array(a));return{verifier:r,challenge:i}}o(Z,"generatePKCE");var T="127.0.0.1",k=1456,U="/oauth/callback",S=`http://${T}:${k}${U}`,J=6e4,P="browser",D="device-code",v="pi-gateway",I="gateway offline_access",X="urn:ietf:params:oauth:grant-type:device_code";async function Q(e,r){let t=await fetch(new URL("/v1/oauth",e),{headers:{accept:"application/json"},signal:r});if(!t.ok)throw new Error(`Could not load Radius OAuth config from ${e}: ${t.status} ${await t.text()}`);let a=await t.json();if(typeof a.authorizationEndpoint!="string")throw new Error(`Invalid Radius OAuth config from ${e}`);return{authorizationEndpoint:a.authorizationEndpoint}}o(Q,"loadRadiusOAuthDiscovery");var H=class extends Error{static{o(this,"OAuthResponseError")}status;oauthError;constructor(e,r,t,a){let i=r?t?`${r}: ${t}`:r:t||String(e);super(`${a}: ${i}`),this.status=e,this.oauthError=r}};async function z(e,r){let t=await e.text().catch(()=>""),a,i;if(t)try{let n=JSON.parse(t);a=typeof n.error=="string"?n.error:void 0,i=typeof n.error_description=="string"?n.error_description:void 0}catch{i=t}return new H(e.status,a,i,r)}o(z,"readOAuthResponseError");async function x(e,r,t){let a;try{a=await fetch(new URL("/v1/oauth/token",e),{method:"POST",headers:{accept:"application/json","content-type":"application/x-www-form-urlencoded"},body:r,signal:t})}catch(n){throw t.aborted?new Error("Login cancelled"):n}if(!a.ok)throw await z(a,"Radius OAuth token request failed");let i=await a.json();return{type:"oauth",access:i.access_token,refresh:i.refresh_token,expires:Date.now()+i.expires_in*1e3-J,scope:i.scope}}o(x,"requestOAuthToken");async function ee(e,r,t){let{verifier:a,challenge:i}=await Z(),n=crypto.randomUUID(),l=new URL(r);l.search=new URLSearchParams({response_type:"code",client_id:v,redirect_uri:S,scope:I,code_challenge:i,code_challenge_method:"S256",handoff:"url",state:n}).toString();let m=await W({providerName:"Radius",host:T,port:k,path:U,state:n,complete:o(d=>x(e,new URLSearchParams({grant_type:"authorization_code",client_id:v,redirect_uri:S,code:d,code_verifier:a}),t.signal),"complete"),signal:t.signal});t.notify({type:"progress",message:`Listening for OAuth callback on ${S}`}),t.notify({type:"auth_url",url:l.toString(),instructions:"Continue in your browser."});try{let d=await m.wait();if(!d)throw new Error("OAuth callback did not complete.");return d}finally{m.close()}}o(ee,"loginWithBrowser");async function te(e,r){let t;try{t=await fetch(new URL("/v1/oauth/device",e),{method:"POST",headers:{accept:"application/json","content-type":"application/x-www-form-urlencoded"},body:new URLSearchParams({client_id:v,scope:I}),signal:r})}catch(i){throw r.aborted?new Error("Login cancelled"):i}if(!t.ok)throw await z(t,"Radius OAuth device authorization failed");let a=await t.json();if(!a.device_code||!a.user_code||!a.verification_uri||!a.expires_in)throw new Error("Radius OAuth device authorization response is missing required fields");return{device_code:a.device_code,user_code:a.user_code,verification_uri:a.verification_uri,expires_in:a.expires_in,interval:a.interval}}o(te,"requestDeviceAuthorization");async function re(e,r){let t=await te(e,r.signal);return r.notify({type:"device_code",userCode:t.user_code,verificationUri:t.verification_uri,intervalSeconds:t.interval,expiresInSeconds:t.expires_in}),Y({intervalSeconds:t.interval,expiresInSeconds:t.expires_in,signal:r.signal,poll:o(async()=>{try{return{status:"complete",value:await x(e,new URLSearchParams({grant_type:X,client_id:v,device_code:t.device_code}),r.signal)}}catch(a){if(!(a instanceof H))throw a;switch(a.oauthError){case"authorization_pending":return{status:"pending"};case"slow_down":return{status:"slow_down"};case"expired_token":return{status:"failed",message:"Device authorization expired."};case"access_denied":return{status:"failed",message:"Device authorization was denied."};default:throw a}}},"poll")})}o(re,"loginWithDeviceCode");function ae(e){let r=B(e.gateway);return{name:e.name,async login(t){let a=await t.prompt({type:"select",message:`Sign in to ${e.name}:`,options:[{id:P,label:"Sign in with browser (recommended)"},{id:D,label:"Sign in with device code (when signing in from another device)"}]});if(a===D)return re(r,t);if(a===P){let i=await Q(r,t.signal);return ee(r,i.authorizationEndpoint,t)}throw new Error(`Unknown ${e.name} sign-in method: ${a}`)},async refresh(t,a){return await x(r,new URLSearchParams({grant_type:"refresh_token",client_id:v,refresh_token:t.refresh}),a)},async toAuth(t){return{apiKey:t.access}}}}o(ae,"createRadiusOAuth");export{ae as createRadiusOAuth};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{createRequire as r}from"node:module";const c=r(import.meta.url);import{McpOAuthCredentialStore as e,McpServerConnection as t,McpServerLog as o,McpSignInCancelledError as i,createDefaultTransport as p,signInMcpServer as m}from"./chunk-PRXLTI3Y.js";import"./chunk-ABVPQ2YN.js";import"./chunk-ZKDITC7J.js";import"./chunk-HC56T2OZ.js";import"./chunk-S3GGRYIO.js";import"./chunk-4L3WN2XY.js";export{e as McpOAuthCredentialStore,t as McpServerConnection,o as McpServerLog,i as McpSignInCancelledError,p as createDefaultTransport,m as signInMcpServer};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
var He=Object.defineProperty;var i=(e,r)=>He(e,"name",{value:r,configurable:!0});import{createRequire as Oe}from"node:module";const hr=Oe(import.meta.url);import{FormData as W,blobFrom as ze,blobFromSync as Ie,fetch_blob_default as ae,fileFrom as Ne,fileFromSync as De,file_default as Me,formDataToBlob as We,init_esm_min as ie,init_fetch_blob as je,init_from as Ve}from"./chunk-6CYCI3EJ.js";import{__esm as y}from"./chunk-4L3WN2XY.js";function Ge(e){if(!/^data:/i.test(e))throw new TypeError('`uri` does not appear to be a Data URI (must begin with "data:")');e=e.replace(/\r?\n/g,"");let r=e.indexOf(",");if(r===-1||r<=4)throw new TypeError("malformed data: URI");let t=e.substring(5,r).split(";"),n="",o=!1,s=t[0]||"text/plain",l=s;for(let T=1;T<t.length;T++)t[T]==="base64"?o=!0:t[T]&&(l+=`;${t[T]}`,t[T].indexOf("charset=")===0&&(n=t[T].substring(8)));!t[0]&&!n.length&&(l+=";charset=US-ASCII",n="US-ASCII");let u=o?"base64":"ascii",f=unescape(e.substring(r+1)),a=Buffer.from(f,u);return a.type=s,a.typeFull=l,a.charset=n,a}i(Ge,"dataUriToBuffer");var le,Ke=y({"node_modules/data-uri-to-buffer/dist/index.js"(){le=Ge}}),H,Y=y({"node_modules/node-fetch/src/errors/base.js"(){H=class extends Error{static{i(this,"FetchBaseError")}constructor(e,r){super(e),Error.captureStackTrace(this,this.constructor),this.type=r}get name(){return this.constructor.name}get[Symbol.toStringTag](){return this.constructor.name}}}}),w,ce=y({"node_modules/node-fetch/src/errors/fetch-error.js"(){Y(),w=class extends H{static{i(this,"FetchError")}constructor(e,r,t){super(e,r),t&&(this.code=this.errno=t.code,this.erroredSysCall=t.syscall)}}}}),O,Z,z,ue,fe,de,q=y({"node_modules/node-fetch/src/utils/is.js"(){O=Symbol.toStringTag,Z=i(e=>typeof e=="object"&&typeof e.append=="function"&&typeof e.delete=="function"&&typeof e.get=="function"&&typeof e.getAll=="function"&&typeof e.has=="function"&&typeof e.set=="function"&&typeof e.sort=="function"&&e[O]==="URLSearchParams","isURLSearchParameters"),z=i(e=>e&&typeof e=="object"&&typeof e.arrayBuffer=="function"&&typeof e.type=="string"&&typeof e.stream=="function"&&typeof e.constructor=="function"&&/^(Blob|File)$/.test(e[O]),"isBlob"),ue=i(e=>typeof e=="object"&&(e[O]==="AbortSignal"||e[O]==="EventTarget"),"isAbortSignal"),fe=i((e,r)=>{let t=new URL(r).hostname,n=new URL(e).hostname;return t===n||t.endsWith(`.${n}`)},"isDomainOrSubdomain"),de=i((e,r)=>{let t=new URL(r).protocol,n=new URL(e).protocol;return t===n},"isSameProtocol")}});import U,{PassThrough as he}from"node:stream";import{types as pe,deprecate as Q,promisify as Je}from"node:util";import{Buffer as b}from"node:buffer";async function X(e){if(e[m].disturbed)throw new TypeError(`body used already for: ${e.url}`);if(e[m].disturbed=!0,e[m].error)throw e[m].error;let{body:r}=e;if(r===null)return b.alloc(0);if(!(r instanceof U))return b.alloc(0);let t=[],n=0;try{for await(let o of r){if(e.size>0&&n+o.length>e.size){let s=new w(`content size at ${e.url} over limit: ${e.size}`,"max-size");throw r.destroy(s),s}n+=o.length,t.push(o)}}catch(o){throw o instanceof H?o:new w(`Invalid response body while trying to fetch ${e.url}: ${o.message}`,"system",o)}if(r.readableEnded===!0||r._readableState.ended===!0)try{return t.every(o=>typeof o=="string")?b.from(t.join("")):b.concat(t,n)}catch(o){throw new w(`Could not create Buffer from response body for ${e.url}: ${o.message}`,"system",o)}else throw new w(`Premature close of server response while trying to fetch ${e.url}`)}i(X,"consumeBody");var me,m,A,j,ye,ee,ge,we,re=y({"node_modules/node-fetch/src/body.js"(){je(),ie(),ce(),Y(),q(),me=Je(U.pipeline),m=Symbol("Body internals"),A=class{static{i(this,"Body")}constructor(e,{size:r=0}={}){let t=null;e===null?e=null:Z(e)?e=b.from(e.toString()):z(e)||b.isBuffer(e)||(pe.isAnyArrayBuffer(e)?e=b.from(e):ArrayBuffer.isView(e)?e=b.from(e.buffer,e.byteOffset,e.byteLength):e instanceof U||(e instanceof W?(e=We(e),t=e.type.split("=")[1]):e=b.from(String(e))));let n=e;b.isBuffer(e)?n=U.Readable.from(e):z(e)&&(n=U.Readable.from(e.stream())),this[m]={body:e,stream:n,boundary:t,disturbed:!1,error:null},this.size=r,e instanceof U&&e.on("error",o=>{let s=o instanceof H?o:new w(`Invalid response body while trying to fetch ${this.url}: ${o.message}`,"system",o);this[m].error=s})}get body(){return this[m].stream}get bodyUsed(){return this[m].disturbed}async arrayBuffer(){let{buffer:e,byteOffset:r,byteLength:t}=await X(this);return e.slice(r,r+t)}async formData(){let e=this.headers.get("content-type");if(e.startsWith("application/x-www-form-urlencoded")){let t=new W,n=new URLSearchParams(await this.text());for(let[o,s]of n)t.append(o,s);return t}let{toFormData:r}=await import("./multipart-parser-SQ6GDJL7.js");return r(this.body,e)}async blob(){let e=this.headers&&this.headers.get("content-type")||this[m].body&&this[m].body.type||"",r=await this.arrayBuffer();return new ae([r],{type:e})}async json(){let e=await this.text();return JSON.parse(e)}async text(){let e=await X(this);return new TextDecoder().decode(e)}buffer(){return X(this)}},A.prototype.buffer=Q(A.prototype.buffer,"Please use 'response.arrayBuffer()' instead of 'response.buffer()'","node-fetch#buffer"),Object.defineProperties(A.prototype,{body:{enumerable:!0},bodyUsed:{enumerable:!0},arrayBuffer:{enumerable:!0},blob:{enumerable:!0},json:{enumerable:!0},text:{enumerable:!0},data:{get:Q(()=>{},"data doesn't exist, use json(), text(), arrayBuffer(), or body instead","https://github.com/node-fetch/node-fetch/issues/1000 (response)")}}),j=i((e,r)=>{let t,n,{body:o}=e[m];if(e.bodyUsed)throw new Error("cannot clone body after it is used");return o instanceof U&&typeof o.getBoundary!="function"&&(t=new he({highWaterMark:r}),n=new he({highWaterMark:r}),o.pipe(t),o.pipe(n),e[m].stream=t,o=n),o},"clone"),ye=Q(e=>e.getBoundary(),"form-data doesn't follow the spec and requires special treatment. Use alternative package","https://github.com/node-fetch/node-fetch/issues/1167"),ee=i((e,r)=>e===null?null:typeof e=="string"?"text/plain;charset=UTF-8":Z(e)?"application/x-www-form-urlencoded;charset=UTF-8":z(e)?e.type||null:b.isBuffer(e)||pe.isAnyArrayBuffer(e)||ArrayBuffer.isView(e)?null:e instanceof W?`multipart/form-data; boundary=${r[m].boundary}`:e&&typeof e.getBoundary=="function"?`multipart/form-data;boundary=${ye(e)}`:e instanceof U?null:"text/plain;charset=UTF-8","extractContentType"),ge=i(e=>{let{body:r}=e[m];return r===null?0:z(r)?r.size:b.isBuffer(r)?r.length:r&&typeof r.getLengthSync=="function"&&r.hasKnownLength&&r.hasKnownLength()?r.getLengthSync():null},"getTotalBytes"),we=i(async(e,{body:r})=>{r===null?e.end():await me(r,e)},"writeToStream")}});import{types as be}from"node:util";import V from"node:http";function Ye(e=[]){return new L(e.reduce((r,t,n,o)=>(n%2===0&&r.push(o.slice(n,n+2)),r),[]).filter(([r,t])=>{try{return I(r),G(r,String(t)),!0}catch{return!1}}))}i(Ye,"fromRawHeaders");var I,G,L,te=y({"node_modules/node-fetch/src/headers.js"(){I=typeof V.validateHeaderName=="function"?V.validateHeaderName:e=>{if(!/^[\^`\-\w!#$%&'*+.|~]+$/.test(e)){let r=new TypeError(`Header name must be a valid HTTP token [${e}]`);throw Object.defineProperty(r,"code",{value:"ERR_INVALID_HTTP_TOKEN"}),r}},G=typeof V.validateHeaderValue=="function"?V.validateHeaderValue:(e,r)=>{if(/[^\t\u0020-\u007E\u0080-\u00FF]/.test(r)){let t=new TypeError(`Invalid character in header content ["${e}"]`);throw Object.defineProperty(t,"code",{value:"ERR_INVALID_CHAR"}),t}},L=class Ce extends URLSearchParams{static{i(this,"_Headers")}constructor(r){let t=[];if(r instanceof Ce){let n=r.raw();for(let[o,s]of Object.entries(n))t.push(...s.map(l=>[o,l]))}else if(r!=null)if(typeof r=="object"&&!be.isBoxedPrimitive(r)){let n=r[Symbol.iterator];if(n==null)t.push(...Object.entries(r));else{if(typeof n!="function")throw new TypeError("Header pairs must be iterable");t=[...r].map(o=>{if(typeof o!="object"||be.isBoxedPrimitive(o))throw new TypeError("Each header pair must be an iterable object");return[...o]}).map(o=>{if(o.length!==2)throw new TypeError("Each header pair must be a name/value tuple");return[...o]})}}else throw new TypeError("Failed to construct 'Headers': The provided value is not of type '(sequence<sequence<ByteString>> or record<ByteString, ByteString>)");return t=t.length>0?t.map(([n,o])=>(I(n),G(n,String(o)),[String(n).toLowerCase(),String(o)])):void 0,super(t),new Proxy(this,{get(n,o,s){switch(o){case"append":case"set":return(l,u)=>(I(l),G(l,String(u)),URLSearchParams.prototype[o].call(n,String(l).toLowerCase(),String(u)));case"delete":case"has":case"getAll":return l=>(I(l),URLSearchParams.prototype[o].call(n,String(l).toLowerCase()));case"keys":return()=>(n.sort(),new Set(URLSearchParams.prototype.keys.call(n)).keys());default:return Reflect.get(n,o,s)}}})}get[Symbol.toStringTag](){return this.constructor.name}toString(){return Object.prototype.toString.call(this)}get(r){let t=this.getAll(r);if(t.length===0)return null;let n=t.join(", ");return/^content-encoding$/i.test(r)&&(n=n.toLowerCase()),n}forEach(r,t=void 0){for(let n of this.keys())Reflect.apply(r,t,[this.get(n),n,this])}*values(){for(let r of this.keys())yield this.get(r)}*entries(){for(let r of this.keys())yield[r,this.get(r)]}[Symbol.iterator](){return this.entries()}raw(){return[...this.keys()].reduce((r,t)=>(r[t]=this.getAll(t),r),{})}[Symbol.for("nodejs.util.inspect.custom")](){return[...this.keys()].reduce((r,t)=>{let n=this.getAll(t);return t==="host"?r[t]=n[0]:r[t]=n.length>1?n:n[0],r},{})}},Object.defineProperties(L.prototype,["get","entries","forEach","values"].reduce((e,r)=>(e[r]={enumerable:!0},e),{}))}}),Se,K,Te=y({"node_modules/node-fetch/src/utils/is-redirect.js"(){Se=new Set([301,302,303,307,308]),K=i(e=>Se.has(e),"isRedirect")}}),S,v,Ze=y({"node_modules/node-fetch/src/response.js"(){te(),re(),Te(),S=Symbol("Response internals"),v=class D extends A{static{i(this,"_Response")}constructor(r=null,t={}){super(r,t);let n=t.status!=null?t.status:200,o=new L(t.headers);if(r!==null&&!o.has("Content-Type")){let s=ee(r,this);s&&o.append("Content-Type",s)}this[S]={type:"default",url:t.url,status:n,statusText:t.statusText||"",headers:o,counter:t.counter,highWaterMark:t.highWaterMark}}get type(){return this[S].type}get url(){return this[S].url||""}get status(){return this[S].status}get ok(){return this[S].status>=200&&this[S].status<300}get redirected(){return this[S].counter>0}get statusText(){return this[S].statusText}get headers(){return this[S].headers}get highWaterMark(){return this[S].highWaterMark}clone(){return new D(j(this,this.highWaterMark),{type:this.type,url:this.url,status:this.status,statusText:this.statusText,headers:this.headers,ok:this.ok,redirected:this.redirected,size:this.size,highWaterMark:this.highWaterMark})}static redirect(r,t=302){if(!K(t))throw new RangeError('Failed to execute "redirect" on "response": Invalid status code');return new D(null,{headers:{location:new URL(r).toString()},status:t})}static error(){let r=new D(null,{status:0,statusText:""});return r[S].type="error",r}static json(r=void 0,t={}){let n=JSON.stringify(r);if(n===void 0)throw new TypeError("data is not JSON serializable");let o=new L(t&&t.headers);return o.has("content-type")||o.set("content-type","application/json"),new D(n,{...t,headers:o})}get[Symbol.toStringTag](){return"Response"}},Object.defineProperties(v.prototype,{type:{enumerable:!0},url:{enumerable:!0},status:{enumerable:!0},ok:{enumerable:!0},redirected:{enumerable:!0},statusText:{enumerable:!0},headers:{enumerable:!0},clone:{enumerable:!0}})}}),Re,qe=y({"node_modules/node-fetch/src/utils/get-search.js"(){Re=i(e=>{if(e.search)return e.search;let r=e.href.length-1,t=e.hash||(e.href[r]==="#"?"#":"");return e.href[r-t.length]==="?"?"?":""},"getSearch")}});import{isIP as Qe}from"node:net";function ve(e,r=!1){return e==null||(e=new URL(e),/^(about|blob|data):$/.test(e.protocol))?"no-referrer":(e.username="",e.password="",e.hash="",r&&(e.pathname="",e.search=""),e)}i(ve,"stripURLForUseAsAReferrer");function Xe(e){if(!oe.has(e))throw new TypeError(`Invalid referrerPolicy: ${e}`);return e}i(Xe,"validateReferrerPolicy");function er(e){if(/^(http|ws)s:$/.test(e.protocol))return!0;let r=e.host.replace(/(^\[)|(]$)/g,""),t=Qe(r);return t===4&&/^127\./.test(r)||t===6&&/^(((0+:){7})|(::(0+:){0,6}))0*1$/.test(r)?!0:e.host==="localhost"||e.host.endsWith(".localhost")?!1:e.protocol==="file:"}i(er,"isOriginPotentiallyTrustworthy");function C(e){return/^about:(blank|srcdoc)$/.test(e)||e.protocol==="data:"||/^(blob|filesystem):$/.test(e.protocol)?!0:er(e)}i(C,"isUrlPotentiallyTrustworthy");function rr(e,{referrerURLCallback:r,referrerOriginCallback:t}={}){if(e.referrer==="no-referrer"||e.referrerPolicy==="")return null;let n=e.referrerPolicy;if(e.referrer==="about:client")return"no-referrer";let o=e.referrer,s=ve(o),l=ve(o,!0);s.toString().length>4096&&(s=l),r&&(s=r(s)),t&&(l=t(l));let u=new URL(e.url);switch(n){case"no-referrer":return"no-referrer";case"origin":return l;case"unsafe-url":return s;case"strict-origin":return C(s)&&!C(u)?"no-referrer":l.toString();case"strict-origin-when-cross-origin":return s.origin===u.origin?s:C(s)&&!C(u)?"no-referrer":l;case"same-origin":return s.origin===u.origin?s:"no-referrer";case"origin-when-cross-origin":return s.origin===u.origin?s:l;case"no-referrer-when-downgrade":return C(s)&&!C(u)?"no-referrer":s;default:throw new TypeError(`Invalid referrerPolicy: ${n}`)}}i(rr,"determineRequestsReferrer");function tr(e){let r=(e.get("referrer-policy")||"").split(/[,\s]+/),t="";for(let n of r)n&&oe.has(n)&&(t=n);return t}i(tr,"parseReferrerPolicyFromHeader");var oe,Ee,Pe=y({"node_modules/node-fetch/src/utils/referrer.js"(){oe=new Set(["","no-referrer","no-referrer-when-downgrade","same-origin","origin","strict-origin","origin-when-cross-origin","strict-origin-when-cross-origin","unsafe-url"]),Ee="strict-origin-when-cross-origin"}});import{format as or}from"node:url";import{deprecate as nr}from"node:util";var d,$,Le,N,Ue,sr=y({"node_modules/node-fetch/src/request.js"(){te(),re(),q(),qe(),Pe(),d=Symbol("Request internals"),$=i(e=>typeof e=="object"&&typeof e[d]=="object","isRequest"),Le=nr(()=>{},".data is not a valid RequestInit property, use .body instead","https://github.com/node-fetch/node-fetch/issues/1000 (request)"),N=class $e extends A{static{i(this,"_Request")}constructor(r,t={}){let n;if($(r)?n=new URL(r.url):(n=new URL(r),r={}),n.username!==""||n.password!=="")throw new TypeError(`${n} is an url with embedded credentials.`);let o=t.method||r.method||"GET";if(/^(delete|get|head|options|post|put)$/i.test(o)&&(o=o.toUpperCase()),!$(t)&&"data"in t&&Le(),(t.body!=null||$(r)&&r.body!==null)&&(o==="GET"||o==="HEAD"))throw new TypeError("Request with GET/HEAD method cannot have body");let s=t.body?t.body:$(r)&&r.body!==null?j(r):null;super(s,{size:t.size||r.size||0});let l=new L(t.headers||r.headers||{});if(s!==null&&!l.has("Content-Type")){let a=ee(s,this);a&&l.set("Content-Type",a)}let u=$(r)?r.signal:null;if("signal"in t&&(u=t.signal),u!=null&&!ue(u))throw new TypeError("Expected signal to be an instanceof AbortSignal or EventTarget");let f=t.referrer==null?r.referrer:t.referrer;if(f==="")f="no-referrer";else if(f){let a=new URL(f);f=/^about:(\/\/)?client$/.test(a)?"client":a}else f=void 0;this[d]={method:o,redirect:t.redirect||r.redirect||"follow",headers:l,parsedURL:n,signal:u,referrer:f},this.follow=t.follow===void 0?r.follow===void 0?20:r.follow:t.follow,this.compress=t.compress===void 0?r.compress===void 0?!0:r.compress:t.compress,this.counter=t.counter||r.counter||0,this.agent=t.agent||r.agent,this.highWaterMark=t.highWaterMark||r.highWaterMark||16384,this.insecureHTTPParser=t.insecureHTTPParser||r.insecureHTTPParser||!1,this.referrerPolicy=t.referrerPolicy||r.referrerPolicy||""}get method(){return this[d].method}get url(){return or(this[d].parsedURL)}get headers(){return this[d].headers}get redirect(){return this[d].redirect}get signal(){return this[d].signal}get referrer(){if(this[d].referrer==="no-referrer")return"";if(this[d].referrer==="client")return"about:client";if(this[d].referrer)return this[d].referrer.toString()}get referrerPolicy(){return this[d].referrerPolicy}set referrerPolicy(r){this[d].referrerPolicy=Xe(r)}clone(){return new $e(this)}get[Symbol.toStringTag](){return"Request"}},Object.defineProperties(N.prototype,{method:{enumerable:!0},url:{enumerable:!0},headers:{enumerable:!0},redirect:{enumerable:!0},clone:{enumerable:!0},signal:{enumerable:!0},referrer:{enumerable:!0},referrerPolicy:{enumerable:!0}}),Ue=i(e=>{let{parsedURL:r}=e[d],t=new L(e[d].headers);t.has("Accept")||t.set("Accept","*/*");let n=null;if(e.body===null&&/^(post|put)$/i.test(e.method)&&(n="0"),e.body!==null){let u=ge(e);typeof u=="number"&&!Number.isNaN(u)&&(n=String(u))}n&&t.set("Content-Length",n),e.referrerPolicy===""&&(e.referrerPolicy=Ee),e.referrer&&e.referrer!=="no-referrer"?e[d].referrer=rr(e):e[d].referrer="no-referrer",e[d].referrer instanceof URL&&t.set("Referer",e.referrer),t.has("User-Agent")||t.set("User-Agent","node-fetch"),e.compress&&!t.has("Accept-Encoding")&&t.set("Accept-Encoding","gzip, deflate, br");let{agent:o}=e;typeof o=="function"&&(o=o(r));let s=Re(r),l={path:r.pathname+s,method:e.method,headers:t[Symbol.for("nodejs.util.inspect.custom")](),insecureHTTPParser:e.insecureHTTPParser,agent:o};return{parsedURL:r,options:l}},"getNodeRequestOptions")}}),ne,ar=y({"node_modules/node-fetch/src/errors/abort-error.js"(){Y(),ne=class extends H{static{i(this,"AbortError")}constructor(e,r="aborted"){super(e,r)}}}});import ir from"node:http";import lr from"node:https";import k from"node:zlib";import Be,{PassThrough as _e,pipeline as F}from"node:stream";import{Buffer as J}from"node:buffer";async function xe(e,r){return new Promise((t,n)=>{let o=new N(e,r),{parsedURL:s,options:l}=Ue(o);if(!Ae.has(s.protocol))throw new TypeError(`node-fetch cannot load ${e}. URL scheme "${s.protocol.replace(/:$/,"")}" is not supported.`);if(s.protocol==="data:"){let c=le(o.url),E=new v(c,{headers:{"Content-Type":c.typeFull}});t(E);return}let u=(s.protocol==="https:"?lr:ir).request,{signal:f}=o,a=null,T=i(()=>{let c=new ne("The operation was aborted.");n(c),o.body&&o.body instanceof Be.Readable&&o.body.destroy(c),!(!a||!a.body)&&a.body.emit("error",c)},"abort");if(f&&f.aborted){T();return}let M=i(()=>{T(),_()},"abortAndFinalize"),B=u(s.toString(),l);f&&f.addEventListener("abort",M);let _=i(()=>{B.abort(),f&&f.removeEventListener("abort",M)},"finalize");B.on("error",c=>{n(new w(`request to ${o.url} failed, reason: ${c.message}`,"system",c)),_()}),cr(B,c=>{a&&a.body&&a.body.destroy(c)}),process.version<"v14"&&B.on("socket",c=>{let E;c.prependListener("end",()=>{E=c._eventsCount}),c.prependListener("close",h=>{if(a&&E<c._eventsCount&&!h){let P=new Error("Premature close");P.code="ERR_STREAM_PREMATURE_CLOSE",a.body.emit("error",P)}})}),B.on("response",c=>{B.setTimeout(0);let E=Ye(c.rawHeaders);if(K(c.statusCode)){let p=E.get("Location"),R=null;try{R=p===null?null:new URL(p,o.url)}catch{if(o.redirect!=="manual"){n(new w(`uri requested responds with an invalid redirect URL: ${p}`,"invalid-redirect")),_();return}}switch(o.redirect){case"error":n(new w(`uri requested responds with a redirect, redirect mode is set to error: ${o.url}`,"no-redirect")),_();return;case"manual":break;case"follow":{if(R===null)break;if(o.counter>=o.follow){n(new w(`maximum redirect reached at: ${o.url}`,"max-redirect")),_();return}let g={headers:new L(o.headers),follow:o.follow,counter:o.counter+1,agent:o.agent,compress:o.compress,method:o.method,body:j(o),signal:o.signal,size:o.size,referrer:o.referrer,referrerPolicy:o.referrerPolicy};if(!fe(o.url,R)||!de(o.url,R))for(let Fe of["authorization","www-authenticate","cookie","cookie2"])g.headers.delete(Fe);if(c.statusCode!==303&&o.body&&r.body instanceof Be.Readable){n(new w("Cannot follow redirect with body being a readable stream","unsupported-redirect")),_();return}(c.statusCode===303||(c.statusCode===301||c.statusCode===302)&&o.method==="POST")&&(g.method="GET",g.body=void 0,g.headers.delete("content-length"));let se=tr(E);se&&(g.referrerPolicy=se),t(xe(new N(R,g))),_();return}default:return n(new TypeError(`Redirect option '${o.redirect}' is not a valid value of RequestRedirect`))}}f&&c.once("end",()=>{f.removeEventListener("abort",M)});let h=F(c,new _e,p=>{p&&n(p)});process.version<"v12.10"&&c.on("aborted",M);let P={url:o.url,status:c.statusCode,statusText:c.statusMessage,headers:E,size:o.size,counter:o.counter,highWaterMark:o.highWaterMark},x=E.get("Content-Encoding");if(!o.compress||o.method==="HEAD"||x===null||c.statusCode===204||c.statusCode===304){a=new v(h,P),t(a);return}let ke={flush:k.Z_SYNC_FLUSH,finishFlush:k.Z_SYNC_FLUSH};if(x==="gzip"||x==="x-gzip"){h=F(h,k.createGunzip(ke),p=>{p&&n(p)}),a=new v(h,P),t(a);return}if(x==="deflate"||x==="x-deflate"){let p=F(c,new _e,R=>{R&&n(R)});p.once("data",R=>{(R[0]&15)===8?h=F(h,k.createInflate(),g=>{g&&n(g)}):h=F(h,k.createInflateRaw(),g=>{g&&n(g)}),a=new v(h,P),t(a)}),p.once("end",()=>{a||(a=new v(h,P),t(a))});return}if(x==="br"){h=F(h,k.createBrotliDecompress(),p=>{p&&n(p)}),a=new v(h,P),t(a);return}a=new v(h,P),t(a)}),we(B,o).catch(n)})}i(xe,"fetch");function cr(e,r){let t=J.from(`0\r
|
|
2
|
-
\r
|
|
3
|
-
`),n=!1,o=!1,s;e.on("response",l=>{let{headers:u}=l;n=u["transfer-encoding"]==="chunked"&&!u["content-length"]}),e.on("socket",l=>{let u=i(()=>{if(n&&!o){let a=new Error("Premature close");a.code="ERR_STREAM_PREMATURE_CLOSE",r(a)}},"onSocketClose"),f=i(a=>{o=J.compare(a.slice(-5),t)===0,!o&&s&&(o=J.compare(s.slice(-3),t.slice(0,3))===0&&J.compare(a.slice(-2),t.slice(3))===0),s=a},"onData");l.prependListener("close",u),l.on("data",f),e.on("close",()=>{l.removeListener("close",u),l.removeListener("data",f)})})}i(cr,"fixResponseChunkedTransferBadEnding");var Ae,ur=y({"node_modules/node-fetch/src/index.js"(){Ke(),re(),Ze(),te(),sr(),ce(),ar(),Te(),ie(),q(),Pe(),Ve(),Ae=new Set(["data:","http:","https:"])}});ur();export{ne as AbortError,ae as Blob,w as FetchError,Me as File,W as FormData,L as Headers,N as Request,v as Response,ze as blobFrom,Ie as blobFromSync,xe as default,Ne as fileFrom,De as fileFromSync,K as isRedirect};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var i=Object.defineProperty;var t=(e,r)=>i(e,"name",{value:r,configurable:!0});import{createRequire as m}from"node:module";const y=m(import.meta.url);import{classifySystemOne as p}from"./chunk-YTERFI73.js";import{isRecord as s}from"./chunk-HMFU7ZIF.js";import"./chunk-TEPMHNKQ.js";import"./chunk-PMRZO46Y.js";import"./chunk-UTB4DTYQ.js";import"./chunk-GYI2XXNW.js";import"./chunk-LPXNMA2W.js";import"./chunk-4L3WN2XY.js";var a={api:"typesafe-system-one",label:"System One API",url:t(e=>new URL("systemone",`${e.baseUrl.replace(/\/+$/u,"")}/`),"url"),payload:t((e,r)=>({model:e.id,...r}),"payload"),output:t(e=>{if(!s(e))throw new Error("System One API returned an unexpected response");return e},"output")},n=t((e,r,o)=>p(a,e,r,o),"classify");export{n as classify};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{createRequire as l}from"node:module";const x=l(import.meta.url);import{dist_exports as i}from"./chunk-R4YWRKK4.js";import{all_exports as o,compat_exports as r,compile_exports as e,dist_exports as p,value_exports as t}from"./chunk-4HEMJ3PG.js";import{build_exports as a}from"./chunk-Q6IMZXWD.js";import"./chunk-WXULTH2D.js";import"./chunk-5M7W2EDY.js";import"./chunk-ABVPQ2YN.js";import"./chunk-ZKDITC7J.js";import{dist_exports as m}from"./chunk-HC56T2OZ.js";import"./chunk-USJZMAIR.js";import"./chunk-S3GGRYIO.js";import"./chunk-YKF7PQCJ.js";import"./chunk-ZBURYEWF.js";import"./chunk-DRQDKNXA.js";import"./chunk-TRDNDS6A.js";import"./chunk-GYI2XXNW.js";import"./chunk-LPXNMA2W.js";import"./chunk-4L3WN2XY.js";var s={},n={typebox:a,"typebox/compile":e,"typebox/value":t,"@sinclair/typebox":a,"@sinclair/typebox/compile":e,"@sinclair/typebox/value":t,"@earendil-works/pi-agent-core":p,"@earendil-works/pi-tui":m,"@earendil-works/pi-ai":r,"@earendil-works/pi-ai/compat":r,"@earendil-works/pi-ai/oauth":s,"@earendil-works/pi-ai/providers/all":o,"@earendil-works/pi-coding-agent":i,"@mariozechner/pi-agent-core":p,"@mariozechner/pi-tui":m,"@mariozechner/pi-ai":r,"@mariozechner/pi-ai/compat":r,"@mariozechner/pi-ai/oauth":s,"@mariozechner/pi-ai/providers/all":o,"@mariozechner/pi-coding-agent":i};export{n as VIRTUAL_MODULES};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var m=Object.defineProperty;var o=(e,r)=>m(e,"name",{value:r,configurable:!0});import{createRequire as S}from"node:module";const F=S(import.meta.url);var c="Login cancelled",E="Device flow timed out",I="Device flow timed out after one or more slow_down responses. This is often caused by clock drift in WSL or VM environments. Please sync or restart the VM clock and try again.";function f(e,r,t){return new Promise((n,i)=>{if(r.aborted){i(new Error(t));return}let a=o(()=>{clearTimeout(_),i(new Error(t))},"onAbort"),_=setTimeout(()=>{r.removeEventListener("abort",a),n()},e);r.addEventListener("abort",a,{once:!0})})}o(f,"abortableSleep");async function y(e){let r=typeof e.expiresInSeconds=="number"?Date.now()+e.expiresInSeconds*1e3:Number.POSITIVE_INFINITY,t=Math.max(1e3,Math.floor((e.intervalSeconds??5)*1e3)),n=0;if(e.waitBeforeFirstPoll){let i=r-Date.now();i>0&&await f(Math.min(t,i),e.signal,c)}for(;Date.now()<r;){if(e.signal.aborted)throw new Error(c);let i=await e.poll();if(i.status==="complete")return i.value;if(i.status==="failed")throw new Error(i.message);i.status==="slow_down"&&(n+=1,t=typeof i.intervalSeconds=="number"&&Number.isFinite(i.intervalSeconds)&&i.intervalSeconds>0?Math.max(1e3,Math.floor(i.intervalSeconds*1e3)):Math.max(1e3,t+5e3));let a=r-Date.now();if(a<=0)break;await f(Math.min(t,a),e.signal,c)}throw new Error(n>0?I:E)}o(y,"pollOAuthDeviceCodeFlow");var l="b1a00492-073a-47ea-816f-4c329264a828",x="openid profile email offline_access grok-cli:access api:access",A="https://auth.x.ai/oauth2/device/code",p="https://auth.x.ai/oauth2/token",g=300*1e3,b=3600;function s(e,r){let t=e[r];if(typeof t!="string"||t.length===0)throw new Error(`Invalid xAI OAuth response field: ${r}`);return t}o(s,"requiredString");function v(e,r){let t=e[r];if(typeof t!="number"||!Number.isFinite(t)||t<=0)throw new Error(`Invalid xAI OAuth response field: ${r}`);return t}o(v,"positiveNumber");function w(e){let r;try{r=new URL(e)}catch{throw new Error("Untrusted verification URI in xAI OAuth response")}if(r.protocol!=="https:")throw new Error("Untrusted verification URI in xAI OAuth response");return r.href}o(w,"validateVerificationUri");async function u(e,r,t){let n;try{n=await fetch(e,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams(r),signal:t})}catch(a){throw t.aborted?new Error("Login cancelled"):a}let i;try{let a=await n.json();i=a&&typeof a=="object"&&!Array.isArray(a)?a:{}}catch{throw t.aborted?new Error("Login cancelled"):new Error(`xAI OAuth returned invalid JSON (HTTP ${n.status})`)}return{ok:n.ok,status:n.status,body:i}}o(u,"postForm");function d(e,r){let t=typeof r.body.error=="string"?r.body.error:void 0,n=typeof r.body.error_description=="string"?r.body.error_description:void 0,i=[t,n].filter(Boolean).join(": ");return new Error(`xAI OAuth ${e} failed (HTTP ${r.status})${i?`: ${i}`:""}`)}o(d,"requestFailure");function k(e){let r=e.interval,t=typeof r=="number"&&Number.isFinite(r)&&r>0?r:void 0,n=typeof e.verification_uri_complete=="string"&&e.verification_uri_complete.length>0?w(e.verification_uri_complete):void 0;return{deviceCode:s(e,"device_code"),userCode:s(e,"user_code"),verificationUri:w(s(e,"verification_uri")),verificationUriComplete:n,intervalSeconds:t,expiresInSeconds:v(e,"expires_in")}}o(k,"parseDeviceCode");function h(e,r){let t=s(e,"access_token"),n=e.refresh_token===void 0&&r?r:s(e,"refresh_token"),i=e.expires_in===void 0?b:v(e,"expires_in");return{type:"oauth",access:t,refresh:n,expires:Date.now()+i*1e3-g}}o(h,"credentialsFromTokenResponse");async function T(e){let r=await u(A,{client_id:l,scope:x,referrer:"pi"},e);if(!r.ok)throw d("device authorization",r);return k(r.body)}o(T,"requestDeviceCode");async function O(e,r){return y({intervalSeconds:e.intervalSeconds,expiresInSeconds:e.expiresInSeconds,waitBeforeFirstPoll:!0,signal:r,poll:o(async()=>{let t=await u(p,{grant_type:"urn:ietf:params:oauth:grant-type:device_code",client_id:l,device_code:e.deviceCode},r);if(t.ok)return{status:"complete",value:h(t.body)};let n=t.body.error;if(n==="authorization_pending")return{status:"pending"};if(n==="slow_down"){let i=t.body.interval;return{status:"slow_down",intervalSeconds:typeof i=="number"?i:void 0}}return n==="access_denied"||n==="authorization_denied"?{status:"failed",message:"xAI device authorization was denied"}:n==="expired_token"?{status:"failed",message:"xAI device code expired"}:{status:"failed",message:d("device token polling",t).message}},"poll")})}o(O,"pollForTokens");async function C(e){let r=await T(e.signal);return e.notify({type:"device_code",userCode:r.userCode,verificationUri:r.verificationUriComplete??r.verificationUri,intervalSeconds:r.intervalSeconds,expiresInSeconds:r.expiresInSeconds}),O(r,e.signal)}o(C,"loginXai");async function M(e,r){let t=await u(p,{grant_type:"refresh_token",client_id:l,refresh_token:e},r);if(!t.ok)throw d("token refresh",t);return h(t.body,e)}o(M,"refreshXaiToken");var D={name:"xAI (Grok/X subscription)",isSubscription:!0,loginLabel:"Sign in with SuperGrok or X Premium",login:C,refresh:o((e,r)=>M(e.refresh,r),"refresh"),async toAuth(e){return{apiKey:e.access}}};export{D as xaiOAuth};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
var o=Object.defineProperty;var r=(i,t)=>o(i,"name",{value:t,configurable:!0});import{createRequire as p}from"node:module";const a=p(import.meta.url);import{configureHttpDispatcher as e,main as m}from"./chunks/chunk-4HEMJ3PG.js";import"./chunks/chunk-Q6IMZXWD.js";import"./chunks/chunk-WXULTH2D.js";import"./chunks/chunk-5M7W2EDY.js";import"./chunks/chunk-ABVPQ2YN.js";import"./chunks/chunk-ZKDITC7J.js";import{APP_NAME as s}from"./chunks/chunk-HC56T2OZ.js";import"./chunks/chunk-USJZMAIR.js";import"./chunks/chunk-S3GGRYIO.js";import"./chunks/chunk-YKF7PQCJ.js";import"./chunks/chunk-ZBURYEWF.js";import"./chunks/chunk-DRQDKNXA.js";import"./chunks/chunk-TRDNDS6A.js";import"./chunks/chunk-GYI2XXNW.js";import"./chunks/chunk-LPXNMA2W.js";import"./chunks/chunk-4L3WN2XY.js";function n(){process.title=s,process.env.PI_CODING_AGENT="true",process.env.AI_AGENT="pi",process.emitWarning=(()=>{}),e()}r(n,"setupCli"),n(),m(process.argv.slice(2));
|
package/dist/bundle/cli.js
DELETED
package/dist/bundle/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{createRequire as e}from"node:module";const nr=e(import.meta.url);import{DAL_HOOK_ENTRY_TYPE as o,DAL_HOOK_NOTIFICATION_CHANNEL as t,ShowImagesSelectorComponent as r,ThemeSelectorComponent as n,buildDalHookInput as i,dalHookActivity as a,dalHooksExtension as s,decideDalHooks as l,engineToolInput as m,formatDalHookActivity as c,hookToolInput as S,hookToolName as p,isDalHookActivity as T,reportDalHookProblems as d,runDalCommandHook as u,runDalHookEvent as E,runDalHooks as g,runNotificationHooks as C,runPostToolUseHooks as D,runPreToolUseHooks as R,runSessionStartHooks as h,runStopHooks as _,runUserPromptSubmitHooks as A,selectDalHooks as H,toolMatchNames as P}from"./chunks/chunk-R4YWRKK4.js";import{AgentSession as k,AgentSessionRuntime as L,AssistantMessageComponent as f,BackgroundProcessManager as O,BashExecutionComponent as M,BorderedLoader as I,BranchSummaryMessageComponent as N,CURRENT_SESSION_VERSION as y,CompactionSummaryMessageComponent as x,CredentialSynchronizationError as F,CustomEditor as v,CustomMessageComponent as U,DEFAULT_COMPACTION_SETTINGS as B,DefaultPackageManager as b,DefaultResourceLoader as w,DynamicBorder as G,ExtensionEditorComponent as K,ExtensionInputComponent as V,ExtensionRunner as j,ExtensionSelectorComponent as W,FooterComponent as X,HOST_CAPABILITIES_ENV as q,HOST_TOKEN_ENV as z,HOST_TOKEN_HEADER as Y,HOST_URL_ENV as J,HostCallError as Q,HostCapabilities as Z,InteractiveMode as $,LoginDialogComponent as ee,MAX_BACKGROUND_PROCESSES as oe,ModelRegistry as te,ModelRuntime as re,ModelSelectorComponent as ne,OAuthSelectorComponent as ie,RpcClient as ae,SANDBOX_ENV as se,SessionManager as le,SessionSelectorComponent as me,SettingsManager as ce,SettingsSelectorComponent as Se,ShellSandbox as pe,SkillInvocationMessageComponent as Te,ThinkingSelectorComponent as de,ToolExecutionComponent as ue,TreeSelectorComponent as Ee,UserMessageComponent as ge,UserMessageSelectorComponent as Ce,VIRTUAL_MODEL_STATE_ENTRY as De,buildContextEntries as Re,buildProjectMap as he,buildRuleSet as _e,buildSessionContext as Ae,buildSessionProjection as He,calculateContextTokens as Pe,collectEntriesForBranchSummary as ke,compact as Le,convertToLlm as fe,convertToPng as Oe,copyToClipboard as Me,createAgentSession as Ie,createAgentSessionFromServices as Ne,createAgentSessionRuntime as ye,createAgentSessionServices as xe,createBashTool as Fe,createBashToolDefinition as ve,createCodemodeExtension as Ue,createCodingTools as Be,createEditTool as be,createEditToolDefinition as we,createEventBus as Ge,createExtensionRuntime as Ke,createFindTool as Ve,createFindToolDefinition as je,createGrepTool as We,createGrepToolDefinition as Xe,createLocalBashOperations as qe,createLocalPowerShellOperations as ze,createLsTool as Ye,createLsToolDefinition as Je,createMcpExtension as Qe,createPowerShellTool as Ze,createPowerShellToolDefinition as $e,createProcessToolDefinition as eo,createReadOnlyTools as oo,createReadTool as to,createReadToolDefinition as ro,createSyntheticSourceInfo as no,createToolSearchExtension as io,createWriteTool as ao,createWriteToolDefinition as so,defineTool as lo,detectSandboxAvailability as mo,detectSupportedImageMimeTypeFromFile as co,discoverAndLoadExtensions as So,estimateTokens as po,evaluateToolPolicy as To,findCutPoint as uo,findTurnStartIndex as Eo,formatDimensionNote as go,formatProjectMapPrompt as Co,formatSkillsForPrompt as Do,generateBranchSummary as Ro,generateDiffString as ho,generateSummary as _o,generateSummaryWithUsage as Ao,generateUnifiedPatch as Ho,getHostCapabilities as Po,getLastAssistantUsage as ko,getLatestCompactionEntry as Lo,isBashToolResult as fo,isEditToolResult as Oo,isFindToolResult as Mo,isGrepToolResult as Io,isLsToolResult as No,isPowerShellToolResult as yo,isReadToolResult as xo,isToolCallEventType as Fo,isWriteToolResult as vo,loadProjectContextFiles as Uo,loadSkills as Bo,loadSkillsFromDir as bo,main as wo,matchPermissionRules as Go,migrateSessionEntries as Ko,parseArgs as Vo,parseFrontmatter as jo,parseHostCapabilities as Wo,parsePermissionRule as Xo,parseSessionEntries as qo,parseSkillBlock as zo,prepareBranchEntries as Yo,readAccessDenial as Jo,registerPermissionAskHandler as Qo,registerSandboxEscalationHandler as Zo,registerShellExecutionGuard as $o,renderDiff as et,resizeImage as ot,resolveCliModel as tt,resolveModelScopeWithDiagnostics as rt,resolveSandboxPolicy as nt,runPrintMode as it,runRpcMode as at,serializeConversation as st,sessionEntryToContextMessages as lt,shouldCompact as mt,stripFrontmatter as ct,withFileMutationQueue as St,wrapRegisteredTool as pt,wrapRegisteredTools as Tt}from"./chunks/chunk-4HEMJ3PG.js";import"./chunks/chunk-Q6IMZXWD.js";import{ArminComponent as dt}from"./chunks/chunk-WXULTH2D.js";import{DALCODE_PROJECT_DIR_NAME as ut,DEFAULT_HOOK_TIMEOUT_SECONDS as Et,ProjectTrustStore as gt,TRUST_REQUIRING_PROJECT_HOOK_FILES as Ct,dalHookSourceFiles as Dt,deriveHookName as Rt,hasTrustRequiringProjectResources as ht,loadDalHooks as _t,projectFileDeclaresHooks as At}from"./chunks/chunk-5M7W2EDY.js";import{readStoredCredential as Ht}from"./chunks/chunk-ABVPQ2YN.js";import{DEFAULT_MAX_BYTES as Pt,DEFAULT_MAX_LINES as kt,DEFAULT_SHELL_ENV_EXCLUDES as Lt,applyShellEnvironmentPolicy as ft,formatSize as Ot,getPowerShellConfig as Mt,getShellConfig as It,getShellEnv as Nt,isDalCodeCredentialName as yt,truncateHead as xt,truncateLine as Ft,truncateTail as vt,truncateToVisualLines as Ut,withoutDalCodeCredentials as Bt}from"./chunks/chunk-ZKDITC7J.js";import{CONFIG_DIR_NAME as bt,SHARED_SKILL_CONFIG_DIRS as wt,Theme as Gt,VERSION as Kt,getAgentDir as Vt,getDocsPath as jt,getExamplesPath as Wt,getLanguageFromPath as Xt,getMarkdownTheme as qt,getPackageDir as zt,getReadmePath as Yt,getSelectListTheme as Jt,getSettingsListTheme as Qt,highlightCode as Zt,initTheme as $t,keyHint as er,keyText as or,rawKeyHint as tr}from"./chunks/chunk-HC56T2OZ.js";import"./chunks/chunk-USJZMAIR.js";import"./chunks/chunk-S3GGRYIO.js";import"./chunks/chunk-YKF7PQCJ.js";import"./chunks/chunk-ZBURYEWF.js";import"./chunks/chunk-DRQDKNXA.js";import"./chunks/chunk-TRDNDS6A.js";import"./chunks/chunk-GYI2XXNW.js";import"./chunks/chunk-LPXNMA2W.js";import"./chunks/chunk-4L3WN2XY.js";export{k as AgentSession,L as AgentSessionRuntime,dt as ArminComponent,f as AssistantMessageComponent,O as BackgroundProcessManager,M as BashExecutionComponent,I as BorderedLoader,N as BranchSummaryMessageComponent,bt as CONFIG_DIR_NAME,y as CURRENT_SESSION_VERSION,x as CompactionSummaryMessageComponent,F as CredentialSynchronizationError,v as CustomEditor,U as CustomMessageComponent,ut as DALCODE_PROJECT_DIR_NAME,o as DAL_HOOK_ENTRY_TYPE,t as DAL_HOOK_NOTIFICATION_CHANNEL,B as DEFAULT_COMPACTION_SETTINGS,Et as DEFAULT_HOOK_TIMEOUT_SECONDS,Pt as DEFAULT_MAX_BYTES,kt as DEFAULT_MAX_LINES,Lt as DEFAULT_SHELL_ENV_EXCLUDES,b as DefaultPackageManager,w as DefaultResourceLoader,G as DynamicBorder,K as ExtensionEditorComponent,V as ExtensionInputComponent,j as ExtensionRunner,W as ExtensionSelectorComponent,X as FooterComponent,q as HOST_CAPABILITIES_ENV,z as HOST_TOKEN_ENV,Y as HOST_TOKEN_HEADER,J as HOST_URL_ENV,Q as HostCallError,Z as HostCapabilities,$ as InteractiveMode,ee as LoginDialogComponent,oe as MAX_BACKGROUND_PROCESSES,te as ModelRegistry,re as ModelRuntime,ne as ModelSelectorComponent,ie as OAuthSelectorComponent,gt as ProjectTrustStore,ae as RpcClient,se as SANDBOX_ENV,wt as SHARED_SKILL_CONFIG_DIRS,le as SessionManager,me as SessionSelectorComponent,ce as SettingsManager,Se as SettingsSelectorComponent,pe as ShellSandbox,r as ShowImagesSelectorComponent,Te as SkillInvocationMessageComponent,Ct as TRUST_REQUIRING_PROJECT_HOOK_FILES,Gt as Theme,n as ThemeSelectorComponent,de as ThinkingSelectorComponent,ue as ToolExecutionComponent,Ee as TreeSelectorComponent,ge as UserMessageComponent,Ce as UserMessageSelectorComponent,Kt as VERSION,De as VIRTUAL_MODEL_STATE_ENTRY,ft as applyShellEnvironmentPolicy,Re as buildContextEntries,i as buildDalHookInput,he as buildProjectMap,_e as buildRuleSet,Ae as buildSessionContext,He as buildSessionProjection,Pe as calculateContextTokens,ke as collectEntriesForBranchSummary,Le as compact,fe as convertToLlm,Oe as convertToPng,Me as copyToClipboard,Ie as createAgentSession,Ne as createAgentSessionFromServices,ye as createAgentSessionRuntime,xe as createAgentSessionServices,Fe as createBashTool,ve as createBashToolDefinition,Ue as createCodemodeExtension,Be as createCodingTools,be as createEditTool,we as createEditToolDefinition,Ge as createEventBus,Ke as createExtensionRuntime,Ve as createFindTool,je as createFindToolDefinition,We as createGrepTool,Xe as createGrepToolDefinition,qe as createLocalBashOperations,ze as createLocalPowerShellOperations,Ye as createLsTool,Je as createLsToolDefinition,Qe as createMcpExtension,Ze as createPowerShellTool,$e as createPowerShellToolDefinition,eo as createProcessToolDefinition,oo as createReadOnlyTools,to as createReadTool,ro as createReadToolDefinition,no as createSyntheticSourceInfo,io as createToolSearchExtension,ao as createWriteTool,so as createWriteToolDefinition,a as dalHookActivity,Dt as dalHookSourceFiles,s as dalHooksExtension,l as decideDalHooks,lo as defineTool,Rt as deriveHookName,mo as detectSandboxAvailability,co as detectSupportedImageMimeTypeFromFile,So as discoverAndLoadExtensions,m as engineToolInput,po as estimateTokens,To as evaluateToolPolicy,uo as findCutPoint,Eo as findTurnStartIndex,c as formatDalHookActivity,go as formatDimensionNote,Co as formatProjectMapPrompt,Ot as formatSize,Do as formatSkillsForPrompt,Ro as generateBranchSummary,ho as generateDiffString,_o as generateSummary,Ao as generateSummaryWithUsage,Ho as generateUnifiedPatch,Vt as getAgentDir,jt as getDocsPath,Wt as getExamplesPath,Po as getHostCapabilities,Xt as getLanguageFromPath,ko as getLastAssistantUsage,Lo as getLatestCompactionEntry,qt as getMarkdownTheme,zt as getPackageDir,Mt as getPowerShellConfig,Yt as getReadmePath,Jt as getSelectListTheme,Qt as getSettingsListTheme,It as getShellConfig,Nt as getShellEnv,ht as hasTrustRequiringProjectResources,Zt as highlightCode,S as hookToolInput,p as hookToolName,$t as initTheme,fo as isBashToolResult,yt as isDalCodeCredentialName,T as isDalHookActivity,Oo as isEditToolResult,Mo as isFindToolResult,Io as isGrepToolResult,No as isLsToolResult,yo as isPowerShellToolResult,xo as isReadToolResult,Fo as isToolCallEventType,vo as isWriteToolResult,er as keyHint,or as keyText,_t as loadDalHooks,Uo as loadProjectContextFiles,Bo as loadSkills,bo as loadSkillsFromDir,wo as main,Go as matchPermissionRules,Ko as migrateSessionEntries,Vo as parseArgs,jo as parseFrontmatter,Wo as parseHostCapabilities,Xo as parsePermissionRule,qo as parseSessionEntries,zo as parseSkillBlock,Yo as prepareBranchEntries,At as projectFileDeclaresHooks,tr as rawKeyHint,Jo as readAccessDenial,Ht as readStoredCredential,Qo as registerPermissionAskHandler,Zo as registerSandboxEscalationHandler,$o as registerShellExecutionGuard,et as renderDiff,d as reportDalHookProblems,ot as resizeImage,tt as resolveCliModel,rt as resolveModelScopeWithDiagnostics,nt as resolveSandboxPolicy,u as runDalCommandHook,E as runDalHookEvent,g as runDalHooks,C as runNotificationHooks,D as runPostToolUseHooks,R as runPreToolUseHooks,it as runPrintMode,at as runRpcMode,h as runSessionStartHooks,_ as runStopHooks,A as runUserPromptSubmitHooks,H as selectDalHooks,st as serializeConversation,lt as sessionEntryToContextMessages,mt as shouldCompact,ct as stripFrontmatter,P as toolMatchNames,xt as truncateHead,Ft as truncateLine,vt as truncateTail,Ut as truncateToVisualLines,St as withFileMutationQueue,Bt as withoutDalCodeCredentials,pt as wrapRegisteredTool,Tt as wrapRegisteredTools};
|
package/dist/bundle/rpc-entry.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{createRequire as r}from"node:module";const e=r(import.meta.url);import{configureHttpDispatcher as i,main as o}from"./chunks/chunk-4HEMJ3PG.js";import"./chunks/chunk-Q6IMZXWD.js";import"./chunks/chunk-WXULTH2D.js";import"./chunks/chunk-5M7W2EDY.js";import"./chunks/chunk-ABVPQ2YN.js";import"./chunks/chunk-ZKDITC7J.js";import{APP_NAME as p}from"./chunks/chunk-HC56T2OZ.js";import"./chunks/chunk-USJZMAIR.js";import"./chunks/chunk-S3GGRYIO.js";import"./chunks/chunk-YKF7PQCJ.js";import"./chunks/chunk-ZBURYEWF.js";import"./chunks/chunk-DRQDKNXA.js";import"./chunks/chunk-TRDNDS6A.js";import"./chunks/chunk-GYI2XXNW.js";import"./chunks/chunk-LPXNMA2W.js";import"./chunks/chunk-4L3WN2XY.js";process.title=`${p}-rpc`,process.env.PI_CODING_AGENT="true",process.env.AI_AGENT="pi",process.emitWarning=(()=>{}),i(),o(["--mode","rpc",...process.argv.slice(2)]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var a=Object.defineProperty;var i=(t,o)=>a(t,"name",{value:o,configurable:!0});import{Key as p}from"@earendil-works/pi-tui";import{Type as e}from"typebox";const n=["ctrl","shift","alt","super"],s=`(?:[a-z0-9]|${Object.values(p).flatMap(t=>typeof t=="string"?[t.replace(/[\\^$.*+?()[\]{}|]/g,"\\$&")]:[]).join("|")})`,c=n.map(t=>`${t}\\+.*${t}\\+`).join("|"),r=e.Unsafe(e.String({pattern:`^(?!.*(?:${c}))(?:(?:${n.join("|")})\\+){0,4}${s}$`,description:"Key identifier with optional ctrl, shift, alt, or super modifiers."}));function f(t){return e.Union([r,e.Array(r)],t)}i(f,"keybindingValueSchema");const $=f();export{r as KeyIdSchema,$ as KeybindingValueSchema,f as keybindingValueSchema};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var f=Object.defineProperty;var i=(l,r)=>f(l,"name",{value:r,configurable:!0});import{TUI_KEYBINDINGS as a}from"@earendil-works/pi-tui";import{Type as o}from"typebox";import{Compile as m}from"typebox/compile";import{t as e}from"../dal/i18n.js";import{KeybindingValueSchema as c,keybindingValueSchema as u}from"./key-id-schema.js";import{useWindowsKeybindings as g}from"./keybindings.js";import{KeybindingValueSchema as D}from"./key-id-schema.js";const p=g();function t(l,r){return{defaultKeys:l,get description(){return r()}}}i(t,"binding");const h={"app.interrupt":t("escape",()=>e("\u53D6\u6D88\u6216\u4E2D\u6B62")),"app.clear":t("ctrl+c",()=>e("\u6E05\u7A7A\u8F93\u5165\u6846")),"app.exit":t("ctrl+d",()=>e("\u8F93\u5165\u6846\u4E3A\u7A7A\u65F6\u9000\u51FA")),"app.suspend":t(process.platform==="win32"?[]:"ctrl+z",()=>e("\u6302\u8D77\u5230\u540E\u53F0")),"app.thinking.cycle":t("shift+tab",()=>e("\u5FAA\u73AF\u5207\u6362\u601D\u8003\u6DF1\u5EA6")),"app.thinking.save":t("ctrl+s",()=>e("\u4FDD\u5B58\u601D\u8003\u6DF1\u5EA6")),"app.model.cycleForward":t("ctrl+p",()=>e("\u5207\u6362\u5230\u4E0B\u4E00\u4E2A\u6A21\u578B")),"app.model.cycleBackward":t(p?"alt+p":"shift+ctrl+p",()=>e("\u5207\u6362\u5230\u4E0A\u4E00\u4E2A\u6A21\u578B")),"app.model.select":t("ctrl+l",()=>e("\u6253\u5F00\u6A21\u578B\u9009\u62E9")),"app.tools.expand":t("ctrl+o",()=>e("\u5C55\u5F00\u6216\u6298\u53E0\u5DE5\u5177\u8F93\u51FA")),"app.tools.focusPrev":t("alt+up",()=>e("\u9009\u4E2D\u4E0A\u4E00\u4E2A\u5DE5\u5177\u8C03\u7528")),"app.tools.focusNext":t("alt+down",()=>e("\u9009\u4E2D\u4E0B\u4E00\u4E2A\u5DE5\u5177\u8C03\u7528")),"app.thinking.toggle":t("ctrl+t",()=>e("\u663E\u793A\u6216\u9690\u85CF\u601D\u8003\u8FC7\u7A0B")),"app.session.toggleNamedFilter":t("ctrl+n",()=>e("\u53EA\u770B\u5DF2\u547D\u540D\u7684\u4F1A\u8BDD / \u5168\u90E8\u4F1A\u8BDD")),"app.editor.external":t("ctrl+g",()=>e("\u6253\u5F00\u5916\u90E8\u7F16\u8F91\u5668")),"app.message.copy":t("ctrl+x",()=>e("\u590D\u5236\u9009\u4E2D\u5185\u5BB9\u6216\u6700\u540E\u4E00\u6761\u56DE\u590D")),"app.message.followUp":t(p?"ctrl+q":"alt+enter",()=>e("\u8FFD\u52A0\u4E00\u6761\u6392\u961F\u6D88\u606F")),"app.message.dequeue":t(p?"alt+q":"alt+up",()=>e("\u53D6\u56DE\u6392\u961F\u4E2D\u7684\u6D88\u606F")),"app.clipboard.pasteImage":t(p?"alt+v":"ctrl+v",()=>e("\u4ECE\u526A\u8D34\u677F\u7C98\u8D34\u56FE\u7247\uFF08\u6CA1\u6709\u56FE\u7247\u65F6\u7C98\u8D34\u6587\u5B57\uFF09")),"app.screenshot":t(process.platform==="darwin"?"ctrl+shift+s":[],()=>e("\u622A\u56FE\u5E76\u9644\u5230\u8F93\u5165\u6846")),"app.session.new":t([],()=>e("\u5F00\u59CB\u65B0\u4F1A\u8BDD")),"app.session.tree":t([],()=>e("\u6253\u5F00\u4F1A\u8BDD\u6811")),"app.session.fork":t([],()=>e("\u5206\u53C9\u5F53\u524D\u4F1A\u8BDD")),"app.session.resume":t([],()=>e("\u6062\u590D\u4F1A\u8BDD")),"app.tree.foldOrUp":t(process.platform==="darwin"?["alt+left","ctrl+left"]:["ctrl+left","alt+left"],()=>e("\u6298\u53E0\u5206\u652F\u6216\u4E0A\u79FB")),"app.tree.unfoldOrDown":t(process.platform==="darwin"?["alt+right","ctrl+right"]:["ctrl+right","alt+right"],()=>e("\u5C55\u5F00\u5206\u652F\u6216\u4E0B\u79FB")),"app.tree.editLabel":t("shift+l",()=>e("\u7F16\u8F91\u6811\u8282\u70B9\u6807\u7B7E")),"app.tree.toggleLabelTimestamp":t("shift+t",()=>e("\u663E\u793A\u6216\u9690\u85CF\u6807\u7B7E\u65F6\u95F4")),"app.session.togglePath":t("ctrl+shift+p",()=>e("\u663E\u793A\u6216\u9690\u85CF\u4F1A\u8BDD\u8DEF\u5F84")),"app.session.toggleSort":t("ctrl+s",()=>e("\u5207\u6362\u4F1A\u8BDD\u6392\u5E8F\u65B9\u5F0F")),"app.session.rename":t("ctrl+r",()=>e("\u4E3A\u4F1A\u8BDD\u91CD\u547D\u540D")),"app.session.delete":t("ctrl+d",()=>e("\u5220\u9664\u4F1A\u8BDD")),"app.session.deleteNoninvasive":t("ctrl+backspace",()=>e("\u641C\u7D22\u6846\u4E3A\u7A7A\u65F6\u5220\u9664\u4F1A\u8BDD")),"app.models.save":t("ctrl+s",()=>e("\u4FDD\u5B58\u6A21\u578B\u9009\u62E9")),"app.models.thinkingLower":t("left",()=>e("\u964D\u4F4E\u6240\u9009\u6A21\u578B\u7684\u601D\u8003\u6DF1\u5EA6")),"app.models.thinkingHigher":t("right",()=>e("\u63D0\u9AD8\u6240\u9009\u6A21\u578B\u7684\u601D\u8003\u6DF1\u5EA6")),"app.models.enableAll":t("ctrl+a",()=>e("\u542F\u7528\u5168\u90E8\u6A21\u578B")),"app.models.clearAll":t("ctrl+x",()=>e("\u6E05\u7A7A\u5DF2\u9009\u6A21\u578B")),"app.models.toggleProvider":t("ctrl+p",()=>e("\u542F\u7528\u6216\u505C\u7528\u8BE5\u63D0\u4F9B\u65B9\u7684\u5168\u90E8\u6A21\u578B")),"app.models.reorderUp":t("alt+up",()=>e("\u6A21\u578B\u987A\u5E8F\u4E0A\u79FB")),"app.models.reorderDown":t("alt+down",()=>e("\u6A21\u578B\u987A\u5E8F\u4E0B\u79FB")),"app.tree.filter.default":t("ctrl+d",()=>e("\u6811\u7B5B\u9009\uFF1A\u9ED8\u8BA4\u89C6\u56FE")),"app.tree.filter.noTools":t("ctrl+t",()=>e("\u6811\u7B5B\u9009\uFF1A\u9690\u85CF\u5DE5\u5177\u7ED3\u679C")),"app.tree.filter.userOnly":t("ctrl+u",()=>e("\u6811\u7B5B\u9009\uFF1A\u53EA\u770B\u7528\u6237\u6D88\u606F")),"app.tree.filter.labeledOnly":t("ctrl+l",()=>e("\u6811\u7B5B\u9009\uFF1A\u53EA\u770B\u5E26\u6807\u7B7E\u7684\u6761\u76EE")),"app.tree.filter.all":t("ctrl+a",()=>e("\u6811\u7B5B\u9009\uFF1A\u663E\u793A\u5168\u90E8\u6761\u76EE")),"app.tree.filter.cycleForward":t("ctrl+o",()=>e("\u6811\u7B5B\u9009\uFF1A\u5207\u6362\u5230\u4E0B\u4E00\u4E2A")),"app.tree.filter.cycleBackward":t("shift+ctrl+o",()=>e("\u6811\u7B5B\u9009\uFF1A\u5207\u6362\u5230\u4E0A\u4E00\u4E2A"))},w={...a,"tui.editor.undo":{...a["tui.editor.undo"],defaultKeys:process.platform==="win32"?"ctrl+z":p?"alt+z":"ctrl+-"},"tui.altScreen.previousPrompt":{...a["tui.altScreen.previousPrompt"],defaultKeys:p?"ctrl+up":["ctrl+shift+up","ctrl+up"]},"tui.altScreen.nextPrompt":{...a["tui.altScreen.nextPrompt"],defaultKeys:p?"ctrl+down":["ctrl+shift+down","ctrl+down"]},"tui.altScreen.search":{...a["tui.altScreen.search"],defaultKeys:p?"ctrl+f":"ctrl+shift+f"},...h},d={$schema:o.Optional(o.String())};for(const[l,r]of Object.entries(w))d[l]=o.Optional(u({description:r.description}));const N=o.Object(d,{additionalProperties:c}),y=m(c);function O(l){const r={};for(const[s,n]of Object.entries(l))s!=="$schema"&&y.Check(n)&&(r[s]=n);return r}i(O,"toKeybindingsConfig");export{w as KEYBINDINGS,D as KeybindingValueSchema,N as KeybindingsSchema,O as toKeybindingsConfig};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{DEFAULT_MAX_AGENT_RETRY_DELAY_MS as e}from"@earendil-works/pi-ai/utils/retry";const t={transport:"auto",steeringMode:"one-at-a-time",followUpMode:"one-at-a-time",compaction:{enabled:!0,reserveTokens:16384,keepRecentTokens:2e4,maxContextTokens:128e3},branchSummary:{reserveTokens:16384,skipPrompt:!1},retry:{enabled:!0,maxRetries:3,baseDelayMs:2e3,maxAgentDelayMs:e,provider:{maxRetryDelayMs:6e4}},hideThinkingBlock:!1,showCacheMissNotices:!1,quietStartup:!1,defaultProjectTrust:"ask",collapseChangelog:!1,enableInstallTelemetry:!0,enableAnalytics:!1,enableSkillCommands:!0,terminal:{showImages:!0,imageWidthCells:60,clearOnShrink:!1,showTerminalProgress:!1},images:{autoResize:!0,blockImages:!1},doubleEscapeAction:"tree",treeFilterMode:"default",editorPaddingX:0,outputPad:1,autocompleteMaxVisible:5,markdown:{codeBlockIndent:" ",mermaid:"streaming"},warnings:{anthropicExtraUsage:!0},codemode:{mode:"on",inlineBudget:3e3},cacheWarming:"streaming",maxOutputTokens:32e3,tuiMode:"fullscreen",fullscreenExitOutput:"transcript",fullscreenScrollbar:"auto",fullscreenCopyOnSelect:!0,fullscreenWheelScrollLines:"auto"};export{t as SETTINGS_DEFAULTS};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var c=Object.defineProperty;var n=(i,p)=>c(i,"name",{value:p,configurable:!0});import{ModelThinkingLevelSchema as a}from"@earendil-works/pi-ai/providers/model-schema";import{Type as e}from"typebox";import{SETTINGS_DEFAULTS as t}from"./settings-defaults.js";function o(i={}){return e.Integer({minimum:0,maximum:Number.MAX_SAFE_INTEGER,...i})}n(o,"nonNegativeSafeInteger");function r(i){return e.Union([e.Number({minimum:0}),e.Literal("disabled")],i)}n(r,"timeoutSetting");const m=e.Object({reserveTokens:e.Optional(o()),keepRecentTokens:e.Optional(o())}),u=e.Object({enabled:e.Optional(e.Boolean({default:t.compaction.enabled})),reserveTokens:e.Optional(o({default:t.compaction.reserveTokens})),keepRecentTokens:e.Optional(o({default:t.compaction.keepRecentTokens})),modelOverrides:e.Optional(e.Record(e.String(),m,{description:'Per-model overrides keyed by exact "provider/modelId" strings.'})),maxContextTokens:e.Optional(o({description:"Context token budget that triggers compaction preparation. 0 compacts only near the model's own window.",default:t.compaction.maxContextTokens}))}),g=e.Object({reserveTokens:e.Optional(e.Number({description:"Tokens reserved for the prompt and LLM response.",default:t.branchSummary.reserveTokens})),skipPrompt:e.Optional(e.Boolean({description:'When true, skips the "Summarize branch?" prompt and defaults to no summary.',default:t.branchSummary.skipPrompt}))}),h=e.Object({timeoutMs:e.Optional(e.Number({description:"SDK or provider request timeout in milliseconds."})),maxRetries:e.Optional(e.Number({description:"SDK or provider retry attempts."})),maxRetryDelayMs:e.Optional(e.Number({description:"Maximum server-requested delay before failing.",default:t.retry.provider.maxRetryDelayMs}))}),O=e.Object({enabled:e.Optional(e.Boolean({default:t.retry.enabled})),maxRetries:e.Optional(e.Number({default:t.retry.maxRetries})),baseDelayMs:e.Optional(e.Number({description:"Exponential backoff base delay in milliseconds: 2s, 4s, 8s.",default:t.retry.baseDelayMs})),maxAgentDelayMs:e.Optional(e.Number({default:t.retry.maxAgentDelayMs})),provider:e.Optional(h),maxDelayMs:e.Optional(e.Number({description:"Legacy retry delay setting. Use provider.maxRetryDelayMs instead.",deprecated:!0}))}),f=e.Object({showImages:e.Optional(e.Boolean({description:"Show images when the terminal supports them.",default:t.terminal.showImages})),imageWidthCells:e.Optional(e.Number({description:"Preferred inline image width in terminal cells.",default:t.terminal.imageWidthCells})),clearOnShrink:e.Optional(e.Boolean({description:"Clear empty rows when content shrinks.",default:t.terminal.clearOnShrink})),showTerminalProgress:e.Optional(e.Boolean({description:"Show OSC 9;4 terminal progress indicators.",default:t.terminal.showTerminalProgress})),hyperlinks:e.Optional(e.Union([e.Boolean(),e.Literal("auto")])),images:e.Optional(e.Union([e.Literal("kitty"),e.Literal("iterm2"),e.Literal("auto"),e.Literal(!1)])),trueColor:e.Optional(e.Union([e.Boolean(),e.Literal("auto")]))}),S=e.Object({autoResize:e.Optional(e.Boolean({description:"Resize images to 2000x2000 maximum for better model compatibility.",default:t.images.autoResize})),blockImages:e.Optional(e.Boolean({description:"When true, prevents all images from being sent to LLM providers.",default:t.images.blockImages}))});function l(i){return e.Object({minimal:e.Optional(e.Number()),low:e.Optional(e.Number()),medium:e.Optional(e.Number()),high:e.Optional(e.Number())},i)}n(l,"thinkingBudgetsSettings");const C=l(),b=e.Object({codeBlockIndent:e.Optional(e.String({default:t.markdown.codeBlockIndent})),mermaid:e.Optional(e.Union([e.Literal("off"),e.Literal("final"),e.Literal("streaming")],{default:t.markdown.mermaid}))}),y=e.Object({anthropicExtraUsage:e.Optional(e.Boolean({default:t.warnings.anthropicExtraUsage}))});function s(i){return e.Union([e.Literal("on"),e.Literal("only")],i)}n(s,"codemodeMode");const U=s(),k=e.Object({mode:e.Optional(s({description:'How codemode presents tools. "on" keeps direct tools declared and annotates tools callable from scripts; codemode lists only tools without direct exposure. "only" lists every script-callable tool in codemode and does not declare active direct tools.',default:t.codemode.mode})),inlineBudget:e.Optional(e.Number({minimum:0,description:"Estimated tokens available for inline codemode tool declarations.",default:t.codemode.inlineBudget}))}),L=e.Union([e.String({description:"Load all resources from the package."}),e.Object({source:e.String(),autoload:e.Optional(e.Boolean({description:"When false, start empty and only apply explicit resource patterns."})),extensions:e.Optional(e.Array(e.String())),skills:e.Optional(e.Array(e.String())),prompts:e.Optional(e.Array(e.String())),themes:e.Optional(e.Array(e.String())),resolvedCommit:e.Optional(e.String())})],{description:"Package source for npm or git packages. Use the string form to load all resources or the object form to filter resources."}),d=e.Array(e.String()),w=e.Union([d,e.Object({enableSkillCommands:e.Optional(e.Boolean()),customDirectories:e.Optional(d)},{deprecated:!0})],{description:"Local skill file paths or directories."}),A=e.Object({$schema:e.Optional(e.String({description:"JSON Schema reference."})),lastChangelogVersion:e.Optional(e.String()),defaultProvider:e.Optional(e.String()),defaultModel:e.Optional(e.String()),defaultThinkingLevel:e.Optional(a),modelThinkingLevels:e.Optional(e.Record(e.String(),a,{description:'Per-model default thinking level overrides keyed by "provider/modelId".'})),transport:e.Optional(e.Union([e.Literal("auto"),e.Literal("sse"),e.Literal("websocket"),e.Literal("websocket-cached")],{default:t.transport})),steeringMode:e.Optional(e.Union([e.Literal("all"),e.Literal("one-at-a-time")],{default:t.steeringMode})),followUpMode:e.Optional(e.Union([e.Literal("all"),e.Literal("one-at-a-time")],{default:t.followUpMode})),theme:e.Optional(e.String()),compaction:e.Optional(u),branchSummary:e.Optional(g),retry:e.Optional(O),hideThinkingBlock:e.Optional(e.Boolean({default:t.hideThinkingBlock})),showCacheMissNotices:e.Optional(e.Boolean({description:"Show cache cost and provider recovery notices.",default:t.showCacheMissNotices})),externalEditor:e.Optional(e.String({description:"Command for Ctrl+G external editor; takes precedence over VISUAL and EDITOR."})),shellPath:e.Optional(e.String({description:"Custom shell path, for example for Cygwin on Windows, with support for leading ~ expansion."})),quietStartup:e.Optional(e.Union([e.Boolean(),e.Literal("header")],{description:'When true, hide all startup output. When "header", keep only the startup header.',default:t.quietStartup})),defaultProjectTrust:e.Optional(e.Union([e.Literal("ask"),e.Literal("always"),e.Literal("never")],{description:"Global setting only.",default:t.defaultProjectTrust})),shellCommandPrefix:e.Optional(e.String({description:"Prefix prepended to every bash command, for example to enable shell aliases."})),npmCommand:e.Optional(e.Array(e.String(),{description:'Command used for npm package lookup and installation, in argv form such as ["mise", "exec", "node@20", "--", "npm"].'})),collapseChangelog:e.Optional(e.Boolean({description:"Show the condensed changelog after update; use /changelog for the full changelog.",default:t.collapseChangelog})),enableInstallTelemetry:e.Optional(e.Boolean({description:"Send an anonymous version and update ping after changelog-detected updates.",default:t.enableInstallTelemetry})),enableAnalytics:e.Optional(e.Boolean({description:"Opt in to analytics data sharing.",default:t.enableAnalytics})),trackingId:e.Optional(e.String({description:"Analytics tracking identifier, generated when analytics is enabled."})),packages:e.Optional(e.Array(L,{description:"npm or git package sources, as strings or objects with resource filtering."})),extensions:e.Optional(e.Array(e.String(),{description:"Local extension file paths or directories."})),deviceId:e.Optional(e.String({description:"Stable installation UUID, generated when authentication first needs it. Global only."})),skills:e.Optional(w),prompts:e.Optional(e.Array(e.String(),{description:"Local prompt template file paths or directories."})),themes:e.Optional(e.Array(e.String(),{description:"Local theme file paths or directories."})),enableSkillCommands:e.Optional(e.Boolean({description:"Register skills as /skill:name commands.",default:t.enableSkillCommands})),terminal:e.Optional(f),images:e.Optional(S),enabledModels:e.Optional(e.Array(e.String(),{description:"Model patterns for cycling, in the same format as the --models CLI flag."})),defaultTools:e.Optional(e.Array(e.String(),{description:"Initial tool selection. Plain names replace the inherited selection; +name and -name entries add or remove tools."})),doubleEscapeAction:e.Optional(e.Union([e.Literal("fork"),e.Literal("tree"),e.Literal("none")],{description:"Action for double-escape with an empty editor.",default:t.doubleEscapeAction})),treeFilterMode:e.Optional(e.Union([e.Literal("default"),e.Literal("no-tools"),e.Literal("user-only"),e.Literal("labeled-only"),e.Literal("all")],{description:"Default filter when opening /tree.",default:t.treeFilterMode})),thinkingBudgets:e.Optional(l({description:"Custom token budgets for thinking levels."})),editorPaddingX:e.Optional(e.Number({description:"Horizontal padding for the input editor.",default:t.editorPaddingX})),outputPad:e.Optional(e.Union([e.Literal(0),e.Literal(1)],{description:"Horizontal padding for transcript content.",default:t.outputPad})),autocompleteMaxVisible:e.Optional(e.Number({description:"Maximum visible items in the autocomplete dropdown.",default:t.autocompleteMaxVisible})),showHardwareCursor:e.Optional(e.Boolean({description:"Show the terminal cursor while still positioning it for IME."})),markdown:e.Optional(b),warnings:e.Optional(y),codemode:e.Optional(k),sessionDir:e.Optional(e.String({description:"Custom session storage directory, in the same format as the --session-dir CLI flag."})),httpProxy:e.Optional(e.String({description:"Proxy URL applied as HTTP_PROXY and HTTPS_PROXY for Pi-managed HTTP clients."})),httpIdleTimeoutMs:e.Optional(r({description:'HTTP header or body idle timeout in milliseconds; 0 or "disabled" disables it.'})),maxOutputTokens:e.Optional(o({description:"Output-token ceiling applied to every model request; 0 uses the model's own limit.",default:t.maxOutputTokens})),shellEnvironment:e.Optional(e.Object({exclude:e.Optional(e.Array(e.String(),{description:"Credential names never passed through."})),include:e.Optional(e.Array(e.String(),{description:"Extra names passed through."}))},{description:"Child-process environment policy (DAL). Validated where it is applied.",additionalProperties:!0})),permissions:e.Optional(e.Object({allow:e.Optional(e.Array(e.String(),{description:"Rules that skip asking."})),deny:e.Optional(e.Array(e.String(),{description:"Rules that refuse without asking."})),ask:e.Optional(e.Array(e.String(),{description:"Rules that always ask."}))},{description:"Tool permission rules (DAL). Matched by tool name and path patterns."})),sandbox:e.Optional(e.Object({},{description:"OS sandbox settings for agent shell commands (DAL). Validated by the sandbox policy.",additionalProperties:!0})),cacheWarming:e.Optional(e.Union([e.Literal("off"),e.Literal("streaming"),e.Literal("idle")],{description:'Cache-warming profile. "idle" also warms between agent runs. Global only because each refresh costs money.',default:t.cacheWarming})),websocketConnectTimeoutMs:e.Optional(r({description:'WebSocket connect or open handshake timeout in milliseconds; 0 or "disabled" disables it.'})),tuiMode:e.Optional(e.Union([e.Literal("regular"),e.Literal("fullscreen")],{default:t.tuiMode})),fullscreenExitOutput:e.Optional(e.Union([e.Literal("transcript"),e.Literal("resume-hint")],{description:"No effect in regular TUI mode.",default:t.fullscreenExitOutput})),fullscreenScrollbar:e.Optional(e.Union([e.Literal("auto"),e.Literal("always"),e.Literal("hidden")],{description:"No effect in regular TUI mode.",default:t.fullscreenScrollbar})),fullscreenCopyOnSelect:e.Optional(e.Boolean({description:"No effect in regular TUI mode.",default:t.fullscreenCopyOnSelect})),fullscreenWheelScrollLines:e.Optional(e.Union([e.Number(),e.Literal("auto")],{description:"Lines scrolled per wheel event in fullscreen mode; numeric values are clamped from 1 to 100.",default:t.fullscreenWheelScrollLines})),queueMode:e.Optional(e.Union([e.Literal("all"),e.Literal("one-at-a-time")],{description:"Legacy setting migrated to steeringMode.",deprecated:!0})),websockets:e.Optional(e.Boolean({description:"Legacy setting migrated to transport.",deprecated:!0}))},{additionalProperties:!0});export{A as SettingsSchema};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var m=Object.defineProperty;var i=(d,c)=>m(d,"name",{value:c,configurable:!0});import{theme as x}from"../theme/theme.js";const o="bbbab8b9b9b6b9b8b5bcbbb8b8b7b4b7b5b2b6b5b2b8b7b4b7b6b3b6b4b1bdbcb8bab8b6bbb8b5b8b5b1bbb8b4c2bebbc1bebac0bdbabfbcb9c1bebabfbebbc0bfbcc0bdbabbb8b5c1bfbcbfbcb8bbb9b6bfbcb8c2bfbcc1bfbcbfbbb8bdb9b6b8b7b5b9b8b5b8b8b5b5b5b2b6b5b2b8b7b4b9b8b5b9b8b5b6b5b3bab8b5bcbab7bbb9b6bbb8b5bfb9b5bdb2abbcb0a8beb2aabeb5afbfbab6bebab7c0bfbcbebdbabebbb8c0bdbabfbebbc2bebbbdbab7c3c0bdc3c0bdc1bebbc2bebabfbcb8bab9b6b7b6b3b2b1aeb6b5b2b5b4b1b5b4b2b6b5b2b7b6b4b9b8b6b7b6b3bbbab7b2afaba5988fb49e90b09481b79a88b39683b09583b7a395bfb6b0c0bdbabdbbb8bebcb9c1bfbcc0bebbbdbab7bebbb8c2bfbcc0bdbac0bcb9bdb9b6c0bcb8b5b4b2b4b3b0bab9b6b9b9b6b5b4b1b5b4b1b6b5b3b9b8b5b9b8b6b9b8b6b2aeaa968174a6836eaa856eab846eaf8973ac8973b08f79b18f7ab39786b7a89dbbb3aebfbab6c2c0bdbebcb9bfbdbac3c1bdc2bebbc0bcb9bdb9b6c1bdbabfbbb8b4b3b0b9b8b5b8b7b5b4b3b1b5b4b1b8b7b4b8b7b5bab9b6bbbab7b1afad8c7a719d735ca47860a87d65a98069ae8972ae8c75af8d77aa826ba98067aa8974b39e90b6a79dbbb2adc0bdbac1bfbdbfbbb8c1bdb9bebab6c0bdb9bfbbb8c1bdbab4b2b0b7b6b4b7b6b3b4b2b0bab9b7b6b5b2b6b5b2bab9b6bab9b6958c87977663aa836bac8772b08f7aad8c77b2917db0917db0907cac8971a77d64a87f67ac8972b29887b8a89dbfbab5bfbdbac1bebac0bcb9c0bcb9c0bcb9c1bebabebab7b8b7b4b7b6b4b5b4b1b5b4b2b7b6b3b5b4b2bab9b7bab9b6b4b1ada88f7fad8973ae8d78b19684b19685b29786b69a89b29582b1917daa856ea87e66a97e66ad866ea9826baf9280b8ada6bdbbb8bebab7bfbbb8c1bdbabfbbb8bcb8b4bcb8b5b6b4b2b7b5b3b6b5b2b8b7b4b3b2afb8b7b4b6b5b2b3b2b0b3a59aab856fad8d78b0917eb19886b49b8bb49a89b39785b0917eaf8f7cab866fa77d65a77a61a87d64a9816ab08f79b5a296c1bcb8c3bfbcc2bebbbebab7bfbbb7bdbab6c2bebab8b7b4b7b6b4b6b5b3b7b6b3b6b5b2b9b8b6b4b3b1b6b1acac8f7ca9826bae8f7aaf9583b49c8cb49c8bb79d8cb59987b19380ad8e79ae8c77af8e78ac8771a3775faa826bae8972b39888bbb6b2bebbb8bfbbb8bfbbb8c0bdb9bebbb7c0bdb9b6b5b2b9b8b5b4b3b1b8b7b5b4b3b0b7b6b4b6b5b3b1a7a0aa8772a77d65a88570b49887b19b8d9c887c907a6d987f71aa907faf917daf8e7aad8c78ac8b77a8836ca9836cac8770b49b8abdb6b2c0bcb9c0bdb9bfbbb8bebab7bfbcb9bebab7b9b8b6b5b4b2b9b8b5b8b7b5b8b7b4b7b6b4b5b4b2b3a9a2ad8973a1755da9856fb398858c776a65544b776358725d526e594d9c7f6eb1907ba68672ad8e7aab8771ac856db18f79b3a092beb9b5c1bdbabdb9b5bebab7bfbbb7bebab7bcb9b6b7b6b4b6b6b3b8b7b4b5b4b2b8b6b4b7b6b3b4b3b0b4aba4a6826ba3775fb08e79b19584a88e7daa8e7db29481ad8f7c997e6da38674ac8d79ac8e7aae917f9a7c6a896a599a7c6ab3a398c1bdbabdb9b6bcb8b5bebab6bebab7bdb9b5bdb9b6b5b4b1b7b5b3b5b4b2b7b6b3b7b6b4b3b3b0b3b2b0b4aca5a7846fa97f68ae8f7bae9383b59c8bb2937fae8e79ac8b76af927eaf927eb29683b39885b2988891786a72594c6e594d978d86bdbab7bab7b3c0bcb9c0bcb9bebab7bebbb7bdb9b6b3b2b0b4b3b0b5b4b2b4b4b1b4b3b1b4b3b1b4b3b0b6ada5aa8670a57a62ad8e7ab29b8cb69d8dab856fa9826aa88069ab8771af907db49987b19684b29886b59987b39480b09787b5a9a1bcb8b5bebab7bdb9b5bebab7bfbbb8bfbbb7bbb7b4b3b2afb8b7b5b8b7b5b3b2b0b5b4b2b6b5b3b6b4b1afa299a98975a9826baf907cb39988b49a89af8e7aac8973aa856eaf8c74b1917dae907dac907db39988b29785b49785b7a090b9aca3bfbab7bcb8b5bdb9b6bcb8b4bcb8b5bdb9b5bcb8b4b5b4b2b6b5b3b4b3b0b4b3b0b9b8b5b8b6b4908b88887467aa8f7ea78976ad8973b08b74b59885b69e8eb29888b1917cb1917db1937fae907cb19686b39a8ab29886b59b8ab8a192b6aaa3b7b2afbcb8b4bcb8b5bbb7b4c0bcb9bebab7c0bcb9b6b5b2b6b5b3b4b3b0bab9b7b7b6b4b1b0ae7b716ba083709b806f716158967764b08870b29481b69b8ab69f8fb39a89b69f90b49d8db39a89b29988b49c8cb6a090b8a496baa49593867f8f8986bfbbb7bdb9b5bcb7b4bab6b3b9b5b2bab6b2b4b3b1b3b3b0b6b5b3b8b7b5b4b2b0a7a5a38f837dae917ea084725a504c63544da28370b39784b59e8db2a093a698909b918b998e8790857e95877dad998bb39c8cb5a091b9a2938d827c95908dbebab6bbb7b3bdbab7bbb7b4bdb9b6bbb7b4b4b3b0b5b4b1b8b7b5b6b5b3b8b8b5b4b2af968f8ab29a8bab9485544b483a323073655d96887f70655f61595547403e453e3c453f3d57504f655e5b90847db39c8db7a090b6a09189807aaba6a3bdb9b6c0bcb9bebab7bcb7b4bebab7bbb7b4b3b2b0b6b5b3b2b1afb7b6b4b8b7b4b5b4b1aeaba8b5a89fac998d4d44412d25244d46444e4744322b293a3230423937433a37352d2a59504c534b48524a48988a81b59f8fb19c8d827974b2afacbdb9b5bcb8b4bdb9b5bcb8b5bdb9b6bab6b2b8b7b5b5b4b2b6b6b3b9b8b5b7b6b3b6b5b2b8b6b3b9b4b1b2a9a26c64612d25242d2625312a28352d2c453d3a78675c8d7a6ea09792aea6a0615854332b29524a479f8e82b09d90a49b96c1bdb9bebab7bfbbb8bbb8b4b9b5b1b8b4b0b9b4b0b7b6b4b8b7b5b8b7b4b6b5b3b8b6b3bab9b6b9b8b5b4b3b0b7b5b2a5a29f453d3b261e1d261f1e2e2625413936857268977865b19482b5a69caca5a07c7572453d3b746963a0948cc5bfbbc0bbb8beb9b6bbb7b3bbb6b3b7b3afb8b4b0b9b5b1b7b6b3b6b5b3b5b4b2b5b4b2b7b6b3b7b6b3b8b6b3b4b2afb7b6b3b3b1ae6d6765251f1e1e18172a22212d2523443b3971625ab19888b09482a89182877e792c25243e3634766d6abeb9b5bfbbb7bebab6bcb7b3bbb6b3b9b5b1b7b3afb8b4b0b4b3b0b5b4b1b5b4b1b4b3b1b5b4b2b8b6b4b5b3b0b9b6b4b5b4b1b6b4b27f79762a2322221c1b2d2524221b1a443e3c47413f6f676281766f867971675e5a3e37352a222166605dbab7b3bdb9b5beb9b5bcb7b3bcb7b3b9b4b0bab6b2bab6b2b5b3b0b6b4b2b3b2afb7b6b3b4b4b1b4b3b0b6b4b1b5b4b1b4b3b0b9b6b29a8c8252474230292828201f181212322c2c231e1d1c16162c26252923222d26252d2523332b2a8e8885bcb8b5bcb7b3bbb6b2bcb7b3b9b4b1b9b5b1b7b2afb7b2ae7a838e9b9b9caeadacb3b2b0b3b2afb7b7b4b6b5b3b6b6b3b7b6b3b9ada4a991808e7b6f50453f2b24231a14142923221f19181d17161f18182620201d17162a22215d5654b7b3b0bbb7b3bbb6b2b8b4b0bab5b1bbb6b2bab5b1b8b4b0bab6b22c496b4c5d735f68766e727a828285929090adaba8b7b2aeb6a59ab39682a28470a387748e76674e403a1a14141d1716181211221c1c1f1918221c1b2f2827342d2c8d8884bab6b3b9b5b2bab5b1bab5b1b9b4b0bab6b2b8b4b0b9b4b0b7b2ae325e8b365f8a3a5d833f5b7a545f70646469706b6aa08f84b08e78b18e769f7e689e7f6b9e816d907766584940362d2a1c1615201b1a1a1413201a1a251e1d393331a39e9bbab5b1bcb7b3bab6b2b8b3afb8b4b0b9b4b0b9b4b1bab5b2b5b0ac3d6c9843729d44719c426e98415f805a64716f6a699d8677b1927eb3947faa89749d7a649f7f6ba487749e837186716454463f2c25231e181837302e3a33317a7471beb9b6bcb8b4bbb6b2b6b2aebab5b1b9b5b1b8b3afbab6b2b6b1adb5aeaa4877a14c7aa44e7ba345719a3a5d80586b7f767475927b6eb1927faf8e79b08e78a78169a07861a17f6aa58570a688749b83738270666f66618a8480a49e99b7b2aebab6b2bcb8b4b9b5b1b7b2aebab5b1b9b4b0b6b1aeb6b1adb2aca8b2aca84876a04a78a2517fa74771973a5d80405c7a6161677c695fac8a75b08d77b4917aaf8971ad876fa5816aa6846ea78670a98a76ac9484ab9f96b2aca8bdb8b4bcb7b3bcb8b4bcb8b4b8b3afb7b2aeb9b4b0b8b3afb8b2aeb6afabb3aeaab2aeaa4878a14b7aa34c7ba44a759b3d63873b5f825b67766f5f569c7e6caf8c77b18f79b28f78b5927caf8e78a98872aa8a76a98a76ac917fada199b7b0acb9b3afbfb9b5c1bab6bdb6b2b8b3afbab5b1b9b4b0b6afabb7b1adb3ada9b3aeaab0aba8",n=32,l=32;function g(){const d=[];for(let c=0;c<l;c++){const e=[];for(let b=0;b<n;b++){const a=(c*n+b)*6,t=parseInt(o.slice(a,a+2),16),s=parseInt(o.slice(a+2,a+4),16),f=parseInt(o.slice(a+4,a+6),16);e.push([t,s,f])}d.push(e)}return d}i(g,"parseImage");function r(d,c,e,b=!1){return`\x1B[${b?48:38};2;${d};${c};${e}m`}i(r,"rgb");const u="\x1B[0m";function k(){const d=g(),c=[];for(let e=0;e<l;e+=2){let b="";for(let a=0;a<n;a++){const t=d[e][a],s=d[e+1]?.[a]??t;b+=`${r(s[0],s[1],s[2])}${r(t[0],t[1],t[2],!0)}\u2584`}b+=u,c.push(b)}return c}i(k,"buildImage");class I{static{i(this,"DaxnutsComponent")}ui;image;interval=null;tick=0;maxTicks=25;cachedLines=[];cachedWidth=0;cachedTick=-1;constructor(c){this.ui=c,this.image=k(),this.startAnimation()}invalidate(){this.cachedWidth=0}startAnimation(){this.interval=setInterval(()=>{this.tick++,this.tick>=this.maxTicks&&this.stopAnimation(),this.cachedWidth=0,this.ui.requestRender()},80)}stopAnimation(){this.interval&&(clearInterval(this.interval),this.interval=null)}render(c){if(c===this.cachedWidth&&this.cachedTick===this.tick)return this.cachedLines;const e=x,b=[],a=i(f=>{const h=f.replace(/\x1b\[[0-9;]*m/g,"").length,p=Math.max(0,Math.floor((c-h)/2));return" ".repeat(p)+f},"center");b.push("");const t=Math.min(this.image.length,Math.floor(this.tick/this.maxTicks*(this.image.length+3)));for(let f=0;f<this.image.length;f++)if(f<t)b.push(a(this.image[f]));else if(f===t){const h="\u2593".repeat(n);b.push(a(r(100,200,255)+h+u))}else b.push(a(" ".repeat(n)));b.push("");const s=Math.max(0,this.tick-this.maxTicks*.6);return s>0||this.tick>=this.maxTicks?(b.push(a(e.fg("accent","Free Kimi K2.5 via OpenCode Zen"))),b.push(a(e.fg("success",'"Powered by daxnuts"'))),b.push(a(e.fg("muted","\u2014 @thdxr")))):(b.push(""),b.push(""),b.push("")),b.push(""),s>2||this.tick>=this.maxTicks?(b.push(a(e.fg("dim","Try OpenCode"))),b.push(a(e.fg("mdLink","https://mistral.ai/news/mistral-vibe-2-0")))):(b.push(""),b.push("")),b.push(""),this.cachedLines=b,this.cachedWidth=c,this.cachedTick=this.tick,b}dispose(){this.stopAnimation()}}export{I as DaxnutsComponent};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
var f=Object.defineProperty;var c=(o,r)=>f(o,"name",{value:r,configurable:!0});import{Type as e}from"typebox";import{Compile as g}from"typebox/compile";import{THEME_TOKENS as u}from"./theme-tokens.js";function s(o){return e.Union([e.String({description:"Hex color (#RGB or #RRGGBB), OKLCH or OKHSL color, variable reference, or empty string for terminal default"}),e.Integer({minimum:0,maximum:255,description:"256-color palette index (0-255)"})],o?{description:o}:{})}c(s,"colorValue");const b=s();function O(o){const r={};for(const[l,n]of Object.entries(o)){const i=s(n.description);r[l]=n.fallback===void 0?i:e.Optional(i)}return r}c(O,"themeTokenProperties");const k=e.Unsafe(e.Object(O(u),{description:"Theme color definitions (scrollbar, thinkingMax, and search highlight colors are optional and use compatible fallbacks)",additionalProperties:!1})),P=e.Object({$schema:e.Optional(e.String({description:"JSON schema reference"})),name:e.String({pattern:"^[^/]+$",description:"Theme name. Must not contain '/' because it is reserved for automatic light/dark theme settings."}),appearance:e.Optional(e.Union([e.Literal("dark"),e.Literal("light")],{description:"Background the theme is designed for. Detected from the theme colors when omitted."})),vars:e.Optional(e.Record(e.String(),b,{description:"Reusable color variables"})),colors:k,export:e.Optional(e.Object({pageBg:e.Optional(s("Page background color")),cardBg:e.Optional(s("Card/container background color")),infoBg:e.Optional(s("Info sections background (system prompt, notices)"))},{description:"Optional colors for HTML export (defaults derived from userMessageBg if not specified)",additionalProperties:!1}))},{title:"Pi Coding Agent Theme",description:"Theme schema for Pi coding agent",additionalProperties:!1}),m=g(P);function x(o,r){if(typeof r=="object"&&r!==null&&"name"in r&&typeof r.name=="string"&&r.name.includes("/"))throw new Error(`Invalid theme name "${r.name}": theme names cannot contain "/" because it is reserved for automatic light/dark theme settings.`);if(!m.Check(r)){const l=Array.from(m.Errors(r)),n=new Set,i=[];for(const t of l){if(t.keyword==="required"&&t.instancePath==="/colors"){const p=t.params.requiredProperties;for(const h of p??[])n.add(h);continue}const d=t.instancePath||"/";i.push(` - ${d}: ${t.message}`)}let a=`Invalid theme "${o}":
|
|
2
|
-
`;throw n.size>0&&(a+=`
|
|
3
|
-
Missing required color tokens:
|
|
4
|
-
`,a+=Array.from(n).sort().map(t=>` - ${t}`).join(`
|
|
5
|
-
`),a+=`
|
|
6
|
-
|
|
7
|
-
Please add these colors to your theme's "colors" object.`,a+=`
|
|
8
|
-
See the built-in themes (dark.json, light.json) for reference values.`),i.length>0&&(a+=`
|
|
9
|
-
|
|
10
|
-
Other errors:
|
|
11
|
-
${i.join(`
|
|
12
|
-
`)}`),new Error(a)}return r}c(x,"validateThemeJson");export{b as ColorValueSchema,P as ThemeJsonSchema,x as validateThemeJson};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var i=Object.defineProperty;var n=(o,t)=>i(o,"name",{value:t,configurable:!0});function s(o){for(const[t,e]of Object.entries(o)){if(e.fallback===void 0)continue;const r=o[e.fallback];if(r===void 0)throw new Error(`Theme token ${t} has unknown fallback ${e.fallback}`);if(r.slot!==e.slot)throw new Error(`Theme token ${t} has fallback ${e.fallback} in a different color slot`)}return o}n(s,"defineThemeTokens");const l=s({accent:{slot:"foreground",description:"Primary accent color (logo, selected items, cursor)"},border:{slot:"foreground",description:"Normal borders"},borderAccent:{slot:"foreground",description:"Highlighted borders"},borderMuted:{slot:"foreground",description:"Subtle borders"},success:{slot:"foreground",description:"Success states"},error:{slot:"foreground",description:"Error states"},warning:{slot:"foreground",description:"Warning states"},muted:{slot:"foreground",description:"Secondary/dimmed text"},dim:{slot:"foreground",description:"Very dimmed text (more subtle than muted)"},text:{slot:"foreground",description:"Default text color (usually empty string)"},thinkingText:{slot:"foreground",description:"Thinking block text color"},scrollbarTrack:{slot:"foreground",description:"Fullscreen scrollbar track foreground (falls back to muted when omitted)",fallback:"muted"},scrollbarThumb:{slot:"foreground",description:"Fullscreen scrollbar thumb foreground (falls back to text when omitted)",fallback:"text"},selectedBg:{slot:"background",description:"Selected item background"},searchMatchBg:{slot:"background",description:"Transcript search match background and current-match text (falls back to selectedBg when omitted)",fallback:"selectedBg"},searchMatchText:{slot:"foreground",description:"Transcript search match text and current-match background (falls back to text when omitted)",fallback:"text"},userMessageBg:{slot:"background",description:"User message background"},userMessageText:{slot:"foreground",description:"User message text color"},customMessageBg:{slot:"background",description:"Custom message background (hook-injected messages)"},customMessageText:{slot:"foreground",description:"Custom message text color"},customMessageLabel:{slot:"foreground",description:"Custom message type label color"},toolPendingBg:{slot:"background",description:"Tool execution box (pending state)"},toolSuccessBg:{slot:"background",description:"Tool execution box (success state)"},toolErrorBg:{slot:"background",description:"Tool execution box (error state)"},toolTitle:{slot:"foreground",description:"Tool execution box title color"},toolOutput:{slot:"foreground",description:"Tool execution box output text color"},mdHeading:{slot:"foreground",description:"Markdown heading text"},mdLink:{slot:"foreground",description:"Markdown link text"},mdLinkUrl:{slot:"foreground",description:"Markdown link URL"},mdCode:{slot:"foreground",description:"Markdown inline code"},mdCodeBlock:{slot:"foreground",description:"Markdown code block content"},mdCodeBlockBorder:{slot:"foreground",description:"Markdown code block fences"},mdQuote:{slot:"foreground",description:"Markdown blockquote text"},mdQuoteBorder:{slot:"foreground",description:"Markdown blockquote border"},mdHr:{slot:"foreground",description:"Markdown horizontal rule"},mdListBullet:{slot:"foreground",description:"Markdown list bullets/numbers"},toolDiffAdded:{slot:"foreground",description:"Added lines in tool diffs"},toolDiffRemoved:{slot:"foreground",description:"Removed lines in tool diffs"},toolDiffContext:{slot:"foreground",description:"Context lines in tool diffs"},syntaxComment:{slot:"foreground",description:"Syntax highlighting: comments"},syntaxKeyword:{slot:"foreground",description:"Syntax highlighting: keywords"},syntaxFunction:{slot:"foreground",description:"Syntax highlighting: function names"},syntaxVariable:{slot:"foreground",description:"Syntax highlighting: variable names"},syntaxString:{slot:"foreground",description:"Syntax highlighting: string literals"},syntaxNumber:{slot:"foreground",description:"Syntax highlighting: number literals"},syntaxType:{slot:"foreground",description:"Syntax highlighting: type names"},syntaxOperator:{slot:"foreground",description:"Syntax highlighting: operators"},syntaxPunctuation:{slot:"foreground",description:"Syntax highlighting: punctuation"},thinkingOff:{slot:"foreground",description:"Thinking level border: off"},thinkingMinimal:{slot:"foreground",description:"Thinking level border: minimal"},thinkingLow:{slot:"foreground",description:"Thinking level border: low"},thinkingMedium:{slot:"foreground",description:"Thinking level border: medium"},thinkingHigh:{slot:"foreground",description:"Thinking level border: high"},thinkingXhigh:{slot:"foreground",description:"Thinking level border: xhigh"},thinkingMax:{slot:"foreground",description:"Thinking level border: max (falls back to thinkingXhigh when omitted)",fallback:"thinkingXhigh"},bashMode:{slot:"foreground",description:"Editor border color in bash mode"}});export{l as THEME_TOKENS};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var f=Object.defineProperty;var i=(o,s)=>f(o,"name",{value:s,configurable:!0});import{Type as e}from"typebox";import{ModelCostSchema as g}from"./model-schema.js";function d(o){return e.Union([e.Literal("openai"),e.Literal("openai-nosession"),e.Literal("openrouter")],o)}i(d,"sessionAffinityFormat");const T=d({description:"Session-affinity header format used to route related requests consistently."});function c(o){return e.Union([e.Literal("thinking_token_budget"),e.Literal("thinking_budget"),e.Literal("thinking_budget_tokens")],o)}i(c,"thinkingTokenBudgetField");const q=c({description:'Top-level request field name used by OpenAI-compatible endpoints to cap reasoning tokens. "thinking_token_budget" is used by vLLM, "thinking_budget" by Qwen, DashScope, or SGLang, and "thinking_budget_tokens" by llama.cpp.'}),h=e.Union([e.String(),e.Number(),e.Boolean(),e.Null(),e.Object({$var:e.Union([e.Literal("thinking.enabled"),e.Literal("thinking.effort"),e.Literal("thinking.budget")]),omitWhenOff:e.Optional(e.Boolean())})]);function u(o){return e.Object({p50:e.Optional(e.Number({description:`${o} at the 50th percentile.`})),p75:e.Optional(e.Number({description:`${o} at the 75th percentile.`})),p90:e.Optional(e.Number({description:`${o} at the 90th percentile.`})),p99:e.Optional(e.Number({description:`${o} at the 99th percentile.`}))})}i(u,"percentileCutoffs");const y=e.Object({allow_fallbacks:e.Optional(e.Boolean({description:"Whether to allow backup providers to serve requests.",default:!0})),require_parameters:e.Optional(e.Boolean({description:"Whether to filter providers to only those that support all parameters in the request.",default:!1})),data_collection:e.Optional(e.Union([e.Literal("deny"),e.Literal("allow")],{description:'Data collection setting. "allow": allow providers that may store or train on data. "deny": only use providers that do not collect user data.',default:"allow"})),zdr:e.Optional(e.Boolean({description:"Whether to restrict routing to only ZDR (Zero Data Retention) endpoints."})),enforce_distillable_text:e.Optional(e.Boolean({description:"Whether to restrict routing to only models that allow text distillation."})),order:e.Optional(e.Array(e.String(),{description:"An ordered list of provider names or slugs to try in sequence, falling back to the next if unavailable."})),only:e.Optional(e.Array(e.String(),{description:"List of provider names or slugs to exclusively allow for this request."})),ignore:e.Optional(e.Array(e.String(),{description:"List of provider names or slugs to skip for this request."})),quantizations:e.Optional(e.Array(e.String(),{description:'A list of quantization levels to filter providers by, for example ["fp16", "bf16", "fp8", "fp6", "int8", "int4", "fp4", "fp32"].'})),sort:e.Optional(e.Union([e.String(),e.Object({by:e.Optional(e.String({description:'The sorting metric, such as "price", "throughput", or "latency".'})),partition:e.Optional(e.Union([e.String(),e.Null()],{description:'Partitioning strategy: "model" or "none".',default:"model"}))})],{description:'Sorting strategy. Can be a string such as "price", "throughput", or "latency", or an object.'})),max_price:e.Optional(e.Object({prompt:e.Optional(e.Union([e.Number(),e.String()],{description:"Price per million prompt tokens."})),completion:e.Optional(e.Union([e.Number(),e.String()],{description:"Price per million completion tokens."})),image:e.Optional(e.Union([e.Number(),e.String()],{description:"Price per image."})),audio:e.Optional(e.Union([e.Number(),e.String()],{description:"Price per audio unit."})),request:e.Optional(e.Union([e.Number(),e.String()],{description:"Price per request."}))},{description:"Maximum price per million tokens in USD."})),preferred_min_throughput:e.Optional(e.Union([e.Number(),u("Minimum tokens per second")],{description:"Preferred minimum throughput in tokens per second. A number applies to p50."})),preferred_max_latency:e.Optional(e.Union([e.Number(),u("Maximum latency in seconds")],{description:"Preferred maximum latency in seconds. A number applies to p50."}))},{description:"OpenRouter provider routing preferences. Controls which upstream providers OpenRouter routes requests to. Sent as the provider field in the OpenRouter API request body. See https://openrouter.ai/docs/guides/routing/provider-selection."}),v=e.Object({only:e.Optional(e.Array(e.String(),{description:'List of provider slugs to exclusively use for this request, for example ["bedrock", "anthropic"].'})),order:e.Optional(e.Array(e.String(),{description:'List of provider slugs to try in order, for example ["anthropic", "openai"].'}))},{description:"Vercel AI Gateway routing preferences. Controls which upstream providers the gateway routes requests to. See https://vercel.com/docs/ai-gateway/models-and-providers/provider-options."}),b=e.Object({provider:e.String({minLength:1}),model:e.String({minLength:1}),cost:g},{description:"An Anthropic server-side refusal fallback model with local pricing metadata."});function t(o){return e.Optional(e.Boolean(o))}i(t,"optionalCompatBoolean");function p(o){return e.Optional(d(o))}i(p,"optionalSessionAffinityFormat");const k=e.Object({supportsStore:e.Optional(e.Boolean({description:"Whether the provider supports the store field. Default: auto-detected from URL."})),supportsDeveloperRole:t({description:"Whether the provider supports the developer role instead of system. Default: auto-detected from URL."}),supportsReasoningEffort:e.Optional(e.Boolean({description:"Whether the provider supports reasoning_effort. Default: auto-detected from URL."})),supportsUsageInStreaming:e.Optional(e.Boolean({description:"Whether the provider supports stream_options.include_usage for token usage in streaming responses.",default:!0})),supportsFinishReason:e.Optional(e.Boolean({description:"Whether streamed responses include finish_reason. When false, pi infers stop or toolUse when the stream ends.",default:!0})),maxTokensField:e.Optional(e.Union([e.Literal("max_completion_tokens"),e.Literal("max_tokens")],{description:"Which field to use for max tokens. Default: auto-detected from URL."})),requiresToolResultName:e.Optional(e.Boolean({description:"Whether tool results require the name field. Default: auto-detected from URL."})),requiresAssistantAfterToolResult:e.Optional(e.Boolean({description:"Whether a user message after tool results requires an assistant message in between. Default: auto-detected from URL."})),requiresThinkingAsText:e.Optional(e.Boolean({description:"Whether thinking blocks must be converted to text blocks with <thinking> delimiters. Default: auto-detected from URL."})),requiresReasoningContentOnAssistantMessages:e.Optional(e.Boolean({description:"Whether all replayed assistant messages must include an empty reasoning_content field when reasoning is enabled. Default: auto-detected from URL."})),thinkingFormat:e.Optional(e.Union([e.Literal("openai"),e.Literal("openrouter"),e.Literal("deepseek"),e.Literal("together"),e.Literal("baseten"),e.Literal("zai"),e.Literal("qwen"),e.Literal("chat-template"),e.Literal("qwen-chat-template"),e.Literal("string-thinking"),e.Literal("ant-ling")],{description:'Format for reasoning or thinking parameters. When omitted, Pi auto-detects the format from the provider URL. "openai" uses reasoning_effort, "openrouter" uses reasoning.effort, "deepseek" uses thinking.type plus reasoning_effort when supported, "together" uses reasoning.enabled plus reasoning_effort when supported, "baseten" uses configurable chat_template_args plus reasoning_effort when supported, "zai" uses thinking.type, "qwen" uses top-level enable_thinking, "qwen-chat-template" uses chat_template_kwargs.enable_thinking and preserve_thinking, "chat-template" uses configurable chat_template_kwargs, "string-thinking" uses top-level thinking, and "ant-ling" uses reasoning.effort only when the mapped effort is non-null.'})),chatTemplateKwargs:e.Optional(e.Record(e.String(),h,{description:'Kwargs sent as chat_template_kwargs when thinkingFormat is "chat-template". Use $var with "thinking.enabled", "thinking.effort", or "thinking.budget" for pi-controlled values.'})),chatTemplateArgs:e.Optional(e.Record(e.String(),h,{description:'Arguments sent as chat_template_args when thinkingFormat is "baseten". Use $var with "thinking.enabled", "thinking.effort", or "thinking.budget" for pi-controlled values.'})),openRouterRouting:e.Optional(y),vercelGatewayRouting:e.Optional(v),zaiToolStream:e.Optional(e.Boolean({description:"Whether z.ai supports top-level tool_stream for streaming tool call deltas.",default:!1})),thinkingTokenBudgetField:e.Optional(c({description:'Top-level request field used to cap reasoning tokens from thinkingBudgets. Reasoning and the answer share max_tokens on these endpoints. "thinking_token_budget" is vLLM, "thinking_budget" is Qwen, DashScope, or SGLang, and "thinking_budget_tokens" is llama.cpp. Off by default and not set on the generated catalog.'})),supportsThinkingTokenBudget:e.Optional(e.Boolean({description:'Alias for thinkingTokenBudgetField: "thinking_token_budget" (vLLM). Prefer thinkingTokenBudgetField.',default:!1})),supportsOpenAIGrammarTools:t({description:"Whether the provider supports OpenAI custom tools with Lark or regex grammar formats. When false, grammar-constrained tools fall back to normal function tools. The generated catalog enables this for capable models.",default:!1}),supportsMidConvoSystemMessages:t({description:"Whether the exact model accepts system or developer messages after the conversation has started. When false, later system messages are folded into the leading system message. The generated catalog enables this for verified models.",default:!1}),supportsMidConvoToolAdditions:e.Optional(e.Boolean({description:"Whether system messages can introduce additional tools mid-conversation. Requires supportsMidConvoSystemMessages. The generated catalog enables this for capable models.",default:!1})),supportsStrictMode:t({description:"Whether the provider supports the strict field in tool definitions. Generated capable models enable it explicitly.",default:!1}),cacheControlFormat:e.Optional(e.Literal("anthropic",{description:"Cache control convention for prompt caching. Anthropic applies cache_control markers to the system prompt, last tool definition, and last user, assistant, or tool-result text content."})),sendSessionAffinityHeaders:t({description:"Whether to send session-affinity data from options.sessionId. Default: true for OpenRouter endpoints, false otherwise."}),sessionAffinityFormat:p({description:"Session-affinity header format. openai sends session_id, x-client-request-id, and x-session-affinity; openai-nosession sends x-client-request-id and x-session-affinity; openrouter sends x-session-id. Does not affect prompt_cache_key. Default: auto-detected."}),supportsLongCacheRetention:t({description:'Whether the provider supports long prompt cache retention (prompt_cache_retention: "24h" or Anthropic-style cache_control.ttl: "1h", depending on format). Default: auto-detected from provider and URL.'}),dsmlToolCallsInContent:e.Optional(e.Boolean({description:"Whether DeepSeek's native tool-call markup can arrive in content when the serving side fails to parse it into tool_calls. When true, complete DSML blocks in the text stream become tool calls and stray DSML tags are dropped. Default: true for DeepSeek models."})),vllmPriority:e.Optional(e.Number({description:"vLLM scheduler priority sent as the top-level priority request field. Lower values are handled earlier and the server default is 0. Only meaningful with --scheduling-policy priority. Off by default and not set on the generated catalog."}))},{description:"Compatibility settings for OpenAI-compatible completions APIs. Use this to override URL-based auto-detection for custom providers.",additionalProperties:!0}),O=e.Object({supportsDeveloperRole:t({description:"Whether the provider supports the developer role instead of system.",default:!0}),supportsMidConvoSystemMessages:t({description:"Whether the exact model accepts developer or system messages after the conversation has started. When false, later system messages are folded into the leading system message. The generated catalog enables this for verified models.",default:!1}),sessionAffinityFormat:p({description:"Session-affinity header format. openai sends session_id and x-client-request-id; openai-nosession sends x-client-request-id; openrouter sends x-session-id. Does not affect prompt_cache_key. Default: auto-detected."}),supportsLongCacheRetention:t({description:'Whether the provider supports long prompt cache retention. This uses prompt_cache_options.ttl: "30m" on GPT-5.6+ and prompt_cache_retention: "24h" on earlier models.',default:!0}),supportsStrictMode:t({description:"Whether the provider supports strict JSON-schema function tools. Defaults are API-specific; generated OpenAI models enable it explicitly."}),supportsOpenAIGrammarTools:t({description:"Whether to emit OpenAI custom tools with Lark or regex grammar formats. When false, grammar-constrained tools fall back to normal function tools. The generated catalog enables this for capable models.",default:!1}),supportsAdditionalTools:e.Optional(e.Boolean({description:"Whether the model supports message-anchored additional_tools input items.",default:!1})),supportsToolSearch:e.Optional(e.Boolean({description:"Whether the model supports client-executed tool search for transcript-anchored additions.",default:!1})),supportsExplicitPromptCacheMode:e.Optional(e.Boolean({description:"Whether the model accepts prompt_cache_options. Older OpenAI models reject the parameter.",default:!1})),supportsMaxOutputTokens:e.Optional(e.Boolean({description:"Whether the provider accepts max_output_tokens. Some Codex-protocol gateways reject it.",default:!0}))},{description:"Compatibility settings for OpenAI Responses APIs.",additionalProperties:!0}),_=e.Object({supportsEagerToolInputStreaming:e.Optional(e.Boolean({description:"Whether the provider accepts per-tool eager_input_streaming. When false, the Anthropic provider omits tools[].eager_input_streaming and sends the legacy fine-grained-tool-streaming-2025-05-14 beta header for tool-enabled requests.",default:!0})),supportsLongCacheRetention:t({description:"Whether the provider supports Anthropic long cache retention through cache_control.ttl.",default:!0}),sendSessionAffinityHeaders:t({description:"Whether to send x-session-affinity from options.sessionId when caching is enabled. Required for providers like Fireworks that use session affinity for prompt cache routing; requests to the same replica maximize cache hits. Default: true for OpenRouter endpoints, false otherwise."}),sessionAffinityFormat:e.Optional(e.Literal("openrouter",{description:"Session-affinity format. openrouter sends x-session-id; when unset, sends x-session-affinity."})),supportsCacheControlOnTools:e.Optional(e.Boolean({description:"Whether the provider supports Anthropic-style cache_control markers on tool definitions. When false, cache_control is omitted from tool parameters. Some Anthropic-compatible providers, such as Fireworks, do not support this field on tools and may reject or ignore it.",default:!0})),supportsTemperature:e.Optional(e.Boolean({description:"Whether the model accepts the Anthropic temperature request field. Claude Opus 4.7+ rejects non-default values.",default:!0})),forceAdaptiveThinking:e.Optional(e.Boolean({description:"Whether to force adaptive thinking (thinking.type: adaptive plus output_config.effort) regardless of model ID. Built-in models that require adaptive thinking set this in generated metadata. Custom Anthropic-compatible providers can set this to true for any model whose upstream requires the adaptive format. Set false to opt out on overridden built-in models.",default:!1})),allowEmptySignature:e.Optional(e.Boolean({description:"Whether to replay empty thinking signatures instead of converting thinking to text.",default:!1})),supportsStrictTools:e.Optional(e.Boolean({description:"Whether the provider supports Anthropic strict tool schemas. Generated Anthropic models enable it explicitly.",default:!1})),supportsMidConvoEffort:e.Optional(e.Boolean({description:"Whether the exact model transport supports effort-only system messages and thinking binding controls.",default:!1})),supportsMidConvoSystemMessages:t({description:"Whether the exact model accepts system-role messages inside the conversation. When false, later system messages are folded into the top-level system prompt.",default:!1}),supportsMidConvoToolChanges:e.Optional(e.Boolean({description:"Whether the exact model accepts mid-conversation tool_addition and tool_removal blocks. Requires supportsMidConvoSystemMessages.",default:!1})),allowedFallbackModels:e.Optional(e.Array(b,{maxItems:3,description:"Models Anthropic accepts for server-side refusal fallback, with local pricing metadata for returned fallback responses. When absent or empty, callers must omit fallbacks; Anthropic rejects the field for models with no permitted fallback targets."}))},{description:"Compatibility settings for Anthropic Messages-compatible APIs.",additionalProperties:!0}),S=e.Object({supportsStrictMode:t({description:"Whether the model supports Bedrock strict tool schemas.",default:!1})},{description:"Compatibility settings for Amazon Bedrock models.",additionalProperties:!0}),A=e.Object({supportsMidConvoSystemMessages:t({description:"Whether the exact model accepts system messages after the conversation has started. When false, later system messages are folded into the leading system message.",default:!1})},{description:"Compatibility settings for the Mistral chat API.",additionalProperties:!0}),x={supportsDeveloperRole:t({description:"Whether the provider supports the developer role instead of system. Defaults are API-specific."}),supportsMidConvoSystemMessages:t({description:"Whether the exact model accepts system or developer messages after the conversation has started. When false, later system messages are folded into the leading system message.",default:!1}),sessionAffinityFormat:p({description:"Session-affinity header format. Defaults are API-specific or auto-detected."}),supportsLongCacheRetention:t({description:"Whether the provider supports long prompt cache retention. Defaults are API-specific or auto-detected."}),supportsStrictMode:t({description:"Whether the provider supports strict tool schemas. Defaults are API-specific."}),supportsOpenAIGrammarTools:t({description:"Whether the provider supports OpenAI custom tools with Lark or regex grammar formats. When false, grammar-constrained tools fall back to normal function tools.",default:!1}),sendSessionAffinityHeaders:t({description:"Whether to send session-affinity data from options.sessionId. Defaults are API-specific."})};function w(o,s){const a={},l=new Set;for(const n of o)for(const[r,m]of Object.entries(n)){if(a[r]!==void 0&&(l.add(r),!(r in s)))throw new Error(`Duplicate compatibility schema property requires an override: ${r}`);a[r]=m}for(const n of Object.keys(s))if(!l.has(n))throw new Error(`Compatibility schema override does not resolve a duplicate property: ${n}`);return{...a,...s}}i(w,"mergeCompatProperties");const W={"openai-completions":k,"openai-responses":O,"anthropic-messages":_,"bedrock-converse-stream":S,"mistral-conversations":A},L=w(Object.values(W).map(o=>o.properties),x),M=e.Object(L,{description:"Provider and model compatibility overrides.",additionalProperties:!0});export{b as AnthropicAllowedFallbackModelSchema,_ as AnthropicMessagesCompatSchema,S as BedrockCompatSchema,h as ChatTemplateKwargValueSchema,A as MistralConversationsCompatSchema,k as OpenAICompletionsCompatSchema,O as OpenAIResponsesCompatSchema,y as OpenRouterRoutingSchema,M as ProviderCompatSchema,T as SessionAffinityFormatSchema,q as ThinkingTokenBudgetFieldSchema,v as VercelGatewayRoutingSchema};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var m=Object.defineProperty;var o=(t,r)=>m(t,"name",{value:r,configurable:!0});import{Type as e}from"typebox";const n=["minimal","low","medium","high","xhigh","max"],a=["off",...n],c=["text","image"],p=["none","short","long"],l=["short","long"],M=e.Enum(n),u=e.Enum(a),I=e.Enum(c),S=e.Enum(p),h=e.Union([e.String(),e.Null()]),E=e.Partial(e.Record(u,h)),b=e.Partial(e.Record(e.Enum(l),e.Number({exclusiveMinimum:0})),{description:"Best-effort prompt cache lifetime in seconds for each retention tier. A missing tier means the lifetime is unknown, so Pi does not warm it."}),i={input:e.Number({description:"Input cost in USD per million tokens."}),output:e.Number({description:"Output cost in USD per million tokens."}),cacheRead:e.Number({description:"Cache-read cost in USD per million tokens."}),cacheWrite:e.Number({description:"Cache-write cost in USD per million tokens."})},T=e.Object(i),d=e.Object({inputTokensAbove:e.Number({description:"Use this tier when total request input exceeds this token count."}),...i}),N=e.Object({...i,tiers:e.Optional(e.Array(d,{description:"Request-wide pricing tiers. The highest matching input threshold applies to the full request."}))});function s(t){return e.Object({maxWidth:e.Optional(e.Integer({minimum:1})),maxHeight:e.Optional(e.Integer({minimum:1})),maxBytes:e.Optional(e.Integer({minimum:1,description:"Maximum base64-encoded payload size in bytes."})),jpegQuality:e.Optional(e.Integer({minimum:1,maximum:100}))},t)}o(s,"modelImageResizeOptions");const L=s(),x=e.Object({resize:e.Optional(s({description:"Cache-safe resize profile applied before a new image enters conversation history."})),maxPerMessage:e.Optional(e.Integer({minimum:1,description:"Maximum images accepted in one provider message."})),maxPerRequest:e.Optional(e.Integer({minimum:1,description:"Maximum images accepted across one provider request."}))}),R=e.Object({maxRequestBytes:e.Optional(e.Integer({minimum:1,description:"Maximum serialized provider request size in bytes."})),images:e.Optional(x)});export{p as CACHE_RETENTIONS,S as CacheRetentionSchema,c as MODEL_INPUT_MODALITIES,l as MODEL_PROMPT_CACHE_RETENTIONS,a as MODEL_THINKING_LEVELS,T as ModelCostRatesSchema,N as ModelCostSchema,d as ModelCostTierSchema,x as ModelImageInputLimitsSchema,L as ModelImageResizeOptionsSchema,R as ModelInputLimitsSchema,I as ModelInputModalitySchema,b as ModelPromptCacheSchema,u as ModelThinkingLevelSchema,n as THINKING_LEVELS,E as ThinkingLevelMapSchema,M as ThinkingLevelSchema};
|