mu-harness 0.22.0 → 0.22.1

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.
@@ -164,6 +164,13 @@ export function webSocketAdapter(opts) {
164
164
  const frame = await modelsFrame();
165
165
  if (frame)
166
166
  push(frame);
167
+ // Detect the new model's input modalities (loads the model) and re-advertise.
168
+ const modalities = await harness.models.capabilities(msg.ref).catch(() => undefined);
169
+ if (modalities) {
170
+ caps.vision = modalities.vision;
171
+ caps.audio = modalities.audio;
172
+ push({ type: 'capabilities', vision: caps.vision, audio: caps.audio });
173
+ }
167
174
  return;
168
175
  }
169
176
  case 'subagent:dispatch': {
@@ -1,4 +1,4 @@
1
- import type { Provider } from 'mu-core';
1
+ import type { ModelModalities, Provider } from 'mu-core';
2
2
  export interface ModelRegistryOptions {
3
3
  providers: Record<string, Provider>;
4
4
  default: string;
@@ -12,5 +12,7 @@ export interface ModelRegistry {
12
12
  readonly providers: string[];
13
13
  select(ref: string): void;
14
14
  resolve(ref?: string): ResolvedModel;
15
+ /** Probe a model's input modalities via its provider (may load the model). Undefined if unsupported. */
16
+ capabilities(ref?: string): Promise<ModelModalities | undefined>;
15
17
  }
16
18
  export declare const createModelRegistry: (options: ModelRegistryOptions) => ModelRegistry;
@@ -26,5 +26,9 @@ export const createModelRegistry = (options) => {
26
26
  selected = ref;
27
27
  },
28
28
  resolve,
29
+ capabilities: async (ref) => {
30
+ const { provider, model } = resolve(ref);
31
+ return provider.capabilities ? await provider.capabilities(model) : undefined;
32
+ },
29
33
  };
30
34
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mu-harness",
3
- "version": "0.22.0",
3
+ "version": "0.22.1",
4
4
  "description": "Agent harness: createHarness wires mu-core into a host — XDG paths, model registry, plugins, disk-loaded agents & skills, sub-agents, sessions (JSONL + SQLite catalog), slash commands, permission/approval hooks, an optional scheduler, and a composable TUI chat app",
5
5
  "license": "MIT",
6
6
  "main": "./script/index.js",
@@ -23,8 +23,8 @@
23
23
  "@swc/wasm-typescript": "^1.15.0",
24
24
  "cli-highlight": "^2.1.11",
25
25
  "croner": "^9.0.0",
26
- "mu-core": "^0.22.0",
27
- "mu-tui": "^0.22.0",
26
+ "mu-core": "^0.22.1",
27
+ "mu-tui": "^0.22.1",
28
28
  "ws": "^8.18.0"
29
29
  },
30
30
  "_generatedBy": "dnt@dev",
@@ -167,6 +167,13 @@ function webSocketAdapter(opts) {
167
167
  const frame = await modelsFrame();
168
168
  if (frame)
169
169
  push(frame);
170
+ // Detect the new model's input modalities (loads the model) and re-advertise.
171
+ const modalities = await harness.models.capabilities(msg.ref).catch(() => undefined);
172
+ if (modalities) {
173
+ caps.vision = modalities.vision;
174
+ caps.audio = modalities.audio;
175
+ push({ type: 'capabilities', vision: caps.vision, audio: caps.audio });
176
+ }
170
177
  return;
171
178
  }
172
179
  case 'subagent:dispatch': {
@@ -1,4 +1,4 @@
1
- import type { Provider } from 'mu-core';
1
+ import type { ModelModalities, Provider } from 'mu-core';
2
2
  export interface ModelRegistryOptions {
3
3
  providers: Record<string, Provider>;
4
4
  default: string;
@@ -12,5 +12,7 @@ export interface ModelRegistry {
12
12
  readonly providers: string[];
13
13
  select(ref: string): void;
14
14
  resolve(ref?: string): ResolvedModel;
15
+ /** Probe a model's input modalities via its provider (may load the model). Undefined if unsupported. */
16
+ capabilities(ref?: string): Promise<ModelModalities | undefined>;
15
17
  }
16
18
  export declare const createModelRegistry: (options: ModelRegistryOptions) => ModelRegistry;
@@ -29,6 +29,10 @@ const createModelRegistry = (options) => {
29
29
  selected = ref;
30
30
  },
31
31
  resolve,
32
+ capabilities: async (ref) => {
33
+ const { provider, model } = resolve(ref);
34
+ return provider.capabilities ? await provider.capabilities(model) : undefined;
35
+ },
32
36
  };
33
37
  };
34
38
  exports.createModelRegistry = createModelRegistry;