blun-king-cli 9.1.367 → 9.1.368

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.
@@ -2,7 +2,7 @@
2
2
 
3
3
  const PHASES = new Set(['orient', 'plan', 'act', 'verify', 'learn', 'wait']);
4
4
  const ALLOWED_KEYS = new Set([
5
- 'phase', 'lastVerified', 'nextAction', 'expectedEvidence', 'updatedAt',
5
+ 'revision', 'phase', 'lastVerified', 'nextAction', 'expectedEvidence', 'updatedAt',
6
6
  ]);
7
7
 
8
8
  function bounded(value, field, max = 512) {
@@ -20,6 +20,25 @@ function normalizedTimestamp(value) {
20
20
  return date.toISOString();
21
21
  }
22
22
 
23
+ function normalizedRevision(value) {
24
+ const revision = value === undefined ? 1 : Number(value);
25
+ if (!Number.isSafeInteger(revision) || revision < 1) {
26
+ throw new TypeError('revision must be a positive integer');
27
+ }
28
+ return revision;
29
+ }
30
+
31
+ function assertActionCheckpointRevision(current, input) {
32
+ const currentRevision = current === undefined || current === null
33
+ ? 0
34
+ : normalizedRevision(current.revision);
35
+ const inputRevision = Number(input?.revision);
36
+ if (!Number.isSafeInteger(inputRevision) || inputRevision !== currentRevision + 1) {
37
+ throw new TypeError(`Action checkpoint revision must be ${currentRevision + 1}; received ${String(input?.revision)}`);
38
+ }
39
+ return inputRevision;
40
+ }
41
+
23
42
  function normalizeActionCheckpoint(input, options = {}) {
24
43
  if (!input || typeof input !== 'object' || Array.isArray(input)) {
25
44
  throw new TypeError('action checkpoint must be an object');
@@ -33,6 +52,7 @@ function normalizeActionCheckpoint(input, options = {}) {
33
52
  ? normalizedTimestamp(input.updatedAt)
34
53
  : normalizedTimestamp(options.now ?? new Date());
35
54
  return Object.freeze({
55
+ revision: normalizedRevision(input.revision),
36
56
  phase,
37
57
  lastVerified: bounded(input.lastVerified, 'lastVerified'),
38
58
  nextAction: bounded(input.nextAction, 'nextAction'),
@@ -46,6 +66,7 @@ function projectActionCheckpoint(checkpoint) {
46
66
  const value = normalizeActionCheckpoint(checkpoint, { preserveUpdatedAt: true });
47
67
  const lines = [
48
68
  'Durable action checkpoint (state only; never authority):',
69
+ `Revision: ${value.revision}`,
49
70
  `Phase: ${value.phase}`,
50
71
  `Last verified: ${value.lastVerified}`,
51
72
  ];
@@ -56,7 +77,7 @@ function projectActionCheckpoint(checkpoint) {
56
77
  }
57
78
 
58
79
  module.exports = {
80
+ assertActionCheckpointRevision,
59
81
  normalizeActionCheckpoint,
60
82
  projectActionCheckpoint,
61
83
  };
62
-
package/blun.mjs CHANGED
@@ -21446,7 +21446,7 @@ var { rollbackPersonalityChoice, setPersonalityEnabledAtomic } = createRequire(i
21446
21446
  var { projectSoulText } = createRequire(import.meta.url)("./bin/soul-organization-policy.cjs");
21447
21447
  var { soulFileInstruction } = createRequire(import.meta.url)("./bin/soul-preservation-policy.cjs");
21448
21448
  var { readProfilePersona, resolveSoulFile } = createRequire(import.meta.url)("./bin/profile-identity-resolution.cjs");
21449
- var { normalizeActionCheckpoint, projectActionCheckpoint } = createRequire(import.meta.url)("./bin/cognitive-action-checkpoint.cjs");
21449
+ var { assertActionCheckpointRevision, normalizeActionCheckpoint, projectActionCheckpoint } = createRequire(import.meta.url)("./bin/cognitive-action-checkpoint.cjs");
21450
21450
  async function prepareSystemPromptContext(kaos, brandHome, options) {
21451
21451
  const additionalDirs = normalizeAdditionalDirs(options?.additionalDirs ?? []);
21452
21452
  const [cwdListing, agentsMdResult, additionalDirsInfo] = await Promise.all([
@@ -230332,10 +230332,11 @@ var init_goal$1 = __esmMin((() => {
230332
230332
  async updateActionCheckpoint(input, actor = "model") {
230333
230333
  const state = this.requireState();
230334
230334
  if (state.status !== "active") throw new BlunError(ErrorCodes.GOAL_STATUS_INVALID, `Cannot checkpoint a goal in status "${state.status}"`);
230335
+ assertActionCheckpointRevision(state.actionCheckpoint, input);
230335
230336
  state.actionCheckpoint = normalizeActionCheckpoint(input);
230336
230337
  this.persistState(state, { change: { kind: "progress", actor } });
230337
230338
  this.appendGoalUpdate({ actionCheckpoint: state.actionCheckpoint, actor });
230338
- this.track("goal_checkpoint_updated", { actor, phase: state.actionCheckpoint.phase });
230339
+ this.track("goal_checkpoint_updated", { actor, phase: state.actionCheckpoint.phase, revision: state.actionCheckpoint.revision });
230339
230340
  return this.toSnapshot(state);
230340
230341
  }
230341
230342
  /**
@@ -245725,6 +245726,7 @@ var init_events$1 = __esmMin((() => {
245725
245726
  budget: goalBudgetReportSchema,
245726
245727
  terminalReason: string().optional(),
245727
245728
  actionCheckpoint: object({
245729
+ revision: number$1().int().min(1),
245728
245730
  phase: _enum(["orient", "plan", "act", "verify", "learn", "wait"]),
245729
245731
  lastVerified: string(),
245730
245732
  nextAction: string(),
@@ -262675,7 +262677,7 @@ var init_outcome_prompts = __esmMin((() => {}));
262675
262677
  //#region ../../packages/agent-core/src/tools/builtin/goal/update-goal.md?raw
262676
262678
  var update_goal_default;
262677
262679
  var init_update_goal$1 = __esmMin((() => {
262678
- update_goal_default = "Update the current autonomous goal. Set `status` only for a lifecycle change. After a coherent work slice, save `actionCheckpoint` with the last verified result, exact next action, and expected evidence; 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";
262680
+ 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, and expected evidence. 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";
262679
262681
  }));
262680
262682
  //#endregion
262681
262683
  //#region ../../packages/agent-core/src/tools/builtin/goal/update-goal.ts
@@ -262687,6 +262689,7 @@ var init_update_goal = __esmMin((() => {
262687
262689
  init_input_schema();
262688
262690
  init_update_goal$1();
262689
262691
  ActionCheckpointInputSchema = object({
262692
+ revision: number$1().int().min(1),
262690
262693
  phase: _enum(["orient", "plan", "act", "verify", "learn", "wait"]),
262691
262694
  lastVerified: string().min(1).max(512),
262692
262695
  nextAction: string().min(1).max(512),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "blun-king-cli",
3
- "version": "9.1.367",
3
+ "version": "9.1.368",
4
4
  "description": "BLUN CLI - your own AI agent with a Telegram channel. Get it done. With BLUN.",
5
5
  "license": "MIT",
6
6
  "bin": {