@ai-setting/roy-agent-core 1.7.55 → 1.7.56
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/index.js +7 -7
- package/dist/env/agent/agent-component.d.ts +30 -0
- package/dist/env/agent/index.js +13 -12
- package/dist/env/commands/index.js +7 -7
- package/dist/env/context/index.js +3 -3
- package/dist/env/debug/index.js +7 -7
- package/dist/env/environment.d.ts +7 -0
- package/dist/env/event-source/index.js +16 -16
- package/dist/env/hook/index.js +5 -5
- package/dist/env/index.js +40 -39
- package/dist/env/llm/adapter-ai-sdk.d.ts +6 -0
- package/dist/env/llm/adapter-pi-ai.d.ts +5 -0
- package/dist/env/llm/index.js +10 -10
- package/dist/env/llm/invoke.d.ts +33 -1
- package/dist/env/llm/llm.d.ts +13 -0
- package/dist/env/llm/outbound-defense.d.ts +140 -0
- package/dist/env/log-trace/decorator.d.ts +46 -3
- package/dist/env/log-trace/index.d.ts +1 -0
- package/dist/env/log-trace/index.js +33 -7
- package/dist/env/log-trace/trace-filters.d.ts +127 -0
- package/dist/env/mcp/index.js +7 -7
- package/dist/env/memory/index.js +7 -7
- package/dist/env/plugin/index.js +7 -7
- package/dist/env/prompt/index.js +7 -7
- package/dist/env/session/index.js +11 -10
- package/dist/env/session/session-component.d.ts +4 -0
- package/dist/env/session/storage/index.js +5 -3
- package/dist/env/skill/index.js +7 -7
- package/dist/env/task/delegate/index.js +7 -7
- package/dist/env/task/index.js +12 -12
- package/dist/env/task/plugins/index.js +9 -9
- package/dist/env/task/storage/index.js +2 -2
- package/dist/env/task/tools/index.js +3 -3
- package/dist/env/tool/built-in/index.js +3 -3
- package/dist/env/tool/index.js +9 -9
- package/dist/env/workflow/engine/index.js +12 -12
- package/dist/env/workflow/hooks/index.js +7 -7
- package/dist/env/workflow/index.js +23 -22
- package/dist/env/workflow/nodes/index.js +2 -2
- package/dist/env/workflow/plugins/index.js +8 -8
- package/dist/env/workflow/service/index.js +2 -2
- package/dist/env/workflow/storage/index.js +3 -3
- package/dist/env/workflow/tools/index.js +15 -14
- package/dist/env/workflow/utils/index.js +5 -5
- package/dist/index.d.ts +1 -1
- package/dist/index.js +81 -55
- package/dist/shared/@ai-setting/{roy-agent-core-k25gv86p.js → roy-agent-core-0b3fdnn3.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-6qxh4xrm.js → roy-agent-core-0bmk44ye.js} +6 -6
- package/dist/shared/@ai-setting/{roy-agent-core-k8b440n3.js → roy-agent-core-16t0zfbk.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-4z3rq5gw.js → roy-agent-core-1pnfkspm.js} +2 -2
- package/dist/shared/@ai-setting/{roy-agent-core-a4vzsn0g.js → roy-agent-core-202v00x4.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-j2nvedt6.js → roy-agent-core-2044fbsd.js} +9 -9
- package/dist/shared/@ai-setting/{roy-agent-core-fs36xgcs.js → roy-agent-core-3dkzqqsd.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-qm9jda8p.js → roy-agent-core-3kz6934b.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-tjg71zqp.js → roy-agent-core-3mc6vmvj.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-tdbv7ff4.js → roy-agent-core-40xzbjtm.js} +2 -2
- package/dist/shared/@ai-setting/{roy-agent-core-athdr2m0.js → roy-agent-core-4zy2v3br.js} +10 -2
- package/dist/shared/@ai-setting/{roy-agent-core-t37wbysj.js → roy-agent-core-5gw6w424.js} +4 -4
- package/dist/shared/@ai-setting/{roy-agent-core-978b6wfx.js → roy-agent-core-5psjwd08.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-7evvpfwc.js → roy-agent-core-5rxs0ra3.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-12d2xap8.js → roy-agent-core-6qgq7h1g.js} +3 -3
- package/dist/shared/@ai-setting/{roy-agent-core-6167phd4.js → roy-agent-core-833t16n1.js} +3 -3
- package/dist/shared/@ai-setting/{roy-agent-core-2k4xffaa.js → roy-agent-core-8cgtwytv.js} +3 -3
- package/dist/shared/@ai-setting/{roy-agent-core-rx16h2m1.js → roy-agent-core-97eyghsp.js} +2 -2
- package/dist/shared/@ai-setting/{roy-agent-core-fvs48d38.js → roy-agent-core-98aa9r0x.js} +12 -7
- package/dist/shared/@ai-setting/{roy-agent-core-ytr2w0vb.js → roy-agent-core-9nv586rw.js} +57 -19
- package/dist/shared/@ai-setting/roy-agent-core-b599jgyd.js +578 -0
- package/dist/shared/@ai-setting/{roy-agent-core-zvemdfx5.js → roy-agent-core-bwzy00t2.js} +12 -5
- package/dist/shared/@ai-setting/{roy-agent-core-dwx9hjwx.js → roy-agent-core-c6at31ra.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-1cv9j4dg.js → roy-agent-core-d14h726p.js} +3 -3
- package/dist/shared/@ai-setting/{roy-agent-core-cd62e9p1.js → roy-agent-core-d4jpn06f.js} +22 -9
- package/dist/shared/@ai-setting/{roy-agent-core-e2z1etk4.js → roy-agent-core-e0wbq0qq.js} +7 -7
- package/dist/shared/@ai-setting/{roy-agent-core-vrsxhw9e.js → roy-agent-core-e677am8e.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-g36jevrk.js → roy-agent-core-ezsyyjxw.js} +9 -9
- package/dist/shared/@ai-setting/{roy-agent-core-ne2t1pay.js → roy-agent-core-f8sp1txg.js} +2 -2
- package/dist/shared/@ai-setting/{roy-agent-core-ak4dc3kg.js → roy-agent-core-gn8f4rhs.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-qcspfszy.js → roy-agent-core-gngjkw3b.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-9jzysq50.js → roy-agent-core-heft3j4c.js} +2 -2
- package/dist/shared/@ai-setting/{roy-agent-core-5apmk4qw.js → roy-agent-core-jszgaevt.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-nde5gzta.js → roy-agent-core-m8n0dffe.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-2bscfrr1.js → roy-agent-core-n3b7ztms.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-8eqngasy.js → roy-agent-core-nhk0dsxr.js} +13 -13
- package/dist/shared/@ai-setting/{roy-agent-core-b5ew8t0k.js → roy-agent-core-nntphgww.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-8s9jd2qy.js → roy-agent-core-nra8vfrs.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-2b8jtv7m.js → roy-agent-core-ns3pbyz4.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-7g03zkkb.js → roy-agent-core-pemxr5n4.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-skzjs973.js → roy-agent-core-pjxa78mp.js} +5 -5
- package/dist/shared/@ai-setting/{roy-agent-core-w527pcpe.js → roy-agent-core-q7zksbw0.js} +44 -493
- package/dist/shared/@ai-setting/{roy-agent-core-zd3ddm4k.js → roy-agent-core-qjjf4tjb.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-qamktze3.js → roy-agent-core-qyqnmz8c.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-9csa89jx.js → roy-agent-core-r9qe0ghe.js} +2 -2
- package/dist/shared/@ai-setting/{roy-agent-core-7qy3nffr.js → roy-agent-core-tc7gw38m.js} +2 -2
- package/dist/shared/@ai-setting/{roy-agent-core-aer5kw1j.js → roy-agent-core-v2188rnk.js} +16 -16
- package/dist/shared/@ai-setting/{roy-agent-core-mxdc756a.js → roy-agent-core-vmg30n5x.js} +7 -7
- package/dist/shared/@ai-setting/{roy-agent-core-rnwr39b0.js → roy-agent-core-w7hnjhvx.js} +5 -3
- package/dist/shared/@ai-setting/{roy-agent-core-dv714bqh.js → roy-agent-core-wafk25ff.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-9h72sk1n.js → roy-agent-core-xcq04fq0.js} +5 -5
- package/dist/shared/@ai-setting/{roy-agent-core-2gay3sjt.js → roy-agent-core-yg247mk4.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-0hq21px2.js → roy-agent-core-yv9x4wmg.js} +631 -35
- package/dist/shared/@ai-setting/{roy-agent-core-yhsssn86.js → roy-agent-core-zmeka63k.js} +1 -1
- package/package.json +1 -1
- package/dist/shared/@ai-setting/roy-agent-core-dsevjbck.js +0 -245
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview HTTP outbound defence middleware for the AI SDK (path B).
|
|
3
|
+
*
|
|
4
|
+
* ── Why this file exists (Task #4457 → #4465) ──────────────────────────
|
|
5
|
+
*
|
|
6
|
+
* roy-agent has TWO independent LLM request paths:
|
|
7
|
+
*
|
|
8
|
+
* path A `adapter-pi-ai.ts` → pi-ai `stream()` / `complete()`
|
|
9
|
+
* path B `invoke.ts` → AI SDK `streamText()` / `generateText()`
|
|
10
|
+
*
|
|
11
|
+
* path A is the normal route. path B runs when path A fails — see
|
|
12
|
+
* `llm.ts`: "adapter(pi-ai) failed, falling back to AI SDK invoke".
|
|
13
|
+
*
|
|
14
|
+
* Everything defensive was only ever wired into path A:
|
|
15
|
+
*
|
|
16
|
+
* #4398/#4403 `reasoning_content: ""` on assistant messages (via pi-ai's
|
|
17
|
+
* `onPayload` hook) — path A only
|
|
18
|
+
* #4383 `prompt_cache_key` / `prompt_cache_retention` (via pi-ai's
|
|
19
|
+
* `buildPiCacheOptions`) — path A only
|
|
20
|
+
*
|
|
21
|
+
* Byte-level packet capture of a production fallback proved the gap:
|
|
22
|
+
*
|
|
23
|
+
* | path | assistant msgs | with reasoning_content |
|
|
24
|
+
* |-------------------------|----------------|------------------------|
|
|
25
|
+
* | A `adapter.stream()` | 149 | 149 (100%) |
|
|
26
|
+
* | B `invoke()` (fallback) | 149 | 0 (0%) |
|
|
27
|
+
*
|
|
28
|
+
* Same endpoint, same conversation — the only difference was path B. The
|
|
29
|
+
* request came back `400 [invalid_request_error] The reasoning_content in the
|
|
30
|
+
* thinking mode must be passed back to the API.`
|
|
31
|
+
*
|
|
32
|
+
* The capture also showed path B sending no cache keys at all, so every
|
|
33
|
+
* fallback paid full input price.
|
|
34
|
+
*
|
|
35
|
+
* ── Why a fetch middleware, and not "patch the messages array" ─────────
|
|
36
|
+
*
|
|
37
|
+
* The obvious fix is to inject the field into the `ModelMessage[]` we hand the
|
|
38
|
+
* SDK. That approach is **silently useless** here, for two independent reasons
|
|
39
|
+
* discovered while localising this task:
|
|
40
|
+
*
|
|
41
|
+
* 1. `convertToSDKMessages()` writes cache options under the `openai`
|
|
42
|
+
* providerOptions key, but `@ai-sdk/openai-compatible` reads
|
|
43
|
+
* `openaiCompatible` / `<providerName>` and validates them against
|
|
44
|
+
* `openaiCompatibleLanguageModelChatOptions` — a schema with **no**
|
|
45
|
+
* `promptCacheKey` field at all. So the existing path B cache code has
|
|
46
|
+
* never emitted anything on the wire. (Confirmed by capture: 0 hits.)
|
|
47
|
+
*
|
|
48
|
+
* 2. The wire protocol is not always chat/completions. On
|
|
49
|
+
* `openai-responses` the top-level conversation list is `input`, not
|
|
50
|
+
* `messages`, so any messages-only patch is a no-op there.
|
|
51
|
+
*
|
|
52
|
+
* A `fetch` wrapper sits after all protocol conversion and after providerOptions
|
|
53
|
+
* validation, so it sees exactly the bytes that go on the wire — and it is the
|
|
54
|
+
* only option shared by all three provider factories (`createOpenAI`,
|
|
55
|
+
* `createOpenAICompatible`, `createAnthropic`); `transformRequestBody` exists
|
|
56
|
+
* on `openai-compatible` only.
|
|
57
|
+
*
|
|
58
|
+
* ── Cache-prefix safety (the constraint that shapes every decision here) ──
|
|
59
|
+
*
|
|
60
|
+
* Prompt caching is a PREFIX match: the bytes sent at turn N are the reusable
|
|
61
|
+
* prefix at turn N+1. Therefore:
|
|
62
|
+
*
|
|
63
|
+
* - the injected value is a constant `""`, appended at a deterministic
|
|
64
|
+
* position, on *every* assistant message of *every* turn;
|
|
65
|
+
* - the field is only added when absent (idempotent, no double-injection);
|
|
66
|
+
* - the guard is NARROW: non-DeepSeek providers never get the field, because
|
|
67
|
+
* they either reject unknown fields or hash assistant messages into their
|
|
68
|
+
* own prefix — injecting would be a pure cache regression.
|
|
69
|
+
*
|
|
70
|
+
* Both guarantees are covered by tests in `fallback-path-defense.test.ts`.
|
|
71
|
+
*/
|
|
72
|
+
/** Wire protocols we know how to patch. */
|
|
73
|
+
export type WireProtocol = "openai-chat" | "openai-responses" | "anthropic" | "other";
|
|
74
|
+
export interface OutboundDefenseTarget {
|
|
75
|
+
/** Configured provider id (may be a gateway, e.g. `opencodego`). */
|
|
76
|
+
provider?: string;
|
|
77
|
+
/** Model id actually requested — decides DeepSeek-family membership. */
|
|
78
|
+
modelId?: string;
|
|
79
|
+
/** Conversation id; becomes `prompt_cache_key` for OpenAI-family protocols. */
|
|
80
|
+
sessionId?: string;
|
|
81
|
+
/**
|
|
82
|
+
* Cache retention preference, mirroring pi-ai's `cacheRetention`:
|
|
83
|
+
* - `"long"` → `prompt_cache_key` + `prompt_cache_retention: "24h"`
|
|
84
|
+
* - `"short"` → `prompt_cache_key` only
|
|
85
|
+
* - `"none"` → neither
|
|
86
|
+
*
|
|
87
|
+
* When omitted, OpenAI-family protocols default to `"long"` so path B
|
|
88
|
+
* matches what path A does through `buildPiCacheOptions()` (which defaults
|
|
89
|
+
* to `"long"` for `openai-completions`).
|
|
90
|
+
*/
|
|
91
|
+
cacheRetention?: "none" | "short" | "long";
|
|
92
|
+
/**
|
|
93
|
+
* Restricts which patches may be applied. Omitted → auto-detect from the
|
|
94
|
+
* body shape (permissive; used by unit tests and by callers that already
|
|
95
|
+
* know the endpoint speaks OpenAI).
|
|
96
|
+
*
|
|
97
|
+
* Production passes this explicitly so an Anthropic request can never
|
|
98
|
+
* receive OpenAI-only fields (`prompt_cache_key`) or a stray
|
|
99
|
+
* `reasoning_content` that the Messages API would reject.
|
|
100
|
+
*/
|
|
101
|
+
wireProtocol?: WireProtocol;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Apply both defences to a parsed request body, returning a NEW object.
|
|
105
|
+
*
|
|
106
|
+
* Pure and synchronous, so it can be unit-tested without any HTTP machinery.
|
|
107
|
+
* Returns the original reference when nothing changes, which keeps the
|
|
108
|
+
* "untouched for non-DeepSeek providers" guarantee cheap to assert.
|
|
109
|
+
*/
|
|
110
|
+
export declare function applyOutboundDefense(body: Record<string, unknown>, target: OutboundDefenseTarget): Record<string, unknown>;
|
|
111
|
+
/**
|
|
112
|
+
* Wrap a `fetch` implementation with the outbound defences.
|
|
113
|
+
*
|
|
114
|
+
* The wrapper is deliberately fail-open: anything it cannot understand
|
|
115
|
+
* (non-string body, unparsable JSON, unexpected shape) is forwarded to the
|
|
116
|
+
* inner fetch **completely unchanged**. A broken defence must never turn a
|
|
117
|
+
* recoverable LLM call into a hard failure — path B only runs *because* we are
|
|
118
|
+
* already in a degraded state.
|
|
119
|
+
*
|
|
120
|
+
* @param target provider/model/session of this call
|
|
121
|
+
* @param inner the fetch to delegate to (defaults to globalThis.fetch)
|
|
122
|
+
*/
|
|
123
|
+
export declare function createOutboundDefenseFetch(target: OutboundDefenseTarget, inner?: typeof fetch): typeof fetch;
|
|
124
|
+
/**
|
|
125
|
+
* Map a pi-ai `apiProtocol` (the vocabulary `resolveApiProtocol()` speaks) onto
|
|
126
|
+
* this module's wire-protocol vocabulary.
|
|
127
|
+
*
|
|
128
|
+
* Task #4465 cross-validation (C1): the initial implementation hardcoded the
|
|
129
|
+
* wire protocol per *provider id*, but path A derives it from the **endpoint**
|
|
130
|
+
* (`resolveApiProtocol(provider, baseURL)`). The two disagree for real configs —
|
|
131
|
+
* e.g. the production `minimax` provider points at
|
|
132
|
+
* `https://api.minimaxi.com/anthropic`, which path A classifies as
|
|
133
|
+
* `anthropic-messages` while a per-id table says "OpenAI chat". Injecting
|
|
134
|
+
* OpenAI-only `prompt_cache_key` onto an Anthropic-protocol endpoint would be
|
|
135
|
+
* wrong (and pointless) there.
|
|
136
|
+
*
|
|
137
|
+
* So callers should derive the protocol the same way path A does and hand the
|
|
138
|
+
* result through this mapper.
|
|
139
|
+
*/
|
|
140
|
+
export declare function wireProtocolFromApiProtocol(apiProtocol: string | undefined): WireProtocol;
|
|
@@ -8,15 +8,56 @@
|
|
|
8
8
|
export interface TracedOptions {
|
|
9
9
|
name?: string;
|
|
10
10
|
recordParams?: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* ★ 2026-10-22:**result 是否写进 DB**(默认 **true** = 写)。
|
|
13
|
+
*
|
|
14
|
+
* 为什么默认是 true:单个返回值通常并不大,真正把 traces.db 撑到 169GB 的是
|
|
15
|
+
* **不断累积的入参**(每轮 LLM 请求都带完整 system prompt + 全量历史)。
|
|
16
|
+
* 所以默认保留 result(不改变既有调用方的数据可见性),瘦身交给
|
|
17
|
+
* `paramFilter` / `resultFilter`:需要截断的 span 显式声明摘要即可。
|
|
18
|
+
*
|
|
19
|
+
* 现在的语义:
|
|
20
|
+
* - 有 `resultFilter` → 存 filter 产出的摘要(filter 失效时退回本选项裁决)
|
|
21
|
+
* - `recordResultToDb: true` → 强制存**完整** result(优先于 resultFilter)
|
|
22
|
+
* - 否则按本选项:`true`(默认)存完整 result / `false` 显式不存
|
|
23
|
+
*
|
|
24
|
+
* 「日志里要不要打」由 `logResult` 单独控制,与本选项解耦。
|
|
25
|
+
*/
|
|
11
26
|
recordResult?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* ★ 2026-10-22:**强制把完整 result 写进 DB**,即使 `recordResult: false`。
|
|
29
|
+
*
|
|
30
|
+
* 背景:`recordResult` 原本只控制日志,DB 里始终存全量 result,导致
|
|
31
|
+
* traces.db 膨胀到 169GB。修复后 `recordResult: false` 意味着「不入库」,
|
|
32
|
+
* 但少数场景确实需要完整返回值(例如把 result 当业务数据读的下游)。
|
|
33
|
+
* 这些场景用本选项显式声明 —— **默认不存,需要就显式开**。
|
|
34
|
+
*/
|
|
35
|
+
recordResultToDb?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* ★ 2026-10-22:**日志里是否打印 result**(与「DB 存不存」解耦)。
|
|
38
|
+
*
|
|
39
|
+
* 背景:改造前 `recordResult` 同时控制日志与 DB。DB 瘦身时把它改成 false,
|
|
40
|
+
* 会连带让 app.log 里的 LLM 响应消失 —— DB 省了体积,排障能力也一起没了。
|
|
41
|
+
*
|
|
42
|
+
* 语义:不设时跟随 `recordResult`(向后兼容);
|
|
43
|
+
* 显式设 `true` 可实现「DB 不存完整 result,但日志照打」。
|
|
44
|
+
*/
|
|
45
|
+
logResult?: boolean;
|
|
12
46
|
recordError?: boolean;
|
|
13
47
|
log?: boolean;
|
|
14
48
|
maxLogSize?: number;
|
|
15
49
|
paramFilter?: (args: any[], argNames?: string[]) => Record<string, any>;
|
|
16
50
|
/**
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
51
|
+
* result filter —— 把返回值压成一份**摘要**。
|
|
52
|
+
*
|
|
53
|
+
* 摘要的键会被摊平到 span 的顶层属性(便于 `debug trace` 直接看字段),
|
|
54
|
+
* ⚠️ **同时它就是 DB 里 `result` 列的内容** —— 也就是说这个 filter 不只是
|
|
55
|
+
* 「额外加几个属性」,它**替换**了原本要存的完整返回值。
|
|
56
|
+
*
|
|
57
|
+
* 想保留完整 result,请显式设 `recordResultToDb: true`(它优先于本 filter)。
|
|
58
|
+
*
|
|
59
|
+
* 若 filter 抛异常或没有返回可用对象,会**退回** `recordResult` 的裁决,
|
|
60
|
+
* 不会静默丢掉调用方明确要求记录的 result。
|
|
20
61
|
*/
|
|
21
62
|
resultFilter?: (result: any) => Record<string, any>;
|
|
22
63
|
/**
|
|
@@ -78,6 +119,8 @@ export declare function TracedLightweight(options?: {
|
|
|
78
119
|
export declare function wrapFunction<T extends (...args: any[]) => any>(fn: T, name: string, options?: {
|
|
79
120
|
recordParams?: boolean;
|
|
80
121
|
recordResult?: boolean;
|
|
122
|
+
recordResultToDb?: boolean;
|
|
123
|
+
logResult?: boolean;
|
|
81
124
|
recordError?: boolean;
|
|
82
125
|
log?: boolean;
|
|
83
126
|
maxLogSize?: number;
|
|
@@ -12,3 +12,4 @@ export { propagation, serialize, parse, type ExtractedContext, } from "./opentel
|
|
|
12
12
|
export { injectToEnv, injectToEnvWithContext, injectToEnvFromCarrier, getTraceparentHeader, type EnvCarrier, } from "./opentelemetry/propagation-env";
|
|
13
13
|
export { createLogger, setQuietMode, isQuietMode, setConfigComponent as setLoggerConfigComponent, getLogLevel, getLogLevels, getLogDir, getLogFile, setLogDirOverride, getLogDirOverride, simplifyFilePath, getMaxOutput, } from "./logger";
|
|
14
14
|
export { TracedAs, Traced, TracedLightweight, wrapFunction, type TracedOptions } from "./decorator";
|
|
15
|
+
export { isTraceFullMode, resetTraceFullModeCache, llmInvokeParamFilter, llmInvokeResultFilter, messagesParamFilter, toolExecParamFilter, toolInvokeParamFilter, toolExecResultFilter, envQueryParamFilter, agentRunParamFilter, recordSessionMessagesParamFilter, embedParamFilter, embedResultFilter, } from "./trace-filters";
|
|
@@ -7,19 +7,32 @@ import {
|
|
|
7
7
|
injectToEnv,
|
|
8
8
|
injectToEnvFromCarrier,
|
|
9
9
|
injectToEnvWithContext
|
|
10
|
-
} from "../../shared/@ai-setting/roy-agent-core-
|
|
10
|
+
} from "../../shared/@ai-setting/roy-agent-core-w7hnjhvx.js";
|
|
11
11
|
import"../../shared/@ai-setting/roy-agent-core-7hh0brvs.js";
|
|
12
|
-
import"../../shared/@ai-setting/roy-agent-core-
|
|
13
|
-
import"../../shared/@ai-setting/roy-agent-core-
|
|
14
|
-
import"../../shared/@ai-setting/roy-agent-core-
|
|
15
|
-
import"../../shared/@ai-setting/roy-agent-core-
|
|
16
|
-
import"../../shared/@ai-setting/roy-agent-core-
|
|
12
|
+
import"../../shared/@ai-setting/roy-agent-core-40xzbjtm.js";
|
|
13
|
+
import"../../shared/@ai-setting/roy-agent-core-gngjkw3b.js";
|
|
14
|
+
import"../../shared/@ai-setting/roy-agent-core-1pnfkspm.js";
|
|
15
|
+
import"../../shared/@ai-setting/roy-agent-core-16t0zfbk.js";
|
|
16
|
+
import"../../shared/@ai-setting/roy-agent-core-jszgaevt.js";
|
|
17
17
|
import {
|
|
18
18
|
Traced,
|
|
19
19
|
TracedAs,
|
|
20
20
|
TracedLightweight,
|
|
21
|
+
agentRunParamFilter,
|
|
22
|
+
embedParamFilter,
|
|
23
|
+
embedResultFilter,
|
|
24
|
+
envQueryParamFilter,
|
|
25
|
+
isTraceFullMode,
|
|
26
|
+
llmInvokeParamFilter,
|
|
27
|
+
llmInvokeResultFilter,
|
|
28
|
+
messagesParamFilter,
|
|
29
|
+
recordSessionMessagesParamFilter,
|
|
30
|
+
resetTraceFullModeCache,
|
|
31
|
+
toolExecParamFilter,
|
|
32
|
+
toolExecResultFilter,
|
|
33
|
+
toolInvokeParamFilter,
|
|
21
34
|
wrapFunction
|
|
22
|
-
} from "../../shared/@ai-setting/roy-agent-core-
|
|
35
|
+
} from "../../shared/@ai-setting/roy-agent-core-b599jgyd.js";
|
|
23
36
|
import {
|
|
24
37
|
OTelTracerProvider,
|
|
25
38
|
SpanKind,
|
|
@@ -48,14 +61,23 @@ import {
|
|
|
48
61
|
import"../../shared/@ai-setting/roy-agent-core-fs0mn2jk.js";
|
|
49
62
|
export {
|
|
50
63
|
wrapFunction,
|
|
64
|
+
toolInvokeParamFilter,
|
|
65
|
+
toolExecResultFilter,
|
|
66
|
+
toolExecParamFilter,
|
|
51
67
|
simplifyFilePath,
|
|
52
68
|
setQuietMode,
|
|
53
69
|
setConfigComponent as setLoggerConfigComponent,
|
|
54
70
|
setLogDirOverride,
|
|
55
71
|
serialize,
|
|
56
72
|
resetTracerProvider,
|
|
73
|
+
resetTraceFullModeCache,
|
|
74
|
+
recordSessionMessagesParamFilter,
|
|
57
75
|
propagation,
|
|
58
76
|
parse,
|
|
77
|
+
messagesParamFilter,
|
|
78
|
+
llmInvokeResultFilter,
|
|
79
|
+
llmInvokeParamFilter,
|
|
80
|
+
isTraceFullMode,
|
|
59
81
|
isQuietMode,
|
|
60
82
|
injectToEnvWithContext,
|
|
61
83
|
injectToEnvFromCarrier,
|
|
@@ -70,7 +92,11 @@ export {
|
|
|
70
92
|
getLogDir,
|
|
71
93
|
getDefaultSpanDbPath,
|
|
72
94
|
getDefaultLogDir,
|
|
95
|
+
envQueryParamFilter,
|
|
96
|
+
embedResultFilter,
|
|
97
|
+
embedParamFilter,
|
|
73
98
|
createLogger,
|
|
99
|
+
agentRunParamFilter,
|
|
74
100
|
TracedLightweight,
|
|
75
101
|
TracedAs,
|
|
76
102
|
Traced,
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Trace 参数瘦身过滤器(paramFilter / resultFilter 共享工具)
|
|
3
|
+
*
|
|
4
|
+
* ## 背景
|
|
5
|
+
*
|
|
6
|
+
* `traces.db` 曾膨胀到 169GB / 1800 万 span。根因不是 span 数量多,而是
|
|
7
|
+
* **单个 span 把全量 messages / tool result 写进了 attributes**:
|
|
8
|
+
*
|
|
9
|
+
* | span name | 平均 attributes 体积 |
|
|
10
|
+
* |------------------------------|----------------------|
|
|
11
|
+
* | `llm.component.invoke` | 473 KB |
|
|
12
|
+
* | `session.extractRecentMessages` | 878 KB |
|
|
13
|
+
* | `agent.component.executeTool` | 259 KB |
|
|
14
|
+
* | `agent.component.buildAdditionInfo` | 158 KB |
|
|
15
|
+
*
|
|
16
|
+
* 每个 LLM 调用都把「system prompt + 全量对话历史」原样序列化进 DB,
|
|
17
|
+
* 排障价值极低(DB 里只有数字,看不出内容)而体积代价极高。
|
|
18
|
+
*
|
|
19
|
+
* ## 方案:显式白名单 filter
|
|
20
|
+
*
|
|
21
|
+
* 用 `paramFilter` / `resultFilter` 把入参/返回值替换成**摘要**:
|
|
22
|
+
* 条数、长度、模型名 —— 排障时最需要的那几个数字,体积 < 1KB。
|
|
23
|
+
*
|
|
24
|
+
* 相比 `recordParams: false`(黑盒式"全丢"),filter 是**显式白名单**:
|
|
25
|
+
* 读代码就知道存了什么、没存什么;后续要加字段只改一个函数。
|
|
26
|
+
*
|
|
27
|
+
* ## 全量模式
|
|
28
|
+
*
|
|
29
|
+
* `ROY_TRACE_FULL=1` 时,所有 filter 退化为"原样保留",用于临时全量排查。
|
|
30
|
+
* 这样运维时只需重启进程 + 加环境变量,**不必改代码重新构建**。
|
|
31
|
+
*/
|
|
32
|
+
/** 强制刷新全量模式缓存(测试用) */
|
|
33
|
+
export declare function resetTraceFullModeCache(): void;
|
|
34
|
+
/**
|
|
35
|
+
* 是否处于全量模式(`ROY_TRACE_FULL=1`)。
|
|
36
|
+
*
|
|
37
|
+
* 只认 `"1"` / `"true"` / `"yes"`(大小写不敏感),避免 `ROY_TRACE_FULL=0`
|
|
38
|
+
* 这种"看起来像开了其实是关了"的歧义写法被误判为开启。
|
|
39
|
+
*/
|
|
40
|
+
export declare function isTraceFullMode(): boolean;
|
|
41
|
+
/**
|
|
42
|
+
* 通用:LLM 调用入参摘要(`llm.component.invoke` / `agent.component.invokeLLM`)。
|
|
43
|
+
*
|
|
44
|
+
* 保留的字段都是**排障时最常问的问题**的答案:
|
|
45
|
+
* - 用的是哪个模型 / provider
|
|
46
|
+
* - 这次塞了多少条消息、多大(判断是不是上下文爆炸)
|
|
47
|
+
* - 带了多少个工具
|
|
48
|
+
*/
|
|
49
|
+
export declare function llmInvokeParamFilter(args: any[]): Record<string, any>;
|
|
50
|
+
/**
|
|
51
|
+
* 通用:LLM 调用返回值摘要。
|
|
52
|
+
*
|
|
53
|
+
* 只留 `finishReason` / 输出长度 / 推理长度 / tool call 数 / usage ——
|
|
54
|
+
* 这几个是判断"这次调用是否正常、有没有被截断、烧了多少 token"的关键数字。
|
|
55
|
+
*
|
|
56
|
+
* ⚠️ 真实类型是 `LLMInvokeResult = { output: LLMOutput, ... }`,
|
|
57
|
+
* `LLMOutput = { content, reasoning?, finishReason, toolCalls?, usage? }`,
|
|
58
|
+
* **没有 `text` / `parts`**;`AgentLLMOutput` 也是 `content` 形状。
|
|
59
|
+
* 两种都兼容:`content` 优先。
|
|
60
|
+
*/
|
|
61
|
+
export declare function llmInvokeResultFilter(r: any): Record<string, any>;
|
|
62
|
+
/**
|
|
63
|
+
* 通用:消息数组入参摘要(`session.extractRecentMessages` 等)。
|
|
64
|
+
*
|
|
65
|
+
* @param args[0] 通常是消息数组本身,也可能是 `{ messages: [...] }`
|
|
66
|
+
*/
|
|
67
|
+
export declare function messagesParamFilter(args: any[]): Record<string, any>;
|
|
68
|
+
/**
|
|
69
|
+
* 通用:工具执行入参摘要(`agent.component.executeTool`)。
|
|
70
|
+
*
|
|
71
|
+
* 工具参数可能含大文件内容,所以只留"工具名 + 参数键名列表",不留参数值。
|
|
72
|
+
*/
|
|
73
|
+
export declare function toolExecParamFilter(args: any[]): Record<string, any>;
|
|
74
|
+
/**
|
|
75
|
+
* 通用:embed 入参摘要(`llm.adapter.embed` / `llm.adapter.ai_sdk.embed`)。
|
|
76
|
+
*
|
|
77
|
+
* embed 的 `texts`/`input` 是大字符串数组,**绝对不能入库**。
|
|
78
|
+
*/
|
|
79
|
+
export declare function embedParamFilter(args: any[]): Record<string, any>;
|
|
80
|
+
/**
|
|
81
|
+
* 通用:embed 返回值摘要 —— 只留维度数,不留向量本身。
|
|
82
|
+
*/
|
|
83
|
+
export declare function embedResultFilter(r: any): Record<string, any>;
|
|
84
|
+
/**
|
|
85
|
+
* 工具执行返回值摘要。
|
|
86
|
+
*
|
|
87
|
+
* 返回值里最大的两块是 `output`(stdout)和 `metadata.stdout/stderr` ——
|
|
88
|
+
* 一次 `cat` 一个大文件就能写进几 MB。同样只留长度 + 截断前缀。
|
|
89
|
+
*/
|
|
90
|
+
export declare function toolExecResultFilter(r: any): Record<string, any>;
|
|
91
|
+
/**
|
|
92
|
+
* 工具执行入参摘要(`tool.bash.execute` 的 command / `tool.component.execute` 的 args)。
|
|
93
|
+
*/
|
|
94
|
+
export declare function toolInvokeParamFilter(args: any[]): Record<string, any>;
|
|
95
|
+
/**
|
|
96
|
+
* 顶层查询入参摘要(`env.handle_query` / `env.handle_workflow_agent_query`)。
|
|
97
|
+
*
|
|
98
|
+
* 入参 `query` 是 `string | ContentPart[]` —— 多模态时是图片/文件的数组,
|
|
99
|
+
* 可能很大。只留长度与类型,不留内容。
|
|
100
|
+
*/
|
|
101
|
+
/**
|
|
102
|
+
* 环境入口(`env.handle_query` / `env.handle_workflow_agent_query`)入参摘要。
|
|
103
|
+
*
|
|
104
|
+
* ⚠️ **两个调用点的入参形状不同**,不能共用同一套解析:
|
|
105
|
+
* - `env.handle_query(query, context?)` → args[0] 是 **query**
|
|
106
|
+
* - `env.handle_workflow_agent_query(agentName, query, agentComponent, context?)`
|
|
107
|
+
* → args[0] 是 **agentName**,args[1] 才是 query
|
|
108
|
+
*
|
|
109
|
+
* 早期版本把 args[0] 一律当 agentName,导致 `handle_query` 的
|
|
110
|
+
* **整条 query 被原样存进 `agentName` 字段** —— 过滤器等于没生效。
|
|
111
|
+
* 现在按「参数个数 + 形状」区分两种入口。
|
|
112
|
+
*/
|
|
113
|
+
export declare function envQueryParamFilter(args: any[]): Record<string, any>;
|
|
114
|
+
/**
|
|
115
|
+
* `agent.component.run` 入参摘要。
|
|
116
|
+
*
|
|
117
|
+
* 入参是 `(agentName, query, context)` —— `query` 可能是多模态数组
|
|
118
|
+
* (base64 图片能到 MB 级)。只留长度与条数。
|
|
119
|
+
*/
|
|
120
|
+
export declare function agentRunParamFilter(args: any[]): Record<string, any>;
|
|
121
|
+
/**
|
|
122
|
+
* `agent.component.recordSessionMessages` 入参摘要。
|
|
123
|
+
*
|
|
124
|
+
* ⚠️ 这是**最大的漏网之鱼**:`allMessages` 是**每一轮 ReAct 迭代的全部消息**
|
|
125
|
+
* (含工具输出),实测单 span ~200 KB / 迭代。必须只留条数与长度。
|
|
126
|
+
*/
|
|
127
|
+
export declare function recordSessionMessagesParamFilter(args: any[]): Record<string, any>;
|
package/dist/env/mcp/index.js
CHANGED
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
augmentNpmEnvForPackageRunner,
|
|
11
11
|
getMcpPathPriority,
|
|
12
12
|
resolvePackageRunnerCommand
|
|
13
|
-
} from "../../shared/@ai-setting/roy-agent-core-
|
|
13
|
+
} from "../../shared/@ai-setting/roy-agent-core-c6at31ra.js";
|
|
14
14
|
import {
|
|
15
15
|
adaptMcpTool,
|
|
16
16
|
convertInputSchemaToZod,
|
|
@@ -18,12 +18,12 @@ import {
|
|
|
18
18
|
} from "../../shared/@ai-setting/roy-agent-core-8t7wny6v.js";
|
|
19
19
|
import"../../shared/@ai-setting/roy-agent-core-ctdhjv68.js";
|
|
20
20
|
import"../../shared/@ai-setting/roy-agent-core-7hh0brvs.js";
|
|
21
|
-
import"../../shared/@ai-setting/roy-agent-core-
|
|
22
|
-
import"../../shared/@ai-setting/roy-agent-core-
|
|
23
|
-
import"../../shared/@ai-setting/roy-agent-core-
|
|
24
|
-
import"../../shared/@ai-setting/roy-agent-core-
|
|
25
|
-
import"../../shared/@ai-setting/roy-agent-core-
|
|
26
|
-
import"../../shared/@ai-setting/roy-agent-core-
|
|
21
|
+
import"../../shared/@ai-setting/roy-agent-core-40xzbjtm.js";
|
|
22
|
+
import"../../shared/@ai-setting/roy-agent-core-gngjkw3b.js";
|
|
23
|
+
import"../../shared/@ai-setting/roy-agent-core-1pnfkspm.js";
|
|
24
|
+
import"../../shared/@ai-setting/roy-agent-core-16t0zfbk.js";
|
|
25
|
+
import"../../shared/@ai-setting/roy-agent-core-jszgaevt.js";
|
|
26
|
+
import"../../shared/@ai-setting/roy-agent-core-b599jgyd.js";
|
|
27
27
|
import"../../shared/@ai-setting/roy-agent-core-8seq65bp.js";
|
|
28
28
|
import"../../shared/@ai-setting/roy-agent-core-jnszp0jq.js";
|
|
29
29
|
import {
|
package/dist/env/memory/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
MemoryComponent,
|
|
4
4
|
SOURCE_PRIORITY,
|
|
5
5
|
getSourcePriority
|
|
6
|
-
} from "../../shared/@ai-setting/roy-agent-core-
|
|
6
|
+
} from "../../shared/@ai-setting/roy-agent-core-gn8f4rhs.js";
|
|
7
7
|
import {
|
|
8
8
|
RecallMemorySchema,
|
|
9
9
|
RecordMemorySchema
|
|
@@ -25,12 +25,12 @@ import {
|
|
|
25
25
|
recallMemory
|
|
26
26
|
} from "../../shared/@ai-setting/roy-agent-core-j5c3chtn.js";
|
|
27
27
|
import"../../shared/@ai-setting/roy-agent-core-7hh0brvs.js";
|
|
28
|
-
import"../../shared/@ai-setting/roy-agent-core-
|
|
29
|
-
import"../../shared/@ai-setting/roy-agent-core-
|
|
30
|
-
import"../../shared/@ai-setting/roy-agent-core-
|
|
31
|
-
import"../../shared/@ai-setting/roy-agent-core-
|
|
32
|
-
import"../../shared/@ai-setting/roy-agent-core-
|
|
33
|
-
import"../../shared/@ai-setting/roy-agent-core-
|
|
28
|
+
import"../../shared/@ai-setting/roy-agent-core-40xzbjtm.js";
|
|
29
|
+
import"../../shared/@ai-setting/roy-agent-core-gngjkw3b.js";
|
|
30
|
+
import"../../shared/@ai-setting/roy-agent-core-1pnfkspm.js";
|
|
31
|
+
import"../../shared/@ai-setting/roy-agent-core-16t0zfbk.js";
|
|
32
|
+
import"../../shared/@ai-setting/roy-agent-core-jszgaevt.js";
|
|
33
|
+
import"../../shared/@ai-setting/roy-agent-core-b599jgyd.js";
|
|
34
34
|
import"../../shared/@ai-setting/roy-agent-core-8seq65bp.js";
|
|
35
35
|
import"../../shared/@ai-setting/roy-agent-core-jnszp0jq.js";
|
|
36
36
|
import"../../shared/@ai-setting/roy-agent-core-fs0mn2jk.js";
|
package/dist/env/plugin/index.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import {
|
|
2
2
|
EventBusNotificationChannel,
|
|
3
3
|
PluginComponent
|
|
4
|
-
} from "../../shared/@ai-setting/roy-agent-core-
|
|
4
|
+
} from "../../shared/@ai-setting/roy-agent-core-5gw6w424.js";
|
|
5
5
|
import {
|
|
6
6
|
normalizeLarkAtMentions
|
|
7
7
|
} from "../../shared/@ai-setting/roy-agent-core-64f22h1g.js";
|
|
8
8
|
import {
|
|
9
9
|
BasePlugin
|
|
10
10
|
} from "../../shared/@ai-setting/roy-agent-core-az13yzmc.js";
|
|
11
|
-
import"../../shared/@ai-setting/roy-agent-core-
|
|
12
|
-
import"../../shared/@ai-setting/roy-agent-core-
|
|
13
|
-
import"../../shared/@ai-setting/roy-agent-core-
|
|
14
|
-
import"../../shared/@ai-setting/roy-agent-core-
|
|
15
|
-
import"../../shared/@ai-setting/roy-agent-core-
|
|
16
|
-
import"../../shared/@ai-setting/roy-agent-core-
|
|
11
|
+
import"../../shared/@ai-setting/roy-agent-core-40xzbjtm.js";
|
|
12
|
+
import"../../shared/@ai-setting/roy-agent-core-gngjkw3b.js";
|
|
13
|
+
import"../../shared/@ai-setting/roy-agent-core-1pnfkspm.js";
|
|
14
|
+
import"../../shared/@ai-setting/roy-agent-core-16t0zfbk.js";
|
|
15
|
+
import"../../shared/@ai-setting/roy-agent-core-jszgaevt.js";
|
|
16
|
+
import"../../shared/@ai-setting/roy-agent-core-b599jgyd.js";
|
|
17
17
|
import {
|
|
18
18
|
createLogger,
|
|
19
19
|
init_logger
|
package/dist/env/prompt/index.js
CHANGED
|
@@ -3,16 +3,16 @@ import {
|
|
|
3
3
|
PromptConfigSchema,
|
|
4
4
|
PromptPathSchema,
|
|
5
5
|
PromptRenderer
|
|
6
|
-
} from "../../shared/@ai-setting/roy-agent-core-
|
|
6
|
+
} from "../../shared/@ai-setting/roy-agent-core-6qgq7h1g.js";
|
|
7
7
|
import"../../shared/@ai-setting/roy-agent-core-6masakz4.js";
|
|
8
8
|
import"../../shared/@ai-setting/roy-agent-core-qxnbvgwe.js";
|
|
9
9
|
import"../../shared/@ai-setting/roy-agent-core-7hh0brvs.js";
|
|
10
|
-
import"../../shared/@ai-setting/roy-agent-core-
|
|
11
|
-
import"../../shared/@ai-setting/roy-agent-core-
|
|
12
|
-
import"../../shared/@ai-setting/roy-agent-core-
|
|
13
|
-
import"../../shared/@ai-setting/roy-agent-core-
|
|
14
|
-
import"../../shared/@ai-setting/roy-agent-core-
|
|
15
|
-
import"../../shared/@ai-setting/roy-agent-core-
|
|
10
|
+
import"../../shared/@ai-setting/roy-agent-core-40xzbjtm.js";
|
|
11
|
+
import"../../shared/@ai-setting/roy-agent-core-gngjkw3b.js";
|
|
12
|
+
import"../../shared/@ai-setting/roy-agent-core-1pnfkspm.js";
|
|
13
|
+
import"../../shared/@ai-setting/roy-agent-core-16t0zfbk.js";
|
|
14
|
+
import"../../shared/@ai-setting/roy-agent-core-jszgaevt.js";
|
|
15
|
+
import"../../shared/@ai-setting/roy-agent-core-b599jgyd.js";
|
|
16
16
|
import"../../shared/@ai-setting/roy-agent-core-8seq65bp.js";
|
|
17
17
|
import"../../shared/@ai-setting/roy-agent-core-jnszp0jq.js";
|
|
18
18
|
import"../../shared/@ai-setting/roy-agent-core-fs0mn2jk.js";
|
|
@@ -3,23 +3,24 @@ import {
|
|
|
3
3
|
MIN_SESSION_ID_LENGTH,
|
|
4
4
|
SessionComponent,
|
|
5
5
|
isValidSessionId
|
|
6
|
-
} from "../../shared/@ai-setting/roy-agent-core-
|
|
6
|
+
} from "../../shared/@ai-setting/roy-agent-core-bwzy00t2.js";
|
|
7
7
|
import {
|
|
8
8
|
MemorySessionStore
|
|
9
|
-
} from "../../shared/@ai-setting/roy-agent-core-
|
|
9
|
+
} from "../../shared/@ai-setting/roy-agent-core-tc7gw38m.js";
|
|
10
10
|
import"../../shared/@ai-setting/roy-agent-core-ze068vc9.js";
|
|
11
11
|
import"../../shared/@ai-setting/roy-agent-core-rvxg1wps.js";
|
|
12
12
|
import {
|
|
13
13
|
SessionMessageConverter
|
|
14
|
-
} from "../../shared/@ai-setting/roy-agent-core-
|
|
15
|
-
import"../../shared/@ai-setting/roy-agent-core-
|
|
14
|
+
} from "../../shared/@ai-setting/roy-agent-core-ns3pbyz4.js";
|
|
15
|
+
import"../../shared/@ai-setting/roy-agent-core-yv9x4wmg.js";
|
|
16
|
+
import"../../shared/@ai-setting/roy-agent-core-zjdzk1gg.js";
|
|
16
17
|
import"../../shared/@ai-setting/roy-agent-core-7hh0brvs.js";
|
|
17
|
-
import"../../shared/@ai-setting/roy-agent-core-
|
|
18
|
-
import"../../shared/@ai-setting/roy-agent-core-
|
|
19
|
-
import"../../shared/@ai-setting/roy-agent-core-
|
|
20
|
-
import"../../shared/@ai-setting/roy-agent-core-
|
|
21
|
-
import"../../shared/@ai-setting/roy-agent-core-
|
|
22
|
-
import"../../shared/@ai-setting/roy-agent-core-
|
|
18
|
+
import"../../shared/@ai-setting/roy-agent-core-40xzbjtm.js";
|
|
19
|
+
import"../../shared/@ai-setting/roy-agent-core-gngjkw3b.js";
|
|
20
|
+
import"../../shared/@ai-setting/roy-agent-core-1pnfkspm.js";
|
|
21
|
+
import"../../shared/@ai-setting/roy-agent-core-16t0zfbk.js";
|
|
22
|
+
import"../../shared/@ai-setting/roy-agent-core-jszgaevt.js";
|
|
23
|
+
import"../../shared/@ai-setting/roy-agent-core-b599jgyd.js";
|
|
23
24
|
import"../../shared/@ai-setting/roy-agent-core-8seq65bp.js";
|
|
24
25
|
import"../../shared/@ai-setting/roy-agent-core-jnszp0jq.js";
|
|
25
26
|
import"../../shared/@ai-setting/roy-agent-core-fs0mn2jk.js";
|
|
@@ -397,6 +397,10 @@ export declare class SessionComponent extends BaseComponent {
|
|
|
397
397
|
* 现在:优先取干净的纯文本轮次(信息密度最高),一轮都没取到时兜底保留最近
|
|
398
398
|
* 若干条原始消息(含 tool 轮次),至少让 CLI 能看到「刚才在干什么」。
|
|
399
399
|
*/
|
|
400
|
+
/**
|
|
401
|
+
* ★ 2026-10-22:**只存摘要**(Task #4479)。改造前平均 878KB(最大 12.8MB)
|
|
402
|
+
* —— 入参是完整 messages 数组,返回值是抽出来的消息正文。
|
|
403
|
+
*/
|
|
400
404
|
private extractRecentMessages;
|
|
401
405
|
/**
|
|
402
406
|
* Preview compact operation
|
|
@@ -3,9 +3,11 @@ import {
|
|
|
3
3
|
SQLiteSessionStore,
|
|
4
4
|
getDefaultDataDir,
|
|
5
5
|
getDefaultSessionDbPath
|
|
6
|
-
} from "../../../shared/@ai-setting/roy-agent-core-
|
|
7
|
-
import"../../../shared/@ai-setting/roy-agent-core-
|
|
8
|
-
import"../../../shared/@ai-setting/roy-agent-core-
|
|
6
|
+
} from "../../../shared/@ai-setting/roy-agent-core-tc7gw38m.js";
|
|
7
|
+
import"../../../shared/@ai-setting/roy-agent-core-ns3pbyz4.js";
|
|
8
|
+
import"../../../shared/@ai-setting/roy-agent-core-yv9x4wmg.js";
|
|
9
|
+
import"../../../shared/@ai-setting/roy-agent-core-zjdzk1gg.js";
|
|
10
|
+
import"../../../shared/@ai-setting/roy-agent-core-b599jgyd.js";
|
|
9
11
|
import"../../../shared/@ai-setting/roy-agent-core-8seq65bp.js";
|
|
10
12
|
import"../../../shared/@ai-setting/roy-agent-core-jnszp0jq.js";
|
|
11
13
|
import"../../../shared/@ai-setting/roy-agent-core-fs0mn2jk.js";
|
package/dist/env/skill/index.js
CHANGED
|
@@ -6,19 +6,19 @@ import {
|
|
|
6
6
|
getSourcePriority,
|
|
7
7
|
parseFrontmatter,
|
|
8
8
|
parseSkillFile
|
|
9
|
-
} from "../../shared/@ai-setting/roy-agent-core-
|
|
9
|
+
} from "../../shared/@ai-setting/roy-agent-core-yg247mk4.js";
|
|
10
10
|
import {
|
|
11
11
|
SkillToolSchema,
|
|
12
12
|
buildSkillDescription,
|
|
13
13
|
createSkillTool
|
|
14
14
|
} from "../../shared/@ai-setting/roy-agent-core-psvxt4c9.js";
|
|
15
15
|
import"../../shared/@ai-setting/roy-agent-core-7hh0brvs.js";
|
|
16
|
-
import"../../shared/@ai-setting/roy-agent-core-
|
|
17
|
-
import"../../shared/@ai-setting/roy-agent-core-
|
|
18
|
-
import"../../shared/@ai-setting/roy-agent-core-
|
|
19
|
-
import"../../shared/@ai-setting/roy-agent-core-
|
|
20
|
-
import"../../shared/@ai-setting/roy-agent-core-
|
|
21
|
-
import"../../shared/@ai-setting/roy-agent-core-
|
|
16
|
+
import"../../shared/@ai-setting/roy-agent-core-40xzbjtm.js";
|
|
17
|
+
import"../../shared/@ai-setting/roy-agent-core-gngjkw3b.js";
|
|
18
|
+
import"../../shared/@ai-setting/roy-agent-core-1pnfkspm.js";
|
|
19
|
+
import"../../shared/@ai-setting/roy-agent-core-16t0zfbk.js";
|
|
20
|
+
import"../../shared/@ai-setting/roy-agent-core-jszgaevt.js";
|
|
21
|
+
import"../../shared/@ai-setting/roy-agent-core-b599jgyd.js";
|
|
22
22
|
import"../../shared/@ai-setting/roy-agent-core-8seq65bp.js";
|
|
23
23
|
import"../../shared/@ai-setting/roy-agent-core-jnszp0jq.js";
|
|
24
24
|
import"../../shared/@ai-setting/roy-agent-core-fs0mn2jk.js";
|
|
@@ -3,18 +3,18 @@ import {
|
|
|
3
3
|
BackgroundTaskManager,
|
|
4
4
|
createDelegateTool,
|
|
5
5
|
createStopTool
|
|
6
|
-
} from "../../../shared/@ai-setting/roy-agent-core-
|
|
6
|
+
} from "../../../shared/@ai-setting/roy-agent-core-vmg30n5x.js";
|
|
7
7
|
import"../../../shared/@ai-setting/roy-agent-core-tbrn9wdm.js";
|
|
8
|
-
import"../../../shared/@ai-setting/roy-agent-core-
|
|
8
|
+
import"../../../shared/@ai-setting/roy-agent-core-zmeka63k.js";
|
|
9
9
|
import"../../../shared/@ai-setting/roy-agent-core-1pg0fepg.js";
|
|
10
10
|
import"../../../shared/@ai-setting/roy-agent-core-6masakz4.js";
|
|
11
|
-
import"../../../shared/@ai-setting/roy-agent-core-
|
|
11
|
+
import"../../../shared/@ai-setting/roy-agent-core-97eyghsp.js";
|
|
12
12
|
import"../../../shared/@ai-setting/roy-agent-core-qxnbvgwe.js";
|
|
13
13
|
import"../../../shared/@ai-setting/roy-agent-core-c1v263jn.js";
|
|
14
|
-
import"../../../shared/@ai-setting/roy-agent-core-
|
|
15
|
-
import"../../../shared/@ai-setting/roy-agent-core-
|
|
16
|
-
import"../../../shared/@ai-setting/roy-agent-core-
|
|
17
|
-
import"../../../shared/@ai-setting/roy-agent-core-
|
|
14
|
+
import"../../../shared/@ai-setting/roy-agent-core-1pnfkspm.js";
|
|
15
|
+
import"../../../shared/@ai-setting/roy-agent-core-16t0zfbk.js";
|
|
16
|
+
import"../../../shared/@ai-setting/roy-agent-core-jszgaevt.js";
|
|
17
|
+
import"../../../shared/@ai-setting/roy-agent-core-b599jgyd.js";
|
|
18
18
|
import"../../../shared/@ai-setting/roy-agent-core-8seq65bp.js";
|
|
19
19
|
import"../../../shared/@ai-setting/roy-agent-core-jnszp0jq.js";
|
|
20
20
|
import"../../../shared/@ai-setting/roy-agent-core-fs0mn2jk.js";
|