@ouro.bot/cli 0.1.0-alpha.1167 → 0.1.0-alpha.1169

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/README.md CHANGED
@@ -21,7 +21,7 @@ npx ouro.bot@latest up # install the ouro command and start the daemon
21
21
 
22
22
  - **You talk to it where you already are:** the terminal, Teams, iMessage, mail or a voice call.
23
23
  - **It remembers.** Notes, people and promises live in the agent's own bundle and vault, so tomorrow it knows what you agreed today.
24
- - **It does the work.** Real tools: files, shell, GitHub, Microsoft Graph, and coding agents it can hand work to. [Shepherd](https://ouroboros.bot/#shepherd) keeps those coding agents moving, and [Butler](https://ouroboros.bot/butler/) looks after a home server.
24
+ - **It does the work.** Real tools: files, shell, GitHub, Microsoft Graph, and coding agents it can hand work to. [Shepherd](https://ouroboros.bot/shepherd/) keeps the flock (the coding agents in your terminals, and the GitHub Copilot app's sessions), [Housesitter](https://ouroboros.bot/housesitter/) keeps the house (the Mac they live on), and [Butler](https://ouroboros.bot/butler/) looks after a home server.
25
25
  - **Its errors go back to it, not to you.** If the model provider turns a request down or a tool call comes back broken, the agent hears what went wrong, fixes it and replies in the same turn. Only what needs a person, such as a sign-in, a usage limit or an outage, comes to you.
26
26
 
27
27
  `ouro.bot` is the bootstrap wrapper: `npx ouro.bot@latest` installs `@ouro.bot/cli`, which gives you the `ouro` command.
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.1169",
6
+ "changes": [
7
+ "Tool schemas: one copy of external_event_disposition fields, shorter descriptions, mail tools only when the mail sense is enabled (about 4.5k fewer tokens per turn)"
8
+ ]
9
+ },
10
+ {
11
+ "version": "0.1.0-alpha.1168",
12
+ "changes": [
13
+ "An agent's context window is read from the provider's own model listing (GitHub Copilot's capabilities.limits.max_context_window_tokens) once per model and cached. The built-in 200k/400k estimates apply only when that read fails, and the log says so (engine.context_window_fallback)."
14
+ ]
15
+ },
4
16
  {
5
17
  "version": "0.1.0-alpha.1167",
6
18
  "changes": [
@@ -1,5 +1,5 @@
1
1
  {
2
- "runtimeVersion": "0.1.0-alpha.1167",
2
+ "runtimeVersion": "0.1.0-alpha.1169",
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.1167</Repository>
4
+ <Repository>ghcr.io/ourostack/ouroboros-butler:0.1.0-alpha.1169</Repository>
5
5
  <Registry>https://github.com/ourostack/ouroboros/pkgs/container/ouroboros-butler</Registry>
6
6
  <Network>host</Network>
7
7
  <Shell>sh</Shell>
@@ -66,6 +66,7 @@ exports.sessionPath = sessionPath;
66
66
  exports.logPath = logPath;
67
67
  const fs = __importStar(require("fs"));
68
68
  const path = __importStar(require("path"));
69
+ const model_limits_1 = require("./model-limits");
69
70
  const model_capabilities_1 = require("./model-capabilities");
70
71
  const identity_1 = require("./identity");
71
72
  const provider_credentials_1 = require("./provider-credentials");
@@ -288,7 +289,7 @@ function getContextConfig(model) {
288
289
  : undefined;
289
290
  const modelId = model ?? agentConfig.humanFacing?.model;
290
291
  return {
291
- maxTokens: override ?? (modelId ? (0, model_capabilities_1.getModelCapabilities)(modelId).contextWindowTokens : undefined) ?? defaults.maxTokens,
292
+ maxTokens: override ?? (modelId ? (0, model_limits_1.getLearnedContextWindow)(modelId) ?? (0, model_capabilities_1.getModelCapabilities)(modelId).contextWindowTokens : undefined) ?? defaults.maxTokens,
292
293
  contextMargin: typeof agentContext?.contextMargin === "number" ? agentContext.contextMargin : defaults.contextMargin,
293
294
  };
294
295
  }
@@ -23,6 +23,7 @@ exports.dropReplayedReasoning = dropReplayedReasoning;
23
23
  exports.runAgent = runAgent;
24
24
  const config_1 = require("./config");
25
25
  const identity_1 = require("./identity");
26
+ const model_limits_1 = require("./model-limits");
26
27
  const source_grounding_1 = require("./source-grounding");
27
28
  const shelf_claims_1 = require("./shelf-claims");
28
29
  const reply_style_1 = require("./reply-style");
@@ -188,6 +189,7 @@ async function getProviderRuntime(facing = "human", owner) {
188
189
  console.error(`\n[fatal] ${msg}\n`);
189
190
  throw new Error(msg);
190
191
  }
192
+ await (0, model_limits_1.learnContextWindow)(runtime);
191
193
  // The shared tool loop supplies approval continuation to every provider adapter.
192
194
  return { ...runtime, capabilities: new Set([...runtime.capabilities, "approval-continuation"]) };
193
195
  }
@@ -202,6 +204,7 @@ async function getChainEntryRuntime(entry, owner) {
202
204
  /* v8 ignore next -- defensive: the registry resolves every provider id @preserve */
203
205
  if (!runtime)
204
206
  throw new Error(`${entry.provider} (${entry.model}) runtime could not be initialized.`);
207
+ await (0, model_limits_1.learnContextWindow)(runtime);
205
208
  return { ...runtime, capabilities: new Set([...runtime.capabilities, "approval-continuation"]) };
206
209
  }
207
210
  // Called after getProviderRuntime has loaded the same agent.json, so a bad config has already failed the turn.
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getLearnedContextWindow = getLearnedContextWindow;
4
+ exports.learnContextWindow = learnContextWindow;
5
+ exports.resetLearnedContextWindowsForTests = resetLearnedContextWindowsForTests;
6
+ const runtime_1 = require("../nerves/runtime");
7
+ const learned = new Map();
8
+ const attempted = new Set();
9
+ /** The context window a provider reported for this model, once learned. */
10
+ function getLearnedContextWindow(model) {
11
+ return learned.get(model);
12
+ }
13
+ /**
14
+ * Ask the provider once per model for its real context window and remember it. A provider that cannot say, or a failed
15
+ * read, leaves the static table in model-capabilities.ts as the fallback, and says so in the log.
16
+ */
17
+ async function learnContextWindow(runtime) {
18
+ const key = runtime.model;
19
+ if (learned.has(key) || attempted.has(key))
20
+ return;
21
+ attempted.add(key);
22
+ if (!runtime.fetchContextWindow)
23
+ return;
24
+ try {
25
+ const tokens = await runtime.fetchContextWindow(AbortSignal.timeout(5000));
26
+ if (tokens === undefined)
27
+ throw new Error("the provider's model list has no context window for this model");
28
+ learned.set(key, tokens);
29
+ (0, runtime_1.emitNervesEvent)({
30
+ component: "engine",
31
+ event: "engine.context_window_learned",
32
+ message: "context window read from the provider",
33
+ meta: { provider: runtime.id, model: key, tokens },
34
+ });
35
+ }
36
+ catch (error) {
37
+ (0, runtime_1.emitNervesEvent)({
38
+ level: "warn",
39
+ component: "engine",
40
+ event: "engine.context_window_fallback",
41
+ message: "context window read failed; using the built-in estimate for this model",
42
+ meta: { provider: runtime.id, model: key, reason: error instanceof Error ? error.message : String(error) },
43
+ });
44
+ }
45
+ }
46
+ function resetLearnedContextWindowsForTests() {
47
+ learned.clear();
48
+ attempted.clear();
49
+ }
@@ -38,6 +38,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
39
  exports.classifyGithubCopilotError = classifyGithubCopilotError;
40
40
  exports.withCopilotVisionHeader = withCopilotVisionHeader;
41
+ exports.contextWindowFromModels = contextWindowFromModels;
41
42
  exports.createGithubCopilotPooledCaller = createGithubCopilotPooledCaller;
42
43
  exports.createGithubCopilotProviderRuntime = createGithubCopilotProviderRuntime;
43
44
  const openai_1 = __importDefault(require("openai"));
@@ -67,6 +68,12 @@ function withCopilotVisionHeader(fetchImpl) {
67
68
  return send(input, { ...init, headers });
68
69
  };
69
70
  }
71
+ /** Pull one model's context window out of Copilot's /models listing (`capabilities.limits.max_context_window_tokens`). */
72
+ function contextWindowFromModels(models, modelId) {
73
+ const entry = models.find((m) => m?.id === modelId);
74
+ const tokens = entry?.capabilities?.limits?.max_context_window_tokens;
75
+ return typeof tokens === "number" && Number.isFinite(tokens) && tokens > 0 ? Math.floor(tokens) : undefined;
76
+ }
70
77
  /**
71
78
  * The agent's account pool for this turn, when `ouro auth` discovered one; null for a single account.
72
79
  * Without an owning agent (a daemon-side ping, provider discovery) the pool still switches on a 402 or 429,
@@ -161,6 +168,12 @@ function createGithubCopilotProviderRuntime(model, config = (0, config_1.getGith
161
168
  }
162
169
  },
163
170
  /* v8 ignore stop */
171
+ /* v8 ignore start -- network read: the parsing is tested via contextWindowFromModels @preserve */
172
+ async fetchContextWindow(signal) {
173
+ const page = await callModel(this.client, (turnClient) => turnClient.models.list({ signal }));
174
+ return contextWindowFromModels(page.data, this.model);
175
+ },
176
+ /* v8 ignore stop */
164
177
  /* v8 ignore start -- ping: tested via provider-ping.test.ts @preserve */
165
178
  async ping(signal) {
166
179
  await callModel(this.client, (turnClient) => turnClient.chat.completions.create({ model: this.model, max_tokens: 1, messages: [{ role: "user", content: "ping" }] }, { signal }));
@@ -220,6 +233,12 @@ function createGithubCopilotProviderRuntime(model, config = (0, config_1.getGith
220
233
  }
221
234
  },
222
235
  /* v8 ignore stop */
236
+ /* v8 ignore start -- network read: the parsing is tested via contextWindowFromModels @preserve */
237
+ async fetchContextWindow(signal) {
238
+ const page = await callModel(this.client, (turnClient) => turnClient.models.list({ signal }));
239
+ return contextWindowFromModels(page.data, this.model);
240
+ },
241
+ /* v8 ignore stop */
223
242
  /* v8 ignore start -- ping: tested via provider-ping.test.ts @preserve */
224
243
  async ping(signal) {
225
244
  await callModel(this.client, (turnClient) => turnClient.responses.create({ model: this.model, input: "ping", max_output_tokens: 16 }, { signal }));
@@ -807,14 +807,14 @@ exports.awaitingToolDefinitions = [
807
807
  type: "function",
808
808
  function: {
809
809
  name: "resolve_await",
810
- description: "Resolve a pending await with a verdict. verdict='yes' archives and fires the alert. verdict='no' records the observation and continues polling; still pending is always 'no'. verdict='ask_owner' (with question and choices) closes the await and asks my owner to decide, exactly once: use it when the condition cannot be met without the owner deciding, for example a confirmed dead download. Never use ask_owner for \"not yet\" or a merely suspected problem; that is 'no'.",
810
+ description: "Resolve a pending await. yes: condition met; archives and fires the alert. no: anything else, including not yet or unable to tell; records the observation and polling continues. ask_owner (with question and choices): closes the await and asks my owner to decide, once; only when the condition cannot be met without their decision, for example a confirmed dead download.",
811
811
  parameters: {
812
812
  type: "object",
813
813
  properties: {
814
814
  name: { type: "string", description: "Await name (filename stem)." },
815
- verdict: { type: "string", enum: ["yes", "no", "ask_owner"], description: "Exactly 'yes' if the condition is met. Exactly 'no' for anything else, including still pending, not yet, or unable to tell: send 'no' with an observation and polling continues. 'ask_owner' only when the condition cannot be met without the owner deciding; it needs question and choices." },
815
+ verdict: { type: "string", enum: ["yes", "no", "ask_owner"], description: "yes, no or ask_owner" },
816
816
  observation: { type: "string", description: "One-line summary of what I saw this tick." },
817
- message: { type: "string", description: "Only for 'yes': what I tell whoever asked, written to them in plain words and sent as is. Say what I just checked and what it means for them." },
817
+ message: { type: "string", description: "Only for yes: what I tell whoever asked, in plain words, sent as is" },
818
818
  question: { type: "string", description: "Only for ask_owner: the decision I need from my owner, in plain words." },
819
819
  choices: { type: "array", items: { type: "string" }, minItems: 2, maxItems: 4, description: "Only for ask_owner: 2 to 4 short options the owner can pick from." },
820
820
  },
@@ -20,7 +20,6 @@ const tools_user_profile_1 = require("./tools-user-profile");
20
20
  const tools_stripe_1 = require("./tools-stripe");
21
21
  const tools_flight_1 = require("./tools-flight");
22
22
  const tools_attachments_1 = require("./tools-attachments");
23
- const tools_mail_1 = require("./tools-mail");
24
23
  const tools_trip_1 = require("./tools-trip");
25
24
  const tools_a2a_1 = require("./tools-a2a");
26
25
  const tools_commerce_1 = require("./tools-commerce");
@@ -76,7 +75,6 @@ exports.baseToolDefinitions = [
76
75
  ...tools_stripe_1.stripeToolDefinitions,
77
76
  ...tools_flight_1.flightToolDefinitions,
78
77
  ...tools_attachments_1.attachmentToolDefinitions,
79
- ...tools_mail_1.mailToolDefinitions,
80
78
  ...tools_trip_1.tripToolDefinitions,
81
79
  ...tools_a2a_1.a2aToolDefinitions,
82
80
  ...tools_commerce_1.commerceToolDefinitions,
@@ -46,30 +46,29 @@ const intentions_1 = require("../arc/intentions");
46
46
  const steward_policy_1 = require("../heart/steward-policy");
47
47
  const await_parser_1 = require("../heart/awaiting/await-parser");
48
48
  const externalEventDispositionProperties = {
49
- recordPath: { type: "string", description: "Exact receipt path from the external-event message" },
50
- expectedGeneration: { type: "number", description: "Exact generation shown in the external-event turn" },
51
- classifiedRevision: { type: "string", description: "Exact observation revision investigated in this turn" },
49
+ recordPath: { type: "string", description: "Receipt path from the external-event message" },
50
+ expectedGeneration: { type: "number", description: "Generation shown in the external-event turn" },
51
+ classifiedRevision: { type: "string", description: "Observation revision investigated this turn" },
52
52
  classification: { type: "string", enum: ["expected", "needs_attention", "adopted", "snoozed", "dismissed_until_change", "resolved"] },
53
- stewardPolicyKind: { type: "string", enum: ["current", "none"], description: "Use current with the exact live policy key/version when one applies; otherwise use none. Any event may be closed with none." },
54
- stewardPolicyKey: { type: "string", description: "Exact current policy key used for this decision" },
55
- stewardPolicyVersion: { type: "number", description: "Exact current policy version used for this decision" },
53
+ stewardPolicyKind: { type: "string", enum: ["current", "none"], description: "current with the live policy key/version when one applies, else none" },
54
+ stewardPolicyKey: { type: "string" },
55
+ stewardPolicyVersion: { type: "number" },
56
56
  decision: { type: "string", enum: ["silent", "act", "ask", "report"] },
57
- reason: { type: "string", description: "Internal audit note for the decision; never shown to the owner" },
58
- owner_message: { type: "string", description: "Required for ask or report: the exact short plain message the owner reads, as you would text a friend. No ids, leases, generations, revisions or receipts." },
59
- nextWake: { type: "string", enum: ["on_change", "on_escalation", "on_recovery", "at"], description: "Use on_change unless you already called await_condition for this exact event and are supplying its awaitId" },
60
- wakeAt: { type: "string", description: "ISO time required only when nextWake=at" },
61
- awaitId: { type: "string", description: "Existing await_condition receipt required when nextWake=at; never invent one" },
62
- careId: { type: "string", description: "Existing Care adopted for this incident, if any" },
57
+ reason: { type: "string", description: "Internal audit note; never shown to the owner" },
58
+ owner_message: { type: "string", description: "Required for ask or report: the short plain message the owner reads. No ids, leases, generations or receipts." },
59
+ nextWake: { type: "string", enum: ["on_change", "on_escalation", "on_recovery", "at"], description: "on_change unless you called await_condition for this event; then at, with its awaitId" },
60
+ wakeAt: { type: "string", description: "ISO time, only for nextWake=at" },
61
+ awaitId: { type: "string", description: "await_condition receipt, for nextWake=at" },
62
+ careId: { type: "string" },
63
63
  actionRefs: { type: "array", items: { type: "string" } },
64
64
  verificationRefs: { type: "array", items: { type: "string" } },
65
65
  };
66
- const externalEventDispositionRequired = ["recordPath", "expectedGeneration", "classifiedRevision", "classification", "stewardPolicyKind", "decision", "reason", "nextWake"];
67
66
  const externalEventDispositionBatchSchema = {
68
67
  type: "array",
69
68
  minItems: 1,
70
69
  maxItems: 32,
71
- description: "All exact leases from one coalesced external-event turn",
72
- items: { type: "object", properties: externalEventDispositionProperties, required: externalEventDispositionRequired, additionalProperties: false },
70
+ description: "One disposition per lease of a coalesced external-event turn, each with the single-form fields",
71
+ items: { type: "object" },
73
72
  };
74
73
  // The owner reads owner_message verbatim, so internal bookkeeping words never reach them.
75
74
  const OWNER_MESSAGE_FORBIDDEN = /\b(generation|lease|revision|receipt|disposition|claimOwner|recordPath)s?\b|[\u200b-\u200f\u202a-\u202e\u2060-\u206f\ufeff]/iu;
@@ -245,17 +244,13 @@ exports.continuityToolDefinitions = [
245
244
  type: "function",
246
245
  function: {
247
246
  name: "external_event_disposition",
248
- description: "Classify the exact external-event generation I just investigated. An ask or report is the sole owner-delivery path and sends owner_message once for this receipt; reason stays internal. silent and act only record the disposition. In a batch, only the first ask or report sends a message and the later ones are recorded as covered by it, so write that first owner_message to cover every listed incident.",
247
+ description: "Classify the external event I just investigated. ask and report send owner_message (the only way to reach the owner); silent and act only record. In a batch only the first ask or report sends, covering the rest, so make its owner_message cover every incident.",
249
248
  parameters: {
250
249
  type: "object",
251
250
  properties: {
252
251
  ...externalEventDispositionProperties,
253
252
  batch: externalEventDispositionBatchSchema,
254
253
  },
255
- oneOf: [
256
- { type: "object", properties: externalEventDispositionProperties, required: externalEventDispositionRequired },
257
- { type: "object", properties: { batch: externalEventDispositionBatchSchema }, required: ["batch"] },
258
- ],
259
254
  additionalProperties: false,
260
255
  },
261
256
  },
@@ -50,7 +50,7 @@ exports.reportFailureToolDefinition = {
50
50
  type: "function",
51
51
  function: {
52
52
  name: "report_failure",
53
- description: "File a failure report for the engineers who fix you. Use it when a tool you need is missing or a tool errors in a way you cannot work around, so the engineers can get the owner's request moving. When the owner asks for something you have no tool for yet (for example, setting a thermostat), file it right away. File it at once and ask him for nothing. Report the actual result: queued for authorized peers, or saved locally pending authorization, never claim delivery or a GitHub issue from a local save. A repeat retries the same pending report; the A2A server also retries when real escalation grants become available.",
53
+ description: "File a failure report for the engineers who fix you, when a tool you need is missing or errors in a way you cannot work around. File it at once and ask the owner for nothing. Report the actual result (queued, or saved locally pending authorization); never claim delivery or a GitHub issue from a local save. A repeat retries the same report.",
54
54
  parameters: {
55
55
  type: "object",
56
56
  properties: {
@@ -5,51 +5,51 @@ exports.ponderTool = {
5
5
  type: "function",
6
6
  function: {
7
7
  name: "ponder",
8
- description: "create or revise a typed ponder packet so i don't lose the plot while i keep working. use this for harness friction, research, or reflection that should survive the current turn. if the user asked me to think privately and return later from an outward session, preserve literal return tokens and constraints in payload_json fields or success_criteria; the runtime records the latest user request as sourceRequest. then do not settle with the final private answer in the same outward turn; only acknowledge that the private pass is queued. in private runtime, ponder only preserves state; it does not create a new self-return obligation, so surface any existing held item instead of pondering a replacement. ponder does not end the turn by itself and may be followed by more tools before i settle or rest. Don't ponder trivial questions.",
8
+ description: "create or revise a ponder packet: harness friction, research, or reflection that should survive this turn. when asked to think privately and return later from an outward session, keep literal return tokens and constraints in payload_json or success_criteria, then only acknowledge that the private pass is queued. in private runtime it only preserves state; surface an existing held item instead of pondering a replacement. does not end the turn. not for trivial questions.",
9
9
  parameters: {
10
10
  type: "object",
11
11
  properties: {
12
12
  action: {
13
13
  type: "string",
14
14
  enum: ["create", "revise"],
15
- description: "create a new packet or revise an existing drafting packet.",
15
+ description: "create, or revise a drafting packet",
16
16
  },
17
17
  kind: {
18
18
  type: "string",
19
19
  enum: ["harness_friction", "research", "reflection"],
20
- description: "the packet kind. determines the SOP the private-runtime turn should follow.",
20
+ description: "packet kind",
21
21
  },
22
22
  packet_id: {
23
23
  type: "string",
24
- description: "required for action=revise. the packet to revise in place.",
24
+ description: "for revise",
25
25
  },
26
26
  follows_packet_id: {
27
27
  type: "string",
28
- description: "optional follow-up linkage when a new packet grows out of an earlier one.",
28
+ description: "earlier packet this follows from",
29
29
  },
30
30
  objective: {
31
31
  type: "string",
32
- description: "the durable objective for this packet.",
32
+ description: "durable objective",
33
33
  },
34
34
  summary: {
35
35
  type: "string",
36
- description: "brief factual summary of the work object or friction being preserved.",
36
+ description: "brief factual summary",
37
37
  },
38
38
  success_criteria: {
39
39
  type: "string",
40
- description: "newline-delimited success criteria bullets.",
40
+ description: "newline-delimited bullets",
41
41
  },
42
42
  payload_json: {
43
43
  type: "string",
44
- description: "JSON object string with packet-specific structured details. include exact markers, return wording fragments, or constraints the private-runtime pass must preserve; sourceRequest is owned by the runtime from the latest user request. use {} only when there are no such details.",
44
+ description: "JSON object: exact markers, return wording or constraints the private pass must keep ({} if none)",
45
45
  },
46
46
  thought: {
47
47
  type: "string",
48
- description: "deprecated compatibility field. legacy thought text is normalized into a reflection packet.",
48
+ description: "deprecated: becomes a reflection packet",
49
49
  },
50
50
  say: {
51
51
  type: "string",
52
- description: "deprecated compatibility field. retained for migration only; it no longer controls deferral or silence.",
52
+ description: "deprecated: no effect",
53
53
  },
54
54
  },
55
55
  },
@@ -7,7 +7,9 @@ exports.mailToolDefinitions = exports.__mailStatusTestOnly = void 0;
7
7
  exports.renderCachedMessageSummary = renderCachedMessageSummary;
8
8
  exports.mergeCachedMailSearchDocuments = mergeCachedMailSearchDocuments;
9
9
  exports.searchSuccessfulImportArchives = searchSuccessfulImportArchives;
10
+ exports.mailToolsEnabled = mailToolsEnabled;
10
11
  const node_fs_1 = __importDefault(require("node:fs"));
12
+ const node_path_1 = __importDefault(require("node:path"));
11
13
  const friends_1 = require("@ouro.bot/friends");
12
14
  const file_store_1 = require("../mailroom/file-store");
13
15
  const reader_1 = require("../mailroom/reader");
@@ -858,6 +860,18 @@ async function renderMailStatus(input) {
858
860
  ...renderRecentImportOperations(input.agentId),
859
861
  ].join("\n");
860
862
  }
863
+ /** The mail tools exist only for an agent that turned the mail sense on in agent.json (`ouro connect mail` does). */
864
+ function mailToolsEnabled(agentRoot) {
865
+ if (!agentRoot)
866
+ return false;
867
+ try {
868
+ const config = JSON.parse(node_fs_1.default.readFileSync(node_path_1.default.join(agentRoot, "agent.json"), "utf-8"));
869
+ return config.senses?.mail?.enabled === true;
870
+ }
871
+ catch {
872
+ return false;
873
+ }
874
+ }
861
875
  exports.mailToolDefinitions = [
862
876
  {
863
877
  tool: {
@@ -397,12 +397,12 @@ exports.notesToolDefinitions = [
397
397
  type: "function",
398
398
  function: {
399
399
  name: "save_friend_note",
400
- description: "save something i learned about my friend. use type 'name' to update their display name, 'tool_preference' for presentation preferences, or 'note' for general context. For Sanctuary relationships, preference source is stated (the person said or confirmed it), observed (a revisable pattern i inferred), or default (a fallback until better evidence), and only communication or timing are accepted. Any friend may save key reachChannel (with source) to say which channel to reach them on outside a conversation: bluebubbles or teams; iMessage means bluebubbles. Other agents retain their existing integration-preference behavior and do not persist this provenance field. desired state and action authority belong in steward policy. notes and preferences improve orientation but never grant authority. set override=true when replacing an existing value.",
400
+ description: "save something i learned about my friend: type name (display name), tool_preference, or note. Sanctuary relationship preferences take source stated (they said it), observed (my revisable inference) or default, and only keys communication or timing. Any friend may save key reachChannel (with source): bluebubbles or teams, the channel to reach them on outside a conversation. Notes never grant authority; that belongs in steward policy. override=true replaces an existing value.",
401
401
  parameters: {
402
402
  type: "object",
403
403
  properties: {
404
404
  type: { type: "string", enum: ["name", "tool_preference", "note"], description: "what kind of information to save" },
405
- key: { type: "string", description: "category key (required for tool_preference and note; Sanctuary relationship preferences use communication or timing; reachChannel names the channel to reach this person on: bluebubbles or teams)" },
405
+ key: { type: "string", description: "category key (required for tool_preference and note)" },
406
406
  source: { type: "string", enum: ["stated", "observed", "default"], description: "preference provenance; required for Sanctuary relationship preferences and for reachChannel" },
407
407
  content: { type: "string", description: "the value to save" },
408
408
  override: { type: "string", enum: ["true", "false"], description: "set to 'true' to overwrite an existing value" },
@@ -803,20 +803,20 @@ exports.sessionToolDefinitions = [
803
803
  type: "function",
804
804
  function: {
805
805
  name: "send_message",
806
- description: "send a message to a friend's session. when the request is explicitly authorized from a trusted live chat, the harness will try to deliver immediately; otherwise it reports truthful queued/block/failure state. do not use friendId=self for user-requested private-return work; use ponder so the typed return contract can be tracked and surfaced once.",
806
+ description: "send a message to a friend's session. Delivers at once when authorized from a trusted live chat; otherwise reports queued, blocked or failed. For user-requested private-return work use ponder, not friendId=self.",
807
807
  parameters: {
808
808
  type: "object",
809
809
  properties: {
810
810
  friendId: { type: "string", description: "the friend UUID (or 'self')" },
811
- channel: { type: "string", description: "the channel: cli, teams, bluebubbles, voice, mcp, or legacy inner for private-runtime compatibility. channel=voice intentionally starts a live phone call to a trusted friend through the Voice sense." },
811
+ channel: { type: "string", description: "cli, teams, bluebubbles, voice (starts a live phone call to a trusted friend), mcp, or legacy inner" },
812
812
  key: { type: "string", description: "session key (defaults to 'session')" },
813
813
  content: { type: "string", description: "the message content to send" },
814
- voiceAudioSource: { type: "string", enum: ["tone", "url", "file"], description: "optional initial non-speech audio to play after the opening greeting when channel=voice" },
815
- voiceAudioUrl: { type: "string", description: "short audio URL for voiceAudioSource=url" },
816
- voiceAudioPath: { type: "string", description: "local audio file path for voiceAudioSource=file" },
817
- voiceAudioLabel: { type: "string", description: "short label for the initial voice audio" },
818
- voiceAudioToneHz: { type: "number", description: "tone frequency for voiceAudioSource=tone" },
819
- voiceAudioDurationMs: { type: "number", description: "initial audio duration in milliseconds" },
814
+ voiceAudioSource: { type: "string", enum: ["tone", "url", "file"], description: "voice only: non-speech audio after the greeting" },
815
+ voiceAudioUrl: { type: "string", description: "for url" },
816
+ voiceAudioPath: { type: "string", description: "for file" },
817
+ voiceAudioLabel: { type: "string", description: "label" },
818
+ voiceAudioToneHz: { type: "number", description: "for tone" },
819
+ voiceAudioDurationMs: { type: "number", description: "milliseconds" },
820
820
  },
821
821
  required: ["friendId", "channel", "content"],
822
822
  },
@@ -696,16 +696,16 @@ exports.tripToolDefinitions = [
696
696
  type: "function",
697
697
  function: {
698
698
  name: "trip_update_leg",
699
- description: "Update specific fields of an existing leg in a trip. Pass tripId, legId, and a JSON object of field updates (e.g. {status:\"cancelled\", confirmationCode:\"PNR123\"}). Existing evidence is preserved unless explicitly overwritten. Use this instead of trip_upsert when you only need to change one leg without re-emitting the whole record. The leg's `kind` cannot be changed (changing kind means a new leg). Requires trip_update_leg_preview first and its previewToken.",
699
+ description: "Update fields of one existing leg without re-emitting the trip; evidence is kept unless overwritten. `kind` cannot change (that is a new leg). Needs trip_update_leg_preview first and its previewToken.",
700
700
  parameters: {
701
701
  type: "object",
702
702
  properties: {
703
703
  tripId: { type: "string", description: "Canonical trip id." },
704
704
  legId: { type: "string", description: "Leg id within the trip." },
705
- updates: { type: "string", description: "JSON object of leg fields to update. Cannot include `legId` or `kind`. Common fields: status, confirmationCode, vendor, amount, checkInDate, checkOutDate, departureTime, arrivalTime, etc." },
706
- updatedAt: { type: "string", description: "ISO timestamp for the update. Used both for the leg's updatedAt and the trip's updatedAt." },
707
- updateReason: { type: "string", description: "One-line source or reason that makes this update correct. Required so semantic trip writes remain auditable." },
708
- previewToken: { type: "string", description: "Required. Get it from trip_update_leg_preview after inspecting the diff." },
705
+ updates: { type: "string", description: "JSON object of leg fields to update (not legId or kind)" },
706
+ updatedAt: { type: "string", description: "ISO timestamp for the update" },
707
+ updateReason: { type: "string", description: "One-line source or reason for this update" },
708
+ previewToken: { type: "string", description: "From trip_update_leg_preview" },
709
709
  },
710
710
  required: ["tripId", "legId", "updates", "updatedAt", "updateReason", "previewToken"],
711
711
  },
@@ -38,6 +38,7 @@ const tools_flow_1 = require("./tools-flow");
38
38
  const tools_steward_policy_1 = require("./tools-steward-policy");
39
39
  const tools_house_care_1 = require("./tools-house-care");
40
40
  const tools_shepherd_1 = require("./tools-shepherd");
41
+ const tools_mail_1 = require("./tools-mail");
41
42
  const tools_app_sessions_1 = require("./tools-app-sessions");
42
43
  const steward_policy_1 = require("../heart/steward-policy");
43
44
  const relationship_authorization_1 = require("./relationship-authorization");
@@ -102,7 +103,7 @@ Object.defineProperty(exports, "speakTool", { enumerable: true, get: function ()
102
103
  var tools_surface_2 = require("./tools-surface");
103
104
  Object.defineProperty(exports, "surfaceToolDef", { enumerable: true, get: function () { return tools_surface_2.surfaceToolDef; } });
104
105
  // All tool definitions in a single registry
105
- const additionalDefinitions = [...tools_chat_1.chatToolDefinitions, ...tools_teams_1.teamsToolDefinitions, ...ado_semantic_1.adoSemanticToolDefinitions, ...tools_github_1.githubToolDefinitions, ...tools_bundle_1.bundleToolDefinitions, ...tools_voice_1.voiceToolDefinitions, ...tools_unraid_1.unraidToolDefinitions, tools_steward_policy_1.stewardPolicyToolDefinition, ...tools_house_care_1.houseCareToolDefinitions, tools_surface_1.surfaceToolDefinition, ...tools_shepherd_1.shepherdToolDefinitions, ...tools_app_sessions_1.appSessionsToolDefinitions];
106
+ const additionalDefinitions = [...tools_chat_1.chatToolDefinitions, ...tools_teams_1.teamsToolDefinitions, ...ado_semantic_1.adoSemanticToolDefinitions, ...tools_github_1.githubToolDefinitions, ...tools_bundle_1.bundleToolDefinitions, ...tools_voice_1.voiceToolDefinitions, ...tools_unraid_1.unraidToolDefinitions, tools_steward_policy_1.stewardPolicyToolDefinition, ...tools_house_care_1.houseCareToolDefinitions, tools_surface_1.surfaceToolDefinition, ...tools_shepherd_1.shepherdToolDefinitions, ...tools_app_sessions_1.appSessionsToolDefinitions, ...tools_mail_1.mailToolDefinitions];
106
107
  const COMMERCE_AUTHORITY_TOOLS = new Set(["stripe_create_card", "flight_hold", "flight_book"]);
107
108
  class ToolSelectionError extends Error {
108
109
  }
@@ -183,6 +184,8 @@ function selectToolsForChannel(capabilities, toolPreferences, _context, provider
183
184
  ...((0, tools_shepherd_1.shepherdToolsEnabled)(context?.agentRoot ?? safeGetAgentRoot()) ? tools_shepherd_1.shepherdToolDefinitions : []),
184
185
  // The app-sessions tools exist only for an agent that turned the sense on in agent.json.
185
186
  ...((0, tools_app_sessions_1.appSessionsToolsEnabled)(context?.agentRoot ?? safeGetAgentRoot()) ? tools_app_sessions_1.appSessionsToolDefinitions : []),
187
+ // The mail tools exist only for an agent that turned the mail sense on in agent.json.
188
+ ...((0, tools_mail_1.mailToolsEnabled)(context?.agentRoot ?? safeGetAgentRoot()) ? tools_mail_1.mailToolDefinitions : []),
186
189
  ...tools_chat_1.chatToolDefinitions,
187
190
  ...(capabilities?.channel === "voice" ? tools_voice_1.voiceToolDefinitions : []),
188
191
  ...((0, tools_voice_local_1.localAudioToolGate)({ ...context, context: _context }).ok ? [tools_voice_local_1.voiceLocalAudioToolDefinition] : []),
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@ouro.bot/cli",
3
- "version": "0.1.0-alpha.1167",
3
+ "version": "0.1.0-alpha.1169",
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.1167",
9
+ "version": "0.1.0-alpha.1169",
10
10
  "bundleDependencies": [
11
11
  "@ouro.bot/friends"
12
12
  ],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ouro.bot/cli",
3
- "version": "0.1.0-alpha.1167",
3
+ "version": "0.1.0-alpha.1169",
4
4
  "engines": {
5
5
  "node": ">=22"
6
6
  },