@ouro.bot/cli 0.1.0-alpha.1075 → 0.1.0-alpha.1078

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.1078",
6
+ "changes": [
7
+ "surface takes channel=teams, so a private-runtime turn (an ouro msg, an await) can tell a friend on Teams now: it sends at once where the Teams sense runs, and otherwise waits in their Teams chat"
8
+ ]
9
+ },
10
+ {
11
+ "version": "0.1.0-alpha.1076",
12
+ "changes": [
13
+ "The daemon pings providers from a short-lived child, so the provider SDK doesn't stay resident"
14
+ ]
15
+ },
4
16
  {
5
17
  "version": "0.1.0-alpha.1075",
6
18
  "changes": [
@@ -1,5 +1,5 @@
1
1
  {
2
- "runtimeVersion": "0.1.0-alpha.1075",
2
+ "runtimeVersion": "0.1.0-alpha.1078",
3
3
  "bundleSchemaVersion": 3,
4
4
  "lastUpdated": "2026-09-03T00:00:00.000Z"
5
5
  }
@@ -1,7 +1,7 @@
1
1
  <?xml version="1.0"?>
2
2
  <Container version="2">
3
3
  <Name>ouro-butler</Name>
4
- <Repository>ghcr.io/ourostack/ouroboros-butler:0.1.0-alpha.1075</Repository>
4
+ <Repository>ghcr.io/ourostack/ouroboros-butler:0.1.0-alpha.1078</Repository>
5
5
  <Registry>https://github.com/ourostack/ouroboros/pkgs/container/ouroboros-butler</Registry>
6
6
  <Network>host</Network>
7
7
  <Shell>sh</Shell>
@@ -64,6 +64,7 @@ const container_runtime_1 = require("./container-runtime");
64
64
  const supercronic_supervisor_1 = require("./supercronic-supervisor");
65
65
  const daemon_tombstone_1 = require("./daemon-tombstone");
66
66
  const agent_config_check_1 = require("./agent-config-check");
67
+ const provider_ping_child_1 = require("../provider-ping-child");
67
68
  const pulse_1 = require("./pulse");
68
69
  const socket_client_1 = require("./socket-client");
69
70
  const portable_git_1 = require("./portable-git");
@@ -719,7 +720,8 @@ async function prepareProviderRuntime() {
719
720
  // Read from the same vault listing: whether this machine has config or not, the
720
721
  // daemon then knows, and its bootstrap spares each worker and sense a vault CLI run.
721
722
  await (0, runtime_credentials_1.refreshMachineRuntimeCredentialConfig)(agent, daemonMachineId, { preserveCachedOnFailure: true });
722
- const result = await (0, agent_config_check_1.checkAgentConfigWithProviderHealth)(agent, bundlesRoot);
723
+ // The ping runs in a child process, so the provider SDK it loads doesn't stay in the daemon.
724
+ const result = await (0, agent_config_check_1.checkAgentConfigWithProviderHealth)(agent, bundlesRoot, { pingProvider: provider_ping_child_1.pingProviderInChild });
723
725
  if (result.ok)
724
726
  return null;
725
727
  (0, runtime_1.emitNervesEvent)({
@@ -0,0 +1,125 @@
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.runProviderPingChild = runProviderPingChild;
37
+ exports.pingProviderInChild = pingProviderInChild;
38
+ exports.serveProviderPingChild = serveProviderPingChild;
39
+ const child_process_1 = require("child_process");
40
+ const path = __importStar(require("path"));
41
+ const runtime_1 = require("../nerves/runtime");
42
+ const PING_ENTRY = path.join(__dirname, "provider-ping-entry.js");
43
+ // Three attempts of the 10 s ping, plus startup, with room to spare.
44
+ const CHILD_TIMEOUT_MS = 60_000;
45
+ const pingInThisProcess = async (provider, config, options) => (await Promise.resolve().then(() => __importStar(require("./provider-ping")))).pingProvider(provider, config, options);
46
+ /** Run the ping entry with the request on stdin; resolve with its exit code and stdout. */
47
+ function runProviderPingChild(request, entry = PING_ENTRY, timeoutMs = CHILD_TIMEOUT_MS) {
48
+ return new Promise((resolve, reject) => {
49
+ const child = (0, child_process_1.spawn)(process.execPath, [entry], { stdio: ["pipe", "pipe", "ignore"], env: process.env });
50
+ let stdout = "";
51
+ const timer = setTimeout(() => child.kill("SIGKILL"), timeoutMs);
52
+ child.stdout.setEncoding("utf8");
53
+ child.stdout.on("data", (chunk) => { stdout += chunk; });
54
+ /* v8 ignore next -- spawn of this same node binary only fails if the host can't start a process @preserve */
55
+ child.on("error", (error) => { clearTimeout(timer); reject(error); });
56
+ child.on("close", (code) => { clearTimeout(timer); resolve({ code, stdout }); });
57
+ /* v8 ignore next -- EPIPE when the child dies before reading; the close handler reports it @preserve */
58
+ child.stdin.on("error", () => undefined);
59
+ child.stdin.end(request);
60
+ });
61
+ }
62
+ function parsePingResult(stdout) {
63
+ try {
64
+ const value = JSON.parse(stdout.trim());
65
+ return value && typeof value === "object" && typeof value.ok === "boolean" ? value : null;
66
+ }
67
+ catch {
68
+ return null;
69
+ }
70
+ }
71
+ /**
72
+ * Ping a provider from a short-lived child process, so the provider SDK it
73
+ * loads (about 11 MB for openai) leaves with the child instead of staying in a
74
+ * long-lived daemon. Progress callbacks can't cross a process boundary, so a
75
+ * ping that asks for them runs here. If the child can't produce a result, the
76
+ * ping runs here too: this changes where the ping runs, never its answer.
77
+ */
78
+ async function pingProviderInChild(provider, config, options = {}, deps = {}) {
79
+ const pingInProcess = deps.pingInProcess ?? pingInThisProcess;
80
+ if (options.sleep || options.onAttemptStart || options.onRetry)
81
+ return pingInProcess(provider, config, options);
82
+ const request = {
83
+ provider,
84
+ config,
85
+ options: { model: options.model, timeoutMs: options.timeoutMs, attemptPolicy: options.attemptPolicy },
86
+ };
87
+ let failure;
88
+ try {
89
+ const outcome = await (deps.runChild ?? runProviderPingChild)(JSON.stringify(request));
90
+ const result = parsePingResult(outcome.stdout);
91
+ if (result) {
92
+ (0, runtime_1.emitNervesEvent)({ component: "engine", event: "engine.provider_ping_child_done", message: "provider ping ran in a child process", meta: { provider, ok: result.ok } });
93
+ return result;
94
+ }
95
+ failure = `exit ${outcome.code} without a result`;
96
+ }
97
+ catch (error) {
98
+ failure = error instanceof Error ? error.message : String(error);
99
+ }
100
+ (0, runtime_1.emitNervesEvent)({
101
+ level: "warn",
102
+ component: "engine",
103
+ event: "engine.provider_ping_child_fallback",
104
+ message: "provider ping child gave no result; pinging in this process",
105
+ meta: { provider, failure },
106
+ });
107
+ return pingInProcess(provider, config, options);
108
+ }
109
+ /** The child's side: read one request, ping, write the result as one JSON line. */
110
+ async function serveProviderPingChild(input, write, ping = pingInThisProcess) {
111
+ let raw = "";
112
+ for await (const chunk of input)
113
+ raw += chunk.toString();
114
+ let request;
115
+ try {
116
+ request = JSON.parse(raw);
117
+ }
118
+ catch {
119
+ (0, runtime_1.emitNervesEvent)({ level: "error", component: "engine", event: "engine.provider_ping_child_bad_request", message: "provider ping child got an unreadable request", meta: {} });
120
+ return 2;
121
+ }
122
+ const result = await ping(request.provider, request.config, request.options);
123
+ write(`${JSON.stringify(result)}\n`);
124
+ return 0;
125
+ }
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const runtime_1 = require("../nerves/runtime");
4
+ const provider_ping_child_1 = require("./provider-ping-child");
5
+ /* v8 ignore start -- process entry: serveProviderPingChild is unit-tested, and the edge benchmark runs this end to end @preserve */
6
+ (0, runtime_1.emitNervesEvent)({ component: "engine", event: "engine.provider_ping_child_start", message: "provider ping child started", meta: {} });
7
+ void (0, provider_ping_child_1.serveProviderPingChild)(process.stdin, (text) => { process.stdout.write(text); }).then((code) => { process.exitCode = code; });
8
+ /* v8 ignore stop */
@@ -52,7 +52,7 @@ function normalizeSurfaceDeliveryChannel(value) {
52
52
  if (typeof value !== "string")
53
53
  return "auto";
54
54
  const normalized = value.trim().toLowerCase();
55
- return normalized === "voice" ? "voice" : "auto";
55
+ return normalized === "voice" ? "voice" : normalized === "teams" ? "teams" : "auto";
56
56
  }
57
57
  function parseSurfaceVoiceInitialAudio(args) {
58
58
  const source = args.voiceAudioSource === "url" || args.voiceAudioSource === "file" || args.voiceAudioSource === "tone"
@@ -83,7 +83,7 @@ exports.surfaceToolDef = {
83
83
  type: "function",
84
84
  function: {
85
85
  name: "surface",
86
- description: "return a ready thought to a friend or active session without publishing private-runtime work to BlueBubbles. pass delegationId to address a held thought (see your attention queue above), or friendId for spontaneous outreach. Surface delivers tool responses to the active session. BlueBubbles is a dedicated channel - use send_message with channel=\"bluebubbles\" for intentional iMessage delivery. set channel=voice only when you intentionally want a live phone call; content becomes the call reason/opening context. does not end your turn.",
86
+ description: "return a ready thought to a friend or active session without publishing private-runtime work to BlueBubbles. pass delegationId to address a held thought (see your attention queue above), or friendId for spontaneous outreach. Surface delivers tool responses to the active session. BlueBubbles is a dedicated channel - use send_message with channel=\"bluebubbles\" for intentional iMessage delivery. set channel=voice only when you intentionally want a live phone call; content becomes the call reason/opening context. set channel=teams to tell a friend on Teams now (it sends at once where your Teams sense runs, otherwise waits in their Teams chat). does not end your turn.",
87
87
  parameters: {
88
88
  type: "object",
89
89
  properties: {
@@ -101,8 +101,8 @@ exports.surfaceToolDef = {
101
101
  },
102
102
  channel: {
103
103
  type: "string",
104
- enum: ["auto", "voice"],
105
- description: "optional delivery channel; use voice for a live phone call to a trusted friend, otherwise omit",
104
+ enum: ["auto", "voice", "teams"],
105
+ description: "optional delivery channel; use voice for a live phone call to a trusted friend, teams to reach them on Teams now, otherwise omit",
106
106
  },
107
107
  phoneNumber: {
108
108
  type: "string",
@@ -223,6 +223,12 @@ async function routeSurfaceToFriend(agentName, friendId, content, queueItem, hin
223
223
  ? { status: "delivered", detail: voiceResult.detail }
224
224
  : { status: "failed", detail: voiceResult.detail };
225
225
  }
226
+ if (hint?.channel === "teams") {
227
+ // The friend's latest Teams chat, else a new 1:1 the bot opens by their AAD id.
228
+ const teamsSession = (0, session_activity_1.listSessionActivity)({ sessionsDir, friendsDir, agentName, activeThresholdMs: Number.MAX_SAFE_INTEGER })
229
+ .find((activity) => activity.friendId === friendId && activity.channel === "teams");
230
+ return deliverTeamsOrQueue(teamsSession ?? { friendId, channel: "teams", key: "proactive" }, "for their next Teams message");
231
+ }
226
232
  // Priority 1: Bridge-preferred session (if queue item has a bridgeId)
227
233
  if (queueItem?.bridgeId) {
228
234
  const { createBridgeManager } = await Promise.resolve().then(() => __importStar(require("../heart/bridges/manager")));
@@ -311,7 +317,7 @@ exports.surfaceToolDefinition = {
311
317
  content: args.content ?? "",
312
318
  delegationId: args.delegationId,
313
319
  friendId: args.friendId,
314
- deliveryHint: deliveryHint.channel === "voice" || deliveryHint.phoneNumber ? deliveryHint : undefined,
320
+ deliveryHint: deliveryHint.channel !== "auto" || deliveryHint.phoneNumber ? deliveryHint : undefined,
315
321
  queue,
316
322
  routeToFriend,
317
323
  advanceObligation: (obligationId, update) => {
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@ouro.bot/cli",
3
- "version": "0.1.0-alpha.1075",
3
+ "version": "0.1.0-alpha.1078",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@ouro.bot/cli",
9
- "version": "0.1.0-alpha.1075",
9
+ "version": "0.1.0-alpha.1078",
10
10
  "dependencies": {
11
11
  "@anthropic-ai/sdk": "^0.78.0",
12
12
  "@ouro.bot/friends": "0.1.0-alpha.18",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ouro.bot/cli",
3
- "version": "0.1.0-alpha.1075",
3
+ "version": "0.1.0-alpha.1078",
4
4
  "engines": {
5
5
  "node": ">=22"
6
6
  },