@namzu/sdk 53.2.2 → 55.0.0
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 +56 -0
- package/dist/agents/QueryAgent.d.ts.map +1 -1
- package/dist/agents/QueryAgent.js +1 -0
- package/dist/agents/QueryAgent.js.map +1 -1
- package/dist/compaction/context-breakdown.d.ts +85 -0
- package/dist/compaction/context-breakdown.d.ts.map +1 -0
- package/dist/compaction/context-breakdown.js +149 -0
- package/dist/compaction/context-breakdown.js.map +1 -0
- package/dist/compaction/extractor.d.ts.map +1 -1
- package/dist/compaction/extractor.js +5 -1
- package/dist/compaction/extractor.js.map +1 -1
- package/dist/compaction/managers/structured.d.ts.map +1 -1
- package/dist/compaction/managers/structured.js +5 -0
- package/dist/compaction/managers/structured.js.map +1 -1
- package/dist/compaction/manual.d.ts.map +1 -1
- package/dist/compaction/manual.js +6 -0
- package/dist/compaction/manual.js.map +1 -1
- package/dist/compaction/serializer.d.ts +6 -0
- package/dist/compaction/serializer.d.ts.map +1 -1
- package/dist/compaction/serializer.js +21 -3
- package/dist/compaction/serializer.js.map +1 -1
- package/dist/compaction/token-estimate.d.ts +2 -0
- package/dist/compaction/token-estimate.d.ts.map +1 -1
- package/dist/compaction/token-estimate.js +4 -0
- package/dist/compaction/token-estimate.js.map +1 -1
- package/dist/compaction/verifier.d.ts.map +1 -1
- package/dist/compaction/verifier.js +27 -6
- package/dist/compaction/verifier.js.map +1 -1
- package/dist/constants/compaction/index.d.ts +1 -0
- package/dist/constants/compaction/index.d.ts.map +1 -1
- package/dist/constants/compaction/index.js +1 -0
- package/dist/constants/compaction/index.js.map +1 -1
- package/dist/manager/resident/proposal.d.ts +2 -2
- package/dist/manager/resident/store.d.ts +4 -4
- package/dist/prompt/coding-agent-doctrine.d.ts +3 -3
- package/dist/prompt/coding-agent-doctrine.d.ts.map +1 -1
- package/dist/prompt/coding-agent-doctrine.js +18 -20
- package/dist/prompt/coding-agent-doctrine.js.map +1 -1
- package/dist/public-runtime.d.ts +8 -3
- package/dist/public-runtime.d.ts.map +1 -1
- package/dist/public-runtime.js +7 -2
- package/dist/public-runtime.js.map +1 -1
- package/dist/runtime/cache-clock.d.ts +39 -0
- package/dist/runtime/cache-clock.d.ts.map +1 -0
- package/dist/runtime/cache-clock.js +48 -0
- package/dist/runtime/cache-clock.js.map +1 -0
- package/dist/runtime/query/checkpoint.d.ts +12 -2
- package/dist/runtime/query/checkpoint.d.ts.map +1 -1
- package/dist/runtime/query/checkpoint.js +42 -8
- package/dist/runtime/query/checkpoint.js.map +1 -1
- package/dist/runtime/query/compact-session.d.ts +37 -2
- package/dist/runtime/query/compact-session.d.ts.map +1 -1
- package/dist/runtime/query/compact-session.js +77 -3
- package/dist/runtime/query/compact-session.js.map +1 -1
- package/dist/runtime/query/executor/tool-call-admission.d.ts.map +1 -1
- package/dist/runtime/query/executor/tool-call-admission.js +3 -0
- package/dist/runtime/query/executor/tool-call-admission.js.map +1 -1
- package/dist/runtime/query/executor.d.ts +39 -1
- package/dist/runtime/query/executor.d.ts.map +1 -1
- package/dist/runtime/query/executor.js +115 -7
- package/dist/runtime/query/executor.js.map +1 -1
- package/dist/runtime/query/index.d.ts +18 -0
- package/dist/runtime/query/index.d.ts.map +1 -1
- package/dist/runtime/query/index.js +20 -1
- package/dist/runtime/query/index.js.map +1 -1
- package/dist/runtime/query/iteration/index.d.ts.map +1 -1
- package/dist/runtime/query/iteration/index.js +25 -8
- package/dist/runtime/query/iteration/index.js.map +1 -1
- package/dist/runtime/query/iteration/phases/context.d.ts +24 -2
- package/dist/runtime/query/iteration/phases/context.d.ts.map +1 -1
- package/dist/runtime/query/iteration/phases/context.js +22 -22
- package/dist/runtime/query/iteration/phases/context.js.map +1 -1
- package/dist/runtime/query/iteration/phases/per-call-review.d.ts +78 -0
- package/dist/runtime/query/iteration/phases/per-call-review.d.ts.map +1 -0
- package/dist/runtime/query/iteration/phases/per-call-review.js +494 -0
- package/dist/runtime/query/iteration/phases/per-call-review.js.map +1 -0
- package/dist/runtime/query/iteration/phases/tool-review.d.ts.map +1 -1
- package/dist/runtime/query/iteration/phases/tool-review.js +129 -62
- package/dist/runtime/query/iteration/phases/tool-review.js.map +1 -1
- package/dist/runtime/query/iteration/step-context.d.ts +14 -0
- package/dist/runtime/query/iteration/step-context.d.ts.map +1 -1
- package/dist/runtime/query/iteration/step-context.js +29 -0
- package/dist/runtime/query/iteration/step-context.js.map +1 -1
- package/dist/runtime/query/iteration/step-shaping.d.ts.map +1 -1
- package/dist/runtime/query/iteration/step-shaping.js +6 -2
- package/dist/runtime/query/iteration/step-shaping.js.map +1 -1
- package/dist/runtime/query/prepare-turn.d.ts.map +1 -1
- package/dist/runtime/query/prepare-turn.js +16 -3
- package/dist/runtime/query/prepare-turn.js.map +1 -1
- package/dist/runtime/query/project-instructions.d.ts +24 -5
- package/dist/runtime/query/project-instructions.d.ts.map +1 -1
- package/dist/runtime/query/project-instructions.js +107 -35
- package/dist/runtime/query/project-instructions.js.map +1 -1
- package/dist/runtime/query/prompt.d.ts +6 -0
- package/dist/runtime/query/prompt.d.ts.map +1 -1
- package/dist/runtime/query/prompt.js +10 -49
- package/dist/runtime/query/prompt.js.map +1 -1
- package/dist/runtime/query/resume-pending.d.ts +8 -0
- package/dist/runtime/query/resume-pending.d.ts.map +1 -1
- package/dist/runtime/query/resume-pending.js +101 -0
- package/dist/runtime/query/resume-pending.js.map +1 -1
- package/dist/runtime/query/review-policy.d.ts +18 -0
- package/dist/runtime/query/review-policy.d.ts.map +1 -1
- package/dist/runtime/query/review-policy.js +10 -0
- package/dist/runtime/query/review-policy.js.map +1 -1
- package/dist/runtime/query/steering.d.ts +55 -56
- package/dist/runtime/query/steering.d.ts.map +1 -1
- package/dist/runtime/query/steering.js +78 -72
- package/dist/runtime/query/steering.js.map +1 -1
- package/dist/store/budget/disk.js +4 -1
- package/dist/store/budget/disk.js.map +1 -1
- package/dist/tools/admit-facts.d.ts.map +1 -1
- package/dist/tools/admit-facts.js +6 -0
- package/dist/tools/admit-facts.js.map +1 -1
- package/dist/tools/builtins/bash.d.ts +8 -0
- package/dist/tools/builtins/bash.d.ts.map +1 -1
- package/dist/tools/builtins/bash.js +36 -27
- package/dist/tools/builtins/bash.js.map +1 -1
- package/dist/tools/builtins/browser.d.ts.map +1 -1
- package/dist/tools/builtins/browser.js +38 -12
- package/dist/tools/builtins/browser.js.map +1 -1
- package/dist/tools/builtins/edit-apply.d.ts +7 -4
- package/dist/tools/builtins/edit-apply.d.ts.map +1 -1
- package/dist/tools/builtins/edit-apply.js +3 -0
- package/dist/tools/builtins/edit-apply.js.map +1 -1
- package/dist/tools/builtins/edit.d.ts.map +1 -1
- package/dist/tools/builtins/edit.js +31 -11
- package/dist/tools/builtins/edit.js.map +1 -1
- package/dist/tools/builtins/exit-semantics.d.ts +31 -0
- package/dist/tools/builtins/exit-semantics.d.ts.map +1 -0
- package/dist/tools/builtins/exit-semantics.js +198 -0
- package/dist/tools/builtins/exit-semantics.js.map +1 -0
- package/dist/tools/builtins/job.js +1 -1
- package/dist/tools/builtins/job.js.map +1 -1
- package/dist/tools/builtins/skill.js +1 -1
- package/dist/tools/builtins/skill.js.map +1 -1
- package/dist/tools/builtins/structuredOutput.js +1 -1
- package/dist/tools/builtins/structuredOutput.js.map +1 -1
- package/dist/tools/builtins/verify-outputs.js +1 -1
- package/dist/tools/builtins/verify-outputs.js.map +1 -1
- package/dist/tools/builtins/write-file.js +11 -6
- package/dist/tools/builtins/write-file.js.map +1 -1
- package/dist/tools/coordinator/ask-user-question.d.ts +6 -0
- package/dist/tools/coordinator/ask-user-question.d.ts.map +1 -1
- package/dist/tools/coordinator/ask-user-question.js +6 -1
- package/dist/tools/coordinator/ask-user-question.js.map +1 -1
- package/dist/tools/coordinator/index.d.ts.map +1 -1
- package/dist/tools/coordinator/index.js +10 -3
- package/dist/tools/coordinator/index.js.map +1 -1
- package/dist/tools/memory/delete.js +1 -1
- package/dist/tools/memory/delete.js.map +1 -1
- package/dist/tools/memory/read.js +1 -1
- package/dist/tools/memory/read.js.map +1 -1
- package/dist/tools/memory/save.d.ts.map +1 -1
- package/dist/tools/memory/save.js +4 -3
- package/dist/tools/memory/save.js.map +1 -1
- package/dist/tools/memory/search.js +1 -1
- package/dist/tools/memory/search.js.map +1 -1
- package/dist/tools/memory/update.js +1 -1
- package/dist/tools/memory/update.js.map +1 -1
- package/dist/tools/schedules/loop-tool.d.ts.map +1 -1
- package/dist/tools/schedules/loop-tool.js +4 -2
- package/dist/tools/schedules/loop-tool.js.map +1 -1
- package/dist/tools/schedules/schedule-tool.js +2 -2
- package/dist/tools/schedules/schedule-tool.js.map +1 -1
- package/dist/tools/task/create.js +1 -1
- package/dist/tools/task/create.js.map +1 -1
- package/dist/tools/untrusted-envelope.js +1 -1
- package/dist/tools/untrusted-envelope.js.map +1 -1
- package/dist/toolsets/manager.d.ts.map +1 -1
- package/dist/toolsets/manager.js +6 -1
- package/dist/toolsets/manager.js.map +1 -1
- package/dist/turn/evidence-query.d.ts.map +1 -1
- package/dist/turn/evidence-query.js +16 -1
- package/dist/turn/evidence-query.js.map +1 -1
- package/dist/turn/evidence-recall.js +1 -1
- package/dist/turn/evidence-recall.js.map +1 -1
- package/dist/types/agent/base.d.ts +7 -0
- package/dist/types/agent/base.d.ts.map +1 -1
- package/dist/types/common/index.d.ts +19 -0
- package/dist/types/common/index.d.ts.map +1 -1
- package/dist/types/common/index.js +9 -0
- package/dist/types/common/index.js.map +1 -1
- package/dist/types/hitl/index.d.ts +66 -0
- package/dist/types/hitl/index.d.ts.map +1 -1
- package/dist/types/hitl/index.js.map +1 -1
- package/dist/types/message/index.d.ts +8 -0
- package/dist/types/message/index.d.ts.map +1 -1
- package/dist/types/message/index.js +12 -2
- package/dist/types/message/index.js.map +1 -1
- package/dist/types/message/notice-frame.d.ts +41 -0
- package/dist/types/message/notice-frame.d.ts.map +1 -0
- package/dist/types/message/notice-frame.js +65 -0
- package/dist/types/message/notice-frame.js.map +1 -0
- package/dist/types/provider/chat.d.ts +8 -0
- package/dist/types/provider/chat.d.ts.map +1 -1
- package/dist/types/provider/config.d.ts +6 -0
- package/dist/types/provider/config.d.ts.map +1 -1
- package/dist/types/session/checkpoint.d.ts +52 -0
- package/dist/types/session/checkpoint.d.ts.map +1 -1
- package/dist/types/session/checkpoint.js +5 -0
- package/dist/types/session/checkpoint.js.map +1 -1
- package/dist/types/session/events.d.ts +9 -0
- package/dist/types/session/events.d.ts.map +1 -1
- package/dist/types/session/events.js.map +1 -1
- package/dist/types/session/records.d.ts +181 -6
- package/dist/types/session/records.d.ts.map +1 -1
- package/dist/types/session/records.js +1 -1
- package/dist/types/session/records.js.map +1 -1
- package/dist/types/tool/presentation.d.ts +17 -1
- package/dist/types/tool/presentation.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/agents/QueryAgent.ts +1 -0
- package/src/compaction/context-breakdown.ts +228 -0
- package/src/compaction/extractor.ts +8 -1
- package/src/compaction/managers/structured.ts +3 -0
- package/src/compaction/manual.ts +5 -0
- package/src/compaction/serializer.ts +28 -3
- package/src/compaction/token-estimate.ts +5 -0
- package/src/compaction/verifier.ts +32 -6
- package/src/constants/compaction/index.ts +1 -0
- package/src/prompt/coding-agent-doctrine.ts +18 -20
- package/src/public-runtime.ts +24 -2
- package/src/runtime/cache-clock.ts +67 -0
- package/src/runtime/query/checkpoint.ts +49 -8
- package/src/runtime/query/compact-session.ts +101 -3
- package/src/runtime/query/executor/tool-call-admission.ts +3 -0
- package/src/runtime/query/executor.ts +165 -15
- package/src/runtime/query/index.ts +45 -1
- package/src/runtime/query/iteration/index.ts +27 -6
- package/src/runtime/query/iteration/phases/context.ts +37 -11
- package/src/runtime/query/iteration/phases/per-call-review.ts +598 -0
- package/src/runtime/query/iteration/phases/tool-review.ts +168 -83
- package/src/runtime/query/iteration/step-context.ts +29 -0
- package/src/runtime/query/iteration/step-shaping.ts +6 -2
- package/src/runtime/query/prepare-turn.ts +18 -1
- package/src/runtime/query/project-instructions.ts +119 -38
- package/src/runtime/query/prompt.ts +11 -54
- package/src/runtime/query/resume-pending.ts +131 -0
- package/src/runtime/query/review-policy.ts +28 -0
- package/src/runtime/query/steering.ts +100 -96
- package/src/store/budget/disk.ts +4 -1
- package/src/tools/admit-facts.ts +6 -0
- package/src/tools/builtins/bash.ts +38 -28
- package/src/tools/builtins/browser.ts +38 -12
- package/src/tools/builtins/edit-apply.ts +12 -2
- package/src/tools/builtins/edit.ts +38 -12
- package/src/tools/builtins/exit-semantics.ts +198 -0
- package/src/tools/builtins/job.ts +1 -1
- package/src/tools/builtins/skill.ts +1 -1
- package/src/tools/builtins/structuredOutput.ts +1 -1
- package/src/tools/builtins/verify-outputs.ts +1 -1
- package/src/tools/builtins/write-file.ts +11 -6
- package/src/tools/coordinator/ask-user-question.ts +12 -1
- package/src/tools/coordinator/index.ts +10 -3
- package/src/tools/memory/delete.ts +1 -1
- package/src/tools/memory/read.ts +1 -1
- package/src/tools/memory/save.ts +4 -3
- package/src/tools/memory/search.ts +1 -1
- package/src/tools/memory/update.ts +1 -1
- package/src/tools/schedules/loop-tool.ts +4 -2
- package/src/tools/schedules/schedule-tool.ts +2 -2
- package/src/tools/task/create.ts +1 -1
- package/src/tools/untrusted-envelope.ts +1 -1
- package/src/toolsets/manager.ts +6 -1
- package/src/turn/evidence-query.ts +19 -1
- package/src/turn/evidence-recall.ts +1 -1
- package/src/types/agent/base.ts +8 -0
- package/src/types/common/index.ts +27 -0
- package/src/types/hitl/index.ts +67 -0
- package/src/types/message/index.ts +20 -2
- package/src/types/message/notice-frame.ts +88 -0
- package/src/types/provider/chat.ts +8 -0
- package/src/types/provider/config.ts +6 -0
- package/src/types/session/checkpoint.ts +5 -0
- package/src/types/session/events.ts +6 -0
- package/src/types/session/records.ts +1 -1
- package/src/types/tool/presentation.ts +16 -0
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The frame the kernel puts around a notice it sends the model: the operator's
|
|
3
|
+
* message typed while a tool ran, a background job's exit, a monitor's events.
|
|
4
|
+
*
|
|
5
|
+
* A notice is its own user-role message at the next request boundary. It is
|
|
6
|
+
* never appended to a tool result: a tool result carries only what the tool
|
|
7
|
+
* returned, and Namzu's own words inside that slot read as tool output.
|
|
8
|
+
*
|
|
9
|
+
* The frame says what the text is and whose it is, and its tag carries a
|
|
10
|
+
* random marker drawn after the text is fixed (`<namzu-notice-1f3a...>`), so
|
|
11
|
+
* nothing the text says can spell the closing tag. {@link escapeNoticeFrame}
|
|
12
|
+
* is the second layer: it turns every spelling of the tag prefix in tool
|
|
13
|
+
* output and file content into inert text before it reaches the conversation.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
import {
|
|
17
|
+
generateRenderNonce,
|
|
18
|
+
nonceClosureStatement,
|
|
19
|
+
pickRenderNonce,
|
|
20
|
+
} from '../../tools/render-nonce.js'
|
|
21
|
+
|
|
22
|
+
/** The fixed prefix of every notice tag; the real tag adds `-<marker>`. */
|
|
23
|
+
export const NOTICE_TAG = 'namzu-notice'
|
|
24
|
+
|
|
25
|
+
export type NoticeKind = 'operator-message' | 'job' | 'monitor'
|
|
26
|
+
|
|
27
|
+
const OPEN_OR_CLOSE = /<(\/?)(namzu-notice)/gi
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Make the notice tag inert: `<namzu-notice` becomes `<namzu-notice`, in any
|
|
31
|
+
* case, opening or closing, with or without a marker after it. Idempotent, so
|
|
32
|
+
* text that passes through twice (a result rebuilt on resume) is not changed
|
|
33
|
+
* again.
|
|
34
|
+
*/
|
|
35
|
+
export function escapeNoticeFrame(text: string): string {
|
|
36
|
+
return text.includes('<') ? text.replace(OPEN_OR_CLOSE, '<$1$2') : text
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/** What a frame says about whose words are inside it. */
|
|
40
|
+
export const NOTICE_PREAMBLE: Readonly<Record<NoticeKind, string>> = {
|
|
41
|
+
'operator-message': '',
|
|
42
|
+
job: 'Namzu sent this automatically. The operator did not write it, so it is neither an answer to a question you asked nor an approval.',
|
|
43
|
+
monitor:
|
|
44
|
+
'Namzu sent this automatically. The operator did not write it, so it is neither an answer to a question you asked nor an approval.',
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export function noticeTag(nonce: string): string {
|
|
48
|
+
return `${NOTICE_TAG}-${nonce}`
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export function noticeOpen(kind: NoticeKind, nonce: string): string {
|
|
52
|
+
return `<${noticeTag(nonce)} kind="${kind}">`
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export function noticeClose(nonce: string): string {
|
|
56
|
+
return `</${noticeTag(nonce)}>`
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* `label`, the preamble and the body inside one frame, the body escaped. The
|
|
61
|
+
* marker is drawn fresh for each frame and never occurs in the label or body.
|
|
62
|
+
*/
|
|
63
|
+
export function frameNotice(
|
|
64
|
+
kind: NoticeKind,
|
|
65
|
+
label: string,
|
|
66
|
+
body: string,
|
|
67
|
+
generateNonce: () => string = generateRenderNonce,
|
|
68
|
+
): string {
|
|
69
|
+
const safe = escapeNoticeFrame(body)
|
|
70
|
+
const nonce = pickRenderNonce(generateNonce, [label, safe])
|
|
71
|
+
const lines = [noticeOpen(kind, nonce), label]
|
|
72
|
+
if (NOTICE_PREAMBLE[kind]) lines.push(NOTICE_PREAMBLE[kind])
|
|
73
|
+
lines.push(nonceClosureStatement(noticeClose(nonce)), safe, noticeClose(nonce))
|
|
74
|
+
return lines.join('\n')
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
const OPERATOR_FRAME = new RegExp(
|
|
78
|
+
`^<${NOTICE_TAG}-([0-9a-f]+) kind="operator-message">\\n[^\\n]*\\n[^\\n]*\\n([\\s\\S]*)\\n</${NOTICE_TAG}-\\1>$`,
|
|
79
|
+
)
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* The operator's text inside a frame {@link frameNotice} made for an operator
|
|
83
|
+
* message, as the frame held it (tag already made inert), or `undefined` for
|
|
84
|
+
* any other text.
|
|
85
|
+
*/
|
|
86
|
+
export function readOperatorNotice(content: string): string | undefined {
|
|
87
|
+
return OPERATOR_FRAME.exec(content)?.[2]
|
|
88
|
+
}
|
|
@@ -21,6 +21,14 @@ export type ResponseFormat =
|
|
|
21
21
|
|
|
22
22
|
export interface CacheControl {
|
|
23
23
|
type: 'auto' | 'ephemeral'
|
|
24
|
+
/**
|
|
25
|
+
* How long the provider should keep this prefix cached: `'5m'` (the
|
|
26
|
+
* default every provider uses when this is absent) or `'1h'`. Honoured only
|
|
27
|
+
* by a driver that has an extended lifetime; others ignore it. The longer
|
|
28
|
+
* lifetime is priced higher for the cache write, so asking for it is a cost
|
|
29
|
+
* decision, not a translation.
|
|
30
|
+
*/
|
|
31
|
+
ttl?: '5m' | '1h'
|
|
24
32
|
}
|
|
25
33
|
|
|
26
34
|
export interface ChatCompletionParams {
|
|
@@ -157,6 +157,12 @@ export interface ProviderCapabilities {
|
|
|
157
157
|
/** Whether the driver maps document blocks returned by tools onto its result wire. */
|
|
158
158
|
supportsToolResultDocuments?: boolean
|
|
159
159
|
maxOutputTokens?: number
|
|
160
|
+
/**
|
|
161
|
+
* Prompt-cache lifetimes the driver can be asked for through
|
|
162
|
+
* `cacheControl.ttl`. Absent means the driver offers none (it has no cache,
|
|
163
|
+
* or the lifetime is the provider's own and cannot be chosen or read).
|
|
164
|
+
*/
|
|
165
|
+
cacheTtl?: readonly ('5m' | '1h')[]
|
|
160
166
|
}
|
|
161
167
|
|
|
162
168
|
export interface ProviderFactoryResult {
|
|
@@ -79,6 +79,11 @@ export const TokenUsageSchema = z
|
|
|
79
79
|
cachedTokens: count,
|
|
80
80
|
cacheWriteTokens: count,
|
|
81
81
|
reasoningTokens: count.optional(),
|
|
82
|
+
cacheTtlMs: count.optional(),
|
|
83
|
+
cacheWriteTtlTokens: z
|
|
84
|
+
.object({ fiveMin: count.optional(), oneHour: count.optional() })
|
|
85
|
+
.strict()
|
|
86
|
+
.optional(),
|
|
82
87
|
})
|
|
83
88
|
.strict()
|
|
84
89
|
|
|
@@ -811,6 +811,12 @@ type CoreSessionEvent =
|
|
|
811
811
|
turnId: TurnId
|
|
812
812
|
usage: TokenUsage
|
|
813
813
|
cost: CostInfo
|
|
814
|
+
/**
|
|
815
|
+
* The prompt cache after the latest model call alone (not the turn
|
|
816
|
+
* total above). Present only when the driver reports a lifetime;
|
|
817
|
+
* absent means unknown, and a host must not assume one.
|
|
818
|
+
*/
|
|
819
|
+
cache?: { ttlMs: number; touched: boolean }
|
|
814
820
|
/**
|
|
815
821
|
* How large the CONTEXT is right now, and how large it may get.
|
|
816
822
|
*
|
|
@@ -494,7 +494,7 @@ export const DecisionExpiredRecordSchema = inTurn('decision_expired', {
|
|
|
494
494
|
export const CompactionRecordSchema = recordSchema('compaction', {
|
|
495
495
|
compactionId: text.min(1),
|
|
496
496
|
strategy: text.min(1),
|
|
497
|
-
trigger: z.enum(['auto', 'manual']),
|
|
497
|
+
trigger: z.enum(['auto', 'manual', 'idle']),
|
|
498
498
|
replacesSeqRange: z.tuple([positive, positive]),
|
|
499
499
|
summary: z.union([z.array(messageBody), spill]),
|
|
500
500
|
keptMessageIds: z.array(messageId),
|
|
@@ -106,6 +106,16 @@ export type ToolFailureReason =
|
|
|
106
106
|
| 'unknown_tool'
|
|
107
107
|
| 'timed_out'
|
|
108
108
|
| 'invalid_input'
|
|
109
|
+
/** An edit or write on a file the conversation never read. */
|
|
110
|
+
| 'not_read'
|
|
111
|
+
/** An edit or write based on a copy that has since changed on disk. */
|
|
112
|
+
| 'changed_on_disk'
|
|
113
|
+
/** An edit whose text is not in the file. */
|
|
114
|
+
| 'text_not_found'
|
|
115
|
+
/** An edit whose text appears more than once. */
|
|
116
|
+
| 'not_unique'
|
|
117
|
+
/** The call's arguments did not fit the tool's input schema, so the tool never ran. */
|
|
118
|
+
| 'invalid_arguments'
|
|
109
119
|
|
|
110
120
|
/**
|
|
111
121
|
* What a call was about and what came of it, as typed fields.
|
|
@@ -126,6 +136,12 @@ export type ToolFacts =
|
|
|
126
136
|
/** The command line, on the call. */
|
|
127
137
|
readonly command?: string
|
|
128
138
|
readonly exitCode?: number
|
|
139
|
+
/**
|
|
140
|
+
* A non-zero `exitCode` that is the command's answer and not a failure
|
|
141
|
+
* (`grep` found nothing, `diff` found a difference): a short plain
|
|
142
|
+
* sentence. A host draws the call as having succeeded.
|
|
143
|
+
*/
|
|
144
|
+
readonly exitNote?: string
|
|
129
145
|
readonly timedOut?: boolean
|
|
130
146
|
/** The signal that ended it, when one did. */
|
|
131
147
|
readonly signal?: string
|