@springbrand/agent-runtime 0.1.3-alpha.0 → 0.1.3-alpha.1
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/package.json +1 -1
- package/src/index.ts +9 -11
- package/src/kernel/bindings.ts +26 -3
- package/src/kernel/extensions.ts +1 -1
- package/src/kernel/profile.ts +3 -4
- package/src/layers/orchestration/temporary-agent/runner.ts +0 -65
- package/src/pi/assembly/context.ts +1 -3
- package/src/pi/assembly/snapshot.ts +12 -7
- package/src/pi/runtime-adapter/assembly.ts +16 -66
- package/src/pi/runtime-adapter/execution.ts +18 -6
- package/src/pi/tool/compiler.ts +5 -32
- package/src/pi/tool/core-host.ts +10 -7
- package/src/pi/tool/core.ts +7 -4
- package/src/pi/tool/mcp.ts +2 -2
- package/src/pi/tool/schedule.ts +46 -2
- package/src/pi/tool/skill.ts +1 -1
- package/src/plugins.ts +311 -521
- package/src/runtime.ts +5 -4
package/src/runtime.ts
CHANGED
|
@@ -927,18 +927,19 @@ export abstract class AgentRuntimeKernel<
|
|
|
927
927
|
}
|
|
928
928
|
}
|
|
929
929
|
|
|
930
|
-
//
|
|
930
|
+
// 作用:按当前模型输入预算压缩 Pi 上下文。
|
|
931
931
|
// 调用:Pi Turn 适配器在发模型请求前通过 `transformContext` 回调。
|
|
932
|
-
//
|
|
932
|
+
// 原因:模型窗口必须预留最大输出,压缩也必须使用本 Snapshot 的模型和密钥。
|
|
933
933
|
private async transformPiContext(
|
|
934
934
|
submissionId: string,
|
|
935
935
|
messages: Parameters<PiRuntimeTranscript["compactContext"]>[0],
|
|
936
936
|
signal?: AbortSignal,
|
|
937
937
|
): ReturnType<PiRuntimeTranscript["compactContext"]> {
|
|
938
938
|
const snapshot = this.assembly();
|
|
939
|
+
const inputBudget = snapshot.pi.model.contextWindow -
|
|
940
|
+
snapshot.pi.model.maxTokens;
|
|
939
941
|
const compacted = await this.transcript.compactContext(messages, {
|
|
940
|
-
compactAfterTokens:
|
|
941
|
-
snapshot.profile.memory.compactAfterTokens,
|
|
942
|
+
compactAfterTokens: inputBudget * 0.85,
|
|
942
943
|
model: snapshot.pi.model,
|
|
943
944
|
apiKey: this.pi.resolveApiKey(
|
|
944
945
|
snapshot.bindings.provider,
|