@ouro.bot/cli 0.1.0-alpha.1513 → 0.1.0-alpha.1514
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 +8 -0
- package/deploy/unraid/sanctuary.ouro/bundle-meta.json +1 -1
- package/deploy/unraid/sanctuary.xml +1 -1
- package/dist/heart/daemon/app-sessions-record.js +14 -1
- package/dist/mind/where-am-i.js +16 -1
- package/dist/senses/app-sessions/digest-cards.js +80 -4
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
package/changelog.json
CHANGED
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"_note": "Each pull request writes its own change note under changes/; the release job on main gives each landed change its version and adds the notes here (scripts/release-version.cjs). On main this file stops at the last version set by hand; the published package has every release. Agents read this file directly via read_file to understand what changed between versions.",
|
|
3
3
|
"versions": [
|
|
4
|
+
{
|
|
5
|
+
"version": "0.1.0-alpha.1514",
|
|
6
|
+
"changes": [
|
|
7
|
+
"\"where i am\" now shows, for each work session on another machine, the repository, branch, pull request, owning session and desk log file its desk card names, with when the card last changed, so that work can be followed through the shared repos and desk.",
|
|
8
|
+
"The desk-card pointers now read the canonical v1 card (Desk's task-card-format): `evidence.ref` and `artifacts` for the pull request, `repos[]` and `iterations` for the repository and PR number, `bridge_sessions` for the session, and the `branch:<owner/repo>#<name>` row of `## Resources` for the branch. Flat `repo`, `branch`, `pr` and `session` fields still work and win.",
|
|
9
|
+
"The desk log pointer is now portable: a path relative to the desk root plus the desk repository's remote URL (when the desk is a git checkout), never the publishing machine's absolute path."
|
|
10
|
+
]
|
|
11
|
+
},
|
|
4
12
|
{
|
|
5
13
|
"version": "0.1.0-alpha.1513",
|
|
6
14
|
"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.1514</Repository>
|
|
5
5
|
<Registry>https://github.com/ourostack/ouroboros/pkgs/container/ouroboros-butler</Registry>
|
|
6
6
|
<Network>host</Network>
|
|
7
7
|
<Shell>sh</Shell>
|
|
@@ -48,6 +48,19 @@ function readJson(file) {
|
|
|
48
48
|
return null;
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
|
+
/** The desk card's own pointers: its track and slug, plus the repository, branch, pull request, owning session and desk log file it names, with when it last changed. */
|
|
52
|
+
function deskPointer(card) {
|
|
53
|
+
return {
|
|
54
|
+
track: card.track, slug: card.slug, status: card.status, via: "desk",
|
|
55
|
+
...(card.pr ? { url: card.pr } : {}),
|
|
56
|
+
...(card.repo ? { repo: card.repo } : {}),
|
|
57
|
+
...(card.branch ? { branch: card.branch } : {}),
|
|
58
|
+
...(card.session ? { session: card.session } : {}),
|
|
59
|
+
...(card.file ? { file: card.file } : {}),
|
|
60
|
+
...(card.deskRepo ? { deskRepo: card.deskRepo } : {}),
|
|
61
|
+
...(card.updatedAt ? { updatedAt: card.updatedAt } : {}),
|
|
62
|
+
};
|
|
63
|
+
}
|
|
51
64
|
/**
|
|
52
65
|
* This machine's Copilot app sessions for its peer record, from the app-sessions sense's last snapshot. Each session
|
|
53
66
|
* the digest tied to a desk card carries that card's track, slug and status, so a peer sees what work runs here and
|
|
@@ -62,7 +75,7 @@ function appSessionsRecord(agentRoot, nowMs) {
|
|
|
62
75
|
const cards = new Map((digestFresh ? digest?.sessions ?? [] : []).filter((s) => s.card).map((s) => [s.id, s.card]));
|
|
63
76
|
const sessions = (snap.sessions ?? []).map(({ id, name, state }) => {
|
|
64
77
|
const card = cards.get(id);
|
|
65
|
-
return { id, name, state, ...(card ? { desk:
|
|
78
|
+
return { id, name, state, ...(card ? { desk: deskPointer(card) } : {}) };
|
|
66
79
|
});
|
|
67
80
|
(0, runtime_1.emitNervesEvent)({ component: "daemon", event: "daemon.app_sessions_record_built", message: "built the app sessions part of the peer record", meta: { sessions: sessions.length, withDeskCard: cards.size } });
|
|
68
81
|
return { appSessions: { at: snap.at, counts: snap.counts, sessions } };
|
package/dist/mind/where-am-i.js
CHANGED
|
@@ -69,12 +69,27 @@ function sessionCounts(record) {
|
|
|
69
69
|
return parts.length > 0 ? `; copilot app sessions: ${parts.join(", ")}` : "";
|
|
70
70
|
}
|
|
71
71
|
const PEER_SESSIONS_SHOWN = 8;
|
|
72
|
+
/** Where a peer's work can be followed passively: its desk card, the repository branch and pull request the card names, and when the card last changed. */
|
|
73
|
+
function deskPointers(desk, nowMs) {
|
|
74
|
+
if (!desk?.track)
|
|
75
|
+
return "";
|
|
76
|
+
const parts = [`desk card ${desk.track}/${desk.slug ?? "?"}${desk.status ? ` [${desk.status}]` : ""}`];
|
|
77
|
+
if (desk.repo || desk.branch)
|
|
78
|
+
parts.push(`${desk.repo ?? "repo?"}@${desk.branch ?? "branch?"}`);
|
|
79
|
+
if (desk.url)
|
|
80
|
+
parts.push(`pr ${desk.url}`);
|
|
81
|
+
if (desk.session)
|
|
82
|
+
parts.push(`session ${desk.session}`);
|
|
83
|
+
if (desk.file)
|
|
84
|
+
parts.push(`log ${desk.file}${desk.deskRepo ? ` in ${desk.deskRepo}` : ""}${desk.updatedAt ? ` (updated ${ago(desk.updatedAt, nowMs)})` : ""}`);
|
|
85
|
+
return `, ${parts.join("; ")}`;
|
|
86
|
+
}
|
|
72
87
|
/** The Copilot app sessions a peer last published, so work running there is visible without reaching the machine. */
|
|
73
88
|
function peerSessionLines(record, nowMs) {
|
|
74
89
|
const sessions = record?.appSessions?.sessions ?? [];
|
|
75
90
|
if (!record?.appSessions || sessions.length === 0)
|
|
76
91
|
return [];
|
|
77
|
-
const shown = sessions.slice(0, PEER_SESSIONS_SHOWN).map((session) => ` - ${session.name ?? session.id}${session.state ? ` (${session.state})` : ""}${session.desk
|
|
92
|
+
const shown = sessions.slice(0, PEER_SESSIONS_SHOWN).map((session) => ` - ${session.name ?? session.id}${session.state ? ` (${session.state})` : ""}${deskPointers(session.desk, nowMs)}`);
|
|
78
93
|
const more = sessions.length > shown.length ? [` - and ${sessions.length - shown.length} more`] : [];
|
|
79
94
|
return [` its copilot app sessions as of ${ago(record.appSessions.at, nowMs)}:`, ...shown, ...more];
|
|
80
95
|
}
|
|
@@ -156,19 +156,91 @@ function scanFocus(id, entry, maxBytes, options = {}) {
|
|
|
156
156
|
(0, runtime_1.emitNervesEvent)({ component: "senses", event: "senses.app_sessions_focus_scanned", message: "scanned a session's history for its declared task", meta: { bytes: scanned.bytes, first: entry === undefined, found: !!scanned.entry.track } });
|
|
157
157
|
return scanned;
|
|
158
158
|
}
|
|
159
|
+
const unquote = (value) => value.trim().replace(/^['"]|['"]$/g, "");
|
|
160
|
+
/** The indented lines under a top-level front-matter key, or an empty list. */
|
|
161
|
+
function block(front, key) {
|
|
162
|
+
const lines = front.split("\n");
|
|
163
|
+
const start = lines.findIndex(line => line.startsWith(`${key}:`));
|
|
164
|
+
if (start < 0)
|
|
165
|
+
return [];
|
|
166
|
+
const out = [];
|
|
167
|
+
for (const line of lines.slice(start + 1)) {
|
|
168
|
+
if (line.length > 0 && !/^\s/.test(line) && !line.startsWith("- "))
|
|
169
|
+
break;
|
|
170
|
+
out.push(line);
|
|
171
|
+
}
|
|
172
|
+
return out;
|
|
173
|
+
}
|
|
174
|
+
/** The `- key: value` items of a block list, each as its simple key/value pairs. */
|
|
175
|
+
function items(lines) {
|
|
176
|
+
const result = [];
|
|
177
|
+
for (const line of lines) {
|
|
178
|
+
const entry = /^(\s*)-\s+(.*)$/.exec(line);
|
|
179
|
+
const text = entry ? entry[2] : line.trim();
|
|
180
|
+
if (entry)
|
|
181
|
+
result.push({});
|
|
182
|
+
const pair = /^([A-Za-z_][\w-]*):\s*(.*)$/.exec(text);
|
|
183
|
+
if (pair && result.length > 0)
|
|
184
|
+
result[result.length - 1][pair[1]] = unquote(pair[2].replace(/\s+#.*$/, ""));
|
|
185
|
+
}
|
|
186
|
+
return result;
|
|
187
|
+
}
|
|
188
|
+
/** The values of a front-matter list, written inline (`[a, b]`) or as a block of `- value` lines. */
|
|
189
|
+
function listValues(front, key) {
|
|
190
|
+
const inline = new RegExp(`^${key}:\\s*\\[(.*)\\]`, "m").exec(front)?.[1];
|
|
191
|
+
if (inline !== undefined)
|
|
192
|
+
return inline.split(",").map(unquote).filter(Boolean);
|
|
193
|
+
return block(front, key).map(line => /^\s*-\s+(.+)$/.exec(line)?.[1]).filter((v) => !!v).map(v => unquote(v.replace(/\s+#.*$/, "")));
|
|
194
|
+
}
|
|
195
|
+
const githubRepo = (url) => /github\.com[/:]([^/]+\/[^/.]+)/.exec(url)?.[1];
|
|
196
|
+
/**
|
|
197
|
+
* Where the work a card describes can be followed: the repository, branch, pull request and session. It reads the
|
|
198
|
+
* canonical v1 card (`repos[]`, `evidence.ref`, `artifacts`, `iterations`, `bridge_sessions`, and the `branch:<owner/repo>#<name>`
|
|
199
|
+
* rows of `## Resources`, per Desk's task-card-format) and, for compatibility, flat `repo`, `branch`, `pr`/`pr_url` and
|
|
200
|
+
* `session`/`session_id` fields, which win when present.
|
|
201
|
+
*/
|
|
202
|
+
function pointers(front, body, field) {
|
|
203
|
+
const repos = items(block(front, "repos"));
|
|
204
|
+
const history = items(block(front, "iterations").filter(line => /^\s{2,}(?:-\s|[a-z]+:\s)/.test(line) && !/^\s*(active|history):/.test(line)));
|
|
205
|
+
const evidence = block(front, "evidence").join("\n");
|
|
206
|
+
const slugOf = (name) => {
|
|
207
|
+
const entry = repos.find(r => r.name === name);
|
|
208
|
+
return (entry?.url ? githubRepo(entry.url) : undefined) ?? name;
|
|
209
|
+
};
|
|
210
|
+
const branchRow = [...body.matchAll(/`?branch:([^\s#|`]+)#([^\s|`]+)`?/g)].pop();
|
|
211
|
+
const active = /^\s+active:\s*(\S.*)$/m.exec(block(front, "iterations").join("\n"))?.[1]?.trim();
|
|
212
|
+
const current = history.filter(h => h.pr && h.pr !== "null").find(h => active && h.path && unquote(active).endsWith(h.path.replace(/^\.\//, ""))) ?? [...history].reverse().find(h => h.pr && h.pr !== "null");
|
|
213
|
+
const pullUrl = (evidence.match(/ref:\s*(\S*\/pull\/\d+\S*)/)?.[1]) ?? [...listValues(front, "artifacts")].reverse().find(v => /\/pull\/\d+/.test(v));
|
|
214
|
+
const repo = field("repo") ?? (branchRow ? branchRow[1] : undefined) ?? (pullUrl ? githubRepo(pullUrl) : undefined) ?? slugOf(current?.repo ?? repos[0]?.name);
|
|
215
|
+
const pr = field("pr") ?? field("pr_url") ?? pullUrl ?? (current && repo ? `https://github.com/${repo}/pull/${current.pr}` : undefined);
|
|
216
|
+
const branch = field("branch") ?? branchRow?.[2];
|
|
217
|
+
const session = field("session") ?? field("session_id") ?? listValues(front, "bridge_sessions")[0];
|
|
218
|
+
return { ...(repo ? { repo } : {}), ...(branch ? { branch } : {}), ...(pr ? { pr } : {}), ...(session ? { session } : {}) };
|
|
219
|
+
}
|
|
220
|
+
/** The origin URL of the desk root's git checkout, or null when it has no remote. */
|
|
221
|
+
function deskRemote(root) {
|
|
222
|
+
try {
|
|
223
|
+
const config = fs.readFileSync(path.join(root, ".git", "config"), "utf-8");
|
|
224
|
+
return /\[remote "origin"\][^[]*?\burl\s*=\s*(\S+)/.exec(config)?.[1] ?? null;
|
|
225
|
+
}
|
|
226
|
+
catch {
|
|
227
|
+
return null;
|
|
228
|
+
}
|
|
229
|
+
}
|
|
159
230
|
/** The card at `<root>/<track>/<slug>/task.md`, or archived beside it, in the first desk root that has it: its title, status and next step. */
|
|
160
231
|
function readCard(roots, track, slug) {
|
|
161
232
|
for (const root of roots) {
|
|
162
|
-
const
|
|
233
|
+
const found = [path.join(root, track, slug, "task.md"), path.join(root, track, "_archive", slug, "task.md")].map(file => {
|
|
163
234
|
try {
|
|
164
|
-
return fs.readFileSync(file, "utf-8");
|
|
235
|
+
return { file, body: fs.readFileSync(file, "utf-8"), updatedAt: fs.statSync(file).mtime.toISOString() };
|
|
165
236
|
}
|
|
166
237
|
catch {
|
|
167
238
|
return null;
|
|
168
239
|
}
|
|
169
|
-
}).find(
|
|
170
|
-
if (
|
|
240
|
+
}).find(entry => entry !== null);
|
|
241
|
+
if (found === undefined)
|
|
171
242
|
continue;
|
|
243
|
+
const { body } = found;
|
|
172
244
|
const front = /^---\n([\s\S]*?)\n---/.exec(body)?.[1] ?? "";
|
|
173
245
|
const field = (name) => {
|
|
174
246
|
const value = new RegExp(`^${name}:\\s*(.+)$`, "m").exec(front)?.[1]?.trim().replace(/^['"]|['"]$/g, "");
|
|
@@ -181,6 +253,10 @@ function readCard(roots, track, slug) {
|
|
|
181
253
|
title: field("title") ?? slug,
|
|
182
254
|
status: field("status") ?? "unknown",
|
|
183
255
|
next: next ? (next.length > NEXT_MAX_CHARS ? `${next.slice(0, NEXT_MAX_CHARS - 1)}…` : next) : null,
|
|
256
|
+
...pointers(front, body, field),
|
|
257
|
+
file: path.relative(root, found.file).split(path.sep).join("/"),
|
|
258
|
+
...(deskRemote(root) ? { deskRepo: deskRemote(root) } : {}),
|
|
259
|
+
updatedAt: found.updatedAt,
|
|
184
260
|
};
|
|
185
261
|
}
|
|
186
262
|
return null;
|
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.1514",
|
|
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.1514",
|
|
10
10
|
"bundleDependencies": [
|
|
11
11
|
"@ouro.bot/friends"
|
|
12
12
|
],
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ouro.bot/cli",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.1514",
|
|
4
4
|
"description": "Ouroboros, the agent harness: agents with durable memory that live where you talk (terminal, Teams, iMessage, mail, voice) and use real tools. Start with npx ouro.bot@latest.",
|
|
5
5
|
"homepage": "https://ouroboros.bot/",
|
|
6
6
|
"engines": {
|