@opencow-ai/opencow-agent-sdk 0.4.10 → 0.4.12

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.
@@ -45,7 +45,7 @@
45
45
  * `src/session/canonical/index.js`.
46
46
  */
47
47
  import { APIError, APIUserAbortError } from '@anthropic-ai/sdk';
48
- import type { BetaBase64ImageSource, BetaContentBlock, BetaContentBlockParam, BetaImageBlockParam, BetaMessage, BetaMessageParam, BetaRawMessageStreamEvent, BetaRedactedThinkingBlock, BetaRedactedThinkingBlockParam, BetaTextBlock, BetaTextBlockParam, BetaThinkingBlock, BetaThinkingBlockParam, BetaToolResultBlockParam, BetaToolUnion, BetaToolUseBlock, BetaToolUseBlockParam, BetaUsage } from '@anthropic-ai/sdk/resources/beta/messages/messages.mjs';
48
+ import type { BetaBase64ImageSource, BetaURLImageSource, BetaContentBlock, BetaContentBlockParam, BetaImageBlockParam, BetaMessage, BetaMessageParam, BetaRawMessageStreamEvent, BetaRedactedThinkingBlock, BetaRedactedThinkingBlockParam, BetaTextBlock, BetaTextBlockParam, BetaThinkingBlock, BetaThinkingBlockParam, BetaToolResultBlockParam, BetaToolUnion, BetaToolUseBlock, BetaToolUseBlockParam, BetaUsage } from '@anthropic-ai/sdk/resources/beta/messages/messages.mjs';
49
49
  export type CanonicalVersion = 'v1';
50
50
  /**
51
51
  * Current canonical schema version. Consumers that persist canonical
@@ -98,6 +98,10 @@ export type CanonicalStreamEvent = BetaRawMessageStreamEvent;
98
98
  export type CanonicalImageBlockParam = BetaImageBlockParam;
99
99
  /** Base64-encoded image source inside an image block. */
100
100
  export type CanonicalBase64ImageSource = BetaBase64ImageSource;
101
+ /** External-URL image source inside an image block. */
102
+ export type CanonicalURLImageSource = BetaURLImageSource;
103
+ /** Discriminated union of every image-source variant carried by an image block. */
104
+ export type CanonicalImageSource = CanonicalBase64ImageSource | CanonicalURLImageSource;
101
105
  /** Token-usage metadata carried on assistant messages and deltas. */
102
106
  export type CanonicalUsage = BetaUsage;
103
107
  /**
@@ -48,6 +48,22 @@ export type ValidationResult = {
48
48
  message: string;
49
49
  errorCode: number;
50
50
  };
51
+ /**
52
+ * Host-supplied media uploader (see `Options.uploadMedia`). Given media
53
+ * bytes + media type, returns a fetchable URL the model side can render,
54
+ * or `null` when upload is unavailable. Media-neutral: serves any binary a
55
+ * tool produces (image / PDF / extracted page image, ...), driven by
56
+ * `mediaType`. The SDK passes the **compressed** buffer (post token-budget),
57
+ * so the materialized bytes stay bounded.
58
+ *
59
+ * Returning `null` or throwing means "uploader unavailable" — callers fall
60
+ * back to inline base64. Pure port: no SDK/CLI behavior depends on it being
61
+ * set, so standalone runs are unaffected.
62
+ */
63
+ export type UploadMediaFn = (input: {
64
+ bytes: Uint8Array;
65
+ mediaType: string;
66
+ }) => Promise<string | null>;
51
67
  export type ToolPermissionContext = DeepImmutable<{
52
68
  mode: PermissionMode;
53
69
  additionalWorkingDirectories: Map<string, AdditionalWorkingDirectory>;
@@ -143,6 +159,13 @@ export type ToolRuntimeContext = {
143
159
  toolInput: Record<string, unknown>;
144
160
  toolUseId: string;
145
161
  }) => void | Promise<void>;
162
+ /**
163
+ * Host-injected media uploader (see `Options.uploadMedia`). When present,
164
+ * media-producing tools (FileReadTool) upload the compressed bytes and
165
+ * carry a URL instead of inline base64. Absent → base64 (zero-config
166
+ * standalone behavior).
167
+ */
168
+ uploadMedia?: UploadMediaFn;
146
169
  updateFileHistoryState: (updater: (prev: FileHistoryState) => FileHistoryState) => void;
147
170
  updateAttributionState: (updater: (prev: AttributionState) => AttributionState) => void;
148
171
  setConversationId?: (id: UUID) => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opencow-ai/opencow-agent-sdk",
3
- "version": "0.4.10",
3
+ "version": "0.4.12",
4
4
  "description": "Claude Code opened to any LLM — OpenAI, Gemini, DeepSeek, Ollama, and 200+ models",
5
5
  "type": "module",
6
6
  "main": "./dist/sdk.js",