@contractspec/lib.personalization 6.0.6 → 6.0.10

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
@@ -1,40 +1,79 @@
1
1
  # @contractspec/lib.personalization
2
2
 
3
- Website: https://contractspec.io/
3
+ Website: https://contractspec.io
4
4
 
5
+ **Behavior tracking, analysis, and adaptation helpers for ContractSpec personalization.**
5
6
 
6
- Composable behavior tracking and personalization primitives for ContractSpec applications. The library provides trackers that capture feature usage, analyzers that transform raw events into adaptation hints, and adapters that feed personalized overlays or workflow tweaks.
7
+ ## What It Provides
7
8
 
8
- ## Modules
9
+ - **Layer**: lib.
10
+ - **Consumers**: bundles, example apps.
11
+ - `src/docs/` contains docblocks and documentation-facing exports.
12
+ - Related ContractSpec packages include `@contractspec/lib.bus`, `@contractspec/lib.contracts-spec`, `@contractspec/lib.knowledge`, `@contractspec/lib.overlay-engine`, `@contractspec/lib.schema`, `@contractspec/lib.surface-runtime`, ...
13
+ - `src/docs/` contains docblocks and documentation-facing exports.
9
14
 
10
- - `tracker` – lightweight tracker helpers that record field/feature/workflow usage.
11
- - `store` – store abstractions plus an in-memory implementation.
12
- - `analyzer` – stateless analyzers that convert usage data into insights.
13
- - `adapter` – bridges insights into OverlaySpecs or WorkflowComposer extensions.
14
-
15
- See `docs/tech/personalization/behavior-tracking.md` for full usage notes.
16
-
17
- ## Bundle spec / surface-runtime alignment
18
-
19
- When using `@contractspec/lib.surface-runtime`, the types in `./preference-dimensions` are the canonical source for preference resolution:
20
-
21
- - **`PreferenceDimensions`** — 7-dimension model (guidance, density, dataDepth, control, media, pace, narrative)
22
- - **`BundlePreferenceAdapter`** — Interface for resolving and persisting preferences; surface-runtime's `resolvePreferenceProfile` consumes adapters implementing this interface
23
- - **`ResolvedPreferenceProfile`** — Canonical values with source attribution; aligns with surface-runtime's adaptation output
24
-
25
- Pass a `BundlePreferenceAdapter` implementation to `resolveBundle` options when integrating personalization with surface-runtime.
15
+ ## Installation
26
16
 
17
+ `npm install @contractspec/lib.personalization`
27
18
 
19
+ or
28
20
 
21
+ `bun add @contractspec/lib.personalization`
29
22
 
23
+ ## Usage
30
24
 
25
+ Import the root entrypoint from `@contractspec/lib.personalization`, or choose a documented subpath when you only need one part of the package surface.
31
26
 
27
+ ## Architecture
32
28
 
29
+ - `src/adapter.ts` is part of the package's public or composition surface.
30
+ - `src/analyzer.ts` is part of the package's public or composition surface.
31
+ - `src/docs/` contains docblocks and documentation-facing exports.
32
+ - `src/index.ts` is the root public barrel and package entrypoint.
33
+ - `src/preference-dimensions.ts` is part of the package's public or composition surface.
34
+ - `src/store.ts` is part of the package's public or composition surface.
35
+ - `src/tracker.ts` is part of the package's public or composition surface.
36
+ - `src/types.ts` is shared public type definitions.
33
37
 
38
+ ## Public Entry Points
34
39
 
40
+ - Export `.` resolves through `./src/index.ts`.
41
+ - Export `./adapter` resolves through `./src/adapter.ts`.
42
+ - Export `./analyzer` resolves through `./src/analyzer.ts`.
43
+ - Export `./docs` resolves through `./src/docs/index.ts`.
44
+ - Export `./docs/behavior-tracking.docblock` resolves through `./src/docs/behavior-tracking.docblock.ts`.
45
+ - Export `./docs/overlay-engine.docblock` resolves through `./src/docs/overlay-engine.docblock.ts`.
46
+ - Export `./docs/workflow-composition.docblock` resolves through `./src/docs/workflow-composition.docblock.ts`.
47
+ - Export `./preference-dimensions` resolves through `./src/preference-dimensions.ts`.
48
+ - Export `./store` resolves through `./src/store.ts`.
49
+ - Export `./tracker` resolves through `./src/tracker.ts`.
50
+ - The package publishes 11 total export subpaths; keep docs aligned with `package.json`.
35
51
 
52
+ ## Local Commands
36
53
 
54
+ - `bun run dev` — contractspec-bun-build dev
55
+ - `bun run build` — bun run prebuild && bun run build:bundle && bun run build:types
56
+ - `bun run test` — bun test --pass-with-no-tests
57
+ - `bun run lint` — bun lint:fix
58
+ - `bun run lint:check` — biome check .
59
+ - `bun run lint:fix` — biome check --write --unsafe --only=nursery/useSortedClasses . && biome check --write .
60
+ - `bun run typecheck` — tsc --noEmit
61
+ - `bun run publish:pkg` — bun publish --tolerate-republish --ignore-scripts --verbose
62
+ - `bun run publish:pkg:canary` — bun publish:pkg --tag canary
63
+ - `bun run clean` — rimraf dist .turbo
64
+ - `bun run build:bundle` — contractspec-bun-build transpile
65
+ - `bun run build:types` — contractspec-bun-build types
66
+ - `bun run prebuild` — contractspec-bun-build prebuild
37
67
 
68
+ ## Recent Updates
38
69
 
