@code-yeongyu/senpi-agent-core 2026.11.23 → 2026.11.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent-loop.js +15 -2
- package/package.json +3 -3
package/dist/agent-loop.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Agent loop that works with AgentMessage throughout.
|
|
3
3
|
* Transforms to Message[] only at the LLM call boundary.
|
|
4
4
|
*/
|
|
5
|
-
import { assistantRecords, carryAssistantCapture, getAssistantCapture, createInitialSystemMessage, EventStream, getCurrentTools, getToolStateChanges, isCursorExecResolved, isAssistantProgress, normalizeContext, supportsAllowedToolChoice, validateToolArguments, } from "@earendil-works/pi-ai";
|
|
5
|
+
import { assistantRecords, carryAssistantCapture, clampThinkingLevel, getAssistantCapture, createInitialSystemMessage, EventStream, getCurrentTools, getToolStateChanges, isCursorExecResolved, isAssistantProgress, normalizeContext, supportsAllowedToolChoice, validateToolArguments, } from "@earendil-works/pi-ai";
|
|
6
6
|
import { createTerminalFailureAssistantMessage, isStreamIdleTimeoutError, normalizeTerminalAssistantMessage, settleStopReason, shouldFinalizeIdleAsStop, shouldTerminateAssistantTurn, } from "./assistant-terminal-state.js";
|
|
7
7
|
import { createResponseTimingRecorder } from "./response-timing.js";
|
|
8
8
|
import { internalProgressSink } from "./internal-events.js";
|
|
@@ -331,6 +331,17 @@ async function runLoop(initialContext, newMessages, initialConfig, signal, emit,
|
|
|
331
331
|
}
|
|
332
332
|
await emit({ type: "agent_end", messages: newMessages });
|
|
333
333
|
}
|
|
334
|
+
/**
|
|
335
|
+
* The level a request is sent at. Thinking-off reaches a model whose ladder has no `off` (a thinking-only
|
|
336
|
+
* model such as Kimi K3.1 Pro) when a level is carried over from another model; that model rejects the
|
|
337
|
+
* request, so it is raised to the model's lowest supported level instead (omo#12316).
|
|
338
|
+
*/
|
|
339
|
+
function sendableReasoning(model, reasoning) {
|
|
340
|
+
if (reasoning !== undefined || !model.reasoning)
|
|
341
|
+
return reasoning;
|
|
342
|
+
const level = clampThinkingLevel(model, "off");
|
|
343
|
+
return level === "off" ? undefined : level;
|
|
344
|
+
}
|
|
334
345
|
/** Apply a `prepareNextTurn` or `prepareRequest` update to the loop config for this and later requests. */
|
|
335
346
|
function applyLoopUpdate(config, update) {
|
|
336
347
|
return {
|
|
@@ -500,9 +511,11 @@ async function streamAssistantResponse(context, config, signal, emit, streamFunc
|
|
|
500
511
|
const llmContext = await preStream.run(buildProviderContext(context, config, requestAbortController.signal));
|
|
501
512
|
// Resolve API key (important for expiring tokens)
|
|
502
513
|
const resolvedApiKey = (config.getApiKey ? await preStream.run(config.getApiKey(config.model.provider)) : undefined) || config.apiKey;
|
|
514
|
+
const reasoning = sendableReasoning(config.model, config.reasoning);
|
|
503
515
|
responseTiming.requested();
|
|
504
516
|
const response = await preStream.run(streamFunction(config.model, llmContext, {
|
|
505
517
|
...config,
|
|
518
|
+
reasoning,
|
|
506
519
|
streamKind: "main",
|
|
507
520
|
apiKey: resolvedApiKey,
|
|
508
521
|
signal: requestAbortController.signal,
|
|
@@ -530,7 +543,7 @@ async function streamAssistantResponse(context, config, signal, emit, streamFunc
|
|
|
530
543
|
closeAssistantIterator(late[Symbol.asyncIterator]());
|
|
531
544
|
});
|
|
532
545
|
// Record the requested level, whichever stream function answered.
|
|
533
|
-
const result = async () => Object.assign(await response.result(), { thinkingLevel:
|
|
546
|
+
const result = async () => Object.assign(await response.result(), { thinkingLevel: reasoning ?? "off" });
|
|
534
547
|
// Without an internal listener the loop reads the public stream exactly as before: no records, no carriers.
|
|
535
548
|
const sink = config[internalProgressSink];
|
|
536
549
|
const records = sink ? assistantRecords(response) : response;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@code-yeongyu/senpi-agent-core",
|
|
3
|
-
"version": "2026.11.
|
|
3
|
+
"version": "2026.11.25",
|
|
4
4
|
"description": "General-purpose agent with transport abstraction, state management, and attachment support",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -76,8 +76,8 @@
|
|
|
76
76
|
},
|
|
77
77
|
"dependencies": {
|
|
78
78
|
"@earendil-works/chord": "0.99.1",
|
|
79
|
-
"@earendil-works/pi-ai": "npm:@code-yeongyu/senpi-ai@2026.11.
|
|
80
|
-
"@earendil-works/pi-telemetry": "npm:@code-yeongyu/senpi-telemetry@2026.11.
|
|
79
|
+
"@earendil-works/pi-ai": "npm:@code-yeongyu/senpi-ai@2026.11.25",
|
|
80
|
+
"@earendil-works/pi-telemetry": "npm:@code-yeongyu/senpi-telemetry@2026.11.25",
|
|
81
81
|
"diff": "9.0.0",
|
|
82
82
|
"ignore": "7.0.9",
|
|
83
83
|
"typebox": "1.3.34",
|