@femtomc/mu-agent 26.2.106 → 26.2.108
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/README.md +41 -21
- package/assets/mu-tui-logo.png +0 -0
- package/dist/extensions/index.d.ts +1 -1
- package/dist/extensions/index.d.ts.map +1 -1
- package/dist/extensions/index.js +1 -1
- package/dist/extensions/mu-command-dispatcher.d.ts +0 -1
- package/dist/extensions/mu-command-dispatcher.d.ts.map +1 -1
- package/dist/extensions/mu-command-dispatcher.js +5 -42
- package/dist/extensions/mu-operator.js +2 -2
- package/dist/extensions/mu-serve.js +2 -2
- package/dist/extensions/ui.d.ts +4 -0
- package/dist/extensions/ui.d.ts.map +1 -0
- package/dist/extensions/ui.js +1055 -0
- package/dist/operator.d.ts +93 -255
- package/dist/operator.d.ts.map +1 -1
- package/dist/operator.js +41 -32
- package/package.json +33 -33
- package/prompts/skills/automation/SKILL.md +25 -0
- package/prompts/skills/{crons → automation/crons}/SKILL.md +2 -2
- package/prompts/skills/{heartbeats → automation/heartbeats}/SKILL.md +2 -2
- package/prompts/skills/core/SKILL.md +28 -0
- package/prompts/skills/{code-mode → core/code-mode}/SKILL.md +1 -1
- package/prompts/skills/{memory → core/memory}/SKILL.md +2 -2
- package/prompts/skills/{mu → core/mu}/SKILL.md +52 -9
- package/prompts/skills/{tmux → core/tmux}/SKILL.md +1 -1
- package/prompts/skills/messaging/SKILL.md +27 -0
- package/prompts/skills/subagents/SKILL.md +93 -243
- package/prompts/skills/{control-flow → subagents/control-flow}/SKILL.md +122 -17
- package/prompts/skills/subagents/execution/SKILL.md +428 -0
- package/prompts/skills/{model-routing → subagents/model-routing}/SKILL.md +179 -19
- package/prompts/skills/subagents/planning/SKILL.md +393 -0
- package/prompts/skills/{orchestration → subagents/protocol}/SKILL.md +7 -10
- package/prompts/skills/writing/SKILL.md +3 -2
- package/dist/extensions/hud.d.ts +0 -4
- package/dist/extensions/hud.d.ts.map +0 -1
- package/dist/extensions/hud.js +0 -483
- package/prompts/skills/hud/SKILL.md +0 -205
- package/prompts/skills/planning/SKILL.md +0 -244
- /package/prompts/skills/{setup-discord → messaging/setup-discord}/SKILL.md +0 -0
- /package/prompts/skills/{setup-neovim → messaging/setup-neovim}/SKILL.md +0 -0
- /package/prompts/skills/{setup-slack → messaging/setup-slack}/SKILL.md +0 -0
- /package/prompts/skills/{setup-telegram → messaging/setup-telegram}/SKILL.md +0 -0
package/dist/operator.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type UiDoc } from "@femtomc/mu-core";
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
import { CommandContextResolver } from "./command_context.js";
|
|
4
4
|
import { type CreateMuSessionOpts, type MuSession } from "./session_factory.js";
|
|
@@ -59,167 +59,86 @@ export type OperatorApprovedCommand = z.infer<typeof OperatorApprovedCommandSche
|
|
|
59
59
|
export declare const OperatorBackendTurnResultSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
60
60
|
kind: z.ZodLiteral<"respond">;
|
|
61
61
|
message: z.ZodString;
|
|
62
|
-
|
|
62
|
+
ui_docs: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
63
63
|
v: z.ZodDefault<z.ZodLiteral<1>>;
|
|
64
|
-
|
|
64
|
+
ui_id: z.ZodString;
|
|
65
65
|
title: z.ZodString;
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
italic: z.ZodOptional<z.ZodBoolean>;
|
|
72
|
-
code: z.ZodOptional<z.ZodBoolean>;
|
|
73
|
-
}, z.core.$strict>>;
|
|
74
|
-
scope: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
75
|
-
chips: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
76
|
-
key: z.ZodString;
|
|
77
|
-
label: z.ZodString;
|
|
66
|
+
summary: z.ZodOptional<z.ZodString>;
|
|
67
|
+
components: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
68
|
+
kind: z.ZodLiteral<"text">;
|
|
69
|
+
id: z.ZodString;
|
|
70
|
+
text: z.ZodString;
|
|
78
71
|
tone: z.ZodOptional<z.ZodEnum<{
|
|
79
72
|
error: "error";
|
|
80
|
-
info: "info";
|
|
81
73
|
success: "success";
|
|
74
|
+
info: "info";
|
|
82
75
|
warning: "warning";
|
|
83
76
|
muted: "muted";
|
|
84
77
|
accent: "accent";
|
|
85
78
|
dim: "dim";
|
|
86
79
|
}>>;
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
}>>;
|
|
92
|
-
italic: z.ZodOptional<z.ZodBoolean>;
|
|
93
|
-
code: z.ZodOptional<z.ZodBoolean>;
|
|
94
|
-
}, z.core.$strict>>;
|
|
95
|
-
}, z.core.$strict>>>;
|
|
96
|
-
sections: z.ZodDefault<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
97
|
-
kind: z.ZodLiteral<"kv">;
|
|
80
|
+
metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
81
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
82
|
+
kind: z.ZodLiteral<"list">;
|
|
83
|
+
id: z.ZodString;
|
|
98
84
|
title: z.ZodOptional<z.ZodString>;
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
normal: "normal";
|
|
102
|
-
strong: "strong";
|
|
103
|
-
}>>;
|
|
104
|
-
italic: z.ZodOptional<z.ZodBoolean>;
|
|
105
|
-
code: z.ZodOptional<z.ZodBoolean>;
|
|
106
|
-
}, z.core.$strict>>;
|
|
107
|
-
items: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
108
|
-
key: z.ZodString;
|
|
85
|
+
items: z.ZodArray<z.ZodObject<{
|
|
86
|
+
id: z.ZodString;
|
|
109
87
|
label: z.ZodString;
|
|
110
|
-
|
|
88
|
+
detail: z.ZodOptional<z.ZodString>;
|
|
111
89
|
tone: z.ZodOptional<z.ZodEnum<{
|
|
112
90
|
error: "error";
|
|
113
|
-
info: "info";
|
|
114
91
|
success: "success";
|
|
92
|
+
info: "info";
|
|
115
93
|
warning: "warning";
|
|
116
94
|
muted: "muted";
|
|
117
95
|
accent: "accent";
|
|
118
96
|
dim: "dim";
|
|
119
97
|
}>>;
|
|
120
|
-
value_style: z.ZodOptional<z.ZodObject<{
|
|
121
|
-
weight: z.ZodOptional<z.ZodEnum<{
|
|
122
|
-
normal: "normal";
|
|
123
|
-
strong: "strong";
|
|
124
|
-
}>>;
|
|
125
|
-
italic: z.ZodOptional<z.ZodBoolean>;
|
|
126
|
-
code: z.ZodOptional<z.ZodBoolean>;
|
|
127
|
-
}, z.core.$strict>>;
|
|
128
|
-
}, z.core.$strict>>>;
|
|
129
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
130
|
-
kind: z.ZodLiteral<"checklist">;
|
|
131
|
-
title: z.ZodOptional<z.ZodString>;
|
|
132
|
-
title_style: z.ZodOptional<z.ZodObject<{
|
|
133
|
-
weight: z.ZodOptional<z.ZodEnum<{
|
|
134
|
-
normal: "normal";
|
|
135
|
-
strong: "strong";
|
|
136
|
-
}>>;
|
|
137
|
-
italic: z.ZodOptional<z.ZodBoolean>;
|
|
138
|
-
code: z.ZodOptional<z.ZodBoolean>;
|
|
139
98
|
}, z.core.$strict>>;
|
|
140
|
-
|
|
141
|
-
id: z.ZodString;
|
|
142
|
-
label: z.ZodString;
|
|
143
|
-
done: z.ZodBoolean;
|
|
144
|
-
style: z.ZodOptional<z.ZodObject<{
|
|
145
|
-
weight: z.ZodOptional<z.ZodEnum<{
|
|
146
|
-
normal: "normal";
|
|
147
|
-
strong: "strong";
|
|
148
|
-
}>>;
|
|
149
|
-
italic: z.ZodOptional<z.ZodBoolean>;
|
|
150
|
-
code: z.ZodOptional<z.ZodBoolean>;
|
|
151
|
-
}, z.core.$strict>>;
|
|
152
|
-
}, z.core.$strict>>>;
|
|
99
|
+
metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
153
100
|
}, z.core.$strict>, z.ZodObject<{
|
|
154
|
-
kind: z.ZodLiteral<"
|
|
101
|
+
kind: z.ZodLiteral<"key_value">;
|
|
102
|
+
id: z.ZodString;
|
|
155
103
|
title: z.ZodOptional<z.ZodString>;
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
104
|
+
rows: z.ZodArray<z.ZodObject<{
|
|
105
|
+
key: z.ZodString;
|
|
106
|
+
value: z.ZodString;
|
|
107
|
+
tone: z.ZodOptional<z.ZodEnum<{
|
|
108
|
+
error: "error";
|
|
109
|
+
success: "success";
|
|
110
|
+
info: "info";
|
|
111
|
+
warning: "warning";
|
|
112
|
+
muted: "muted";
|
|
113
|
+
accent: "accent";
|
|
114
|
+
dim: "dim";
|
|
160
115
|
}>>;
|
|
161
|
-
italic: z.ZodOptional<z.ZodBoolean>;
|
|
162
|
-
code: z.ZodOptional<z.ZodBoolean>;
|
|
163
116
|
}, z.core.$strict>>;
|
|
164
|
-
|
|
117
|
+
metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
165
118
|
}, z.core.$strict>, z.ZodObject<{
|
|
166
|
-
kind: z.ZodLiteral<"
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
normal: "normal";
|
|
171
|
-
strong: "strong";
|
|
172
|
-
}>>;
|
|
173
|
-
italic: z.ZodOptional<z.ZodBoolean>;
|
|
174
|
-
code: z.ZodOptional<z.ZodBoolean>;
|
|
175
|
-
}, z.core.$strict>>;
|
|
176
|
-
text: z.ZodString;
|
|
177
|
-
tone: z.ZodOptional<z.ZodEnum<{
|
|
178
|
-
error: "error";
|
|
179
|
-
info: "info";
|
|
180
|
-
success: "success";
|
|
181
|
-
warning: "warning";
|
|
182
|
-
muted: "muted";
|
|
183
|
-
accent: "accent";
|
|
184
|
-
dim: "dim";
|
|
185
|
-
}>>;
|
|
186
|
-
style: z.ZodOptional<z.ZodObject<{
|
|
187
|
-
weight: z.ZodOptional<z.ZodEnum<{
|
|
188
|
-
normal: "normal";
|
|
189
|
-
strong: "strong";
|
|
190
|
-
}>>;
|
|
191
|
-
italic: z.ZodOptional<z.ZodBoolean>;
|
|
192
|
-
code: z.ZodOptional<z.ZodBoolean>;
|
|
193
|
-
}, z.core.$strict>>;
|
|
194
|
-
}, z.core.$strict>], "kind">>>;
|
|
119
|
+
kind: z.ZodLiteral<"divider">;
|
|
120
|
+
id: z.ZodString;
|
|
121
|
+
metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
122
|
+
}, z.core.$strict>], "kind">>;
|
|
195
123
|
actions: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
196
124
|
id: z.ZodString;
|
|
197
125
|
label: z.ZodString;
|
|
198
|
-
command_text: z.ZodString;
|
|
199
126
|
kind: z.ZodOptional<z.ZodEnum<{
|
|
200
127
|
primary: "primary";
|
|
201
128
|
secondary: "secondary";
|
|
202
129
|
danger: "danger";
|
|
130
|
+
link: "link";
|
|
203
131
|
}>>;
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
italic: z.ZodOptional<z.ZodBoolean>;
|
|
210
|
-
code: z.ZodOptional<z.ZodBoolean>;
|
|
211
|
-
}, z.core.$strict>>;
|
|
132
|
+
description: z.ZodOptional<z.ZodString>;
|
|
133
|
+
component_id: z.ZodOptional<z.ZodString>;
|
|
134
|
+
callback_token: z.ZodOptional<z.ZodString>;
|
|
135
|
+
payload: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
136
|
+
metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
212
137
|
}, z.core.$strict>>>;
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
strong: "strong";
|
|
218
|
-
}>>;
|
|
219
|
-
italic: z.ZodOptional<z.ZodBoolean>;
|
|
220
|
-
code: z.ZodOptional<z.ZodBoolean>;
|
|
221
|
-
}, z.core.$strict>>;
|
|
222
|
-
snapshot_multiline: z.ZodOptional<z.ZodString>;
|
|
138
|
+
revision: z.ZodObject<{
|
|
139
|
+
id: z.ZodString;
|
|
140
|
+
version: z.ZodNumber;
|
|
141
|
+
}, z.core.$strict>;
|
|
223
142
|
updated_at_ms: z.ZodNumber;
|
|
224
143
|
metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
225
144
|
}, z.core.$strict>>>;
|
|
@@ -260,167 +179,86 @@ export declare const OperatorBackendTurnResultSchema: z.ZodDiscriminatedUnion<[z
|
|
|
260
179
|
kind: z.ZodLiteral<"operator_thinking_set">;
|
|
261
180
|
thinking: z.ZodString;
|
|
262
181
|
}, z.core.$strip>], "kind">;
|
|
263
|
-
|
|
182
|
+
ui_docs: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
264
183
|
v: z.ZodDefault<z.ZodLiteral<1>>;
|
|
265
|
-
|
|
184
|
+
ui_id: z.ZodString;
|
|
266
185
|
title: z.ZodString;
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
italic: z.ZodOptional<z.ZodBoolean>;
|
|
273
|
-
code: z.ZodOptional<z.ZodBoolean>;
|
|
274
|
-
}, z.core.$strict>>;
|
|
275
|
-
scope: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
276
|
-
chips: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
277
|
-
key: z.ZodString;
|
|
278
|
-
label: z.ZodString;
|
|
186
|
+
summary: z.ZodOptional<z.ZodString>;
|
|
187
|
+
components: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
188
|
+
kind: z.ZodLiteral<"text">;
|
|
189
|
+
id: z.ZodString;
|
|
190
|
+
text: z.ZodString;
|
|
279
191
|
tone: z.ZodOptional<z.ZodEnum<{
|
|
280
192
|
error: "error";
|
|
281
|
-
info: "info";
|
|
282
193
|
success: "success";
|
|
194
|
+
info: "info";
|
|
283
195
|
warning: "warning";
|
|
284
196
|
muted: "muted";
|
|
285
197
|
accent: "accent";
|
|
286
198
|
dim: "dim";
|
|
287
199
|
}>>;
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
}>>;
|
|
293
|
-
italic: z.ZodOptional<z.ZodBoolean>;
|
|
294
|
-
code: z.ZodOptional<z.ZodBoolean>;
|
|
295
|
-
}, z.core.$strict>>;
|
|
296
|
-
}, z.core.$strict>>>;
|
|
297
|
-
sections: z.ZodDefault<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
298
|
-
kind: z.ZodLiteral<"kv">;
|
|
200
|
+
metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
201
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
202
|
+
kind: z.ZodLiteral<"list">;
|
|
203
|
+
id: z.ZodString;
|
|
299
204
|
title: z.ZodOptional<z.ZodString>;
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
normal: "normal";
|
|
303
|
-
strong: "strong";
|
|
304
|
-
}>>;
|
|
305
|
-
italic: z.ZodOptional<z.ZodBoolean>;
|
|
306
|
-
code: z.ZodOptional<z.ZodBoolean>;
|
|
307
|
-
}, z.core.$strict>>;
|
|
308
|
-
items: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
309
|
-
key: z.ZodString;
|
|
205
|
+
items: z.ZodArray<z.ZodObject<{
|
|
206
|
+
id: z.ZodString;
|
|
310
207
|
label: z.ZodString;
|
|
311
|
-
|
|
208
|
+
detail: z.ZodOptional<z.ZodString>;
|
|
312
209
|
tone: z.ZodOptional<z.ZodEnum<{
|
|
313
210
|
error: "error";
|
|
314
|
-
info: "info";
|
|
315
211
|
success: "success";
|
|
212
|
+
info: "info";
|
|
316
213
|
warning: "warning";
|
|
317
214
|
muted: "muted";
|
|
318
215
|
accent: "accent";
|
|
319
216
|
dim: "dim";
|
|
320
217
|
}>>;
|
|
321
|
-
value_style: z.ZodOptional<z.ZodObject<{
|
|
322
|
-
weight: z.ZodOptional<z.ZodEnum<{
|
|
323
|
-
normal: "normal";
|
|
324
|
-
strong: "strong";
|
|
325
|
-
}>>;
|
|
326
|
-
italic: z.ZodOptional<z.ZodBoolean>;
|
|
327
|
-
code: z.ZodOptional<z.ZodBoolean>;
|
|
328
|
-
}, z.core.$strict>>;
|
|
329
|
-
}, z.core.$strict>>>;
|
|
330
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
331
|
-
kind: z.ZodLiteral<"checklist">;
|
|
332
|
-
title: z.ZodOptional<z.ZodString>;
|
|
333
|
-
title_style: z.ZodOptional<z.ZodObject<{
|
|
334
|
-
weight: z.ZodOptional<z.ZodEnum<{
|
|
335
|
-
normal: "normal";
|
|
336
|
-
strong: "strong";
|
|
337
|
-
}>>;
|
|
338
|
-
italic: z.ZodOptional<z.ZodBoolean>;
|
|
339
|
-
code: z.ZodOptional<z.ZodBoolean>;
|
|
340
218
|
}, z.core.$strict>>;
|
|
341
|
-
|
|
342
|
-
id: z.ZodString;
|
|
343
|
-
label: z.ZodString;
|
|
344
|
-
done: z.ZodBoolean;
|
|
345
|
-
style: z.ZodOptional<z.ZodObject<{
|
|
346
|
-
weight: z.ZodOptional<z.ZodEnum<{
|
|
347
|
-
normal: "normal";
|
|
348
|
-
strong: "strong";
|
|
349
|
-
}>>;
|
|
350
|
-
italic: z.ZodOptional<z.ZodBoolean>;
|
|
351
|
-
code: z.ZodOptional<z.ZodBoolean>;
|
|
352
|
-
}, z.core.$strict>>;
|
|
353
|
-
}, z.core.$strict>>>;
|
|
219
|
+
metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
354
220
|
}, z.core.$strict>, z.ZodObject<{
|
|
355
|
-
kind: z.ZodLiteral<"
|
|
221
|
+
kind: z.ZodLiteral<"key_value">;
|
|
222
|
+
id: z.ZodString;
|
|
356
223
|
title: z.ZodOptional<z.ZodString>;
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
224
|
+
rows: z.ZodArray<z.ZodObject<{
|
|
225
|
+
key: z.ZodString;
|
|
226
|
+
value: z.ZodString;
|
|
227
|
+
tone: z.ZodOptional<z.ZodEnum<{
|
|
228
|
+
error: "error";
|
|
229
|
+
success: "success";
|
|
230
|
+
info: "info";
|
|
231
|
+
warning: "warning";
|
|
232
|
+
muted: "muted";
|
|
233
|
+
accent: "accent";
|
|
234
|
+
dim: "dim";
|
|
361
235
|
}>>;
|
|
362
|
-
italic: z.ZodOptional<z.ZodBoolean>;
|
|
363
|
-
code: z.ZodOptional<z.ZodBoolean>;
|
|
364
236
|
}, z.core.$strict>>;
|
|
365
|
-
|
|
237
|
+
metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
366
238
|
}, z.core.$strict>, z.ZodObject<{
|
|
367
|
-
kind: z.ZodLiteral<"
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
normal: "normal";
|
|
372
|
-
strong: "strong";
|
|
373
|
-
}>>;
|
|
374
|
-
italic: z.ZodOptional<z.ZodBoolean>;
|
|
375
|
-
code: z.ZodOptional<z.ZodBoolean>;
|
|
376
|
-
}, z.core.$strict>>;
|
|
377
|
-
text: z.ZodString;
|
|
378
|
-
tone: z.ZodOptional<z.ZodEnum<{
|
|
379
|
-
error: "error";
|
|
380
|
-
info: "info";
|
|
381
|
-
success: "success";
|
|
382
|
-
warning: "warning";
|
|
383
|
-
muted: "muted";
|
|
384
|
-
accent: "accent";
|
|
385
|
-
dim: "dim";
|
|
386
|
-
}>>;
|
|
387
|
-
style: z.ZodOptional<z.ZodObject<{
|
|
388
|
-
weight: z.ZodOptional<z.ZodEnum<{
|
|
389
|
-
normal: "normal";
|
|
390
|
-
strong: "strong";
|
|
391
|
-
}>>;
|
|
392
|
-
italic: z.ZodOptional<z.ZodBoolean>;
|
|
393
|
-
code: z.ZodOptional<z.ZodBoolean>;
|
|
394
|
-
}, z.core.$strict>>;
|
|
395
|
-
}, z.core.$strict>], "kind">>>;
|
|
239
|
+
kind: z.ZodLiteral<"divider">;
|
|
240
|
+
id: z.ZodString;
|
|
241
|
+
metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
242
|
+
}, z.core.$strict>], "kind">>;
|
|
396
243
|
actions: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
397
244
|
id: z.ZodString;
|
|
398
245
|
label: z.ZodString;
|
|
399
|
-
command_text: z.ZodString;
|
|
400
246
|
kind: z.ZodOptional<z.ZodEnum<{
|
|
401
247
|
primary: "primary";
|
|
402
248
|
secondary: "secondary";
|
|
403
249
|
danger: "danger";
|
|
250
|
+
link: "link";
|
|
404
251
|
}>>;
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
italic: z.ZodOptional<z.ZodBoolean>;
|
|
411
|
-
code: z.ZodOptional<z.ZodBoolean>;
|
|
412
|
-
}, z.core.$strict>>;
|
|
252
|
+
description: z.ZodOptional<z.ZodString>;
|
|
253
|
+
component_id: z.ZodOptional<z.ZodString>;
|
|
254
|
+
callback_token: z.ZodOptional<z.ZodString>;
|
|
255
|
+
payload: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
256
|
+
metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
413
257
|
}, z.core.$strict>>>;
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
strong: "strong";
|
|
419
|
-
}>>;
|
|
420
|
-
italic: z.ZodOptional<z.ZodBoolean>;
|
|
421
|
-
code: z.ZodOptional<z.ZodBoolean>;
|
|
422
|
-
}, z.core.$strict>>;
|
|
423
|
-
snapshot_multiline: z.ZodOptional<z.ZodString>;
|
|
258
|
+
revision: z.ZodObject<{
|
|
259
|
+
id: z.ZodString;
|
|
260
|
+
version: z.ZodNumber;
|
|
261
|
+
}, z.core.$strict>;
|
|
424
262
|
updated_at_ms: z.ZodNumber;
|
|
425
263
|
metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
426
264
|
}, z.core.$strict>>>;
|
|
@@ -440,13 +278,13 @@ export interface MessagingOperatorBackend {
|
|
|
440
278
|
export type OperatorDecision = {
|
|
441
279
|
kind: "response";
|
|
442
280
|
message: string;
|
|
443
|
-
|
|
281
|
+
ui_docs?: UiDoc[];
|
|
444
282
|
operatorSessionId: string;
|
|
445
283
|
operatorTurnId: string;
|
|
446
284
|
} | {
|
|
447
285
|
kind: "command";
|
|
448
286
|
commandText: string;
|
|
449
|
-
|
|
287
|
+
ui_docs?: UiDoc[];
|
|
450
288
|
operatorSessionId: string;
|
|
451
289
|
operatorTurnId: string;
|
|
452
290
|
} | {
|
package/dist/operator.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operator.d.ts","sourceRoot":"","sources":["../src/operator.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"operator.d.ts","sourceRoot":"","sources":["../src/operator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,KAAK,KAAK,EAAmB,MAAM,kBAAkB,CAAC;AAI5E,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,EAAmB,KAAK,mBAAmB,EAAE,KAAK,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjG,OAAO,EAAE,8BAA8B,EAAE,MAAM,sBAAsB,CAAC;AAEtE,MAAM,MAAM,gCAAgC,GAAG;IAC9C,OAAO,EAAE,MAAM,CAAC;IAChB,iBAAiB,EAAE,MAAM,CAAC;IA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,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;CAMlC;AAED,MAAM,MAAM,8BAA8B,GAAG;IAC5C,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,cAAc,CAAC,EAAE,CAAC,IAAI,EAAE,mBAAmB,KAAK,OAAO,CAAC,SAAS,CAAC,CAAC;IACnE,KAAK,CAAC,EAAE,MAAM,MAAM,CAAC;IACrB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,qBAAqB,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,MAAM,CAAC;CACrD,CAAC;AAEF,OAAO,EAAE,8BAA8B,EAAE,CAAC;AA+F1C,qBAAa,0BAA2B,YAAW,wBAAwB;;gBAiBvD,IAAI,GAAE,8BAAmC;IAmK/C,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAqBjD,OAAO,CAAC,KAAK,EAAE,wBAAwB,GAAG,OAAO,CAAC,yBAAyB,CAAC;IAgIlF,OAAO,IAAI,IAAI;CAKtB"}
|
package/dist/operator.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { UiDocSchema, normalizeUiDocs } from "@femtomc/mu-core";
|
|
2
2
|
import { appendJsonl, getStorePaths } from "@femtomc/mu-core/node";
|
|
3
3
|
import { mkdir, readFile, rename, writeFile } from "node:fs/promises";
|
|
4
4
|
import { dirname, join } from "node:path";
|
|
@@ -7,7 +7,7 @@ import { CommandContextResolver } from "./command_context.js";
|
|
|
7
7
|
import { createMuSession } from "./session_factory.js";
|
|
8
8
|
import { DEFAULT_OPERATOR_SYSTEM_PROMPT } from "./default_prompts.js";
|
|
9
9
|
const OPERATOR_RESPONSE_MAX_CHARS = 12_000;
|
|
10
|
-
const
|
|
10
|
+
const OPERATOR_TURN_UI_DOCS_MAX = 16;
|
|
11
11
|
const SAFE_RESPONSE_RE = new RegExp(`^[\\s\\S]{1,${OPERATOR_RESPONSE_MAX_CHARS}}$`);
|
|
12
12
|
const OPERATOR_TIMEOUT_MIN_MS = 1_000;
|
|
13
13
|
const OPERATOR_TIMEOUT_HARD_CAP_MS = 10 * 60 * 1_000;
|
|
@@ -44,17 +44,17 @@ export const OperatorApprovedCommandSchema = z.discriminatedUnion("kind", [
|
|
|
44
44
|
thinking: z.string().trim().min(1),
|
|
45
45
|
}),
|
|
46
46
|
]);
|
|
47
|
-
const
|
|
47
|
+
const OperatorTurnUiDocsSchema = z.array(UiDocSchema).max(OPERATOR_TURN_UI_DOCS_MAX).optional();
|
|
48
48
|
export const OperatorBackendTurnResultSchema = z.discriminatedUnion("kind", [
|
|
49
49
|
z.object({
|
|
50
50
|
kind: z.literal("respond"),
|
|
51
51
|
message: z.string().trim().min(1).max(OPERATOR_RESPONSE_MAX_CHARS),
|
|
52
|
-
|
|
52
|
+
ui_docs: OperatorTurnUiDocsSchema,
|
|
53
53
|
}),
|
|
54
54
|
z.object({
|
|
55
55
|
kind: z.literal("command"),
|
|
56
56
|
command: OperatorApprovedCommandSchema,
|
|
57
|
-
|
|
57
|
+
ui_docs: OperatorTurnUiDocsSchema,
|
|
58
58
|
}),
|
|
59
59
|
]);
|
|
60
60
|
function normalizeArg(arg) {
|
|
@@ -255,30 +255,30 @@ function nonEmptyString(value) {
|
|
|
255
255
|
const trimmed = value.trim();
|
|
256
256
|
return trimmed.length > 0 ? trimmed : null;
|
|
257
257
|
}
|
|
258
|
-
function
|
|
258
|
+
function isUiToolName(toolName) {
|
|
259
259
|
const normalized = toolName.trim().toLowerCase();
|
|
260
|
-
return normalized === "
|
|
260
|
+
return normalized === "mu_ui";
|
|
261
261
|
}
|
|
262
|
-
function
|
|
262
|
+
function extractUiDocsFromToolResult(result) {
|
|
263
263
|
const rec = asRecord(result);
|
|
264
264
|
if (!rec) {
|
|
265
265
|
return [];
|
|
266
266
|
}
|
|
267
267
|
const details = asRecord(rec.details);
|
|
268
268
|
const candidates = [];
|
|
269
|
-
const
|
|
270
|
-
if (Array.isArray(
|
|
271
|
-
candidates.push(...
|
|
269
|
+
const topLevelUiDocs = rec.ui_docs;
|
|
270
|
+
if (Array.isArray(topLevelUiDocs)) {
|
|
271
|
+
candidates.push(...topLevelUiDocs);
|
|
272
272
|
}
|
|
273
273
|
if (details) {
|
|
274
|
-
const
|
|
275
|
-
if (Array.isArray(
|
|
276
|
-
candidates.push(...
|
|
274
|
+
const detailUiDocs = details.ui_docs;
|
|
275
|
+
if (Array.isArray(detailUiDocs)) {
|
|
276
|
+
candidates.push(...detailUiDocs);
|
|
277
277
|
}
|
|
278
278
|
}
|
|
279
|
-
return
|
|
279
|
+
return normalizeUiDocs(candidates, { maxDocs: OPERATOR_TURN_UI_DOCS_MAX });
|
|
280
280
|
}
|
|
281
|
-
function
|
|
281
|
+
function collectUiDocsFromToolExecutionEvent(event) {
|
|
282
282
|
const rec = asRecord(event);
|
|
283
283
|
if (!rec) {
|
|
284
284
|
return [];
|
|
@@ -287,10 +287,10 @@ function collectHudDocsFromToolExecutionEvent(event) {
|
|
|
287
287
|
return [];
|
|
288
288
|
}
|
|
289
289
|
const toolName = nonEmptyString(rec.toolName);
|
|
290
|
-
if (!toolName || !
|
|
290
|
+
if (!toolName || !isUiToolName(toolName)) {
|
|
291
291
|
return [];
|
|
292
292
|
}
|
|
293
|
-
return
|
|
293
|
+
return extractUiDocsFromToolResult(rec.result);
|
|
294
294
|
}
|
|
295
295
|
export class JsonFileConversationSessionStore {
|
|
296
296
|
#path;
|
|
@@ -500,10 +500,14 @@ export class MessagingOperatorRuntime {
|
|
|
500
500
|
operatorTurnId: turnId,
|
|
501
501
|
};
|
|
502
502
|
}
|
|
503
|
+
const docPayload = {};
|
|
504
|
+
if (backendResult.ui_docs && backendResult.ui_docs.length > 0) {
|
|
505
|
+
docPayload.ui_docs = backendResult.ui_docs;
|
|
506
|
+
}
|
|
503
507
|
return {
|
|
504
508
|
kind: "response",
|
|
505
509
|
message,
|
|
506
|
-
...
|
|
510
|
+
...docPayload,
|
|
507
511
|
operatorSessionId: sessionId,
|
|
508
512
|
operatorTurnId: turnId,
|
|
509
513
|
};
|
|
@@ -521,10 +525,14 @@ export class MessagingOperatorRuntime {
|
|
|
521
525
|
operatorTurnId: turnId,
|
|
522
526
|
};
|
|
523
527
|
}
|
|
528
|
+
const docPayload = {};
|
|
529
|
+
if (backendResult.ui_docs && backendResult.ui_docs.length > 0) {
|
|
530
|
+
docPayload.ui_docs = backendResult.ui_docs;
|
|
531
|
+
}
|
|
524
532
|
return {
|
|
525
533
|
kind: "command",
|
|
526
534
|
commandText: approved.commandText,
|
|
527
|
-
...
|
|
535
|
+
...docPayload,
|
|
528
536
|
operatorSessionId: sessionId,
|
|
529
537
|
operatorTurnId: turnId,
|
|
530
538
|
};
|
|
@@ -788,7 +796,7 @@ export class PiMessagingOperatorBackend {
|
|
|
788
796
|
const session = sessionRecord.session;
|
|
789
797
|
let assistantText = "";
|
|
790
798
|
let capturedCommand = null;
|
|
791
|
-
let
|
|
799
|
+
let capturedUiDocs = [];
|
|
792
800
|
const unsub = session.subscribe((event) => {
|
|
793
801
|
// Capture assistant text for fallback responses.
|
|
794
802
|
if (event?.type === "message_end" && event?.message?.role === "assistant") {
|
|
@@ -817,10 +825,10 @@ export class PiMessagingOperatorBackend {
|
|
|
817
825
|
capturedCommand = parsed.data;
|
|
818
826
|
}
|
|
819
827
|
}
|
|
820
|
-
const
|
|
821
|
-
if (
|
|
822
|
-
|
|
823
|
-
maxDocs:
|
|
828
|
+
const uiDocs = collectUiDocsFromToolExecutionEvent(event);
|
|
829
|
+
if (uiDocs.length > 0) {
|
|
830
|
+
capturedUiDocs = normalizeUiDocs([...capturedUiDocs, ...uiDocs], {
|
|
831
|
+
maxDocs: OPERATOR_TURN_UI_DOCS_MAX,
|
|
824
832
|
});
|
|
825
833
|
}
|
|
826
834
|
});
|
|
@@ -860,7 +868,6 @@ export class PiMessagingOperatorBackend {
|
|
|
860
868
|
await session.agent.waitForIdle();
|
|
861
869
|
assistantText = "";
|
|
862
870
|
capturedCommand = null;
|
|
863
|
-
capturedHudDocs = [];
|
|
864
871
|
await promptOnce();
|
|
865
872
|
}
|
|
866
873
|
}
|
|
@@ -884,10 +891,11 @@ export class PiMessagingOperatorBackend {
|
|
|
884
891
|
command: capturedCommand,
|
|
885
892
|
messagePreview: assistantText,
|
|
886
893
|
});
|
|
887
|
-
|
|
888
|
-
|
|
894
|
+
const docPayload = {};
|
|
895
|
+
if (capturedUiDocs.length > 0) {
|
|
896
|
+
docPayload.ui_docs = capturedUiDocs;
|
|
889
897
|
}
|
|
890
|
-
return { kind: "command", command: capturedCommand };
|
|
898
|
+
return { kind: "command", command: capturedCommand, ...docPayload };
|
|
891
899
|
}
|
|
892
900
|
// Otherwise treat the assistant text as a plain response.
|
|
893
901
|
const message = assistantText.trim();
|
|
@@ -903,10 +911,11 @@ export class PiMessagingOperatorBackend {
|
|
|
903
911
|
outcome: "respond",
|
|
904
912
|
messagePreview: responseMessage,
|
|
905
913
|
});
|
|
906
|
-
|
|
907
|
-
|
|
914
|
+
const docPayload = {};
|
|
915
|
+
if (capturedUiDocs.length > 0) {
|
|
916
|
+
docPayload.ui_docs = capturedUiDocs;
|
|
908
917
|
}
|
|
909
|
-
return { kind: "respond", message: responseMessage };
|
|
918
|
+
return { kind: "respond", message: responseMessage, ...docPayload };
|
|
910
919
|
}
|
|
911
920
|
dispose() {
|
|
912
921
|
for (const sessionId of [...this.#sessions.keys()]) {
|