@ouro.bot/cli 0.1.0-alpha.1084 → 0.1.0-alpha.1085
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 +6 -0
- package/deploy/unraid/sanctuary.ouro/bundle-meta.json +1 -1
- package/deploy/unraid/sanctuary.xml +1 -1
- package/dist/heart/daemon/presence-roster.js +11 -12
- package/dist/heart/daemon/presence.js +29 -3
- package/dist/mind/where-am-i.js +25 -5
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
package/changelog.json
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
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.1085",
|
|
6
|
+
"changes": [
|
|
7
|
+
"Presence names only the senses agent.json turns on: a disabled sense is listed as running on no machine, never as owned by one, in ouro presence status (with a new disabled list in --json), in published records and in the agent's where-i-am. A shared sense with no named owner now lives on the roster's always-on machine instead of whoever joined first, and joining no longer stamps every sense on the first machine. Where-i-am says whether each sense actually runs here or, per the peer's own record, there, and lists machine-scoped senses from agent.json instead of a fixed list."
|
|
8
|
+
]
|
|
9
|
+
},
|
|
4
10
|
{
|
|
5
11
|
"version": "0.1.0-alpha.1084",
|
|
6
12
|
"changes": [
|
|
@@ -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.
|
|
4
|
+
<Repository>ghcr.io/ourostack/ouroboros-butler:0.1.0-alpha.1085</Repository>
|
|
5
5
|
<Registry>https://github.com/ourostack/ouroboros/pkgs/container/ouroboros-butler</Registry>
|
|
6
6
|
<Network>host</Network>
|
|
7
7
|
<Shell>sh</Shell>
|
|
@@ -47,7 +47,6 @@ exports.presenceStatusJson = presenceStatusJson;
|
|
|
47
47
|
exports.renderPresenceStatus = renderPresenceStatus;
|
|
48
48
|
const path = __importStar(require("path"));
|
|
49
49
|
const runtime_1 = require("../../nerves/runtime");
|
|
50
|
-
const agent_discovery_1 = require("./agent-discovery");
|
|
51
50
|
const agent_home_1 = require("./agent-home");
|
|
52
51
|
const presence_1 = require("./presence");
|
|
53
52
|
/** Add (or rename) this machine in the agent's roster. Creating a roster keeps every shared sense with `home`. */
|
|
@@ -76,13 +75,9 @@ async function joinPresenceRoster(options) {
|
|
|
76
75
|
const machines = current
|
|
77
76
|
? block.machines.map((machine) => (machine.machineId === machineId ? { machineId, name: machineName, role } : machine))
|
|
78
77
|
: [...block.machines, { machineId, name: machineName, role }];
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
for (const sense of presence_1.SHARED_SENSES)
|
|
83
|
-
owners[sense] = ownerId;
|
|
84
|
-
}
|
|
85
|
-
const next = { ...block, machines, owners };
|
|
78
|
+
// No sense is stamped on whoever joins first: an unclaimed shared sense stays with home until an always-on
|
|
79
|
+
// machine joins, then lives there. `ouro presence handoff` names an owner explicitly.
|
|
80
|
+
const next = { ...block, machines, owners: { ...block.owners } };
|
|
86
81
|
return {
|
|
87
82
|
kind: "write",
|
|
88
83
|
next: { ...parsed, presence: next },
|
|
@@ -155,10 +150,10 @@ function presenceStatusJson(options) {
|
|
|
155
150
|
const { presence, machineId, settings } = options;
|
|
156
151
|
(0, runtime_1.emitNervesEvent)({ component: "daemon", event: "daemon.presence_status_json", message: "rendered presence status as json", meta: { active: presence !== null } });
|
|
157
152
|
if (!presence)
|
|
158
|
-
return { enabled: settings.enabled, machine: null, peers: [], owns: [], owners: {}, legacy: [] };
|
|
153
|
+
return { enabled: settings.enabled, machine: null, peers: [], owns: [], owners: {}, disabled: [], legacy: [] };
|
|
159
154
|
const me = presence.block.machines.find((machine) => machine.machineId === machineId);
|
|
160
155
|
const owners = {};
|
|
161
|
-
for (const sense of presence_1.
|
|
156
|
+
for (const sense of (0, presence_1.enabledSharedSenses)(presence)) {
|
|
162
157
|
const owner = (0, presence_1.effectiveOwner)(presence, sense);
|
|
163
158
|
owners[sense] = presence.block.machines.find((machine) => machine.machineId === owner)?.name ?? owner;
|
|
164
159
|
}
|
|
@@ -171,8 +166,9 @@ function presenceStatusJson(options) {
|
|
|
171
166
|
const record = presence.peers.find((peer) => peer.machineId === machine.machineId);
|
|
172
167
|
return { machineId: machine.machineId, name: machine.name, role: machine.role, seenAt: record?.seenAt ?? null, version: record?.version ?? null, location: record?.location ?? null };
|
|
173
168
|
}),
|
|
174
|
-
owns: presence_1.
|
|
169
|
+
owns: (0, presence_1.enabledSharedSenses)(presence).filter((sense) => (0, presence_1.effectiveOwner)(presence, sense) === machineId),
|
|
175
170
|
owners,
|
|
171
|
+
disabled: presence_1.SHARED_SENSES.filter((sense) => !(0, presence_1.senseEnabled)(presence, sense)),
|
|
176
172
|
legacy: presence.legacy.map((id) => presence.block.machines.find((machine) => machine.machineId === id)?.name ?? id),
|
|
177
173
|
};
|
|
178
174
|
}
|
|
@@ -206,12 +202,15 @@ function renderPresenceStatus(options) {
|
|
|
206
202
|
lines.push(`- ${machine.name}${me}: ${machine.role}; ${seen}${legacy}`);
|
|
207
203
|
}
|
|
208
204
|
lines.push("owners:");
|
|
209
|
-
for (const sense of presence_1.
|
|
205
|
+
for (const sense of (0, presence_1.enabledSharedSenses)(presence)) {
|
|
210
206
|
const owner = (0, presence_1.effectiveOwner)(presence, sense);
|
|
211
207
|
const name = presence.block.machines.find((machine) => machine.machineId === owner)?.name ?? owner;
|
|
212
208
|
const declared = presence.block.owners[sense];
|
|
213
209
|
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)` : "";
|
|
214
210
|
lines.push(`- ${sense}: ${name}${held}`);
|
|
215
211
|
}
|
|
212
|
+
const off = presence_1.SHARED_SENSES.filter((sense) => !(0, presence_1.senseEnabled)(presence, sense));
|
|
213
|
+
if (off.length > 0)
|
|
214
|
+
lines.push(`turned off in agent.json, so running on no machine: ${off.join(", ")}`);
|
|
216
215
|
return lines.join("\n");
|
|
217
216
|
}
|
|
@@ -72,6 +72,10 @@ exports.presenceSettingsPath = presenceSettingsPath;
|
|
|
72
72
|
exports.readLocalPresenceSettings = readLocalPresenceSettings;
|
|
73
73
|
exports.writeLocalPresenceSettings = writeLocalPresenceSettings;
|
|
74
74
|
exports.readPresence = readPresence;
|
|
75
|
+
exports.enabledSensesOf = enabledSensesOf;
|
|
76
|
+
exports.senseEnabled = senseEnabled;
|
|
77
|
+
exports.enabledSharedSenses = enabledSharedSenses;
|
|
78
|
+
exports.alwaysOnMachine = alwaysOnMachine;
|
|
75
79
|
exports.mayRunSense = mayRunSense;
|
|
76
80
|
exports.readPresenceForAgent = readPresenceForAgent;
|
|
77
81
|
exports.isRosterMember = isRosterMember;
|
|
@@ -304,7 +308,29 @@ function readPresence(agentJson, localFlag, peerRecords) {
|
|
|
304
308
|
// A home off the roster runs every shared sense under the home lease.
|
|
305
309
|
if (home && !block.machines.some((machine) => machine.machineId === home.machineId))
|
|
306
310
|
legacy.push(home.machineId);
|
|
307
|
-
|
|
311
|
+
const enabledSenses = enabledSensesOf(agentJson.senses);
|
|
312
|
+
return { block, home, legacy, peers: peerRecords, ...(enabledSenses ? { enabledSenses } : {}) };
|
|
313
|
+
}
|
|
314
|
+
/** The senses a `senses` block turns on. Habits run on schedulers, not a senses entry, so they count unless turned off. */
|
|
315
|
+
function enabledSensesOf(senses) {
|
|
316
|
+
if (!isRecord(senses))
|
|
317
|
+
return undefined;
|
|
318
|
+
const enabled = Object.entries(senses).filter(([, entry]) => isRecord(entry) && entry.enabled === true).map(([sense]) => sense);
|
|
319
|
+
if (!(isRecord(senses.habits) && senses.habits.enabled === false) && !enabled.includes("habits"))
|
|
320
|
+
enabled.push("habits");
|
|
321
|
+
return enabled;
|
|
322
|
+
}
|
|
323
|
+
/** Whether agent.json turns the sense on. A disabled sense runs nowhere, so no machine owns it in any sense a person cares about. */
|
|
324
|
+
function senseEnabled(presence, sense) {
|
|
325
|
+
return !presence.enabledSenses || presence.enabledSenses.includes(sense);
|
|
326
|
+
}
|
|
327
|
+
/** The shared senses agent.json turns on. */
|
|
328
|
+
function enabledSharedSenses(presence) {
|
|
329
|
+
return exports.SHARED_SENSES.filter((sense) => senseEnabled(presence, sense));
|
|
330
|
+
}
|
|
331
|
+
/** The roster's always-on machine, which keeps any shared sense nobody claimed: a laptop travels and sleeps. */
|
|
332
|
+
function alwaysOnMachine(presence) {
|
|
333
|
+
return presence.block.machines.find((machine) => machine.role === "always-on")?.machineId;
|
|
308
334
|
}
|
|
309
335
|
/**
|
|
310
336
|
* Whether this machine may run a sense now: it owns it, and, for a shared
|
|
@@ -348,7 +374,7 @@ function rosterMachine(presence, machineId) {
|
|
|
348
374
|
function effectiveOwner(presence, sense) {
|
|
349
375
|
if (presence.legacy.length > 0 && presence.home)
|
|
350
376
|
return presence.home.machineId;
|
|
351
|
-
return presence.block.owners[sense] ?? presence.home?.machineId ?? presence.block.machines[0].machineId;
|
|
377
|
+
return presence.block.owners[sense] ?? alwaysOnMachine(presence) ?? presence.home?.machineId ?? presence.block.machines[0].machineId;
|
|
352
378
|
}
|
|
353
379
|
/** Whether this machine runs this sense under the roster. Machine-scoped senses run on every roster machine. */
|
|
354
380
|
function ownsSense(presence, machineId, sense) {
|
|
@@ -359,7 +385,7 @@ function ownsSense(presence, machineId, sense) {
|
|
|
359
385
|
return effectiveOwner(presence, sense) === machineId;
|
|
360
386
|
}
|
|
361
387
|
function ownedSharedSenses(presence, machineId) {
|
|
362
|
-
return
|
|
388
|
+
return enabledSharedSenses(presence).filter((sense) => ownsSense(presence, machineId, sense));
|
|
363
389
|
}
|
|
364
390
|
/** A machine name a person would type: case-insensitive, `.local` ignored; ids match too. */
|
|
365
391
|
function findRosterMachine(presence, nameOrId) {
|
package/dist/mind/where-am-i.js
CHANGED
|
@@ -65,6 +65,10 @@ function sessionCounts(record) {
|
|
|
65
65
|
const parts = Object.entries(counts).filter(([, count]) => typeof count === "number").map(([state, count]) => `${count} ${state}`);
|
|
66
66
|
return parts.length > 0 ? `; copilot app sessions: ${parts.join(", ")}` : "";
|
|
67
67
|
}
|
|
68
|
+
/** Senses every presence runs for its own machine. */
|
|
69
|
+
const MACHINE_SENSES = ["cli", "shepherd", "app-sessions"];
|
|
70
|
+
/** What a person calls a sense whose name is the integration's. */
|
|
71
|
+
const SENSE_NAMES = { bluebubbles: "bluebubbles (iMessage)" };
|
|
68
72
|
function renderWhereAmI(presence, self, nowMs = Date.now()) {
|
|
69
73
|
if (!presence)
|
|
70
74
|
return "";
|
|
@@ -86,13 +90,29 @@ function renderWhereAmI(presence, self, nowMs = Date.now()) {
|
|
|
86
90
|
lines.push(`- ${peer.name} (${facts}): ${seen}`);
|
|
87
91
|
}
|
|
88
92
|
}
|
|
89
|
-
|
|
90
|
-
const
|
|
91
|
-
|
|
93
|
+
// Only senses agent.json turns on: a disabled sense runs on no machine, whatever the roster's owners say.
|
|
94
|
+
const enabled = (0, presence_1.enabledSharedSenses)(presence);
|
|
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);
|
|
97
|
+
const here = own.map((sense) => {
|
|
98
|
+
// 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
|
+
return holder ? `${sense} (not yet: waiting for ${machineName(holder.machineId)} to let go)` : sense;
|
|
101
|
+
});
|
|
102
|
+
lines.push(`shared senses that run here: ${here.length > 0 ? here.join(", ") : "none"}.`);
|
|
92
103
|
if (elsewhere.length > 0) {
|
|
93
|
-
lines.push(`
|
|
104
|
+
lines.push(`shared senses that run on a peer: ${elsewhere.map((sense) => {
|
|
105
|
+
const owner = (0, presence_1.effectiveOwner)(presence, sense);
|
|
106
|
+
const record = presence.peers.find((peer) => peer.machineId === owner);
|
|
107
|
+
const shown = record?.owns?.includes(sense) ? `its record from ${ago(record.seenAt, nowMs)} says it runs it` : "its last record does not show it running";
|
|
108
|
+
return `${sense} (${machineName(owner)}; ${shown})`;
|
|
109
|
+
}).join(", ")}.`);
|
|
94
110
|
}
|
|
95
|
-
|
|
111
|
+
const off = presence_1.SHARED_SENSES.filter((sense) => !(0, presence_1.senseEnabled)(presence, sense)).map((sense) => SENSE_NAMES[sense] ?? sense);
|
|
112
|
+
if (off.length > 0)
|
|
113
|
+
lines.push(`turned off in agent.json, so running on no machine: ${off.join(", ")}.`);
|
|
114
|
+
const local = MACHINE_SENSES.filter((sense) => (0, presence_1.senseEnabled)(presence, sense));
|
|
115
|
+
lines.push(`machine-scoped senses that run on every presence and see only their own machine: ${local.length > 0 ? local.join(", ") : "none"}.`);
|
|
96
116
|
if (presence.legacy.length > 0) {
|
|
97
117
|
lines.push(`until ${presence.legacy.map((id) => machineName(id)).join(", ")} publish${presence.legacy.length === 1 ? "es" : ""} a current presence record, every shared sense stays with home.`);
|
|
98
118
|
}
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ouro.bot/cli",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.1085",
|
|
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.
|
|
9
|
+
"version": "0.1.0-alpha.1085",
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"@anthropic-ai/sdk": "^0.78.0",
|
|
12
12
|
"@ouro.bot/friends": "0.1.0-alpha.18",
|