@ouro.bot/cli 0.1.0-alpha.1085 → 0.1.0-alpha.1087

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,18 @@
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.1087",
6
+ "changes": [
7
+ "Owner's explicit asks are not refused: advisory correction hold for family; literal shell variables resolved"
8
+ ]
9
+ },
10
+ {
11
+ "version": "0.1.0-alpha.1086",
12
+ "changes": [
13
+ "Presence failover: ouro presence failover take|release <sense> lets a machine run a shared sense in place of an owner that stopped answering, through a machine-local lease under the bundle's state/. The roster is unchanged, so the owner runs the sense again as soon as it is back and never waits on the stand-in; the stand-in's record lists the sense under failover, and status, status --json and where-i-am say who is standing in, since when and why. The Teams tunnel controller in the desk tooling takes the lease after the endpoint stops answering and releases it when the owner reclaims the endpoint."
14
+ ]
15
+ },
4
16
  {
5
17
  "version": "0.1.0-alpha.1085",
6
18
  "changes": [
@@ -1,5 +1,5 @@
1
1
  {
2
- "runtimeVersion": "0.1.0-alpha.1085",
2
+ "runtimeVersion": "0.1.0-alpha.1087",
3
3
  "bundleSchemaVersion": 3,
4
4
  "lastUpdated": "2026-09-03T00:00:00.000Z"
5
5
  }
@@ -1,7 +1,7 @@
1
1
  <?xml version="1.0"?>
2
2
  <Container version="2">
3
3
  <Name>ouro-butler</Name>
4
- <Repository>ghcr.io/ourostack/ouroboros-butler:0.1.0-alpha.1085</Repository>
4
+ <Repository>ghcr.io/ourostack/ouroboros-butler:0.1.0-alpha.1087</Repository>
5
5
  <Registry>https://github.com/ourostack/ouroboros/pkgs/container/ouroboros-butler</Registry>
6
6
  <Network>host</Network>
7
7
  <Shell>sh</Shell>
@@ -2405,7 +2405,7 @@ async function executePresence(command, deps) {
2405
2405
  catch {
2406
2406
  return returnCliFailure(deps, `cannot read ${command.agent}'s agent.json in ${agentRoot}`);
2407
2407
  }
2408
- const presence = (0, presence_1.readPresence)(agentJson, settings.enabled, (0, presence_1.readPeerRecords)(agentRoot));
2408
+ const presence = (0, presence_1.readPresence)(agentJson, settings.enabled, (0, presence_1.readPeerRecords)(agentRoot), (0, presence_1.readFailoverLeases)(agentRoot));
2409
2409
  if (command.json) {
2410
2410
  const json = JSON.stringify((0, presence_roster_1.presenceStatusJson)({ presence, machineId: identity.machineId, settings }));
2411
2411
  deps.writeStdout(json);
@@ -2421,6 +2421,14 @@ async function executePresence(command, deps) {
2421
2421
  deps.writeStdout(message);
2422
2422
  return message;
2423
2423
  }
2424
+ if (command.kind === "presence.failover") {
2425
+ const result = (0, presence_roster_1.presenceFailover)({ agent: command.agent, agentRoot, machineId: identity.machineId, action: command.action, sense: command.sense,
2426
+ reason: command.reason, now: new Date(providerCliNow(deps)), presence: (0, presence_1.readPresenceForAgent)(agentRoot, { homeDir }) });
2427
+ if (!result.ok)
2428
+ return returnCliFailure(deps, result.message);
2429
+ deps.writeStdout(result.message);
2430
+ return result.message;
2431
+ }
2424
2432
  if (command.kind === "presence.handoff") {
2425
2433
  const result = await (0, presence_roster_1.handoffPresenceSense)({ agent: command.agent, bundlesRoot, sense: command.sense, target: command.machine });
2426
2434
  if (!result.ok)
@@ -8362,7 +8370,7 @@ async function runOuroCli(args, deps = (0, cli_defaults_1.createDefaultOuroCliDe
8362
8370
  return (0, desk_admin_1.executeDeskAdminCommand)(command, deps);
8363
8371
  }
8364
8372
  // ── presence: one agent on several machines (local, no daemon needed) ──
8365
- if (command.kind === "presence.join" || command.kind === "presence.handoff" || command.kind === "presence.status" || command.kind === "presence.location") {
8373
+ if (command.kind === "presence.join" || command.kind === "presence.handoff" || command.kind === "presence.status" || command.kind === "presence.failover" || command.kind === "presence.location") {
8366
8374
  return executePresence(command, deps);
8367
8375
  }
8368
8376
  // ── move: make this machine the agent's home (local, no daemon needed) ──
@@ -129,7 +129,7 @@ exports.COMMAND_REGISTRY = {
129
129
  presence: {
130
130
  category: "Agents",
131
131
  description: "Run one agent on several machines at once: join this machine to its roster, hand a shared sense (Teams, habits, …) to another machine, or see who owns what",
132
- usage: "ouro presence join --agent <name> [--role <role>] [--name <machine name>] | ouro presence handoff <sense> <machine> --agent <name> | ouro presence status --agent <name> [--json] | ouro presence location <home|office|…>",
132
+ usage: "ouro presence join --agent <name> [--role <role>] [--name <machine name>] | ouro presence handoff <sense> <machine> --agent <name> | ouro presence status --agent <name> [--json] | ouro presence failover take|release <sense> --agent <name> [--reason <why>] | ouro presence location <home|office|…>",
133
133
  example: "ouro presence handoff teams aris-mac-mini --agent my-agent",
134
134
  subcommands: ["join", "handoff", "status", "location"],
135
135
  },
@@ -3288,7 +3288,7 @@ function parseOuroCommand(args) {
3288
3288
  if (head === "versions")
3289
3289
  return { kind: "versions" };
3290
3290
  if (head === "presence") {
3291
- const usage = "Usage: ouro presence join --agent <name> [--role <role>] [--name <machine name>] | ouro presence handoff <sense> <machine> --agent <name> | ouro presence status --agent <name> [--json] | ouro presence location <home|office|…>";
3291
+ const usage = "Usage: ouro presence join --agent <name> [--role <role>] [--name <machine name>] | ouro presence handoff <sense> <machine> --agent <name> | ouro presence status --agent <name> [--json] | ouro presence failover take|release <sense> --agent <name> [--reason <why>] | ouro presence location <home|office|…>";
3292
3292
  const { agent, rest } = extractAgentFlag(args.slice(1));
3293
3293
  const [sub, ...tail] = rest;
3294
3294
  if (sub === "location") {
@@ -3304,6 +3304,14 @@ function parseOuroCommand(args) {
3304
3304
  return { kind: "presence.status", agent, json: true };
3305
3305
  if (sub === "handoff" && tail.length === 2)
3306
3306
  return { kind: "presence.handoff", agent, sense: tail[0], machine: tail[1] };
3307
+ if (sub === "failover" && (tail[0] === "take" || tail[0] === "release") && tail[1]) {
3308
+ const [action, sense, ...options] = tail;
3309
+ if (options.length === 0)
3310
+ return { kind: "presence.failover", agent, action, sense };
3311
+ if (action === "take" && options.length === 2 && options[0] === "--reason" && options[1])
3312
+ return { kind: "presence.failover", agent, action, sense, reason: options[1] };
3313
+ throw new Error(usage);
3314
+ }
3307
3315
  if (sub === "join") {
3308
3316
  const command = { kind: "presence.join", agent };
3309
3317
  for (let i = 0; i < tail.length; i++) {
@@ -234,8 +234,9 @@ class PresenceTicker {
234
234
  async publish(agent, presence) {
235
235
  const now = (this.deps.now ?? (() => new Date()))();
236
236
  const owns = (0, presence_1.ownedSharedSenses)(presence, this.deps.machineId);
237
+ const failover = (0, presence_1.failoverSenses)(presence, this.deps.machineId);
237
238
  const last = this.lastPublishedMs.get(agent);
238
- const ownsChanged = this.lastOwns.get(agent) !== owns.join(",");
239
+ const ownsChanged = this.lastOwns.get(agent) !== [...owns, ...failover.map((sense) => `failover:${sense}`)].join(",");
239
240
  if (!ownsChanged && last !== undefined && now.getTime() - last < exports.PEER_RECORD_INTERVAL_MS)
240
241
  return;
241
242
  const agentRoot = path.join(this.deps.bundlesRoot, `${agent}.ouro`);
@@ -252,11 +253,12 @@ class PresenceTicker {
252
253
  os: describeOs(),
253
254
  location: settings.location ?? (machine.role === "always-on" ? "home" : "unknown"),
254
255
  owns,
256
+ ...(failover.length > 0 ? { failover } : {}),
255
257
  ...this.deps.extraRecord?.(agent),
256
258
  };
257
259
  (0, presence_1.writePeerRecord)(agentRoot, record);
258
260
  this.lastPublishedMs.set(agent, now.getTime());
259
- this.lastOwns.set(agent, owns.join(","));
261
+ this.lastOwns.set(agent, [...owns, ...failover.map((sense) => `failover:${sense}`)].join(","));
260
262
  (0, runtime_1.emitNervesEvent)({ component: "daemon", event: "daemon.presence_record_published", message: "published this machine's presence record", meta: { agent, machineId: this.deps.machineId, version: this.deps.version } });
261
263
  }
262
264
  }
@@ -43,6 +43,7 @@ var __importStar = (this && this.__importStar) || (function () {
43
43
  Object.defineProperty(exports, "__esModule", { value: true });
44
44
  exports.joinPresenceRoster = joinPresenceRoster;
45
45
  exports.handoffPresenceSense = handoffPresenceSense;
46
+ exports.presenceFailover = presenceFailover;
46
47
  exports.presenceStatusJson = presenceStatusJson;
47
48
  exports.renderPresenceStatus = renderPresenceStatus;
48
49
  const path = __importStar(require("path"));
@@ -145,12 +146,49 @@ async function handoffPresenceSense(options) {
145
146
  },
146
147
  });
147
148
  }
149
+ /**
150
+ * `ouro presence failover take|release <sense>`: run a shared sense here in place of its owner while the owner is
151
+ * unreachable, or stop doing so. The roster is unchanged, so the owner runs the sense again as soon as it is back; the
152
+ * stand-in (or whatever watches for that, such as the Teams tunnel controller) then releases.
153
+ */
154
+ function presenceFailover(options) {
155
+ const { agent, agentRoot, machineId, action, sense, presence } = options;
156
+ (0, runtime_1.emitNervesEvent)({ component: "daemon", event: "daemon.presence_failover", message: `presence failover ${action}`, meta: { agent, sense, action } });
157
+ const leases = (0, presence_1.readFailoverLeases)(agentRoot);
158
+ if (action === "release") {
159
+ const rest = leases.filter((lease) => lease.sense !== sense);
160
+ if (rest.length === leases.length)
161
+ return { ok: true, message: `this machine was not standing in for ${agent}'s ${sense}; nothing to release` };
162
+ (0, presence_1.writeFailoverLeases)(agentRoot, rest);
163
+ return { ok: true, message: `released ${agent}'s ${sense}: this machine stops it within about a minute, and its owner runs it` };
164
+ }
165
+ if (!presence)
166
+ return { ok: false, message: `presence is off here or ${agent} has no roster, so there is no owner to stand in for` };
167
+ if (!(0, presence_1.isSharedSense)(sense))
168
+ return { ok: false, message: `${sense} is not a shared sense; shared senses are ${presence_1.SHARED_SENSES.join(", ")}` };
169
+ const me = presence.block.machines.find((machine) => machine.machineId === machineId);
170
+ if (!me)
171
+ return { ok: false, message: `this machine is not on ${agent}'s roster; run \`ouro presence join --agent ${agent}\` first` };
172
+ const owner = (0, presence_1.effectiveOwner)(presence, sense);
173
+ const ownerName = presence.block.machines.find((machine) => machine.machineId === owner)?.name ?? owner;
174
+ if (owner === machineId)
175
+ return { ok: false, message: `${me.name} already owns ${agent}'s ${sense}; there is nothing to stand in for` };
176
+ if (leases.some((lease) => lease.sense === sense && lease.machine === machineId)) {
177
+ return { ok: true, message: `${me.name} is already standing in for ${ownerName} on ${agent}'s ${sense}` };
178
+ }
179
+ const reason = options.reason?.trim() || `${ownerName} stopped answering`;
180
+ (0, presence_1.writeFailoverLeases)(agentRoot, [...leases.filter((lease) => lease.sense !== sense), { sense, machine: machineId, from: owner, since: options.now.toISOString(), reason }]);
181
+ return {
182
+ ok: true,
183
+ message: `${me.name} now runs ${agent}'s ${sense} in place of ${ownerName} (${reason}); the daemon starts it within about a minute. ${ownerName} takes it back as soon as it runs again; release with \`ouro presence failover release ${sense} --agent ${agent}\``,
184
+ };
185
+ }
148
186
  /** `ouro presence status --json`: this machine, its peers and what it owns, for tools such as an arrival check. */
149
187
  function presenceStatusJson(options) {
150
188
  const { presence, machineId, settings } = options;
151
189
  (0, runtime_1.emitNervesEvent)({ component: "daemon", event: "daemon.presence_status_json", message: "rendered presence status as json", meta: { active: presence !== null } });
152
190
  if (!presence)
153
- return { enabled: settings.enabled, machine: null, peers: [], owns: [], owners: {}, disabled: [], legacy: [] };
191
+ return { enabled: settings.enabled, machine: null, peers: [], owns: [], failover: [], owners: {}, disabled: [], legacy: [] };
154
192
  const me = presence.block.machines.find((machine) => machine.machineId === machineId);
155
193
  const owners = {};
156
194
  for (const sense of (0, presence_1.enabledSharedSenses)(presence)) {
@@ -166,7 +204,10 @@ function presenceStatusJson(options) {
166
204
  const record = presence.peers.find((peer) => peer.machineId === machine.machineId);
167
205
  return { machineId: machine.machineId, name: machine.name, role: machine.role, seenAt: record?.seenAt ?? null, version: record?.version ?? null, location: record?.location ?? null };
168
206
  }),
169
- owns: (0, presence_1.enabledSharedSenses)(presence).filter((sense) => (0, presence_1.effectiveOwner)(presence, sense) === machineId),
207
+ owns: (0, presence_1.enabledSharedSenses)(presence).filter((sense) => (0, presence_1.effectiveOwner)(presence, sense) === machineId || (0, presence_1.holdsFailover)(presence, machineId, sense)),
208
+ failover: (presence.failover ?? []).filter((lease) => lease.machine === machineId).map((lease) => ({
209
+ sense: lease.sense, from: presence.block.machines.find((machine) => machine.machineId === lease.from)?.name ?? lease.from, since: lease.since, reason: lease.reason,
210
+ })),
170
211
  owners,
171
212
  disabled: presence_1.SHARED_SENSES.filter((sense) => !(0, presence_1.senseEnabled)(presence, sense)),
172
213
  legacy: presence.legacy.map((id) => presence.block.machines.find((machine) => machine.machineId === id)?.name ?? id),
@@ -207,7 +248,9 @@ function renderPresenceStatus(options) {
207
248
  const name = presence.block.machines.find((machine) => machine.machineId === owner)?.name ?? owner;
208
249
  const declared = presence.block.owners[sense];
209
250
  const held = declared && declared !== owner ? ` (roster names ${presence.block.machines.find((machine) => machine.machineId === declared)?.name ?? declared}; held by home until every machine runs presence)` : "";
210
- lines.push(`- ${sense}: ${name}${held}`);
251
+ const standIn = presence.failover?.find((lease) => lease.sense === sense);
252
+ const failover = standIn ? `; this machine stands in for it since ${standIn.since} (${standIn.reason})` : "";
253
+ lines.push(`- ${sense}: ${name}${held}${failover}`);
211
254
  }
212
255
  const off = presence_1.SHARED_SENSES.filter((sense) => !(0, presence_1.senseEnabled)(presence, sense));
213
256
  if (off.length > 0)
@@ -77,6 +77,11 @@ exports.senseEnabled = senseEnabled;
77
77
  exports.enabledSharedSenses = enabledSharedSenses;
78
78
  exports.alwaysOnMachine = alwaysOnMachine;
79
79
  exports.mayRunSense = mayRunSense;
80
+ exports.holdsFailover = holdsFailover;
81
+ exports.failoverLeasePath = failoverLeasePath;
82
+ exports.readFailoverLeases = readFailoverLeases;
83
+ exports.writeFailoverLeases = writeFailoverLeases;
84
+ exports.failoverSenses = failoverSenses;
80
85
  exports.readPresenceForAgent = readPresenceForAgent;
81
86
  exports.isRosterMember = isRosterMember;
82
87
  exports.rosterMachine = rosterMachine;
@@ -183,6 +188,8 @@ function parsePeerRecord(value) {
183
188
  }
184
189
  if (Array.isArray(value.owns))
185
190
  record.owns = value.owns.filter((sense) => typeof sense === "string");
191
+ if (Array.isArray(value.failover))
192
+ record.failover = value.failover.filter((sense) => typeof sense === "string");
186
193
  if (isRecord(value.appSessions))
187
194
  record.appSessions = value.appSessions;
188
195
  return record;
@@ -291,7 +298,7 @@ function writeLocalPresenceSettings(settings, homeDir = os.homedir()) {
291
298
  * The presence this machine should follow, or null for today's one-home lease
292
299
  * (flag off, or no usable block).
293
300
  */
294
- function readPresence(agentJson, localFlag, peerRecords) {
301
+ function readPresence(agentJson, localFlag, peerRecords, failover = []) {
295
302
  if (!localFlag || !isRecord(agentJson))
296
303
  return null;
297
304
  const block = parsePresenceBlock(agentJson.presence);
@@ -309,7 +316,7 @@ function readPresence(agentJson, localFlag, peerRecords) {
309
316
  if (home && !block.machines.some((machine) => machine.machineId === home.machineId))
310
317
  legacy.push(home.machineId);
311
318
  const enabledSenses = enabledSensesOf(agentJson.senses);
312
- return { block, home, legacy, peers: peerRecords, ...(enabledSenses ? { enabledSenses } : {}) };
319
+ return { block, home, legacy, peers: peerRecords, ...(enabledSenses ? { enabledSenses } : {}), ...(failover.length > 0 ? { failover } : {}) };
313
320
  }
314
321
  /** The senses a `senses` block turns on. Habits run on schedulers, not a senses entry, so they count unless turned off. */
315
322
  function enabledSensesOf(senses) {
@@ -345,7 +352,56 @@ function mayRunSense(presence, machineId, sense) {
345
352
  return false;
346
353
  if (!isSharedSense(sense))
347
354
  return true;
348
- return !presence.peers.some((peer) => peer.machineId !== machineId && isRosterMember(presence, peer.machineId) && peer.owns?.includes(sense));
355
+ // A stand-in runs the sense because its owner is gone, whatever the owner's last record said.
356
+ if (holdsFailover(presence, machineId, sense))
357
+ return true;
358
+ // The owner never waits on a stand-in: the stand-in lets go once the owner runs the sense again.
359
+ return !presence.peers.some((peer) => peer.machineId !== machineId && isRosterMember(presence, peer.machineId) && peer.owns?.includes(sense) && !peer.failover?.includes(sense));
360
+ }
361
+ /** Whether this machine holds a failover lease on the sense. */
362
+ function holdsFailover(presence, machineId, sense) {
363
+ return !!presence.failover?.some((lease) => lease.sense === sense && lease.machine === machineId);
364
+ }
365
+ function failoverLeasePath(agentRoot) {
366
+ return path.join(agentRoot, "state", "presence", "failover.json");
367
+ }
368
+ /** This machine's failover leases; a missing or malformed file holds none. */
369
+ function readFailoverLeases(agentRoot) {
370
+ let parsed;
371
+ try {
372
+ parsed = JSON.parse(fs.readFileSync(failoverLeasePath(agentRoot), "utf-8"));
373
+ }
374
+ catch {
375
+ return [];
376
+ }
377
+ if (!isRecord(parsed) || !Array.isArray(parsed.leases))
378
+ return [];
379
+ const leases = [];
380
+ for (const lease of parsed.leases) {
381
+ if (!isRecord(lease))
382
+ continue;
383
+ const sense = text(lease.sense);
384
+ const machine = text(lease.machine);
385
+ const from = text(lease.from);
386
+ const since = text(lease.since);
387
+ if (!sense || !isSharedSense(sense) || !machine || !from || !since)
388
+ continue;
389
+ leases.push({ sense, machine, from, since, reason: text(lease.reason) ?? "" });
390
+ }
391
+ return leases;
392
+ }
393
+ /** Replace this machine's failover leases (an empty list removes the file's leases). */
394
+ function writeFailoverLeases(agentRoot, leases) {
395
+ const target = failoverLeasePath(agentRoot);
396
+ fs.mkdirSync(path.dirname(target), { recursive: true });
397
+ const temp = `${target}.${process.pid}.tmp`;
398
+ fs.writeFileSync(temp, `${JSON.stringify({ leases }, null, 2)}\n`, "utf-8");
399
+ fs.renameSync(temp, target);
400
+ (0, runtime_1.emitNervesEvent)({ component: "daemon", event: "daemon.presence_failover_written", message: "updated this machine's failover leases", meta: { agentRoot, senses: leases.map((lease) => lease.sense) } });
401
+ }
402
+ /** The shared senses this machine runs as a stand-in. */
403
+ function failoverSenses(presence, machineId) {
404
+ return exports.SHARED_SENSES.filter((sense) => holdsFailover(presence, machineId, sense));
349
405
  }
350
406
  /** Read the bundle's agent.json, the local flag and the peer records together. */
351
407
  function readPresenceForAgent(agentRoot, options = {}) {
@@ -359,7 +415,7 @@ function readPresenceForAgent(agentRoot, options = {}) {
359
415
  catch {
360
416
  return null;
361
417
  }
362
- return readPresence(agentJson, true, readPeerRecords(agentRoot));
418
+ return readPresence(agentJson, true, readPeerRecords(agentRoot), readFailoverLeases(agentRoot));
363
419
  }
364
420
  function isRosterMember(presence, machineId) {
365
421
  return presence.block.machines.some((machine) => machine.machineId === machineId);
@@ -382,7 +438,7 @@ function ownsSense(presence, machineId, sense) {
382
438
  return false;
383
439
  if (!isSharedSense(sense))
384
440
  return true;
385
- return effectiveOwner(presence, sense) === machineId;
441
+ return effectiveOwner(presence, sense) === machineId || holdsFailover(presence, machineId, sense);
386
442
  }
387
443
  function ownedSharedSenses(presence, machineId) {
388
444
  return enabledSharedSenses(presence).filter((sense) => ownsSense(presence, machineId, sense));
@@ -162,6 +162,7 @@ function deriveSignals(currentUserSpeech, priorAssistantReferents, latestStructu
162
162
  */
163
163
  const TERSE_CORRECTION_MAX_WORDS = 12;
164
164
  const CORRECTION_HOLD_CLEARED_BY = "Resolve the referent (orientation_get lists the candidates) or restate the request as a standalone, correction-free instruction. The policy is recomputed from each user turn, so it never carries past this turn.";
165
+ const CORRECTION_HOLD_ADVISORY = "Advisory only: tools are not blocked. Read the referent first (orientation_get lists the candidates); if the request is clear, do it now without asking for confirmation. Ask only when two readings would lead to different actions.";
165
166
  function countWords(text) {
166
167
  return text.trim().split(/\s+/).filter(Boolean).length;
167
168
  }
@@ -171,7 +172,7 @@ function correctionMarkerArmsHold(combinedSpeech, priorAssistantReferents, lates
171
172
  // Long speech still holds when there is something concrete to disambiguate.
172
173
  return priorAssistantReferents.length > 0 || Boolean(latestStructuredOutput);
173
174
  }
174
- function deriveActionPolicy(signals, combinedSpeech, priorAssistantReferents, latestStructuredOutput) {
175
+ function deriveActionPolicy(signals, combinedSpeech, priorAssistantReferents, latestStructuredOutput, familySpeaker) {
175
176
  const holdSignals = signals.filter((signal) => signal !== "correction_marker"
176
177
  || correctionMarkerArmsHold(combinedSpeech, priorAssistantReferents, latestStructuredOutput));
177
178
  if (holdSignals.length === 0)
@@ -186,7 +187,8 @@ function deriveActionPolicy(signals, combinedSpeech, priorAssistantReferents, la
186
187
  : "Current user speech appears to correct or revise prior understanding; inspect orientation before mutating durable state.",
187
188
  blockedMutationKinds: ["durable_state_write", "external_side_effect"],
188
189
  ...(triggeredBy ? { triggeredBy } : {}),
189
- clearedBy: CORRECTION_HOLD_CLEARED_BY,
190
+ clearedBy: familySpeaker ? CORRECTION_HOLD_ADVISORY : CORRECTION_HOLD_CLEARED_BY,
191
+ ...(familySpeaker ? { advisory: true } : {}),
190
192
  };
191
193
  }
192
194
  // A reply names the message it answers. The sense stamps that message's text on the
@@ -233,7 +235,7 @@ function buildOrientationFrame(input) {
233
235
  const latestStructuredOutput = candidateStructuredOutput && shouldAttachStructuredOutput(combinedSpeech, signals)
234
236
  ? candidateStructuredOutput
235
237
  : undefined;
236
- const actionPolicy = deriveActionPolicy(signals, combinedSpeech, priorAssistantReferents, candidateStructuredOutput);
238
+ const actionPolicy = deriveActionPolicy(signals, combinedSpeech, priorAssistantReferents, candidateStructuredOutput, input.familySpeaker === true);
237
239
  const frame = {
238
240
  schemaVersion: 1,
239
241
  channel: input.channel,
@@ -270,6 +272,7 @@ function buildOrientationFrame(input) {
270
272
  speechKind,
271
273
  signals,
272
274
  blockedMutationKinds: actionPolicy.blockedMutationKinds,
275
+ advisory: actionPolicy.advisory === true,
273
276
  triggeredBy: actionPolicy.triggeredBy ?? null,
274
277
  referentCount: priorAssistantReferents.length,
275
278
  structuredOutput: candidateStructuredOutput?.id ?? null,
@@ -288,7 +291,9 @@ function renderOrientationFrame(frame) {
288
291
  ];
289
292
  if (frame.actionPolicy.mode === "correction_hold") {
290
293
  lines.push(`policy reason: ${frame.actionPolicy.reason}`);
291
- lines.push(`policy blocks: ${frame.actionPolicy.blockedMutationKinds.join(", ")}`);
294
+ lines.push(frame.actionPolicy.advisory
295
+ ? `policy is advisory: nothing is blocked; check before ${frame.actionPolicy.blockedMutationKinds.join(", ")}`
296
+ : `policy blocks: ${frame.actionPolicy.blockedMutationKinds.join(", ")}`);
292
297
  if (frame.actionPolicy.triggeredBy) {
293
298
  lines.push(`policy trigger: correction marker "${frame.actionPolicy.triggeredBy}" in current user speech`);
294
299
  }
@@ -93,13 +93,17 @@ function renderWhereAmI(presence, self, nowMs = Date.now()) {
93
93
  // Only senses agent.json turns on: a disabled sense runs on no machine, whatever the roster's owners say.
94
94
  const enabled = (0, presence_1.enabledSharedSenses)(presence);
95
95
  const own = enabled.filter((sense) => (0, presence_1.effectiveOwner)(presence, sense) === self.machineId);
96
- const elsewhere = enabled.filter((sense) => (0, presence_1.effectiveOwner)(presence, sense) !== self.machineId);
96
+ const standIn = (presence.failover ?? []).filter((lease) => lease.machine === self.machineId);
97
+ const elsewhere = enabled.filter((sense) => (0, presence_1.effectiveOwner)(presence, sense) !== self.machineId && !standIn.some((lease) => lease.sense === sense));
97
98
  const here = own.map((sense) => {
98
99
  // The same wait mayRunSense applies: a peer whose record still runs it has not let go yet.
99
- const holder = presence.peers.find((peer) => peer.machineId !== self.machineId && (0, presence_1.isRosterMember)(presence, peer.machineId) && peer.owns?.includes(sense));
100
+ const holder = presence.peers.find((peer) => peer.machineId !== self.machineId && (0, presence_1.isRosterMember)(presence, peer.machineId) && peer.owns?.includes(sense) && !peer.failover?.includes(sense));
100
101
  return holder ? `${sense} (not yet: waiting for ${machineName(holder.machineId)} to let go)` : sense;
101
102
  });
102
103
  lines.push(`shared senses that run here: ${here.length > 0 ? here.join(", ") : "none"}.`);
104
+ for (const lease of standIn) {
105
+ lines.push(`i am running ${lease.sense} here in place of ${machineName(lease.from)} since ${ago(lease.since, nowMs)}, because ${lease.reason || "it stopped answering"}; ${machineName(lease.from)} takes it back as soon as it runs again.`);
106
+ }
103
107
  if (elsewhere.length > 0) {
104
108
  lines.push(`shared senses that run on a peer: ${elsewhere.map((sense) => {
105
109
  const owner = (0, presence_1.effectiveOwner)(presence, sense);
@@ -271,10 +271,35 @@ const SEGMENT_OPERATORS = new Set(["&&", "||", ";", "|"]);
271
271
  // shell could resolve it into one. A word like that counts as mentioning the folder when its directory part can match the folder's
272
272
  // path, so the read-only rule below applies to the command.
273
273
  const EXPANSION = "\u0001";
274
+ // Marks a word built from a same-command literal, so the word is still checked though it shows no glob or expansion.
275
+ const SUBSTITUTED = "\u0002";
274
276
  const STABLE_VARIABLES = ["HOME", "TMPDIR", "USER"];
277
+ // Builtins that can set a variable other than by NAME=value; with any of them present no assignment is trusted.
278
+ const OTHER_VARIABLE_SETTERS = /(?:^|[\s;&|(])(?:read|for|select|declare|typeset|local|readonly|eval|getopts|mapfile|readarray|printf|source|\.|let|export\s+-|unset)(?=$|[\s;&|)])/;
279
+ /**
280
+ * Variables this command sets exactly once to a plain literal (`R=gim-home/CIT; gh pr view 1 -R $R`), with where the
281
+ * assignment ends. Uses after that point are that literal, so they need not count as "could be anything". Quoted values,
282
+ * expansions in the value, a second assignment to the same name or any other way of setting a variable leave it unknown.
283
+ */
284
+ function literalAssignments(command) {
285
+ const found = new Map();
286
+ if (OTHER_VARIABLE_SETTERS.test(command))
287
+ return found;
288
+ for (const match of command.matchAll(/(?:^|[\s;&|(])(?:export\s+)?([A-Za-z_]\w*)=([^\s;&|()<>`$'"\\{}*?[\]~]+)(?=$|[\s;&|)])/g)) {
289
+ const name = match[1];
290
+ // Counts every NAME= in the command, including the one just matched.
291
+ if (command.match(new RegExp(`(?:^|[^\\w$])${name}=`, "g")).length === 1)
292
+ found.set(name, { value: match[2], end: match.index + match[0].length });
293
+ }
294
+ return found;
295
+ }
275
296
  function neutraliseExpansions(command) {
276
- return command.replace(/\$\([^)]*\)|`[^`]*`|\$\{([A-Za-z_]\w*)\}|\$([A-Za-z_]\w*)|\$\{[^}]*\}/g, (_match, braced, plain) => {
297
+ const literals = literalAssignments(command);
298
+ return command.replace(/\$\([^)]*\)|`[^`]*`|\$\{([A-Za-z_]\w*)\}|\$([A-Za-z_]\w*)|\$\{[^}]*\}/g, (_match, braced, plain, offset) => {
277
299
  const name = braced ?? plain;
300
+ const literal = name === undefined ? undefined : literals.get(name);
301
+ if (literal && offset >= literal.end)
302
+ return `${SUBSTITUTED}${literal.value}`;
278
303
  if (name !== undefined && STABLE_VARIABLES.includes(name) && !new RegExp(`\\b${name}=`).test(command) && process.env[name])
279
304
  return process.env[name];
280
305
  return EXPANSION;
@@ -288,8 +313,9 @@ function wordPattern(word) {
288
313
  return new RegExp(`^${source}$`);
289
314
  }
290
315
  function globOrExpansionCouldReach(command, folder, agentRoot) {
291
- const tokens = neutraliseExpansions(command).split(/[\s<>|;&()'"]+/).filter((token) => /[*?[{\u0001]/.test(token));
292
- return tokens.some((token) => {
316
+ const tokens = neutraliseExpansions(command).split(/[\s<>|;&()'"]+/).filter((token) => /[*?[{\u0001\u0002]/.test(token));
317
+ return tokens.some((marked) => {
318
+ const token = marked.replaceAll(SUBSTITUTED, "");
293
319
  const word = token.startsWith("~") ? expandHome(token) : token;
294
320
  const absolute = word.startsWith("/") || word.startsWith(EXPANSION) ? word : `${agentRoot}/${word}`;
295
321
  const dir = absolute.slice(0, Math.max(absolute.lastIndexOf("/"), 0));
@@ -429,7 +429,9 @@ async function preflightToolCall(name, args, ctx) {
429
429
  return { kind: "ready" };
430
430
  const risk = riskProfileForTool(def, name, args);
431
431
  const orientationPolicy = ctx?.orientationFrame?.actionPolicy;
432
- if (orientationPolicy?.mode === "correction_hold" && orientationPolicyBlocks(risk, orientationPolicy.blockedMutationKinds)) {
432
+ // A family speaker's hold is advice; a relationship-scoped turn (Sanctuary) always enforces it.
433
+ if (orientationPolicy?.mode === "correction_hold" && (!orientationPolicy.advisory || ctx?.relationshipAuthorization)
434
+ && orientationPolicyBlocks(risk, orientationPolicy.blockedMutationKinds)) {
433
435
  (0, runtime_1.emitNervesEvent)({
434
436
  level: "warn", event: "tool.orientation_hold_block", component: "tools",
435
437
  message: "orientation hold blocked high-risk tool execution",
@@ -913,6 +913,7 @@ async function handleInboundTurnExclusive(input) {
913
913
  messages: sessionMessages,
914
914
  currentUserMessages,
915
915
  structuredOutputs: session.structuredOutputs ?? [],
916
+ familySpeaker: resolvedContext.friend.trustLevel === "family",
916
917
  })
917
918
  : undefined);
918
919
  // Step 4b: Continuity pipeline — derive tempo, build start-of-turn packet, snapshot obligations
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@ouro.bot/cli",
3
- "version": "0.1.0-alpha.1085",
3
+ "version": "0.1.0-alpha.1087",
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.1085",
9
+ "version": "0.1.0-alpha.1087",
10
10
  "dependencies": {
11
11
  "@anthropic-ai/sdk": "^0.78.0",
12
12
  "@ouro.bot/friends": "0.1.0-alpha.18",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ouro.bot/cli",
3
- "version": "0.1.0-alpha.1085",
3
+ "version": "0.1.0-alpha.1087",
4
4
  "engines": {
5
5
  "node": ">=22"
6
6
  },