@histoire/protocol 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 (114) hide show
  1. package/LICENSE +21 -0
  2. package/dist/bridge/catalog.d.ts +12 -0
  3. package/dist/bridge/catalog.d.ts.map +1 -0
  4. package/dist/bridge/envelope.d.ts +18 -0
  5. package/dist/bridge/envelope.d.ts.map +1 -0
  6. package/dist/bridge/events.d.ts +9 -0
  7. package/dist/bridge/events.d.ts.map +1 -0
  8. package/dist/bridge/handshake.d.ts +42 -0
  9. package/dist/bridge/handshake.d.ts.map +1 -0
  10. package/dist/bridge/limits.d.ts +41 -0
  11. package/dist/bridge/limits.d.ts.map +1 -0
  12. package/dist/bridge/payload.d.ts +9 -0
  13. package/dist/bridge/payload.d.ts.map +1 -0
  14. package/dist/bridge/project-test-collection.d.ts +5 -0
  15. package/dist/bridge/project-test-collection.d.ts.map +1 -0
  16. package/dist/bridge/results.d.ts +12 -0
  17. package/dist/bridge/results.d.ts.map +1 -0
  18. package/dist/bridge/size.d.ts +23 -0
  19. package/dist/bridge/size.d.ts.map +1 -0
  20. package/dist/bridge/snapshot.d.ts +27 -0
  21. package/dist/bridge/snapshot.d.ts.map +1 -0
  22. package/dist/bridge/source-descriptor.d.ts +5 -0
  23. package/dist/bridge/source-descriptor.d.ts.map +1 -0
  24. package/dist/bridge/string-size.d.ts +12 -0
  25. package/dist/bridge/string-size.d.ts.map +1 -0
  26. package/dist/bridge/test-execution.d.ts +4 -0
  27. package/dist/bridge/test-execution.d.ts.map +1 -0
  28. package/dist/bridge/types.d.ts +83 -0
  29. package/dist/bridge/types.d.ts.map +1 -0
  30. package/dist/bridge/validation.d.ts +14 -0
  31. package/dist/bridge/validation.d.ts.map +1 -0
  32. package/dist/channels.d.ts +42 -0
  33. package/dist/channels.d.ts.map +1 -0
  34. package/dist/geometry.d.ts +9 -0
  35. package/dist/geometry.d.ts.map +1 -0
  36. package/dist/helpers/matrix-numeric.d.ts +18 -0
  37. package/dist/helpers/matrix-numeric.d.ts.map +1 -0
  38. package/dist/helpers/matrix.d.ts +22 -0
  39. package/dist/helpers/matrix.d.ts.map +1 -0
  40. package/dist/helpers/meta.d.ts +26 -0
  41. package/dist/helpers/meta.d.ts.map +1 -0
  42. package/dist/helpers/story-frame.d.ts +4 -0
  43. package/dist/helpers/story-frame.d.ts.map +1 -0
  44. package/dist/helpers/story-route.d.ts +25 -0
  45. package/dist/helpers/story-route.d.ts.map +1 -0
  46. package/dist/index.d.ts +51 -0
  47. package/dist/index.d.ts.map +1 -0
  48. package/dist/index.js +3295 -0
  49. package/dist/inspection/capabilities.d.ts +24 -0
  50. package/dist/inspection/capabilities.d.ts.map +1 -0
  51. package/dist/inspection/debug-buffer.d.ts +21 -0
  52. package/dist/inspection/debug-buffer.d.ts.map +1 -0
  53. package/dist/inspection/extensions.d.ts +5 -0
  54. package/dist/inspection/extensions.d.ts.map +1 -0
  55. package/dist/inspection/rows.d.ts +5 -0
  56. package/dist/inspection/rows.d.ts.map +1 -0
  57. package/dist/inspection/validation.d.ts +23 -0
  58. package/dist/inspection/validation.d.ts.map +1 -0
  59. package/dist/plugin-channels.d.ts +84 -0
  60. package/dist/plugin-channels.d.ts.map +1 -0
  61. package/dist/serialization/controls-revision.d.ts +12 -0
  62. package/dist/serialization/controls-revision.d.ts.map +1 -0
  63. package/dist/serialization/state.d.ts +12 -0
  64. package/dist/serialization/state.d.ts.map +1 -0
  65. package/dist/serialization/test-errors.d.ts +8 -0
  66. package/dist/serialization/test-errors.d.ts.map +1 -0
  67. package/dist/theme/color.d.ts +17 -0
  68. package/dist/theme/color.d.ts.map +1 -0
  69. package/dist/theme/semantic.d.ts +32 -0
  70. package/dist/theme/semantic.d.ts.map +1 -0
  71. package/dist/types/catalog.d.ts +172 -0
  72. package/dist/types/catalog.d.ts.map +1 -0
  73. package/dist/types/common.d.ts +59 -0
  74. package/dist/types/common.d.ts.map +1 -0
  75. package/dist/types/content.d.ts +34 -0
  76. package/dist/types/content.d.ts.map +1 -0
  77. package/dist/types/controls.d.ts +132 -0
  78. package/dist/types/controls.d.ts.map +1 -0
  79. package/dist/types/debug.d.ts +64 -0
  80. package/dist/types/debug.d.ts.map +1 -0
  81. package/dist/types/embed-presentation.d.ts +25 -0
  82. package/dist/types/embed-presentation.d.ts.map +1 -0
  83. package/dist/types/error.d.ts +23 -0
  84. package/dist/types/error.d.ts.map +1 -0
  85. package/dist/types/inspection-accessibility.d.ts +43 -0
  86. package/dist/types/inspection-accessibility.d.ts.map +1 -0
  87. package/dist/types/inspection-components.d.ts +69 -0
  88. package/dist/types/inspection-components.d.ts.map +1 -0
  89. package/dist/types/inspection.d.ts +221 -0
  90. package/dist/types/inspection.d.ts.map +1 -0
  91. package/dist/types/isolated-inspection.d.ts +69 -0
  92. package/dist/types/isolated-inspection.d.ts.map +1 -0
  93. package/dist/types/preview-message.d.ts +179 -0
  94. package/dist/types/preview-message.d.ts.map +1 -0
  95. package/dist/types/readonly.d.ts +5 -0
  96. package/dist/types/readonly.d.ts.map +1 -0
  97. package/dist/types/settings.d.ts +31 -0
  98. package/dist/types/settings.d.ts.map +1 -0
  99. package/dist/types/snapshot.d.ts +94 -0
  100. package/dist/types/snapshot.d.ts.map +1 -0
  101. package/dist/types/source-descriptor.d.ts +72 -0
  102. package/dist/types/source-descriptor.d.ts.map +1 -0
  103. package/dist/types/source-search.d.ts +20 -0
  104. package/dist/types/source-search.d.ts.map +1 -0
  105. package/dist/types/test.d.ts +208 -0
  106. package/dist/types/test.d.ts.map +1 -0
  107. package/dist/url/embed-origins.d.ts +16 -0
  108. package/dist/url/embed-origins.d.ts.map +1 -0
  109. package/dist/url/embed.d.ts +30 -0
  110. package/dist/url/embed.d.ts.map +1 -0
  111. package/dist/url/preview.d.ts +14 -0
  112. package/dist/url/preview.d.ts.map +1 -0
  113. package/package.json +32 -3
  114. package/README.md +0 -3
