@happyvertical/smrt-scanner 0.46.0 → 0.47.1
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/AGENTS.md +86 -2
- package/dist/chunks/{scanner-C3VqXyzB.js → scanner-CxUeI0FI.js} +185 -24
- package/dist/chunks/scanner-CxUeI0FI.js.map +1 -0
- package/dist/cli.js +1 -1
- package/dist/index.d.ts +209 -5
- package/dist/index.js +2 -2
- package/dist/types.d.ts +67 -4
- package/package.json +1 -1
- package/dist/chunks/scanner-C3VqXyzB.js.map +0 -1
package/dist/cli.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { n as ManifestAdapter, t as OxcScanner } from "./chunks/scanner-
|
|
2
|
+
import { n as ManifestAdapter, t as OxcScanner } from "./chunks/scanner-CxUeI0FI.js";
|
|
3
3
|
import { readFileSync, writeFileSync } from "node:fs";
|
|
4
4
|
import { dirname, resolve } from "node:path";
|
|
5
5
|
import { fileURLToPath } from "node:url";
|
package/dist/index.d.ts
CHANGED
|
@@ -13,10 +13,15 @@ export declare interface AgentSurfaceCapability {
|
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
|
-
*
|
|
16
|
+
* Something a reader of the emitted surface has to know about a declaration.
|
|
17
17
|
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
18
|
+
* Two kinds, and the difference is whether the entry survived. Every code but
|
|
19
|
+
* `tool-name-collision` reports a declaration that is NOT emitted — never a
|
|
20
|
+
* silent omission, so each of those messages names `useWebMcpTool`, the escape
|
|
21
|
+
* hatch for a genuinely computed tool set. A `tool-name-collision` is
|
|
22
|
+
* advisory: the declaration IS emitted, and the diagnostic records that its
|
|
23
|
+
* derived WebMCP tool name is already spoken for by something outside the
|
|
24
|
+
* declared surface.
|
|
20
25
|
*/
|
|
21
26
|
export declare interface AgentSurfaceDiagnostic {
|
|
22
27
|
code: AgentSurfaceDiagnosticCode;
|
|
@@ -28,7 +33,7 @@ export declare interface AgentSurfaceDiagnostic {
|
|
|
28
33
|
}
|
|
29
34
|
|
|
30
35
|
/** Why a recognized declaration could not be emitted. */
|
|
31
|
-
export declare type AgentSurfaceDiagnosticCode = 'non-literal-argument' | 'not-module-scope' | 'argument-count' | 'incomplete-declaration' | 'invalid-identity' | 'svelte-declaration' | 'duplicate-identity';
|
|
36
|
+
export declare type AgentSurfaceDiagnosticCode = 'non-literal-argument' | 'not-module-scope' | 'argument-count' | 'incomplete-declaration' | 'invalid-identity' | 'svelte-declaration' | 'duplicate-identity' | 'tool-name-collision';
|
|
32
37
|
|
|
33
38
|
/**
|
|
34
39
|
* Effect classification, mirroring `CapabilityEffect` in
|
|
@@ -92,6 +97,41 @@ export declare type AgentSurfacePlaybookStep = {
|
|
|
92
97
|
id: string;
|
|
93
98
|
};
|
|
94
99
|
|
|
100
|
+
export declare interface AgentSurfaceToolNameOptions {
|
|
101
|
+
/**
|
|
102
|
+
* Generated model tool names for the SAME manifest, already filtered by the
|
|
103
|
+
* exposure policy.
|
|
104
|
+
*
|
|
105
|
+
* Filtered, not enumerated: comparing against every verb a class COULD
|
|
106
|
+
* expose would report collisions with tools that are never registered.
|
|
107
|
+
* `buildWebMcpToolDefinitions` in `@happyvertical/smrt-core/vite-plugin` is
|
|
108
|
+
* the function that emits the runtime definitions, so its output is the only
|
|
109
|
+
* honest input here.
|
|
110
|
+
*/
|
|
111
|
+
generatedToolNames?: readonly GeneratedModelToolName[];
|
|
112
|
+
/**
|
|
113
|
+
* Prefixes the fixed UI tools are mounted under, defaulting to the
|
|
114
|
+
* registrar's own `smrt_ui_`.
|
|
115
|
+
*
|
|
116
|
+
* Supplied for the same reason `generatedToolNames` is: a name is compared
|
|
117
|
+
* against tools that will really register. Quantifying over every prefix an
|
|
118
|
+
* app COULD have configured — deriving the would-be prefix from the name —
|
|
119
|
+
* looks like more coverage and is the opposite. Under the default it has no
|
|
120
|
+
* true positive at all, because an id flattening to `smrt_ui_*` is rejected
|
|
121
|
+
* by {@link intentIdentityProblem} before it can become an entry, so every
|
|
122
|
+
* diagnostic such a rule emits for a default-configured app is false. A
|
|
123
|
+
* warning that is always wrong where it fires is worse than silence: it is
|
|
124
|
+
* persisted into the knowledge artifact, counted by `smrt doctor`, and
|
|
125
|
+
* clearable only by renaming an intent that was correct.
|
|
126
|
+
*
|
|
127
|
+
* There is no build-time source for this today — `ui.prefix` is a runtime
|
|
128
|
+
* `<Provider webmcp={{ ui: { prefix } }}>` prop — so the default leaves this
|
|
129
|
+
* half dormant. That is the honest state of it, and the seam is ready for
|
|
130
|
+
* the caller that can fill it.
|
|
131
|
+
*/
|
|
132
|
+
uiToolPrefixes?: readonly string[];
|
|
133
|
+
}
|
|
134
|
+
|
|
95
135
|
declare interface ArrayExpression extends BaseNode {
|
|
96
136
|
type: 'ArrayExpression';
|
|
97
137
|
elements: (Expression | SpreadElement | null)[];
|
|
@@ -129,6 +169,57 @@ declare interface CallExpression extends BaseNode {
|
|
|
129
169
|
typeParameters?: TSTypeParameterInstantiation;
|
|
130
170
|
}
|
|
131
171
|
|
|
172
|
+
/**
|
|
173
|
+
* Report an emitted intent whose derived WebMCP tool name is already spoken
|
|
174
|
+
* for by something OUTSIDE the declared surface (#2725).
|
|
175
|
+
*
|
|
176
|
+
* `mergeAgentSurfaces` resolves the collisions it can see on its own —
|
|
177
|
+
* intent vs intent, where `intentToolName` is not injective. It cannot see the
|
|
178
|
+
* two sources that live outside the declaration set:
|
|
179
|
+
*
|
|
180
|
+
* - **generated model tools**, `${className.toLowerCase()}_${action}`, so
|
|
181
|
+
* `defineIntent({ id: 'product.list' })` lands exactly on `Product.list`;
|
|
182
|
+
* - **the six fixed UI tools** under a CUSTOM `webmcp.ui.prefix`. The default
|
|
183
|
+
* `smrt_ui_` is already a hard rejection in {@link intentIdentityProblem},
|
|
184
|
+
* mirroring `defineIntent`; a custom prefix is not, because `defineIntent`
|
|
185
|
+
* accepts such an id and the intent really does register.
|
|
186
|
+
*
|
|
187
|
+
* ### These are warnings, not drops — unlike intent vs intent
|
|
188
|
+
*
|
|
189
|
+
* The asymmetry is real and it is the whole reason this is a separate pass.
|
|
190
|
+
* Two colliding intents are a closed question: `defineIntent` REJECTS the
|
|
191
|
+
* second declaration, so only one can exist and emitting both would overstate
|
|
192
|
+
* the surface by an entry that cannot be. Neither collision here is closed:
|
|
193
|
+
*
|
|
194
|
+
* - `defineIntent` accepts the intent, so the declaration is real and the
|
|
195
|
+
* entry belongs in the artifact. Dropping it would make the emitted surface
|
|
196
|
+
* disagree with the source, which is the failure this module exists to
|
|
197
|
+
* prevent;
|
|
198
|
+
* - which registration survives is decided at mount by the document-global
|
|
199
|
+
* tool-name lock (#2613), which rejects the second with a
|
|
200
|
+
* `WebMcpToolNameCollisionError` naming the owner. That is a runtime answer
|
|
201
|
+
* to a question the build can already see coming, and it costs whoever loses
|
|
202
|
+
* its tool; the build-time notice is the earlier, cheaper one;
|
|
203
|
+
* - and whether it happens at all depends on runtime values no artifact
|
|
204
|
+
* records: a WebMCP `namespace` moves every generated tool out of the way,
|
|
205
|
+
* an `effects` policy can exclude the action, and a page need not mount
|
|
206
|
+
* both. A build-time drop would be a guess about all three.
|
|
207
|
+
*
|
|
208
|
+
* So the entry stays and the report is advisory. The message names both sides,
|
|
209
|
+
* the consequence, and — because those runtime values are unknowable here and
|
|
210
|
+
* a `namespace` genuinely dissolves the collision — the precondition under
|
|
211
|
+
* which it holds. Without that last part a namespaced app gets a notice that
|
|
212
|
+
* is always wrong where it fires, recommending the very remedy it already
|
|
213
|
+
* applied, with renaming a correct intent as the only clearing action. That is
|
|
214
|
+
* the standard `uiToolPrefixes` exists to meet; the generated half has to meet
|
|
215
|
+
* it too, and it does so in the message because the caller CAN supply
|
|
216
|
+
* namespaced names when it knows them.
|
|
217
|
+
*
|
|
218
|
+
* @param surface - A MERGED surface; intent-vs-intent losers are already gone.
|
|
219
|
+
* @returns Diagnostics only. The caller appends them; nothing is removed.
|
|
220
|
+
*/
|
|
221
|
+
export declare function checkAgentSurfaceToolNames(surface: AgentSurface, options?: AgentSurfaceToolNameOptions): AgentSurfaceDiagnostic[];
|
|
222
|
+
|
|
132
223
|
declare interface ClassBody extends BaseNode {
|
|
133
224
|
type: 'ClassBody';
|
|
134
225
|
body: ClassElement[];
|
|
@@ -314,6 +405,28 @@ declare interface FunctionExpression extends BaseNode {
|
|
|
314
405
|
body: BlockStatement;
|
|
315
406
|
}
|
|
316
407
|
|
|
408
|
+
/**
|
|
409
|
+
* One WebMCP tool name the build will register for a generated model action,
|
|
410
|
+
* supplied by the caller that knows the exposure policy.
|
|
411
|
+
*/
|
|
412
|
+
export declare interface GeneratedModelToolName {
|
|
413
|
+
/**
|
|
414
|
+
* The tool name EXACTLY as it will be registered.
|
|
415
|
+
*
|
|
416
|
+
* This pass never derives a generated name and never applies a namespace of
|
|
417
|
+
* its own: it compares the strings it is handed. That is deliberate. The
|
|
418
|
+
* WebMCP `namespace` is a runtime `<Provider webmcp={{ namespace }}>` value
|
|
419
|
+
* that no build artifact records, so inventing a build-time declaration of
|
|
420
|
+
* it here would create a second place to say what the provider already says,
|
|
421
|
+
* free to disagree with it silently. Taking names instead means a caller
|
|
422
|
+
* that ever does know the namespace qualifies them itself and nothing in
|
|
423
|
+
* this module changes.
|
|
424
|
+
*/
|
|
425
|
+
name: string;
|
|
426
|
+
/** What owns that name, for the message — e.g. `Product.list`. */
|
|
427
|
+
declaredBy?: string;
|
|
428
|
+
}
|
|
429
|
+
|
|
317
430
|
declare interface Identifier extends BaseNode {
|
|
318
431
|
type: 'Identifier';
|
|
319
432
|
name: string;
|
|
@@ -863,11 +976,19 @@ declare interface MethodDefinition {
|
|
|
863
976
|
type: string;
|
|
864
977
|
optional: boolean;
|
|
865
978
|
default?: unknown;
|
|
979
|
+
/** See `RawParameterDefinition.typeUnresolved` (#2686). */
|
|
980
|
+
typeUnresolved?: boolean;
|
|
981
|
+
/** See `RawParameterDefinition.memberTypes` (#2686). */
|
|
982
|
+
memberTypes?: string[];
|
|
983
|
+
/** See `RawParameterDefinition.unionBranches` (#2686). */
|
|
984
|
+
unionBranches?: ParameterTypeBranch[];
|
|
866
985
|
}>;
|
|
867
986
|
returnType: string;
|
|
868
987
|
description?: string;
|
|
869
988
|
isStatic: boolean;
|
|
870
989
|
isPublic: boolean;
|
|
990
|
+
/** Config of an `@method()` decorator on this method (#2686). */
|
|
991
|
+
decoratorConfig?: Record<string, unknown>;
|
|
871
992
|
}
|
|
872
993
|
|
|
873
994
|
declare interface MethodDefinition_2 extends BaseNode {
|
|
@@ -878,6 +999,7 @@ declare interface MethodDefinition_2 extends BaseNode {
|
|
|
878
999
|
computed: boolean;
|
|
879
1000
|
static: boolean;
|
|
880
1001
|
accessibility?: 'public' | 'private' | 'protected';
|
|
1002
|
+
decorators?: Decorator[];
|
|
881
1003
|
}
|
|
882
1004
|
|
|
883
1005
|
declare interface NewExpression extends BaseNode {
|
|
@@ -1218,6 +1340,14 @@ export declare interface OxcScannerOptions {
|
|
|
1218
1340
|
agentSurfaceInclude?: string[];
|
|
1219
1341
|
}
|
|
1220
1342
|
|
|
1343
|
+
/** One branch of a top-level union parameter type (#2686). */
|
|
1344
|
+
export declare interface ParameterTypeBranch {
|
|
1345
|
+
/** The branch's own type name, e.g. `string` or `object`. */
|
|
1346
|
+
type: string;
|
|
1347
|
+
/** Inline object members declared by THIS branch only. */
|
|
1348
|
+
memberTypes?: string[];
|
|
1349
|
+
}
|
|
1350
|
+
|
|
1221
1351
|
/**
|
|
1222
1352
|
* Read one file for agent-surface declarations ONLY (#2591).
|
|
1223
1353
|
*
|
|
@@ -1456,6 +1586,17 @@ export declare interface RawMethodDefinition {
|
|
|
1456
1586
|
returnType: string | null;
|
|
1457
1587
|
/** JSDoc description if present */
|
|
1458
1588
|
description: string | null;
|
|
1589
|
+
/**
|
|
1590
|
+
* Config object of an `@method()` decorator on this method, when one is
|
|
1591
|
+
* present. `{}` for a bare `@method()`; `undefined` when the method carries
|
|
1592
|
+
* no `@method()` decorator at all — the two are distinct, because an
|
|
1593
|
+
* explicit bare decorator still marks the method as deliberately reviewed.
|
|
1594
|
+
*
|
|
1595
|
+
* Values are extracted with the same literal-only rules the class-level
|
|
1596
|
+
* `@smrt()` config uses, so an expression the scanner cannot resolve becomes
|
|
1597
|
+
* a scan error rather than a silently dropped `expose: false`.
|
|
1598
|
+
*/
|
|
1599
|
+
decoratorConfig?: Record<string, unknown>;
|
|
1459
1600
|
/** Start line in source */
|
|
1460
1601
|
line: number;
|
|
1461
1602
|
}
|
|
@@ -1472,6 +1613,45 @@ export declare interface RawParameterDefinition {
|
|
|
1472
1613
|
optional: boolean;
|
|
1473
1614
|
/** Default value as string */
|
|
1474
1615
|
defaultValue: string | null;
|
|
1616
|
+
/**
|
|
1617
|
+
* True when the parameter carries a type annotation the scanner could not
|
|
1618
|
+
* express as a string — an intersection, tuple, conditional, mapped,
|
|
1619
|
+
* `typeof`, or indexed-access type — or when an inline object literal
|
|
1620
|
+
* contains such a member.
|
|
1621
|
+
*
|
|
1622
|
+
* This is the provenance that separates "the author wrote `any`" from "the
|
|
1623
|
+
* scanner gave up": both previously reached the manifest as the string
|
|
1624
|
+
* `'any'`. Consumers that must fail closed on an uncertain type (the API
|
|
1625
|
+
* wire-ability gate) read this rather than trusting `type`.
|
|
1626
|
+
*
|
|
1627
|
+
* `type: null` with `typeUnresolved` absent means the parameter simply has
|
|
1628
|
+
* no annotation, which is an implicit — and genuinely authored — `any`.
|
|
1629
|
+
*/
|
|
1630
|
+
typeUnresolved?: boolean;
|
|
1631
|
+
/**
|
|
1632
|
+
* Resolved member types of an INLINE object-literal annotation
|
|
1633
|
+
* (`{ onDone: () => void; target: Content }` → `['Function', 'Content']`),
|
|
1634
|
+
* flattened across nested literals, arrays, and unions.
|
|
1635
|
+
*
|
|
1636
|
+
* `extractTypeName` collapses every inline literal to the single string
|
|
1637
|
+
* `'object'`, which erases exactly the members a caller needs to judge
|
|
1638
|
+
* whether the bag can cross a wire. NAMED bags (an interface, type alias,
|
|
1639
|
+
* `Partial<>`/`Pick<>`) are deliberately NOT expanded — resolving them needs
|
|
1640
|
+
* cross-file type resolution this AST layer does not do, and they are
|
|
1641
|
+
* accepted heuristically by the consumers that care.
|
|
1642
|
+
*/
|
|
1643
|
+
memberTypes?: string[];
|
|
1644
|
+
/**
|
|
1645
|
+
* For a top-level UNION, each branch with the inline members IT declared.
|
|
1646
|
+
*
|
|
1647
|
+
* `memberTypes` above flattens across branches, which lets one branch veto
|
|
1648
|
+
* another: `{ callback: () => void } | string` is wire-able through its
|
|
1649
|
+
* string branch, but the flattened `Function` rejected the whole parameter.
|
|
1650
|
+
* A consumer that understands this field MUST prefer it over `memberTypes`
|
|
1651
|
+
* for unions. Absent on a non-union parameter and on manifests generated
|
|
1652
|
+
* before #2686.
|
|
1653
|
+
*/
|
|
1654
|
+
unionBranches?: ParameterTypeBranch[];
|
|
1475
1655
|
}
|
|
1476
1656
|
|
|
1477
1657
|
/** Preserve relative glob escapes; normalize separators only after rewriting. */
|
|
@@ -1659,6 +1839,10 @@ declare interface TSArrayType extends BaseNode {
|
|
|
1659
1839
|
elementType: TSType;
|
|
1660
1840
|
}
|
|
1661
1841
|
|
|
1842
|
+
declare interface TSBigIntKeyword extends BaseNode {
|
|
1843
|
+
type: 'TSBigIntKeyword';
|
|
1844
|
+
}
|
|
1845
|
+
|
|
1662
1846
|
declare interface TSBooleanKeyword extends BaseNode {
|
|
1663
1847
|
type: 'TSBooleanKeyword';
|
|
1664
1848
|
}
|
|
@@ -1702,6 +1886,10 @@ declare interface TSMethodSignature extends BaseNode {
|
|
|
1702
1886
|
returnType?: TSTypeAnnotation;
|
|
1703
1887
|
}
|
|
1704
1888
|
|
|
1889
|
+
declare interface TSNeverKeyword extends BaseNode {
|
|
1890
|
+
type: 'TSNeverKeyword';
|
|
1891
|
+
}
|
|
1892
|
+
|
|
1705
1893
|
declare interface TSNullKeyword extends BaseNode {
|
|
1706
1894
|
type: 'TSNullKeyword';
|
|
1707
1895
|
}
|
|
@@ -1710,6 +1898,10 @@ declare interface TSNumberKeyword extends BaseNode {
|
|
|
1710
1898
|
type: 'TSNumberKeyword';
|
|
1711
1899
|
}
|
|
1712
1900
|
|
|
1901
|
+
declare interface TSObjectKeyword extends BaseNode {
|
|
1902
|
+
type: 'TSObjectKeyword';
|
|
1903
|
+
}
|
|
1904
|
+
|
|
1713
1905
|
declare interface TSPropertySignature extends BaseNode {
|
|
1714
1906
|
type: 'TSPropertySignature';
|
|
1715
1907
|
key: Expression;
|
|
@@ -1728,7 +1920,15 @@ declare interface TSStringKeyword extends BaseNode {
|
|
|
1728
1920
|
type: 'TSStringKeyword';
|
|
1729
1921
|
}
|
|
1730
1922
|
|
|
1731
|
-
declare
|
|
1923
|
+
declare interface TSSymbolKeyword extends BaseNode {
|
|
1924
|
+
type: 'TSSymbolKeyword';
|
|
1925
|
+
}
|
|
1926
|
+
|
|
1927
|
+
declare interface TSThisType extends BaseNode {
|
|
1928
|
+
type: 'TSThisType';
|
|
1929
|
+
}
|
|
1930
|
+
|
|
1931
|
+
declare type TSType = TSStringKeyword | TSNumberKeyword | TSBooleanKeyword | TSAnyKeyword | TSUnknownKeyword | TSNeverKeyword | TSObjectKeyword | TSBigIntKeyword | TSSymbolKeyword | TSVoidKeyword | TSNullKeyword | TSUndefinedKeyword | TSThisType | TSTypeReference | TSArrayType | TSUnionType | TSTypeLiteral | TSLiteralType | TSFunctionType;
|
|
1732
1932
|
|
|
1733
1933
|
declare interface TSTypeAliasDeclaration extends BaseNode {
|
|
1734
1934
|
type: 'TSTypeAliasDeclaration';
|
|
@@ -1769,6 +1969,10 @@ declare interface TSUnionType extends BaseNode {
|
|
|
1769
1969
|
types: TSType[];
|
|
1770
1970
|
}
|
|
1771
1971
|
|
|
1972
|
+
declare interface TSUnknownKeyword extends BaseNode {
|
|
1973
|
+
type: 'TSUnknownKeyword';
|
|
1974
|
+
}
|
|
1975
|
+
|
|
1772
1976
|
declare interface TSVoidKeyword extends BaseNode {
|
|
1773
1977
|
type: 'TSVoidKeyword';
|
|
1774
1978
|
}
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as
|
|
1
|
+
import { _ as scanSvelteAgentSurface, a as parseFile, c as discoverSourceFiles, d as checkAgentSurfaceToolNames, f as emptyAgentSurface, g as mergeAgentSurfaces, h as isPrunedAgentSurfacePath, i as parseAgentSurfaceFile, l as normalizeGlobSeparators, m as isAgentSurfaceSourcePath, n as ManifestAdapter, o as parseSource, p as extractAgentSurface, r as extractSmrtImports, s as InheritanceResolver, t as OxcScanner, u as relativeGlobToCwd, v as sourceMayDeclareAgentSurface } from "./chunks/scanner-CxUeI0FI.js";
|
|
2
2
|
import "./types.js";
|
|
3
3
|
import { existsSync, readFileSync } from "node:fs";
|
|
4
4
|
import { basename, resolve } from "node:path";
|
|
@@ -272,6 +272,6 @@ async function verifyManifestCompleteness(options) {
|
|
|
272
272
|
};
|
|
273
273
|
}
|
|
274
274
|
//#endregion
|
|
275
|
-
export { InheritanceResolver, ManifestAdapter, OxcScanner, classifyNumericFieldName, discoverSourceFiles, emptyAgentSurface, extractAgentSurface, extractSmrtImports, isAgentSurfaceSourcePath, isPrunedAgentSurfacePath, lintNumericPrecision, mergeAgentSurfaces, normalizeGlobSeparators, parseAgentSurfaceFile, parseFile, parseSource, relativeGlobToCwd, scanSvelteAgentSurface, sourceMayContainNumericPrecisionIssue, sourceMayDeclareAgentSurface, splitIdentifierWords, verifyManifestCompleteness };
|
|
275
|
+
export { InheritanceResolver, ManifestAdapter, OxcScanner, checkAgentSurfaceToolNames, classifyNumericFieldName, discoverSourceFiles, emptyAgentSurface, extractAgentSurface, extractSmrtImports, isAgentSurfaceSourcePath, isPrunedAgentSurfacePath, lintNumericPrecision, mergeAgentSurfaces, normalizeGlobSeparators, parseAgentSurfaceFile, parseFile, parseSource, relativeGlobToCwd, scanSvelteAgentSurface, sourceMayContainNumericPrecisionIssue, sourceMayDeclareAgentSurface, splitIdentifierWords, verifyManifestCompleteness };
|
|
276
276
|
|
|
277
277
|
//# sourceMappingURL=index.js.map
|
package/dist/types.d.ts
CHANGED
|
@@ -13,10 +13,15 @@ export declare interface AgentSurfaceCapability {
|
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
|
-
*
|
|
16
|
+
* Something a reader of the emitted surface has to know about a declaration.
|
|
17
17
|
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
18
|
+
* Two kinds, and the difference is whether the entry survived. Every code but
|
|
19
|
+
* `tool-name-collision` reports a declaration that is NOT emitted — never a
|
|
20
|
+
* silent omission, so each of those messages names `useWebMcpTool`, the escape
|
|
21
|
+
* hatch for a genuinely computed tool set. A `tool-name-collision` is
|
|
22
|
+
* advisory: the declaration IS emitted, and the diagnostic records that its
|
|
23
|
+
* derived WebMCP tool name is already spoken for by something outside the
|
|
24
|
+
* declared surface.
|
|
20
25
|
*/
|
|
21
26
|
export declare interface AgentSurfaceDiagnostic {
|
|
22
27
|
code: AgentSurfaceDiagnosticCode;
|
|
@@ -28,7 +33,7 @@ export declare interface AgentSurfaceDiagnostic {
|
|
|
28
33
|
}
|
|
29
34
|
|
|
30
35
|
/** Why a recognized declaration could not be emitted. */
|
|
31
|
-
export declare type AgentSurfaceDiagnosticCode = 'non-literal-argument' | 'not-module-scope' | 'argument-count' | 'incomplete-declaration' | 'invalid-identity' | 'svelte-declaration' | 'duplicate-identity';
|
|
36
|
+
export declare type AgentSurfaceDiagnosticCode = 'non-literal-argument' | 'not-module-scope' | 'argument-count' | 'incomplete-declaration' | 'invalid-identity' | 'svelte-declaration' | 'duplicate-identity' | 'tool-name-collision';
|
|
32
37
|
|
|
33
38
|
/**
|
|
34
39
|
* Effect classification, mirroring `CapabilityEffect` in
|
|
@@ -250,6 +255,14 @@ export declare interface OxcScannerOptions {
|
|
|
250
255
|
agentSurfaceInclude?: string[];
|
|
251
256
|
}
|
|
252
257
|
|
|
258
|
+
/** One branch of a top-level union parameter type (#2686). */
|
|
259
|
+
export declare interface ParameterTypeBranch {
|
|
260
|
+
/** The branch's own type name, e.g. `string` or `object`. */
|
|
261
|
+
type: string;
|
|
262
|
+
/** Inline object members declared by THIS branch only. */
|
|
263
|
+
memberTypes?: string[];
|
|
264
|
+
}
|
|
265
|
+
|
|
253
266
|
/**
|
|
254
267
|
* Type definitions for OXC-based SMRT scanner
|
|
255
268
|
*
|
|
@@ -377,6 +390,17 @@ export declare interface RawMethodDefinition {
|
|
|
377
390
|
returnType: string | null;
|
|
378
391
|
/** JSDoc description if present */
|
|
379
392
|
description: string | null;
|
|
393
|
+
/**
|
|
394
|
+
* Config object of an `@method()` decorator on this method, when one is
|
|
395
|
+
* present. `{}` for a bare `@method()`; `undefined` when the method carries
|
|
396
|
+
* no `@method()` decorator at all — the two are distinct, because an
|
|
397
|
+
* explicit bare decorator still marks the method as deliberately reviewed.
|
|
398
|
+
*
|
|
399
|
+
* Values are extracted with the same literal-only rules the class-level
|
|
400
|
+
* `@smrt()` config uses, so an expression the scanner cannot resolve becomes
|
|
401
|
+
* a scan error rather than a silently dropped `expose: false`.
|
|
402
|
+
*/
|
|
403
|
+
decoratorConfig?: Record<string, unknown>;
|
|
380
404
|
/** Start line in source */
|
|
381
405
|
line: number;
|
|
382
406
|
}
|
|
@@ -393,6 +417,45 @@ export declare interface RawParameterDefinition {
|
|
|
393
417
|
optional: boolean;
|
|
394
418
|
/** Default value as string */
|
|
395
419
|
defaultValue: string | null;
|
|
420
|
+
/**
|
|
421
|
+
* True when the parameter carries a type annotation the scanner could not
|
|
422
|
+
* express as a string — an intersection, tuple, conditional, mapped,
|
|
423
|
+
* `typeof`, or indexed-access type — or when an inline object literal
|
|
424
|
+
* contains such a member.
|
|
425
|
+
*
|
|
426
|
+
* This is the provenance that separates "the author wrote `any`" from "the
|
|
427
|
+
* scanner gave up": both previously reached the manifest as the string
|
|
428
|
+
* `'any'`. Consumers that must fail closed on an uncertain type (the API
|
|
429
|
+
* wire-ability gate) read this rather than trusting `type`.
|
|
430
|
+
*
|
|
431
|
+
* `type: null` with `typeUnresolved` absent means the parameter simply has
|
|
432
|
+
* no annotation, which is an implicit — and genuinely authored — `any`.
|
|
433
|
+
*/
|
|
434
|
+
typeUnresolved?: boolean;
|
|
435
|
+
/**
|
|
436
|
+
* Resolved member types of an INLINE object-literal annotation
|
|
437
|
+
* (`{ onDone: () => void; target: Content }` → `['Function', 'Content']`),
|
|
438
|
+
* flattened across nested literals, arrays, and unions.
|
|
439
|
+
*
|
|
440
|
+
* `extractTypeName` collapses every inline literal to the single string
|
|
441
|
+
* `'object'`, which erases exactly the members a caller needs to judge
|
|
442
|
+
* whether the bag can cross a wire. NAMED bags (an interface, type alias,
|
|
443
|
+
* `Partial<>`/`Pick<>`) are deliberately NOT expanded — resolving them needs
|
|
444
|
+
* cross-file type resolution this AST layer does not do, and they are
|
|
445
|
+
* accepted heuristically by the consumers that care.
|
|
446
|
+
*/
|
|
447
|
+
memberTypes?: string[];
|
|
448
|
+
/**
|
|
449
|
+
* For a top-level UNION, each branch with the inline members IT declared.
|
|
450
|
+
*
|
|
451
|
+
* `memberTypes` above flattens across branches, which lets one branch veto
|
|
452
|
+
* another: `{ callback: () => void } | string` is wire-able through its
|
|
453
|
+
* string branch, but the flattened `Function` rejected the whole parameter.
|
|
454
|
+
* A consumer that understands this field MUST prefer it over `memberTypes`
|
|
455
|
+
* for unions. Absent on a non-union parameter and on manifests generated
|
|
456
|
+
* before #2686.
|
|
457
|
+
*/
|
|
458
|
+
unionBranches?: ParameterTypeBranch[];
|
|
396
459
|
}
|
|
397
460
|
|
|
398
461
|
/**
|