@ouro.bot/cli 0.1.0-alpha.1178 → 0.1.0-alpha.1179

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,14 @@
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.1179",
6
+ "changes": [
7
+ "Describe Teams screenshots and image attachments through the agent's configured vision provider without requiring a MiniMax key.",
8
+ "Reject truncated native image descriptions and preserve provider completion status and attachment timeouts.",
9
+ "Preserve Responses API failure messages and reject partial image descriptions from failed streams."
10
+ ]
11
+ },
4
12
  {
5
13
  "version": "0.1.0-alpha.1178",
6
14
  "changes": [
@@ -1,5 +1,5 @@
1
1
  {
2
- "runtimeVersion": "0.1.0-alpha.1178",
2
+ "runtimeVersion": "0.1.0-alpha.1179",
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.1178</Repository>
4
+ <Repository>ghcr.io/ourostack/ouroboros-butler:0.1.0-alpha.1179</Repository>
5
5
  <Registry>https://github.com/ourostack/ouroboros/pkgs/container/ouroboros-butler</Registry>
6
6
  <Network>host</Network>
7
7
  <Shell>sh</Shell>
@@ -33,7 +33,7 @@ var __importStar = (this && this.__importStar) || (function () {
33
33
  };
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.IMAGE_DESCRIPTION_TEXT = exports.ATTACHMENT_WORDS_TIMEOUT_MS = void 0;
36
+ exports.UnsupportedImageModelError = exports.IMAGE_DESCRIPTION_TEXT = exports.ATTACHMENT_WORDS_TIMEOUT_MS = void 0;
37
37
  exports.imageDescriptionPrompt = imageDescriptionPrompt;
38
38
  exports.imageFileDataUrl = imageFileDataUrl;
39
39
  exports.describeImage = describeImage;
@@ -41,6 +41,8 @@ exports.attachmentWords = attachmentWords;
41
41
  exports.attachmentTurnLines = attachmentTurnLines;
42
42
  const fs = __importStar(require("node:fs/promises"));
43
43
  const runtime_1 = require("../../nerves/runtime");
44
+ const identity_1 = require("../identity");
45
+ const model_capabilities_1 = require("../model-capabilities");
44
46
  const provider_credentials_1 = require("../provider-credentials");
45
47
  const minimax_1 = require("../providers/minimax");
46
48
  const minimax_vlm_1 = require("../providers/minimax-vlm");
@@ -61,14 +63,84 @@ async function imageFileDataUrl(filePath, mimeType) {
61
63
  const normalizedMime = mimeType?.trim().toLowerCase() || "image/jpeg";
62
64
  return `data:${normalizedMime};base64,${(await fs.readFile(filePath)).toString("base64")}`;
63
65
  }
64
- /** Describe an image with the agent's MiniMax vision model. Throws a reason that names the fix. */
66
+ class UnsupportedImageModelError extends Error {
67
+ }
68
+ exports.UnsupportedImageModelError = UnsupportedImageModelError;
69
+ const ignoreProgress = () => { };
70
+ /** Describe with the configured outward provider; never borrow another provider's credentials. */
65
71
  async function describeImage(agentName, params) {
66
- const credential = await (0, provider_credentials_1.readProviderCredentialRecord)(agentName, "minimax");
67
- const apiKey = credential.ok ? credential.record.credentials.apiKey : undefined;
68
- if (!apiKey) {
69
- throw new Error("image understanding needs a MiniMax API key in the agent vault — run `ouro auth --agent <agent> --provider minimax`");
72
+ (0, runtime_1.emitNervesEvent)({
73
+ component: "senses",
74
+ event: "senses.image_description_start",
75
+ message: "describing an image with the configured provider",
76
+ meta: { attachmentId: params.attachmentGuid },
77
+ });
78
+ try {
79
+ // Loaded at call time because the provider runtime also imports the attachment tools.
80
+ const { getProviderRuntime } = await Promise.resolve().then(() => __importStar(require("../core")));
81
+ const runtime = await getProviderRuntime("human", { agentName, agentRoot: params.agentRoot ?? (0, identity_1.getAgentRoot)(agentName) });
82
+ let description;
83
+ if ((0, model_capabilities_1.getModelCapabilities)(runtime.model).vision === true) {
84
+ const messages = [{
85
+ role: "user",
86
+ content: [
87
+ { type: "text", text: params.prompt },
88
+ { type: "image_url", image_url: { url: params.imageDataUrl } },
89
+ ],
90
+ }];
91
+ runtime.resetTurnState(messages);
92
+ const signal = params.timeoutMs === undefined ? undefined : AbortSignal.timeout(params.timeoutMs);
93
+ const result = await runtime.streamTurn({
94
+ messages,
95
+ activeTools: [],
96
+ signal,
97
+ callbacks: {
98
+ onModelStart: ignoreProgress,
99
+ onModelStreamStart: ignoreProgress,
100
+ onTextChunk: ignoreProgress,
101
+ onReasoningChunk: ignoreProgress,
102
+ onToolStart: ignoreProgress,
103
+ onToolEnd: ignoreProgress,
104
+ onError(error) { throw error; },
105
+ },
106
+ });
107
+ signal?.throwIfAborted();
108
+ if (!result.content.trim() || result.toolCalls.length > 0 || result.termination?.refused
109
+ || result.termination?.finishReason === "length" || result.termination?.finishReason === "incomplete"
110
+ || result.termination?.finishReason === "content_filter") {
111
+ throw new Error(`image description from ${runtime.id} (${runtime.model}) was empty, refused or incomplete; retry the image request`);
112
+ }
113
+ description = result.content;
114
+ }
115
+ else if (runtime.id === "minimax") {
116
+ const credential = await (0, provider_credentials_1.readProviderCredentialRecord)(agentName, "minimax");
117
+ const apiKey = credential.ok ? credential.record.credentials.apiKey : undefined;
118
+ if (!apiKey) {
119
+ throw new Error("image understanding needs a MiniMax API key in the agent vault — human-required: run `ouro auth --agent <agent> --provider minimax`");
120
+ }
121
+ description = await (0, minimax_vlm_1.minimaxVlmDescribe)({ ...params, apiKey: String(apiKey), baseURL: minimax_1.MINIMAX_PROVIDER_BASE_URL });
122
+ }
123
+ else {
124
+ throw new UnsupportedImageModelError(`image understanding: configured outward model ${runtime.id} (${runtime.model}) does not support images; human-choice: select a vision-capable outward model with \`ouro use --agent ${agentName} --lane outward --provider <provider> --model <model>\``);
125
+ }
126
+ (0, runtime_1.emitNervesEvent)({
127
+ component: "senses",
128
+ event: "senses.image_description_end",
129
+ message: "image description received",
130
+ meta: { provider: runtime.id, model: runtime.model, descriptionLength: description.length },
131
+ });
132
+ return description;
133
+ }
134
+ catch (error) {
135
+ (0, runtime_1.emitNervesEvent)({
136
+ level: "warn",
137
+ component: "senses",
138
+ event: "senses.image_description_error",
139
+ message: "image description unavailable",
140
+ meta: { attachmentId: params.attachmentGuid },
141
+ });
142
+ throw error;
70
143
  }
71
- return (0, minimax_vlm_1.minimaxVlmDescribe)({ apiKey: String(apiKey), baseURL: minimax_1.MINIMAX_PROVIDER_BASE_URL, ...params });
72
144
  }
73
145
  /** Turn stored attachments into words for a text-only turn. Other kinds stay listed in the attachment block for the tools. */
74
146
  async function attachmentWords(records, context) {
@@ -84,6 +156,8 @@ async function attachmentWords(records, context) {
84
156
  imageDataUrl: await imageFileDataUrl(image.path, image.mimeType),
85
157
  attachmentGuid: record.id,
86
158
  mimeType: image.mimeType,
159
+ agentRoot: context.agentRoot,
160
+ timeoutMs: context.timeoutMs,
87
161
  });
88
162
  lines.push(exports.IMAGE_DESCRIPTION_TEXT.description(description));
89
163
  }
@@ -372,6 +372,7 @@ async function streamAnthropicMessages(client, model, request, options = { claud
372
372
  let content = "";
373
373
  let streamStarted = false;
374
374
  let usage;
375
+ let termination;
375
376
  const toolCalls = new Map();
376
377
  const thinkingBlocks = new Map();
377
378
  const redactedBlocks = new Map();
@@ -467,6 +468,11 @@ async function streamAnthropicMessages(client, model, request, options = { claud
467
468
  continue;
468
469
  }
469
470
  if (eventType === "message_delta") {
471
+ const stopReason = event.delta?.stop_reason;
472
+ if (stopReason === "max_tokens" || stopReason === "model_context_window_exceeded"
473
+ || stopReason === "pause_turn" || stopReason === "refusal") {
474
+ termination = { finishReason: "incomplete", refused: stopReason === "refusal" };
475
+ }
470
476
  const rawUsage = event.usage;
471
477
  if (rawUsage && typeof rawUsage === "object") {
472
478
  usage = toAnthropicUsage(rawUsage);
@@ -508,6 +514,7 @@ async function streamAnthropicMessages(client, model, request, options = { claud
508
514
  toolCalls: completedToolCalls,
509
515
  outputItems,
510
516
  usage,
517
+ ...(termination ? { termination } : {}),
511
518
  settleStreamed: answerStreamer.streamed,
512
519
  ...(settleFinalization ? { settleFinalization } : {}),
513
520
  };
@@ -788,6 +788,7 @@ async function streamResponsesApi(client, createParams, callbacks, signal, eager
788
788
  let streamStarted = false;
789
789
  const toolCalls = [];
790
790
  const outputItems = [];
791
+ let incomplete = false;
791
792
  let currentToolCall = null;
792
793
  let usage;
793
794
  const answerStreamer = new SettleStreamer(callbacks, eagerSettleStreaming);
@@ -856,8 +857,16 @@ async function streamResponsesApi(client, createParams, callbacks, signal, eager
856
857
  }
857
858
  break;
858
859
  }
860
+ case "response.failed":
861
+ case "response.incomplete":
859
862
  case "response.completed":
860
863
  case "response.done": {
864
+ if (event.type === "response.failed" || event.response?.status === "failed") {
865
+ const message = event.response?.error?.message;
866
+ throw new Error(`Responses API failed: ${typeof message === "string" ? message : "without error details"}`);
867
+ }
868
+ if (event.type === "response.incomplete" || event.response?.status === "incomplete")
869
+ incomplete = true;
861
870
  const u = event.response?.usage;
862
871
  if (u) {
863
872
  usage = {
@@ -911,6 +920,7 @@ async function streamResponsesApi(client, createParams, callbacks, signal, eager
911
920
  toolCalls,
912
921
  outputItems,
913
922
  usage,
923
+ ...(incomplete ? { termination: { finishReason: "incomplete", refused: false } } : {}),
914
924
  settleStreamed: answerStreamer.streamed,
915
925
  ...(settleFinalization ? { settleFinalization } : {}),
916
926
  };
@@ -243,17 +243,19 @@ exports.attachmentToolDefinitions = [
243
243
  description = await (0, understand_1.describeImage)(agentName, { prompt, imageDataUrl, attachmentGuid: attachmentId, mimeType: materialized.mimeType });
244
244
  }
245
245
  catch (error) {
246
- if (!/MiniMax API key/.test(normalizeThrownReason(error)))
247
- throw error;
246
+ const reason = normalizeThrownReason(error);
247
+ const missingMinimaxKey = /MiniMax API key/.test(reason);
248
248
  return (0, tool_results_1.frictionToolResult)("describe_image", {
249
249
  kind: "external_blocker",
250
- recoverability: "blocked",
251
- summary: "MiniMax credentials are missing, so image understanding is unavailable until credentials are fixed.",
252
- signature: "describe_image:minimax-missing-key",
250
+ recoverability: missingMinimaxKey || error instanceof understand_1.UnsupportedImageModelError ? "blocked" : "retryable",
251
+ summary: reason,
252
+ signature: missingMinimaxKey ? "describe_image:minimax-missing-key" : "describe_image:provider-unavailable",
253
253
  suggested_next_actions: [
254
254
  {
255
255
  kind: "message",
256
- message: "Run `ouro auth --agent <agent> --provider minimax`, then retry describe_image.",
256
+ message: missingMinimaxKey
257
+ ? "Human-required: run `ouro auth --agent <agent> --provider minimax`, then retry describe_image."
258
+ : reason,
257
259
  },
258
260
  ],
259
261
  });
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@ouro.bot/cli",
3
- "version": "0.1.0-alpha.1178",
3
+ "version": "0.1.0-alpha.1179",
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.1178",
9
+ "version": "0.1.0-alpha.1179",
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.1178",
3
+ "version": "0.1.0-alpha.1179",
4
4
  "engines": {
5
5
  "node": ">=22"
6
6
  },