@@ -0,0 +1,208 @@
1
+ import type { HistoireJsonValue, HistoireTarget } from './common.js';
2
+ /** Plugin-keyed JSON a test attaches to its result (for example structured findings). */
3
+ export type HistoireTestData = Readonly<Record<string, HistoireJsonValue>>;
4
+ /** One engine result retains initiating request and source/document ownership. */
5
+ export interface HistoireTestExecutionIdentity {
6
+ /** Existing bridge request or Node runner identity, never a second execution. */
7
+ runId: string;
8
+ /** Explicit engine, including preview collection. */
9
+ mode: 'preview' | 'server';
10
+ /** Exact target; omitted only for Node multi-story runs. */
11
+ target?: HistoireTarget;
12
+ /** Connected source when execution belongs to a published book. */
13
+ sourceId?: string;
14
+ /** Captured published source generation. */
15
+ epoch?: string;
16
+ /** Captured immutable publication. */
17
+ revision?: string;
18
+ /** Captured ready preview document; absent for server runs. */
19
+ runtimeId?: string;
20
+ }
21
+ /** Portable serialized test data; callbacks stay runtime-local. */
22
+ export interface HistoireSerializedTestError {
23
+ /** Display name. */
24
+ name?: string;
25
+ /** Formatted failure message. */
26
+ message: string;
27
+ /** Formatted stack when available. */
28
+ stack?: string;
29
+ /** Assertion difference when available. */
30
+ diff?: string;
31
+ /** Explicitly projected diagnostic value; transport requires JSON-safe data. */
32
+ raw?: unknown;
33
+ }
34
+ /** Portable serialized test data; callbacks stay runtime-local. */
35
+ export type HistoireTestError = string | HistoireSerializedTestError;
36
+ /** Execution mode for a collected Histoire test definition. */
37
+ export type HistoireTestMode = 'run' | 'skip' | 'only' | 'todo';
38
+ /** Portable serialized test data; callbacks stay runtime-local. */
39
+ export interface HistoireSerializedTestDefinition {
40
+ /** Stable test identity. */
41
+ id: string;
42
+ /** Display name. */
43
+ name: string;
44
+ /** Suite-qualified test name. */
45
+ fullName: string;
46
+ /** Mirrors Vitest modifiers such as `.skip`, `.only`, and `.todo`. */
47
+ mode?: HistoireTestMode;
48
+ /** Optional Vitest deadline in milliseconds for this test body. */
49
+ timeout?: number;
50
+ }
51
+ /** Optional exact authority used by automated same-origin preview hosts. */
52
+ export interface HistoireTestRequestAuthority {
53
+ /** Story selected when request was dispatched. */
54
+ storyId?: string | null;
55
+ /** Variant selected when request was dispatched. */
56
+ variantId?: string | null;
57
+ /** Preview document lifetime; WindowProxy survives navigation. */
58
+ documentId?: string;
59
+ /** Owned host capability echoed only for automation correlation. */
60
+ mcpNonce?: string;
61
+ /** Captured project generation echoed only for automation correlation. */
62
+ mcpEpoch?: string;
63
+ }
64
+ /** Portable serialized test data; callbacks stay runtime-local. */
65
+ export interface HistoireCollectTestsPayload extends HistoireTestRequestAuthority {
66
+ /** Collection request correlation. */
67
+ requestId?: string;
68
+ /** Legacy opaque variant correlation key. */
69
+ variantKey?: string | null;
70
+ }
71
+ /** Portable serialized test data; callbacks stay runtime-local. */
72
+ export interface HistoireRunTestsPayload extends HistoireTestRequestAuthority {
73
+ /** Execution request correlation. */
74
+ runId?: string;
75
+ /** Legacy opaque variant correlation key. */
76
+ variantKey?: string | null;
77
+ }
78
+ /** One isolated in-book test case request, kept internal to Histoire surfaces. */
79
+ export interface HistoireRunTestCasePayload extends HistoireTestRequestAuthority {
80
+ /** Correlates a hidden runtime document with its one scheduled case. */
81
+ runId: string;
82
+ /** Definition collected from the selected visible runtime. */
83
+ definition: HistoireSerializedTestDefinition;
84
+ }
85
+ /** Result produced by one isolated in-book test case request. */
86
+ export interface HistoireTestCaseResultPayload extends HistoireRunTestCasePayload {
87
+ /** Complete one-case summary, merged by the host in collection order. */
88
+ summary: HistoireTestRunSummary;
89
+ }
90
+ /** Portable serialized test data; callbacks stay runtime-local. */
91
+ export interface HistoireTestDefinitionsPayload extends HistoireCollectTestsPayload {
92
+ /** Serialized collected definitions. */
93
+ definitions: HistoireSerializedTestDefinition[];
94
+ /**
95
+ * Present when the preview-side collection crashed — lets the host UI
96
+ * distinguish "no tests registered" from a broken collection.
97
+ */
98
+ error?: HistoireTestError | null;
99
+ }
100
+ /** Result of a preview test collection request, resolved by the host store. */
101
+ export interface HistoireTestCollectionResult {
102
+ /** Optional additive attribution for SDK adapters; legacy callers remain compatible. */
103
+ execution?: HistoireTestExecutionIdentity;
104
+ /** Serialized collected definitions. */
105
+ definitions: HistoireSerializedTestDefinition[];
106
+ /** Set when the preview-side collection crashed instead of returning definitions. */
107
+ error?: HistoireTestError | null;
108
+ }
109
+ /** Definitions discovered across exact variants without executing assertions. */
110
+ export interface HistoireProjectTestCollectionResult {
111
+ /** Captured server operation and source publication. */
112
+ execution: HistoireTestExecutionIdentity;
113
+ /** Includes successful empty collections and per-variant failures. */
114
+ variants: {
115
+ /** Exact variant identity within its story. */
116
+ target: HistoireTarget & {
117
+ variantId: string;
118
+ };
119
+ /** Definitions or portable collection error. */
120
+ collection: HistoireTestCollectionResult;
121
+ }[];
122
+ }
123
+ /** Portable serialized test data; callbacks stay runtime-local. */
124
+ export interface HistoireTestResultPayload extends HistoireRunTestsPayload {
125
+ /** Completed execution results. */
126
+ summary: HistoireTestRunSummary;
127
+ }
128
+ /** Portable serialized test data; callbacks stay runtime-local. */
129
+ export interface HistoireTestCaseResultInput {
130
+ /** Stable test identity. */
131
+ id?: string;
132
+ /** Display name. */
133
+ name: string;
134
+ /** Suite-qualified test name. */
135
+ fullName?: string;
136
+ /** Completed assertion state. */
137
+ state: 'passed' | 'failed' | 'skipped';
138
+ /** Formatted assertion or lifecycle failures. */
139
+ errors: HistoireTestError[];
140
+ /** Plugin-keyed data attached by the test. */
141
+ data?: HistoireTestData;
142
+ }
143
+ /** Portable serialized test data; callbacks stay runtime-local. */
144
+ export interface HistoireTestCaseResult {
145
+ /** Stable test identity. */
146
+ id: string;
147
+ /** Display name. */
148
+ name: string;
149
+ /** Suite-qualified test name. */
150
+ fullName: string;
151
+ /** Completed assertion state. */
152
+ state: 'passed' | 'failed' | 'skipped';
153
+ /** Formatted assertion or lifecycle failures. */
154
+ errors: HistoireTestError[];
155
+ /** Exact collected story identity. */
156
+ storyId?: string;
157
+ /** Exact collected variant identity. */
158
+ variantId?: string;
159
+ /** Plugin-keyed data attached by the test. */
160
+ data?: HistoireTestData;
161
+ }
162
+ /**
163
+ * A story that could not be collected during a test run, so whether it defines
164
+ * tests at all is unknown.
165
+ */
166
+ export interface HistoireUncollectedStory {
167
+ /** Story path relative to the project root. */
168
+ relativePath: string;
169
+ /** Why the story could not be collected. */
170
+ error: string;
171
+ }
172
+ /** Portable serialized test data; callbacks stay runtime-local. */
173
+ export interface HistoireTestRunSummary {
174
+ /** Optional additive attribution, shared by SDK/Node results and bridge progress. */
175
+ execution?: HistoireTestExecutionIdentity;
176
+ /** Whether run completed without failed assertions or collection failures. */
177
+ ok: boolean;
178
+ /** Total completed tests. */
179
+ total: number;
180
+ /** Passed assertions. */
181
+ passed: number;
182
+ /** Failed assertions. */
183
+ failed: number;
184
+ /** Skipped tests. */
185
+ skipped: number;
186
+ /** Formatted assertion or lifecycle failures. */
187
+ errors: HistoireTestError[];
188
+ /** Attributable per-test results. */
189
+ tests: HistoireTestCaseResult[];
190
+ /**
191
+ * Stories the run had to skip because they failed to collect. Present only
192
+ * when something went wrong: a skipped story may have defined tests, so the
193
+ * run is reported as failed rather than silently under-reporting.
194
+ */
195
+ uncollectedStories?: HistoireUncollectedStory[];
196
+ }
197
+ /** Portable serialized test data; callbacks stay runtime-local. */
198
+ export interface HistoireResolvedTestCase extends HistoireSerializedTestDefinition {
199
+ /** Completed assertion state. */
200
+ state: HistoireTestCaseResult['state'] | 'idle';
201
+ /** Formatted assertion or lifecycle failures. */
202
+ errors: HistoireTestError[];
203
+ /** Exact collected story identity. */
204
+ storyId?: string;
205
+ /** Exact collected variant identity. */
206
+ variantId?: string;
207
+ }
208
+ //# sourceMappingURL=test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"test.d.ts","sourceRoot":"","sources":["../../src/types/test.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAEpE,yFAAyF;AACzF,MAAM,MAAM,gBAAgB,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC,CAAA;A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EAAE,gBAAgB,CAAA;CACxB;AAED;;;GAGG;AACH,MAAM,WAAW,wBAAwB;IACvC,+CAA+C;IAC/C,YAAY,EAAE,MAAM,CAAA;IACpB,4CAA4C;IAC5C,KAAK,EAAE,MAAM,CAAA;CACd;AAED,mEAAmE;AACnE,MAAM,WAAW,sBAAsB;IACrC,qFAAqF;IACrF,SAAS,CAAC,EAAE,6BAA6B,CAAA;IACzC,8EAA8E;IAC9E,EAAE,EAAE,OAAO,CAAA;IACX,6BAA6B;IAC7B,KAAK,EAAE,MAAM,CAAA;IACb,yBAAyB;IACzB,MAAM,EAAE,MAAM,CAAA;IACd,yBAAyB;IACzB,MAAM,EAAE,MAAM,CAAA;IACd,qBAAqB;IACrB,OAAO,EAAE,MAAM,CAAA;IACf,iDAAiD;IACjD,MAAM,EAAE,iBAAiB,EAAE,CAAA;IAC3B,qCAAqC;IACrC,KAAK,EAAE,sBAAsB,EAAE,CAAA;IAC/B;;;;OAIG;IACH,kBAAkB,CAAC,EAAE,wBAAwB,EAAE,CAAA;CAChD;AAED,mEAAmE;AACnE,MAAM,WAAW,wBAAyB,SAAQ,gCAAgC;IAChF,iCAAiC;IACjC,KAAK,EAAE,sBAAsB,CAAC,OAAO,CAAC,GAAG,MAAM,CAAA;IAC/C,iDAAiD;IACjD,MAAM,EAAE,iBAAiB,EAAE,CAAA;IAC3B,sCAAsC;IACtC,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,wCAAwC;IACxC,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB"}
@@ -0,0 +1,16 @@
1
+ /** Present override distinguishes replacement from an absent deployment file/env. */
2
+ export interface HistoireEmbedOriginOverride {
3
+ /** Whether deployer supplied an override, including malformed/unreadable input. */
4
+ present: boolean;
5
+ /** Parsed additional origins; malformed values fail closed. */
6
+ value?: unknown;
7
+ }
8
+ /** Validates and deduplicates exact origins without silently accepting a partial list. */
9
+ export declare function validateEmbedOrigins(value: unknown): string[];
10
+ /** Resolves one document's policy; invalid present override permits own origin only. */
11
+ export declare function resolveEmbedOrigins(baked: readonly string[], override?: HistoireEmbedOriginOverride): readonly string[];
12
+ /** Framing directive shares exact effective list used by bridge authorization. */
13
+ export declare function createEmbedFrameAncestors(allowedOrigins: readonly string[]): string;
14
+ /** Replaces only framing directive while preserving independent CSP policies/directives. */
15
+ export declare function mergeEmbedFrameAncestors(existing: string | readonly string[] | undefined, allowedOrigins: readonly string[]): string | string[];
16
+ //# sourceMappingURL=embed-origins.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"embed-origins.d.ts","sourceRoot":"","sources":["../../src/url/embed-origins.ts"],"names":[],"mappings":"AAEA,qFAAqF;AACrF,MAAM,WAAW,2BAA2B;IAC1C,mFAAmF;IACnF,OAAO,EAAE,OAAO,CAAA;IAChB,+DAA+D;IAC/D,KAAK,CAAC,EAAE,OAAO,CAAA;CAChB;AAED,0FAA0F;AAC1F,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,EAAE,CAG7D;AAED,wFAAwF;AACxF,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,EAAE,QAAQ,CAAC,EAAE,2BAA2B,GAAG,SAAS,MAAM,EAAE,CAOvH;AAED,kFAAkF;AAClF,wBAAgB,yBAAyB,CAAC,cAAc,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,CAEnF;AAED,4FAA4F;AAC5F,wBAAgB,wBAAwB,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,GAAG,SAAS,EAAE,cAAc,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,GAAG,MAAM,EAAE,CAI/I"}
@@ -0,0 +1,30 @@
1
+ import type { HistoireEmbedDocumentOptions, HistoireEmbedPanel, HistoireEmbedPresentation } from '../types/embed-presentation.js';
2
+ /** Normalize panels once for URL, SDK, and native composition. */
3
+ export declare function validateEmbedPanels(value?: unknown): HistoireEmbedPanel[];
4
+ /** Largest accepted embed gutter in CSS pixels. */
5
+ export declare const HISTOIRE_EMBED_MAX_PADDING = 1024;
6
+ /** Whether a value is a usable embed gutter in CSS pixels. */
7
+ export declare function isEmbedPadding(value: unknown): value is number;
8
+ /** Reject gutters that are negative, non-finite or unreasonably large. */
9
+ export declare function validateEmbedPadding(value: unknown): number;
10
+ /** Read CSS pixels, including the negative exponent used by the writer for tiny fractions. */
11
+ export declare function parseEmbedPadding(query: URLSearchParams): number | undefined;
12
+ /** Serialize a validated gutter so the embed document can read it back exactly. */
13
+ export declare function writeEmbedPadding(query: URLSearchParams, value: number): void;
14
+ /** Validate untyped SDK options before a surface reserves runtime ownership. */
15
+ export declare function validateEmbedPresentation(value: unknown): HistoireEmbedPresentation;
16
+ /** Parse SDK surface presentation independently from parent handshake identity. */
17
+ export declare function parseEmbedPresentation(query: URLSearchParams): HistoireEmbedPresentation | undefined;
18
+ /** Serialize only validated cosmetic hints; selection still comes from parent session. */
19
+ export declare function writeEmbedPresentation(query: URLSearchParams, input: HistoireEmbedPresentation): void;
20
+ /** Validate exact public target IDs, retaining byte-for-byte query identity. */
21
+ export declare function parseEmbedDocumentOptions(query: URLSearchParams): HistoireEmbedDocumentOptions;
22
+ /** Build deployment-relative direct embed link without standalone route or runtime hints. */
23
+ export declare function getEmbedRelativeUrl(options: {
24
+ base: string;
25
+ storyId: string;
26
+ variantId?: string;
27
+ panels?: readonly HistoireEmbedPanel[];
28
+ padding?: number;
29
+ }): string;
30
+ //# sourceMappingURL=embed.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"embed.d.ts","sourceRoot":"","sources":["../../src/url/embed.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,4BAA4B,EAAE,kBAAkB,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAA;AAUjI,kEAAkE;AAClE,wBAAgB,mBAAmB,CAAC,KAAK,GAAE,OAAsB,GAAG,kBAAkB,EAAE,CAGvF;AAED,mDAAmD;AACnD,eAAO,MAAM,0BAA0B,OAAO,CAAA;AAE9C,8DAA8D;AAC9D,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAE9D;AAED,0EAA0E;AAC1E,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAG3D;AAED,8FAA8F;AAC9F,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,eAAe,GAAG,MAAM,GAAG,SAAS,CAK5E;AAED,mFAAmF;AACnF,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAE7E;AAED,gFAAgF;AAChF,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,OAAO,GAAG,yBAAyB,CAKnF;AAeD,mFAAmF;AACnF,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,eAAe,GAAG,yBAAyB,GAAG,SAAS,CAIpG;AAED,0FAA0F;AAC1F,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,eAAe,EAAE,KAAK,EAAE,yBAAyB,GAAG,IAAI,CAKrG;AAED,gFAAgF;AAChF,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,eAAe,GAAG,4BAA4B,CAK9F;AAQD,6FAA6F;AAC7F,wBAAgB,mBAAmB,CAAC,OAAO,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,SAAS,kBAAkB,EAAE,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,CAOpK"}
@@ -0,0 +1,14 @@
1
+ /** Inputs shared by browser UI and MCP sandbox links. */
2
+ export interface SandboxUrlOptions {
3
+ /** Deployment base, including optional trailing slash. */
4
+ base: string;
5
+ /** Exact collected story identity. */
6
+ storyId: string;
7
+ /** Exact variant identity. */
8
+ variantId: string;
9
+ }
10
+ /** Canonical deployment base must remain on the current origin. */
11
+ export declare function normalizePreviewBase(value: string): string;
12
+ /** Build a relative sandbox URL with exact identities in query parameters. */
13
+ export declare function getSandboxRelativeUrl(options: SandboxUrlOptions): string;
14
+ //# sourceMappingURL=preview.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"preview.d.ts","sourceRoot":"","sources":["../../src/url/preview.ts"],"names":[],"mappings":"AAAA,yDAAyD;AACzD,MAAM,WAAW,iBAAiB;IAChC,0DAA0D;IAC1D,IAAI,EAAE,MAAM,CAAA;IACZ,sCAAsC;IACtC,OAAO,EAAE,MAAM,CAAA;IACf,8BAA8B;IAC9B,SAAS,EAAE,MAAM,CAAA;CAClB;AAED,mEAAmE;AACnE,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAO1D;AAED,8EAA8E;AAC9E,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,iBAAiB,GAAG,MAAM,CAIxE"}
package/package.json CHANGED
@@ -1,6 +1,35 @@
1
1
  {
2
2
  "name": "@histoire/protocol",
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": "Portable Histoire catalog and embedding contracts",
6
+ "license": "MIT",
7
+ "publishConfig": {
8
+ "access": "public"
9
+ },
10
+ "sideEffects": false,
11
+ "exports": {
12
+ ".": {
13
+ "types": "./dist/index.d.ts",
14
+ "default": "./dist/index.js"
15
+ }
16
+ },
17
+ "main": "./dist/index.js",
18
+ "module": "./dist/index.js",
19
+ "types": "./dist/index.d.ts",
20
+ "files": [
21
+ "dist"
22
+ ],
23
+ "devDependencies": {
24
+ "@typescript/native": "npm:typescript@7.0.2",
25
+ "concurrently": "^9.1.0",
26
+ "typescript": "npm:@typescript/typescript6@6.0.2",
27
+ "vite": "^8.3.5",
28
+ "vitest": "5.1.1"
29
+ },
30
+ "scripts": {
31
+ "build": "rimraf dist && vite build && tsc --emitDeclarationOnly",
32
+ "test": "vitest run",
33
+ "watch": "concurrently \"vite build --watch\" \"tsc -w --emitDeclarationOnly\""
34
+ }
6
35
  }
package/README.md DELETED
@@ -1,3 +0,0 @@
1
- # Temporary Holding Version
2
-
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.