@ouro.bot/cli 0.1.0-alpha.756 → 0.1.0-alpha.757

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.json CHANGED
@@ -1,6 +1,13 @@
1
1
  {
2
2
  "_note": "This changelog is maintained as part of the PR/version-bump workflow. Agent-curated, not auto-generated. Agents read this file directly via read_file to understand what changed between versions.",
3
3
  "versions": [
4
+ {
5
+ "version": "0.1.0-alpha.757",
6
+ "changes": [
7
+ "Allow authenticated steward policy writes to use the current version when the agent omits an explicit concurrency token.",
8
+ "Keep private external-event turns bound to their exact leased batch, with prompt-safe lease context and deterministic disposition completeness."
9
+ ]
10
+ },
4
11
  {
5
12
  "version": "0.1.0-alpha.756",
6
13
  "changes": [
@@ -1,5 +1,5 @@
1
1
  {
2
- "runtimeVersion": "0.1.0-alpha.756",
2
+ "runtimeVersion": "0.1.0-alpha.757",
3
3
  "bundleSchemaVersion": 3,
4
4
  "lastUpdated": "2026-08-30T00:00:00.000Z"
5
5
  }
@@ -1,7 +1,7 @@
1
1
  <?xml version="1.0"?>
2
2
  <Container version="2">
3
3
  <Name>Mendelow Cloud Butler</Name>
4
- <Repository>ghcr.io/ourostack/ouroboros-butler:0.1.0-alpha.756</Repository>
4
+ <Repository>ghcr.io/ourostack/ouroboros-butler:0.1.0-alpha.757</Repository>
5
5
  <Registry>https://github.com/ourostack/ouroboros/pkgs/container/ouroboros-butler</Registry>
6
6
  <Network>host</Network>
7
7
  <Shell>sh</Shell>
@@ -204,6 +204,7 @@ exports.continuityToolDefinitions = [
204
204
  verificationRefs,
205
205
  },
206
206
  });
207
+ ctx?.externalEventAuthority?.recordCommittedDisposition?.(turnEvent);
207
208
  (0, runtime_1.emitNervesEvent)({ component: "repertoire", event: "repertoire.external_event_disposition", message: "external event disposition recorded", meta: { agentName, eventId: record.eventId, generation: record.generation, classification, decision } });
208
209
  return JSON.stringify(handled, null, 2);
209
210
  };
@@ -16,12 +16,12 @@ exports.stewardPolicyToolDefinition = {
16
16
  type: "function",
17
17
  function: {
18
18
  name: "steward_policy_manage",
19
- description: "Read or update the household steward's typed desired-state and routine-action policy. Updates require the current authenticated family request and exact policy version.",
19
+ description: "Read or update the household steward's typed desired-state and routine-action policy. Updates require the current authenticated family request. expectedVersion is optional; omit it to apply against the current policy version, or supply a version from read for explicit stale-write detection.",
20
20
  parameters: {
21
21
  type: "object",
22
22
  properties: {
23
23
  action: { type: "string", enum: ["read", "set_desired_state", "grant_routine_action"] },
24
- expectedVersion: { type: "integer", minimum: 0 },
24
+ expectedVersion: { type: "integer", minimum: 0, description: "Optional version returned by read. When omitted, the runtime uses the current policy version." },
25
25
  key: { type: "string" },
26
26
  value: { type: "string" },
27
27
  provenance: { type: "string", enum: ["stated", "observed", "default", "installed_explicit_policy"] },
@@ -51,7 +51,9 @@ exports.stewardPolicyToolDefinition = {
51
51
  const actor = ctx.relationshipAuthorization?.actor;
52
52
  if (!actor)
53
53
  throw new Error("steward policy mutation requires authenticated relationship authority");
54
- const expectedVersion = Number(args.expectedVersion);
54
+ const expectedVersion = args.expectedVersion === undefined
55
+ ? (0, steward_policy_1.readStewardPolicy)(ctx.agentRoot).version
56
+ : Number(args.expectedVersion);
55
57
  if (!Number.isInteger(expectedVersion) || expectedVersion < 0)
56
58
  throw new Error("expectedVersion must be a nonnegative integer");
57
59
  let mutation;
@@ -835,6 +835,24 @@ function buildHeldReturnWakeMessage() {
835
835
  "Return each listed item with surface(delegationId=...) before resting or settling.",
836
836
  ].join("\n");
837
837
  }
838
+ function buildExternalEventLeaseMessage(event) {
839
+ const members = [event, ...(event.relatedEvents ?? [])];
840
+ return [
841
+ "[current external-event disposition contract]",
842
+ "This exact lease frame is authoritative for this turn. Ignore older receipts, failed tool arguments, held-work summaries, and checkpoints when choosing disposition arguments.",
843
+ "Investigate the current observation, then call external_event_disposition once for every listed lease before settling.",
844
+ ...members.flatMap((member, index) => [
845
+ "",
846
+ `lease ${index + 1}:`,
847
+ `recordPath: ${JSON.stringify(member.recordPath)}`,
848
+ `expectedGeneration: ${member.generation}`,
849
+ `classifiedRevision: ${JSON.stringify(member.observationRevision)}`,
850
+ ]),
851
+ ].join("\n");
852
+ }
853
+ function externalEventLeaseKey(event) {
854
+ return JSON.stringify([event.recordPath, event.generation, event.observationRevision, event.claimOwner]);
855
+ }
838
856
  function buildAlsoDueLine(agentRoot, currentHabitName, now) {
839
857
  const habitsDir = path.join(agentRoot, "habits");
840
858
  let files;
@@ -1126,7 +1144,10 @@ async function runPrivateRuntimeTurn(options) {
1126
1144
  userContent = buildInstinctUserMessage(instincts, reason, state);
1127
1145
  }
1128
1146
  }
1129
- if (shouldUseHeldReturnWake) {
1147
+ if (options?.externalEvent) {
1148
+ userContent = buildExternalEventLeaseMessage(options.externalEvent);
1149
+ }
1150
+ else if (shouldUseHeldReturnWake) {
1130
1151
  userContent = buildHeldReturnWakeMessage();
1131
1152
  }
1132
1153
  // ── Session loader: wraps existing session logic ──────────────────
@@ -1197,6 +1218,7 @@ async function runPrivateRuntimeTurn(options) {
1197
1218
  };
1198
1219
  })()
1199
1220
  : undefined;
1221
+ const committedExternalEventLeases = new Set();
1200
1222
  const externalEventRelationship = options?.externalEvent
1201
1223
  ? await (async () => {
1202
1224
  const agentRoot = (0, identity_1.getAgentRoot)(agentName);
@@ -1231,6 +1253,9 @@ async function runPrivateRuntimeTurn(options) {
1231
1253
  const decision = initial.authorizeTool("external_event_disposition");
1232
1254
  return decision.allowed ? { allowed: true, reason: "relationship-authorized" } : { allowed: false, reason: decision.reason };
1233
1255
  },
1256
+ recordCommittedDisposition: (event) => {
1257
+ committedExternalEventLeases.add(externalEventLeaseKey(event));
1258
+ },
1234
1259
  },
1235
1260
  externalEventEffects: {
1236
1261
  deliverOwnerDecision: async (input) => {
@@ -1403,6 +1428,13 @@ async function runPrivateRuntimeTurn(options) {
1403
1428
  ...(effectiveHabitSession ? { habitSession: effectiveHabitSession } : {}),
1404
1429
  },
1405
1430
  });
1431
+ if (options?.externalEvent && ["settled", "observed", "rested"].includes(String(result.turnOutcome))) {
1432
+ const incomplete = [options.externalEvent, ...(options.externalEvent.relatedEvents ?? [])]
1433
+ .filter((event) => !committedExternalEventLeases.has(externalEventLeaseKey(event)));
1434
+ if (incomplete.length > 0) {
1435
+ throw new Error(`External-event turn did not commit dispositions for every exact lease (${incomplete.length} incomplete)`);
1436
+ }
1437
+ }
1406
1438
  if (externalRunBase) {
1407
1439
  const lifecycle = result.turnOutcome === "settled" || result.turnOutcome === "observed" || result.turnOutcome === "rested"
1408
1440
  ? "completed"
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@ouro.bot/cli",
3
- "version": "0.1.0-alpha.756",
3
+ "version": "0.1.0-alpha.757",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@ouro.bot/cli",
9
- "version": "0.1.0-alpha.756",
9
+ "version": "0.1.0-alpha.757",
10
10
  "dependencies": {
11
11
  "@anthropic-ai/sdk": "^0.78.0",
12
12
  "@azure/identity": "^4.13.0",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ouro.bot/cli",
3
- "version": "0.1.0-alpha.756",
3
+ "version": "0.1.0-alpha.757",
4
4
  "engines": {
5
5
  "node": ">=22"
6
6
  },