@ouro.bot/cli 0.1.0-alpha.597 → 0.1.0-alpha.598
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.598",
|
|
6
|
+
"changes": [
|
|
7
|
+
"New `restart_runtime({ reason })` tool. Agent self-maintenance: asking Ari to restart the daemon over BlueBubbles is now a thing of the past. Sends `daemon.restart` over the existing socket — daemon logs the reason as `daemon.restart_requested`, runs its normal stop pathway, and exits. launchctl's KeepAlive policy auto-respawns the daemon, so the agent comes back fresh on the other side. The agent will not see this tool's return value — its process exits with the daemon and a clean boot replaces it. In dev mode (no launchctl) the daemon just exits; same observable behavior as `daemon.stop`, with the restart-requested audit event distinguishing intent."
|
|
8
|
+
]
|
|
9
|
+
},
|
|
4
10
|
{
|
|
5
11
|
"version": "0.1.0-alpha.597",
|
|
6
12
|
"changes": [
|
|
@@ -1073,6 +1073,27 @@ class OuroDaemon {
|
|
|
1073
1073
|
await this.stop();
|
|
1074
1074
|
this.onStopCommandComplete?.();
|
|
1075
1075
|
return { ok: true, message: "daemon stopped" };
|
|
1076
|
+
case "daemon.restart": {
|
|
1077
|
+
// Restart is "stop + let launchctl respawn." Under launchctl's KeepAlive
|
|
1078
|
+
// policy the process is auto-restarted on exit, so daemon.restart and
|
|
1079
|
+
// daemon.stop differ only in intent + audit trail. In dev (no launchctl),
|
|
1080
|
+
// the process simply exits — same observable behavior as daemon.stop.
|
|
1081
|
+
(0, runtime_1.emitNervesEvent)({
|
|
1082
|
+
component: "daemon",
|
|
1083
|
+
event: "daemon.restart_requested",
|
|
1084
|
+
message: "daemon restart requested",
|
|
1085
|
+
meta: {
|
|
1086
|
+
reason: command.reason ?? null,
|
|
1087
|
+
requestedBy: command.requestedBy ?? null,
|
|
1088
|
+
},
|
|
1089
|
+
});
|
|
1090
|
+
await this.stop();
|
|
1091
|
+
this.onStopCommandComplete?.();
|
|
1092
|
+
return {
|
|
1093
|
+
ok: true,
|
|
1094
|
+
message: "daemon restarting — launchctl will respawn",
|
|
1095
|
+
};
|
|
1096
|
+
}
|
|
1076
1097
|
case "daemon.status": {
|
|
1077
1098
|
const data = this.buildStatusPayload();
|
|
1078
1099
|
return {
|
|
@@ -20,6 +20,7 @@ const tools_mail_1 = require("./tools-mail");
|
|
|
20
20
|
const tools_trip_1 = require("./tools-trip");
|
|
21
21
|
const tools_awaiting_1 = require("./tools-awaiting");
|
|
22
22
|
const tools_obligations_1 = require("./tools-obligations");
|
|
23
|
+
const tools_runtime_1 = require("./tools-runtime");
|
|
23
24
|
// Re-export flow tools for consumers that import them from tools-base
|
|
24
25
|
var tools_flow_1 = require("./tools-flow");
|
|
25
26
|
Object.defineProperty(exports, "ponderTool", { enumerable: true, get: function () { return tools_flow_1.ponderTool; } });
|
|
@@ -55,6 +56,7 @@ exports.baseToolDefinitions = [
|
|
|
55
56
|
...tools_trip_1.tripToolDefinitions,
|
|
56
57
|
...tools_awaiting_1.awaitingToolDefinitions,
|
|
57
58
|
...tools_obligations_1.obligationToolDefinitions,
|
|
59
|
+
...tools_runtime_1.runtimeToolDefinitions,
|
|
58
60
|
];
|
|
59
61
|
// Convenience array of just the tool schemas (no handler/integration metadata).
|
|
60
62
|
// Used by consumers that need the OpenAI function-tool format.
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.runtimeToolDefinitions = void 0;
|
|
4
|
+
const identity_1 = require("../heart/identity");
|
|
5
|
+
const runtime_1 = require("../nerves/runtime");
|
|
6
|
+
const socket_client_1 = require("../heart/daemon/socket-client");
|
|
7
|
+
async function restartRuntime(args, agentName) {
|
|
8
|
+
if (typeof args.reason !== "string" || args.reason.trim().length === 0) {
|
|
9
|
+
return JSON.stringify({ error: "reason is required (one-line audit string)" });
|
|
10
|
+
}
|
|
11
|
+
const reason = args.reason.trim();
|
|
12
|
+
(0, runtime_1.emitNervesEvent)({
|
|
13
|
+
component: "repertoire",
|
|
14
|
+
event: "repertoire.runtime_restart_requested",
|
|
15
|
+
message: "agent requested runtime restart",
|
|
16
|
+
meta: { agent: agentName, reason },
|
|
17
|
+
});
|
|
18
|
+
try {
|
|
19
|
+
const response = await (0, socket_client_1.sendDaemonCommand)(socket_client_1.DEFAULT_DAEMON_SOCKET_PATH, {
|
|
20
|
+
kind: "daemon.restart",
|
|
21
|
+
reason,
|
|
22
|
+
requestedBy: agentName,
|
|
23
|
+
});
|
|
24
|
+
return JSON.stringify({
|
|
25
|
+
requested: true,
|
|
26
|
+
reason,
|
|
27
|
+
detail: response.message ?? "daemon restart requested",
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
catch (error) {
|
|
31
|
+
return JSON.stringify({
|
|
32
|
+
error: "failed to reach daemon socket",
|
|
33
|
+
detail: error instanceof Error ? error.message : String(error),
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
exports.runtimeToolDefinitions = [
|
|
38
|
+
{
|
|
39
|
+
tool: {
|
|
40
|
+
type: "function",
|
|
41
|
+
function: {
|
|
42
|
+
name: "restart_runtime",
|
|
43
|
+
description: "ask my runtime (the daemon hosting me) to restart itself. for when something is wedged — stale state, recovery queue jammed, version mismatch, or i just need a fresh boot. under launchctl the daemon auto-respawns, so i come back on the other side with a clean slate. takes a one-line reason that lands in the audit log. i will NOT see this tool's response — my process exits with the daemon and i wake up fresh.",
|
|
44
|
+
parameters: {
|
|
45
|
+
type: "object",
|
|
46
|
+
properties: {
|
|
47
|
+
reason: {
|
|
48
|
+
type: "string",
|
|
49
|
+
description: "one-line audit reason (e.g. 'bluebubbles recovery queue wedged for 4h', 'picking up daemon version update').",
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
required: ["reason"],
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
handler: async (args) => {
|
|
57
|
+
const agentName = (0, identity_1.getAgentName)();
|
|
58
|
+
return restartRuntime({ reason: args.reason }, agentName);
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
];
|