blun-king-cli 9.1.370 → 9.1.372
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/bin/cognitive-action-checkpoint.cjs +27 -1
- package/blun.mjs +4 -1
- package/package.json +1 -1
|
@@ -6,8 +6,11 @@ const PHASES = new Set(['orient', 'plan', 'act', 'verify', 'learn', 'wait']);
|
|
|
6
6
|
const EVIDENCE_BASES = new Set([
|
|
7
7
|
'runtime_tool', 'user_statement', 'external_report', 'carried_forward',
|
|
8
8
|
]);
|
|
9
|
+
const EPISTEMIC_STATES = new Set([
|
|
10
|
+
'verified', 'credible_unverified', 'hypothesis', 'uncertain_memory', 'stale', 'unknown',
|
|
11
|
+
]);
|
|
9
12
|
const MODEL_KEYS = new Set([
|
|
10
|
-
'revision', 'phase', 'evidenceBasis', 'lastVerified', 'nextAction', 'expectedEvidence', 'updatedAt',
|
|
13
|
+
'revision', 'phase', 'evidenceBasis', 'epistemicState', 'lastVerified', 'nextAction', 'expectedEvidence', 'updatedAt',
|
|
11
14
|
]);
|
|
12
15
|
const RUNTIME_KEYS = new Set([...MODEL_KEYS, 'evidenceReceipt']);
|
|
13
16
|
const EVIDENCE_INPUT_KEYS = new Set([
|
|
@@ -46,6 +49,14 @@ function normalizedEvidenceBasis(value, allowLegacy = false) {
|
|
|
46
49
|
: 'evidenceBasis is invalid');
|
|
47
50
|
}
|
|
48
51
|
|
|
52
|
+
function normalizedEpistemicState(value, allowLegacy = false) {
|
|
53
|
+
const state = String(value ?? '').trim();
|
|
54
|
+
if (EPISTEMIC_STATES.has(state) || allowLegacy && state === 'legacy_unknown') return state;
|
|
55
|
+
throw new TypeError(value === undefined
|
|
56
|
+
? 'epistemicState is required'
|
|
57
|
+
: 'epistemicState is invalid');
|
|
58
|
+
}
|
|
59
|
+
|
|
49
60
|
function normalizedTurnId(value) {
|
|
50
61
|
const turnId = Number(value);
|
|
51
62
|
if (!Number.isSafeInteger(turnId) || turnId < 0) throw new TypeError('evidence turnId must be a non-negative integer');
|
|
@@ -129,11 +140,18 @@ function assertActionCheckpointRevision(current, input) {
|
|
|
129
140
|
|
|
130
141
|
function assertActionCheckpointEvidenceBasis(current, input, runtimeEvidence) {
|
|
131
142
|
const basis = normalizedEvidenceBasis(input?.evidenceBasis);
|
|
143
|
+
const epistemicState = normalizedEpistemicState(input?.epistemicState);
|
|
132
144
|
if (basis === 'runtime_tool') {
|
|
133
145
|
const receipt = normalizeActionEvidenceReceipt(runtimeEvidence);
|
|
134
146
|
if (receipt.successfulTools < 1) {
|
|
135
147
|
throw new TypeError('runtime_tool evidenceBasis requires a successful runtime tool in the current turn');
|
|
136
148
|
}
|
|
149
|
+
if (epistemicState !== 'verified') {
|
|
150
|
+
throw new TypeError('runtime_tool evidenceBasis requires verified epistemicState');
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
if (basis === 'external_report' && epistemicState === 'verified') {
|
|
154
|
+
throw new TypeError('external_report evidenceBasis cannot claim verified epistemicState');
|
|
137
155
|
}
|
|
138
156
|
if (basis === 'carried_forward') {
|
|
139
157
|
if (!current) throw new TypeError('carried_forward evidenceBasis requires a current checkpoint');
|
|
@@ -144,6 +162,9 @@ function assertActionCheckpointEvidenceBasis(current, input, runtimeEvidence) {
|
|
|
144
162
|
if (bounded(input?.lastVerified, 'lastVerified') !== currentValue.lastVerified) {
|
|
145
163
|
throw new TypeError('carried_forward evidenceBasis cannot change lastVerified');
|
|
146
164
|
}
|
|
165
|
+
if (epistemicState !== currentValue.epistemicState) {
|
|
166
|
+
throw new TypeError('carried_forward evidenceBasis cannot change epistemicState');
|
|
167
|
+
}
|
|
147
168
|
}
|
|
148
169
|
return basis;
|
|
149
170
|
}
|
|
@@ -162,6 +183,9 @@ function normalizeActionCheckpoint(input, options = {}) {
|
|
|
162
183
|
const evidenceBasis = input.evidenceBasis === undefined && replay
|
|
163
184
|
? 'legacy_unknown'
|
|
164
185
|
: normalizedEvidenceBasis(input.evidenceBasis, replay);
|
|
186
|
+
const epistemicState = input.epistemicState === undefined && replay
|
|
187
|
+
? 'legacy_unknown'
|
|
188
|
+
: normalizedEpistemicState(input.epistemicState, replay);
|
|
165
189
|
const updatedAt = options.preserveUpdatedAt === true && input.updatedAt !== undefined
|
|
166
190
|
? normalizedTimestamp(input.updatedAt)
|
|
167
191
|
: normalizedTimestamp(options.now ?? new Date());
|
|
@@ -169,6 +193,7 @@ function normalizeActionCheckpoint(input, options = {}) {
|
|
|
169
193
|
revision: normalizedRevision(input.revision),
|
|
170
194
|
phase,
|
|
171
195
|
evidenceBasis,
|
|
196
|
+
epistemicState,
|
|
172
197
|
lastVerified: bounded(input.lastVerified, 'lastVerified'),
|
|
173
198
|
nextAction: bounded(input.nextAction, 'nextAction'),
|
|
174
199
|
expectedEvidence: bounded(input.expectedEvidence, 'expectedEvidence'),
|
|
@@ -191,6 +216,7 @@ function projectActionCheckpoint(checkpoint) {
|
|
|
191
216
|
`Revision: ${value.revision}`,
|
|
192
217
|
`Phase: ${value.phase}`,
|
|
193
218
|
`Evidence basis: ${value.evidenceBasis.replaceAll('_', ' ')}`,
|
|
219
|
+
`Epistemic state: ${value.epistemicState.replaceAll('_', ' ')}`,
|
|
194
220
|
`Last verified: ${value.lastVerified}`,
|
|
195
221
|
];
|
|
196
222
|
lines.push(`Next action: ${value.nextAction}`);
|
package/blun.mjs
CHANGED
|
@@ -245732,6 +245732,8 @@ var init_events$1 = __esmMin((() => {
|
|
|
245732
245732
|
actionCheckpoint: object({
|
|
245733
245733
|
revision: number$1().int().min(1),
|
|
245734
245734
|
phase: _enum(["orient", "plan", "act", "verify", "learn", "wait"]),
|
|
245735
|
+
evidenceBasis: _enum(["runtime_tool", "user_statement", "external_report", "carried_forward", "legacy_unknown"]),
|
|
245736
|
+
epistemicState: _enum(["verified", "credible_unverified", "hypothesis", "uncertain_memory", "stale", "unknown", "legacy_unknown"]),
|
|
245735
245737
|
lastVerified: string(),
|
|
245736
245738
|
nextAction: string(),
|
|
245737
245739
|
expectedEvidence: string(),
|
|
@@ -262699,7 +262701,7 @@ var init_outcome_prompts = __esmMin((() => {}));
|
|
|
262699
262701
|
//#region ../../packages/agent-core/src/tools/builtin/goal/update-goal.md?raw
|
|
262700
262702
|
var update_goal_default;
|
|
262701
262703
|
var init_update_goal$1 = __esmMin((() => {
|
|
262702
|
-
update_goal_default = "Update the current autonomous goal. Set `status` only for a lifecycle change. After a coherent work slice, save `actionCheckpoint` with a monotone revision, the last verified result, exact next action, expected evidence, and an explicit evidence basis. Use `runtime_tool` only when a successful tool in this turn measured the result; use `user_statement` for a direct user assertion, `external_report` for a report not independently measured here, and `carried_forward` only when the last verified text is unchanged. Start at revision 1 and increment the currently projected revision by exactly one; stale writers fail closed. This is durable progress state, not permission, and should change only when the facts change. A checkpoint-only call keeps the goal active.\n\n- `active` — resume a paused or blocked goal when the user explicitly asks you to work on that goal.\n- `complete` — the objective is fully satisfied, all files are written, all tests pass, and any stated validation has passed.\n- `blocked` — a genuine external condition or required user decision prevents progress.\n- `paused` — set the goal aside for now.\n\nDo not mark complete after a plan or partial result. If useful work remains, checkpoint it and continue. Do not ask for permission merely to execute an already authorized checkpoint; ask only at a real rights boundary or missing user decision.\n";
|
|
262704
|
+
update_goal_default = "Update the current autonomous goal. Set `status` only for a lifecycle change. After a coherent work slice, save `actionCheckpoint` with a monotone revision, the last verified result, exact next action, expected evidence, and an explicit evidence basis. Use `runtime_tool` only when a successful tool in this turn measured the result; use `user_statement` for a direct user assertion, `external_report` for a report not independently measured here, and `carried_forward` only when the last verified text is unchanged. Classify knowledge as `verified`, `credible_unverified`, `hypothesis`, `uncertain_memory`, `stale`, or `unknown`; never present a weaker state as verified, and preserve the state on carry-forward. Start at revision 1 and increment the currently projected revision by exactly one; stale writers fail closed. This is durable progress state, not permission, and should change only when the facts change. A checkpoint-only call keeps the goal active.\n\n- `active` — resume a paused or blocked goal when the user explicitly asks you to work on that goal.\n- `complete` — the objective is fully satisfied, all files are written, all tests pass, and any stated validation has passed.\n- `blocked` — a genuine external condition or required user decision prevents progress.\n- `paused` — set the goal aside for now.\n\nDo not mark complete after a plan or partial result. If useful work remains, checkpoint it and continue. Do not ask for permission merely to execute an already authorized checkpoint; ask only at a real rights boundary or missing user decision.\n";
|
|
262703
262705
|
}));
|
|
262704
262706
|
//#endregion
|
|
262705
262707
|
//#region ../../packages/agent-core/src/tools/builtin/goal/update-goal.ts
|
|
@@ -262714,6 +262716,7 @@ var init_update_goal = __esmMin((() => {
|
|
|
262714
262716
|
revision: number$1().int().min(1),
|
|
262715
262717
|
phase: _enum(["orient", "plan", "act", "verify", "learn", "wait"]),
|
|
262716
262718
|
evidenceBasis: _enum(["runtime_tool", "user_statement", "external_report", "carried_forward"]),
|
|
262719
|
+
epistemicState: _enum(["verified", "credible_unverified", "hypothesis", "uncertain_memory", "stale", "unknown"]),
|
|
262717
262720
|
lastVerified: string().min(1).max(512),
|
|
262718
262721
|
nextAction: string().min(1).max(512),
|
|
262719
262722
|
expectedEvidence: string().min(1).max(512)
|