@histoire/devframe 0.0.0-stage → 1.0.0-beta.3

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.
Files changed (69) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +36 -2
  3. package/dist/client/attach.d.ts +15 -0
  4. package/dist/client/attach.d.ts.map +1 -0
  5. package/dist/client/attach.js +238 -0
  6. package/dist/client/diagnostics.d.ts +14 -0
  7. package/dist/client/diagnostics.d.ts.map +1 -0
  8. package/dist/client/diagnostics.js +31 -0
  9. package/dist/client/events.d.ts +11 -0
  10. package/dist/client/events.d.ts.map +1 -0
  11. package/dist/client/events.js +52 -0
  12. package/dist/client/highlight-operations.d.ts +14 -0
  13. package/dist/client/highlight-operations.d.ts.map +1 -0
  14. package/dist/client/highlight-operations.js +74 -0
  15. package/dist/client/index.d.ts +3 -0
  16. package/dist/client/index.d.ts.map +1 -0
  17. package/dist/client/index.js +2 -0
  18. package/dist/client/inspection.d.ts +9 -0
  19. package/dist/client/inspection.d.ts.map +1 -0
  20. package/dist/client/inspection.js +32 -0
  21. package/dist/client/pairing-budget.d.ts +3 -0
  22. package/dist/client/pairing-budget.d.ts.map +1 -0
  23. package/dist/client/pairing-budget.js +36 -0
  24. package/dist/host/index.d.ts +35 -0
  25. package/dist/host/index.d.ts.map +1 -0
  26. package/dist/host/index.js +86 -0
  27. package/dist/node/broker.d.ts +37 -0
  28. package/dist/node/broker.d.ts.map +1 -0
  29. package/dist/node/broker.js +349 -0
  30. package/dist/node/devframe.d.ts +64 -0
  31. package/dist/node/devframe.d.ts.map +1 -0
  32. package/dist/node/devframe.js +193 -0
  33. package/dist/node/grants.d.ts +24 -0
  34. package/dist/node/grants.d.ts.map +1 -0
  35. package/dist/node/grants.js +58 -0
  36. package/dist/node/index.d.ts +8 -0
  37. package/dist/node/index.d.ts.map +1 -0
  38. package/dist/node/index.js +4 -0
  39. package/dist/node/mcp.d.ts +10 -0
  40. package/dist/node/mcp.d.ts.map +1 -0
  41. package/dist/node/mcp.js +150 -0
  42. package/dist/node/retirements.d.ts +8 -0
  43. package/dist/node/retirements.d.ts.map +1 -0
  44. package/dist/node/retirements.js +34 -0
  45. package/dist/node/rpc-budget.d.ts +6 -0
  46. package/dist/node/rpc-budget.d.ts.map +1 -0
  47. package/dist/node/rpc-budget.js +26 -0
  48. package/dist/node/types.d.ts +65 -0
  49. package/dist/node/types.d.ts.map +1 -0
  50. package/dist/node/types.js +1 -0
  51. package/dist/node/validation.d.ts +10 -0
  52. package/dist/node/validation.d.ts.map +1 -0
  53. package/dist/node/validation.js +50 -0
  54. package/dist/report/content.d.ts +33 -0
  55. package/dist/report/content.d.ts.map +1 -0
  56. package/dist/report/content.js +64 -0
  57. package/dist/report/index.d.ts +60 -0
  58. package/dist/report/index.d.ts.map +1 -0
  59. package/dist/report/index.js +78 -0
  60. package/dist/shared/diagnostics.d.ts +9 -0
  61. package/dist/shared/diagnostics.d.ts.map +1 -0
  62. package/dist/shared/diagnostics.js +20 -0
  63. package/dist/shared/events.d.ts +27 -0
  64. package/dist/shared/events.d.ts.map +1 -0
  65. package/dist/shared/events.js +49 -0
  66. package/dist/shared/services.d.ts +413 -0
  67. package/dist/shared/services.d.ts.map +1 -0
  68. package/dist/shared/services.js +113 -0
  69. package/package.json +53 -3
