@ouro.bot/cli 0.1.0-alpha.1325 → 0.1.0-alpha.1327
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.1327",
|
|
6
|
+
"changes": [
|
|
7
|
+
"The five session tools have Ouro AX cards; their failures end with a code, and query_active_work and query_session state a low-risk profile."
|
|
8
|
+
]
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
"version": "0.1.0-alpha.1326",
|
|
12
|
+
"changes": [
|
|
13
|
+
"The nine continuity tools have Ouro AX cards; their failures end with a code, and query_episodes, query_presence, query_cares and query_relationships state a low-risk profile."
|
|
14
|
+
]
|
|
15
|
+
},
|
|
4
16
|
{
|
|
5
17
|
"version": "0.1.0-alpha.1325",
|
|
6
18
|
"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.1327</Repository>
|
|
5
5
|
<Registry>https://github.com/ourostack/ouroboros/pkgs/container/ouroboros-butler</Registry>
|
|
6
6
|
<Network>host</Network>
|
|
7
7
|
<Shell>sh</Shell>
|
|
@@ -43,6 +43,7 @@ const episodes_1 = require("../arc/episodes");
|
|
|
43
43
|
const cares_1 = require("../arc/cares");
|
|
44
44
|
const presence_1 = require("../arc/presence");
|
|
45
45
|
const intentions_1 = require("../arc/intentions");
|
|
46
|
+
const tool_error_code_1 = require("./tool-error-code");
|
|
46
47
|
const steward_policy_1 = require("../heart/steward-policy");
|
|
47
48
|
const await_parser_1 = require("../heart/awaiting/await-parser");
|
|
48
49
|
const externalEventDispositionProperties = {
|
|
@@ -78,11 +79,11 @@ function prepareExternalEventDisposition(a, ctx) {
|
|
|
78
79
|
const recordPath = path.resolve(String(a.recordPath ?? ""));
|
|
79
80
|
const relative = path.relative(agentEventRoot, recordPath);
|
|
80
81
|
if (!relative || relative.startsWith("..") || path.isAbsolute(relative) || !recordPath.endsWith(".json")) {
|
|
81
|
-
throw new Error("External event receipt does not belong to the current agent");
|
|
82
|
+
throw new Error((0, tool_error_code_1.withCode)("External event receipt does not belong to the current agent", "receipt-not-this-turn"));
|
|
82
83
|
}
|
|
83
84
|
const record = (0, router_1.readExternalEventRecord)(recordPath);
|
|
84
85
|
if (record.agent !== agentName)
|
|
85
|
-
throw new Error("External event receipt does not belong to the current agent");
|
|
86
|
+
throw new Error((0, tool_error_code_1.withCode)("External event receipt does not belong to the current agent", "receipt-not-this-turn"));
|
|
86
87
|
const turnContext = ctx?.currentExternalEvent;
|
|
87
88
|
const turnEvent = turnContext
|
|
88
89
|
? [turnContext, ...(turnContext.relatedEvents ?? [])].find((event) => path.resolve(event.recordPath) === recordPath)
|
|
@@ -99,19 +100,19 @@ function prepareExternalEventDisposition(a, ctx) {
|
|
|
99
100
|
// land on the receipt while this generation is still being worked, and the lease revision is
|
|
100
101
|
// the one the agent actually investigated.
|
|
101
102
|
if (!turnEvent)
|
|
102
|
-
throw new Error("External event disposition is not authorized for this exact turn lease");
|
|
103
|
+
throw new Error((0, tool_error_code_1.withCode)("External event disposition is not authorized for this exact turn lease", "receipt-not-this-turn"));
|
|
103
104
|
if (turnEvent.agent !== agentName || record.agent !== agentName)
|
|
104
|
-
throw new Error("External event receipt does not belong to the current agent");
|
|
105
|
+
throw new Error((0, tool_error_code_1.withCode)("External event receipt does not belong to the current agent", "receipt-not-this-turn"));
|
|
105
106
|
if (turnEvent.eventId !== record.eventId)
|
|
106
|
-
throw new Error("External event disposition event id does not match the turn lease");
|
|
107
|
+
throw new Error((0, tool_error_code_1.withCode)("External event disposition event id does not match the turn lease", "receipt-not-this-turn"));
|
|
107
108
|
if (turnEvent.generation !== expectedGeneration || record.generation !== expectedGeneration)
|
|
108
|
-
throw new Error("External event disposition generation does not match the turn lease");
|
|
109
|
+
throw new Error((0, tool_error_code_1.withCode)("External event disposition generation does not match the turn lease", "receipt-not-this-turn"));
|
|
109
110
|
if (turnEvent.observationRevision !== classifiedRevision)
|
|
110
|
-
throw new Error("External event disposition revision does not match the exact turn lease");
|
|
111
|
+
throw new Error((0, tool_error_code_1.withCode)("External event disposition revision does not match the exact turn lease", "receipt-not-this-turn"));
|
|
111
112
|
if (record.disposition != null)
|
|
112
|
-
throw new Error("External event generation is already dispositioned");
|
|
113
|
+
throw new Error((0, tool_error_code_1.withCode)("External event generation is already dispositioned", "receipt-closed"));
|
|
113
114
|
if (record.executionState === "dead_letter")
|
|
114
|
-
throw new Error("External event receipt is dead-lettered and cannot be dispositioned");
|
|
115
|
+
throw new Error((0, tool_error_code_1.withCode)("External event receipt is dead-lettered and cannot be dispositioned", "receipt-closed"));
|
|
115
116
|
const classification = String(a.classification);
|
|
116
117
|
const decision = String(a.decision);
|
|
117
118
|
const nextWake = String(a.nextWake);
|
|
@@ -124,7 +125,7 @@ function prepareExternalEventDisposition(a, ctx) {
|
|
|
124
125
|
|| !["expected", "needs_attention", "adopted", "snoozed", "dismissed_until_change", "resolved"].includes(classification)
|
|
125
126
|
|| !["silent", "act", "ask", "report"].includes(decision)
|
|
126
127
|
|| !["on_change", "on_escalation", "on_recovery", "at"].includes(nextWake)) {
|
|
127
|
-
throw new Error("External event disposition is invalid");
|
|
128
|
+
throw new Error((0, tool_error_code_1.withCode)("External event disposition is invalid", "disposition-invalid"));
|
|
128
129
|
}
|
|
129
130
|
const wake = nextWake === "at" ? { kind: "at", at: String(a.wakeAt ?? "") } : { kind: nextWake };
|
|
130
131
|
const actionRefs = Array.isArray(a.actionRefs) ? a.actionRefs.map(String) : [];
|
|
@@ -138,9 +139,9 @@ function prepareExternalEventDisposition(a, ctx) {
|
|
|
138
139
|
else {
|
|
139
140
|
const key = String(a.stewardPolicyKey ?? "").trim();
|
|
140
141
|
if (!key)
|
|
141
|
-
throw new Error("External event disposition is invalid");
|
|
142
|
+
throw new Error((0, tool_error_code_1.withCode)("External event disposition is invalid", "disposition-invalid"));
|
|
142
143
|
if (policy.version !== policyVersion || (!policy.desiredStates[key] && !policy.routineActionGrants[key])) {
|
|
143
|
-
throw new Error("External event steward policy is not the exact current key/version");
|
|
144
|
+
throw new Error((0, tool_error_code_1.withCode)("External event steward policy is not the exact current key/version", "policy-not-current"));
|
|
144
145
|
}
|
|
145
146
|
stewardPolicy = { kind: "current", key, version: policyVersion };
|
|
146
147
|
}
|
|
@@ -148,15 +149,15 @@ function prepareExternalEventDisposition(a, ctx) {
|
|
|
148
149
|
const care = (0, cares_1.readCares)(agentRoot).find((candidate) => candidate.id === a.careId);
|
|
149
150
|
const binding = care?.incidentBindings?.find((candidate) => candidate.source === record.source && candidate.incidentKey === record.eventId && candidate.classifiedRevision === classifiedRevision);
|
|
150
151
|
if (!care || !binding)
|
|
151
|
-
throw new Error("External event Care does not belong to this agent and incident revision");
|
|
152
|
+
throw new Error((0, tool_error_code_1.withCode)("External event Care does not belong to this agent and incident revision", "care-not-bound"));
|
|
152
153
|
}
|
|
153
154
|
if (classification === "adopted" && !(typeof a.careId === "string" && a.careId)) {
|
|
154
|
-
throw new Error("External event adopted disposition requires a Care");
|
|
155
|
+
throw new Error((0, tool_error_code_1.withCode)("External event adopted disposition requires a Care", "care-not-bound"));
|
|
155
156
|
}
|
|
156
157
|
if (nextWake === "at") {
|
|
157
158
|
const awaitId = typeof a.awaitId === "string" ? a.awaitId : "";
|
|
158
159
|
if (!/^[A-Za-z0-9_-]+$/u.test(awaitId))
|
|
159
|
-
throw new Error("External event timed disposition requires a current pending Await");
|
|
160
|
+
throw new Error((0, tool_error_code_1.withCode)("External event timed disposition requires a current pending Await", "await-mismatch"));
|
|
160
161
|
const awaitPath = path.join(agentRoot, "awaiting", `${awaitId}.md`);
|
|
161
162
|
let pendingAwait;
|
|
162
163
|
try {
|
|
@@ -166,15 +167,15 @@ function prepareExternalEventDisposition(a, ctx) {
|
|
|
166
167
|
pendingAwait = (0, await_parser_1.parseAwaitFile)(fs.readFileSync(awaitPath, "utf8"), awaitPath);
|
|
167
168
|
}
|
|
168
169
|
catch {
|
|
169
|
-
throw new Error("External event timed disposition requires a current pending Await");
|
|
170
|
+
throw new Error((0, tool_error_code_1.withCode)("External event timed disposition requires a current pending Await", "await-mismatch"));
|
|
170
171
|
}
|
|
171
172
|
const expectedOwnerId = ctx?.context?.friend.id;
|
|
172
173
|
if (pendingAwait.filed_from !== "external-event" || pendingAwait.filed_from_key !== record.recordPath
|
|
173
174
|
|| (expectedOwnerId && pendingAwait.filed_for_friend_id !== expectedOwnerId)) {
|
|
174
|
-
throw new Error("External event timed disposition Await is not owned by this exact external event");
|
|
175
|
+
throw new Error((0, tool_error_code_1.withCode)("External event timed disposition Await is not owned by this exact external event", "await-mismatch"));
|
|
175
176
|
}
|
|
176
177
|
if (pendingAwait.status !== "pending" || pendingAwait.wake_at !== String(a.wakeAt)) {
|
|
177
|
-
throw new Error("External event timed disposition Await does not match the exact wake time");
|
|
178
|
+
throw new Error((0, tool_error_code_1.withCode)("External event timed disposition Await does not match the exact wake time", "await-mismatch"));
|
|
178
179
|
}
|
|
179
180
|
}
|
|
180
181
|
const authority = ctx?.externalEventAuthority?.authorizeDisposition({
|
|
@@ -190,20 +191,20 @@ function prepareExternalEventDisposition(a, ctx) {
|
|
|
190
191
|
verificationRefs,
|
|
191
192
|
});
|
|
192
193
|
if (!authority?.allowed)
|
|
193
|
-
throw new Error(`External event disposition authority denied: ${authority?.reason ?? "authority unavailable"}
|
|
194
|
+
throw new Error((0, tool_error_code_1.withCode)(`External event disposition authority denied: ${authority?.reason ?? "authority unavailable"}`, "authority-denied"));
|
|
194
195
|
return {
|
|
195
196
|
recordPath,
|
|
196
197
|
finish: async () => {
|
|
197
198
|
let ownerMessage;
|
|
198
199
|
if (decision === "ask" || decision === "report") {
|
|
199
200
|
if (!ownerText)
|
|
200
|
-
throw new Error("ask and report need owner_message: the short plain text the owner will read");
|
|
201
|
+
throw new Error((0, tool_error_code_1.withCode)("ask and report need owner_message: the short plain text the owner will read", "owner-message-invalid"));
|
|
201
202
|
if (Buffer.byteLength(ownerText, "utf8") > 1_200)
|
|
202
|
-
throw new Error("External event owner message must be phone-sized");
|
|
203
|
+
throw new Error((0, tool_error_code_1.withCode)("External event owner message must be phone-sized", "owner-message-invalid"));
|
|
203
204
|
if (OWNER_MESSAGE_FORBIDDEN.test(ownerText))
|
|
204
|
-
throw new Error("owner_message must be plain words for the owner, with no internal ids, leases, generations, revisions, receipts or hidden characters");
|
|
205
|
+
throw new Error((0, tool_error_code_1.withCode)("owner_message must be plain words for the owner, with no internal ids, leases, generations, revisions, receipts or hidden characters", "owner-message-invalid"));
|
|
205
206
|
if (!ctx?.externalEventEffects)
|
|
206
|
-
throw new Error("External event owner delivery is unavailable");
|
|
207
|
+
throw new Error((0, tool_error_code_1.withCode)("External event owner delivery is unavailable", "owner-delivery-unavailable"));
|
|
207
208
|
// The whole dispatched batch shares one owner message; the delivery port settles later decisions as covered by it.
|
|
208
209
|
const relatedEvents = [turnContext, ...(turnContext.relatedEvents ?? [])]
|
|
209
210
|
.filter((event) => path.resolve(event.recordPath) !== recordPath)
|
|
@@ -259,20 +260,20 @@ exports.continuityToolDefinitions = [
|
|
|
259
260
|
const input = a;
|
|
260
261
|
if (input.batch !== undefined) {
|
|
261
262
|
if (Object.keys(input).some((key) => key !== "batch"))
|
|
262
|
-
throw new Error("External event disposition single and batch forms are mutually exclusive");
|
|
263
|
+
throw new Error((0, tool_error_code_1.withCode)("External event disposition single and batch forms are mutually exclusive", "disposition-invalid"));
|
|
263
264
|
if (!Array.isArray(input.batch) || input.batch.length < 1 || input.batch.length > 32)
|
|
264
|
-
throw new Error("External event disposition batch must contain 1 to 32 items");
|
|
265
|
+
throw new Error((0, tool_error_code_1.withCode)("External event disposition batch must contain 1 to 32 items", "disposition-invalid"));
|
|
265
266
|
if (input.batch.some((item) => !item || typeof item !== "object" || Array.isArray(item)))
|
|
266
|
-
throw new Error("External event disposition batch item is invalid");
|
|
267
|
+
throw new Error((0, tool_error_code_1.withCode)("External event disposition batch item is invalid", "disposition-invalid"));
|
|
267
268
|
const recordPaths = input.batch.map((item) => path.resolve(String(item.recordPath ?? "")));
|
|
268
269
|
if (new Set(recordPaths).size !== recordPaths.length)
|
|
269
|
-
throw new Error("External event disposition batch contains a duplicate receipt");
|
|
270
|
+
throw new Error((0, tool_error_code_1.withCode)("External event disposition batch contains a duplicate receipt", "disposition-invalid"));
|
|
270
271
|
const activeFrame = ctx?.currentExternalEvent
|
|
271
272
|
? [ctx.currentExternalEvent, ...(ctx.currentExternalEvent.relatedEvents ?? [])]
|
|
272
273
|
: [];
|
|
273
274
|
const activeRecordPaths = new Set(activeFrame.map((event) => path.resolve(event.recordPath)));
|
|
274
275
|
if (activeRecordPaths.size !== recordPaths.length || recordPaths.some((recordPath) => !activeRecordPaths.has(recordPath))) {
|
|
275
|
-
throw new Error("External event disposition batch must contain every lease in the active turn frame");
|
|
276
|
+
throw new Error((0, tool_error_code_1.withCode)("External event disposition batch must contain every lease in the active turn frame", "batch-incomplete"));
|
|
276
277
|
}
|
|
277
278
|
const prepared = input.batch.map((item) => prepareExternalEventDisposition(item, ctx));
|
|
278
279
|
return (async () => {
|
|
@@ -292,6 +293,18 @@ exports.continuityToolDefinitions = [
|
|
|
292
293
|
return prepared.finish().then((handled) => JSON.stringify(handled, null, 2));
|
|
293
294
|
},
|
|
294
295
|
riskProfile: { mutates: "durable_state_write", risk: "high", reason: "records the agent's classification on an existing external-event receipt" },
|
|
296
|
+
ax: { id: "tool:external_event_disposition", group: "turn-external-events", when: "Pick this once you have investigated an external event this turn, to record what it means and whether the owner hears about it.", effect: "write", errors: [
|
|
297
|
+
{ code: "receipt-not-this-turn", means: "The receipt or its generation, event id or revision doesn't match a lease handed to this turn.", fix: "Copy recordPath, expectedGeneration and classifiedRevision exactly from this turn's external-event message." },
|
|
298
|
+
{ code: "receipt-closed", means: "This generation already has a disposition, or the daemon dead-lettered it.", fix: "Stop; nothing more is needed for this generation." },
|
|
299
|
+
{ code: "disposition-invalid", means: "A field is missing or not one of its allowed values, or the single and batch forms are mixed.", fix: "Send either one disposition or one batch, with reason and each enum field set to an allowed value." },
|
|
300
|
+
{ code: "batch-incomplete", means: "The batch leaves out a lease of this turn or names one that isn't in it.", fix: "Send one batch item for every lease the turn listed, and only those." },
|
|
301
|
+
{ code: "policy-not-current", means: "stewardPolicyKey and stewardPolicyVersion don't match the live steward policy.", fix: "Read the current policy's key and version again, or set stewardPolicyKind to none." },
|
|
302
|
+
{ code: "care-not-bound", means: "adopted needs a careId, and that Care must be bound to this incident revision.", fix: "Bind the incident with care_manage bind_incident first, then pass that Care's id." },
|
|
303
|
+
{ code: "await-mismatch", means: "nextWake at needs a pending Await filed for this event at the same wake time.", fix: "Call await_condition for this event, then pass its awaitId and the same wakeAt." },
|
|
304
|
+
{ code: "authority-denied", means: "The runtime refused this disposition for this event; the message gives the reason.", fix: "Choose a disposition the reason allows, usually ask or report to the owner." },
|
|
305
|
+
{ code: "owner-message-invalid", means: "ask and report need owner_message as short plain words, with no internal ids or bookkeeping terms.", fix: "Write one phone-sized message the owner can read cold, without ids, leases or receipts." },
|
|
306
|
+
{ code: "owner-delivery-unavailable", means: "This turn can't deliver a message to the owner.", fix: "Use decision silent or act for now and record why in reason." },
|
|
307
|
+
] },
|
|
295
308
|
},
|
|
296
309
|
{
|
|
297
310
|
tool: {
|
|
@@ -322,6 +335,10 @@ exports.continuityToolDefinitions = [
|
|
|
322
335
|
(0, runtime_1.emitNervesEvent)({ component: "repertoire", event: "repertoire.query_episodes", message: `queried ${episodes.length} episodes`, meta: { count: episodes.length } });
|
|
323
336
|
return JSON.stringify(episodes, null, 2);
|
|
324
337
|
},
|
|
338
|
+
riskProfile: { mutates: "none", risk: "low" },
|
|
339
|
+
ax: { id: "tool:query_episodes", group: "turn-continuity", when: "Pick this to recall recent significant events from your continuity log, filtered by kind or time, before retelling what happened lately.", effect: "read", idempotent: true, errors: [
|
|
340
|
+
{ code: "invalid-arguments", means: "limit isn't a number, or kind or since isn't text.", fix: "Pass limit as a number such as 20, and since as an ISO time." },
|
|
341
|
+
] },
|
|
325
342
|
},
|
|
326
343
|
{
|
|
327
344
|
tool: {
|
|
@@ -354,6 +371,10 @@ exports.continuityToolDefinitions = [
|
|
|
354
371
|
return JSON.stringify(episode, null, 2);
|
|
355
372
|
},
|
|
356
373
|
riskProfile: { mutates: "durable_state_write", risk: "high", reason: "writes continuity episode state" },
|
|
374
|
+
ax: { id: "tool:capture_episode", group: "turn-continuity", when: "Pick this to mark a turning point worth remembering with why it mattered; later chats find it through query_episodes.", effect: "write", errors: [
|
|
375
|
+
{ code: "invalid-arguments", means: "summary or whyItMattered is missing.", fix: "Call capture_episode again with both a summary and why it mattered." },
|
|
376
|
+
{ code: "orientation-hold", means: "This turn is on a correction hold, so new episodes wait.", fix: "Call orientation_get, settle what the person meant, then go ahead if it is still right." },
|
|
377
|
+
] },
|
|
357
378
|
},
|
|
358
379
|
{
|
|
359
380
|
tool: {
|
|
@@ -372,6 +393,10 @@ exports.continuityToolDefinitions = [
|
|
|
372
393
|
(0, runtime_1.emitNervesEvent)({ component: "repertoire", event: "repertoire.query_presence", message: `presence: self + ${peers.length} peers`, meta: { peerCount: peers.length } });
|
|
373
394
|
return JSON.stringify({ self, peers }, null, 2);
|
|
374
395
|
},
|
|
396
|
+
riskProfile: { mutates: "none", risk: "low" },
|
|
397
|
+
ax: { id: "tool:query_presence", group: "turn-continuity", when: "Pick this to see your own current availability and lane, and which peer agents are around, before handing off or waiting on one.", effect: "read", idempotent: true, errors: [
|
|
398
|
+
{ code: "not-allowed", means: "This relationship's tool selection doesn't include presence.", fix: "Carry on without it; presence matters only for coordinating with other agents." },
|
|
399
|
+
] },
|
|
375
400
|
},
|
|
376
401
|
{
|
|
377
402
|
tool: {
|
|
@@ -394,6 +419,10 @@ exports.continuityToolDefinitions = [
|
|
|
394
419
|
(0, runtime_1.emitNervesEvent)({ component: "repertoire", event: "repertoire.query_cares", message: `queried ${cares.length} cares`, meta: { count: cares.length } });
|
|
395
420
|
return JSON.stringify(cares, null, 2);
|
|
396
421
|
},
|
|
422
|
+
riskProfile: { mutates: "none", risk: "low" },
|
|
423
|
+
ax: { id: "tool:query_cares", group: "turn-continuity", when: "Pick this to list what you are watching over, active cares by default or every status, before creating one with care_manage.", effect: "read", idempotent: true, errors: [
|
|
424
|
+
{ code: "invalid-arguments", means: "status isn't text.", fix: "Pass status as active, watching, resolved, dormant or all." },
|
|
425
|
+
] },
|
|
397
426
|
},
|
|
398
427
|
{
|
|
399
428
|
tool: {
|
|
@@ -462,7 +491,7 @@ exports.continuityToolDefinitions = [
|
|
|
462
491
|
}
|
|
463
492
|
else if (a.action === "bind_incident") {
|
|
464
493
|
if (!a.expectedUpdatedAt)
|
|
465
|
-
throw new Error("bind_incident requires expectedUpdatedAt: copy the Care's current updatedAt from the last care_manage result");
|
|
494
|
+
throw new Error((0, tool_error_code_1.withCode)("bind_incident requires expectedUpdatedAt: copy the Care's current updatedAt from the last care_manage result", "expected-updated-at-required"));
|
|
466
495
|
result = (0, cares_1.bindCareIncident)(agentRoot, a.id, {
|
|
467
496
|
source: a.source,
|
|
468
497
|
incidentKey: a.incidentKey,
|
|
@@ -472,7 +501,7 @@ exports.continuityToolDefinitions = [
|
|
|
472
501
|
}
|
|
473
502
|
else if (a.action === "resolve_incident") {
|
|
474
503
|
if (!a.expectedUpdatedAt)
|
|
475
|
-
throw new Error("resolve_incident requires expectedUpdatedAt: copy the Care's current updatedAt from the last care_manage result");
|
|
504
|
+
throw new Error((0, tool_error_code_1.withCode)("resolve_incident requires expectedUpdatedAt: copy the Care's current updatedAt from the last care_manage result", "expected-updated-at-required"));
|
|
476
505
|
result = (0, cares_1.resolveCareIncident)(agentRoot, a.id, {
|
|
477
506
|
source: a.source,
|
|
478
507
|
incidentKey: a.incidentKey,
|
|
@@ -517,6 +546,11 @@ exports.continuityToolDefinitions = [
|
|
|
517
546
|
return JSON.stringify(result, null, 2);
|
|
518
547
|
},
|
|
519
548
|
riskProfile: { mutates: "durable_state_write", risk: "high", reason: "creates or updates care state" },
|
|
549
|
+
ax: { id: "tool:care_manage", group: "turn-continuity", when: "Pick this to start, change or close a care, or tie a machine incident to one; query_cares finds existing ids first.", effect: "write", errors: [
|
|
550
|
+
{ code: "expected-updated-at-required", means: "bind_incident and resolve_incident need the Care's current updatedAt.", fix: "Copy updatedAt from the last care_manage or query_cares result into expectedUpdatedAt." },
|
|
551
|
+
{ code: "invalid-arguments", means: "action is missing or not one of create, update, resolve, bind_incident, resolve_incident or upsert_incident.", fix: "Call care_manage again with one of those actions and its fields." },
|
|
552
|
+
{ code: "orientation-hold", means: "This turn is on a correction hold, so care changes wait.", fix: "Call orientation_get, settle what the person meant, then go ahead if it is still right." },
|
|
553
|
+
] },
|
|
520
554
|
},
|
|
521
555
|
{
|
|
522
556
|
tool: {
|
|
@@ -542,6 +576,10 @@ exports.continuityToolDefinitions = [
|
|
|
542
576
|
(0, runtime_1.emitNervesEvent)({ component: "repertoire", event: "repertoire.query_relationships", message: `queried relationships`, meta: { agentName: a.agentName ?? "all" } });
|
|
543
577
|
return JSON.stringify(agents, null, 2);
|
|
544
578
|
},
|
|
579
|
+
riskProfile: { mutates: "none", risk: "low" },
|
|
580
|
+
ax: { id: "tool:query_relationships", group: "turn-continuity", when: "Pick this to see what you know about other agents you work with, one by name or all; people are in friend_list.", effect: "read", idempotent: true, errors: [
|
|
581
|
+
{ code: "invalid-arguments", means: "agentName isn't text.", fix: "Pass the agent's name as text, or leave it out to list all agents." },
|
|
582
|
+
] },
|
|
545
583
|
},
|
|
546
584
|
{
|
|
547
585
|
tool: {
|
|
@@ -572,6 +610,10 @@ exports.continuityToolDefinitions = [
|
|
|
572
610
|
return JSON.stringify(intention, null, 2);
|
|
573
611
|
},
|
|
574
612
|
riskProfile: { mutates: "durable_state_write", risk: "high", reason: "writes intention state" },
|
|
613
|
+
ax: { id: "tool:intention_capture", group: "turn-continuity", when: "Pick this to jot something small you mean to do or check later, with an optional nudge time; bigger concerns become cares.", effect: "write", errors: [
|
|
614
|
+
{ code: "invalid-arguments", means: "content is missing.", fix: "Call intention_capture again with what you mean to do as content." },
|
|
615
|
+
{ code: "orientation-hold", means: "This turn is on a correction hold, so new intentions wait.", fix: "Call orientation_get, settle what the person meant, then go ahead if it is still right." },
|
|
616
|
+
] },
|
|
575
617
|
},
|
|
576
618
|
{
|
|
577
619
|
tool: {
|
|
@@ -598,5 +640,9 @@ exports.continuityToolDefinitions = [
|
|
|
598
640
|
return JSON.stringify(result, null, 2);
|
|
599
641
|
},
|
|
600
642
|
riskProfile: { mutates: "durable_state_write", risk: "high", reason: "updates intention state" },
|
|
643
|
+
ax: { id: "tool:intention_manage", group: "turn-continuity", when: "Pick this to close an intention, as resolve when done or dismiss when it no longer matters, using its id.", effect: "write", errors: [
|
|
644
|
+
{ code: "invalid-arguments", means: "action isn't resolve or dismiss, or id is missing.", fix: "Call intention_manage again with action resolve or dismiss and the intention's id." },
|
|
645
|
+
{ code: "orientation-hold", means: "This turn is on a correction hold, so intention changes wait.", fix: "Call orientation_get, settle what the person meant, then go ahead if it is still right." },
|
|
646
|
+
] },
|
|
601
647
|
},
|
|
602
648
|
];
|
|
@@ -56,6 +56,7 @@ const obligations_1 = require("../arc/obligations");
|
|
|
56
56
|
const progress_story_1 = require("../heart/progress-story");
|
|
57
57
|
const habit_session_summary_1 = require("../heart/habits/habit-session-summary");
|
|
58
58
|
const cross_chat_delivery_1 = require("../heart/cross-chat-delivery");
|
|
59
|
+
const tool_error_code_1 = require("./tool-error-code");
|
|
59
60
|
const tool_arguments_1 = require("./tool-arguments");
|
|
60
61
|
const mail_import_discovery_1 = require("../heart/mail-import-discovery");
|
|
61
62
|
const outbound_1 = require("../senses/voice/outbound");
|
|
@@ -198,12 +199,17 @@ function renderCrossChatDeliveryStatus(target, result) {
|
|
|
198
199
|
: result.status === "blocked"
|
|
199
200
|
? "blocked"
|
|
200
201
|
: "failed";
|
|
201
|
-
|
|
202
|
+
const story = (0, progress_story_1.renderProgressStory)((0, progress_story_1.buildProgressStory)({
|
|
202
203
|
scope: "shared-work",
|
|
203
204
|
phase,
|
|
204
205
|
objective: `message to ${target}`,
|
|
205
206
|
outcomeText: `${lead}\n${result.detail}`,
|
|
206
207
|
}));
|
|
208
|
+
if (result.status === "blocked")
|
|
209
|
+
return (0, tool_error_code_1.withCode)(story, "delivery-blocked");
|
|
210
|
+
if (result.status === "failed")
|
|
211
|
+
return (0, tool_error_code_1.withCode)(story, "delivery-failed");
|
|
212
|
+
return story;
|
|
207
213
|
}
|
|
208
214
|
function normalizeHabitSendStatus(status) {
|
|
209
215
|
return status === "queued_for_later" ? "queued" : status;
|
|
@@ -650,6 +656,10 @@ exports.sessionToolDefinitions = [
|
|
|
650
656
|
? `${activeWork}\n\n${formatButlerOperationalVisibility(readButlerOperationalVisibility(), { section: args.section, offset: numeric(args.offset, 0, 0, 10_000), limit: numeric(args.limit, 10, 1, 20) })}`
|
|
651
657
|
: activeWork;
|
|
652
658
|
},
|
|
659
|
+
riskProfile: { mutates: "none", risk: "low" },
|
|
660
|
+
ax: { id: "tool:query_active_work", group: "turn-sessions", when: "Pick this first for any whole-self status question, to see every live session, coding lane and owed return at once.", effect: "read", idempotent: true, errors: [
|
|
661
|
+
{ code: "invalid-arguments", means: "section isn't one of the listed sections, or offset or limit isn't text.", fix: "Pass section as all, health, policy, awaits, telegram, events, actions or provider." },
|
|
662
|
+
] },
|
|
653
663
|
},
|
|
654
664
|
{
|
|
655
665
|
tool: {
|
|
@@ -702,6 +712,9 @@ exports.sessionToolDefinitions = [
|
|
|
702
712
|
reason: "reads habit run summaries from local receipts and session artifacts",
|
|
703
713
|
},
|
|
704
714
|
summaryKeys: ["runId", "habitName", "operationId", "which"],
|
|
715
|
+
ax: { id: "tool:session_summary", group: "turn-sessions", when: "Pick this to learn how a habit run went, by exact runId or by habit name and which run, without opening session files.", effect: "read", idempotent: true, errors: [
|
|
716
|
+
{ code: "invalid-arguments", means: "A selector isn't text or which isn't allowed; runId mixed with other selectors comes back as invalid_selector JSON.", fix: "Pass runId alone, or habitName or operationId with an optional which such as latest." },
|
|
717
|
+
] },
|
|
705
718
|
},
|
|
706
719
|
{
|
|
707
720
|
tool: {
|
|
@@ -738,7 +751,7 @@ exports.sessionToolDefinitions = [
|
|
|
738
751
|
level: "warn", component: "tools", event: "tool.session_path_rejected",
|
|
739
752
|
message: "session query rejected invalid coordinates", meta: { reason: "invalid friend or channel" },
|
|
740
753
|
});
|
|
741
|
-
return NO_SESSION_FOUND_MESSAGE;
|
|
754
|
+
return (0, tool_error_code_1.withCode)(NO_SESSION_FOUND_MESSAGE, "session-not-found");
|
|
742
755
|
}
|
|
743
756
|
(0, tool_arguments_1.assertRelationshipToolOwner)(ctx);
|
|
744
757
|
// Resolve friend name -> UUID if not already a UUID or "self"
|
|
@@ -751,7 +764,7 @@ exports.sessionToolDefinitions = [
|
|
|
751
764
|
}
|
|
752
765
|
if (mode === "status") {
|
|
753
766
|
if (friendId !== "self" || channel !== "inner") {
|
|
754
|
-
return "status mode is only available for self/private runtime.";
|
|
767
|
+
return (0, tool_error_code_1.withCode)("status mode is only available for self/private runtime.", "status-self-only");
|
|
755
768
|
}
|
|
756
769
|
const agentRoot = ctx?.agentRoot ?? (0, identity_1.getAgentRoot)(ctx?.agentName);
|
|
757
770
|
const sessionPath = (0, thoughts_1.getPrivateRuntimeSessionPath)(agentRoot);
|
|
@@ -778,7 +791,7 @@ exports.sessionToolDefinitions = [
|
|
|
778
791
|
level: "warn", component: "tools", event: "tool.session_path_rejected",
|
|
779
792
|
message: "session query rejected an unconfined path", meta: { reason: error.message },
|
|
780
793
|
});
|
|
781
|
-
return NO_SESSION_FOUND_MESSAGE;
|
|
794
|
+
return (0, tool_error_code_1.withCode)(NO_SESSION_FOUND_MESSAGE, "session-not-found");
|
|
782
795
|
}
|
|
783
796
|
const sessionTail = await summarizeSessionTailSafely({
|
|
784
797
|
sessionPath: sessFile,
|
|
@@ -790,13 +803,18 @@ exports.sessionToolDefinitions = [
|
|
|
790
803
|
summarize: ctx?.summarize,
|
|
791
804
|
});
|
|
792
805
|
if (sessionTail.kind === "missing") {
|
|
793
|
-
return NO_SESSION_FOUND_MESSAGE;
|
|
806
|
+
return (0, tool_error_code_1.withCode)(NO_SESSION_FOUND_MESSAGE, "session-not-found");
|
|
794
807
|
}
|
|
795
808
|
if (sessionTail.kind === "empty") {
|
|
796
809
|
return EMPTY_SESSION_MESSAGE;
|
|
797
810
|
}
|
|
798
811
|
return sessionTail.summary;
|
|
799
812
|
},
|
|
813
|
+
riskProfile: { mutates: "none", risk: "low" },
|
|
814
|
+
ax: { id: "tool:query_session", group: "turn-sessions", when: "Pick this to read the recent transcript of another chat by friend and channel, or your private runtime's progress with status mode.", effect: "read", idempotent: true, errors: [
|
|
815
|
+
{ code: "session-not-found", means: "No session exists for that friend, channel and key, or the coordinates aren't valid.", fix: "Check the friend's id with friend_list and the channel name, and leave key out unless you know it." },
|
|
816
|
+
{ code: "status-self-only", means: "mode status works only for friendId self on channel inner.", fix: "Use mode transcript for other chats, or friendId self with channel inner for status." },
|
|
817
|
+
] },
|
|
800
818
|
},
|
|
801
819
|
{
|
|
802
820
|
tool: {
|
|
@@ -1123,6 +1141,11 @@ exports.sessionToolDefinitions = [
|
|
|
1123
1141
|
return renderCrossChatDeliveryStatus(`${friendId} on ${channel}/${key}`, deliveryResult);
|
|
1124
1142
|
},
|
|
1125
1143
|
riskProfile: sendMessageRiskProfile,
|
|
1144
|
+
ax: { id: "tool:send_message", group: "turn-sessions", when: "Pick this to reach someone in a different chat or channel than this one, or a phone call by voice; to keep thinking privately, use ponder.", effect: "write", errors: [
|
|
1145
|
+
{ code: "delivery-blocked", means: "The message wasn't sent: no routable chat exists for that session, or the text carries internal markers.", fix: "Check the friend and channel with query_session, and remove internal notes from the content." },
|
|
1146
|
+
{ code: "delivery-failed", means: "The channel tried to send and failed, or the person can't be reached that way.", fix: "Try again once, or reach them on another channel they use." },
|
|
1147
|
+
{ code: "orientation-hold", means: "This turn is on a correction hold, so messages to other chats wait.", fix: "Call orientation_get, settle what the person meant, then send if it still fits." },
|
|
1148
|
+
] },
|
|
1126
1149
|
},
|
|
1127
1150
|
{
|
|
1128
1151
|
tool: {
|
|
@@ -1141,11 +1164,11 @@ exports.sessionToolDefinitions = [
|
|
|
1141
1164
|
},
|
|
1142
1165
|
handler: (args, ctx) => {
|
|
1143
1166
|
if (!ctx?.supportedReasoningEfforts || !ctx.setReasoningEffort) {
|
|
1144
|
-
return "reasoning effort adjustment is not available in this context.";
|
|
1167
|
+
return (0, tool_error_code_1.withCode)("reasoning effort adjustment is not available in this context.", "effort-unavailable");
|
|
1145
1168
|
}
|
|
1146
1169
|
const level = (args.level || "").trim();
|
|
1147
1170
|
if (!ctx.supportedReasoningEfforts.includes(level)) {
|
|
1148
|
-
return `invalid reasoning effort level "${level}". accepted levels: ${ctx.supportedReasoningEfforts.join(", ")}
|
|
1171
|
+
return (0, tool_error_code_1.withCode)(`invalid reasoning effort level "${level}". accepted levels: ${ctx.supportedReasoningEfforts.join(", ")}`, "invalid-effort-level");
|
|
1149
1172
|
}
|
|
1150
1173
|
ctx.setReasoningEffort(level);
|
|
1151
1174
|
(0, runtime_1.emitNervesEvent)({
|
|
@@ -1158,5 +1181,9 @@ exports.sessionToolDefinitions = [
|
|
|
1158
1181
|
},
|
|
1159
1182
|
requiredCapability: "reasoning-effort",
|
|
1160
1183
|
summaryKeys: ["level"],
|
|
1184
|
+
ax: { id: "tool:set_reasoning_effort", group: "turn-sessions", when: "Pick this to think harder on a knotty problem or lighter on routine work in the turns that follow.", effect: "write", idempotent: true, errors: [
|
|
1185
|
+
{ code: "effort-unavailable", means: "This model or context has no adjustable reasoning effort.", fix: "Carry on at the current effort." },
|
|
1186
|
+
{ code: "invalid-effort-level", means: "That level isn't one this model accepts; the message lists the accepted ones.", fix: "Call again with one of the listed levels." },
|
|
1187
|
+
] },
|
|
1161
1188
|
},
|
|
1162
1189
|
];
|
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.1327",
|
|
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.1327",
|
|
10
10
|
"bundleDependencies": [
|
|
11
11
|
"@ouro.bot/friends"
|
|
12
12
|
],
|