@code-yeongyu/senpi 2026.10.10-2 → 2026.10.10-3
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 +20 -0
- package/dist/bundle/chunks/{anthropic-messages-CVXI6CLT.js → anthropic-messages-OE3QBX4P.js} +1 -1
- package/dist/bundle/chunks/{app-server-command-WZG7WYMD.js → app-server-command-DVWM37GF.js} +1 -1
- package/dist/bundle/chunks/{chunk-Q2ZTPMWD.js → chunk-4TK7VCZZ.js} +1 -1
- package/dist/bundle/chunks/{chunk-SB22X6ZR.js → chunk-H4UIUFU5.js} +1 -1
- package/dist/bundle/chunks/chunk-I5HLTDT4.js +2 -0
- package/dist/bundle/chunks/{chunk-W6B7SEAK.js → chunk-MT2C4I5R.js} +17 -16
- package/dist/bundle/chunks/{chunk-LSE7KE2C.js → chunk-ODYQK5XJ.js} +1 -1
- package/dist/bundle/chunks/{chunk-ULYOMGXX.js → chunk-PDSG6VER.js} +1 -1
- package/dist/bundle/chunks/{chunk-3YXB7Z7O.js → chunk-Z7MMKKIY.js} +1 -1
- package/dist/bundle/chunks/{cli-main-T4T5UNRJ.js → cli-main-B4S4DGBX.js} +1 -1
- package/dist/bundle/chunks/{help-fast-path-44VUGB7H.js → help-fast-path-EHRZEBRO.js} +1 -1
- package/dist/bundle/chunks/{host-command-X64D7PT3.js → host-command-VATE7HRG.js} +1 -1
- package/dist/bundle/chunks/{interactive-mode-ULFSI46Z.js → interactive-mode-QOFA64JL.js} +1 -1
- package/dist/bundle/chunks/{multi-session-host-VM7WJBC5.js → multi-session-host-E5RDPWQN.js} +1 -1
- package/dist/bundle/chunks/{openai-completions-6HU7GIGD.js → openai-completions-Q2LEWXEC.js} +1 -1
- package/dist/bundle/chunks/{openai-responses-S4QYZXF3.js → openai-responses-DHGWSTZM.js} +1 -1
- package/dist/bundle/chunks/{package-manager-cli-OAFUQY7E.js → package-manager-cli-YGTWXRG5.js} +1 -1
- package/dist/bundle/chunks/{rotation-stream-ZJQ6I2RZ.js → rotation-stream-C5BM7TMM.js} +1 -1
- package/dist/bundle/chunks/{rpc-mode-XVRJJG3K.js → rpc-mode-HDAGQ4X3.js} +1 -1
- package/dist/bundle/chunks/{session-control-endpoint-FEGOYWHN.js → session-control-endpoint-NABTZHCZ.js} +1 -1
- package/dist/bundle/chunks/{session-picker-R5N2EKUS.js → session-picker-O7OESJWU.js} +1 -1
- package/dist/bundle/chunks/session-worker.js +17 -16
- package/dist/bundle/cli.js +1 -1
- package/dist/bundle/index.js +1 -1
- package/dist/bundle/rpc-entry.js +1 -1
- package/dist/bundle/runtime-manifest.json +1 -1
- package/dist/core/agent-session.d.ts +2 -0
- package/dist/core/agent-session.js +18 -4
- package/dist/core/extensions/builtin/goal/lifecycle-helpers.js +1 -1
- package/dist/core/extensions/builtin/goal/monitor-continuation.js +3 -1
- package/dist/core/extensions/builtin/goal/prompt.d.ts +6 -1
- package/dist/core/extensions/builtin/goal/prompt.js +32 -1
- package/dist/core/extensions/builtin/websearch/websearch/config.js +2 -0
- package/dist/core/extensions/builtin/websearch/websearch/provider-endpoints.js +1 -0
- package/dist/core/extensions/builtin/websearch/websearch/providers/keenable.d.ts +3 -0
- package/dist/core/extensions/builtin/websearch/websearch/providers/keenable.js +55 -0
- package/dist/core/extensions/builtin/websearch/websearch/providers.js +2 -0
- package/dist/core/extensions/builtin/websearch/websearch/types.d.ts +1 -1
- package/dist/core/model-config-schema.d.ts +5 -0
- package/dist/core/model-config-schema.js +1 -0
- package/dist/core/provider-composer.js +5 -1
- package/dist/core/provider-timeout-retry.d.ts +7 -1
- package/dist/core/provider-timeout-retry.js +23 -12
- package/dist/core/reload-veto.d.ts +1 -1
- package/dist/core/reload-veto.js +7 -1
- package/docs/models.md +34 -0
- package/docs/web-search.md +3 -1
- package/package.json +6 -6
- package/dist/bundle/chunks/chunk-YSPHACIN.js +0 -2
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { createRequire as __piCreateRequire } from "node:module"; const require = __piCreateRequire(import.meta.url); { const __piWorkerThreads = require("node:worker_threads"); if (typeof __piWorkerThreads.markAsUncloneable !== "function") { __piWorkerThreads.markAsUncloneable = () => {}; } }
|
|
2
|
+
var forcedToolChoiceRefusals=new Set;function isRecord(value){return typeof value=="object"&&value!==null}function extractHttpStatus(error){if(!isRecord(error))return;let status=error.status;if(typeof status=="number")return status;let response=error.response;if(isRecord(response)&&typeof response.status=="number")return response.status}function errorMessage(error){return error instanceof Error?error.message:typeof error=="string"?error:String(error)}var IN_BAND_BEFORE_CONTENT=Symbol.for("senpi.forcedToolChoice.inBandBeforeContent");function isInBandBeforeContent(error){return isRecord(error)&&error[IN_BAND_BEFORE_CONTENT]===!0}function markInBandBeforeContent(error){let marked=isRecord(error)?error:new Error(errorMessage(error));try{Object.defineProperty(marked,IN_BAND_BEFORE_CONTENT,{value:!0})}catch{}return marked}function isRequestRefusal(error){let status=extractHttpStatus(error);return status===400||status===void 0&&isInBandBeforeContent(error)}async function primeStreamUntilContent(stream,hasContent,maxBuffered=64){let iterator=stream[Symbol.asyncIterator](),buffered=[],ended=!1;try{for(;buffered.length<maxBuffered;){let next=await iterator.next();if(next.done){ended=!0;break}if(buffered.push(next.value),hasContent(next.value))break}}catch(error){throw markInBandBeforeContent(error)}return{async*[Symbol.asyncIterator](){try{if(yield*buffered,ended)return;for(;;){let next=await iterator.next();if(next.done)return;yield next.value}}finally{ended||await iterator.return?.()}}}}function isForcedToolChoiceUnsupportedError(error,sentForcedToolChoice){if(!sentForcedToolChoice||!isRequestRefusal(error))return!1;let message=errorMessage(error);return/tool[_\s-]?choices?\b.*?(not\s+(?:currently\s+)?compatible|incompatible|not\s+(?:currently\s+)?supported|unsupported)/is.test(message)||/forces?\s+tool\s+use.*?(not\s+(?:currently\s+)?compatible|incompatible|not\s+(?:currently\s+)?supported|unsupported)/is.test(message)||/does\s+not\s+support\s+forced\s+tool[_\s-]?choices?/is.test(message)||/\bonly\s+[`"]*auto(?:matic)?[`"]*\s.{0,40}?tool[_\s-]?choice/is.test(message)||/thinking\s+may\s+not\s+be\s+enabled\s+when\s+tool[_\s-]?choice\s+forces\s+tool\s+use/is.test(message)||/tool[_\s-]?choice\s+cannot\s+force\s+tool\s+use/is.test(message)}function forcedToolName(toolChoice){if(!isRecord(toolChoice))return;let named=isRecord(toolChoice.function)?toolChoice.function.name:toolChoice.name;return typeof named=="string"&&named.length>0?named:void 0}function toolNames(tools){return Array.isArray(tools)?tools.map(tool=>{if(!isRecord(tool))return;let named=isRecord(tool.function)?tool.function.name:tool.name;return typeof named=="string"?named:void 0}):[]}function escapeRegExp(text){return text.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function refusalNamesForcedTool(error,params){if(!isRequestRefusal(error))return!1;let name=forcedToolName(params.tool_choice);if(name===void 0)return!1;let message=errorMessage(error),index=toolNames(params.tools).indexOf(name);return index>=0&&new RegExp(`\\btools(?:\\.${index}|\\[${index}\\])(?!\\d)`).test(message)?!0:new RegExp(`['"\`]${escapeRegExp(name)}['"\`]`).test(message)}function omitToolChoiceParam(params){let nextParams={...params};return delete nextParams.tool_choice,nextParams}function refusalKey(target){return JSON.stringify([target.api,target.provider,target.baseUrl,target.id])}function hasRefusedForcedToolChoice(target){return forcedToolChoiceRefusals.has(refusalKey(target))}async function sendWithForcedToolChoiceFallback(request){let forced=request.isForced(request.params.tool_choice);if(forced&&(!request.acceptsForcedToolChoice||hasRefusedForcedToolChoice(request.target))){let params=omitToolChoiceParam(request.params);return{params,result:await request.send(params)}}try{return{params:request.params,result:await request.send(request.params)}}catch(error){if(!isForcedToolChoiceUnsupportedError(error,forced)&&!(forced&&refusalNamesForcedTool(error,request.params)))throw error;let params=omitToolChoiceParam(request.params),result=await request.send(params);return/thinking/i.test(errorMessage(error))||forcedToolChoiceRefusals.add(refusalKey(request.target)),{params,result}}}export{primeStreamUntilContent,hasRefusedForcedToolChoice,sendWithForcedToolChoiceFallback};
|