@ouro.bot/cli 0.1.0-alpha.25 → 0.1.0-alpha.27
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 +13 -0
- package/dist/heart/daemon/agent-discovery.js +81 -0
- package/dist/heart/daemon/daemon-cli.js +6 -30
- package/dist/heart/daemon/daemon-entry.js +2 -1
- package/dist/heart/daemon/daemon.js +40 -1
- package/dist/heart/identity.js +8 -0
- package/dist/mind/phrases.js +1 -0
- package/dist/senses/bluebubbles.js +1 -1
- package/dist/senses/debug-activity.js +14 -13
- package/package.json +1 -1
package/changelog.json
CHANGED
|
@@ -1,6 +1,19 @@
|
|
|
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.27",
|
|
6
|
+
"changes": [
|
|
7
|
+
"The daemon now discovers all enabled agents in ~/AgentBundles, so ouro status and managed workers reflect every real agent instead of only slugger and ouroboros.",
|
|
8
|
+
"BlueBubbles typing now wraps the visible working phase correctly, and phrase updates from agent.json take effect on the next turn without requiring a restart."
|
|
9
|
+
]
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"version": "0.1.0-alpha.26",
|
|
13
|
+
"changes": [
|
|
14
|
+
"The daemon now auto-checks npm for new runtime versions every 30 minutes and performs a staged restart when an update is available. You no longer need to manually run npm install."
|
|
15
|
+
]
|
|
16
|
+
},
|
|
4
17
|
{
|
|
5
18
|
"version": "0.1.0-alpha.25",
|
|
6
19
|
"changes": [
|
|
@@ -0,0 +1,81 @@
|
|
|
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.listEnabledBundleAgents = listEnabledBundleAgents;
|
|
37
|
+
const fs = __importStar(require("fs"));
|
|
38
|
+
const path = __importStar(require("path"));
|
|
39
|
+
const identity_1 = require("../identity");
|
|
40
|
+
const runtime_1 = require("../../nerves/runtime");
|
|
41
|
+
function listEnabledBundleAgents(options = {}) {
|
|
42
|
+
const bundlesRoot = options.bundlesRoot ?? (0, identity_1.getAgentBundlesRoot)();
|
|
43
|
+
const readdirSync = options.readdirSync ?? fs.readdirSync;
|
|
44
|
+
const readFileSync = options.readFileSync ?? fs.readFileSync;
|
|
45
|
+
let entries;
|
|
46
|
+
try {
|
|
47
|
+
entries = readdirSync(bundlesRoot, { withFileTypes: true });
|
|
48
|
+
}
|
|
49
|
+
catch {
|
|
50
|
+
(0, runtime_1.emitNervesEvent)({
|
|
51
|
+
level: "warn",
|
|
52
|
+
component: "daemon",
|
|
53
|
+
event: "daemon.agent_discovery_failed",
|
|
54
|
+
message: "failed to read bundle root for daemon agent discovery",
|
|
55
|
+
meta: { bundlesRoot },
|
|
56
|
+
});
|
|
57
|
+
return [];
|
|
58
|
+
}
|
|
59
|
+
const discovered = [];
|
|
60
|
+
for (const entry of entries) {
|
|
61
|
+
if (!entry.isDirectory() || !entry.name.endsWith(".ouro"))
|
|
62
|
+
continue;
|
|
63
|
+
const agentName = entry.name.slice(0, -5);
|
|
64
|
+
const configPath = path.join(bundlesRoot, entry.name, "agent.json");
|
|
65
|
+
let enabled = true;
|
|
66
|
+
try {
|
|
67
|
+
const raw = readFileSync(configPath, "utf-8");
|
|
68
|
+
const parsed = JSON.parse(raw);
|
|
69
|
+
if (typeof parsed.enabled === "boolean") {
|
|
70
|
+
enabled = parsed.enabled;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
catch {
|
|
74
|
+
continue;
|
|
75
|
+
}
|
|
76
|
+
if (enabled) {
|
|
77
|
+
discovered.push(agentName);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
return discovered.sort((left, right) => left.localeCompare(right));
|
|
81
|
+
}
|
|
@@ -56,6 +56,7 @@ const specialist_prompt_1 = require("./specialist-prompt");
|
|
|
56
56
|
const specialist_tools_1 = require("./specialist-tools");
|
|
57
57
|
const runtime_metadata_1 = require("./runtime-metadata");
|
|
58
58
|
const daemon_runtime_sync_1 = require("./daemon-runtime-sync");
|
|
59
|
+
const agent_discovery_1 = require("./agent-discovery");
|
|
59
60
|
const update_hooks_1 = require("./update-hooks");
|
|
60
61
|
const bundle_meta_1 = require("./hooks/bundle-meta");
|
|
61
62
|
const bundle_manifest_1 = require("../../mind/bundle-manifest");
|
|
@@ -596,36 +597,11 @@ async function defaultPromptInput(question) {
|
|
|
596
597
|
}
|
|
597
598
|
}
|
|
598
599
|
function defaultListDiscoveredAgents() {
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
}
|
|
604
|
-
catch {
|
|
605
|
-
return [];
|
|
606
|
-
}
|
|
607
|
-
const discovered = [];
|
|
608
|
-
for (const entry of entries) {
|
|
609
|
-
if (!entry.isDirectory() || !entry.name.endsWith(".ouro"))
|
|
610
|
-
continue;
|
|
611
|
-
const agentName = entry.name.slice(0, -5);
|
|
612
|
-
const configPath = path.join(bundlesRoot, entry.name, "agent.json");
|
|
613
|
-
let enabled = true;
|
|
614
|
-
try {
|
|
615
|
-
const raw = fs.readFileSync(configPath, "utf-8");
|
|
616
|
-
const parsed = JSON.parse(raw);
|
|
617
|
-
if (typeof parsed.enabled === "boolean") {
|
|
618
|
-
enabled = parsed.enabled;
|
|
619
|
-
}
|
|
620
|
-
}
|
|
621
|
-
catch {
|
|
622
|
-
continue;
|
|
623
|
-
}
|
|
624
|
-
if (enabled) {
|
|
625
|
-
discovered.push(agentName);
|
|
626
|
-
}
|
|
627
|
-
}
|
|
628
|
-
return discovered.sort((left, right) => left.localeCompare(right));
|
|
600
|
+
return (0, agent_discovery_1.listEnabledBundleAgents)({
|
|
601
|
+
bundlesRoot: (0, identity_1.getAgentBundlesRoot)(),
|
|
602
|
+
readdirSync: fs.readdirSync,
|
|
603
|
+
readFileSync: fs.readFileSync,
|
|
604
|
+
});
|
|
629
605
|
}
|
|
630
606
|
async function defaultLinkFriendIdentity(command) {
|
|
631
607
|
const fp = path.join((0, identity_1.getAgentBundlesRoot)(), `${command.agent}.ouro`, "friends");
|
|
@@ -9,6 +9,7 @@ const health_monitor_1 = require("./health-monitor");
|
|
|
9
9
|
const task_scheduler_1 = require("./task-scheduler");
|
|
10
10
|
const runtime_logging_1 = require("./runtime-logging");
|
|
11
11
|
const sense_manager_1 = require("./sense-manager");
|
|
12
|
+
const agent_discovery_1 = require("./agent-discovery");
|
|
12
13
|
function parseSocketPath(argv) {
|
|
13
14
|
const socketIndex = argv.indexOf("--socket");
|
|
14
15
|
if (socketIndex >= 0) {
|
|
@@ -26,7 +27,7 @@ const socketPath = parseSocketPath(process.argv);
|
|
|
26
27
|
message: "starting daemon entrypoint",
|
|
27
28
|
meta: { socketPath },
|
|
28
29
|
});
|
|
29
|
-
const managedAgents =
|
|
30
|
+
const managedAgents = (0, agent_discovery_1.listEnabledBundleAgents)();
|
|
30
31
|
const processManager = new process_manager_1.DaemonProcessManager({
|
|
31
32
|
agents: managedAgents.map((agent) => ({
|
|
32
33
|
name: agent,
|
|
@@ -43,6 +43,9 @@ const runtime_metadata_1 = require("./runtime-metadata");
|
|
|
43
43
|
const update_hooks_1 = require("./update-hooks");
|
|
44
44
|
const bundle_meta_1 = require("./hooks/bundle-meta");
|
|
45
45
|
const bundle_manifest_1 = require("../../mind/bundle-manifest");
|
|
46
|
+
const update_checker_1 = require("./update-checker");
|
|
47
|
+
const staged_restart_1 = require("./staged-restart");
|
|
48
|
+
const child_process_1 = require("child_process");
|
|
46
49
|
function buildWorkerRows(snapshots) {
|
|
47
50
|
return snapshots.map((snapshot) => ({
|
|
48
51
|
agent: snapshot.name,
|
|
@@ -112,7 +115,42 @@ class OuroDaemon {
|
|
|
112
115
|
});
|
|
113
116
|
// Register update hooks and apply pending updates before starting agents
|
|
114
117
|
(0, update_hooks_1.registerUpdateHook)(bundle_meta_1.bundleMetaHook);
|
|
115
|
-
|
|
118
|
+
const currentVersion = (0, bundle_manifest_1.getPackageVersion)();
|
|
119
|
+
await (0, update_hooks_1.applyPendingUpdates)(this.bundlesRoot, currentVersion);
|
|
120
|
+
// Start periodic update checker (polls npm registry every 30 minutes)
|
|
121
|
+
const bundlesRoot = this.bundlesRoot;
|
|
122
|
+
const daemon = this;
|
|
123
|
+
(0, update_checker_1.startUpdateChecker)({
|
|
124
|
+
currentVersion,
|
|
125
|
+
deps: {
|
|
126
|
+
distTag: "alpha",
|
|
127
|
+
fetchRegistryJson: /* v8 ignore next -- integration: real HTTP fetch @preserve */ async () => {
|
|
128
|
+
const res = await fetch("https://registry.npmjs.org/@ouro.bot/cli");
|
|
129
|
+
return res.json();
|
|
130
|
+
},
|
|
131
|
+
},
|
|
132
|
+
onUpdate: /* v8 ignore start -- integration: real npm install + process spawn @preserve */ async (result) => {
|
|
133
|
+
if (!result.latestVersion)
|
|
134
|
+
return;
|
|
135
|
+
await (0, staged_restart_1.performStagedRestart)(result.latestVersion, {
|
|
136
|
+
execSync: (cmd) => (0, child_process_1.execSync)(cmd, { stdio: "inherit" }),
|
|
137
|
+
spawnSync: child_process_1.spawnSync,
|
|
138
|
+
resolveNewCodePath: (_version) => {
|
|
139
|
+
try {
|
|
140
|
+
const resolved = (0, child_process_1.execSync)(`node -e "console.log(require.resolve('@ouro.bot/cli/package.json'))"`, { encoding: "utf-8" }).trim();
|
|
141
|
+
return resolved ? path.dirname(resolved) : null;
|
|
142
|
+
}
|
|
143
|
+
catch {
|
|
144
|
+
return null;
|
|
145
|
+
}
|
|
146
|
+
},
|
|
147
|
+
gracefulShutdown: () => daemon.stop(),
|
|
148
|
+
nodePath: process.execPath,
|
|
149
|
+
bundlesRoot,
|
|
150
|
+
});
|
|
151
|
+
},
|
|
152
|
+
/* v8 ignore stop */
|
|
153
|
+
});
|
|
116
154
|
await this.processManager.startAutoStartAgents();
|
|
117
155
|
await this.senseManager?.startAutoStartSenses();
|
|
118
156
|
this.scheduler.start?.();
|
|
@@ -200,6 +238,7 @@ class OuroDaemon {
|
|
|
200
238
|
message: "stopping daemon server",
|
|
201
239
|
meta: { socketPath: this.socketPath },
|
|
202
240
|
});
|
|
241
|
+
(0, update_checker_1.stopUpdateChecker)();
|
|
203
242
|
this.scheduler.stop?.();
|
|
204
243
|
await this.processManager.stopAll();
|
|
205
244
|
await this.senseManager?.stopAll();
|
package/dist/heart/identity.js
CHANGED
|
@@ -43,6 +43,7 @@ exports.getAgentSecretsPath = getAgentSecretsPath;
|
|
|
43
43
|
exports.loadAgentConfig = loadAgentConfig;
|
|
44
44
|
exports.setAgentName = setAgentName;
|
|
45
45
|
exports.setAgentConfigOverride = setAgentConfigOverride;
|
|
46
|
+
exports.resetAgentConfigCache = resetAgentConfigCache;
|
|
46
47
|
exports.resetIdentity = resetIdentity;
|
|
47
48
|
const fs = __importStar(require("fs"));
|
|
48
49
|
const os = __importStar(require("os"));
|
|
@@ -346,6 +347,13 @@ function setAgentName(name) {
|
|
|
346
347
|
function setAgentConfigOverride(config) {
|
|
347
348
|
_agentConfigOverride = config;
|
|
348
349
|
}
|
|
350
|
+
/**
|
|
351
|
+
* Clear only the cached agent config while preserving the resolved agent identity.
|
|
352
|
+
* Used when a running agent should pick up updated disk-backed config on the next turn.
|
|
353
|
+
*/
|
|
354
|
+
function resetAgentConfigCache() {
|
|
355
|
+
_cachedAgentConfig = null;
|
|
356
|
+
}
|
|
349
357
|
/**
|
|
350
358
|
* Clear all cached identity state.
|
|
351
359
|
* Used in tests and when switching agent context.
|
package/dist/mind/phrases.js
CHANGED
|
@@ -205,12 +205,12 @@ function createBlueBubblesCallbacks(client, chat, replyToMessageGuid) {
|
|
|
205
205
|
return;
|
|
206
206
|
}
|
|
207
207
|
textBuffer = "";
|
|
208
|
+
await activity.finish();
|
|
208
209
|
await client.sendText({
|
|
209
210
|
chat,
|
|
210
211
|
text: trimmed,
|
|
211
212
|
replyToMessageGuid,
|
|
212
213
|
});
|
|
213
|
-
await activity.finish();
|
|
214
214
|
},
|
|
215
215
|
async finish() {
|
|
216
216
|
await activity.finish();
|
|
@@ -36,15 +36,6 @@ function createDebugActivityController(options) {
|
|
|
36
36
|
lastPhrase = phrase;
|
|
37
37
|
return phrase;
|
|
38
38
|
}
|
|
39
|
-
function ensureTyping(active) {
|
|
40
|
-
if (typingActive === active) {
|
|
41
|
-
return;
|
|
42
|
-
}
|
|
43
|
-
typingActive = active;
|
|
44
|
-
enqueue(active ? "typing_start" : "typing_stop", async () => {
|
|
45
|
-
await options.transport.setTyping(active);
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
39
|
function setStatus(text) {
|
|
49
40
|
(0, runtime_1.emitNervesEvent)({
|
|
50
41
|
component: "senses",
|
|
@@ -55,13 +46,20 @@ function createDebugActivityController(options) {
|
|
|
55
46
|
textLength: text.length,
|
|
56
47
|
},
|
|
57
48
|
});
|
|
58
|
-
|
|
49
|
+
const shouldStartTyping = !typingActive;
|
|
50
|
+
if (shouldStartTyping) {
|
|
51
|
+
typingActive = true;
|
|
52
|
+
}
|
|
59
53
|
enqueue("status_update", async () => {
|
|
60
54
|
if (statusMessageGuid) {
|
|
61
55
|
await options.transport.editStatus(statusMessageGuid, text);
|
|
62
|
-
return;
|
|
63
56
|
}
|
|
64
|
-
|
|
57
|
+
else {
|
|
58
|
+
statusMessageGuid = await options.transport.sendStatus(text);
|
|
59
|
+
}
|
|
60
|
+
if (shouldStartTyping) {
|
|
61
|
+
await options.transport.setTyping(true);
|
|
62
|
+
}
|
|
65
63
|
});
|
|
66
64
|
}
|
|
67
65
|
return {
|
|
@@ -100,7 +98,10 @@ function createDebugActivityController(options) {
|
|
|
100
98
|
await queue;
|
|
101
99
|
return;
|
|
102
100
|
}
|
|
103
|
-
|
|
101
|
+
typingActive = false;
|
|
102
|
+
enqueue("typing_stop", async () => {
|
|
103
|
+
await options.transport.setTyping(false);
|
|
104
|
+
});
|
|
104
105
|
await queue;
|
|
105
106
|
},
|
|
106
107
|
};
|