@ouro.bot/cli 0.1.0-alpha.1720 → 0.1.0-alpha.1722

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,16 @@
1
1
  {
2
2
  "_note": "Each pull request writes its own change note under changes/; the release job on main gives each landed change its version and adds the notes here (scripts/release-version.cjs). On main this file stops at the last version set by hand; the published package has every release. Agents read this file directly via read_file to understand what changed between versions.",
3
3
  "versions": [
4
+ {
5
+ "version": "0.1.0-alpha.1722",
6
+ "changes": [
7
+ "An Anthropic workspace that has hit its spend limit (\"workspace API usage limits\") is now treated as out of quota instead of an unknown failure, so the repair line says to restore quota or pick another provider rather than send you to `ouro auth`. The startup provider ping now logs why it failed.",
8
+ "The Butler's product registration now says which tool calls its Telegram turns must make before they answer. Telegram used to build these itself:",
9
+ "The owner's questions about storage, stale Docker care, full visibility, install state and version.",
10
+ "The household's media questions.",
11
+ "On the Butler's image, the same contracts apply in the same order. An agent with no product never gets them."
12
+ ]
13
+ },
4
14
  {
5
15
  "version": "0.1.0-alpha.1720",
6
16
  "changes": [
@@ -1,5 +1,5 @@
1
1
  {
2
- "runtimeVersion": "0.1.0-alpha.1720",
2
+ "runtimeVersion": "0.1.0-alpha.1722",
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.1720</Repository>
4
+ <Repository>ghcr.io/ourostack/ouroboros-butler:0.1.0-alpha.1722</Repository>
5
5
  <Registry>https://github.com/ourostack/ouroboros/pkgs/container/ouroboros-butler</Registry>
6
6
  <Network>host</Network>
7
7
  <Shell>sh</Shell>
@@ -21,6 +21,7 @@ exports.productSenseOwnerReply = productSenseOwnerReply;
21
21
  exports.productAcceptanceMarker = productAcceptanceMarker;
22
22
  exports.productAcceptanceEventMeta = productAcceptanceEventMeta;
23
23
  exports.productRunAcceptanceApproved = productRunAcceptanceApproved;
24
+ exports.productSenseTurnContracts = productSenseTurnContracts;
24
25
  const runtime_1 = require("../../nerves/runtime");
25
26
  const container_runtime_1 = require("../daemon/container-runtime");
26
27
  /** The seam version this harness runs. A product built for another stops the start. */
@@ -311,3 +312,17 @@ function productRunAcceptanceApproved(agentName, approval, operation) {
311
312
  const acceptance = productFor(agentName)?.acceptance;
312
313
  return acceptance ? acceptance.runApproved(approval, operation) : operation();
313
314
  }
315
+ /** The tool calls a turn on the sense must make for the product's own agent (J6), or none. A throw from the product fails the turn. */
316
+ async function productSenseTurnContracts(sense, input) {
317
+ const product = productFor(input.agentName);
318
+ const own = product?.senses?.[sense]?.turnContracts;
319
+ if (!own)
320
+ return { contracts: [] };
321
+ try {
322
+ return await own(input);
323
+ }
324
+ catch (error) {
325
+ hookFailed(product, "senses.turnContracts", input.agentName, error, "the product's turn contracts failed, so the turn fails");
326
+ throw error;
327
+ }
328
+ }
@@ -89,7 +89,7 @@ async function pingProviderInChild(provider, config, options = {}, deps = {}) {
89
89
  const outcome = await (deps.runChild ?? runProviderPingChild)(JSON.stringify(request));
90
90
  const result = parsePingResult(outcome.stdout);
91
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 } });
92
+ (0, runtime_1.emitNervesEvent)({ component: "engine", event: "engine.provider_ping_child_done", message: "provider ping ran in a child process", meta: result.ok ? { provider, ok: true } : { provider, ok: false, classification: result.classification, reason: result.message } });
93
93
  return result;
94
94
  }
95
95
  failure = `exit ${outcome.code} without a result`;
@@ -304,12 +304,13 @@ function mergeAnthropicToolArguments(current, partial) {
304
304
  }
305
305
  return current + partial;
306
306
  }
307
- // An org whose prepaid API credits are used up gets HTTP 400 (or 402) with this phrase. That is a
308
- // usage limit, not a malformed request, so failover tells the human the right thing.
309
- const ANTHROPIC_CREDIT_LOW_PHRASE = "credit balance is too low";
307
+ // An org whose prepaid API credits are used up, or whose workspace hit its spend limit ("You have reached your
308
+ // specified workspace API usage limits. You will regain access on <date>"), gets HTTP 400 (or 402) with one of
309
+ // these phrases. That is a usage limit, not a malformed request, so failover tells the human the right thing.
310
+ const ANTHROPIC_USAGE_LIMIT_PHRASES = ["credit balance is too low", "workspace api usage limits"];
310
311
  function isAnthropicCreditExhausted(error) {
311
312
  const status = error.status;
312
- return (status === 400 || status === 402) && error.message.toLowerCase().includes(ANTHROPIC_CREDIT_LOW_PHRASE);
313
+ return (status === 400 || status === 402) && ANTHROPIC_USAGE_LIMIT_PHRASES.some((phrase) => error.message.toLowerCase().includes(phrase));
313
314
  }
314
315
  function classifyAnthropicError(error) {
315
316
  if (isAnthropicCreditExhausted(error))
@@ -34,6 +34,7 @@ var __importStar = (this && this.__importStar) || (function () {
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.product = exports.BUTLER_HOUSE_CARE_TOOL_NAMES = void 0;
37
+ exports.butlerTurnContracts = butlerTurnContracts;
37
38
  exports.selectButlerTools = selectButlerTools;
38
39
  const path = __importStar(require("node:path"));
39
40
  const butler_agent_1 = require("../heart/butler-agent");
@@ -106,6 +107,40 @@ async function runSanctuaryHealth(input) {
106
107
  * core's whole tool registry, and every process on the image loads the product. Core registers them, so a turn gets core's own.
107
108
  */
108
109
  exports.BUTLER_HOUSE_CARE_TOOL_NAMES = ["house_sweep", "house_digest_send"];
110
+ /**
111
+ * The tool calls the Butler's Telegram turns must make before they answer. The owner's questions about storage, stale
112
+ * Docker care, full visibility, install state and version, and the household's media questions, each have a contract.
113
+ * Everyone else's turns have none. The contract modules load at the turn, not with the product.
114
+ */
115
+ async function butlerTurnContracts(input) {
116
+ const owner = input.profileId === "sanctuary-owner";
117
+ if (!owner && input.profileId !== "sanctuary-household")
118
+ return { contracts: [] };
119
+ const [visibility, install, media, storage] = await Promise.all([
120
+ Promise.resolve().then(() => __importStar(require("../senses/sanctuary-full-visibility-contract"))),
121
+ Promise.resolve().then(() => __importStar(require("../senses/sanctuary-install-state-contract"))),
122
+ Promise.resolve().then(() => __importStar(require("../senses/sanctuary-media-catalog-contract"))),
123
+ Promise.resolve().then(() => __importStar(require("../senses/sanctuary-storage-optimization-contract"))),
124
+ ]);
125
+ const tools = input.advertisedToolNames;
126
+ if (!owner) {
127
+ const mediaCatalog = media.sanctuaryMediaCatalogRequiredToolCalls(input.userMessage, tools);
128
+ return { contracts: mediaCatalog ? [mediaCatalog] : [] };
129
+ }
130
+ // Built in the order Telegram built them, so their obligation events log in the same order.
131
+ const storageOptimization = storage.sanctuaryStorageOptimizationRequiredToolCalls(input.userMessage, tools);
132
+ const staleDockerCare = visibility.sanctuaryStaleDockerCareRequiredToolCalls(input.activeCares, input.careEvidenceNow, tools);
133
+ const fullVisibility = visibility.sanctuaryFullVisibilityRequiredToolCalls(input.userMessage, tools, () => staleDockerCare?.currentRiskClaims() ?? []);
134
+ const contracts = [
135
+ storageOptimization,
136
+ fullVisibility,
137
+ staleDockerCare,
138
+ media.sanctuaryMediaCatalogRequiredToolCalls(input.userMessage, tools),
139
+ install.sanctuaryInstallStateRequiredToolCalls(input.userMessage, tools),
140
+ install.sanctuaryVersionQuestionRequiredToolCalls(input.userMessage, tools),
141
+ ].filter((contract) => contract !== undefined);
142
+ return { contracts, ...(fullVisibility ? { emptyResponseFallback: fullVisibility.emptyResponseFallback } : {}) };
143
+ }
109
144
  /** The tools the Butler adds to a turn's menu: the root-host tool in the owner's Telegram chat, and house care on its own private turns. */
110
145
  function selectButlerTools(input) {
111
146
  if (input.channel === "telegram") {
@@ -179,6 +214,8 @@ exports.product = {
179
214
  },
180
215
  // "Why aren't my shows downloading?" gets the household's credit top-up reply, never the downloaders' internals.
181
216
  presentOwnerReply: (agentName, { request, text }) => (0, sanctuary_download_credit_presentation_1.presentSanctuaryDownloadCreditReply)(agentName, request === "why aren't my shows downloading?", text),
217
+ // The owner's and the household's questions about the house must be answered from the house's tools, not from memory.
218
+ turnContracts: butlerTurnContracts,
182
219
  },
183
220
  },
184
221
  // J8: the Butler takes delegated commands from peers the operator granted, each announced in the owner's own Telegram
@@ -84,10 +84,6 @@ const root_host_approval_runtime_1 = require("./root-host-approval-runtime");
84
84
  const tools_sanctuary_host_1 = require("../repertoire/tools-sanctuary-host");
85
85
  const active_1 = require("../heart/product/active");
86
86
  const sanctuary_runtime_2 = require("./sanctuary-runtime");
87
- const sanctuary_full_visibility_contract_1 = require("./sanctuary-full-visibility-contract");
88
- const sanctuary_install_state_contract_1 = require("./sanctuary-install-state-contract");
89
- const sanctuary_media_catalog_contract_1 = require("./sanctuary-media-catalog-contract");
90
- const sanctuary_storage_optimization_contract_1 = require("./sanctuary-storage-optimization-contract");
91
87
  const sanctuary_grounding_1 = require("./sanctuary-grounding");
92
88
  const telegram_approval_runtime_1 = require("./telegram-approval-runtime");
93
89
  const telegram_audit_ledger_1 = require("./telegram-audit-ledger");
@@ -1429,29 +1425,16 @@ function createTelegramSenseApp(options) {
1429
1425
  return async ({ runAgentOptions, activeCares = [], careEvidenceNow = Date.now() }) => {
1430
1426
  const relationshipAuthorization = await resolveLiveRelationshipAuthorization(relationshipCoordinates);
1431
1427
  const isSanctuaryOwner = (0, butler_agent_1.isButlerAgent)(options.agentName) && relationshipAuthorization.profileId === "sanctuary-owner";
1432
- const isSanctuaryHouseholdConversation = (0, butler_agent_1.isButlerAgent)(options.agentName)
1433
- && (relationshipAuthorization.profileId === "sanctuary-owner" || relationshipAuthorization.profileId === "sanctuary-household");
1434
- const storageOptimization = isSanctuaryOwner
1435
- ? (0, sanctuary_storage_optimization_contract_1.sanctuaryStorageOptimizationRequiredToolCalls)(input.userMessage, relationshipAuthorization.advertisedToolNames)
1436
- : undefined;
1437
- const staleDockerCare = isSanctuaryOwner
1438
- ? (0, sanctuary_full_visibility_contract_1.sanctuaryStaleDockerCareRequiredToolCalls)(activeCares, careEvidenceNow, relationshipAuthorization.advertisedToolNames)
1439
- : undefined;
1440
- const fullVisibility = isSanctuaryOwner
1441
- ? (0, sanctuary_full_visibility_contract_1.sanctuaryFullVisibilityRequiredToolCalls)(input.userMessage, relationshipAuthorization.advertisedToolNames, () => staleDockerCare?.currentRiskClaims() ?? [])
1442
- : undefined;
1443
- const mediaCatalog = isSanctuaryHouseholdConversation
1444
- ? (0, sanctuary_media_catalog_contract_1.sanctuaryMediaCatalogRequiredToolCalls)(input.userMessage, relationshipAuthorization.advertisedToolNames)
1445
- : undefined;
1446
- const installState = isSanctuaryOwner
1447
- ? (0, sanctuary_install_state_contract_1.sanctuaryInstallStateRequiredToolCalls)(input.userMessage, relationshipAuthorization.advertisedToolNames)
1448
- : undefined;
1449
- const versionQuestion = isSanctuaryOwner
1450
- ? (0, sanctuary_install_state_contract_1.sanctuaryVersionQuestionRequiredToolCalls)(input.userMessage, relationshipAuthorization.advertisedToolNames)
1451
- : undefined;
1452
- if (input.fullVisibilityProgress && fullVisibility)
1453
- input.fullVisibilityProgress.fallback = fullVisibility.emptyResponseFallback;
1454
- const contracts = [storageOptimization, fullVisibility, staleDockerCare, mediaCatalog, installState, versionQuestion].filter(Boolean);
1428
+ const { contracts, emptyResponseFallback } = await (0, active_1.productSenseTurnContracts)("telegram", {
1429
+ agentName: options.agentName,
1430
+ profileId: relationshipAuthorization.profileId,
1431
+ userMessage: input.userMessage,
1432
+ advertisedToolNames: relationshipAuthorization.advertisedToolNames,
1433
+ activeCares,
1434
+ careEvidenceNow,
1435
+ });
1436
+ if (input.fullVisibilityProgress && emptyResponseFallback)
1437
+ input.fullVisibilityProgress.fallback = emptyResponseFallback;
1455
1438
  const ownedNames = contracts.map((contract) => new Set(contract.names));
1456
1439
  const requiredToolCalls = contracts.length === 0 ? undefined : {
1457
1440
  names: [...new Set(contracts.flatMap((contract) => [...contract.names]))],
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@ouro.bot/cli",
3
- "version": "0.1.0-alpha.1720",
3
+ "version": "0.1.0-alpha.1722",
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.1720",
9
+ "version": "0.1.0-alpha.1722",
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.1720",
3
+ "version": "0.1.0-alpha.1722",
4
4
  "description": "Ouroboros, the agent harness: agents with durable memory that live where you talk (terminal, Teams, iMessage, mail, voice) and use real tools. Start with npx ouro.bot@latest.",
5
5
  "homepage": "https://ouroboros.bot/",
6
6
  "engines": {