@mercury-fw/cli-engine 0.69.0 → 0.71.0
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/CHANGELOG.md +27 -0
- package/cli-tool.ts +2 -20
- package/dist/cli-tool.d.ts +0 -5
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,32 @@
|
|
|
1
1
|
# @mercury-fw/cli-engine
|
|
2
2
|
|
|
3
|
+
## 0.71.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 2b08f7e: - `formatterPlugin` renders the `display` of every tool a plugin contributes, typed tools included (`{ ok: true, …, display }`)
|
|
8
|
+
- formatter rule `{ item, empty?, always: true }`: that kind is shown after the answer without `present`, the model gets `shown: true` next to its `displayRef`
|
|
9
|
+
- `ToolDisplay.always`
|
|
10
|
+
- the core strips `display` from every plugin tool's result and stashes it, a typed tool's too
|
|
11
|
+
- stashed list labels: the tool name, its input and the item count
|
|
12
|
+
- a failed or cancelled turn's displays are no longer appended to the next answer
|
|
13
|
+
- `present` is offered with any plugin tool
|
|
14
|
+
- **Breaking:** `createCliTool` no longer takes `stashDisplay` and returns the post-processor's `display` as it is: drop the option
|
|
15
|
+
- **Breaking:** a hand-written `DisplayHandler` returns `{ text, always? }` instead of a string: wrap the text
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- Updated dependencies [2b08f7e]
|
|
20
|
+
- @mercury-fw/plugin-types@0.71.0
|
|
21
|
+
- @mercury-fw/utils@0.71.0
|
|
22
|
+
|
|
23
|
+
## 0.70.0
|
|
24
|
+
|
|
25
|
+
### Patch Changes
|
|
26
|
+
|
|
27
|
+
- @mercury-fw/plugin-types@0.70.0
|
|
28
|
+
- @mercury-fw/utils@0.70.0
|
|
29
|
+
|
|
3
30
|
## 0.69.0
|
|
4
31
|
|
|
5
32
|
### Patch Changes
|
package/cli-tool.ts
CHANGED
|
@@ -170,11 +170,6 @@ export function createCliTool(
|
|
|
170
170
|
postProcess?: CliPostProcessor;
|
|
171
171
|
/** The texts of the turn's person (`SessionToolContext.t`), handed to the post-processor. */
|
|
172
172
|
t: Translate;
|
|
173
|
-
/** Stashes a post-processor's rendered `display` artifact and returns a ref
|
|
174
|
-
* the model can `present`. Pre-bound to this turn's session by the
|
|
175
|
-
* composition root. Optional: with none wired the inline `display` is left
|
|
176
|
-
* untouched and no `displayRef` is minted. */
|
|
177
|
-
stashDisplay?: (artifact: string, label?: string) => string;
|
|
178
173
|
/** The person the turn is for (see `SessionToolContext.person`): every
|
|
179
174
|
* command runs as them, with `--user` and the id their CLI knows them by.
|
|
180
175
|
* Absent or `null`: the CLI's own service identity. */
|
|
@@ -266,21 +261,8 @@ export function createCliTool(
|
|
|
266
261
|
? opts.postProcess({ binary: parsed.binary, args: parsed.args, prefix: match.prefix }, result, opts.t)
|
|
267
262
|
: result;
|
|
268
263
|
|
|
269
|
-
//
|
|
270
|
-
//
|
|
271
|
-
// to `present` it. Only string items (what the formatter renders) are
|
|
272
|
-
// showable; a display still carrying structured items (no formatter
|
|
273
|
-
// applied) has nothing to stash. With no `stashDisplay` wired, the result
|
|
274
|
-
// is left exactly as-is.
|
|
275
|
-
if (opts.stashDisplay && processed.ok && processed.display) {
|
|
276
|
-
const stringItems = processed.display.items.filter((i): i is string => typeof i === "string");
|
|
277
|
-
if (stringItems.length > 0) {
|
|
278
|
-
// What the list is, so the model still knows a turn later.
|
|
279
|
-
const count = `${stringItems.length} ${stringItems.length === 1 ? "item" : "items"}`;
|
|
280
|
-
const displayRef = opts.stashDisplay(stringItems.join("\n\n"), `${command.trim()} (${count})`);
|
|
281
|
-
return { ...processed, displayRef };
|
|
282
|
-
}
|
|
283
|
-
}
|
|
264
|
+
// The display stays on the result: the core's display channel stashes
|
|
265
|
+
// it and hands the model a ref, for every plugin tool alike.
|
|
284
266
|
return processed;
|
|
285
267
|
},
|
|
286
268
|
toModelOutput: ({ output }) => ({ type: "json", value: omitLoginLinkForModel(omitDisplayForModel(output)) as JSONValue }),
|
package/dist/cli-tool.d.ts
CHANGED
|
@@ -99,11 +99,6 @@ export declare function createCliTool(runCliFn: typeof runCli, configs: Record<s
|
|
|
99
99
|
postProcess?: CliPostProcessor;
|
|
100
100
|
/** The texts of the turn's person (`SessionToolContext.t`), handed to the post-processor. */
|
|
101
101
|
t: Translate;
|
|
102
|
-
/** Stashes a post-processor's rendered `display` artifact and returns a ref
|
|
103
|
-
* the model can `present`. Pre-bound to this turn's session by the
|
|
104
|
-
* composition root. Optional: with none wired the inline `display` is left
|
|
105
|
-
* untouched and no `displayRef` is minted. */
|
|
106
|
-
stashDisplay?: (artifact: string, label?: string) => string;
|
|
107
102
|
/** The person the turn is for (see `SessionToolContext.person`): every
|
|
108
103
|
* command runs as them, with `--user` and the id their CLI knows them by.
|
|
109
104
|
* Absent or `null`: the CLI's own service identity. */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mercury-fw/cli-engine",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.71.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -23,8 +23,8 @@
|
|
|
23
23
|
}
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@mercury-fw/plugin-types": "0.
|
|
27
|
-
"@mercury-fw/utils": "0.
|
|
26
|
+
"@mercury-fw/plugin-types": "0.71.0",
|
|
27
|
+
"@mercury-fw/utils": "0.71.0",
|
|
28
28
|
"ai": "^7.0.126",
|
|
29
29
|
"shell-quote": "^1.11.0",
|
|
30
30
|
"zod": "^4.6.5"
|