toolmenu 0.12.0 → 0.14.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/README.md +84 -23
- package/dist/args.d.ts +31 -5
- package/dist/args.js +91 -14
- package/dist/auth.d.ts +4 -2
- package/dist/auth.js +59 -21
- package/dist/auto.d.ts +80 -6
- package/dist/auto.js +255 -19
- package/dist/breakdown.d.ts +2 -0
- package/dist/breakdown.js +64 -19
- package/dist/catalog.d.ts +87 -10
- package/dist/catalog.js +415 -58
- package/dist/cli.js +170 -185
- package/dist/close.d.ts +8 -0
- package/dist/close.js +18 -0
- package/dist/config.d.ts +7 -1
- package/dist/config.js +17 -0
- package/dist/connect.d.ts +14 -0
- package/dist/connect.js +150 -16
- package/dist/diff.d.ts +23 -1
- package/dist/diff.js +574 -120
- package/dist/difference.d.ts +2 -0
- package/dist/difference.js +13 -12
- package/dist/explain.d.ts +113 -0
- package/dist/explain.js +461 -0
- package/dist/failures.d.ts +15 -0
- package/dist/failures.js +59 -2
- package/dist/help.d.ts +11 -0
- package/dist/help.js +205 -0
- package/dist/history.d.ts +13 -0
- package/dist/history.js +86 -6
- package/dist/init.d.ts +93 -2
- package/dist/init.js +508 -21
- package/dist/menu.js +10 -2
- package/dist/options.d.ts +141 -0
- package/dist/options.js +50 -0
- package/dist/report.d.ts +2 -2
- package/dist/report.js +305 -101
- package/dist/rules/description.d.ts +7 -2
- package/dist/rules/description.js +86 -42
- package/dist/rules/determinism.d.ts +4 -1
- package/dist/rules/determinism.js +175 -11
- package/dist/rules/gated.d.ts +7 -0
- package/dist/rules/gated.js +77 -0
- package/dist/rules/ids.d.ts +1 -1
- package/dist/rules/ids.js +9 -4
- package/dist/rules/index.d.ts +6 -0
- package/dist/rules/index.js +18 -6
- package/dist/rules/naming.d.ts +1 -1
- package/dist/rules/naming.js +91 -21
- package/dist/rules/rule.d.ts +25 -0
- package/dist/rules/rule.js +25 -1
- package/dist/rules/spec.d.ts +6 -0
- package/dist/rules/spec.js +56 -9
- package/dist/rules/write.d.ts +1 -1
- package/dist/rules/write.js +64 -14
- package/dist/session.d.ts +34 -9
- package/dist/session.js +525 -94
- package/dist/snapshot.d.ts +8 -2
- package/dist/snapshot.js +33 -2
- package/dist/types.d.ts +21 -0
- package/dist/words.d.ts +5 -0
- package/dist/words.js +14 -0
- package/package.json +2 -2
package/dist/session.d.ts
CHANGED
|
@@ -2,12 +2,18 @@ import { type ToolChange } from './compare.js';
|
|
|
2
2
|
import { type Target } from './connect.js';
|
|
3
3
|
import { type FailureClass } from './failures.js';
|
|
4
4
|
import type { Era, Finding, Menu, MenuTool, Severity } from './types.js';
|
|
5
|
+
import { type AutoSummary } from './auto.js';
|
|
5
6
|
export type Step = {
|
|
6
7
|
kind: 'list';
|
|
7
8
|
} | {
|
|
8
9
|
kind: 'call';
|
|
9
10
|
tool: string;
|
|
10
11
|
args: Record<string, unknown>;
|
|
12
|
+
/**
|
|
13
|
+
* --auto only, never from a scenario file: an unlock guessed from its schema
|
|
14
|
+
* alone. If its first such call changes nothing, the rest aren't made.
|
|
15
|
+
*/
|
|
16
|
+
tentative?: boolean;
|
|
11
17
|
} | {
|
|
12
18
|
kind: 'wait_for';
|
|
13
19
|
event: 'tools_list_changed';
|
|
@@ -16,6 +22,12 @@ export type Step = {
|
|
|
16
22
|
export interface Scenario {
|
|
17
23
|
allowWrites: boolean;
|
|
18
24
|
steps: Step[];
|
|
25
|
+
/**
|
|
26
|
+
* Tools the user says only read, although the server doesn't mark them
|
|
27
|
+
* readOnlyHint (`assume_read_only`, --assume-read-only). Called without
|
|
28
|
+
* allow_writes; a tool marked destructiveHint or readOnlyHint: false never is.
|
|
29
|
+
*/
|
|
30
|
+
assumeReadOnly?: string[];
|
|
19
31
|
}
|
|
20
32
|
/** Read and check a scenario file. Mistakes are reported before anything runs. */
|
|
21
33
|
export declare function loadScenario(path: string): Promise<Scenario>;
|
|
@@ -31,6 +43,11 @@ export interface StepRecord {
|
|
|
31
43
|
note?: string;
|
|
32
44
|
/** Why the call failed, when it did (a tool error or a failed request). */
|
|
33
45
|
failure?: FailureClass;
|
|
46
|
+
/**
|
|
47
|
+
* What a call step's call did: the tool answered, answered with an error
|
|
48
|
+
* (isError), the request failed, or it wasn't sent (refused, not in the menu).
|
|
49
|
+
*/
|
|
50
|
+
outcome?: 'answered' | 'tool-error' | 'failed' | 'not-sent';
|
|
34
51
|
changed: boolean;
|
|
35
52
|
listChanged: number;
|
|
36
53
|
scope?: Scope;
|
|
@@ -60,13 +77,15 @@ export interface SessionResult {
|
|
|
60
77
|
*/
|
|
61
78
|
union: Menu;
|
|
62
79
|
/** With --auto: which tools were called, and which weren't and why. */
|
|
63
|
-
auto?:
|
|
64
|
-
called: string[];
|
|
65
|
-
skipped: import('./auto.js').AutoPlan['skipped'];
|
|
66
|
-
};
|
|
80
|
+
auto?: AutoSummary;
|
|
67
81
|
}
|
|
68
82
|
export interface SessionOptions {
|
|
69
83
|
timeoutMs?: number;
|
|
84
|
+
/**
|
|
85
|
+
* --auto: steps for tools that appear mid-session, run right after the step
|
|
86
|
+
* that brought them. Called once per change, with only the new tools.
|
|
87
|
+
*/
|
|
88
|
+
replan?: (added: MenuTool[]) => Step[];
|
|
70
89
|
/** How long to wait for a list_changed notification after a change. */
|
|
71
90
|
noticeGraceMs?: number;
|
|
72
91
|
rules?: Record<string, Severity | 'off'>;
|
|
@@ -77,18 +96,21 @@ export interface SessionOptions {
|
|
|
77
96
|
/** The union menu is kept as a baseline (--union-out): an unlock never called then leaves tools out of it. */
|
|
78
97
|
unionOut?: boolean;
|
|
79
98
|
/** session --auto: what the plan called and skipped, so a run that called nothing isn't a clean one. */
|
|
80
|
-
auto?:
|
|
81
|
-
called: string[];
|
|
82
|
-
skipped: import('./auto.js').AutoPlan['skipped'];
|
|
83
|
-
};
|
|
99
|
+
auto?: AutoSummary;
|
|
84
100
|
/** Waits before retrying a request refused for being too many (default 2, 4, 8, 16, 32 s: a per-minute limit clears within them). */
|
|
85
101
|
rateLimitWaitsMs?: number[];
|
|
86
102
|
}
|
|
87
|
-
|
|
103
|
+
/** `each`: this step's line when findings of one rule are said once for several steps. */
|
|
104
|
+
/** `each`: this step's line when repeats merge. `cause`: what makes two edits one cause. Neither is reported. */
|
|
105
|
+
export type Raw = Omit<Finding, 'severity'> & {
|
|
88
106
|
severity: Severity;
|
|
107
|
+
each?: string;
|
|
108
|
+
cause?: string;
|
|
89
109
|
};
|
|
90
110
|
/** Observe the menu while a scripted session runs. No LLM: the scenario is the agent. */
|
|
91
111
|
export declare function session(target: Target, scenario: Scenario, options?: SessionOptions): Promise<SessionResult>;
|
|
112
|
+
/** "step 2", "steps 2 and 3", "steps 2, 3 and 5", "steps 1–7 and 9". */
|
|
113
|
+
export declare function stepsText(steps: number[]): string;
|
|
92
114
|
/** Turn a menu change into findings, with the cost of each. */
|
|
93
115
|
export declare function changeFindings(before: MenuTool[], after: MenuTool[], changes: ToolChange[], step: number, origin?: string): Raw[];
|
|
94
116
|
/**
|
|
@@ -99,6 +121,7 @@ export declare function changeFindings(before: MenuTool[], after: MenuTool[], ch
|
|
|
99
121
|
* a fresh process starts there anyway (an unlock undone reads as "seen" by it).
|
|
100
122
|
*/
|
|
101
123
|
export declare function scopeOf(changes: ToolChange[], next: MenuTool[], probe: MenuTool[], transport: Target['kind'], baseline?: MenuTool[]): Scope;
|
|
124
|
+
export declare function mergeRepeats(raw: Raw[]): Raw[];
|
|
102
125
|
export type { Era };
|
|
103
126
|
interface Unlocker {
|
|
104
127
|
tool: MenuTool;
|
|
@@ -107,6 +130,8 @@ interface Unlocker {
|
|
|
107
130
|
param?: string;
|
|
108
131
|
/** Values to try for it, from the schema's enum. */
|
|
109
132
|
values: unknown[];
|
|
133
|
+
/** Its name or description says it unlocks tools (for this parameter); otherwise a guess from its schema. */
|
|
134
|
+
claims: boolean;
|
|
110
135
|
}
|
|
111
136
|
/**
|
|
112
137
|
* At most `max` characters, cut by code point at a word boundary, never inside a
|