@ouro.bot/cli 0.1.0-alpha.647 → 0.1.0-alpha.649

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.649",
6
+ "changes": [
7
+ "No-agent CLI process logging is now machine-scoped under `~/.ouro-cli/daemon` instead of fabricating `~/AgentBundles/default.ouro`; update hooks and version detection ignore any stale no-agent `default.ouro` directory that lacks `agent.json`."
8
+ ]
9
+ },
10
+ {
11
+ "version": "0.1.0-alpha.648",
12
+ "changes": [
13
+ "Daemon restart state truth: stale exits from a child intentionally replaced during restart are ignored, preventing provider refresh from reporting success while a later SIGTERM from the old worker clears the replacement pid and leaves status stuck at `starting`."
14
+ ]
15
+ },
4
16
  {
5
17
  "version": "0.1.0-alpha.647",
6
18
  "changes": [
@@ -123,6 +123,9 @@ function readFirstBundleMetaVersion(bundlesRoot) {
123
123
  /* v8 ignore next -- skip non-.ouro dirs: tested via version-detect tests @preserve */
124
124
  if (!entry.isDirectory() || !entry.name.endsWith(".ouro"))
125
125
  continue;
126
+ const agentJsonPath = path.join(bundlesRoot, entry.name, "agent.json");
127
+ if (entry.name === "default.ouro" && !fs.existsSync(agentJsonPath))
128
+ continue;
126
129
  const metaPath = path.join(bundlesRoot, entry.name, "bundle-meta.json");
127
130
  if (!fs.existsSync(metaPath))
128
131
  continue;
@@ -396,7 +396,7 @@ class DaemonProcessManager {
396
396
  });
397
397
  /* v8 ignore stop */
398
398
  child.once("exit", (code, signal) => {
399
- this.onExit(state, code, signal);
399
+ this.onExit(state, child, code, signal);
400
400
  });
401
401
  }
402
402
  finally {
@@ -579,8 +579,8 @@ class DaemonProcessManager {
579
579
  listAgentSnapshots() {
580
580
  return [...this.agents.values()].map((state) => state.snapshot);
581
581
  }
582
- onExit(state, code, signal) {
583
- if (!state.process)
582
+ onExit(state, child, code, signal) {
583
+ if (state.process !== child)
584
584
  return;
585
585
  state.process = null;
586
586
  state.startInFlight = false;
@@ -39,6 +39,7 @@ const path = __importStar(require("path"));
39
39
  const nerves_1 = require("../../nerves");
40
40
  const runtime_1 = require("../../nerves/runtime");
41
41
  const identity_1 = require("../identity");
42
+ const ouro_version_manager_1 = require("../versioning/ouro-version-manager");
42
43
  const LEGACY_SHARED_RUNTIME_LOGGING = {
43
44
  level: "info",
44
45
  sinks: ["terminal", "ndjson"],
@@ -99,26 +100,37 @@ function resolveRuntimeLoggingConfig(configPath, processName) {
99
100
  sinks,
100
101
  };
101
102
  }
102
- function resolveAgentNameForPaths(explicit) {
103
- if (explicit && explicit.trim().length > 0)
104
- return explicit.trim();
103
+ function machineDaemonLoggingConfigPath(homeDir) {
104
+ return path.join((0, ouro_version_manager_1.getOuroCliHome)(homeDir), "daemon", "logging.json");
105
+ }
106
+ function machineDaemonLogsDir(homeDir) {
107
+ return path.join((0, ouro_version_manager_1.getOuroCliHome)(homeDir), "daemon", "logs");
108
+ }
109
+ function resolveLoggingPathTarget(explicit) {
110
+ if (explicit && explicit.trim().length > 0) {
111
+ return { kind: "agent", agentName: explicit.trim() };
112
+ }
105
113
  try {
106
- return (0, identity_1.getAgentName)();
114
+ return { kind: "agent", agentName: (0, identity_1.getAgentName)() };
107
115
  }
108
116
  catch {
109
- return "default";
117
+ return { kind: "machine" };
110
118
  }
111
119
  }
112
120
  function configureDaemonRuntimeLogger(processName, options = {}) {
113
- const agentName = resolveAgentNameForPaths(options.agentName);
121
+ const pathTarget = resolveLoggingPathTarget(options.agentName);
114
122
  const configPath = options.configPath
115
- ?? (options.homeDir
116
- ? path.join(options.homeDir, "AgentBundles", `${agentName}.ouro`, "state", "daemon", "logging.json")
117
- : (0, identity_1.getAgentDaemonLoggingConfigPath)(agentName));
123
+ ?? (pathTarget.kind === "machine"
124
+ ? machineDaemonLoggingConfigPath(options.homeDir)
125
+ : options.homeDir
126
+ ? path.join(options.homeDir, "AgentBundles", `${pathTarget.agentName}.ouro`, "state", "daemon", "logging.json")
127
+ : (0, identity_1.getAgentDaemonLoggingConfigPath)(pathTarget.agentName));
118
128
  const config = resolveRuntimeLoggingConfig(configPath, processName);
119
- const logsDir = options.homeDir
120
- ? path.join(options.homeDir, "AgentBundles", `${agentName}.ouro`, "state", "daemon", "logs")
121
- : (0, identity_1.getAgentDaemonLogsDir)(agentName);
129
+ const logsDir = pathTarget.kind === "machine"
130
+ ? machineDaemonLogsDir(options.homeDir)
131
+ : options.homeDir
132
+ ? path.join(options.homeDir, "AgentBundles", `${pathTarget.agentName}.ouro`, "state", "daemon", "logs")
133
+ : (0, identity_1.getAgentDaemonLogsDir)(pathTarget.agentName);
122
134
  // Rotation policy per daemon ndjson stream (Unit 1c):
123
135
  // 25 MB threshold x 5 gzipped generations = ~30 MB peak per stream.
124
136
  // Call sites previously relied on the implicit 50 MB default; we now pass
@@ -148,6 +160,7 @@ function configureDaemonRuntimeLogger(processName, options = {}) {
148
160
  level: config.level,
149
161
  sinks: config.sinks,
150
162
  configPath,
163
+ pathTarget,
151
164
  },
152
165
  });
153
166
  }
@@ -57,6 +57,9 @@ function getRegisteredHooks() {
57
57
  function clearRegisteredHooks() {
58
58
  _hooks.length = 0;
59
59
  }
60
+ function isNoAgentDefaultBundle(agentRoot, entryName) {
61
+ return entryName === "default.ouro" && !fs.existsSync(path.join(agentRoot, "agent.json"));
62
+ }
60
63
  async function applyPendingUpdates(bundlesRoot, currentVersion) {
61
64
  const summary = { updated: [] };
62
65
  (0, runtime_1.emitNervesEvent)({
@@ -80,6 +83,15 @@ async function applyPendingUpdates(bundlesRoot, currentVersion) {
80
83
  if (!entry.isDirectory() || !entry.name.endsWith(".ouro"))
81
84
  continue;
82
85
  const agentRoot = path.join(bundlesRoot, entry.name);
86
+ if (isNoAgentDefaultBundle(agentRoot, entry.name)) {
87
+ (0, runtime_1.emitNervesEvent)({
88
+ component: "daemon",
89
+ event: "daemon.update_hook_skip_no_agent_default",
90
+ message: "skipping no-agent default bundle during pending updates",
91
+ meta: { agentRoot },
92
+ });
93
+ continue;
94
+ }
83
95
  let previousVersion;
84
96
  const metaPath = path.join(agentRoot, "bundle-meta.json");
85
97
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ouro.bot/cli",
3
- "version": "0.1.0-alpha.647",
3
+ "version": "0.1.0-alpha.649",
4
4
  "main": "dist/heart/daemon/ouro-entry.js",
5
5
  "bin": {
6
6
  "cli": "dist/heart/daemon/ouro-bot-entry.js",