@@ -0,0 +1,413 @@
1
+ /** Explicit scopes; no generic SDK methods or shared-state writes. */
2
+ export type Exposure = 'inspection' | 'events' | 'diagnostics' | 'components' | 'accessibility' | 'highlight';
3
+ /** MCP descriptors and broker authorization share these exact registrations. */
4
+ export declare const LIVE_TOOLS: {
5
+ tool: {
6
+ name: string;
7
+ description: string;
8
+ inputSchema: {
9
+ type: 'object';
10
+ properties: {
11
+ attachmentId: {
12
+ type: string;
13
+ };
14
+ kind: {
15
+ enum: string[];
16
+ };
17
+ target: {
18
+ type: string;
19
+ };
20
+ expectedOwner: {
21
+ type: string;
22
+ };
23
+ selector: {
24
+ type: string;
25
+ };
26
+ maxNodes: {
27
+ type: string;
28
+ };
29
+ maxDepth: {
30
+ type: string;
31
+ };
32
+ };
33
+ required: string[];
34
+ additionalProperties: boolean;
35
+ };
36
+ };
37
+ eventTool: {
38
+ name: string;
39
+ description: string;
40
+ inputSchema: {
41
+ type: 'object';
42
+ properties: {
43
+ attachmentId: {
44
+ type: string;
45
+ };
46
+ target: {
47
+ type: string;
48
+ };
49
+ expectedOwner: {
50
+ type: string;
51
+ };
52
+ eventLifetime: {
53
+ type: string;
54
+ };
55
+ afterSequence: {
56
+ type: string;
57
+ minimum: number;
58
+ };
59
+ limit: {
60
+ type: string;
61
+ minimum: number;
62
+ maximum: number;
63
+ };
64
+ };
65
+ required: string[];
66
+ additionalProperties: boolean;
67
+ };
68
+ };
69
+ diagnosticTool: {
70
+ name: string;
71
+ description: string;
72
+ inputSchema: {
73
+ type: 'object';
74
+ properties: {
75
+ attachmentId: {
76
+ type: string;
77
+ };
78
+ target: {
79
+ type: string;
80
+ };
81
+ expectedOwner: {
82
+ type: string;
83
+ };
84
+ afterSequence: {
85
+ type: string;
86
+ minimum: number;
87
+ };
88
+ limit: {
89
+ type: string;
90
+ minimum: number;
91
+ maximum: number;
92
+ };
93
+ };
94
+ required: string[];
95
+ additionalProperties: boolean;
96
+ };
97
+ };
98
+ componentTool: {
99
+ name: string;
100
+ description: string;
101
+ inputSchema: {
102
+ type: 'object';
103
+ properties: {
104
+ attachmentId: {
105
+ type: string;
106
+ };
107
+ target: {
108
+ type: string;
109
+ };
110
+ expectedOwner: {
111
+ type: string;
112
+ };
113
+ componentId: {
114
+ type: string;
115
+ };
116
+ selector: {
117
+ type: string;
118
+ };
119
+ rootId: {
120
+ type: string;
121
+ };
122
+ maxNodes: {
123
+ type: string;
124
+ };
125
+ maxDepth: {
126
+ type: string;
127
+ };
128
+ };
129
+ required: string[];
130
+ additionalProperties: boolean;
131
+ };
132
+ };
133
+ accessibilityTool: {
134
+ name: string;
135
+ description: string;
136
+ inputSchema: {
137
+ type: 'object';
138
+ properties: {
139
+ attachmentId: {
140
+ type: string;
141
+ };
142
+ target: {
143
+ type: string;
144
+ };
145
+ expectedOwner: {
146
+ type: string;
147
+ };
148
+ selector: {
149
+ type: string;
150
+ };
151
+ };
152
+ required: string[];
153
+ additionalProperties: boolean;
154
+ };
155
+ };
156
+ highlightTool: {
157
+ name: string;
158
+ description: string;
159
+ annotations: {
160
+ readOnlyHint: boolean;
161
+ destructiveHint: boolean;
162
+ };
163
+ inputSchema: {
164
+ type: 'object';
165
+ properties: {
166
+ attachmentId: {
167
+ type: string;
168
+ };
169
+ target: {
170
+ type: string;
171
+ };
172
+ expectedOwner: {
173
+ type: string;
174
+ };
175
+ selector: {
176
+ type: string;
177
+ };
178
+ componentId: {
179
+ type: string;
180
+ };
181
+ durationMs: {
182
+ type: string;
183
+ };
184
+ };
185
+ required: string[];
186
+ oneOf: {
187
+ required: string[];
188
+ }[];
189
+ additionalProperties: boolean;
190
+ };
191
+ };
192
+ };
193
+ /** Single finite service registry shared by browser, broker and MCP. */
194
+ export declare const LIVE_SERVICES: {
195
+ readonly histoire_inspect_session: {
196
+ readonly scope: 'inspection';
197
+ readonly action: false;
198
+ readonly tool: {
199
+ name: string;
200
+ description: string;
201
+ inputSchema: {
202
+ type: 'object';
203
+ properties: {
204
+ attachmentId: {
205
+ type: string;
206
+ };
207
+ kind: {
208
+ enum: string[];
209
+ };
210
+ target: {
211
+ type: string;
212
+ };
213
+ expectedOwner: {
214
+ type: string;
215
+ };
216
+ selector: {
217
+ type: string;
218
+ };
219
+ maxNodes: {
220
+ type: string;
221
+ };
222
+ maxDepth: {
223
+ type: string;
224
+ };
225
+ };
226
+ required: string[];
227
+ additionalProperties: boolean;
228
+ };
229
+ };
230
+ };
231
+ readonly histoire_get_session_events: {
232
+ readonly scope: 'events';
233
+ readonly action: false;
234
+ readonly tool: {
235
+ name: string;
236
+ description: string;
237
+ inputSchema: {
238
+ type: 'object';
239
+ properties: {
240
+ attachmentId: {
241
+ type: string;
242
+ };
243
+ target: {
244
+ type: string;
245
+ };
246
+ expectedOwner: {
247
+ type: string;
248
+ };
249
+ eventLifetime: {
250
+ type: string;
251
+ };
252
+ afterSequence: {
253
+ type: string;
254
+ minimum: number;
255
+ };
256
+ limit: {
257
+ type: string;
258
+ minimum: number;
259
+ maximum: number;
260
+ };
261
+ };
262
+ required: string[];
263
+ additionalProperties: boolean;
264
+ };
265
+ };
266
+ };
267
+ readonly histoire_get_session_diagnostics: {
268
+ readonly scope: 'diagnostics';
269
+ readonly action: false;
270
+ readonly tool: {
271
+ name: string;
272
+ description: string;
273
+ inputSchema: {
274
+ type: 'object';
275
+ properties: {
276
+ attachmentId: {
277
+ type: string;
278
+ };
279
+ target: {
280
+ type: string;
281
+ };
282
+ expectedOwner: {
283
+ type: string;
284
+ };
285
+ afterSequence: {
286
+ type: string;
287
+ minimum: number;
288
+ };
289
+ limit: {
290
+ type: string;
291
+ minimum: number;
292
+ maximum: number;
293
+ };
294
+ };
295
+ required: string[];
296
+ additionalProperties: boolean;
297
+ };
298
+ };
299
+ };
300
+ readonly histoire_inspect_component: {
301
+ readonly scope: 'components';
302
+ readonly action: false;
303
+ readonly tool: {
304
+ name: string;
305
+ description: string;
306
+ inputSchema: {
307
+ type: 'object';
308
+ properties: {
309
+ attachmentId: {
310
+ type: string;
311
+ };
312
+ target: {
313
+ type: string;
314
+ };
315
+ expectedOwner: {
316
+ type: string;
317
+ };
318
+ componentId: {
319
+ type: string;
320
+ };
321
+ selector: {
322
+ type: string;
323
+ };
324
+ rootId: {
325
+ type: string;
326
+ };
327
+ maxNodes: {
328
+ type: string;
329
+ };
330
+ maxDepth: {
331
+ type: string;
332
+ };
333
+ };
334
+ required: string[];
335
+ additionalProperties: boolean;
336
+ };
337
+ };
338
+ };
339
+ readonly histoire_audit_session_accessibility: {
340
+ readonly scope: 'accessibility';
341
+ readonly action: false;
342
+ readonly tool: {
343
+ name: string;
344
+ description: string;
345
+ inputSchema: {
346
+ type: 'object';
347
+ properties: {
348
+ attachmentId: {
349
+ type: string;
350
+ };
351
+ target: {
352
+ type: string;
353
+ };
354
+ expectedOwner: {
355
+ type: string;
356
+ };
357
+ selector: {
358
+ type: string;
359
+ };
360
+ };
361
+ required: string[];
362
+ additionalProperties: boolean;
363
+ };
364
+ };
365
+ };
366
+ readonly histoire_highlight_element: {
367
+ readonly scope: 'highlight';
368
+ readonly action: true;
369
+ readonly tool: {
370
+ name: string;
371
+ description: string;
372
+ annotations: {
373
+ readOnlyHint: boolean;
374
+ destructiveHint: boolean;
375
+ };
376
+ inputSchema: {
377
+ type: 'object';
378
+ properties: {
379
+ attachmentId: {
380
+ type: string;
381
+ };
382
+ target: {
383
+ type: string;
384
+ };
385
+ expectedOwner: {
386
+ type: string;
387
+ };
388
+ selector: {
389
+ type: string;
390
+ };
391
+ componentId: {
392
+ type: string;
393
+ };
394
+ durationMs: {
395
+ type: string;
396
+ };
397
+ };
398
+ required: string[];
399
+ oneOf: {
400
+ required: string[];
401
+ }[];
402
+ additionalProperties: boolean;
403
+ };
404
+ };
405
+ };
406
+ };
407
+ /** Select component tree, exact details or element owner from finite fields. */
408
+ export declare function componentKind(input: Record<string, unknown>): 'components' | 'component' | 'componentForElement';
409
+ /** Bind each finite service name to its exact operation kinds before dispatch. */
410
+ export declare function assertServiceOperation(name: string, value: unknown): void;
411
+ /** Component-ID highlighting requires both action and component authority. */
412
+ export declare function serviceScopes(name: string, value: unknown): Exposure[];
413
+ //# sourceMappingURL=services.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"services.d.ts","sourceRoot":"","sources":["../../src/shared/services.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,MAAM,MAAM,QAAQ,GAAG,YAAY,GAAG,QAAQ,GAAG,aAAa,GAAG,YAAY,GAAG,eAAe,GAAG,WAAW,CAAA;AAoF7G,gFAAgF;AAChF,eAAO,MAAM,UAAU;;;;;YA9EnB,IAAI,EAAE,QAAQ;YACd,UAAU;gBACR,YAAY;oBAAI,IAAI;;gBACpB,IAAI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schema describes an exact mounted read. */
2
+ const tool = {
3
+ name: 'histoire_inspect_session',
4
+ description: 'Read an explicitly paired mounted Histoire document.',
5
+ inputSchema: {
6
+ type: 'object',
7
+ properties: {
8
+ attachmentId: { type: 'string' },
9
+ kind: { enum: ['variant', 'dom'] },
10
+ target: { type: 'object' },
11
+ expectedOwner: { type: 'object' },
12
+ selector: { type: 'string' },
13
+ maxNodes: { type: 'integer' },
14
+ maxDepth: { type: 'integer' },
15
+ },
16
+ required: ['attachmentId', 'kind', 'target', 'expectedOwner'],
17
+ additionalProperties: false,
18
+ },
19
+ };
20
+ /** Event history is independently scoped and never activates diagnostics. */
21
+ const eventTool = {
22
+ name: 'histoire_get_session_events',
23
+ description: 'Read attributed component events retained by a paired live session.',
24
+ inputSchema: {
25
+ type: 'object',
26
+ properties: { attachmentId: { type: 'string' }, target: { type: 'object' }, expectedOwner: { type: 'object' }, eventLifetime: { type: 'string' }, afterSequence: { type: 'integer', minimum: 0 }, limit: { type: 'integer', minimum: 1, maximum: 100 } },
27
+ required: ['attachmentId', 'target', 'expectedOwner'],
28
+ additionalProperties: false,
29
+ },
30
+ };
31
+ /** Diagnostic history is granted independently of component events. */
32
+ const diagnosticTool = {
33
+ name: 'histoire_get_session_diagnostics',
34
+ description: 'Read explicitly observed diagnostics for a paired live session.',
35
+ inputSchema: {
36
+ type: 'object',
37
+ properties: { attachmentId: { type: 'string' }, target: { type: 'object' }, expectedOwner: { type: 'object' }, afterSequence: { type: 'integer', minimum: 0 }, limit: { type: 'integer', minimum: 1, maximum: 100 } },
38
+ required: ['attachmentId', 'target', 'expectedOwner'],
39
+ additionalProperties: false,
40
+ },
41
+ };
42
+ /** Component tree, instance detail and element-owner lookup share one finite service. */
43
+ const componentTool = {
44
+ name: 'histoire_inspect_component',
45
+ description: 'Read a component tree, instance or element owner from a paired session.',
46
+ inputSchema: {
47
+ type: 'object',
48
+ properties: { attachmentId: { type: 'string' }, target: { type: 'object' }, expectedOwner: { type: 'object' }, componentId: { type: 'string' }, selector: { type: 'string' }, rootId: { type: 'string' }, maxNodes: { type: 'integer' }, maxDepth: { type: 'integer' } },
49
+ required: ['attachmentId', 'target', 'expectedOwner'],
50
+ additionalProperties: false,
51
+ },
52
+ };
53
+ /** Axe audit is available only through its explicit scope. */
54
+ const accessibilityTool = {
55
+ name: 'histoire_audit_session_accessibility',
56
+ description: 'Run a bounded accessibility audit of the mounted document.',
57
+ inputSchema: {
58
+ type: 'object',
59
+ properties: { attachmentId: { type: 'string' }, target: { type: 'object' }, expectedOwner: { type: 'object' }, selector: { type: 'string' } },
60
+ required: ['attachmentId', 'target', 'expectedOwner'],
61
+ additionalProperties: false,
62
+ },
63
+ };
64
+ /** Highlight is an explicit bounded action, never a generic write. */
65
+ const highlightTool = {
66
+ name: 'histoire_highlight_element',
67
+ description: 'Temporarily highlight a selector or component in the paired mounted document.',
68
+ annotations: { readOnlyHint: false, destructiveHint: false },
69
+ inputSchema: {
70
+ type: 'object',
71
+ properties: { attachmentId: { type: 'string' }, target: { type: 'object' }, expectedOwner: { type: 'object' }, selector: { type: 'string' }, componentId: { type: 'string' }, durationMs: { type: 'integer' } },
72
+ required: ['attachmentId', 'target', 'expectedOwner'],
73
+ oneOf: [{ required: ['selector'] }, { required: ['componentId'] }],
74
+ additionalProperties: false,
75
+ },
76
+ };
77
+ /** MCP descriptors and broker authorization share these exact registrations. */
78
+ export const LIVE_TOOLS = { tool, eventTool, diagnosticTool, componentTool, accessibilityTool, highlightTool };
79
+ /** Single finite service registry shared by browser, broker and MCP. */
80
+ export const LIVE_SERVICES = {
81
+ histoire_inspect_session: { scope: 'inspection', action: false, tool },
82
+ histoire_get_session_events: { scope: 'events', action: false, tool: eventTool },
83
+ histoire_get_session_diagnostics: { scope: 'diagnostics', action: false, tool: diagnosticTool },
84
+ histoire_inspect_component: { scope: 'components', action: false, tool: componentTool },
85
+ histoire_audit_session_accessibility: { scope: 'accessibility', action: false, tool: accessibilityTool },
86
+ histoire_highlight_element: { scope: 'highlight', action: true, tool: highlightTool },
87
+ };
88
+ /** Select component tree, exact details or element owner from finite fields. */
89
+ export function componentKind(input) {
90
+ if (input.componentId !== undefined && input.selector !== undefined)
91
+ throw new Error('Invalid component request');
92
+ return input.componentId !== undefined ? 'component' : input.selector !== undefined ? 'componentForElement' : 'components';
93
+ }
94
+ /** Bind each finite service name to its exact operation kinds before dispatch. */
95
+ export function assertServiceOperation(name, value) {
96
+ const kinds = {
97
+ histoire_inspect_session: ['variant', 'dom'],
98
+ histoire_inspect_component: ['components', 'component', 'componentForElement'],
99
+ histoire_audit_session_accessibility: ['accessibility'],
100
+ histoire_highlight_element: ['highlight'],
101
+ };
102
+ if (!Object.hasOwn(LIVE_SERVICES, name))
103
+ throw new Error('Session unavailable');
104
+ if (!Object.hasOwn(kinds, name))
105
+ return;
106
+ if (!value || typeof value !== 'object' || Array.isArray(value) || !kinds[name].includes(value.kind ?? ''))
107
+ throw new Error('Session unavailable');
108
+ }
109
+ /** Component-ID highlighting requires both action and component authority. */
110
+ export function serviceScopes(name, value) {
111
+ const scope = LIVE_SERVICES[name].scope;
112
+ return name === 'histoire_highlight_element' && value !== null && typeof value === 'object' && Object.hasOwn(value, 'componentId') ? [scope, 'components'] : [scope];
113
+ }
package/package.json CHANGED
@@ -1,6 +1,56 @@
1
1
  {
2
2
  "name": "@histoire/devframe",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "type": "module",
4
+ "version": "1.0.0-beta.3",
5
+ "description": "Optional authenticated live inspection adapter for Histoire",
6
+ "license": "MIT",
7
+ "sideEffects": false,
8
+ "exports": {
9
+ "./client": {
10
+ "types": "./dist/client/index.d.ts",
11
+ "default": "./dist/client/index.js"
12
+ },
13
+ "./node": {
14
+ "types": "./dist/node/index.d.ts",
15
+ "default": "./dist/node/index.js"
16
+ },
17
+ "./report": {
18
+ "types": "./dist/report/index.d.ts",
19
+ "default": "./dist/report/index.js"
20
+ },
21
+ "./host": {
22
+ "types": "./dist/host/index.d.ts",
23
+ "default": "./dist/host/index.js"
24
+ }
25
+ },
26
+ "files": [
27
+ "dist"
28
+ ],
29
+ "engines": {
30
+ "node": ">=22.12.0"
31
+ },
32
+ "peerDependencies": {
33
+ "devframe": "1.2.2"
34
+ },
35
+ "dependencies": {
36
+ "@modelcontextprotocol/server": "2.3.1",
37
+ "@histoire/sdk": "^1.0.0-beta.3",
38
+ "@histoire/protocol": "^1.0.0-beta.3"
39
+ },
40
+ "devDependencies": {
41
+ "@modelcontextprotocol/client": "2.3.1",
42
+ "@modelcontextprotocol/node": "2.1.0",
43
+ "@types/node": "^22.0.0",
44
+ "devframe": "1.2.2",
45
+ "esbuild": "^0.27.2",
46
+ "typescript": "npm:@typescript/typescript6@6.0.2",
47
+ "vitest": "5.1.1"
48
+ },
49
+ "publishConfig": {
50
+ "access": "public"
51
+ },
52
+ "scripts": {
53
+ "build": "rimraf dist && tsc",
54
+ "test": "vitest run"
55
+ }
6
56
  }