@octopi-agent/engine 0.90.11 → 0.97.15
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/config-admin/agent-presets.d.ts +70 -0
- package/dist/config-admin/agent-presets.js +243 -0
- package/dist/config-admin/discover.d.ts +30 -0
- package/dist/config-admin/discover.js +48 -0
- package/dist/config-admin/env.d.ts +22 -0
- package/dist/config-admin/env.js +41 -0
- package/dist/config-admin/index.d.ts +20 -0
- package/dist/config-admin/index.js +15 -0
- package/dist/config-admin/model-presets.d.ts +75 -0
- package/dist/config-admin/model-presets.js +249 -0
- package/dist/config-admin/name-guard.d.ts +14 -0
- package/dist/config-admin/name-guard.js +24 -0
- package/dist/config-admin/patch.d.ts +56 -0
- package/dist/config-admin/patch.js +201 -0
- package/dist/config-admin/port.d.ts +68 -0
- package/dist/config-admin/port.js +21 -0
- package/dist/config-admin/redact.d.ts +39 -0
- package/dist/config-admin/redact.js +42 -0
- package/dist/config-schema/agent.d.ts +43 -1
- package/dist/config-schema/context.d.ts +6 -1
- package/dist/config-schema/context.js +8 -0
- package/dist/config-schema/engine.d.ts +106 -4
- package/dist/config-schema/governance.d.ts +43 -1
- package/dist/config-schema/governance.js +157 -0
- package/dist/config-schema/models.d.ts +5 -2
- package/dist/config-schema/models.js +4 -1
- package/dist/config-schema/observability.d.ts +9 -0
- package/dist/config-schema/observability.js +29 -0
- package/dist/config-schema/run.d.ts +3 -0
- package/dist/config-schema/run.js +14 -0
- package/dist/config.d.ts +29 -4
- package/dist/config.js +15 -4
- package/dist/harness/activation/dispatcher.d.ts +8 -2
- package/dist/harness/activation/dispatcher.js +33 -5
- package/dist/harness/activation/inbox.d.ts +87 -0
- package/dist/harness/activation/inbox.js +169 -0
- package/dist/harness/activation/runtime.d.ts +9 -8
- package/dist/harness/activation/runtime.js +100 -8
- package/dist/harness/activation/types.d.ts +19 -0
- package/dist/harness/activation/types.js +2 -0
- package/dist/harness/agent/builder.d.ts +15 -1
- package/dist/harness/agent/builder.js +31 -10
- package/dist/harness/agent/config-bridge.d.ts +5 -0
- package/dist/harness/agent/config-bridge.js +3 -0
- package/dist/harness/agent/config-integrity.d.ts +72 -0
- package/dist/harness/agent/config-integrity.js +146 -0
- package/dist/harness/agent/wire-agent-builder.js +2 -1
- package/dist/harness/collaboration/autonomous-subsystem/think/executor.js +3 -1
- package/dist/harness/collaboration/delegation/child-run.js +21 -5
- package/dist/harness/collaboration/delegation/notifier.js +4 -3
- package/dist/harness/collaboration/delegation/service.js +2 -3
- package/dist/harness/collaboration/delegation/wiring.js +6 -5
- package/dist/harness/collaboration/orchestration/reflector/llm-reflector.d.ts +1 -1
- package/dist/harness/collaboration/orchestration/reflector/llm-reflector.js +1 -1
- package/dist/harness/context/capabilities/compact/engine.d.ts +30 -0
- package/dist/harness/context/capabilities/compact/engine.js +198 -46
- package/dist/harness/context/capabilities/compact/handover.d.ts +78 -0
- package/dist/harness/context/capabilities/compact/handover.js +107 -0
- package/dist/harness/context/capabilities/compact/index.d.ts +3 -1
- package/dist/harness/context/capabilities/compact/index.js +2 -1
- package/dist/harness/context/capabilities/compact/types.d.ts +30 -1
- package/dist/harness/context/capabilities/summary/executor.js +2 -1
- package/dist/harness/context/capabilities/summary/policies.js +8 -5
- package/dist/harness/context/constitution/default-agents.md +11 -10
- package/dist/harness/context/default-context-engine.d.ts +34 -4
- package/dist/harness/context/default-context-engine.js +194 -49
- package/dist/harness/context/hybrid-compressor.js +6 -0
- package/dist/harness/context/llm-summarizer.d.ts +2 -8
- package/dist/harness/context/llm-summarizer.js +69 -91
- package/dist/harness/context/message-selector.js +4 -3
- package/dist/harness/context/summarize.d.ts +2 -0
- package/dist/harness/context/summarize.js +7 -2
- package/dist/harness/context/truncate-compressor.js +7 -0
- package/dist/harness/context/turn-envelope.d.ts +3 -2
- package/dist/harness/context/turn-envelope.js +3 -2
- package/dist/harness/context/types.d.ts +33 -1
- package/dist/harness/extension/execution-environment/dangerous-commands.d.ts +28 -0
- package/dist/harness/extension/execution-environment/dangerous-commands.js +129 -0
- package/dist/harness/extension/execution-environment/effect-policy.d.ts +127 -8
- package/dist/harness/extension/execution-environment/effect-policy.js +244 -19
- package/dist/harness/extension/execution-environment/index.d.ts +4 -2
- package/dist/harness/extension/execution-environment/index.js +2 -1
- package/dist/harness/extension/execution-environment/kill-switch.d.ts +34 -0
- package/dist/harness/extension/execution-environment/kill-switch.js +46 -0
- package/dist/harness/extension/execution-environment/ops-audit.d.ts +200 -0
- package/dist/harness/extension/execution-environment/ops-audit.js +338 -0
- package/dist/harness/extension/execution-environment/privileged-exec.d.ts +158 -0
- package/dist/harness/extension/execution-environment/privileged-exec.js +418 -0
- package/dist/harness/extension/execution-environment/process-info.d.ts +180 -0
- package/dist/harness/extension/execution-environment/process-info.js +466 -0
- package/dist/harness/extension/execution-environment/process-isolation.d.ts +7 -0
- package/dist/harness/extension/execution-environment/process-isolation.js +9 -0
- package/dist/harness/extension/execution-environment/sandbox.d.ts +109 -0
- package/dist/harness/extension/execution-environment/sandbox.js +228 -21
- package/dist/harness/extension/execution-environment/tool-capabilities.d.ts +1 -1
- package/dist/harness/extension/execution-environment/tool-capabilities.js +6 -0
- package/dist/harness/extension/execution-environment/types.d.ts +19 -0
- package/dist/harness/extension/plugin-ecosystem/channel-types.d.ts +5 -0
- package/dist/harness/extension/plugin-ecosystem/tools/allowlisted-run.js +33 -0
- package/dist/harness/extension/plugin-ecosystem/tools/ask-user.d.ts +4 -5
- package/dist/harness/extension/plugin-ecosystem/tools/ask-user.js +5 -15
- package/dist/harness/extension/plugin-ecosystem/tools/builtin.d.ts +3 -0
- package/dist/harness/extension/plugin-ecosystem/tools/builtin.js +53 -2
- package/dist/harness/extension/plugin-ecosystem/tools/index.d.ts +2 -0
- package/dist/harness/extension/plugin-ecosystem/tools/index.js +2 -0
- package/dist/harness/extension/plugin-ecosystem/tools/privileged-tool.d.ts +43 -0
- package/dist/harness/extension/plugin-ecosystem/tools/privileged-tool.js +350 -0
- package/dist/harness/extension/plugin-ecosystem/tools/process-tools.d.ts +30 -0
- package/dist/harness/extension/plugin-ecosystem/tools/process-tools.js +137 -0
- package/dist/harness/governance/human-in-the-loop/decision-cache.d.ts +54 -4
- package/dist/harness/governance/human-in-the-loop/decision-cache.js +42 -16
- package/dist/harness/governance/security/temp-path.d.ts +9 -0
- package/dist/harness/governance/security/temp-path.js +13 -2
- package/dist/harness/governance/session-acl/seed-roles.js +14 -0
- package/dist/harness/index.d.ts +2 -0
- package/dist/harness/index.js +2 -0
- package/dist/harness/knowledge/fts.js +1 -2
- package/dist/harness/knowledge/index-store.js +59 -9
- package/dist/harness/memory/sqlite/keyword-search.d.ts +1 -0
- package/dist/harness/memory/sqlite/keyword-search.js +4 -3
- package/dist/harness/observability/observer/hub.js +8 -0
- package/dist/harness/observability/observer/run-snapshot.js +1 -0
- package/dist/harness/observability/observer/types.d.ts +4 -0
- package/dist/harness/run/agent/agent.d.ts +7 -0
- package/dist/harness/run/agent/agent.js +23 -1
- package/dist/harness/run/reliability/fallback-provider.d.ts +117 -5
- package/dist/harness/run/reliability/fallback-provider.js +262 -22
- package/dist/harness/run/reliability/harness-events.d.ts +24 -1
- package/dist/harness/run/reliability/model-error-policy.d.ts +32 -0
- package/dist/harness/run/reliability/model-error-policy.js +42 -0
- package/dist/harness/run/reliability/provider-wrapper.js +29 -2
- package/dist/harness/run/reliability/refusal-guard.d.ts +20 -0
- package/dist/harness/run/reliability/refusal-guard.js +102 -0
- package/dist/harness/run/reliability/run-agent.js +231 -33
- package/dist/harness/run/run-guard/default-run-guard.js +1 -1
- package/dist/harness/run/run-scope.d.ts +31 -0
- package/dist/harness/run/runner.d.ts +116 -2
- package/dist/harness/run/runner.js +547 -41
- package/dist/harness/session/attachments/llm-intent.js +2 -1
- package/dist/harness/session/tasks/render.d.ts +4 -1
- package/dist/harness/session/tasks/render.js +10 -7
- package/dist/harness/shared/events/agent-event-map.d.ts +66 -0
- package/dist/harness/shared/events/agent-event-map.js +5 -0
- package/dist/index.d.ts +3 -3
- package/dist/index.js +2 -2
- package/dist/integration/agent-runtime/channel-message-source.js +19 -1
- package/dist/integration/index.d.ts +2 -0
- package/dist/integration/index.js +1 -0
- package/dist/integration/observability/loop-watchdog.d.ts +56 -0
- package/dist/integration/observability/loop-watchdog.js +177 -0
- package/dist/integration/observability/metrics.d.ts +3 -0
- package/dist/integration/observability/metrics.js +18 -7
- package/dist/integration/providers/anthropic.d.ts +23 -0
- package/dist/integration/providers/anthropic.js +97 -12
- package/dist/integration/providers/fetch-timeout.d.ts +42 -0
- package/dist/integration/providers/fetch-timeout.js +51 -0
- package/dist/integration/providers/openai.d.ts +10 -0
- package/dist/integration/providers/openai.js +58 -11
- package/dist/integration/providers/provider-diagnostics.d.ts +80 -0
- package/dist/integration/providers/provider-diagnostics.js +89 -0
- package/dist/integration/providers/timeout-coherence.d.ts +52 -0
- package/dist/integration/providers/timeout-coherence.js +68 -0
- package/dist/integration/providers/wire-dump.d.ts +62 -0
- package/dist/integration/providers/wire-dump.js +111 -2
- package/dist/integration/storage/jsonl.js +4 -1
- package/dist/subsystems/cognition-steward/conceptualize/handler.js +1 -1
- package/dist/subsystems/memory-steward/backfill/handler.js +1 -1
- package/dist/subsystems/wisdom-steward/formation/handler.js +1 -1
- package/package.json +3 -2
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Provider 诊断载体 — 把「观测事实」挂在错误对象上而不改变错误语义
|
|
3
|
+
*
|
|
4
|
+
* 为什么不用普通属性(`err.status` / `err.code`):
|
|
5
|
+
* `classifyError`(core/loop/error-classifier.ts)会用字符串键 `status` / `statusCode`
|
|
6
|
+
* / `code` / `httpStatus` 提取状态码,进而改变错误分类与重试决策。诊断信息只服务观测,
|
|
7
|
+
* 不能顺带改变行为,因此全部走 Symbol 键 —— 错误对象的字符串键形状与分类结果保持原样。
|
|
8
|
+
*
|
|
9
|
+
* 背景:一次 52 分钟的停滞只能靠「耗时 300s」反推原因,因为 result 记录只有
|
|
10
|
+
* `outcome: 'error'` 一个词。本模块补齐状态码、错误文本与流内保活计数。
|
|
11
|
+
*
|
|
12
|
+
* @module integration/providers/provider-diagnostics
|
|
13
|
+
*/
|
|
14
|
+
/** HTTP 状态码(响应非 2xx 时由 provider 附加) */
|
|
15
|
+
export declare const HTTP_STATUS: unique symbol;
|
|
16
|
+
/** 流内诊断(流异常收尾时由 provider 附加) */
|
|
17
|
+
export declare const STREAM_DIAG: unique symbol;
|
|
18
|
+
/**
|
|
19
|
+
* 流式调用中的观测事实
|
|
20
|
+
*
|
|
21
|
+
* 用于区分两种沉默:
|
|
22
|
+
* - `keepalives > 0`:上游连接活着,只是不产出内容(排队 / 长 prefill)
|
|
23
|
+
* - `keepalives === 0`:上游既无内容也无心跳,更像连接已死
|
|
24
|
+
*/
|
|
25
|
+
export interface ProviderStreamDiag {
|
|
26
|
+
/** SSE ping / keepalive 心跳数(不计入内容 chunk;SSE 注释行同口径计入) */
|
|
27
|
+
keepalives: number;
|
|
28
|
+
/** 已产出的内容 chunk 数(content / reasoning / tool_call) */
|
|
29
|
+
contentChunks: number;
|
|
30
|
+
/** 已读取的原始字节数 */
|
|
31
|
+
bytes: number;
|
|
32
|
+
/** 首个 wire 字节到达时刻(epoch ms):区分「首包前静默」与「中段断流」 */
|
|
33
|
+
firstBytesAt?: number;
|
|
34
|
+
/** 最后一个 wire 字节到达时刻(epoch ms):回答「被掐前 wire 到底动没动」 */
|
|
35
|
+
lastBytesAt?: number;
|
|
36
|
+
/** 是否读到协议终止(done / [DONE] / EOF) */
|
|
37
|
+
sawEnd: boolean;
|
|
38
|
+
}
|
|
39
|
+
/** 创建一个空诊断累加器(原地累加,异常路径读同一对象) */
|
|
40
|
+
export declare function createStreamDiag(): ProviderStreamDiag;
|
|
41
|
+
/**
|
|
42
|
+
* 记录一次 wire 读取(字节数 + 首末字节时刻)
|
|
43
|
+
*
|
|
44
|
+
* 时间戳是失败取证的关键:聚合计数回答不了「静默的 300s 里 wire 动没动」——
|
|
45
|
+
* 10-27 事故就卡在这个问题上(streamBytes 与生成速率物理上不相容)。
|
|
46
|
+
*
|
|
47
|
+
* @param diag - 诊断累加器
|
|
48
|
+
* @param byteLength - 本次读取的字节数
|
|
49
|
+
*/
|
|
50
|
+
export declare function recordWireBytes(diag: ProviderStreamDiag, byteLength: number): void;
|
|
51
|
+
/**
|
|
52
|
+
* 在错误对象上附加 HTTP 状态码
|
|
53
|
+
*
|
|
54
|
+
* @param err - provider 抛出的错误
|
|
55
|
+
* @param status - 上游响应状态码
|
|
56
|
+
*/
|
|
57
|
+
export declare function attachHttpStatus(err: unknown, status: number): void;
|
|
58
|
+
/**
|
|
59
|
+
* 在错误对象上附加流诊断快照
|
|
60
|
+
*
|
|
61
|
+
* 传引用即可:读取方(wire-dump)在 catch 中同步取值,不保留到下一次调用。
|
|
62
|
+
*
|
|
63
|
+
* @param err - provider 抛出的错误
|
|
64
|
+
* @param diag - 当前调用的诊断累加器
|
|
65
|
+
*/
|
|
66
|
+
export declare function attachStreamDiag(err: unknown, diag: ProviderStreamDiag): void;
|
|
67
|
+
/**
|
|
68
|
+
* 读取附加的 HTTP 状态码
|
|
69
|
+
*
|
|
70
|
+
* @param err - 任意错误值
|
|
71
|
+
* @returns 状态码;未附加时为 undefined
|
|
72
|
+
*/
|
|
73
|
+
export declare function readHttpStatus(err: unknown): number | undefined;
|
|
74
|
+
/**
|
|
75
|
+
* 读取附加的流诊断
|
|
76
|
+
*
|
|
77
|
+
* @param err - 任意错误值
|
|
78
|
+
* @returns 诊断快照;未附加时为 undefined
|
|
79
|
+
*/
|
|
80
|
+
export declare function readStreamDiag(err: unknown): ProviderStreamDiag | undefined;
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Provider 诊断载体 — 把「观测事实」挂在错误对象上而不改变错误语义
|
|
3
|
+
*
|
|
4
|
+
* 为什么不用普通属性(`err.status` / `err.code`):
|
|
5
|
+
* `classifyError`(core/loop/error-classifier.ts)会用字符串键 `status` / `statusCode`
|
|
6
|
+
* / `code` / `httpStatus` 提取状态码,进而改变错误分类与重试决策。诊断信息只服务观测,
|
|
7
|
+
* 不能顺带改变行为,因此全部走 Symbol 键 —— 错误对象的字符串键形状与分类结果保持原样。
|
|
8
|
+
*
|
|
9
|
+
* 背景:一次 52 分钟的停滞只能靠「耗时 300s」反推原因,因为 result 记录只有
|
|
10
|
+
* `outcome: 'error'` 一个词。本模块补齐状态码、错误文本与流内保活计数。
|
|
11
|
+
*
|
|
12
|
+
* @module integration/providers/provider-diagnostics
|
|
13
|
+
*/
|
|
14
|
+
/** HTTP 状态码(响应非 2xx 时由 provider 附加) */
|
|
15
|
+
export const HTTP_STATUS = Symbol.for('@octopi-agent/engine.provider.httpStatus');
|
|
16
|
+
/** 流内诊断(流异常收尾时由 provider 附加) */
|
|
17
|
+
export const STREAM_DIAG = Symbol.for('@octopi-agent/engine.provider.streamDiag');
|
|
18
|
+
/** 创建一个空诊断累加器(原地累加,异常路径读同一对象) */
|
|
19
|
+
export function createStreamDiag() {
|
|
20
|
+
return { keepalives: 0, contentChunks: 0, bytes: 0, sawEnd: false };
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* 记录一次 wire 读取(字节数 + 首末字节时刻)
|
|
24
|
+
*
|
|
25
|
+
* 时间戳是失败取证的关键:聚合计数回答不了「静默的 300s 里 wire 动没动」——
|
|
26
|
+
* 10-27 事故就卡在这个问题上(streamBytes 与生成速率物理上不相容)。
|
|
27
|
+
*
|
|
28
|
+
* @param diag - 诊断累加器
|
|
29
|
+
* @param byteLength - 本次读取的字节数
|
|
30
|
+
*/
|
|
31
|
+
export function recordWireBytes(diag, byteLength) {
|
|
32
|
+
const now = Date.now();
|
|
33
|
+
if (diag.firstBytesAt === undefined)
|
|
34
|
+
diag.firstBytesAt = now;
|
|
35
|
+
diag.lastBytesAt = now;
|
|
36
|
+
diag.bytes += byteLength;
|
|
37
|
+
}
|
|
38
|
+
/** 非对象无法挂载 Symbol(`throw 'string'` 一类),静默跳过 */
|
|
39
|
+
function canAttach(target) {
|
|
40
|
+
return typeof target === 'object' && target !== null;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* 在错误对象上附加 HTTP 状态码
|
|
44
|
+
*
|
|
45
|
+
* @param err - provider 抛出的错误
|
|
46
|
+
* @param status - 上游响应状态码
|
|
47
|
+
*/
|
|
48
|
+
export function attachHttpStatus(err, status) {
|
|
49
|
+
if (!canAttach(err))
|
|
50
|
+
return;
|
|
51
|
+
err[HTTP_STATUS] = status;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* 在错误对象上附加流诊断快照
|
|
55
|
+
*
|
|
56
|
+
* 传引用即可:读取方(wire-dump)在 catch 中同步取值,不保留到下一次调用。
|
|
57
|
+
*
|
|
58
|
+
* @param err - provider 抛出的错误
|
|
59
|
+
* @param diag - 当前调用的诊断累加器
|
|
60
|
+
*/
|
|
61
|
+
export function attachStreamDiag(err, diag) {
|
|
62
|
+
if (!canAttach(err))
|
|
63
|
+
return;
|
|
64
|
+
err[STREAM_DIAG] = diag;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* 读取附加的 HTTP 状态码
|
|
68
|
+
*
|
|
69
|
+
* @param err - 任意错误值
|
|
70
|
+
* @returns 状态码;未附加时为 undefined
|
|
71
|
+
*/
|
|
72
|
+
export function readHttpStatus(err) {
|
|
73
|
+
if (!canAttach(err))
|
|
74
|
+
return undefined;
|
|
75
|
+
const status = err[HTTP_STATUS];
|
|
76
|
+
return typeof status === 'number' ? status : undefined;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* 读取附加的流诊断
|
|
80
|
+
*
|
|
81
|
+
* @param err - 任意错误值
|
|
82
|
+
* @returns 诊断快照;未附加时为 undefined
|
|
83
|
+
*/
|
|
84
|
+
export function readStreamDiag(err) {
|
|
85
|
+
if (!canAttach(err))
|
|
86
|
+
return undefined;
|
|
87
|
+
const diag = err[STREAM_DIAG];
|
|
88
|
+
return diag != null && typeof diag === 'object' ? diag : undefined;
|
|
89
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 模型超时口径一致性检查
|
|
3
|
+
*
|
|
4
|
+
* 背景(2026-10-27 事故):三个超时各自为政,配置写了 900s 却完全不生效——
|
|
5
|
+
* engine watchdog `modelCall.idleTimeoutMs`(默认 300s)只认内容 chunk、
|
|
6
|
+
* provider `timeoutSeconds`(按任意字节重置)、undici fetch 默认
|
|
7
|
+
* headersTimeout / bodyTimeout 各 300s 三者互相踩踏。
|
|
8
|
+
*
|
|
9
|
+
* 其中 transport 层已修复(`fetch-timeout.ts`:provider 为 fetch 显式传入
|
|
10
|
+
* dispatcher,headers/body 超时对齐自身 `timeoutMs`)。本模块负责剩余的
|
|
11
|
+
* **配置口径**自检——只告警、不改变行为,也不擅自改配置。
|
|
12
|
+
*
|
|
13
|
+
* 口径原则:只对「写了也永远不会生效」的配置告警。provider 总超时与引擎的
|
|
14
|
+
* `absoluteTimeoutMs`(单次调用总上限)是同一量纲;`idleTimeoutMs` 是按内容
|
|
15
|
+
* chunk 重置的空闲窗口,与 provider 计时不可直接比较(谁更小谁先生效都属
|
|
16
|
+
* 正常设计),因此不在此制造互相矛盾的双向建议。默认配置绝不告警。
|
|
17
|
+
*
|
|
18
|
+
* @module integration/providers/timeout-coherence
|
|
19
|
+
*/
|
|
20
|
+
/** 一条配置一致性问题 */
|
|
21
|
+
export interface TimeoutCoherenceIssue {
|
|
22
|
+
/** 稳定机器码,供测试与文档引用 */
|
|
23
|
+
code: 'provider_timeout_exceeds_absolute' | 'fallback_chain_exceeds_idle';
|
|
24
|
+
message: string;
|
|
25
|
+
}
|
|
26
|
+
/** 检查输入 */
|
|
27
|
+
export interface TimeoutCoherenceInput {
|
|
28
|
+
/** `modelCall.idleTimeoutMs`(未配置时用引擎默认) */
|
|
29
|
+
idleTimeoutMs?: number;
|
|
30
|
+
/** `modelCall.absoluteTimeoutMs`(未配置时用引擎默认) */
|
|
31
|
+
absoluteTimeoutMs?: number;
|
|
32
|
+
/** provider 名 → 其 `timeoutSeconds` */
|
|
33
|
+
providerTimeouts: Record<string, number | undefined>;
|
|
34
|
+
/** `modelCall.fallbackAttemptTtftMs` */
|
|
35
|
+
fallbackAttemptTtftMs?: number;
|
|
36
|
+
/** 各 agent 的最长回退链节点数(含主模型);未提供则跳过该检查 */
|
|
37
|
+
maxFallbackChainLength?: number;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* 检查模型超时配置是否自洽
|
|
41
|
+
*
|
|
42
|
+
* @param input - 待检查的配置快照
|
|
43
|
+
* @returns 问题清单(空数组 = 自洽)
|
|
44
|
+
*/
|
|
45
|
+
export declare function checkTimeoutCoherence(input: TimeoutCoherenceInput): TimeoutCoherenceIssue[];
|
|
46
|
+
/**
|
|
47
|
+
* 打印检查结果(启动期调用)
|
|
48
|
+
*
|
|
49
|
+
* @param issues - `checkTimeoutCoherence` 的返回值
|
|
50
|
+
* @param logger - 输出函数(默认 console.warn)
|
|
51
|
+
*/
|
|
52
|
+
export declare function logTimeoutCoherence(issues: TimeoutCoherenceIssue[], logger?: (msg: string) => void): void;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 模型超时口径一致性检查
|
|
3
|
+
*
|
|
4
|
+
* 背景(2026-10-27 事故):三个超时各自为政,配置写了 900s 却完全不生效——
|
|
5
|
+
* engine watchdog `modelCall.idleTimeoutMs`(默认 300s)只认内容 chunk、
|
|
6
|
+
* provider `timeoutSeconds`(按任意字节重置)、undici fetch 默认
|
|
7
|
+
* headersTimeout / bodyTimeout 各 300s 三者互相踩踏。
|
|
8
|
+
*
|
|
9
|
+
* 其中 transport 层已修复(`fetch-timeout.ts`:provider 为 fetch 显式传入
|
|
10
|
+
* dispatcher,headers/body 超时对齐自身 `timeoutMs`)。本模块负责剩余的
|
|
11
|
+
* **配置口径**自检——只告警、不改变行为,也不擅自改配置。
|
|
12
|
+
*
|
|
13
|
+
* 口径原则:只对「写了也永远不会生效」的配置告警。provider 总超时与引擎的
|
|
14
|
+
* `absoluteTimeoutMs`(单次调用总上限)是同一量纲;`idleTimeoutMs` 是按内容
|
|
15
|
+
* chunk 重置的空闲窗口,与 provider 计时不可直接比较(谁更小谁先生效都属
|
|
16
|
+
* 正常设计),因此不在此制造互相矛盾的双向建议。默认配置绝不告警。
|
|
17
|
+
*
|
|
18
|
+
* @module integration/providers/timeout-coherence
|
|
19
|
+
*/
|
|
20
|
+
import { DEFAULT_MODEL_CALL_ABSOLUTE_TIMEOUT_MS, DEFAULT_MODEL_CALL_IDLE_TIMEOUT_MS, } from '@octopi-agent/core/loop/agent-loop.js';
|
|
21
|
+
/**
|
|
22
|
+
* 检查模型超时配置是否自洽
|
|
23
|
+
*
|
|
24
|
+
* @param input - 待检查的配置快照
|
|
25
|
+
* @returns 问题清单(空数组 = 自洽)
|
|
26
|
+
*/
|
|
27
|
+
export function checkTimeoutCoherence(input) {
|
|
28
|
+
const issues = [];
|
|
29
|
+
const idle = input.idleTimeoutMs ?? DEFAULT_MODEL_CALL_IDLE_TIMEOUT_MS;
|
|
30
|
+
const absolute = input.absoluteTimeoutMs ?? DEFAULT_MODEL_CALL_ABSOLUTE_TIMEOUT_MS;
|
|
31
|
+
for (const [name, timeoutSeconds] of Object.entries(input.providerTimeouts)) {
|
|
32
|
+
if (timeoutSeconds === undefined)
|
|
33
|
+
continue;
|
|
34
|
+
const providerTimeoutMs = timeoutSeconds * 1000;
|
|
35
|
+
// 同量纲比较:provider 总超时 vs 引擎单次调用总上限。
|
|
36
|
+
// 超过 absolute 意味着该 provider 超时在模型调用上永远不会生效——写了也是死配置。
|
|
37
|
+
if (providerTimeoutMs > absolute) {
|
|
38
|
+
issues.push({
|
|
39
|
+
code: 'provider_timeout_exceeds_absolute',
|
|
40
|
+
message: `provider "${name}" timeoutSeconds=${timeoutSeconds} (${providerTimeoutMs}ms) 大于 modelCall.absoluteTimeoutMs (${absolute}ms),` +
|
|
41
|
+
`引擎会先达到单次调用总上限:该 provider 超时在模型调用上永远不会生效。`,
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
const chainLength = input.maxFallbackChainLength ?? 0;
|
|
46
|
+
if (chainLength > 1) {
|
|
47
|
+
const attempt = input.fallbackAttemptTtftMs;
|
|
48
|
+
if (attempt !== undefined && attempt * chainLength >= idle) {
|
|
49
|
+
issues.push({
|
|
50
|
+
code: 'fallback_chain_exceeds_idle',
|
|
51
|
+
message: `回退链最坏耗时 ${attempt}ms × ${chainLength} = ${attempt * chainLength}ms 已达/超过 modelCall.idleTimeoutMs (${idle}ms):` +
|
|
52
|
+
`整条链无法在外层 watchdog 内跑完,最后一个候选可能拿不到机会。`,
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return issues;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* 打印检查结果(启动期调用)
|
|
60
|
+
*
|
|
61
|
+
* @param issues - `checkTimeoutCoherence` 的返回值
|
|
62
|
+
* @param logger - 输出函数(默认 console.warn)
|
|
63
|
+
*/
|
|
64
|
+
export function logTimeoutCoherence(issues, logger = (msg) => console.warn(msg)) {
|
|
65
|
+
for (const issue of issues) {
|
|
66
|
+
logger(`[modelCall.timeout] ${issue.code}: ${issue.message}`);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
@@ -40,6 +40,8 @@ export interface WireDumpConfig {
|
|
|
40
40
|
maxCallsPerSession?: number;
|
|
41
41
|
/** 单次请求体落盘上限(字节,缺省 8_000_000);超出则只写索引 */
|
|
42
42
|
maxBodyBytes?: number;
|
|
43
|
+
/** 响应留痕(正文+finishReason)截断上限(字符,缺省 2_000) */
|
|
44
|
+
maxResponseChars?: number;
|
|
43
45
|
}
|
|
44
46
|
/** sink 构造选项 = 配置 + 运行时身份解析 */
|
|
45
47
|
export interface WireDumpHookOptions extends WireDumpConfig {
|
|
@@ -60,6 +62,54 @@ export interface WireCallResult {
|
|
|
60
62
|
/** 首个 chunk 到达耗时(仅 stream) */
|
|
61
63
|
ttftMs?: number;
|
|
62
64
|
durationMs: number;
|
|
65
|
+
/** 失败原因(仅 error;由包装层从错误对象提取,观测专用) */
|
|
66
|
+
error?: WireCallErrorInfo;
|
|
67
|
+
/** 响应留痕(成功也记;内容过滤拒答是 200 内联) */
|
|
68
|
+
response?: WireCallResponseInfo;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* 失败留痕
|
|
72
|
+
*
|
|
73
|
+
* 此前 result 记录只有 `outcome: 'error'`,一次 52 分钟停滞只能靠耗时反推原因。
|
|
74
|
+
* 这里补上错误类型、消息、HTTP 状态码与流内心跳计数,使「上游静默」可被直接读出。
|
|
75
|
+
*/
|
|
76
|
+
export interface WireCallErrorInfo {
|
|
77
|
+
/** 错误构造器名(TypeError / Error / AbortError …) */
|
|
78
|
+
name?: string;
|
|
79
|
+
/** 错误消息(截断,避免超长响应体撑爆索引) */
|
|
80
|
+
message: string;
|
|
81
|
+
/** 上游 HTTP 状态码(非 2xx 时由 provider 附加) */
|
|
82
|
+
httpStatus?: number;
|
|
83
|
+
/** 系统错误码(ECONNRESET / UND_ERR_SOCKET …) */
|
|
84
|
+
code?: string;
|
|
85
|
+
/** 流内保活心跳数:>0 表示上游连接活着但未产出内容 */
|
|
86
|
+
keepalives?: number;
|
|
87
|
+
/** 流内已产出的内容 chunk 数 */
|
|
88
|
+
contentChunks?: number;
|
|
89
|
+
/** 流内已读取字节数 */
|
|
90
|
+
streamBytes?: number;
|
|
91
|
+
/** 首个 wire 字节到达时刻(epoch ms):区分「首包前静默」与「中段断流」 */
|
|
92
|
+
firstBytesAt?: number;
|
|
93
|
+
/** 最后一个 wire 字节到达时刻(epoch ms):回答「被掐前 wire 到底动没动」 */
|
|
94
|
+
lastBytesAt?: number;
|
|
95
|
+
/** 是否读到协议终止(done / EOF) */
|
|
96
|
+
sawEnd?: boolean;
|
|
97
|
+
/** 回退链单节点预算耗尽时的预算值(毫秒);存在即「节点只是慢」,非用户取消 */
|
|
98
|
+
attemptBudgetMs?: number;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* 响应留痕(成功也记)
|
|
102
|
+
*
|
|
103
|
+
* 内容过滤拒答常以 200 内联返回(reasoning 照常、正文被替换成罐头拒答),
|
|
104
|
+
* 错误面完全看不出来;不记响应正文就无法回答「为什么被判 high risk」。
|
|
105
|
+
*/
|
|
106
|
+
export interface WireCallResponseInfo {
|
|
107
|
+
/** 响应正文(截断至 maxResponseChars;content 增量累积,空正文不落字段) */
|
|
108
|
+
text?: string;
|
|
109
|
+
/** 推理增量汇总(同截断;部分拒答只留 reasoning,须一并留痕) */
|
|
110
|
+
reasoning?: string;
|
|
111
|
+
/** 结束原因(stop / tool_calls / length / error) */
|
|
112
|
+
finishReason?: string;
|
|
63
113
|
}
|
|
64
114
|
/** 单次调用的收尾句柄 */
|
|
65
115
|
export interface WireCallHandle {
|
|
@@ -112,6 +162,8 @@ export interface WireDumpResultRecord {
|
|
|
112
162
|
outcome: 'ok' | 'error' | 'abandoned';
|
|
113
163
|
durationMs: number;
|
|
114
164
|
ttftMs?: number;
|
|
165
|
+
error?: WireCallErrorInfo;
|
|
166
|
+
response?: WireCallResponseInfo;
|
|
115
167
|
usage?: {
|
|
116
168
|
inputCachedTokens: number;
|
|
117
169
|
inputUncachedTokens: number;
|
|
@@ -122,6 +174,16 @@ export interface WireDumpResultRecord {
|
|
|
122
174
|
};
|
|
123
175
|
}
|
|
124
176
|
export type WireDumpIndexRecord = WireDumpRequestRecord | WireDumpResultRecord;
|
|
177
|
+
/**
|
|
178
|
+
* 把错误提取成可落盘的留痕
|
|
179
|
+
*
|
|
180
|
+
* 只读取观测属性(Symbol 键),不解析 message 文本:分类决策依赖 message,
|
|
181
|
+
* 落盘侧再做正则解析会让「记录」与「决策」两套口径漂移。
|
|
182
|
+
*
|
|
183
|
+
* @param err - 调用失败时的原始错误
|
|
184
|
+
* @returns 可序列化的错误留痕
|
|
185
|
+
*/
|
|
186
|
+
export declare function describeWireError(err: unknown): WireCallErrorInfo;
|
|
125
187
|
/** 缺省落盘根目录 */
|
|
126
188
|
export declare function defaultWireDumpDir(): string;
|
|
127
189
|
/**
|
|
@@ -21,6 +21,72 @@ import { createHash, randomBytes } from 'node:crypto';
|
|
|
21
21
|
import { appendFileSync, existsSync, mkdirSync, readFileSync, readdirSync, unlinkSync, writeFileSync } from 'node:fs';
|
|
22
22
|
import { join } from 'node:path';
|
|
23
23
|
import { getOctopiHome } from '../../paths.js';
|
|
24
|
+
import { readHttpStatus, readStreamDiag, } from './provider-diagnostics.js';
|
|
25
|
+
import { readAttemptBudgetExhausted } from '../../harness/run/reliability/fallback-provider.js';
|
|
26
|
+
/**
|
|
27
|
+
* 响应留痕构造:正文/推理为空时不落字段——chat 与 stream 共用同一形态,
|
|
28
|
+
* 下游不得按 `text === ''` 与 `=== undefined` 分叉解读(对称性)。
|
|
29
|
+
*
|
|
30
|
+
* @param text - 响应正文
|
|
31
|
+
* @param reasoning - 推理汇总
|
|
32
|
+
* @param finishReason - 结束原因
|
|
33
|
+
* @returns 留痕对象;三项皆空时 undefined
|
|
34
|
+
*/
|
|
35
|
+
function buildWireResponse(text, reasoning, finishReason) {
|
|
36
|
+
const info = {};
|
|
37
|
+
if (text.length > 0)
|
|
38
|
+
info.text = text;
|
|
39
|
+
if (reasoning.length > 0)
|
|
40
|
+
info.reasoning = reasoning;
|
|
41
|
+
if (finishReason !== undefined)
|
|
42
|
+
info.finishReason = finishReason;
|
|
43
|
+
return Object.keys(info).length > 0 ? info : undefined;
|
|
44
|
+
}
|
|
45
|
+
/** 错误消息落盘上限(字符):上游错误体可能带整段响应,撑爆索引无意义 */
|
|
46
|
+
const MAX_ERROR_MESSAGE_CHARS = 800;
|
|
47
|
+
/** 流式响应正文累积硬上限(字符):装饰器层的内存护栏,最终截断在 sink 的 maxResponseChars */
|
|
48
|
+
const RESPONSE_CAPTURE_HARD_CAP = 16_384;
|
|
49
|
+
/**
|
|
50
|
+
* 把错误提取成可落盘的留痕
|
|
51
|
+
*
|
|
52
|
+
* 只读取观测属性(Symbol 键),不解析 message 文本:分类决策依赖 message,
|
|
53
|
+
* 落盘侧再做正则解析会让「记录」与「决策」两套口径漂移。
|
|
54
|
+
*
|
|
55
|
+
* @param err - 调用失败时的原始错误
|
|
56
|
+
* @returns 可序列化的错误留痕
|
|
57
|
+
*/
|
|
58
|
+
export function describeWireError(err) {
|
|
59
|
+
const isError = err instanceof Error;
|
|
60
|
+
const message = isError ? err.message : String(err);
|
|
61
|
+
const info = {
|
|
62
|
+
message: message.length > MAX_ERROR_MESSAGE_CHARS ? `${message.slice(0, MAX_ERROR_MESSAGE_CHARS)}…` : message,
|
|
63
|
+
};
|
|
64
|
+
if (isError && err.name)
|
|
65
|
+
info.name = err.name;
|
|
66
|
+
if (typeof err === 'object' && err !== null) {
|
|
67
|
+
const code = err.code;
|
|
68
|
+
if (typeof code === 'string')
|
|
69
|
+
info.code = code;
|
|
70
|
+
}
|
|
71
|
+
const httpStatus = readHttpStatus(err);
|
|
72
|
+
if (httpStatus !== undefined)
|
|
73
|
+
info.httpStatus = httpStatus;
|
|
74
|
+
// 回退链单节点预算耗尽:与「用户主动取消」在留痕里必须可辨,
|
|
75
|
+
// 否则「节点只是慢」会被误读成「用户点了停止」。
|
|
76
|
+
const budgetMs = readAttemptBudgetExhausted(err);
|
|
77
|
+
if (budgetMs !== undefined)
|
|
78
|
+
info.attemptBudgetMs = budgetMs;
|
|
79
|
+
const diag = readStreamDiag(err);
|
|
80
|
+
if (diag) {
|
|
81
|
+
info.keepalives = diag.keepalives;
|
|
82
|
+
info.contentChunks = diag.contentChunks;
|
|
83
|
+
info.streamBytes = diag.bytes;
|
|
84
|
+
info.firstBytesAt = diag.firstBytesAt;
|
|
85
|
+
info.lastBytesAt = diag.lastBytesAt;
|
|
86
|
+
info.sawEnd = diag.sawEnd;
|
|
87
|
+
}
|
|
88
|
+
return info;
|
|
89
|
+
}
|
|
24
90
|
/** 缺省落盘根目录 */
|
|
25
91
|
export function defaultWireDumpDir() {
|
|
26
92
|
return join(getOctopiHome(), 'logs', 'llm-requests');
|
|
@@ -75,6 +141,7 @@ export function createWireDumpSink(options = {}) {
|
|
|
75
141
|
const rootDir = options.dir ?? defaultWireDumpDir();
|
|
76
142
|
const maxCalls = options.maxCallsPerSession ?? 200;
|
|
77
143
|
const maxBodyBytes = options.maxBodyBytes ?? 8_000_000;
|
|
144
|
+
const maxResponseChars = options.maxResponseChars ?? 2_000;
|
|
78
145
|
const resolveContext = options.resolveContext;
|
|
79
146
|
let seq = 0;
|
|
80
147
|
let queue = Promise.resolve();
|
|
@@ -237,6 +304,20 @@ export function createWireDumpSink(options = {}) {
|
|
|
237
304
|
outcome: result.outcome,
|
|
238
305
|
durationMs: Math.max(0, Math.round(result.durationMs)),
|
|
239
306
|
ttftMs: result.ttftMs != null ? Math.max(0, Math.round(result.ttftMs)) : undefined,
|
|
307
|
+
...(result.error ? { error: result.error } : {}),
|
|
308
|
+
...(result.response
|
|
309
|
+
? {
|
|
310
|
+
response: {
|
|
311
|
+
...result.response,
|
|
312
|
+
...(result.response.text != null
|
|
313
|
+
? { text: result.response.text.slice(0, maxResponseChars) }
|
|
314
|
+
: {}),
|
|
315
|
+
...(result.response.reasoning != null
|
|
316
|
+
? { reasoning: result.response.reasoning.slice(0, maxResponseChars) }
|
|
317
|
+
: {}),
|
|
318
|
+
},
|
|
319
|
+
}
|
|
320
|
+
: {}),
|
|
240
321
|
usage: result.usage
|
|
241
322
|
? {
|
|
242
323
|
inputCachedTokens: result.usage.inputCachedTokens,
|
|
@@ -343,11 +424,16 @@ export function withWireDump(inner, sink) {
|
|
|
343
424
|
const startedAt = Date.now();
|
|
344
425
|
try {
|
|
345
426
|
const res = await inner.chat(request);
|
|
346
|
-
handle?.finish({
|
|
427
|
+
handle?.finish({
|
|
428
|
+
outcome: 'ok',
|
|
429
|
+
usage: res.usage,
|
|
430
|
+
durationMs: Date.now() - startedAt,
|
|
431
|
+
response: buildWireResponse(res.content, res.reasoning ?? '', res.finishReason),
|
|
432
|
+
});
|
|
347
433
|
return res;
|
|
348
434
|
}
|
|
349
435
|
catch (err) {
|
|
350
|
-
handle?.finish({ outcome: 'error', durationMs: Date.now() - startedAt });
|
|
436
|
+
handle?.finish({ outcome: 'error', durationMs: Date.now() - startedAt, error: describeWireError(err) });
|
|
351
437
|
throw err;
|
|
352
438
|
}
|
|
353
439
|
},
|
|
@@ -363,12 +449,30 @@ export function withWireDump(inner, sink) {
|
|
|
363
449
|
let sawDone = false;
|
|
364
450
|
let completed = false;
|
|
365
451
|
let failed = false;
|
|
452
|
+
let failedErr;
|
|
453
|
+
/** 响应留痕累积(收尾统一截断;硬上限防流式长输出撑内存) */
|
|
454
|
+
let responseText = '';
|
|
455
|
+
let reasoningText = '';
|
|
456
|
+
let contentChunksSeen = 0;
|
|
457
|
+
let finishReason;
|
|
366
458
|
try {
|
|
367
459
|
for await (const chunk of inner.stream(request)) {
|
|
368
460
|
if (ttftMs == null)
|
|
369
461
|
ttftMs = Date.now() - startedAt;
|
|
370
462
|
if (chunk.type === 'done') {
|
|
371
463
|
sawDone = true;
|
|
464
|
+
finishReason = chunk.finishReason;
|
|
465
|
+
}
|
|
466
|
+
// done 携带全文的实现:仅当本流没有 content 增量时采用,避免正文重复一份
|
|
467
|
+
if (chunk.type === 'content' && typeof chunk.content === 'string') {
|
|
468
|
+
contentChunksSeen += 1;
|
|
469
|
+
responseText += chunk.content;
|
|
470
|
+
}
|
|
471
|
+
else if (chunk.type === 'reasoning' && typeof chunk.content === 'string') {
|
|
472
|
+
reasoningText += chunk.content;
|
|
473
|
+
}
|
|
474
|
+
else if (chunk.type === 'done' && typeof chunk.content === 'string' && contentChunksSeen === 0) {
|
|
475
|
+
responseText += chunk.content;
|
|
372
476
|
}
|
|
373
477
|
// usage 通常只在 done chunk 上;任何 chunk 携带都取,避免缺哨兵时丢掉已消耗额度
|
|
374
478
|
if (chunk.usage)
|
|
@@ -379,9 +483,12 @@ export function withWireDump(inner, sink) {
|
|
|
379
483
|
}
|
|
380
484
|
catch (err) {
|
|
381
485
|
failed = true;
|
|
486
|
+
failedErr = err;
|
|
382
487
|
throw err;
|
|
383
488
|
}
|
|
384
489
|
finally {
|
|
490
|
+
// 单个超大 chunk 也能顶穿上限:截断必须在累积之后
|
|
491
|
+
const response = buildWireResponse(responseText.slice(0, RESPONSE_CAPTURE_HARD_CAP), reasoningText.slice(0, RESPONSE_CAPTURE_HARD_CAP), finishReason);
|
|
385
492
|
handle.finish({
|
|
386
493
|
// 正常读完但服务端没发 done 哨兵(代理断流/兼容实现)不等于消费者放弃:
|
|
387
494
|
// 判 abandoned 会把真实完成记成"提前中断",并误报给 llm-diff
|
|
@@ -389,6 +496,8 @@ export function withWireDump(inner, sink) {
|
|
|
389
496
|
usage,
|
|
390
497
|
ttftMs,
|
|
391
498
|
durationMs: Date.now() - startedAt,
|
|
499
|
+
...(response ? { response } : {}),
|
|
500
|
+
...(failed ? { error: describeWireError(failedErr) } : {}),
|
|
392
501
|
});
|
|
393
502
|
}
|
|
394
503
|
},
|
|
@@ -339,11 +339,14 @@ export class JsonlSessionStore {
|
|
|
339
339
|
await mkdir(this.sessionsDir, { recursive: true });
|
|
340
340
|
await writeFile(this.sessionStateFile(sessionId), JSON.stringify({
|
|
341
341
|
agentId: prev?.agentId,
|
|
342
|
-
|
|
342
|
+
// 字段集必须与 save() 的 state 重写保持一致:漏写即静默清字段
|
|
343
|
+
//(contextDetachIndex 曾被漏掉——updateMetadata 后租约截断点归零,续跑全量灌窗)
|
|
344
|
+
primaryAgentId: prev?.primaryAgentId ?? prev?.agentId,
|
|
343
345
|
preferredAgentId: prev?.preferredAgentId,
|
|
344
346
|
switchAudit: prev?.switchAudit ?? [],
|
|
345
347
|
spawnBy: prev?.spawnBy,
|
|
346
348
|
participants: prev?.participants ?? [],
|
|
349
|
+
contextDetachIndex: prev?.contextDetachIndex,
|
|
347
350
|
contextCompact: prev?.contextCompact,
|
|
348
351
|
contextCompacts: prev?.contextCompacts,
|
|
349
352
|
lifecycle: prev?.lifecycle,
|
|
@@ -71,7 +71,7 @@ async function handler(input, deps) {
|
|
|
71
71
|
const res = await llmPort.chat({
|
|
72
72
|
systemPrompt: systemPrompt || undefined,
|
|
73
73
|
messages: [{ role: 'user', content: userText }],
|
|
74
|
-
|
|
74
|
+
// 温度留空:由模型配置(ModelInfo.temperature)或服务端默认决定
|
|
75
75
|
maxTokens: 2048,
|
|
76
76
|
});
|
|
77
77
|
if (res.finishReason === 'error') {
|
|
@@ -256,7 +256,7 @@ async function handler(input, deps) {
|
|
|
256
256
|
role: 'user',
|
|
257
257
|
content: `## Session evidence (session=${sessionId})\n${sessionText}\n\nExtract long-term memory propositions. Output strict JSON array only.`,
|
|
258
258
|
}],
|
|
259
|
-
|
|
259
|
+
// 温度留空:由模型配置(ModelInfo.temperature)或服务端默认决定
|
|
260
260
|
maxTokens: 2048,
|
|
261
261
|
});
|
|
262
262
|
if (res.finishReason === 'error') {
|
|
@@ -160,7 +160,7 @@ async function handler(_input, deps) {
|
|
|
160
160
|
const res = await llmPort.chat({
|
|
161
161
|
systemPrompt: systemPrompt || undefined,
|
|
162
162
|
messages: [{ role: 'user', content: `${pack.text}${conceptHint}` }],
|
|
163
|
-
|
|
163
|
+
// 温度留空:由模型配置(ModelInfo.temperature)或服务端默认决定
|
|
164
164
|
maxTokens: 2048,
|
|
165
165
|
});
|
|
166
166
|
if (res.finishReason === 'error') {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@octopi-agent/engine",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.97.15",
|
|
4
4
|
"description": "Octopi Engine — Harness product domains, library integrations, and embeddable Agent.run()",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -80,8 +80,9 @@
|
|
|
80
80
|
},
|
|
81
81
|
"dependencies": {
|
|
82
82
|
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
83
|
-
"@octopi-agent/core": "0.
|
|
83
|
+
"@octopi-agent/core": "0.97.15",
|
|
84
84
|
"js-yaml": "^4.3.2",
|
|
85
|
+
"undici": "^8.12.3",
|
|
85
86
|
"zod": "^4.4.3"
|
|
86
87
|
},
|
|
87
88
|
"optionalDependencies": {
|