@ouro.bot/cli 0.1.0-alpha.1130 → 0.1.0-alpha.1131
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,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.1131",
|
|
6
|
+
"changes": [
|
|
7
|
+
"The app-sessions sense now notices a session blocked on the Copilot app's repository-trust card, from the notification claim the app records in its database, and tells the owner once per decision with the session name and repository. It shows as waiting in the sidebar picture and in `ouro status`."
|
|
8
|
+
]
|
|
9
|
+
},
|
|
4
10
|
{
|
|
5
11
|
"version": "0.1.0-alpha.1130",
|
|
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.1131</Repository>
|
|
5
5
|
<Registry>https://github.com/ourostack/ouroboros/pkgs/container/ouroboros-butler</Registry>
|
|
6
6
|
<Network>host</Network>
|
|
7
7
|
<Shell>sh</Shell>
|
|
@@ -150,6 +150,39 @@ function databaseRows(stateDir) {
|
|
|
150
150
|
return [...db.prepare(withHierarchy(workspaces, "workspaces", "w")).all(), ...db.prepare(withHierarchy(CHAT_ROWS, "sessions", "s")).all()];
|
|
151
151
|
});
|
|
152
152
|
}
|
|
153
|
+
function hasTable(db, table) {
|
|
154
|
+
return db.prepare("SELECT 1 FROM sqlite_master WHERE type = 'table' AND name = ?").get(table) !== undefined;
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* The sessions blocked on a repository-trust card. When a session that another session created reaches the card, the app
|
|
158
|
+
* records a `repository_trust` notification claim for it, with the decision id as the watermark, and the claim stays after
|
|
159
|
+
* the person decides. So a claim is an open wait only while the project has no trust grant for the session's host and no
|
|
160
|
+
* newer trust revision. A session nobody coordinates leaves no claim and is not seen here.
|
|
161
|
+
*/
|
|
162
|
+
function repositoryTrustWaits(stateDir) {
|
|
163
|
+
return withDatabase(stateDir, (db) => {
|
|
164
|
+
const waits = new Map();
|
|
165
|
+
if (!["creator_notification_claims", "project_host_trust", "project_trust_revisions", "workspaces", "projects"].every(table => hasTable(db, table)))
|
|
166
|
+
return waits;
|
|
167
|
+
const named = hasColumn(db, "projects", "github_owner") && hasColumn(db, "projects", "github_repo");
|
|
168
|
+
const revision = hasColumn(db, "project_trust_revisions", "local_revision") ? "max(r.revision, r.local_revision)" : "r.revision";
|
|
169
|
+
const claims = db.prepare(`
|
|
170
|
+
SELECT c.watermark, w.session_id, p.name AS project, ${named ? "p.github_owner AS owner, p.github_repo AS repo" : "NULL AS owner, NULL AS repo"},
|
|
171
|
+
EXISTS (SELECT 1 FROM project_host_trust h WHERE h.project_id = w.project_id AND h.host_id = coalesce(w.host_id, 'local')) AS trusted,
|
|
172
|
+
(SELECT ${revision} FROM project_trust_revisions r WHERE r.project_id = w.project_id) AS current
|
|
173
|
+
FROM creator_notification_claims c JOIN workspaces w ON w.id = c.workspace_id LEFT JOIN projects p ON p.id = w.project_id
|
|
174
|
+
WHERE c.kind = 'repository_trust' AND w.session_id IS NOT NULL`).all();
|
|
175
|
+
for (const claim of claims) {
|
|
176
|
+
const decided = Number(/:(\d+)$/.exec(claim.watermark)?.[1]);
|
|
177
|
+
if (claim.trusted || Number.isNaN(decided) || (claim.current ?? 0) > decided)
|
|
178
|
+
continue;
|
|
179
|
+
if ((waits.get(claim.session_id)?.revision ?? -1) >= decided)
|
|
180
|
+
continue;
|
|
181
|
+
waits.set(claim.session_id, { decisionId: claim.watermark, repo: claim.owner && claim.repo ? `${claim.owner}/${claim.repo}` : claim.project ?? "this repository", revision: decided });
|
|
182
|
+
}
|
|
183
|
+
return new Map([...waits].map(([session, { decisionId, repo }]) => [session, { decisionId, repo }]));
|
|
184
|
+
});
|
|
185
|
+
}
|
|
153
186
|
function sessionRecord(stateDir, id) {
|
|
154
187
|
return withDatabase(stateDir, (db) => db.prepare(`
|
|
155
188
|
SELECT s.id, s.archived_at, w.id AS workspace_id, w.workspace_type, w.archived_at AS workspace_archived_at
|
|
@@ -335,13 +368,15 @@ function listAppSessions(options = {}) {
|
|
|
335
368
|
const now = (options.now ?? Date.now)();
|
|
336
369
|
const seen = new Set();
|
|
337
370
|
const rows = [];
|
|
371
|
+
const trusts = repositoryTrustWaits(stateDir);
|
|
338
372
|
for (const row of databaseRows(stateDir)) {
|
|
339
373
|
if (seen.has(row.id) || !SESSION_ID.test(row.id))
|
|
340
374
|
continue;
|
|
341
375
|
seen.add(row.id);
|
|
342
376
|
const facts = cachedTailFacts(stateDir, row.id);
|
|
343
377
|
const isRunning = row.is_running === 1;
|
|
344
|
-
const
|
|
378
|
+
const repositoryTrust = trusts.get(row.id);
|
|
379
|
+
const { state, detail } = repositoryTrust ? { state: "waiting", detail: "waiting for a repository trust decision" } : classify(isRunning, facts, now);
|
|
345
380
|
rows.push({
|
|
346
381
|
id: row.id,
|
|
347
382
|
name: row.name || row.title || (row.workspace_id ? "(unnamed)" : "(unnamed chat)"),
|
|
@@ -362,6 +397,7 @@ function listAppSessions(options = {}) {
|
|
|
362
397
|
updatedAt: row.updated_at,
|
|
363
398
|
lastActivity: facts.lastActivity ?? row.updated_at,
|
|
364
399
|
...(facts.prompt ? { prompt: facts.prompt } : {}),
|
|
400
|
+
...(repositoryTrust ? { repositoryTrust } : {}),
|
|
365
401
|
});
|
|
366
402
|
}
|
|
367
403
|
(0, runtime_1.emitNervesEvent)({ component: "senses", event: "senses.app_sessions_listed", message: "listed the Copilot app's sessions", meta: { sessions: rows.length } });
|
|
@@ -44,7 +44,7 @@ const owner_notice_1 = require("../shepherd/owner-notice");
|
|
|
44
44
|
const store_1 = require("./store");
|
|
45
45
|
const waiting_status_1 = require("./waiting-status");
|
|
46
46
|
/**
|
|
47
|
-
* A session frozen on a permission prompt looks idle from outside, and only the person can answer it in the app. The
|
|
47
|
+
* A session frozen on a permission prompt, or on a repository-trust card, looks idle from outside, and only the person can answer it in the app. The
|
|
48
48
|
* snapshot already reads every session's history each minute, so noticing is deterministic and costs no model turn:
|
|
49
49
|
* a prompt open for more than two minutes is told to the owner once, in one plain message, through the same proactive
|
|
50
50
|
* path Shepherd's owner notices use. A prompt older than a day is shown in `ouro status` but never announced: it is
|
|
@@ -57,11 +57,15 @@ exports.WAITING_LIST_MAX = 6;
|
|
|
57
57
|
const stateFile = (agentRoot) => path.join((0, store_1.appSessionsStateDir)(agentRoot), "waiting-prompts.json");
|
|
58
58
|
const promptKey = (prompt) => `${prompt.session}:${prompt.requestId}`;
|
|
59
59
|
exports.promptKey = promptKey;
|
|
60
|
-
/** The open permission prompts in the sidebar.
|
|
60
|
+
/** The open permission prompts and repository-trust decisions in the sidebar. One the app gave no event time keeps the first time it was seen. */
|
|
61
61
|
function waitingPromptsOf(agentRoot, rows, now) {
|
|
62
62
|
const before = new Map(((0, store_1.readSnapshot)(agentRoot)?.waitingPrompts ?? []).map(prompt => [(0, exports.promptKey)(prompt), prompt.since]));
|
|
63
63
|
const prompts = [];
|
|
64
64
|
for (const row of rows) {
|
|
65
|
+
if (row.repositoryTrust) {
|
|
66
|
+
const requestId = row.repositoryTrust.decisionId;
|
|
67
|
+
prompts.push({ session: row.id, name: row.name, requestId, what: `a repository trust decision for ${row.repositoryTrust.repo}`, since: before.get((0, exports.promptKey)({ session: row.id, requestId })) ?? now });
|
|
68
|
+
}
|
|
65
69
|
if (!row.prompt)
|
|
66
70
|
continue;
|
|
67
71
|
const stamped = Date.parse(row.prompt.at ?? "");
|
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.1131",
|
|
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.1131",
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"@anthropic-ai/sdk": "^0.78.0",
|
|
12
12
|
"@ouro.bot/friends": "0.1.0-alpha.18",
|