mu-harness 0.16.3 → 0.16.5

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.
@@ -15,6 +15,7 @@ export const parseAgent = (source, fallbackName) => {
15
15
  prompt: body,
16
16
  tools: parseToolList(fields.tools),
17
17
  model: str(fields.model),
18
+ color: str(fields.color),
18
19
  extends: str(fields.extends),
19
20
  };
20
21
  };
@@ -4,6 +4,7 @@ const merge = (base, child) => ({
4
4
  prompt: child.prompt || base.prompt,
5
5
  tools: child.tools ?? base.tools,
6
6
  model: child.model ?? base.model,
7
+ color: child.color ?? base.color,
7
8
  });
8
9
  export const createAgentRegistry = (agents = []) => {
9
10
  const raw = new Map();
@@ -4,5 +4,6 @@ export interface Agent {
4
4
  prompt: string;
5
5
  tools?: string[];
6
6
  model?: string;
7
+ color?: string;
7
8
  extends?: string;
8
9
  }
@@ -10,12 +10,16 @@ export const mergeHooks = (list) => {
10
10
  if (hooks.some((h) => h.prepareRequest)) {
11
11
  merged.prepareRequest = async (req) => {
12
12
  let current = req;
13
+ let extra;
13
14
  for (const h of hooks) {
14
15
  const next = await h.prepareRequest?.(current);
15
- if (next)
16
+ if (next) {
16
17
  current = { system: next.system ?? current.system, tools: next.tools ?? current.tools };
18
+ if (next.messages?.length)
19
+ extra = [...(extra ?? []), ...next.messages];
20
+ }
17
21
  }
18
- return current;
22
+ return extra ? { ...current, messages: extra } : current;
19
23
  };
20
24
  }
21
25
  if (hooks.some((h) => h.beforeToolCall)) {
@@ -1,7 +1,8 @@
1
- import type { ContentPart, Tool } from 'mu-core';
1
+ import type { ContentPart, Message, Tool } from 'mu-core';
2
2
  export interface PreparedRequest {
3
3
  system?: string;
4
4
  tools?: Tool[];
5
+ messages?: Message[];
5
6
  }
6
7
  export interface AgentSessionHooks {
7
8
  sessionStart?(): void | Promise<void>;
@@ -44,7 +44,8 @@ export const createAgentSession = (config) => {
44
44
  const toolBlock = callTools.map((tool) => tool.prompt?.trim()).filter(Boolean).join('\n');
45
45
  const effectiveSystem = [baseSystem, toolBlock].filter(Boolean).join('\n\n');
46
46
  const body = hasSystem ? messages.slice(1) : messages;
47
- const callMessages = effectiveSystem ? [systemMessage(effectiveSystem), ...body] : body;
47
+ const withSystem = effectiveSystem ? [systemMessage(effectiveSystem), ...body] : body;
48
+ const callMessages = prepared?.messages?.length ? [...withSystem, ...prepared.messages] : withSystem;
48
49
  const events = run({
49
50
  provider,
50
51
  model: config.model,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mu-harness",
3
- "version": "0.16.3",
3
+ "version": "0.16.5",
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",
@@ -16,8 +16,8 @@
16
16
  "dependencies": {
17
17
  "@swc/wasm-typescript": "^1.15.0",
18
18
  "croner": "^9.0.0",
19
- "mu-core": "^0.16.3",
20
- "mu-tui": "^0.16.3"
19
+ "mu-core": "^0.16.5",
20
+ "mu-tui": "^0.16.5"
21
21
  },
22
22
  "_generatedBy": "dnt@dev"
23
23
  }
@@ -18,6 +18,7 @@ const parseAgent = (source, fallbackName) => {
18
18
  prompt: body,
19
19
  tools: parseToolList(fields.tools),
20
20
  model: (0, index_js_1.str)(fields.model),
21
+ color: (0, index_js_1.str)(fields.color),
21
22
  extends: (0, index_js_1.str)(fields.extends),
22
23
  };
23
24
  };
@@ -7,6 +7,7 @@ const merge = (base, child) => ({
7
7
  prompt: child.prompt || base.prompt,
8
8
  tools: child.tools ?? base.tools,
9
9
  model: child.model ?? base.model,
10
+ color: child.color ?? base.color,
10
11
  });
11
12
  const createAgentRegistry = (agents = []) => {
12
13
  const raw = new Map();
@@ -4,5 +4,6 @@ export interface Agent {
4
4
  prompt: string;
5
5
  tools?: string[];
6
6
  model?: string;
7
+ color?: string;
7
8
  extends?: string;
8
9
  }
@@ -13,12 +13,16 @@ const mergeHooks = (list) => {
13
13
  if (hooks.some((h) => h.prepareRequest)) {
14
14
  merged.prepareRequest = async (req) => {
15
15
  let current = req;
16
+ let extra;
16
17
  for (const h of hooks) {
17
18
  const next = await h.prepareRequest?.(current);
18
- if (next)
19
+ if (next) {
19
20
  current = { system: next.system ?? current.system, tools: next.tools ?? current.tools };
21
+ if (next.messages?.length)
22
+ extra = [...(extra ?? []), ...next.messages];
23
+ }
20
24
  }
21
- return current;
25
+ return extra ? { ...current, messages: extra } : current;
22
26
  };
23
27
  }
24
28
  if (hooks.some((h) => h.beforeToolCall)) {
@@ -1,7 +1,8 @@
1
- import type { ContentPart, Tool } from 'mu-core';
1
+ import type { ContentPart, Message, Tool } from 'mu-core';
2
2
  export interface PreparedRequest {
3
3
  system?: string;
4
4
  tools?: Tool[];
5
+ messages?: Message[];
5
6
  }
6
7
  export interface AgentSessionHooks {
7
8
  sessionStart?(): void | Promise<void>;
@@ -47,7 +47,8 @@ const createAgentSession = (config) => {
47
47
  const toolBlock = callTools.map((tool) => tool.prompt?.trim()).filter(Boolean).join('\n');
48
48
  const effectiveSystem = [baseSystem, toolBlock].filter(Boolean).join('\n\n');
49
49
  const body = hasSystem ? messages.slice(1) : messages;
50
- const callMessages = effectiveSystem ? [systemMessage(effectiveSystem), ...body] : body;
50
+ const withSystem = effectiveSystem ? [systemMessage(effectiveSystem), ...body] : body;
51
+ const callMessages = prepared?.messages?.length ? [...withSystem, ...prepared.messages] : withSystem;
51
52
  const events = (0, mu_core_1.run)({
52
53
  provider,
53
54
  model: config.model,