@hmharness/kernel 0.23.36 → 0.23.38
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/dist/provider.js +14 -1
- package/dist/types.d.ts +17 -0
- package/dist/types.js +10 -0
- package/package.json +1 -1
package/dist/provider.js
CHANGED
|
@@ -44,7 +44,20 @@ export function parseRetryAfterMs(raw, maxMs = 120_000) {
|
|
|
44
44
|
}
|
|
45
45
|
export async function chat(cfg, messages, tools, opts = {}) {
|
|
46
46
|
const streaming = typeof opts.onDelta === 'function';
|
|
47
|
-
|
|
47
|
+
// Native image attachments (multimodal chat, 2026-10-22): a user message
|
|
48
|
+
// carrying `images` becomes OpenAI image_url content parts on the wire -
|
|
49
|
+
// the model sees the actual image. `content` stays plain text everywhere
|
|
50
|
+
// else (transcript/compaction/preview); the transformation is wire-only.
|
|
51
|
+
const wire = messages.map((m) => m.role === 'user' && m.images && m.images.length > 0
|
|
52
|
+
? {
|
|
53
|
+
role: m.role,
|
|
54
|
+
content: [
|
|
55
|
+
...(m.content ? [{ type: 'text', text: m.content }] : []),
|
|
56
|
+
...m.images.map((url) => ({ type: 'image_url', image_url: { url } })),
|
|
57
|
+
],
|
|
58
|
+
}
|
|
59
|
+
: { role: m.role, content: m.content, ...(m.tool_calls ? { tool_calls: m.tool_calls } : {}), ...(m.tool_call_id ? { tool_call_id: m.tool_call_id } : {}), ...(m.name ? { name: m.name } : {}) });
|
|
60
|
+
const body = { model: cfg.model, messages: wire };
|
|
48
61
|
if (tools && tools.length > 0)
|
|
49
62
|
body.tools = tools;
|
|
50
63
|
if (streaming) {
|
package/dist/types.d.ts
CHANGED
|
@@ -40,6 +40,15 @@ export interface Tool {
|
|
|
40
40
|
export interface ChatMessage {
|
|
41
41
|
role: 'system' | 'user' | 'assistant' | 'tool';
|
|
42
42
|
content: string | null;
|
|
43
|
+
/** Native image attachments (data URLs) for MULTIMODAL chat models
|
|
44
|
+
* (2026-10-22 default-multimodal policy): the provider assembles these
|
|
45
|
+
* into OpenAI image_url content parts on the wire, so the chat model
|
|
46
|
+
* sees the actual image instead of a pre-described text summary. Only
|
|
47
|
+
* user messages carry them; content stays plain text for every
|
|
48
|
+
* downstream consumer (transcript/compaction/preview are untouched).
|
|
49
|
+
* Text-only chat models never set this - they keep the describe-chain
|
|
50
|
+
* detour (chatVision prefix). */
|
|
51
|
+
images?: string[];
|
|
43
52
|
tool_calls?: Array<{
|
|
44
53
|
id: string;
|
|
45
54
|
type: 'function';
|
|
@@ -51,6 +60,14 @@ export interface ChatMessage {
|
|
|
51
60
|
tool_call_id?: string;
|
|
52
61
|
name?: string;
|
|
53
62
|
}
|
|
63
|
+
/**
|
|
64
|
+
* Default-multimodal policy (2026-10-22): the CHAT model is assumed to see
|
|
65
|
+
* images natively unless its provider is explicitly marked
|
|
66
|
+
* `supportsVision: false`. Callers use this to decide between sending
|
|
67
|
+
* images as native attachments (multimodal) and the describe-chain detour
|
|
68
|
+
* (text-only) - never unconditionally describing.
|
|
69
|
+
*/
|
|
70
|
+
export declare function chatSeesImages(p: ProviderConfig): boolean;
|
|
54
71
|
/** Connection settings for an OpenAI-compatible endpoint. */
|
|
55
72
|
export interface ProviderConfig {
|
|
56
73
|
baseUrl: string;
|
package/dist/types.js
CHANGED
|
@@ -3,6 +3,16 @@
|
|
|
3
3
|
* The kernel contract surface. Deliberately small: a Tool, a chat message,
|
|
4
4
|
* a provider config. Everything else in hmharness composes from these.
|
|
5
5
|
*/
|
|
6
|
+
/**
|
|
7
|
+
* Default-multimodal policy (2026-10-22): the CHAT model is assumed to see
|
|
8
|
+
* images natively unless its provider is explicitly marked
|
|
9
|
+
* `supportsVision: false`. Callers use this to decide between sending
|
|
10
|
+
* images as native attachments (multimodal) and the describe-chain detour
|
|
11
|
+
* (text-only) - never unconditionally describing.
|
|
12
|
+
*/
|
|
13
|
+
export function chatSeesImages(p) {
|
|
14
|
+
return p.supportsVision !== false;
|
|
15
|
+
}
|
|
6
16
|
/** Resolve a purpose to a concrete provider config (routing > legacy fields).
|
|
7
17
|
*
|
|
8
18
|
* For 'vision' a provider explicitly marked `supportsVision: false` is NOT
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hmharness/kernel",
|
|
3
|
-
"version": "0.23.
|
|
3
|
+
"version": "0.23.38",
|
|
4
4
|
"description": "hmharness kernel: tool registry, provider adapters, the agent loop, session log, config. Zero runtime dependencies (Node >=22 native fetch).",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|