@happyvertical/smrt-svelte 0.43.4 → 0.43.6
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 +23 -0
- package/README.md +23 -1
- package/dist/components/forms/AddressInput.svelte +155 -42
- package/dist/components/forms/AddressInput.svelte.d.ts.map +1 -1
- package/dist/components/forms/CheckboxInput.svelte +40 -13
- package/dist/components/forms/CheckboxInput.svelte.d.ts.map +1 -1
- package/dist/components/forms/DateRangeInput.svelte +132 -16
- package/dist/components/forms/DateRangeInput.svelte.d.ts.map +1 -1
- package/dist/components/forms/DateTimeInput.svelte +48 -14
- package/dist/components/forms/DateTimeInput.svelte.d.ts.map +1 -1
- package/dist/components/forms/Form.svelte +599 -70
- package/dist/components/forms/Form.svelte.d.ts +6 -2
- package/dist/components/forms/Form.svelte.d.ts.map +1 -1
- package/dist/components/forms/MeasurementInput.svelte +137 -31
- package/dist/components/forms/MeasurementInput.svelte.d.ts.map +1 -1
- package/dist/components/forms/MoneyInput.svelte +42 -23
- package/dist/components/forms/MoneyInput.svelte.d.ts.map +1 -1
- package/dist/components/forms/NumberInput.svelte +59 -27
- package/dist/components/forms/NumberInput.svelte.d.ts.map +1 -1
- package/dist/components/forms/PhoneInput.svelte +51 -22
- package/dist/components/forms/PhoneInput.svelte.d.ts.map +1 -1
- package/dist/components/forms/SelectInput.svelte +38 -22
- package/dist/components/forms/SelectInput.svelte.d.ts.map +1 -1
- package/dist/components/forms/TextInput.svelte +32 -18
- package/dist/components/forms/TextInput.svelte.d.ts.map +1 -1
- package/dist/components/forms/TextareaInput.svelte +25 -18
- package/dist/components/forms/TextareaInput.svelte.d.ts.map +1 -1
- package/dist/components/forms/__tests__/AddressInput.behavior.test.js +94 -0
- package/dist/components/forms/__tests__/Form.behavior.test.js +1 -1
- package/dist/components/forms/__tests__/Form.extraction.test.js +68 -0
- package/dist/components/forms/__tests__/Form.test.js +28 -0
- package/dist/components/forms/__tests__/Form.webmcp.test.js +2123 -114
- package/dist/components/forms/__tests__/FormMicButton.test.js +0 -1
- package/dist/components/forms/__tests__/async-invalid-field.fixture.svelte +30 -0
- package/dist/components/forms/__tests__/async-invalid-field.fixture.svelte.d.ts +7 -0
- package/dist/components/forms/__tests__/async-invalid-field.fixture.svelte.d.ts.map +1 -0
- package/dist/components/forms/__tests__/async-validation-form.fixture.svelte +19 -0
- package/dist/components/forms/__tests__/async-validation-form.fixture.svelte.d.ts +9 -0
- package/dist/components/forms/__tests__/async-validation-form.fixture.svelte.d.ts.map +1 -0
- package/dist/components/forms/__tests__/async-validation-snapshot-form.fixture.svelte +21 -0
- package/dist/components/forms/__tests__/async-validation-snapshot-form.fixture.svelte.d.ts +8 -0
- package/dist/components/forms/__tests__/async-validation-snapshot-form.fixture.svelte.d.ts.map +1 -0
- package/dist/components/forms/__tests__/compound-registration-wrapper.fixture.svelte +27 -0
- package/dist/components/forms/__tests__/compound-registration-wrapper.fixture.svelte.d.ts +9 -0
- package/dist/components/forms/__tests__/compound-registration-wrapper.fixture.svelte.d.ts.map +1 -0
- package/dist/components/forms/__tests__/custom-registration-field.fixture.svelte +48 -0
- package/dist/components/forms/__tests__/custom-registration-field.fixture.svelte.d.ts +10 -0
- package/dist/components/forms/__tests__/custom-registration-field.fixture.svelte.d.ts.map +1 -0
- package/dist/components/forms/__tests__/form-extraction-values.fixture.svelte +26 -0
- package/dist/components/forms/__tests__/form-extraction-values.fixture.svelte.d.ts +13 -0
- package/dist/components/forms/__tests__/form-extraction-values.fixture.svelte.d.ts.map +1 -0
- package/dist/components/forms/__tests__/form-registration-lifecycle.fixture.svelte +52 -0
- package/dist/components/forms/__tests__/form-registration-lifecycle.fixture.svelte.d.ts +16 -0
- package/dist/components/forms/__tests__/form-registration-lifecycle.fixture.svelte.d.ts.map +1 -0
- package/dist/components/forms/__tests__/form-with-fields.fixture.svelte +108 -5
- package/dist/components/forms/__tests__/form-with-fields.fixture.svelte.d.ts +34 -0
- package/dist/components/forms/__tests__/form-with-fields.fixture.svelte.d.ts.map +1 -1
- package/dist/components/forms/__tests__/form-with-policy-field.fixture.svelte +24 -0
- package/dist/components/forms/__tests__/form-with-policy-field.fixture.svelte.d.ts +11 -0
- package/dist/components/forms/__tests__/form-with-policy-field.fixture.svelte.d.ts.map +1 -0
- package/dist/components/forms/__tests__/form-with-structured-fields.fixture.svelte +69 -4
- package/dist/components/forms/__tests__/form-with-structured-fields.fixture.svelte.d.ts +32 -0
- package/dist/components/forms/__tests__/form-with-structured-fields.fixture.svelte.d.ts.map +1 -1
- package/dist/components/forms/__tests__/legacy-form-context.fixture.svelte +44 -0
- package/dist/components/forms/__tests__/legacy-form-context.fixture.svelte.d.ts +9 -0
- package/dist/components/forms/__tests__/legacy-form-context.fixture.svelte.d.ts.map +1 -0
- package/dist/components/forms/__tests__/policy-field.fixture.svelte +35 -0
- package/dist/components/forms/__tests__/policy-field.fixture.svelte.d.ts +8 -0
- package/dist/components/forms/__tests__/policy-field.fixture.svelte.d.ts.map +1 -0
- package/dist/components/forms/prepare-field-value.d.ts +5 -0
- package/dist/components/forms/prepare-field-value.d.ts.map +1 -0
- package/dist/components/forms/prepare-field-value.js +15 -0
- package/dist/state/form-context.d.ts +28 -6
- package/dist/state/form-context.d.ts.map +1 -1
- package/dist/state/form-context.js +75 -7
- package/dist/web/__tests__/webmcp-composed.child.fixture.svelte +62 -0
- package/dist/web/__tests__/webmcp-composed.child.fixture.svelte.d.ts +8 -0
- package/dist/web/__tests__/webmcp-composed.child.fixture.svelte.d.ts.map +1 -0
- package/dist/web/__tests__/webmcp-composed.fixture.svelte +52 -0
- package/dist/web/__tests__/webmcp-composed.fixture.svelte.d.ts +12 -0
- package/dist/web/__tests__/webmcp-composed.fixture.svelte.d.ts.map +1 -0
- package/dist/web/__tests__/webmcp-composed.integration.svelte.test.js +247 -0
- package/dist/web/__tests__/webmcp-ssr.fixture.svelte +13 -0
- package/dist/web/__tests__/webmcp-ssr.fixture.svelte.d.ts +19 -0
- package/dist/web/__tests__/webmcp-ssr.fixture.svelte.d.ts.map +1 -0
- package/dist/web/__tests__/webmcp-ui.test.js +209 -33
- package/dist/web/__tests__/webmcp.test.js +20 -0
- package/dist/web/webmcp-ui.d.ts.map +1 -1
- package/dist/web/webmcp-ui.js +50 -31
- package/dist/web/webmcp.svelte.d.ts.map +1 -1
- package/dist/web/webmcp.svelte.js +6 -1
- package/package.json +8 -6
package/dist/web/webmcp-ui.js
CHANGED
|
@@ -21,6 +21,7 @@ const PUBLIC_FAILURE_REASONS = new Set([
|
|
|
21
21
|
const PUBLIC_CONTROL_RESULT_REASONS = new Set([
|
|
22
22
|
'not_found',
|
|
23
23
|
'consent_required',
|
|
24
|
+
'human_confirmation_required',
|
|
24
25
|
'sensitive_control',
|
|
25
26
|
'control_not_writable',
|
|
26
27
|
'control_not_editable',
|
|
@@ -126,9 +127,19 @@ function dataSurfaceIdentity(value) {
|
|
|
126
127
|
};
|
|
127
128
|
}
|
|
128
129
|
function sanitizeControl(snapshot) {
|
|
129
|
-
const
|
|
130
|
-
|
|
131
|
-
|
|
130
|
+
const sensitivityRedacted = snapshot.metadata.sensitivity === 'sensitive' ||
|
|
131
|
+
snapshot.metadata.sensitivity === 'secret';
|
|
132
|
+
const redactValue = sensitivityRedacted || snapshot.state.valueRedacted;
|
|
133
|
+
const redactStagedValue = sensitivityRedacted ||
|
|
134
|
+
snapshot.state.stagedValueRedacted ||
|
|
135
|
+
snapshot.state.staged?.valueRedacted === true;
|
|
136
|
+
const staged = snapshot.state.staged
|
|
137
|
+
? {
|
|
138
|
+
...snapshot.state.staged,
|
|
139
|
+
...(redactStagedValue ? { value: undefined, valueRedacted: true } : {}),
|
|
140
|
+
validationMessage: undefined,
|
|
141
|
+
}
|
|
142
|
+
: undefined;
|
|
132
143
|
return {
|
|
133
144
|
...snapshot,
|
|
134
145
|
identity: { ...snapshot.identity },
|
|
@@ -140,16 +151,30 @@ function sanitizeControl(snapshot) {
|
|
|
140
151
|
options: snapshot.metadata.options?.map((option) => ({ ...option })),
|
|
141
152
|
},
|
|
142
153
|
state: {
|
|
143
|
-
...
|
|
144
|
-
...(
|
|
145
|
-
|
|
146
|
-
:
|
|
147
|
-
...(redactText || snapshot.state.stagedValueRedacted
|
|
148
|
-
? { stagedValue: undefined }
|
|
154
|
+
...snapshot.state,
|
|
155
|
+
...(redactValue ? { value: undefined, valueRedacted: true } : {}),
|
|
156
|
+
...(redactStagedValue
|
|
157
|
+
? { stagedValue: undefined, stagedValueRedacted: true }
|
|
149
158
|
: {}),
|
|
159
|
+
...(staged ? { staged } : {}),
|
|
160
|
+
validationMessage: undefined,
|
|
150
161
|
},
|
|
151
162
|
};
|
|
152
163
|
}
|
|
164
|
+
function sanitizeControlResult(result) {
|
|
165
|
+
const reason = result.reason
|
|
166
|
+
? PUBLIC_CONTROL_RESULT_REASONS.has(result.reason)
|
|
167
|
+
? result.reason
|
|
168
|
+
: 'execution_failed'
|
|
169
|
+
: undefined;
|
|
170
|
+
return {
|
|
171
|
+
ok: result.ok,
|
|
172
|
+
action: result.action,
|
|
173
|
+
identity: { ...result.identity },
|
|
174
|
+
...(reason ? { reason } : {}),
|
|
175
|
+
...(result.snapshot ? { snapshot: sanitizeControl(result.snapshot) } : {}),
|
|
176
|
+
};
|
|
177
|
+
}
|
|
153
178
|
function sanitizeSurfaceValue(value, hiddenColumnIds, redactRowIds, parentKey) {
|
|
154
179
|
if (Array.isArray(value)) {
|
|
155
180
|
return value
|
|
@@ -330,18 +355,7 @@ function tools(prefix, controlRegistry, dataSurfaceRegistry) {
|
|
|
330
355
|
const result = await controlRegistry.execute(command, {
|
|
331
356
|
source: 'agent',
|
|
332
357
|
});
|
|
333
|
-
|
|
334
|
-
? PUBLIC_CONTROL_RESULT_REASONS.has(result.reason)
|
|
335
|
-
? result.reason
|
|
336
|
-
: 'execution_failed'
|
|
337
|
-
: undefined;
|
|
338
|
-
return {
|
|
339
|
-
...result,
|
|
340
|
-
...(reason ? { reason } : { reason: undefined }),
|
|
341
|
-
...(result.snapshot
|
|
342
|
-
? { snapshot: sanitizeControl(result.snapshot) }
|
|
343
|
-
: {}),
|
|
344
|
-
};
|
|
358
|
+
return sanitizeControlResult(result);
|
|
345
359
|
}),
|
|
346
360
|
},
|
|
347
361
|
readTool(`${prefix}list_data_surfaces`, 'List the data surfaces currently mounted in this SMRT Provider.', { type: 'object', additionalProperties: false, properties: {} }, (args) => executeSafely(() => {
|
|
@@ -435,21 +449,26 @@ export function registerWebMcpUiTools(options) {
|
|
|
435
449
|
locks.add(prefix);
|
|
436
450
|
const controller = new AbortController();
|
|
437
451
|
let disposed = false;
|
|
452
|
+
const dispose = () => {
|
|
453
|
+
if (disposed)
|
|
454
|
+
return;
|
|
455
|
+
disposed = true;
|
|
456
|
+
controller.abort();
|
|
457
|
+
locks.delete(prefix);
|
|
458
|
+
};
|
|
438
459
|
try {
|
|
439
460
|
for (const tool of tools(prefix, options.controlRegistry, options.dataSurfaceRegistry)) {
|
|
440
|
-
modelContext.registerTool(tool, {
|
|
461
|
+
const registration = modelContext.registerTool(tool, {
|
|
462
|
+
signal: controller.signal,
|
|
463
|
+
});
|
|
464
|
+
if (registration) {
|
|
465
|
+
void Promise.resolve(registration).catch(dispose);
|
|
466
|
+
}
|
|
441
467
|
}
|
|
442
468
|
}
|
|
443
469
|
catch (error) {
|
|
444
|
-
|
|
445
|
-
locks.delete(prefix);
|
|
470
|
+
dispose();
|
|
446
471
|
throw error;
|
|
447
472
|
}
|
|
448
|
-
return
|
|
449
|
-
if (disposed)
|
|
450
|
-
return;
|
|
451
|
-
disposed = true;
|
|
452
|
-
controller.abort();
|
|
453
|
-
locks.delete(prefix);
|
|
454
|
-
};
|
|
473
|
+
return dispose;
|
|
455
474
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webmcp.svelte.d.ts","sourceRoot":"","sources":["../../src/web/webmcp.svelte.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,MAAM,WAAW,cAAc;IAC7B,IAAI,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,CAAC;QACxB,oBAAoB,CAAC,EAAE,OAAO,CAAC;KAChC,CAAC;IACF,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;CACtE;AAID,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,QAAQ;QAChB,YAAY,CAAC,EAAE,kBAAkB,CAAC;KACnC;IAED,UAAU,kBAAkB;QAC1B,YAAY,CACV,IAAI,EAAE,cAAc,EACpB,OAAO,CAAC,EAAE;YAAE,MAAM,CAAC,EAAE,WAAW,CAAA;SAAE,GACjC,OAAO,CAAC,IAAI,CAAC,CAAC;KAClB;CACF;AAYD;;;;GAIG;AACH,wBAAgB,aAAa,CAC3B,OAAO,EAAE,MAAM,cAAc,GAAG,IAAI,GAAG,SAAS,GAC/C,IAAI,CAiBN"}
|
|
@@ -21,7 +21,12 @@ export function useWebMcpTool(factory) {
|
|
|
21
21
|
if (!spec)
|
|
22
22
|
return;
|
|
23
23
|
const controller = new AbortController();
|
|
24
|
-
context.registerTool(spec, {
|
|
24
|
+
const registration = context.registerTool(spec, {
|
|
25
|
+
signal: controller.signal,
|
|
26
|
+
});
|
|
27
|
+
if (registration) {
|
|
28
|
+
void Promise.resolve(registration).catch(() => controller.abort());
|
|
29
|
+
}
|
|
25
30
|
return () => controller.abort();
|
|
26
31
|
});
|
|
27
32
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@happyvertical/smrt-svelte",
|
|
3
|
-
"version": "0.43.
|
|
3
|
+
"version": "0.43.6",
|
|
4
4
|
"description": "Svelte 5 components for SMRT user management - auth, users, tenants, roles, permissions, groups",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"smrtRawPrimitives": "strict",
|
|
@@ -123,10 +123,10 @@
|
|
|
123
123
|
"@tanstack/db": "^0.6.14",
|
|
124
124
|
"@tanstack/svelte-db": "^0.1.91",
|
|
125
125
|
"esm-env": "^1.2.2",
|
|
126
|
-
"@happyvertical/smrt-
|
|
127
|
-
"@happyvertical/smrt-
|
|
128
|
-
"@happyvertical/smrt-
|
|
129
|
-
"@happyvertical/smrt-
|
|
126
|
+
"@happyvertical/smrt-languages": "0.43.6",
|
|
127
|
+
"@happyvertical/smrt-types": "0.43.6",
|
|
128
|
+
"@happyvertical/smrt-ui": "0.43.6",
|
|
129
|
+
"@happyvertical/smrt-web": "0.43.6"
|
|
130
130
|
},
|
|
131
131
|
"peerDependencies": {
|
|
132
132
|
"@huggingface/transformers": ">=3.8.1",
|
|
@@ -165,7 +165,9 @@
|
|
|
165
165
|
"svelte-check": "^4.7.1",
|
|
166
166
|
"typescript": "5.9.3",
|
|
167
167
|
"vite": "8.1.4",
|
|
168
|
-
"vitest": "4.1.10"
|
|
168
|
+
"vitest": "4.1.10",
|
|
169
|
+
"@happyvertical/smrt-core": "0.43.6",
|
|
170
|
+
"@happyvertical/smrt-scanner": "0.43.6"
|
|
169
171
|
},
|
|
170
172
|
"scripts": {
|
|
171
173
|
"build": "svelte-package -i src --tsconfig tsconfig.svelte.json",
|