70
+ - Replace eslint+prettier by biomejs to optimize speed.
71
+ - Vercel AI SDK parity + surface-runtime i18n and bundle alignment.
72
+ - Bundle spec alignment, i18n support, PM workbench pilot.
73
+ - Upgrade dependencies.
39
74
 
75
+ ## Notes
40
76
 
77
+ - Tracker interface is the adapter boundary — implementation details must not leak.
78
+ - Behavior data schema must stay backward-compatible; older events must remain parseable.
79
+ - Depends on bus, overlay-engine, and knowledge — coordinate cross-lib changes.
@@ -456,7 +456,7 @@ function filterEvents(events, query) {
456
456
  }
457
457
 
458
458
  // src/tracker.ts
459
- import { trace, metrics } from "@opentelemetry/api";
459
+ import { metrics, trace } from "@opentelemetry/api";
460
460
  var DEFAULT_BUFFER_SIZE = 25;
461
461
 
462
462
  class BehaviorTracker {
@@ -1,5 +1,5 @@
1
1
  // src/tracker.ts
2
- import { trace, metrics } from "@opentelemetry/api";
2
+ import { metrics, trace } from "@opentelemetry/api";
3
3
  var DEFAULT_BUFFER_SIZE = 25;
4
4
 
5
5
  class BehaviorTracker {
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- export * from './types';
2
- export * from './store';
3
- export * from './tracker';
4
- export * from './analyzer';
5
1
  export * from './adapter';
2
+ export * from './analyzer';
6
3
  export * from './preference-dimensions';
4
+ export * from './store';
5
+ export * from './tracker';
6
+ export * from './types';
7
7
  import './docs';
package/dist/index.js CHANGED
@@ -457,7 +457,7 @@ function filterEvents(events, query) {
457
457
  }
458
458
 
459
459
  // src/tracker.ts
460
- import { trace, metrics } from "@opentelemetry/api";
460
+ import { metrics, trace } from "@opentelemetry/api";
461
461
  var DEFAULT_BUFFER_SIZE = 25;
462
462
 
463
463
  class BehaviorTracker {
@@ -456,7 +456,7 @@ function filterEvents(events, query) {
456
456
  }
457
457
 
458
458
  // src/tracker.ts
459
- import { trace, metrics } from "@opentelemetry/api";
459
+ import { metrics, trace } from "@opentelemetry/api";
460
460
  var DEFAULT_BUFFER_SIZE = 25;
461
461
 
462
462
  class BehaviorTracker {
@@ -1,5 +1,5 @@
1
1
  // src/tracker.ts
2
- import { trace, metrics } from "@opentelemetry/api";
2
+ import { metrics, trace } from "@opentelemetry/api";
3
3
  var DEFAULT_BUFFER_SIZE = 25;
4
4
 
5
5
  class BehaviorTracker {
package/dist/tracker.js CHANGED
@@ -1,6 +1,6 @@
1
1
  // @bun
2
2
  // src/tracker.ts
3
- import { trace, metrics } from "@opentelemetry/api";
3
+ import { metrics, trace } from "@opentelemetry/api";
4
4
  var DEFAULT_BUFFER_SIZE = 25;
5
5
 
6
6
  class BehaviorTracker {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contractspec/lib.personalization",
3
- "version": "6.0.6",
3
+ "version": "6.0.10",
4
4
  "description": "Behavior tracking, analysis, and adaptation helpers for ContractSpec personalization.",
5
5
  "keywords": [
6
6
  "contractspec",
@@ -25,23 +25,23 @@
25
25
  "dev": "contractspec-bun-build dev",
26
26
  "clean": "rimraf dist .turbo",
27
27
  "lint": "bun lint:fix",
28
- "lint:fix": "eslint src --fix",
29
- "lint:check": "eslint src",
28
+ "lint:fix": "biome check --write --unsafe --only=nursery/useSortedClasses . && biome check --write .",
29
+ "lint:check": "biome check .",
30
30
  "test": "bun test --pass-with-no-tests",
31
31
  "prebuild": "contractspec-bun-build prebuild",
32
32
  "typecheck": "tsc --noEmit"
33
33
  },
34
34
  "dependencies": {
35
- "@contractspec/lib.bus": "3.7.6",
36
- "@contractspec/lib.schema": "3.7.6",
37
- "@contractspec/lib.contracts-spec": "3.7.6",
38
- "@contractspec/lib.knowledge": "3.7.6",
39
- "@contractspec/lib.overlay-engine": "3.7.6",
35
+ "@contractspec/lib.bus": "3.7.10",
36
+ "@contractspec/lib.schema": "3.7.8",
37
+ "@contractspec/lib.contracts-spec": "4.1.2",
38
+ "@contractspec/lib.knowledge": "3.7.10",
39
+ "@contractspec/lib.overlay-engine": "3.7.10",
40
40
  "@opentelemetry/api": "^1.9.0"
41
41
  },
42
42
  "peerDependencies": {
43
43
  "@opentelemetry/api": "^1.9.0",
44
- "@contractspec/lib.surface-runtime": "0.5.6"
44
+ "@contractspec/lib.surface-runtime": "0.5.10"
45
45
  },
46
46
  "peerDependenciesMeta": {
47
47
  "@contractspec/lib.surface-runtime": {
@@ -49,9 +49,9 @@
49
49
  }
50
50
  },
51
51
  "devDependencies": {
52
- "@contractspec/tool.typescript": "3.7.6",
52
+ "@contractspec/tool.typescript": "3.7.8",
53
53
  "typescript": "^5.9.3",
54
- "@contractspec/tool.bun": "3.7.6"
54
+ "@contractspec/tool.bun": "3.7.8"
55
55
  },
56
56
  "exports": {
57
57
  ".": {