@json-layout/core 2.8.1 → 2.9.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/package.json +4 -2
- package/src/compile/index.js +3 -1
- package/src/compile/serialize.js +18 -15
- package/src/compile/skeleton-node.js +71 -5
- package/src/compile/types.ts +1 -0
- package/src/compile/utils/resolve-refs.js +5 -8
- package/src/compile/utils/x-i18n.js +15 -6
- package/src/state/index.js +46 -1
- package/src/state/state-node.js +36 -5
- package/src/state/types.ts +6 -0
- package/src/state/utils/urls.js +2 -0
- package/src/utils/json-pointer.js +29 -0
- package/src/webmcp/README.md +144 -0
- package/src/webmcp/index.js +88 -82
- package/src/webmcp/project.js +479 -111
- package/src/webmcp/resolve.js +37 -1
- package/src/webmcp/schema.js +169 -0
- package/src/webmcp/suggestions-store.js +121 -0
- package/src/webmcp/tools/describe-state.js +20 -64
- package/src/webmcp/tools/edit-array.js +51 -28
- package/src/webmcp/tools/fill-form-skill.js +17 -41
- package/src/webmcp/tools/get-data.js +66 -13
- package/src/webmcp/tools/get-field-suggestions.js +12 -23
- package/src/webmcp/tools/set-data.js +79 -28
- package/src/webmcp/tools/set-field-value.js +49 -39
- package/src/webmcp/variants-memo.js +53 -0
- package/types/compile/index.d.ts.map +1 -1
- package/types/compile/serialize.d.ts.map +1 -1
- package/types/compile/skeleton-node.d.ts +9 -2
- package/types/compile/skeleton-node.d.ts.map +1 -1
- package/types/compile/types.d.ts +1 -0
- package/types/compile/types.d.ts.map +1 -1
- package/types/compile/utils/resolve-refs.d.ts.map +1 -1
- package/types/compile/utils/x-i18n.d.ts +1 -1
- package/types/compile/utils/x-i18n.d.ts.map +1 -1
- package/types/state/index.d.ts +23 -0
- package/types/state/index.d.ts.map +1 -1
- package/types/state/state-node.d.ts.map +1 -1
- package/types/state/types.d.ts +2 -0
- package/types/state/types.d.ts.map +1 -1
- package/types/state/utils/urls.d.ts.map +1 -1
- package/types/utils/json-pointer.d.ts +22 -0
- package/types/utils/json-pointer.d.ts.map +1 -0
- package/types/webmcp/index.d.ts +23 -15
- package/types/webmcp/index.d.ts.map +1 -1
- package/types/webmcp/project.d.ts +159 -57
- package/types/webmcp/project.d.ts.map +1 -1
- package/types/webmcp/resolve.d.ts +7 -3
- package/types/webmcp/resolve.d.ts.map +1 -1
- package/types/webmcp/schema.d.ts +44 -0
- package/types/webmcp/schema.d.ts.map +1 -0
- package/types/webmcp/suggestions-store.d.ts +82 -0
- package/types/webmcp/suggestions-store.d.ts.map +1 -0
- package/types/webmcp/tools/describe-state.d.ts +5 -57
- package/types/webmcp/tools/describe-state.d.ts.map +1 -1
- package/types/webmcp/tools/edit-array.d.ts +8 -37
- package/types/webmcp/tools/edit-array.d.ts.map +1 -1
- package/types/webmcp/tools/fill-form-skill.d.ts +10 -13
- package/types/webmcp/tools/fill-form-skill.d.ts.map +1 -1
- package/types/webmcp/tools/get-data.d.ts +17 -15
- package/types/webmcp/tools/get-data.d.ts.map +1 -1
- package/types/webmcp/tools/get-field-suggestions.d.ts +4 -30
- package/types/webmcp/tools/get-field-suggestions.d.ts.map +1 -1
- package/types/webmcp/tools/set-data.d.ts +17 -34
- package/types/webmcp/tools/set-data.d.ts.map +1 -1
- package/types/webmcp/tools/set-field-value.d.ts +20 -57
- package/types/webmcp/tools/set-field-value.d.ts.map +1 -1
- package/types/webmcp/variants-memo.d.ts +42 -0
- package/types/webmcp/variants-memo.d.ts.map +1 -0
package/types/state/types.d.ts
CHANGED
|
@@ -40,6 +40,8 @@ export interface CreateStateTreeContext {
|
|
|
40
40
|
additionalPropertiesErrors?: ErrorObject[];
|
|
41
41
|
files: FileRef[];
|
|
42
42
|
activatedItems: Record<string, number | string>;
|
|
43
|
+
explicitActivatedItems: Set<string>;
|
|
44
|
+
reResolveActivatedItems: boolean;
|
|
43
45
|
autoActivatedItems: Record<string, number | number>;
|
|
44
46
|
autofocusTarget: string | null;
|
|
45
47
|
currentInput: string | null;
|
|
@@ -1 +1 @@
|
|
|
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AAG,IAAI,CAAA;CAAE,CAAA;AAEhH,MAAM,MAAM,QAAQ,GAAG,SAAS,GAAG;IAAE,MAAM,EAAE,IAAI,CAAC;IAAC,QAAQ,EAAE,SAAS,EAAE,CAAA;CAAE,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"urls.d.ts","sourceRoot":"","sources":["../../../src/state/utils/urls.js"],"names":[],"mappings":"AAEO,6BAA4B,MAAM,WAAoB,MAAM,
|
|
1
|
+
{"version":3,"file":"urls.d.ts","sourceRoot":"","sources":["../../../src/state/utils/urls.js"],"names":[],"mappings":"AAEO,6BAA4B,MAAM,WAAoB,MAAM,OAMlE"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file JSON pointer traversal, shared by the compilation step and the webmcp tools
|
|
3
|
+
* @description Pointers are produced by concatenation in the compilation step
|
|
4
|
+
* (`${refPointerPrefix}/properties/${propertyKey}` and similar), their segments are
|
|
5
|
+
* therefore consumed raw: they are deliberately not unescaped as RFC 6901 would
|
|
6
|
+
* prescribe, so that resolution stays symmetric with the way pointers are built.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Resolve the fragment part of a JSON pointer (what follows the '#') in a schema or any object.
|
|
10
|
+
* @param {unknown} root
|
|
11
|
+
* @param {string} fragment - e.g. '/properties/address/items', leading and empty segments are ignored
|
|
12
|
+
* @returns {{found: true, value: unknown} | {found: false, path: string[]}} - the resolved value, or
|
|
13
|
+
* the segments consumed up to and including the missing one, to report where the resolution failed
|
|
14
|
+
*/
|
|
15
|
+
export function resolvePointerFragment(root: unknown, fragment: string): {
|
|
16
|
+
found: true;
|
|
17
|
+
value: unknown;
|
|
18
|
+
} | {
|
|
19
|
+
found: false;
|
|
20
|
+
path: string[];
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=json-pointer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"json-pointer.d.ts","sourceRoot":"","sources":["../../src/utils/json-pointer.js"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;;;;GAMG;AACH,6CALW,OAAO,YACP,MAAM,GACJ;IAAC,KAAK,EAAE,IAAI,CAAC;IAAC,KAAK,EAAE,OAAO,CAAA;CAAC,GAAG;IAAC,KAAK,EAAE,KAAK,CAAC;IAAC,IAAI,EAAE,MAAM,EAAE,CAAA;CAAC,CAgB1E"}
|
package/types/webmcp/index.d.ts
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {object} WebMCPOptions
|
|
3
|
+
* @property {string} [prefixName] - Prefix for all tool names
|
|
4
|
+
* @property {string} [dataTitle] - Title used in descriptions (default: 'form')
|
|
5
|
+
* @property {boolean} [includeFillFormSkill] - Include the fillFormSkill tool (default: false)
|
|
6
|
+
* @property {boolean} [includeSubAgent] - Include a subagent_ tool wrapping all form tools (default: false)
|
|
7
|
+
*/
|
|
1
8
|
/**
|
|
2
9
|
* WebMCP class that provides MCP tool descriptors for a StatefulLayout instance
|
|
3
10
|
*/
|
|
@@ -22,16 +29,6 @@ export class WebMCP {
|
|
|
22
29
|
* @type {string}
|
|
23
30
|
*/
|
|
24
31
|
readonly _dataTitle: string;
|
|
25
|
-
/**
|
|
26
|
-
* @readonly
|
|
27
|
-
* @type {"small"|"medium"|"large"}
|
|
28
|
-
*/
|
|
29
|
-
readonly _complexity: "small" | "medium" | "large";
|
|
30
|
-
/**
|
|
31
|
-
* @readonly
|
|
32
|
-
* @type {object | null}
|
|
33
|
-
*/
|
|
34
|
-
readonly _schema: object | null;
|
|
35
32
|
/**
|
|
36
33
|
* @readonly
|
|
37
34
|
* @type {boolean}
|
|
@@ -46,6 +43,19 @@ export class WebMCP {
|
|
|
46
43
|
* @type {string[]}
|
|
47
44
|
*/
|
|
48
45
|
_registeredTools: string[];
|
|
46
|
+
/**
|
|
47
|
+
* memory of the last suggestions per node path, used by setFieldValue's suggestionIndex
|
|
48
|
+
* @readonly
|
|
49
|
+
* @type {SuggestionsStore}
|
|
50
|
+
*/
|
|
51
|
+
readonly _suggestionsStore: SuggestionsStore;
|
|
52
|
+
/**
|
|
53
|
+
* Variant lists already sent to the agent. Never cleared on a write: a schema's branches
|
|
54
|
+
* are a constant, so unlike memorized suggestions nothing about the data can invalidate
|
|
55
|
+
* them.
|
|
56
|
+
* @type {VariantsMemo}
|
|
57
|
+
*/
|
|
58
|
+
_variantsMemo: VariantsMemo;
|
|
49
59
|
/**
|
|
50
60
|
* @param {string} name
|
|
51
61
|
* @returns {string}
|
|
@@ -64,6 +74,7 @@ export class WebMCP {
|
|
|
64
74
|
*/
|
|
65
75
|
unregisterTools(): Promise<void>;
|
|
66
76
|
}
|
|
77
|
+
export type ToolDescriptor = import("@mcp-b/webmcp-types").ToolDescriptor;
|
|
67
78
|
export type WebMCPOptions = {
|
|
68
79
|
/**
|
|
69
80
|
* - Prefix for all tool names
|
|
@@ -73,10 +84,6 @@ export type WebMCPOptions = {
|
|
|
73
84
|
* - Title used in descriptions (default: 'form')
|
|
74
85
|
*/
|
|
75
86
|
dataTitle?: string | undefined;
|
|
76
|
-
/**
|
|
77
|
-
* - The original JSON schema
|
|
78
|
-
*/
|
|
79
|
-
schema?: object | undefined;
|
|
80
87
|
/**
|
|
81
88
|
* - Include the fillFormSkill tool (default: false)
|
|
82
89
|
*/
|
|
@@ -86,5 +93,6 @@ export type WebMCPOptions = {
|
|
|
86
93
|
*/
|
|
87
94
|
includeSubAgent?: boolean | undefined;
|
|
88
95
|
};
|
|
89
|
-
|
|
96
|
+
import { SuggestionsStore } from './suggestions-store.js';
|
|
97
|
+
import { VariantsMemo } from './variants-memo.js';
|
|
90
98
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/webmcp/index.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/webmcp/index.js"],"names":[],"mappings":"AA2CA;;;;;;GAMG;AAEH;;GAEG;AACH;IAmDE;;;OAGG;IACH,4BAHW,OAAO,mBAAmB,EAAE,cAAc,YAC1C,aAAa,EAQvB;IA5DD;;;OAGG;IACH,0BAFU,OAAO,mBAAmB,EAAE,cAAc,CAErC;IAEf;;;OAGG;IACH,sBAFU,MAAM,CAEL;IAEX;;;OAGG;IACH,qBAFU,MAAM,CAEN;IAEV;;;OAGG;IACH,gCAFU,OAAO,CAEY;IAE7B;;;OAGG;IACH,2BAFU,OAAO,CAEO;IAExB;;OAEG;IACH,kBAFU,MAAM,EAAE,CAEG;IAErB;;;;OAIG;IACH,4BAFU,gBAAgB,CAEgB;IAE1C;;;;;OAKG;IACH,eAFU,YAAY,CAEY;IAclC;;;OAGG;IACH,gBAHW,MAAM,GACJ,MAAM,CAIlB;IAED;;OAEG;IACH,YAFa,cAAc,EAAE,CAwP5B;IAED;;OAEG;IACH,iBAFa,OAAO,CAAC,IAAI,CAAC,CAczB;IAED;;OAEG;IACH,mBAFa,OAAO,CAAC,IAAI,CAAC,CAYzB;CACF;6BApYa,OAAO,qBAAqB,EAAE,cAAc;;;;;;;;;;;;;;;;;;;iCAHzB,wBAAwB;6BAC5B,oBAAoB"}
|
|
@@ -1,28 +1,72 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* help?: string,
|
|
9
|
-
* error?: string,
|
|
10
|
-
* required?: boolean,
|
|
11
|
-
* readOnly?: boolean,
|
|
12
|
-
* modified?: boolean,
|
|
13
|
-
* constraints?: Record<string, unknown>,
|
|
14
|
-
* variants?: Array<{index: number, title: string}>,
|
|
15
|
-
* selectedVariant?: number,
|
|
16
|
-
* children?: Array<ProjectedNode>,
|
|
17
|
-
* getSuggestions?: boolean
|
|
18
|
-
* }} ProjectedNode
|
|
2
|
+
* Help is authored as HTML for a browser. An agent reads text, so the markup is pure cost —
|
|
3
|
+
* `'` is not merely wasted, it is harder to read than the apostrophe it stands for —
|
|
4
|
+
* and the newlines between block tags break the one-line-per-node markdown the state tree
|
|
5
|
+
* is made of.
|
|
6
|
+
* @param {string} html
|
|
7
|
+
* @returns {string}
|
|
19
8
|
*/
|
|
9
|
+
export function helpToText(html: string): string;
|
|
20
10
|
/**
|
|
11
|
+
* Which nodes are currently rendered, by path. A node hidden by an `if` condition stays
|
|
12
|
+
* in the tree as comp "none", so what a write changes is visibility rather than the set
|
|
13
|
+
* of paths — comparing paths alone would report nothing.
|
|
21
14
|
* @param {import('../state/types.js').StateNode} node
|
|
22
|
-
* @param {
|
|
23
|
-
* @returns {
|
|
15
|
+
* @param {Map<string, string>} [into]
|
|
16
|
+
* @returns {Map<string, string>}
|
|
17
|
+
*/
|
|
18
|
+
export function visibilitySnapshot(node: import("../state/types.js").StateNode, into?: Map<string, string>): Map<string, string>;
|
|
19
|
+
/**
|
|
20
|
+
* What a write turned visible or invisible.
|
|
21
|
+
*
|
|
22
|
+
* Only paths present in both snapshots count. Activating a variant replaces one branch
|
|
23
|
+
* with another, so its nodes are new paths rather than nodes that changed visibility —
|
|
24
|
+
* setFieldValue already lists the activated branch, and counting them here would print
|
|
25
|
+
* the same subtree twice.
|
|
26
|
+
* @param {Map<string, string>} before
|
|
27
|
+
* @param {Map<string, string>} after
|
|
28
|
+
* @returns {{ revealed: string[], hidden: string[] }}
|
|
29
|
+
*/
|
|
30
|
+
export function diffVisibility(before: Map<string, string>, after: Map<string, string>): {
|
|
31
|
+
revealed: string[];
|
|
32
|
+
hidden: string[];
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* @param {{ revealed: string[], hidden: string[] }} diff
|
|
36
|
+
* @returns {string}
|
|
37
|
+
*/
|
|
38
|
+
export function formatVisibilityDiff(diff: {
|
|
39
|
+
revealed: string[];
|
|
40
|
+
hidden: string[];
|
|
41
|
+
}): string;
|
|
42
|
+
/**
|
|
43
|
+
* Render a value for the agent: in full when it is small enough to be worth reading,
|
|
44
|
+
* otherwise named with its kind and size so the agent knows what is there without paying
|
|
45
|
+
* for it. It can always read a node's own subtree with describeState.
|
|
46
|
+
* @param {unknown} value
|
|
47
|
+
* @returns {string | undefined}
|
|
48
|
+
*/
|
|
49
|
+
export function abbreviateValue(value: unknown): string | undefined;
|
|
50
|
+
/**
|
|
51
|
+
* Whether this field's options cannot be fetched yet because the request that would
|
|
52
|
+
* produce them cannot be built.
|
|
53
|
+
*
|
|
54
|
+
* The state layer resolves a remote list's URL up front and stores it as `itemsCacheKey`;
|
|
55
|
+
* when the expression THROWS — because it reads a field nobody has filled in — the key is
|
|
56
|
+
* null. That is a different situation from "your query matched nothing" and from "this
|
|
57
|
+
* field has no list", and all three used to arrive as the same four words. The review that
|
|
58
|
+
* prompted this put 45% of the option lists across thirty real applications in this state
|
|
59
|
+
* until some other field is written first, so it is the common case, not an edge.
|
|
60
|
+
* @param {import('../state/types.js').StateNode} node
|
|
61
|
+
* @returns {boolean}
|
|
24
62
|
*/
|
|
25
|
-
export function
|
|
63
|
+
export function suggestionsBlocked(node: import("../state/types.js").StateNode): boolean;
|
|
64
|
+
/**
|
|
65
|
+
* The expression a blocked list is waiting on, so the answer can say what to go and set.
|
|
66
|
+
* @param {import('../state/types.js').StateNode} node
|
|
67
|
+
* @returns {string|undefined}
|
|
68
|
+
*/
|
|
69
|
+
export function suggestionsSource(node: import("../state/types.js").StateNode): string | undefined;
|
|
26
70
|
/**
|
|
27
71
|
* Project a single field result for slim mutation responses
|
|
28
72
|
* @param {import('../state/types.js').StateNode} node
|
|
@@ -35,77 +79,135 @@ export function projectFieldResult(node: import("../state/types.js").StateNode,
|
|
|
35
79
|
data: unknown;
|
|
36
80
|
error?: string;
|
|
37
81
|
};
|
|
38
|
-
/**
|
|
39
|
-
* @param {import('../state/types.js').StateTree} stateTree
|
|
40
|
-
* @param {import('../state/index.js').StatefulLayout} statefulLayout
|
|
41
|
-
* @returns {{ root: ProjectedNode, valid: boolean }}
|
|
42
|
-
*/
|
|
43
|
-
export function projectStateTree(stateTree: import("../state/types.js").StateTree, statefulLayout: import("../state/index.js").StatefulLayout): {
|
|
44
|
-
root: ProjectedNode;
|
|
45
|
-
valid: boolean;
|
|
46
|
-
};
|
|
47
82
|
/**
|
|
48
83
|
* Format a projected node as a markdown line for LLM-readable output.
|
|
49
84
|
* @param {import('../state/types.js').StateNode} node
|
|
50
85
|
* @param {import('../state/index.js').StatefulLayout} statefulLayout
|
|
51
86
|
* @param {number} [depth]
|
|
87
|
+
* @param {Record<string, string>} [errorsByPath] - computed on the root node when not given
|
|
88
|
+
* @param {import('./variants-memo.js').VariantsMemo} [variantsMemo] - when given, a variant
|
|
89
|
+
* list already printed for the same schema node is replaced by a pointer back to it
|
|
52
90
|
* @returns {string}
|
|
53
91
|
*/
|
|
54
|
-
export function projectNodeToMarkdown(node: import("../state/types.js").StateNode, statefulLayout: import("../state/index.js").StatefulLayout, depth?: number): string;
|
|
92
|
+
export function projectNodeToMarkdown(node: import("../state/types.js").StateNode, statefulLayout: import("../state/index.js").StatefulLayout, depth?: number, errorsByPath?: Record<string, string>, variantsMemo?: import("./variants-memo.js").VariantsMemo): string;
|
|
55
93
|
/**
|
|
56
94
|
* Format a state tree as markdown for LLM-readable output.
|
|
57
95
|
* @param {import('../state/types.js').StateTree} stateTree
|
|
58
96
|
* @param {import('../state/index.js').StatefulLayout} statefulLayout
|
|
97
|
+
* @param {import('./variants-memo.js').VariantsMemo} [variantsMemo]
|
|
59
98
|
* @returns {string}
|
|
60
99
|
*/
|
|
61
|
-
export function projectStateTreeToMarkdown(stateTree: import("../state/types.js").StateTree, statefulLayout: import("../state/index.js").StatefulLayout): string;
|
|
100
|
+
export function projectStateTreeToMarkdown(stateTree: import("../state/types.js").StateTree, statefulLayout: import("../state/index.js").StatefulLayout, variantsMemo?: import("./variants-memo.js").VariantsMemo): string;
|
|
62
101
|
/**
|
|
63
102
|
* Format a mutation result as concise text for LLM-readable output.
|
|
64
103
|
* @param {boolean} valid
|
|
65
|
-
* @param {Array<{path: string, message: string}>} errors
|
|
104
|
+
* @param {Array<{path: string, message: string}>} errors - errors of the mutated subtree
|
|
66
105
|
* @param {string} [prefix] - optional prefix line (e.g. field info)
|
|
106
|
+
* @param {number} [otherErrors] - number of errors of the form outside of the mutated subtree
|
|
67
107
|
* @returns {string}
|
|
68
108
|
*/
|
|
69
109
|
export function formatMutationResult(valid: boolean, errors: Array<{
|
|
70
110
|
path: string;
|
|
71
111
|
message: string;
|
|
72
|
-
}>, prefix?: string): string;
|
|
112
|
+
}>, prefix?: string, otherErrors?: number): string;
|
|
73
113
|
/**
|
|
74
|
-
*
|
|
114
|
+
* @typedef {{index: number, title: string, key?: string, value?: unknown, valueOmitted?: boolean, valueLength?: number}} ProjectedSuggestion
|
|
115
|
+
*/
|
|
116
|
+
/**
|
|
117
|
+
* Project suggestions for the tools output: anything but a short scalar is identified by
|
|
118
|
+
* its title and key alone, and referred to by index instead of copied around.
|
|
75
119
|
* @param {Array<{value: unknown, title: string, key?: string}>} items
|
|
76
|
-
* @
|
|
120
|
+
* @param {number} [baseIndex] - index of the first item, as the store assigned it
|
|
121
|
+
* @returns {ProjectedSuggestion[]}
|
|
77
122
|
*/
|
|
78
|
-
export function
|
|
123
|
+
export function projectSuggestions(items: Array<{
|
|
79
124
|
value: unknown;
|
|
80
125
|
title: string;
|
|
81
126
|
key?: string;
|
|
82
|
-
}
|
|
127
|
+
}>, baseIndex?: number): ProjectedSuggestion[];
|
|
83
128
|
/**
|
|
84
|
-
*
|
|
129
|
+
* Format field suggestions as markdown for LLM-readable output.
|
|
130
|
+
* @param {ProjectedSuggestion[]} suggestions
|
|
131
|
+
* @param {string} [blockedOn] - the expression the list is waiting on, when it has one
|
|
132
|
+
* @returns {string}
|
|
133
|
+
*/
|
|
134
|
+
export function formatSuggestions(suggestions: ProjectedSuggestion[], blockedOn?: string): string;
|
|
135
|
+
/**
|
|
136
|
+
* Errors of the whole form, each named by the location it actually applies to.
|
|
137
|
+
*
|
|
138
|
+
* A node only carries an error while it is hydrated. A list shows its items in summary
|
|
139
|
+
* mode, so nothing below an unedited item exists as a node, and every error under it
|
|
140
|
+
* collapses onto the list — one message, on a path that is not the faulty one. An agent
|
|
141
|
+
* told "/sections must be integer" knows it is wrong and not where, and retries blind.
|
|
142
|
+
*
|
|
143
|
+
* So a node error that is standing in for deeper errors nobody names is replaced by
|
|
144
|
+
* those errors, addressed by data pointer. Errors a hydrated node does name keep their
|
|
145
|
+
* form path, which is what the mutation tools expect.
|
|
146
|
+
* @param {import('../state/index.js').StatefulLayout} statefulLayout
|
|
85
147
|
* @returns {Array<{path: string, message: string}>}
|
|
86
148
|
*/
|
|
87
|
-
export function collectErrors(
|
|
149
|
+
export function collectErrors(statefulLayout: import("../state/index.js").StatefulLayout): Array<{
|
|
88
150
|
path: string;
|
|
89
151
|
message: string;
|
|
90
152
|
}>;
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
modified?: boolean;
|
|
102
|
-
constraints?: Record<string, unknown>;
|
|
103
|
-
variants?: Array<{
|
|
104
|
-
index: number;
|
|
105
|
-
title: string;
|
|
153
|
+
/**
|
|
154
|
+
* Errors of the subtree of a node, and count of the errors of the rest of the form.
|
|
155
|
+
* @param {import('../state/index.js').StatefulLayout} statefulLayout
|
|
156
|
+
* @param {import('../state/types.js').StateNode} node
|
|
157
|
+
* @returns {{ errors: Array<{path: string, message: string}>, otherErrors: number }}
|
|
158
|
+
*/
|
|
159
|
+
export function collectScopedErrors(statefulLayout: import("../state/index.js").StatefulLayout, node: import("../state/types.js").StateNode): {
|
|
160
|
+
errors: Array<{
|
|
161
|
+
path: string;
|
|
162
|
+
message: string;
|
|
106
163
|
}>;
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
164
|
+
otherErrors: number;
|
|
165
|
+
};
|
|
166
|
+
/**
|
|
167
|
+
* Suggestion values can be arbitrarily large objects (a whole dataset definition for example),
|
|
168
|
+
* they are kept out of the tools output and retrieved by index with setFieldValue.
|
|
169
|
+
*/
|
|
170
|
+
/**
|
|
171
|
+
* Longest value inlined in a suggestion listing. Only scalars are ever inlined: a picker
|
|
172
|
+
* shows a person titles, not the objects behind them, and an agent picks a row the same
|
|
173
|
+
* way, by index. Printing a slice of each object cost 61-77% of every suggestion response
|
|
174
|
+
* measured, for bytes the tool's own description tells the agent never to copy.
|
|
175
|
+
*/
|
|
176
|
+
export const SUGGESTION_VALUE_MAX_LENGTH: 100;
|
|
177
|
+
/**
|
|
178
|
+
* Longest value rendered in full anywhere the agent reads state. Beyond it a value is
|
|
179
|
+
* named rather than printed: a picked data-fair dataset is 4-13 KB of column schema, and
|
|
180
|
+
* echoing it on the write, again in the state tree and a third time from getData was the
|
|
181
|
+
* single largest cost in the eval — for content the agent applied by index and never had
|
|
182
|
+
* to handle.
|
|
183
|
+
*/
|
|
184
|
+
export const DISPLAYED_VALUE_MAX_LENGTH: 1000;
|
|
185
|
+
/** Most revealed or hidden paths named before the list is summarised instead. */
|
|
186
|
+
export const REVEALED_PATHS_MAX: 10;
|
|
187
|
+
/**
|
|
188
|
+
* Longest rendered list of options inlined into a state line instead of being flagged as
|
|
189
|
+
* something to go and fetch. A closed enum is already in hand — the state layer resolves it
|
|
190
|
+
* into itemsCacheKey without a request — so flagging it sent the agent on a round trip for
|
|
191
|
+
* a list nobody had to look up: charts spent two of sixteen calls reading four-const enums,
|
|
192
|
+
* and sortBy, sortOrder, color and strValue would each have cost another.
|
|
193
|
+
*/
|
|
194
|
+
export const INLINE_ITEMS_MAX_LENGTH: 200;
|
|
195
|
+
/**
|
|
196
|
+
* Longest help inlined on a node the agent did not ask about. Help is written for someone
|
|
197
|
+
* looking at a form, where it sits behind a "?" icon and is read on demand; inlined into
|
|
198
|
+
* every state read it is pushed instead, and portal-page spends 782 characters of SEO
|
|
199
|
+
* advice on a field no agent in the eval has ever filled. Past this length it is named and
|
|
200
|
+
* left to be fetched, the same bargain oversized values get. Short help stays inline
|
|
201
|
+
* whatever the node — it is the kind that changes what an agent writes, such as a negative
|
|
202
|
+
* height meaning automatic sizing.
|
|
203
|
+
*/
|
|
204
|
+
export const HELP_MAX_LENGTH: 300;
|
|
205
|
+
export type ProjectedSuggestion = {
|
|
206
|
+
index: number;
|
|
207
|
+
title: string;
|
|
208
|
+
key?: string;
|
|
209
|
+
value?: unknown;
|
|
210
|
+
valueOmitted?: boolean;
|
|
211
|
+
valueLength?: number;
|
|
110
212
|
};
|
|
111
213
|
//# sourceMappingURL=project.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"project.d.ts","sourceRoot":"","sources":["../../src/webmcp/project.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"project.d.ts","sourceRoot":"","sources":["../../src/webmcp/project.js"],"names":[],"mappings":"AA6EA;;;;;;;GAOG;AACH,iCAHW,MAAM,GACJ,MAAM,CAWlB;AAED;;;;;;;GAOG;AACH,yCAJW,OAAO,mBAAmB,EAAE,SAAS,SACrC,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GACjB,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAM/B;AAED;;;;;;;;;;GAUG;AACH,uCAJW,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,SACnB,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GACjB;IAAE,QAAQ,EAAE,MAAM,EAAE,CAAC;IAAC,MAAM,EAAE,MAAM,EAAE,CAAA;CAAE,CAcpD;AAED;;;GAGG;AACH,2CAHW;IAAE,QAAQ,EAAE,MAAM,EAAE,CAAC;IAAC,MAAM,EAAE,MAAM,EAAE,CAAA;CAAE,GACtC,MAAM,CAelB;AAED;;;;;;GAMG;AACH,uCAHW,OAAO,GACL,MAAM,GAAG,SAAS,CAQ9B;AAmHD;;;;;;;;;;;;GAYG;AAC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xC,KAAK,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAC,CAAC,CA6BlD;AAED;;;;;GAKG;AACH,oDAJW,OAAO,mBAAmB,EAAE,cAAc,QAC1C,OAAO,mBAAmB,EAAE,SAAS,GACnC;IAAE,MAAM,EAAE,KAAK,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAC,CAAC,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE,CAmBnF;AAzqBD;;;GAGG;AACH;;;;;GAKG;AACH,0CAA2C,GAAG,CAAA;AAE9C;;;;;;GAMG;AACH,yCAA0C,IAAI,CAAA;AAE9C,iFAAiF;AACjF,iCAAkC,EAAE,CAAA;AAEpC;;;;;;GAMG;AACH,sCAAuC,GAAG,CAAA;AAuB1C;;;;;;;;GAQG;AACH,8BAA+B,GAAG,CAAA;kCAierB;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,OAAO,CAAC;IAAC,YAAY,CAAC,EAAE,OAAO,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAA;CAAC"}
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file Node resolution for webmcp tools
|
|
3
|
-
*/
|
|
4
1
|
/**
|
|
5
2
|
* Navigate from a root StateNode to a descendant node by path.
|
|
6
3
|
* @param {import('../state/types.js').StateNode} root
|
|
@@ -8,4 +5,11 @@
|
|
|
8
5
|
* @returns {import('../state/types.js').StateNode|undefined}
|
|
9
6
|
*/
|
|
10
7
|
export function resolveNode(root: import("../state/types.js").StateNode, path: string): import("../state/types.js").StateNode | undefined;
|
|
8
|
+
/**
|
|
9
|
+
* Children of a node as they should be presented to an agent: hidden nodes are removed
|
|
10
|
+
* and the duplicated activated list item is deduplicated.
|
|
11
|
+
* @param {import('../state/types.js').StateNode} node
|
|
12
|
+
* @returns {import('../state/types.js').StateNode[]}
|
|
13
|
+
*/
|
|
14
|
+
export function visibleChildren(node: import("../state/types.js").StateNode): import("../state/types.js").StateNode[];
|
|
11
15
|
//# sourceMappingURL=resolve.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolve.d.ts","sourceRoot":"","sources":["../../src/webmcp/resolve.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"resolve.d.ts","sourceRoot":"","sources":["../../src/webmcp/resolve.js"],"names":[],"mappings":"AAkBA;;;;;GAKG;AACH,kCAJW,OAAO,mBAAmB,EAAE,SAAS,QACrC,MAAM,GACJ,OAAO,mBAAmB,EAAE,SAAS,GAAC,SAAS,CAgB3D;AAED;;;;;GAKG;AACH,sCAHW,OAAO,mBAAmB,EAAE,SAAS,GACnC,OAAO,mBAAmB,EAAE,SAAS,EAAE,CAgBnD"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Deep clone a schema fragment while removing the keys added by the compilation step.
|
|
3
|
+
* @param {unknown} fragment
|
|
4
|
+
* @returns {unknown}
|
|
5
|
+
*/
|
|
6
|
+
export function cleanSchemaFragment(fragment: unknown): unknown;
|
|
7
|
+
/**
|
|
8
|
+
* Resolve a schema fragment from a skeleton pointer (ex: "_jl#/properties/filters/items").
|
|
9
|
+
* @param {object} schema - a JSON schema, its $id should match the pointer prefix
|
|
10
|
+
* @param {string} pointer
|
|
11
|
+
* @returns {object|undefined}
|
|
12
|
+
*/
|
|
13
|
+
export function resolveSchemaPointer(schema: object, pointer: string): object | undefined;
|
|
14
|
+
/**
|
|
15
|
+
* Resolve the sub-schema that governs a node of the form.
|
|
16
|
+
* The schema given to the WebMCP instance is preferred (it is pristine),
|
|
17
|
+
* the compiled one is used as a fallback (it is cleaned up before being returned).
|
|
18
|
+
* @param {StateNode} node
|
|
19
|
+
* @param {StatefulLayout} statefulLayout
|
|
20
|
+
* @param {object|null} [originalSchema]
|
|
21
|
+
* @returns {object|undefined}
|
|
22
|
+
*/
|
|
23
|
+
export function resolveNodeSchema(node: StateNode, statefulLayout: StatefulLayout, originalSchema?: object | null): object | undefined;
|
|
24
|
+
/**
|
|
25
|
+
* List the fields declared by the skeleton of a node, even when the state tree
|
|
26
|
+
* did not hydrate them yet (a collapsed list item for example).
|
|
27
|
+
* @param {StateNode} node
|
|
28
|
+
* @param {StatefulLayout} statefulLayout
|
|
29
|
+
* @param {object|null} [originalSchema]
|
|
30
|
+
* @returns {DeclaredField[]}
|
|
31
|
+
*/
|
|
32
|
+
export function projectDeclaredFields(node: StateNode, statefulLayout: StatefulLayout, originalSchema?: object | null): DeclaredField[];
|
|
33
|
+
export type StateNode = import("../state/types.js").StateNode;
|
|
34
|
+
export type StatefulLayout = import("../state/index.js").StatefulLayout;
|
|
35
|
+
export type DeclaredField = {
|
|
36
|
+
key: string | number;
|
|
37
|
+
path: string;
|
|
38
|
+
type?: string;
|
|
39
|
+
title?: string;
|
|
40
|
+
required?: boolean;
|
|
41
|
+
enum?: unknown[];
|
|
42
|
+
declared: true;
|
|
43
|
+
};
|
|
44
|
+
//# sourceMappingURL=schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/webmcp/schema.js"],"names":[],"mappings":"AAwBA;;;;GAIG;AACH,8CAHW,OAAO,GACL,OAAO,CAcnB;AAeD;;;;;GAKG;AACH,6CAJW,MAAM,WACN,MAAM,GACJ,MAAM,GAAC,SAAS,CAgB5B;AAED;;;;;;;;GAQG;AACH,wCALW,SAAS,kBACT,cAAc,mBACd,MAAM,GAAC,IAAI,GACT,MAAM,GAAC,SAAS,CAkB5B;AAqBD;;;;;;;GAOG;AACH,4CALW,SAAS,kBACT,cAAc,mBACd,MAAM,GAAC,IAAI,GACT,aAAa,EAAE,CAsC3B;wBAhKa,OAAO,mBAAmB,EAAE,SAAS;6BACrC,OAAO,mBAAmB,EAAE,cAAc;4BAQ3C;IAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAAC,IAAI,CAAC,EAAE,OAAO,EAAE,CAAC;IAAC,QAAQ,EAAE,IAAI,CAAA;CAAE"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Memory of the last suggestions returned for each node path
|
|
3
|
+
* @description Suggestion values can be large objects, they are not returned in full
|
|
4
|
+
* to the agent. They are memorized here so that setFieldValue can reuse the original
|
|
5
|
+
* value from its index.
|
|
6
|
+
*
|
|
7
|
+
* Searches on the same path accumulate rather than replace one another, and indices are
|
|
8
|
+
* absolute across them. Replacing meant a second search silently rebound every index the
|
|
9
|
+
* first had handed out, so an agent applying an index it had been given a moment earlier
|
|
10
|
+
* would set a different value with no error — the worst kind of failure this protocol can
|
|
11
|
+
* produce, since nothing in the transcript looks wrong. A write can change another
|
|
12
|
+
* field's options, so writes drop what they invalidate — see `retainFresh`.
|
|
13
|
+
*/
|
|
14
|
+
/** @typedef {{value: unknown, title: string, key?: string}} SuggestionItem */
|
|
15
|
+
/**
|
|
16
|
+
* Per WebMCP instance memory of the suggestions, keyed by node path.
|
|
17
|
+
*/
|
|
18
|
+
export class SuggestionsStore {
|
|
19
|
+
/**
|
|
20
|
+
* @private
|
|
21
|
+
* @type {Map<string, SuggestionItem[]>}
|
|
22
|
+
*/
|
|
23
|
+
private _byPath;
|
|
24
|
+
/**
|
|
25
|
+
* What the node's items depended on when each path was memorized, so a write can tell
|
|
26
|
+
* whether it invalidated them. See `retainFresh`.
|
|
27
|
+
* @private
|
|
28
|
+
* @type {Map<string, unknown>}
|
|
29
|
+
*/
|
|
30
|
+
private _cacheKeys;
|
|
31
|
+
/**
|
|
32
|
+
* Paths that HAD memorized suggestions until a write dropped them. Kept so that the
|
|
33
|
+
* failure can say which of the two things happened: an agent told to "call
|
|
34
|
+
* getFieldSuggestions first" when it did exactly that, one call ago, cannot tell that
|
|
35
|
+
* the list went stale, and the eval shows it stops trusting suggestionIndex entirely.
|
|
36
|
+
* @private
|
|
37
|
+
* @type {Set<string>}
|
|
38
|
+
*/
|
|
39
|
+
private _invalidated;
|
|
40
|
+
/**
|
|
41
|
+
* Memorize a search's items and return the index its first item was given. Indices are
|
|
42
|
+
* absolute per path, so an index handed out earlier keeps meaning what the agent saw.
|
|
43
|
+
* @param {string} path
|
|
44
|
+
* @param {SuggestionItem[]} items
|
|
45
|
+
* @param {unknown} [cacheKey] - the node's itemsCacheKey, what its options depend on
|
|
46
|
+
* @returns {number} the index of the first of these items
|
|
47
|
+
*/
|
|
48
|
+
add(path: string, items: SuggestionItem[], cacheKey?: unknown): number;
|
|
49
|
+
/**
|
|
50
|
+
* Drop only the paths a write actually invalidated.
|
|
51
|
+
*
|
|
52
|
+
* Clearing everything on every write was correct but far broader than the hazard it
|
|
53
|
+
* guarded: writing one field cannot change the options of a field whose list does not
|
|
54
|
+
* depend on it, and the eval caught the cost twice on the same case — once recovered in
|
|
55
|
+
* one call, once in three. `isFresh` is given the key recorded at `add` time so the
|
|
56
|
+
* caller can compare it with the node's current `itemsCacheKey`, which is what the state
|
|
57
|
+
* layer itself uses to decide whether to re-fetch: a resolved URL for a remote picker, so
|
|
58
|
+
* the comparison is exact where it matters, and a value that simply differs for an
|
|
59
|
+
* expression-based list, which over-invalidates in the safe direction.
|
|
60
|
+
* @param {(path: string, cacheKey: unknown) => boolean} isFresh
|
|
61
|
+
*/
|
|
62
|
+
retainFresh(isFresh: (path: string, cacheKey: unknown) => boolean): void;
|
|
63
|
+
/**
|
|
64
|
+
* @param {string} path
|
|
65
|
+
* @returns {SuggestionItem[]|undefined}
|
|
66
|
+
*/
|
|
67
|
+
get(path: string): SuggestionItem[] | undefined;
|
|
68
|
+
/**
|
|
69
|
+
* Get the full original value memorized for a path at a given index.
|
|
70
|
+
* @param {string} path
|
|
71
|
+
* @param {number} index
|
|
72
|
+
* @returns {unknown}
|
|
73
|
+
*/
|
|
74
|
+
getValue(path: string, index: number): unknown;
|
|
75
|
+
clear(): void;
|
|
76
|
+
}
|
|
77
|
+
export type SuggestionItem = {
|
|
78
|
+
value: unknown;
|
|
79
|
+
title: string;
|
|
80
|
+
key?: string;
|
|
81
|
+
};
|
|
82
|
+
//# sourceMappingURL=suggestions-store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"suggestions-store.d.ts","sourceRoot":"","sources":["../../src/webmcp/suggestions-store.js"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,8EAA8E;AAE9E;;GAEG;AACH;IACE;;;OAGG;IACH,gBAAmB;IAEnB;;;;;OAKG;IACH,mBAAsB;IAEtB;;;;;;;OAOG;IACH,qBAAwB;IAExB;;;;;;;OAOG;IACH,UALW,MAAM,SACN,cAAc,EAAE,aAChB,OAAO,GACL,MAAM,CAalB;IAED;;;;;;;;;;;;OAYG;IACH,qBAFW,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,KAAK,OAAO,QAStD;IAED;;;OAGG;IACH,UAHW,MAAM,GACJ,cAAc,EAAE,GAAC,SAAS,CAItC;IAED;;;;;OAKG;IACH,eAJW,MAAM,SACN,MAAM,GACJ,OAAO,CAcnB;IAED,cAIC;CACF;6BA1Ga;IAAC,KAAK,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAA;CAAC"}
|