@ouro.bot/cli 0.1.0-alpha.24 → 0.1.0-alpha.26

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,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.26",
6
+ "changes": [
7
+ "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."
8
+ ]
9
+ },
10
+ {
11
+ "version": "0.1.0-alpha.25",
12
+ "changes": [
13
+ "Runtime updates no longer downgrade your bundle-meta.json if you happen to be running a newer version than the installed CLI. Only forward updates are applied.",
14
+ "The 'ouro up' update summary is now a single consolidated line (e.g. 'updated 4 agents to runtime X (was Y)') instead of one line per agent."
15
+ ]
16
+ },
4
17
  {
5
18
  "version": "0.1.0-alpha.24",
6
19
  "changes": [
@@ -1092,10 +1092,12 @@ async function runOuroCli(args, deps = createDefaultOuroCliDeps()) {
1092
1092
  const currentVersion = (0, bundle_manifest_1.getPackageVersion)();
1093
1093
  const updateSummary = await (0, update_hooks_1.applyPendingUpdates)(bundlesRoot, currentVersion);
1094
1094
  if (updateSummary.updated.length > 0) {
1095
- for (const entry of updateSummary.updated) {
1096
- const from = entry.from ? ` (was ${entry.from})` : "";
1097
- deps.writeStdout(`updated ${entry.agent} to runtime ${entry.to}${from}`);
1098
- }
1095
+ const agents = updateSummary.updated.map((e) => e.agent);
1096
+ const from = updateSummary.updated[0].from;
1097
+ const to = updateSummary.updated[0].to;
1098
+ const fromStr = from ? ` (was ${from})` : "";
1099
+ const count = agents.length;
1100
+ deps.writeStdout(`updated ${count} agent${count === 1 ? "" : "s"} to runtime ${to}${fromStr}`);
1099
1101
  }
1100
1102
  const daemonResult = await ensureDaemonRunning(deps);
1101
1103
  deps.writeStdout(daemonResult.message);
@@ -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
- await (0, update_hooks_1.applyPendingUpdates)(this.bundlesRoot, (0, bundle_manifest_1.getPackageVersion)());
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();
@@ -39,6 +39,7 @@ exports.clearRegisteredHooks = clearRegisteredHooks;
39
39
  exports.applyPendingUpdates = applyPendingUpdates;
40
40
  const fs = __importStar(require("fs"));
41
41
  const path = __importStar(require("path"));
42
+ const semver = __importStar(require("semver"));
42
43
  const runtime_1 = require("../../nerves/runtime");
43
44
  const _hooks = [];
44
45
  function registerUpdateHook(hook) {
@@ -88,6 +89,16 @@ async function applyPendingUpdates(bundlesRoot, currentVersion) {
88
89
  if (previousVersion === currentVersion) {
89
90
  continue;
90
91
  }
92
+ // Skip downgrades — only update forward
93
+ if (semver.valid(previousVersion) && semver.valid(currentVersion) && semver.gte(previousVersion, currentVersion)) {
94
+ (0, runtime_1.emitNervesEvent)({
95
+ component: "daemon",
96
+ event: "daemon.update_hook_skip_downgrade",
97
+ message: "skipping downgrade",
98
+ meta: { agentRoot, previousVersion, currentVersion },
99
+ });
100
+ continue;
101
+ }
91
102
  }
92
103
  }
93
104
  catch {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ouro.bot/cli",
3
- "version": "0.1.0-alpha.24",
3
+ "version": "0.1.0-alpha.26",
4
4
  "main": "dist/heart/daemon/ouro-entry.js",
5
5
  "bin": {
6
6
  "cli": "dist/heart/daemon/ouro-bot-entry.js",