@sparkletree/core 0.5.0 → 0.6.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/README.md CHANGED
@@ -7,7 +7,7 @@ impression analytics.
7
7
 
8
8
  **Building a React app?** Install
9
9
  [`@sparkletree/react`](https://www.npmjs.com/package/@sparkletree/react)
10
- instead it wraps this package. Use `core` directly with Vue, Svelte, Solid,
10
+ instead; it wraps this package. Use `core` directly with Vue, Svelte, Solid,
11
11
  or plain DOM.
12
12
 
13
13
  ```bash
@@ -27,7 +27,7 @@ const handle = openStream({
27
27
  island: "hero",
28
28
  },
29
29
  // Required. This is what the visitor reads if the network is slow, the
30
- // campaign is paused, or generation fails so write it as copy you would
30
+ // campaign is paused, or generation fails, so write it as copy you would
31
31
  // ship on its own.
32
32
  initial: { headline: "Software that meets the moment" },
33
33
  // Set true when that copy is already visible (server-rendered, or carried
@@ -63,10 +63,10 @@ terminal state; `close()` aborts the request and releases timers.
63
63
  | `fetchContent` | One-shot fetch of campaign content, for a first-paint fetch of your own. Not used by `openStream`. |
64
64
  | `CopyChoreographer`, `COPY_FIELDS`, `COPY_HOLD_MS` | The copy state machine, if you want to drive it yourself. |
65
65
  | `SseParser`, `readSseStream` | Server-sent-events parsing, usable standalone. |
66
- | `decideChrome`, `viewerPrefersStandard`, `setViewerPrefersStandard`, `STANDARD_MODE_KEY` | Whether to show the AI-adaptation mark, and the viewer's opt-out. |
66
+ | `decideChrome`, `viewerPrefersStandard`, `setViewerPrefersStandard`, `STANDARD_MODE_KEY` | Whether copy counts as AI-adapted for this viewer (feed an opt-in disclosure mark from it), and the viewer's opt-out. |
67
67
  | `applyTheme`, `themeStyle`, `tokenName`, `tokenSource`, `TOKEN_PREFIX` | Theme tokens delivered with the campaign. |
68
68
  | `track`, `ImpressionRecorder`, `observeVisibility`, `sessionId` | Impression analytics. |
69
- | `pageVariants`, `VariantRegistry`, `RESERVATION_TIMEOUT_MS` | Variant pinning one page view sees one variant. |
69
+ | `pageVariants`, `VariantRegistry`, `RESERVATION_TIMEOUT_MS` | Variant pinning: one page view sees one variant. |
70
70
  | `createClient`, `fetchFragments`, `fragmentSwapPolicy`, `MAX_FRAGMENT_FIELDS`, `MAX_FALLBACK_CHARS` | Fragments: the keys and fallbacks you declare are the request schema. |
71
71
  | `mountAudio`, `activePlayer`, `destroyActiveAudio` | Audio playback (no UI). |
72
72
  | `buildStreamUrl`, `buildContentUrl`, `negotiatedProtocol`, `PROTOCOL_*`, `SDK_PARAM`, `VARIANT_PARAM` | Protocol plumbing. |
@@ -74,14 +74,14 @@ terminal state; `close()` aborts the request and releases timers.
74
74
  ## Copy state
75
75
 
76
76
  `state.fields.{greeting,headline,body,cta}` each carry
77
- `{ text, source, mode, typing, settled }`, already sequenced for display you
77
+ `{ text, source, mode, typing, settled }`, already sequenced for display: you
78
78
  render `text` and use `typing`/`settled` for presentation only. Alongside them:
79
79
  `phase`, `error`, `rewrites`, `contentSource`, `degraded`, `variantId`,
80
80
  `held`, `theme`, `layout`, `backgroundImage`, `videoUrl`, `sequence`,
81
81
  `ctaStyle`, `ctaAction`, `meta`.
82
82
 
83
83
  `phase` moves `idle → holding? → live → settled | failed`. Nothing throws, and
84
- no failure blanks copy a visitor is reading the one deliberate blank is
84
+ no failure blanks copy a visitor is reading. The one deliberate blank is
85
85
  `holding`, and even that one does not have to move the page: `state.held`
86
86
  carries, per field, the copy the hold pulled off the canvas, so a renderer can
87
87
  reserve its exact geometry while `text` is `""`. On `failed`, fields that
@@ -91,15 +91,15 @@ a field the stream opened but never finished is repainted with your whole
91
91
 
92
92
  ## What the client guarantees
93
93
 
94
- 1. **A visitor always reads real copy.** Your `initial` text or the stream's
94
+ 1. **A visitor always reads real copy.** Your `initial` text or the stream's:
95
95
  whatever is on the canvas is something somebody wrote.
96
96
  2. **Copy changes once.** A field is rewritten at most one time per
97
97
  page view. Copy not yet on screen is held back: the field's `text` goes
98
98
  `""` while the canvas waits for the stream and your `initial` text paints
99
99
  only if the hold expires first
100
- (`holdMs`, default `COPY_HOLD_MS` 2500 ms, restarted once if the stream
100
+ (`holdMs`, default `COPY_HOLD_MS` of 2500 ms, restarted once if the stream
101
101
  proves it is alive). Render `state.held` invisibly for the duration and the
102
- space is occupied throughout, so neither exit moves the page which is what
102
+ space is occupied throughout, so neither exit moves the page, which is what
103
103
  `@sparkletree/react` does for you. Copy already on screen is never blanked
104
104
  and never typed over: deltas aimed at it (`initialIsOnScreen` or
105
105
  `serverRendered`) buffer off-canvas and the field changes at most once,
@@ -107,17 +107,18 @@ a field the stream opened but never finished is repainted with your whole
107
107
  canvas, and its pacing lives in `@sparkletree/react`'s `StreamText`.
108
108
  3. **The server declares how content was produced** (static, cached, or
109
109
  generated); the client never guesses from timing.
110
- 4. **AI-adapted copy is marked unless the viewer opts out.** `decideChrome`
111
- returns `marked` for generated and cached content, never for static and
112
- never for any provenance once the viewer has asked for the standard version.
110
+ 4. **The chrome decision is honest.** `decideChrome` returns `marked` for
111
+ generated and cached content, never for static, and never for any
112
+ provenance once the viewer has asked for the standard version. Rendering a
113
+ visible disclosure mark from that decision is the integrator's opt-in.
113
114
 
114
115
  Full documentation:
115
116
  [docs.sparkletree.io](https://docs.sparkletree.io/developers/sdk/core/)
116
117
 
117
118
  ## Requirements
118
119
 
119
- ES2022, **ESM only**, Node >= 18. `fetch`, `ReadableStream` and
120
- `AbortController` must exist inject `fetchImpl` to substitute them. No
120
+ ES2022, ESM only, Node >= 18. `fetch`, `ReadableStream` and
121
+ `AbortController` must exist; inject `fetchImpl` to substitute them. No
121
122
  dependencies.
122
123
 
123
124
  There is no `require` export condition, which matters in two places:
@@ -127,5 +128,5 @@ There is no `require` export condition, which matters in two places:
127
128
  either way, so this depends on your runtime, not your code.)
128
129
  - **In TypeScript**, `moduleResolution: "bundler"` resolves cleanly. So does
129
130
  `"node16"`/`"nodenext"` *if your own package.json has `"type": "module"`*.
130
- Without it you get `TS1479` telling you to use a dynamic import accurate,
131
+ Without it you get `TS1479` telling you to use a dynamic import: accurate,
131
132
  not a false positive.
@@ -29,7 +29,8 @@ export interface AnalyticsContext {
29
29
  }
30
30
  export interface ImpressionDetail {
31
31
  contentSource: ContentSource;
32
- /** Was the adaptation mark rendered? Reported so chrome state is measurable. */
32
+ /** Was adapted copy on screen (the chrome decision)? Reported so chrome
33
+ * state is measurable; the visible mark itself is the integrator's opt-in. */
33
34
  chromeMarked: boolean;
34
35
  /** W8 — set when the server served a deterministic winner. */
35
36
  degraded?: string | null;
@@ -1 +1 @@
1
- {"version":3,"file":"analytics.d.ts","sourceRoot":"","sources":["../src/analytics.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAE/C,MAAM,MAAM,SAAS,GAAG,YAAY,GAAG,OAAO,GAAG,YAAY,GAAG,QAAQ,CAAC;AAEzE,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc,EAAE,MAAM,CAAC;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,gBAAgB;IAC/B,aAAa,EAAE,aAAa,CAAC;IAC7B,gFAAgF;IAChF,YAAY,EAAE,OAAO,CAAC;IACtB,8DAA8D;IAC9D,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAeD,wBAAgB,SAAS,IAAI,MAAM,CAclC;AAcD,iFAAiF;AACjF,wBAAsB,KAAK,CACzB,OAAO,EAAE,gBAAgB,EACzB,SAAS,EAAE,SAAS,EACpB,SAAS,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,GACtC,OAAO,CAAC,IAAI,CAAC,CA8Bf;AAED;;;;;;GAMG;AACH,qBAAa,kBAAkB;IAGjB,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ECISION, not a rendering.
3
3
  *
4
- * Plan v1.1 decision 6: the adaptation mark is STRUCTURAL. It renders inside
5
- * the `StreamText` primitive, in the npm package, when and only when the copy
6
- * beside it was genuinely generated for this viewer. Removing it means forking
7
- * `@sparkletree/core` not deleting a line of JSX from a copied component.
4
+ * `decideChrome` says whether a piece of copy counts as adapted for this
5
+ * viewer. Nothing in the SDK renders a visible mark from it by default; the
6
+ * react package exports `InlineMark` for integrators who opt into one, and
7
+ * the impression beacon reports the decision so chrome state stays
8
+ * measurable.
8
9
  *
9
- * That is the whole design. A mark a consumer can delete is a mark that will
10
- * be deleted, and then "marked by default, contractually required" is a
11
- * sentence in a contract rather than a property of the product.
12
- *
13
- * The honesty runs the other way too, and this is the part W5 exists for: the
14
- * mark must NOT appear on copy that was merely served. Before content-source
15
- * signalling, the silent static-fallback path was indistinguishable on the
16
- * wire from live generation — so a client marking "everything that came down a
17
- * stream" would have been labelling stored copy as adapted. Marking static
18
- * copy as adapted is a worse failure than not marking generated copy, because
19
- * one under-claims and the other lies.
10
+ * The honesty constraint (the part W5 exists for): `marked` must NOT be true
11
+ * for copy that was merely served. Before content-source signalling, the
12
+ * silent static-fallback path was indistinguishable on the wire from live
13
+ * generation — so a client marking "everything that came down a stream"
14
+ * would have been labelling stored copy as adapted. Claiming static copy is
15
+ * adapted is a worse failure than under-claiming generated copy, because one
16
+ * under-claims and the other lies.
20
17
  */
21
18
  import type { ContentSource } from "./wire.js";
22
19
  /** Where the viewer's "show me the standard version" preference lives. */
23
20
  export declare const STANDARD_MODE_KEY = "st:standard";
24
21
  export interface ChromeDecision {
25
- /** Render the adaptation mark? */
22
+ /** Does this copy count as adapted for this viewer? (Feed an opt-in
23
+ * disclosure mark, and the impression beacon, from this.) */
26
24
  marked: boolean;
27
25
  /**
28
26
  * Why, in one machine-readable word. Reported on the impression, so the
@@ -1 +1 @@
1
- {"version":3,"file":"trust.d.ts","sourceRoot":"","sources":["../src/trust.ts"],"names":[],"mappings":"AAAA;;;;;;;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AAE,OAAO,EAAE,OAAO,CAAC,EAAE,OAAO,GAAG,IAAI,CAShF"}
package/dist/trust.js CHANGED
@@ -1,22 +1,19 @@
1
1
  /**
2
- * Trust chrome.
2
+ * Trust chrome — the DECISION, not a rendering.
3
3
  *
4
- * Plan v1.1 decision 6: the adaptation mark is STRUCTURAL. It renders inside
5
- * the `StreamText` primitive, in the npm package, when and only when the copy
6
- * beside it was genuinely generated for this viewer. Removing it means forking
7
- * `@sparkletree/core` not deleting a line of JSX from a copied component.
4
+ * `decideChrome` says whether a piece of copy counts as adapted for this
5
+ * viewer. Nothing in the SDK renders a visible mark from it by default; the
6
+ * react package exports `InlineMark` for integrators who opt into one, and
7
+ * the impression beacon reports the decision so chrome state stays
8
+ * measurable.
8
9
  *
9
- * That is the whole design. A mark a consumer can delete is a mark that will
10
- * be deleted, and then "marked by default, contractually required" is a
11
- * sentence in a contract rather than a property of the product.
12
- *
13
- * The honesty runs the other way too, and this is the part W5 exists for: the
14
- * mark must NOT appear on copy that was merely served. Before content-source
15
- * signalling, the silent static-fallback path was indistinguishable on the
16
- * wire from live generation — so a client marking "everything that came down a
17
- * stream" would have been labelling stored copy as adapted. Marking static
18
- * copy as adapted is a worse failure than not marking generated copy, because
19
- * one under-claims and the other lies.
10
+ * The honesty constraint (the part W5 exists for): `marked` must NOT be true
11
+ * for copy that was merely served. Before content-source signalling, the
12
+ * silent static-fallback path was indistinguishable on the wire from live
13
+ * generation — so a client marking "everything that came down a stream"
14
+ * would have been labelling stored copy as adapted. Claiming static copy is
15
+ * adapted is a worse failure than under-claiming generated copy, because one
16
+ * under-claims and the other lies.
20
17
  */
21
18
  /** Where the viewer's "show me the standard version" preference lives. */
22
19
  export const STANDARD_MODE_KEY = "st:standard";
package/dist/trust.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"trust.js","sourceRoot":"","sources":["../src/trust.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAIH,0EAA0E;AAC1E,M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O,IAAI,CAAC;AACd,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,qBAAqB,CAAC,OAAiB;IACrD,IAAI,CAAC;QACH,OAAO,cAAc,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,iBAAiB,CAAC,KAAK,GAAG,CAAC;IACrE,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAED,+EAA+E;AAC/E,MAAM,UAAU,wBAAwB,CAAC,KAAc,EAAE,OAAiB;IACxE,IAAI,CAAC;QACH,MAAM,KAAK,GAAG,cAAc,CAAC,OAAO,CAAC,CAAC;QACtC,IAAI,CAAC,KAAK;YAAE,OAAO;QACnB,IAAI,KAAK;YAAE,KAAK,CAAC,OAAO,CAAC,iBAAiB,EAAE,GAAG,CAAC,CAAC;;YAC5C,KAAK,CAAC,UAAU,CAAC,iBAAiB,CAAC,CAAC;IAC3C,CAAC;IAAC,MAAM,CAAC;QACP,uEAAuE;IACzE,CAAC;AACH,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sparkletree/core",
3
- "version": "0.5.0",
3
+ "version": "0.6.0",
4
4
  "description": "Framework-agnostic core for the SparkleTree SDK: wire protocol, copy choreography, theme, analytics, audio.",
5
5
  "license": "MIT",
6
6
  "type": "module",