@ouro.bot/cli 0.1.0-alpha.117 → 0.1.0-alpha.119

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.119",
6
+ "changes": [
7
+ "Anthropic ping now uses haiku (widest token access) with minimal beta headers, fixing 400 errors from thinking beta requirements and model access restrictions on setup tokens."
8
+ ]
9
+ },
10
+ {
11
+ "version": "0.1.0-alpha.118",
12
+ "changes": [
13
+ "Daemon now kills orphaned agent processes from previous instances on startup, preventing stale-version agents from handling requests after an update."
14
+ ]
15
+ },
4
16
  {
5
17
  "version": "0.1.0-alpha.117",
6
18
  "changes": [
@@ -34,6 +34,7 @@ var __importStar = (this && this.__importStar) || (function () {
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.OuroDaemon = void 0;
37
+ exports.killOrphanAgentProcesses = killOrphanAgentProcesses;
37
38
  const fs = __importStar(require("fs"));
38
39
  const net = __importStar(require("net"));
39
40
  const path = __importStar(require("path"));
@@ -50,6 +51,51 @@ const child_process_1 = require("child_process");
50
51
  const pending_1 = require("../../mind/pending");
51
52
  const channel_1 = require("../../mind/friends/channel");
52
53
  const mcp_manager_1 = require("../../repertoire/mcp-manager");
54
+ /**
55
+ * Kill orphaned agent-entry.js processes from previous daemon instances.
56
+ * The process manager only tracks agents it spawns in-memory — agents from
57
+ * a previous daemon are invisible and keep handling requests on old code.
58
+ */
59
+ /* v8 ignore start -- orphan cleanup: uses ps/kill which can't be unit-tested @preserve */
60
+ function killOrphanAgentProcesses() {
61
+ try {
62
+ const myPid = process.pid;
63
+ const result = (0, child_process_1.execSync)("ps -eo pid,command", { encoding: "utf-8", timeout: 5000 });
64
+ const pidsToKill = [];
65
+ for (const line of result.split("\n")) {
66
+ if (!line.includes("agent-entry.js"))
67
+ continue;
68
+ const trimmed = line.trim();
69
+ const pid = parseInt(trimmed, 10);
70
+ if (isNaN(pid) || pid === myPid)
71
+ continue;
72
+ pidsToKill.push(pid);
73
+ }
74
+ if (pidsToKill.length > 0) {
75
+ for (const pid of pidsToKill) {
76
+ try {
77
+ process.kill(pid, "SIGTERM");
78
+ }
79
+ catch { /* already exited */ }
80
+ }
81
+ (0, runtime_1.emitNervesEvent)({
82
+ component: "daemon",
83
+ event: "daemon.orphan_cleanup",
84
+ message: `killed ${pidsToKill.length} orphaned agent processes`,
85
+ meta: { pids: pidsToKill },
86
+ });
87
+ }
88
+ }
89
+ catch (error) {
90
+ (0, runtime_1.emitNervesEvent)({
91
+ level: "warn",
92
+ component: "daemon",
93
+ event: "daemon.orphan_cleanup_error",
94
+ message: "failed to clean up orphaned agent processes",
95
+ meta: { error: error instanceof Error ? error.message : String(error) },
96
+ });
97
+ }
98
+ }
53
99
  function buildWorkerRows(snapshots) {
54
100
  return snapshots.map((snapshot) => ({
55
101
  agent: snapshot.name,
@@ -158,6 +204,7 @@ class OuroDaemon {
158
204
  // Pre-initialize MCP connections so they're ready for the first command (non-blocking)
159
205
  /* v8 ignore next -- catch callback: getSharedMcpManager logs errors internally @preserve */
160
206
  (0, mcp_manager_1.getSharedMcpManager)().catch(() => { });
207
+ killOrphanAgentProcesses();
161
208
  await this.processManager.startAutoStartAgents();
162
209
  await this.senseManager?.startAutoStartSenses();
163
210
  this.scheduler.start?.();
@@ -71,12 +71,13 @@ async function pingProvider(provider, config) {
71
71
  const timeout = setTimeout(() => controller.abort(), PING_TIMEOUT_MS);
72
72
  try {
73
73
  // Minimal API call — no thinking, no reasoning, no tools.
74
- // We use the runtime's client directly to avoid provider-specific
75
- // streamTurn params (adaptive thinking, reasoning effort, phase
76
- // annotations) that can cause 400 errors unrelated to auth/quota.
77
74
  if (provider === "anthropic") {
75
+ // Use haiku for the ping — setup tokens may not have access to newer
76
+ // models, but if haiku works, the credentials are valid.
77
+ // Override the beta header to exclude thinking (which requires a
78
+ // thinking param in the request body).
78
79
  const client = runtime.client;
79
- await client.messages.create({ model: runtime.model, max_tokens: 1, messages: [{ role: "user", content: "ping" }] }, { signal: controller.signal });
80
+ await client.messages.create({ model: "claude-haiku-4-5-20251001", max_tokens: 1, messages: [{ role: "user", content: "ping" }] }, { signal: controller.signal, headers: { "anthropic-beta": "claude-code-20250219,oauth-2025-04-20" } });
80
81
  }
81
82
  else {
82
83
  // OpenAI-compatible providers (azure, codex, minimax, github-copilot)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ouro.bot/cli",
3
- "version": "0.1.0-alpha.117",
3
+ "version": "0.1.0-alpha.119",
4
4
  "main": "dist/heart/daemon/ouro-entry.js",
5
5
  "bin": {
6
6
  "cli": "dist/heart/daemon/ouro-bot-entry.js",