@ouro.bot/cli 0.1.0-alpha.1640 → 0.1.0-alpha.1642
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/daemon.js +2 -0
- package/dist/heart/letters/filed-note.js +99 -0
- package/dist/heart/letters/writer.js +2 -0
- package/dist/heart/private-runtime/policy.js +8 -0
- 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.1642",
|
|
6
|
+
"changes": [
|
|
7
|
+
"Filing a letter now tells the agent that owns the mailbox. A note such as `letter L7 from the lane \"desk/task\" was filed (decide, today); its sender gave it the subject \"Which name?\"` goes to the agent's private runtime, and a wake has it read the note now, so the agent decides whether and when its person sees the letter. Each letter is told once: refiling the same letter by its dedupeKey, or a repeated wake, adds nothing. If the wake fails, the note waits for the agent's next private turn.",
|
|
8
|
+
"The private-runtime policy allows this wake only when it names the letter and comes from the daemon's filing. A wake the policy denies is logged as a failure, with the note still queued. The note quotes the sender's lane and subject as the sender's own words.",
|
|
9
|
+
"Update the Ouro UI files to Ouro UI v1.3.590."
|
|
10
|
+
]
|
|
11
|
+
},
|
|
4
12
|
{
|
|
5
13
|
"version": "0.1.0-alpha.1640",
|
|
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.1642</Repository>
|
|
5
5
|
<Registry>https://github.com/ourostack/ouroboros/pkgs/container/ouroboros-butler</Registry>
|
|
6
6
|
<Network>host</Network>
|
|
7
7
|
<Shell>sh</Shell>
|
|
@@ -2572,6 +2572,8 @@ class OuroDaemon {
|
|
|
2572
2572
|
bundlesRoot: this.bundlesRoot,
|
|
2573
2573
|
// A letter goes to its person's iMessage chat as the agent, through the agent's own BlueBubbles settings.
|
|
2574
2574
|
deliverChat: (await Promise.resolve().then(() => __importStar(require("../../senses/bluebubbles/agent-client")))).letterChatSender(this.bundlesRoot),
|
|
2575
|
+
// Filing tells the agent, in its own private runtime, so it decides when its person sees the letter.
|
|
2576
|
+
onFiled: (await Promise.resolve().then(() => __importStar(require("../letters/filed-note")))).letterFiledTeller(this.bundlesRoot, (wake) => this.handlePrivateRuntimeWake(wake)),
|
|
2575
2577
|
});
|
|
2576
2578
|
return letters.answerLettersCommand(this.lettersWriter, command);
|
|
2577
2579
|
}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.letterFiledNote = letterFiledNote;
|
|
37
|
+
exports.letterFiledWake = letterFiledWake;
|
|
38
|
+
exports.tellAgentLetterFiled = tellAgentLetterFiled;
|
|
39
|
+
exports.letterFiledTeller = letterFiledTeller;
|
|
40
|
+
// Filing a letter tells the agent that owns the mailbox (design §3.3: "Letter L7 from <lane>: <subject>"), so it can
|
|
41
|
+
// decide whether and when its person sees the letter. The note goes to the agent's own private runtime, the way a
|
|
42
|
+
// habit that can't run tells it, and a wake has the agent read it now. It is the harness speaking, never the person.
|
|
43
|
+
const path = __importStar(require("path"));
|
|
44
|
+
const pending_1 = require("../../mind/pending");
|
|
45
|
+
const runtime_1 = require("../../nerves/runtime");
|
|
46
|
+
/** The note in the agent's own words, the way its private runtime notes read. */
|
|
47
|
+
function letterFiledNote(letter) {
|
|
48
|
+
// The lane and subject are the sender's words, quoted as theirs, so they can't read as the agent's own thought.
|
|
49
|
+
const from = letter.from.lane ? ` from the lane ${JSON.stringify(letter.from.lane)}` : "";
|
|
50
|
+
const hold = letter.holdUntil ? `, held until ${letter.holdUntil}` : "";
|
|
51
|
+
const chat = letter.answeringHandle
|
|
52
|
+
? "mailbox_deliver sends it to their chat"
|
|
53
|
+
: "it can't go to their chat, since they had no answering handle when it was filed";
|
|
54
|
+
return `letter ${letter.code}${from} was filed (${letter.kind}, ${letter.urgency}${hold}); its sender gave it the subject ${JSON.stringify(letter.subject)}. it waits for my person's answer. i decide whether and when they see it: ${chat}; mailbox_read shows it.`;
|
|
55
|
+
}
|
|
56
|
+
/** The private-runtime wake for one filed letter; its idempotency key makes a repeat a duplicate. */
|
|
57
|
+
function letterFiledWake(agent, letter) {
|
|
58
|
+
return {
|
|
59
|
+
kind: "private.wake",
|
|
60
|
+
agent,
|
|
61
|
+
reason: `letter ${letter.code} filed`,
|
|
62
|
+
triggerSource: "letter-filed",
|
|
63
|
+
budgetClass: "interactive",
|
|
64
|
+
idempotencyKey: `letter-filed:${agent}:${letter.id}`,
|
|
65
|
+
originRefs: [{ kind: "letter", id: letter.id }, { kind: "daemon-command", id: "letters.file" }],
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Queues the note for the agent and wakes it. A wake that fails leaves the note queued for the agent's next private
|
|
70
|
+
* turn, so the letter is never lost to it; the failure is logged.
|
|
71
|
+
*/
|
|
72
|
+
async function tellAgentLetterFiled(agent, agentRoot, letter, wake) {
|
|
73
|
+
// The queue names a note by its timestamp and packet id, so the letter's own filing time makes a repeat one note.
|
|
74
|
+
(0, pending_1.queuePendingMessageOnce)((0, pending_1.getPrivateRuntimePendingDir)(agent, agentRoot), {
|
|
75
|
+
from: agent,
|
|
76
|
+
friendId: "self",
|
|
77
|
+
channel: "inner",
|
|
78
|
+
key: "dialog",
|
|
79
|
+
content: letterFiledNote(letter),
|
|
80
|
+
timestamp: Date.parse(letter.createdAt),
|
|
81
|
+
packetId: `letter-filed:${letter.id}`,
|
|
82
|
+
});
|
|
83
|
+
try {
|
|
84
|
+
const answer = await wake(letterFiledWake(agent, letter));
|
|
85
|
+
if (!answer.ok)
|
|
86
|
+
throw new Error(answer.error ?? "the wake was refused");
|
|
87
|
+
// A wake policy denies still answers ok; only an executable decision woke the agent.
|
|
88
|
+
if (answer.data?.decision?.executable === false)
|
|
89
|
+
throw new Error(answer.message ?? "the wake was denied");
|
|
90
|
+
(0, runtime_1.emitNervesEvent)({ component: "daemon", event: "letters.filed_told", message: "the agent was told a letter was filed", meta: { code: letter.code } });
|
|
91
|
+
}
|
|
92
|
+
catch (error) {
|
|
93
|
+
(0, runtime_1.emitNervesEvent)({ level: "warn", component: "daemon", event: "letters.filed_wake_failed", message: "a filed letter's note waits for the agent's next private turn", meta: { code: letter.code, error: error.message } });
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
/** The daemon's onFiled: each agent hears through its own bundle's private runtime. */
|
|
97
|
+
function letterFiledTeller(bundlesRoot, wake) {
|
|
98
|
+
return (agent, letter) => tellAgentLetterFiled(agent, path.join(bundlesRoot, `${agent}.ouro`), letter, wake);
|
|
99
|
+
}
|
|
@@ -233,6 +233,8 @@ class LettersWriter {
|
|
|
233
233
|
throw error;
|
|
234
234
|
}
|
|
235
235
|
letters.index.add({ letter, events: [], closed: false });
|
|
236
|
+
// The agent hears about each new letter once; a dedupe that refiles one says nothing new.
|
|
237
|
+
this.deps.onFiled?.(letters.agent, letter).catch(() => undefined);
|
|
236
238
|
return { outcome: "needs-human", id: letter.id, code: letter.code, state: "waiting", message: `Filed ${letter.code}, ${letter.subject}. It waits for the person's answer.` };
|
|
237
239
|
}
|
|
238
240
|
list(letters, input) {
|
|
@@ -193,6 +193,14 @@ async function evaluatePolicy(request, context, deps) {
|
|
|
193
193
|
reason: "verified daemon await check",
|
|
194
194
|
};
|
|
195
195
|
}
|
|
196
|
+
if (request.triggerSource === "letter-filed"
|
|
197
|
+
&& hasNonEmptyOriginRef(originRefs, "letter")
|
|
198
|
+
&& hasOriginRef(originRefs, "daemon-command", "letters.file")) {
|
|
199
|
+
return {
|
|
200
|
+
result: "allow",
|
|
201
|
+
reason: "a letter was filed for the agent's person",
|
|
202
|
+
};
|
|
203
|
+
}
|
|
196
204
|
if (isVerifiedHabitWake(request.triggerSource, originRefs)) {
|
|
197
205
|
return {
|
|
198
206
|
result: "allow",
|
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.1642",
|
|
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.1642",
|
|
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.1642",
|
|
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": {
|