@kodax-ai/kodax 0.7.76 → 0.7.78
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 +758 -371
- package/LICENSE +158 -158
- package/README.md +1702 -1508
- package/README_CN.md +1019 -869
- package/config-templates/config.example.jsonc +86 -4
- package/config-templates/integrations/a2a.example.jsonc +98 -98
- package/config-templates/integrations/extensions.example.jsonc +7 -7
- package/config-templates/integrations/mcp.example.jsonc +16 -16
- package/dist/builtin/code-review/SKILL.md +22 -22
- package/dist/builtin/skill-creator/scripts/aggregate-benchmark.d.ts +46 -46
- package/dist/builtin/skill-creator/scripts/analyze-benchmark.d.ts +46 -46
- package/dist/builtin/skill-creator/scripts/compare-runs.d.ts +62 -62
- package/dist/builtin/skill-creator/scripts/generate-review.d.ts +33 -33
- package/dist/builtin/skill-creator/scripts/grade-evals.d.ts +73 -73
- package/dist/builtin/skill-creator/scripts/improve-description.d.ts +23 -23
- package/dist/builtin/skill-creator/scripts/init-skill.d.ts +14 -14
- package/dist/builtin/skill-creator/scripts/install-skill.d.ts +29 -29
- package/dist/builtin/skill-creator/scripts/package-skill.d.ts +38 -38
- package/dist/builtin/skill-creator/scripts/quick-validate.d.ts +8 -8
- package/dist/builtin/skill-creator/scripts/run-eval.d.ts +66 -66
- package/dist/builtin/skill-creator/scripts/run-loop.d.ts +49 -49
- package/dist/builtin/skill-creator/scripts/run-trigger-eval.d.ts +58 -58
- package/dist/chunks/agent-ASP4MS3X.js +2 -0
- package/dist/chunks/argument-completer-JYQ7FX3W.js +2 -0
- package/dist/chunks/chunk-2CFHBKRE.js +5 -0
- package/dist/chunks/chunk-35PPHOQ2.js +292 -0
- package/dist/chunks/chunk-43QNNDHR.js +29 -0
- package/dist/chunks/chunk-5BNQXXGY.js +1 -0
- package/dist/chunks/chunk-5GO6FH7L.js +458 -0
- package/dist/chunks/chunk-5NDCSFOP.js +78 -0
- package/dist/chunks/chunk-6FOJVETH.js +22 -0
- package/dist/chunks/chunk-6XM4B6K2.js +48 -0
- package/dist/chunks/chunk-6YZUE6NC.js +240 -0
- package/dist/chunks/{chunk-RDXRM3UI.js → chunk-7OEBJGHK.js} +1 -1
- package/dist/chunks/chunk-KQLQYHWU.js +386 -0
- package/dist/chunks/chunk-NXO6GWSY.js +46 -0
- package/dist/chunks/chunk-T2XZTLYE.js +316 -0
- package/dist/chunks/chunk-TQDBTTIM.js +348 -0
- package/dist/chunks/{chunk-SMT2JSM3.js → chunk-UID7BLAB.js} +9 -9
- package/dist/chunks/chunk-VAT2QYXM.js +765 -0
- package/dist/chunks/chunk-YAZQTC2L.js +5 -0
- package/dist/chunks/chunk-YVRYHC4C.js +655 -0
- package/dist/chunks/{chunk-PXKSE54E.js → chunk-Z3KFRTSB.js} +1 -1
- package/dist/chunks/compaction-config-BQSSIWK5.js +2 -0
- package/dist/chunks/{construction-bootstrap-5F5KF2BZ.js → construction-bootstrap-VQLQGWPY.js} +1 -1
- package/dist/chunks/dist-BFT5YIGU.js +2 -0
- package/dist/chunks/dist-PCFE24YP.js +2 -0
- package/dist/chunks/host-UTFXCYYM.js +2 -0
- package/dist/chunks/run-manager-PJU3WIFJ.js +2 -0
- package/dist/chunks/utils-SID4HW2Q.js +2 -0
- package/dist/index.d.ts +21 -19
- package/dist/index.js +6 -6
- package/dist/kodax_bootstrap.js +25 -25
- package/dist/kodax_cli.js +1787 -1341
- package/dist/kodax_resume.js +17 -17
- package/dist/provider-capabilities.json +392 -362
- package/dist/runtime-worker.js +1707 -1279
- package/dist/sandbox-workspace-session.js +563 -0
- package/dist/sdk-a2a.d.ts +18 -17
- package/dist/sdk-a2a.js +8 -8
- package/dist/sdk-agent.d.ts +320 -70
- package/dist/sdk-agent.js +1 -1
- package/dist/sdk-coding.d.ts +135 -168
- package/dist/sdk-coding.js +1 -1
- package/dist/sdk-experimental-memory.d.ts +14 -597
- package/dist/sdk-experimental-memory.js +1 -1
- package/dist/sdk-llm.d.ts +219 -6
- package/dist/sdk-llm.js +1 -1
- package/dist/sdk-mcp.js +1 -1
- package/dist/sdk-media.d.ts +1 -1
- package/dist/sdk-media.js +1 -1
- package/dist/sdk-repl.d.ts +70 -27
- package/dist/sdk-repl.js +2 -2
- package/dist/sdk-runtime.d.ts +212 -149
- package/dist/sdk-runtime.js +1 -1
- package/dist/sdk-sandbox.d.ts +93 -0
- package/dist/sdk-sandbox.js +2 -0
- package/dist/sdk-session.d.ts +8 -8
- package/dist/sdk-session.js +1 -1
- package/dist/sdk-skills.d.ts +2 -2
- package/dist/sdk-skills.js +1 -1
- package/dist/semantic-worker.js +15 -15
- package/dist/types-chunks/{base.d-ChvpaKjZ.d.ts → base.d-4e74xDdy.d.ts} +13 -1
- package/dist/types-chunks/{bash-prefix-extractor.d-r1beOESM.d.ts → bash-prefix-extractor.d-uAe2Oqda.d.ts} +319 -9
- package/dist/types-chunks/{capability-learning.d-DPrYxRjF.d.ts → capability-learning.d-CVsdHw4j.d.ts} +1 -1
- package/dist/types-chunks/{capsule.d-zeqV4IQX.d.ts → capsule.d-BlSv9l3V.d.ts} +2 -2
- package/dist/types-chunks/{guardrail.d-CWYD1bdL.d.ts → guardrail.d-BRE_ErEj.d.ts} +1 -1
- package/dist/types-chunks/{guardrail.d-qjuKJZ31.d.ts → guardrail.d-CXDYRgZ3.d.ts} +201 -35
- package/dist/types-chunks/{history-retrieval.d-BKTJIrVd.d.ts → history-retrieval.d-DtCy7x64.d.ts} +2 -2
- package/dist/types-chunks/{integration-config.d-ojG4swOP.d.ts → integration-config.d-BNowXE8k.d.ts} +23 -8
- package/dist/types-chunks/{public-api.d-CX4B11qY.d.ts → public-api.d-B3AohsxN.d.ts} +37 -8
- package/dist/types-chunks/{commands.d-DUxnK2TU.d.ts → repl.d-Ie_ZXb_U.d.ts} +89 -78
- package/dist/types-chunks/{side-query.d-DWTMsndP.d.ts → resolver.d-iAQ9ocLB.d.ts} +23 -74
- package/dist/types-chunks/{run-manager.d-B9fEIjZk.d.ts → run-manager.d-D1twIhF9.d.ts} +1 -1
- package/dist/types-chunks/{sdk-session-B0fhAOPa.d.ts → sdk-session-DB9KksIx.d.ts} +3 -3
- package/dist/types-chunks/side-query.d-DTuLPcC5.d.ts +77 -0
- package/dist/types-chunks/types-D3g6XUQr.d.ts +662 -0
- package/dist/types-chunks/{types.d-sRLugmjy.d.ts → types.d-BA-Jwpfs.d.ts} +506 -11
- package/dist/types-chunks/{types.d-DEctY20M.d.ts → types.d-BH0ZkTGf.d.ts} +2 -2
- package/dist/types-chunks/{types.d-DCQVBqVn.d.ts → types.d-BbtGlKZu.d.ts} +25 -3
- package/dist/types-chunks/{types.d-CSmF0t0n.d.ts → types.d-DIpZJKUl.d.ts} +15 -0
- package/dist/types-chunks/{types.d-Bm_y6YuM.d.ts → types.d-DVDTIfB_.d.ts} +4 -4
- package/dist/types-chunks/{utils.d-D0wPxz8y.d.ts → utils.d-CVp6bFl9.d.ts} +23 -7
- package/docs/SDK_EMBEDDER_GUIDE.md +592 -119
- package/package.json +9 -1
- package/scripts/kodax-bin.cjs +28 -28
- package/scripts/production-env.cjs +25 -25
- package/dist/chunks/agent-7X5CFET2.js +0 -2
- package/dist/chunks/argument-completer-3NHIKB4N.js +0 -2
- package/dist/chunks/chunk-4PWPNCNK.js +0 -158
- package/dist/chunks/chunk-7FJNLJLF.js +0 -369
- package/dist/chunks/chunk-COQYLD4U.js +0 -5
- package/dist/chunks/chunk-D3T24FJW.js +0 -78
- package/dist/chunks/chunk-EI4JBQKL.js +0 -46
- package/dist/chunks/chunk-HGT6WQ24.js +0 -321
- package/dist/chunks/chunk-HS3XHF3R.js +0 -622
- package/dist/chunks/chunk-IDCGNQ4H.js +0 -5
- package/dist/chunks/chunk-KAY2XLCP.js +0 -74
- package/dist/chunks/chunk-OD6LVXU6.js +0 -329
- package/dist/chunks/chunk-OSF3H4RR.js +0 -22
- package/dist/chunks/chunk-TGMBHGZO.js +0 -427
- package/dist/chunks/chunk-VWSLC2WO.js +0 -770
- package/dist/chunks/chunk-Y3AMP22L.js +0 -37
- package/dist/chunks/compaction-config-7J2XE35D.js +0 -2
- package/dist/chunks/dist-2RA7LSH3.js +0 -2
- package/dist/chunks/dist-URKXBOC6.js +0 -2
- package/dist/chunks/host-RKZ2OGFT.js +0 -2
- package/dist/chunks/run-manager-7RM4HEH6.js +0 -2
- package/dist/chunks/utils-X3TEH6IO.js +0 -2
- package/dist/types-chunks/center-types.d-BBT122uJ.d.ts +0 -91
|
@@ -0,0 +1,662 @@
|
|
|
1
|
+
import { k as KodaXMessage } from './types.d-DIpZJKUl.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @kodax-ai/agent Types
|
|
5
|
+
*
|
|
6
|
+
* 通用 Agent 类型定义
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
type KodaXJsonPrimitive = string | number | boolean | null;
|
|
10
|
+
type KodaXJsonValue = KodaXJsonPrimitive | KodaXJsonValue[] | {
|
|
11
|
+
[key: string]: KodaXJsonValue;
|
|
12
|
+
};
|
|
13
|
+
interface KodaXSessionEntryBase {
|
|
14
|
+
id: string;
|
|
15
|
+
parentId: string | null;
|
|
16
|
+
timestamp: string;
|
|
17
|
+
/**
|
|
18
|
+
* Stable logical identity for this transcript item. Cloned/forked entries get
|
|
19
|
+
* a fresh physical `id` but keep their source entry's `logicalId`, allowing
|
|
20
|
+
* SDK hosts to group or fold cloned history without comparing content.
|
|
21
|
+
*/
|
|
22
|
+
logicalId?: string;
|
|
23
|
+
/** Root physical entry id this item was cloned from, when it is a clone. */
|
|
24
|
+
sourceEntryId?: string;
|
|
25
|
+
}
|
|
26
|
+
interface KodaXSessionMessageEntry extends KodaXSessionEntryBase {
|
|
27
|
+
type: 'message';
|
|
28
|
+
message: KodaXMessage;
|
|
29
|
+
}
|
|
30
|
+
interface KodaXSessionCompactionEntry extends KodaXSessionEntryBase {
|
|
31
|
+
type: 'compaction';
|
|
32
|
+
summary: string;
|
|
33
|
+
firstKeptEntryId?: string;
|
|
34
|
+
tokensBefore?: number;
|
|
35
|
+
tokensAfter?: number;
|
|
36
|
+
artifactLedgerId?: string;
|
|
37
|
+
reason?: string;
|
|
38
|
+
details?: KodaXJsonValue;
|
|
39
|
+
memorySeed?: KodaXCompactMemorySeed;
|
|
40
|
+
/**
|
|
41
|
+
* FEATURE_072: post-compact ledger summary + file-content messages that
|
|
42
|
+
* are inlined after the compaction summary at slicer time
|
|
43
|
+
* (`getSessionMessagesFromLineage`). Stored here so they leave the active
|
|
44
|
+
* path automatically when a new compaction entry is appended.
|
|
45
|
+
*
|
|
46
|
+
* NOTE: attachments are emitted by the slicer, NOT by `getContextMessagesForEntry`
|
|
47
|
+
* — preserving the latter's 1-to-1 contract that `entryMatchesContextMessage`
|
|
48
|
+
* and FEATURE_073's future slicing both depend on.
|
|
49
|
+
*/
|
|
50
|
+
postCompactAttachments?: readonly KodaXMessage[];
|
|
51
|
+
}
|
|
52
|
+
interface KodaXSessionBranchSummaryEntry extends KodaXSessionEntryBase {
|
|
53
|
+
type: 'branch_summary';
|
|
54
|
+
summary: string;
|
|
55
|
+
fromId?: string;
|
|
56
|
+
details?: KodaXJsonValue;
|
|
57
|
+
}
|
|
58
|
+
interface KodaXSessionLabelEntry extends KodaXSessionEntryBase {
|
|
59
|
+
type: 'label';
|
|
60
|
+
targetId: string;
|
|
61
|
+
label?: string;
|
|
62
|
+
}
|
|
63
|
+
interface KodaXSessionArchiveMarkerEntry extends KodaXSessionEntryBase {
|
|
64
|
+
type: 'archive_marker';
|
|
65
|
+
/** Links to the corresponding batch in the .archive.jsonl sidecar file */
|
|
66
|
+
archiveBatchId: string;
|
|
67
|
+
/** Number of entries that were archived in this batch */
|
|
68
|
+
archivedEntryCount: number;
|
|
69
|
+
/** Brief summary of the archived content */
|
|
70
|
+
summary: string;
|
|
71
|
+
}
|
|
72
|
+
interface KodaXSessionRewindMarkerEntry extends KodaXSessionEntryBase {
|
|
73
|
+
type: 'rewind_marker';
|
|
74
|
+
targetId: string;
|
|
75
|
+
fromId?: string;
|
|
76
|
+
truncatedCount: number;
|
|
77
|
+
summary: string;
|
|
78
|
+
}
|
|
79
|
+
interface KodaXSessionClientNoticeEntry extends KodaXSessionEntryBase {
|
|
80
|
+
type: 'client_notice';
|
|
81
|
+
source: string;
|
|
82
|
+
content: string;
|
|
83
|
+
turnId?: string;
|
|
84
|
+
payload?: KodaXJsonValue;
|
|
85
|
+
}
|
|
86
|
+
interface KodaXMemoryOutcomeDigest {
|
|
87
|
+
readonly id: string;
|
|
88
|
+
readonly reviewKey: string;
|
|
89
|
+
/** Stable root-episode identity; absent on pre-F263 digests. */
|
|
90
|
+
readonly episodeId?: string;
|
|
91
|
+
readonly sessionId: string;
|
|
92
|
+
readonly branchId: string;
|
|
93
|
+
readonly sequence: number;
|
|
94
|
+
readonly objective: string;
|
|
95
|
+
readonly actionSignature?: string;
|
|
96
|
+
readonly approach: string;
|
|
97
|
+
/**
|
|
98
|
+
* `cancelled` is reserved for a host-bound explicit Memory intent. Ordinary
|
|
99
|
+
* cancelled episodes do not produce an outcome digest.
|
|
100
|
+
*/
|
|
101
|
+
readonly outcome: 'succeeded' | 'failed' | 'cancelled';
|
|
102
|
+
readonly summary: string;
|
|
103
|
+
readonly preconditions?: string;
|
|
104
|
+
readonly lesson?: string;
|
|
105
|
+
readonly evidenceRefs: readonly string[];
|
|
106
|
+
readonly evidence?: readonly KodaXMemoryOutcomeEvidence[];
|
|
107
|
+
/**
|
|
108
|
+
* Explicit durable intent captured from the Action LLM and bound by the
|
|
109
|
+
* host to an exact quote in the current user turn. It is evidence for the
|
|
110
|
+
* governed reviewer, never proof that Memory was queued or applied.
|
|
111
|
+
*/
|
|
112
|
+
readonly memoryIntent?: KodaXMemoryIntent;
|
|
113
|
+
readonly memoryInfluence?: readonly KodaXMemoryInfluenceRef[];
|
|
114
|
+
readonly visibility: 'prompt_safe' | 'private' | 'sensitive';
|
|
115
|
+
readonly createdAt: string;
|
|
116
|
+
}
|
|
117
|
+
interface KodaXMemoryIntent {
|
|
118
|
+
readonly operation: 'remember' | 'correct';
|
|
119
|
+
readonly evidenceRef: string;
|
|
120
|
+
/** Sanitized model-derived claim proposed for governed review. */
|
|
121
|
+
readonly candidateStatement: string;
|
|
122
|
+
/** Sanitized representation of the exact current-user quote verified by the host. */
|
|
123
|
+
readonly userQuote: string;
|
|
124
|
+
}
|
|
125
|
+
interface KodaXMemoryOutcomeEvidence {
|
|
126
|
+
readonly ref: string;
|
|
127
|
+
readonly grade: 'authoritative' | 'verified' | 'corroborated' | 'observed' | 'inferred';
|
|
128
|
+
readonly source: 'user' | 'host' | 'tool' | 'environment' | 'agent';
|
|
129
|
+
readonly verdict?: 'passed' | 'failed' | 'inconclusive';
|
|
130
|
+
readonly observedAt: string;
|
|
131
|
+
}
|
|
132
|
+
interface KodaXMemoryInfluenceRef {
|
|
133
|
+
readonly decisionReceiptRef: string;
|
|
134
|
+
readonly grade: 'direct' | 'supporting' | 'exposed' | 'unknown';
|
|
135
|
+
}
|
|
136
|
+
interface KodaXSessionMemoryOutcomeDigestEntry extends KodaXSessionEntryBase {
|
|
137
|
+
readonly type: 'memory_outcome_digest';
|
|
138
|
+
readonly digest: KodaXMemoryOutcomeDigest;
|
|
139
|
+
/** Durable F263 review job identity. Absent on pre-F263 lineage records. */
|
|
140
|
+
readonly jobId?: string;
|
|
141
|
+
}
|
|
142
|
+
interface KodaXSessionMemoryReviewReceiptEntry extends KodaXSessionEntryBase {
|
|
143
|
+
readonly type: 'memory_review_receipt';
|
|
144
|
+
/** Distinguishes repeated review keys across branch epochs. */
|
|
145
|
+
readonly jobId?: string;
|
|
146
|
+
readonly reviewKey: string;
|
|
147
|
+
readonly proposalIds: readonly string[];
|
|
148
|
+
readonly status: 'completed' | 'no_action';
|
|
149
|
+
readonly completedAt: string;
|
|
150
|
+
}
|
|
151
|
+
type KodaXGoalStatus = 'active' | 'paused' | 'budget_limited' | 'blocked' | 'complete';
|
|
152
|
+
/**
|
|
153
|
+
* Persistent user-set goal state. v0.7.44 FEATURE_192 — backs the
|
|
154
|
+
* `/goal` slash command and the get_goal / create_goal / update_goal
|
|
155
|
+
* tools.
|
|
156
|
+
*
|
|
157
|
+
* Persistence model: each lifecycle event (create / update / pause /
|
|
158
|
+
* resume / clear / budget_limited / blocked / complete) appends a
|
|
159
|
+
* `KodaXSessionGoalEntry` carrying a frozen `KodaXGoalState` snapshot
|
|
160
|
+
* to the session lineage. `readLatestGoalFromBranch` walks the active
|
|
161
|
+
* branch's message-entry IDs and returns the latest goal entry whose
|
|
162
|
+
* parentId belongs to that branch — so forks and rewinds naturally
|
|
163
|
+
* drop goals attached to abandoned message paths.
|
|
164
|
+
*/
|
|
165
|
+
interface KodaXGoalState {
|
|
166
|
+
readonly version: 1;
|
|
167
|
+
/** `${createdAt}-${rand}` — stable across updates of the same goal. */
|
|
168
|
+
readonly id: string;
|
|
169
|
+
readonly objective: string;
|
|
170
|
+
readonly status: KodaXGoalStatus;
|
|
171
|
+
/** Optional explicit token budget; null when the user did not set one. */
|
|
172
|
+
readonly tokenBudget: number | null;
|
|
173
|
+
readonly tokensUsed: number;
|
|
174
|
+
readonly timeUsedSeconds: number;
|
|
175
|
+
/** Consecutive turns the model has reported the same blocker. */
|
|
176
|
+
readonly blockerTurnCount: number;
|
|
177
|
+
/** The blocker_kind string the model last reported, or null. */
|
|
178
|
+
readonly lastBlockerKind: string | null;
|
|
179
|
+
readonly createdAt: number;
|
|
180
|
+
readonly updatedAt: number;
|
|
181
|
+
}
|
|
182
|
+
type KodaXGoalEventType = 'created' | 'updated' | 'paused' | 'resumed' | 'cleared' | 'budget_limited' | 'blocked' | 'complete';
|
|
183
|
+
interface KodaXSessionGoalEntry extends KodaXSessionEntryBase {
|
|
184
|
+
type: 'goal';
|
|
185
|
+
/** Snapshot at time of event; `null` only when `event === 'cleared'`. */
|
|
186
|
+
goal: KodaXGoalState | null;
|
|
187
|
+
event: KodaXGoalEventType;
|
|
188
|
+
}
|
|
189
|
+
type KodaXSessionEntry = KodaXSessionMessageEntry | KodaXSessionCompactionEntry | KodaXSessionBranchSummaryEntry | KodaXSessionLabelEntry | KodaXSessionArchiveMarkerEntry | KodaXSessionRewindMarkerEntry | KodaXSessionClientNoticeEntry | KodaXSessionMemoryOutcomeDigestEntry | KodaXSessionMemoryReviewReceiptEntry | KodaXSessionGoalEntry;
|
|
190
|
+
interface KodaXSessionArtifactLedgerEntry {
|
|
191
|
+
id: string;
|
|
192
|
+
kind: 'file_read' | 'file_modified' | 'file_created' | 'file_deleted' | 'path_scope' | 'search_scope' | 'command_scope' | 'check_result' | 'decision' | 'image_input' | 'tombstone';
|
|
193
|
+
sourceTool?: string;
|
|
194
|
+
action?: string;
|
|
195
|
+
target: string;
|
|
196
|
+
displayTarget?: string;
|
|
197
|
+
summary?: string;
|
|
198
|
+
sessionEntryId?: string;
|
|
199
|
+
timestamp: string;
|
|
200
|
+
metadata?: Record<string, KodaXJsonValue>;
|
|
201
|
+
}
|
|
202
|
+
interface KodaXCompactMemoryProgress {
|
|
203
|
+
completed: string[];
|
|
204
|
+
inProgress: string[];
|
|
205
|
+
blockers: string[];
|
|
206
|
+
}
|
|
207
|
+
interface KodaXCompactMemorySeed {
|
|
208
|
+
objective?: string;
|
|
209
|
+
constraints: string[];
|
|
210
|
+
progress: KodaXCompactMemoryProgress;
|
|
211
|
+
keyDecisions: string[];
|
|
212
|
+
nextSteps: string[];
|
|
213
|
+
keyContext: string[];
|
|
214
|
+
importantTargets: string[];
|
|
215
|
+
tombstones: string[];
|
|
216
|
+
}
|
|
217
|
+
interface KodaXSessionLineage {
|
|
218
|
+
version: 2;
|
|
219
|
+
activeEntryId: string | null;
|
|
220
|
+
entries: KodaXSessionEntry[];
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
interface MemoryContextIdentity {
|
|
224
|
+
/** Explicit owner home for durable runtime state; never persisted in review envelopes. */
|
|
225
|
+
readonly configHome?: string;
|
|
226
|
+
readonly tenantId: string;
|
|
227
|
+
readonly workspaceId?: string;
|
|
228
|
+
readonly userId?: string;
|
|
229
|
+
readonly agentId: string;
|
|
230
|
+
readonly projectId?: string;
|
|
231
|
+
readonly sessionId: string;
|
|
232
|
+
}
|
|
233
|
+
interface MemoryApplicability {
|
|
234
|
+
readonly tenantId: string;
|
|
235
|
+
readonly workspaceId?: string;
|
|
236
|
+
readonly userId?: string;
|
|
237
|
+
readonly agentId?: string;
|
|
238
|
+
readonly projectId?: string;
|
|
239
|
+
readonly sessionId?: string;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
type MemoryRefKind = 'working_context' | 'session_trace' | 'artifact_ledger' | 'learning_proposal' | 'memdir' | 'skill' | 'workflow_run' | 'reasoning_report' | 'self_manual' | 'project_doc';
|
|
243
|
+
|
|
244
|
+
type MemoryScope = 'turn' | 'session' | 'project' | 'workspace' | 'agent' | 'user' | 'builtin';
|
|
245
|
+
type MemoryClaimKind = 'fact' | 'policy' | 'preference' | 'procedure' | 'episode';
|
|
246
|
+
type MemoryLifecycle = 'pending' | 'active' | 'provisional' | 'trusted' | 'stale' | 'quarantined' | 'archived' | 'readonly';
|
|
247
|
+
type MemoryAuthority = 'read_only' | 'proposal_only' | 'approved_write';
|
|
248
|
+
type MemoryVisibility = 'prompt_safe' | 'private' | 'sensitive';
|
|
249
|
+
interface MemoryItemRef {
|
|
250
|
+
readonly kind: MemoryRefKind;
|
|
251
|
+
readonly id: string;
|
|
252
|
+
readonly scope: MemoryScope;
|
|
253
|
+
readonly scopeId?: string;
|
|
254
|
+
readonly applicability?: MemoryApplicability;
|
|
255
|
+
readonly claimKind?: MemoryClaimKind;
|
|
256
|
+
readonly claimKey?: string;
|
|
257
|
+
readonly actionSignature?: string;
|
|
258
|
+
readonly title?: string;
|
|
259
|
+
readonly owner: 'user' | 'project' | 'kodax' | 'external';
|
|
260
|
+
readonly lifecycle: MemoryLifecycle;
|
|
261
|
+
readonly authority: MemoryAuthority;
|
|
262
|
+
readonly visibility: MemoryVisibility;
|
|
263
|
+
readonly sourceRefs: readonly string[];
|
|
264
|
+
readonly relatedRefs: readonly string[];
|
|
265
|
+
readonly version?: string;
|
|
266
|
+
readonly bodyFingerprint?: string;
|
|
267
|
+
readonly storageUri?: string;
|
|
268
|
+
readonly createdAt?: string;
|
|
269
|
+
readonly updatedAt?: string;
|
|
270
|
+
readonly lastUsedAt?: string;
|
|
271
|
+
readonly pinned?: boolean;
|
|
272
|
+
readonly applyReceiptRef?: string;
|
|
273
|
+
readonly expectedFingerprint?: string;
|
|
274
|
+
readonly resultingFingerprint?: string;
|
|
275
|
+
}
|
|
276
|
+
interface MemoryRefFilter {
|
|
277
|
+
readonly kinds?: readonly MemoryRefKind[];
|
|
278
|
+
readonly scopes?: readonly MemoryScope[];
|
|
279
|
+
readonly lifecycles?: readonly MemoryLifecycle[];
|
|
280
|
+
readonly includePrivate?: boolean;
|
|
281
|
+
readonly includeSensitive?: boolean;
|
|
282
|
+
readonly query?: string;
|
|
283
|
+
}
|
|
284
|
+
interface MemoryBodySnapshot {
|
|
285
|
+
readonly ref: MemoryItemRef;
|
|
286
|
+
readonly body: string;
|
|
287
|
+
readonly bodyFingerprint: string;
|
|
288
|
+
readonly frontmatter?: Readonly<Record<string, string>>;
|
|
289
|
+
readonly readAt: string;
|
|
290
|
+
readonly warnings: readonly string[];
|
|
291
|
+
}
|
|
292
|
+
type MemoryProposalAction = 'no_op' | 'link_refs' | 'write_memdir' | 'patch_memdir' | 'handoff_to_skill_loop' | 'quarantine' | 'archive' | 'conflict_report';
|
|
293
|
+
interface MemoryApplyPreview {
|
|
294
|
+
readonly summary: string;
|
|
295
|
+
readonly changedRefs: readonly MemoryItemRef[];
|
|
296
|
+
readonly changedPaths: readonly string[];
|
|
297
|
+
readonly beforeFingerprints: Readonly<Record<string, string>>;
|
|
298
|
+
readonly afterFingerprints?: Readonly<Record<string, string>>;
|
|
299
|
+
readonly diff?: string;
|
|
300
|
+
readonly warnings: readonly string[];
|
|
301
|
+
}
|
|
302
|
+
interface MemoryActionProposal {
|
|
303
|
+
readonly id: string;
|
|
304
|
+
readonly action: MemoryProposalAction;
|
|
305
|
+
readonly targetRefs: readonly MemoryItemRef[];
|
|
306
|
+
readonly sourceRefs: readonly MemoryItemRef[];
|
|
307
|
+
readonly expectedFingerprints: Readonly<Record<string, string>>;
|
|
308
|
+
readonly rationale: string;
|
|
309
|
+
readonly risk: 'low' | 'medium' | 'high';
|
|
310
|
+
readonly preview: MemoryApplyPreview;
|
|
311
|
+
readonly requiresApproval: true;
|
|
312
|
+
readonly createdAt: string;
|
|
313
|
+
}
|
|
314
|
+
interface MemoryApplyResult {
|
|
315
|
+
readonly proposalId: string;
|
|
316
|
+
readonly applied: boolean;
|
|
317
|
+
readonly changedRefs: readonly MemoryItemRef[];
|
|
318
|
+
readonly changedPaths: readonly string[];
|
|
319
|
+
readonly skippedReason?: string;
|
|
320
|
+
readonly warnings: readonly string[];
|
|
321
|
+
}
|
|
322
|
+
interface MemoryRejectResult {
|
|
323
|
+
readonly proposalId: string;
|
|
324
|
+
readonly rejected: boolean;
|
|
325
|
+
readonly skippedReason?: string;
|
|
326
|
+
readonly review?: MemoryReviewPlan;
|
|
327
|
+
readonly warnings: readonly string[];
|
|
328
|
+
}
|
|
329
|
+
interface MemoryLifecycleOperationResult {
|
|
330
|
+
readonly refId: string;
|
|
331
|
+
readonly operation: 'archive' | 'forget' | 'purge';
|
|
332
|
+
readonly acknowledged: boolean;
|
|
333
|
+
readonly residualSourceRefs: readonly string[];
|
|
334
|
+
readonly warnings: readonly string[];
|
|
335
|
+
}
|
|
336
|
+
interface MemoryCuratorInput {
|
|
337
|
+
readonly includePrivate?: boolean;
|
|
338
|
+
readonly includeSensitive?: boolean;
|
|
339
|
+
}
|
|
340
|
+
interface MemoryAutoCuratorInput extends MemoryCuratorInput {
|
|
341
|
+
readonly enabled?: boolean;
|
|
342
|
+
readonly intervalMs?: number;
|
|
343
|
+
readonly minRefs?: number;
|
|
344
|
+
}
|
|
345
|
+
type MemoryAutoCuratorSkipReason = 'disabled' | 'not_due' | 'insufficient_refs';
|
|
346
|
+
interface MemoryAutoCuratorResult {
|
|
347
|
+
readonly ran: boolean;
|
|
348
|
+
readonly skippedReason?: MemoryAutoCuratorSkipReason;
|
|
349
|
+
readonly report?: MemoryGovernanceReport;
|
|
350
|
+
readonly reportPath?: string;
|
|
351
|
+
readonly nextEligibleAt?: string;
|
|
352
|
+
}
|
|
353
|
+
type MemoryGovernanceFindingKind = 'duplicate' | 'conflict' | 'stale' | 'quarantined' | 'orphaned' | 'no_op';
|
|
354
|
+
interface MemoryGovernanceFinding {
|
|
355
|
+
readonly kind: MemoryGovernanceFindingKind;
|
|
356
|
+
readonly severity: 'info' | 'warning' | 'error';
|
|
357
|
+
readonly refIds: readonly string[];
|
|
358
|
+
readonly summary: string;
|
|
359
|
+
readonly suggestedAction: MemoryProposalAction;
|
|
360
|
+
}
|
|
361
|
+
interface MemoryGovernanceReport {
|
|
362
|
+
readonly reportId: string;
|
|
363
|
+
readonly generatedAt: string;
|
|
364
|
+
readonly findings: readonly MemoryGovernanceFinding[];
|
|
365
|
+
readonly warnings: readonly string[];
|
|
366
|
+
}
|
|
367
|
+
interface MemoryPackInput {
|
|
368
|
+
readonly task: string;
|
|
369
|
+
readonly identity?: MemoryContextIdentity;
|
|
370
|
+
readonly decisionIntent?: string;
|
|
371
|
+
readonly actionSignature?: string;
|
|
372
|
+
readonly maxCandidates?: number;
|
|
373
|
+
readonly maxHints?: number;
|
|
374
|
+
readonly includePrivate?: boolean;
|
|
375
|
+
readonly includeSensitive?: boolean;
|
|
376
|
+
readonly includeSnippets?: boolean;
|
|
377
|
+
readonly ignoreMemory?: boolean;
|
|
378
|
+
readonly purpose?: 'automatic' | 'deliberate_query' | 'intervention';
|
|
379
|
+
}
|
|
380
|
+
interface MemoryPackHint {
|
|
381
|
+
readonly ref: MemoryItemRef;
|
|
382
|
+
readonly hook: string;
|
|
383
|
+
readonly reason: string;
|
|
384
|
+
readonly bodySnippet?: string;
|
|
385
|
+
readonly bodyFingerprint?: string;
|
|
386
|
+
}
|
|
387
|
+
interface MemoryPack {
|
|
388
|
+
readonly generatedAt: string;
|
|
389
|
+
readonly taskFingerprint: string;
|
|
390
|
+
readonly memoryRevision: string;
|
|
391
|
+
readonly candidates: readonly MemoryPackHint[];
|
|
392
|
+
readonly promptHints: readonly MemoryPackHint[];
|
|
393
|
+
/** @deprecated Use promptHints. Retained for F228 source compatibility. */
|
|
394
|
+
readonly hints: readonly MemoryPackHint[];
|
|
395
|
+
readonly omitted: readonly string[];
|
|
396
|
+
readonly traceMetadata: MemoryPackTraceMetadata;
|
|
397
|
+
}
|
|
398
|
+
interface MemoryPackTraceMetadata {
|
|
399
|
+
readonly selectedRefIds: readonly string[];
|
|
400
|
+
readonly omittedRefIds: readonly string[];
|
|
401
|
+
readonly taskFingerprint: string;
|
|
402
|
+
readonly suppressed: boolean;
|
|
403
|
+
}
|
|
404
|
+
type MemoryReviewTrigger = 'user_correction' | 'explicit_remember' | 'explicit_forget' | 'proposal_rejected' | 'conflict_detected' | 'episode_completed';
|
|
405
|
+
interface MemoryReviewCandidateRef {
|
|
406
|
+
readonly ref: MemoryItemRef;
|
|
407
|
+
readonly bodySnippet?: string;
|
|
408
|
+
readonly bodyFingerprint?: string;
|
|
409
|
+
readonly warnings: readonly string[];
|
|
410
|
+
}
|
|
411
|
+
interface MemoryReviewInput {
|
|
412
|
+
readonly trigger: MemoryReviewTrigger;
|
|
413
|
+
readonly userFeedback?: string;
|
|
414
|
+
readonly episodeDigest?: KodaXMemoryOutcomeDigest;
|
|
415
|
+
readonly task?: string;
|
|
416
|
+
readonly sourceRefs?: readonly string[];
|
|
417
|
+
readonly candidateRefIds?: readonly string[];
|
|
418
|
+
readonly includePrivate?: boolean;
|
|
419
|
+
readonly includeSensitive?: boolean;
|
|
420
|
+
readonly maxRefs?: number;
|
|
421
|
+
}
|
|
422
|
+
interface MemoryReviewModelInput {
|
|
423
|
+
readonly trigger: MemoryReviewTrigger;
|
|
424
|
+
readonly userFeedback: string;
|
|
425
|
+
readonly task?: string;
|
|
426
|
+
readonly sourceRefs: readonly string[];
|
|
427
|
+
readonly candidateRefs: readonly MemoryReviewCandidateRef[];
|
|
428
|
+
readonly warnings: readonly string[];
|
|
429
|
+
}
|
|
430
|
+
interface MemoryReviewDraftAction {
|
|
431
|
+
readonly action: MemoryProposalAction;
|
|
432
|
+
readonly targetRefIds: readonly string[];
|
|
433
|
+
readonly summary: string;
|
|
434
|
+
readonly rationale: string;
|
|
435
|
+
readonly confidence: 'low' | 'medium' | 'high';
|
|
436
|
+
readonly risk: 'low' | 'medium' | 'high';
|
|
437
|
+
readonly requiresApproval: true;
|
|
438
|
+
readonly proposedBody?: string;
|
|
439
|
+
readonly claimKind?: MemoryClaimKind;
|
|
440
|
+
readonly claimKey?: string;
|
|
441
|
+
readonly actionSignature?: string;
|
|
442
|
+
readonly preconditions?: string;
|
|
443
|
+
readonly counterexamples?: readonly string[];
|
|
444
|
+
readonly relationship?: 'same_claim' | 'condition_refinement' | 'conflict';
|
|
445
|
+
}
|
|
446
|
+
interface MemoryReviewPlan {
|
|
447
|
+
readonly trigger: MemoryReviewTrigger;
|
|
448
|
+
readonly createdAt: string;
|
|
449
|
+
readonly sourceRefs: readonly string[];
|
|
450
|
+
readonly candidateRefs: readonly MemoryReviewCandidateRef[];
|
|
451
|
+
readonly actions: readonly MemoryReviewDraftAction[];
|
|
452
|
+
readonly warnings: readonly string[];
|
|
453
|
+
readonly episodeDigest?: KodaXMemoryOutcomeDigest;
|
|
454
|
+
}
|
|
455
|
+
interface MemoryEpisodeReviewResult {
|
|
456
|
+
readonly plan: MemoryReviewPlan;
|
|
457
|
+
readonly proposalIds: readonly string[];
|
|
458
|
+
readonly appliedProposalIds: readonly string[];
|
|
459
|
+
readonly decisions: readonly MemoryReviewPersistenceDecision[];
|
|
460
|
+
readonly warnings: readonly string[];
|
|
461
|
+
}
|
|
462
|
+
type MemoryReviewPersistenceKind = 'create' | 'evidence_update' | 'condition_refinement' | 'conflict' | 'no_action' | 'reject' | 'quarantine';
|
|
463
|
+
interface MemoryReviewPersistenceDecision {
|
|
464
|
+
readonly actionIndex: number;
|
|
465
|
+
readonly kind: MemoryReviewPersistenceKind;
|
|
466
|
+
readonly reason: string;
|
|
467
|
+
readonly existingRefId?: string;
|
|
468
|
+
readonly proposalId?: string;
|
|
469
|
+
}
|
|
470
|
+
type MemoryReviewRunner = (input: MemoryReviewModelInput) => Promise<MemoryReviewPlan>;
|
|
471
|
+
interface MemoryController {
|
|
472
|
+
listInbox(): Promise<readonly MemoryActionProposal[]>;
|
|
473
|
+
showProposal(id: string): Promise<MemoryActionProposal | undefined>;
|
|
474
|
+
approveProposal(id: string, expectedFingerprints: Readonly<Record<string, string>>): Promise<MemoryApplyResult>;
|
|
475
|
+
rejectProposal(id: string, reason?: string): Promise<MemoryRejectResult>;
|
|
476
|
+
listRefs(filter?: MemoryRefFilter): Promise<readonly MemoryItemRef[]>;
|
|
477
|
+
readRef(ref: MemoryItemRef): Promise<MemoryBodySnapshot>;
|
|
478
|
+
runCurator(input?: MemoryCuratorInput): Promise<MemoryGovernanceReport>;
|
|
479
|
+
maybeRunAutoCurator(input?: MemoryAutoCuratorInput): Promise<MemoryAutoCuratorResult>;
|
|
480
|
+
buildMemoryPack(input: MemoryPackInput): Promise<MemoryPack>;
|
|
481
|
+
reviewMemoryFeedback(input: MemoryReviewInput): Promise<MemoryReviewPlan>;
|
|
482
|
+
prepareEpisodeReview?(digest: KodaXMemoryOutcomeDigest): Promise<MemoryReviewModelInput>;
|
|
483
|
+
applyReviewedEpisode?(plan: MemoryReviewPlan, digest: KodaXMemoryOutcomeDigest, signal?: AbortSignal, revalidateAuthority?: () => Promise<void>): Promise<MemoryEpisodeReviewResult>;
|
|
484
|
+
persistReviewPlan(plan: MemoryReviewPlan): Promise<readonly string[]>;
|
|
485
|
+
/**
|
|
486
|
+
* Resolves which episode-review proposals were actually auto-applied by the
|
|
487
|
+
* governed host policy. Used to keep durable receipts complete while user
|
|
488
|
+
* notices remain truthful.
|
|
489
|
+
*/
|
|
490
|
+
listHostAppliedEpisodeProposalIds?(proposalIds: readonly string[]): Promise<readonly string[]>;
|
|
491
|
+
reviewEpisode(digest: KodaXMemoryOutcomeDigest, signal?: AbortSignal): Promise<MemoryEpisodeReviewResult>;
|
|
492
|
+
archiveRef(id: string): Promise<MemoryLifecycleOperationResult>;
|
|
493
|
+
forgetRef(id: string): Promise<MemoryLifecycleOperationResult>;
|
|
494
|
+
purgeRef(id: string): Promise<MemoryLifecycleOperationResult>;
|
|
495
|
+
}
|
|
496
|
+
type MemoryEvent = {
|
|
497
|
+
readonly type: 'proposal.created';
|
|
498
|
+
readonly proposalId: string;
|
|
499
|
+
} | {
|
|
500
|
+
readonly type: 'proposal.approved';
|
|
501
|
+
readonly proposalId: string;
|
|
502
|
+
} | {
|
|
503
|
+
readonly type: 'proposal.rejected';
|
|
504
|
+
readonly proposalId: string;
|
|
505
|
+
} | {
|
|
506
|
+
readonly type: 'curator.completed';
|
|
507
|
+
readonly reportId: string;
|
|
508
|
+
} | {
|
|
509
|
+
readonly type: 'pack.selected';
|
|
510
|
+
readonly refIds: readonly string[];
|
|
511
|
+
} | {
|
|
512
|
+
readonly type: 'review.completed';
|
|
513
|
+
readonly trigger: MemoryReviewTrigger;
|
|
514
|
+
readonly actionCount: number;
|
|
515
|
+
};
|
|
516
|
+
|
|
517
|
+
type MemoryEvidenceGrade = 'authoritative' | 'verified' | 'corroborated' | 'observed' | 'inferred';
|
|
518
|
+
interface MemoryEvidenceRef {
|
|
519
|
+
readonly ref: string;
|
|
520
|
+
readonly requestedGrade: MemoryEvidenceGrade;
|
|
521
|
+
readonly source: 'user' | 'host' | 'tool' | 'environment' | 'agent';
|
|
522
|
+
readonly verdict?: 'passed' | 'failed' | 'inconclusive';
|
|
523
|
+
readonly observedAt: string;
|
|
524
|
+
}
|
|
525
|
+
type MemorySourcePolicy = (evidence: MemoryEvidenceRef) => MemoryEvidenceGrade;
|
|
526
|
+
type MemoryObservationKind = 'constraint' | 'fact' | 'outcome' | 'correction';
|
|
527
|
+
interface MemoryObservation {
|
|
528
|
+
readonly id: string;
|
|
529
|
+
readonly sequence: number;
|
|
530
|
+
readonly kind: MemoryObservationKind;
|
|
531
|
+
readonly summary: string;
|
|
532
|
+
readonly evidence: readonly MemoryEvidenceRef[];
|
|
533
|
+
readonly visibility: MemoryVisibility;
|
|
534
|
+
readonly claimKey?: string;
|
|
535
|
+
readonly actionSignature?: string;
|
|
536
|
+
readonly occurredAt: string;
|
|
537
|
+
readonly metadata?: Readonly<Record<string, string | number | boolean>>;
|
|
538
|
+
}
|
|
539
|
+
interface MemoryRecallInput {
|
|
540
|
+
readonly decisionRevision: string;
|
|
541
|
+
readonly objective: string;
|
|
542
|
+
readonly decisionContext: string;
|
|
543
|
+
readonly decisionIntent: string;
|
|
544
|
+
readonly actionSignature?: string;
|
|
545
|
+
readonly throughSequence: number;
|
|
546
|
+
}
|
|
547
|
+
interface MemoryQueryInput {
|
|
548
|
+
readonly decisionRevision: string;
|
|
549
|
+
readonly need: string;
|
|
550
|
+
readonly actionSignature?: string;
|
|
551
|
+
readonly throughSequence: number;
|
|
552
|
+
}
|
|
553
|
+
interface MemoryReminder {
|
|
554
|
+
readonly content: string;
|
|
555
|
+
readonly evidenceRefs: readonly string[];
|
|
556
|
+
}
|
|
557
|
+
interface MemoryRecallCandidate {
|
|
558
|
+
readonly refId: string;
|
|
559
|
+
readonly claim: string;
|
|
560
|
+
readonly claimKind?: string;
|
|
561
|
+
readonly source?: 'current' | 'session' | 'durable';
|
|
562
|
+
readonly evidenceRefs?: readonly string[];
|
|
563
|
+
}
|
|
564
|
+
interface MemoryRecallRunnerInput {
|
|
565
|
+
readonly objective: string;
|
|
566
|
+
readonly decisionContext: string;
|
|
567
|
+
readonly decisionIntent: string;
|
|
568
|
+
readonly triggers?: readonly MemoryInterventionTrigger[];
|
|
569
|
+
readonly candidates: readonly MemoryRecallCandidate[];
|
|
570
|
+
readonly signal: AbortSignal;
|
|
571
|
+
}
|
|
572
|
+
type MemoryRecallRunner = (input: MemoryRecallRunnerInput) => Promise<{
|
|
573
|
+
readonly selectedRefIds: readonly string[];
|
|
574
|
+
}>;
|
|
575
|
+
type MemorySelectionMode = 'task_hint' | 'exact'
|
|
576
|
+
/** @deprecated Retained for source compatibility; F275 no longer emits this mode. */
|
|
577
|
+
| 'semantic_prefetch' | 'semantic_intervention' | 'deliberate_query';
|
|
578
|
+
type MemoryInterventionTrigger = 'tool_failure' | 'verification_failure' | 'context_compacted';
|
|
579
|
+
interface MemoryInterventionInput extends MemoryRecallInput {
|
|
580
|
+
readonly triggers: readonly MemoryInterventionTrigger[];
|
|
581
|
+
readonly currentCandidates: readonly MemoryRecallCandidate[];
|
|
582
|
+
readonly signal?: AbortSignal;
|
|
583
|
+
}
|
|
584
|
+
interface MemoryDecisionReceipt {
|
|
585
|
+
readonly id: string;
|
|
586
|
+
readonly decisionEpoch: string;
|
|
587
|
+
readonly decisionRevision: string;
|
|
588
|
+
readonly policyVersion: string;
|
|
589
|
+
readonly candidateSetFingerprint: string;
|
|
590
|
+
/** Candidate identities offered to deterministic or semantic selection. */
|
|
591
|
+
readonly candidateIds: readonly string[];
|
|
592
|
+
/** Candidate identities selected after validating the runner output. */
|
|
593
|
+
readonly selectedCandidateIds: readonly string[];
|
|
594
|
+
/** Source evidence exposed to the Action LLM after deterministic rendering. */
|
|
595
|
+
readonly injectedEvidenceRefs: readonly string[];
|
|
596
|
+
readonly triggers?: readonly MemoryInterventionTrigger[];
|
|
597
|
+
/** @deprecated Use candidateIds. */
|
|
598
|
+
readonly candidateRefs: readonly string[];
|
|
599
|
+
/** @deprecated Use selectedCandidateIds. */
|
|
600
|
+
readonly selectedRefs: readonly string[];
|
|
601
|
+
/** @deprecated Use injectedEvidenceRefs. */
|
|
602
|
+
readonly injectedRefs: readonly string[];
|
|
603
|
+
readonly selectionModes: readonly MemorySelectionMode[];
|
|
604
|
+
readonly actionSignature?: string;
|
|
605
|
+
readonly throughSequence: number;
|
|
606
|
+
}
|
|
607
|
+
type MemoryAgentTraceEvent = {
|
|
608
|
+
readonly type: 'recall.intervention.failed' | 'recall.intervention.discarded'
|
|
609
|
+
/** @deprecated Retained for source compatibility; F275 no longer emits prefetch events. */
|
|
610
|
+
| 'recall.prefetch.completed'
|
|
611
|
+
/** @deprecated Retained for source compatibility; F275 no longer emits prefetch events. */
|
|
612
|
+
| 'recall.prefetch.failed'
|
|
613
|
+
/** @deprecated Retained for source compatibility; F275 no longer emits prefetch events. */
|
|
614
|
+
| 'recall.prefetch.discarded' | 'query.failed' | 'review.failed' | 'review.timed_out';
|
|
615
|
+
readonly key: string;
|
|
616
|
+
readonly detail?: string;
|
|
617
|
+
} | {
|
|
618
|
+
readonly type: 'memory.decision';
|
|
619
|
+
readonly receipt: MemoryDecisionReceipt;
|
|
620
|
+
};
|
|
621
|
+
interface MemorySessionInput {
|
|
622
|
+
readonly identity: MemoryContextIdentity;
|
|
623
|
+
readonly objective: string;
|
|
624
|
+
/** Stable caller-owned identity for this root episode. */
|
|
625
|
+
readonly episodeId?: string;
|
|
626
|
+
}
|
|
627
|
+
interface MemoryEpisodeOutcome {
|
|
628
|
+
readonly status: 'succeeded' | 'failed' | 'cancelled';
|
|
629
|
+
readonly summary: string;
|
|
630
|
+
readonly evidence: readonly MemoryEvidenceRef[];
|
|
631
|
+
readonly memoryIntent?: KodaXMemoryIntent;
|
|
632
|
+
}
|
|
633
|
+
type PersistedOutcomeDigest = KodaXMemoryOutcomeDigest;
|
|
634
|
+
interface MemorySession {
|
|
635
|
+
observe(observation: MemoryObservation): void;
|
|
636
|
+
recall(input: MemoryRecallInput): MemoryReminder | undefined;
|
|
637
|
+
intervene(input: MemoryInterventionInput): Promise<MemoryReminder | undefined>;
|
|
638
|
+
query(input: MemoryQueryInput): Promise<MemoryReminder | undefined>;
|
|
639
|
+
rewind(input: {
|
|
640
|
+
readonly throughSequence: number;
|
|
641
|
+
}): void;
|
|
642
|
+
complete(outcome: MemoryEpisodeOutcome): Promise<void>;
|
|
643
|
+
close(options?: {
|
|
644
|
+
readonly drain?: boolean;
|
|
645
|
+
}): Promise<void>;
|
|
646
|
+
}
|
|
647
|
+
interface MemoryAgent {
|
|
648
|
+
startSession(input: MemorySessionInput): Promise<MemorySession>;
|
|
649
|
+
}
|
|
650
|
+
interface CreateMemoryAgentOptions {
|
|
651
|
+
readonly controlPlane: MemoryController;
|
|
652
|
+
readonly initialMemoryPack?: MemoryPack;
|
|
653
|
+
readonly now?: () => string;
|
|
654
|
+
readonly persistOutcomeDigest?: (digest: PersistedOutcomeDigest) => Promise<void>;
|
|
655
|
+
readonly reviewEpisode?: (digest: PersistedOutcomeDigest, signal: AbortSignal) => Promise<void>;
|
|
656
|
+
readonly reviewTimeoutMs?: number;
|
|
657
|
+
readonly recallRunner?: MemoryRecallRunner;
|
|
658
|
+
readonly onTrace?: (event: MemoryAgentTraceEvent) => void;
|
|
659
|
+
readonly sourcePolicy?: MemorySourcePolicy;
|
|
660
|
+
}
|
|
661
|
+
|
|
662
|
+
export type { MemorySourcePolicy as A, CreateMemoryAgentOptions as C, KodaXSessionArtifactLedgerEntry as K, MemoryAgent as M, PersistedOutcomeDigest as P, KodaXSessionLineage as a, MemoryAgentTraceEvent as b, MemoryApplicability as c, MemoryContextIdentity as d, MemoryController as e, MemoryDecisionReceipt as f, MemoryEpisodeOutcome as g, MemoryEvent as h, MemoryEvidenceGrade as i, MemoryEvidenceRef as j, MemoryInterventionInput as k, MemoryInterventionTrigger as l, MemoryItemRef as m, MemoryObservation as n, MemoryObservationKind as o, MemoryPack as p, MemoryQueryInput as q, MemoryRecallCandidate as r, MemoryRecallInput as s, MemoryRecallRunner as t, MemoryRecallRunnerInput as u, MemoryReminder as v, MemoryReviewRunner as w, MemorySelectionMode as x, MemorySession as y, MemorySessionInput as z };
|