@contractspec/example.learning-journey-ambient-coach 1.44.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.
@@ -0,0 +1,25 @@
1
+ $ tsdown
2
+ ℹ tsdown v0.18.3 powered by rolldown v1.0.0-beta.57
3
+ ℹ config file: /home/runner/work/contractspec/contractspec/packages/examples/learning-journey-ambient-coach/tsdown.config.js
4
+ ℹ entry: src/example.ts, src/index.ts, src/track.ts, src/docs/ambient-coach.docblock.ts, src/docs/index.ts
5
+ ℹ target: esnext
6
+ ℹ tsconfig: tsconfig.json
7
+ ℹ Build start
8
+ ℹ Cleaning 16 files
9
+ ℹ dist/track.js 1.63 kB │ gzip: 0.72 kB
10
+ ℹ dist/docs/ambient-coach.docblock.js 1.27 kB │ gzip: 0.71 kB
11
+ ℹ dist/example.js 0.80 kB │ gzip: 0.45 kB
12
+ ℹ dist/index.js 0.28 kB │ gzip: 0.14 kB
13
+ ℹ dist/docs/index.js 0.04 kB │ gzip: 0.06 kB
14
+ ℹ dist/track.js.map 2.83 kB │ gzip: 1.07 kB
15
+ ℹ dist/docs/ambient-coach.docblock.js.map 1.68 kB │ gzip: 0.88 kB
16
+ ℹ dist/example.js.map 1.15 kB │ gzip: 0.61 kB
17
+ ℹ dist/track.d.ts.map 0.18 kB │ gzip: 0.15 kB
18
+ ℹ dist/example.d.ts.map 0.14 kB │ gzip: 0.13 kB
19
+ ℹ dist/example.d.ts 1.03 kB │ gzip: 0.44 kB
20
+ ℹ dist/track.d.ts 0.44 kB │ gzip: 0.21 kB
21
+ ℹ dist/index.d.ts 0.23 kB │ gzip: 0.12 kB
22
+ ℹ dist/docs/ambient-coach.docblock.d.ts 0.01 kB │ gzip: 0.03 kB
23
+ ℹ dist/docs/index.d.ts 0.01 kB │ gzip: 0.03 kB
24
+ ℹ 15 files, total: 11.71 kB
25
+ ✔ Build complete in 13266ms
@@ -0,0 +1,26 @@
1
+ $ bun build:types && bun build:bundle
2
+ $ tsc --noEmit
3
+ $ tsdown
4
+ ℹ tsdown v0.18.3 powered by rolldown v1.0.0-beta.57
5
+ ℹ config file: /home/runner/work/contractspec/contractspec/packages/examples/learning-journey-ambient-coach/tsdown.config.js
6
+ ℹ entry: src/example.ts, src/index.ts, src/track.ts, src/docs/ambient-coach.docblock.ts, src/docs/index.ts
7
+ ℹ target: esnext
8
+ ℹ tsconfig: tsconfig.json
9
+ ℹ Build start
10
+ ℹ dist/track.js 1.63 kB │ gzip: 0.72 kB
11
+ ℹ dist/docs/ambient-coach.docblock.js 1.27 kB │ gzip: 0.71 kB
12
+ ℹ dist/example.js 0.80 kB │ gzip: 0.45 kB
13
+ ℹ dist/index.js 0.28 kB │ gzip: 0.14 kB
14
+ ℹ dist/docs/index.js 0.04 kB │ gzip: 0.06 kB
15
+ ℹ dist/track.js.map 2.83 kB │ gzip: 1.07 kB
16
+ ℹ dist/docs/ambient-coach.docblock.js.map 1.68 kB │ gzip: 0.88 kB
17
+ ℹ dist/example.js.map 1.15 kB │ gzip: 0.61 kB
18
+ ℹ dist/track.d.ts.map 0.18 kB │ gzip: 0.15 kB
19
+ ℹ dist/example.d.ts.map 0.14 kB │ gzip: 0.13 kB
20
+ ℹ dist/example.d.ts 1.03 kB │ gzip: 0.44 kB
21
+ ℹ dist/track.d.ts 0.44 kB │ gzip: 0.21 kB
22
+ ℹ dist/index.d.ts 0.23 kB │ gzip: 0.12 kB
23
+ ℹ dist/docs/ambient-coach.docblock.d.ts 0.01 kB │ gzip: 0.03 kB
24
+ ℹ dist/docs/index.d.ts 0.01 kB │ gzip: 0.03 kB
25
+ ℹ 15 files, total: 11.71 kB
26
+ ✔ Build complete in 14326ms
package/CHANGELOG.md ADDED
@@ -0,0 +1,178 @@
1
+ # @contractspec/example.learning-journey-ambient-coach
2
+
3
+ ## 1.44.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 5f3a868: chore: isolate branding to contractspec.io
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies [5f3a868]
12
+ - @contractspec/module.learning-journey@1.44.0
13
+ - @contractspec/lib.contracts@1.44.0
14
+ - @contractspec/lib.schema@1.44.0
15
+
16
+ ## 1.43.4
17
+
18
+ ### Patch Changes
19
+
20
+ - 9216062: fix: cross-platform compatibility
21
+ - Updated dependencies [9216062]
22
+ - @contractspec/module.learning-journey@1.43.4
23
+ - @contractspec/lib.contracts@1.43.4
24
+ - @contractspec/lib.schema@1.43.3
25
+
26
+ ## 1.43.3
27
+
28
+ ### Patch Changes
29
+
30
+ - 24d9759: improve documentation
31
+ - Updated dependencies [24d9759]
32
+ - @contractspec/module.learning-journey@1.43.3
33
+ - @contractspec/lib.contracts@1.43.3
34
+ - @contractspec/lib.schema@1.43.2
35
+
36
+ ## 1.43.2
37
+
38
+ ### Patch Changes
39
+
40
+ - e147271: fix: improve stability
41
+ - Updated dependencies [e147271]
42
+ - @contractspec/module.learning-journey@1.43.2
43
+ - @contractspec/lib.contracts@1.43.2
44
+ - @contractspec/lib.schema@1.43.1
45
+
46
+ ## 1.43.1
47
+
48
+ ### Patch Changes
49
+
50
+ - Updated dependencies [f28fdad]
51
+ - @contractspec/lib.contracts@1.43.1
52
+ - @contractspec/module.learning-journey@1.43.1
53
+
54
+ ## 1.43.0
55
+
56
+ ### Minor Changes
57
+
58
+ - 042d072: feat: schema declaration using json schema, including zod
59
+
60
+ ### Patch Changes
61
+
62
+ - Updated dependencies [042d072]
63
+ - @contractspec/module.learning-journey@1.43.0
64
+ - @contractspec/lib.contracts@1.43.0
65
+ - @contractspec/lib.schema@1.43.0
66
+
67
+ ## 1.42.10
68
+
69
+ ### Patch Changes
70
+
71
+ - 1e6a0f1: fix: mcp server
72
+ - Updated dependencies [1e6a0f1]
73
+ - @contractspec/module.learning-journey@1.42.10
74
+ - @contractspec/lib.contracts@1.42.10
75
+ - @contractspec/lib.schema@1.42.10
76
+
77
+ ## 1.42.9
78
+
79
+ ### Patch Changes
80
+
81
+ - 9281db7: fix ModelRegistry
82
+ - Updated dependencies [9281db7]
83
+ - @contractspec/module.learning-journey@1.42.9
84
+ - @contractspec/lib.contracts@1.42.9
85
+ - @contractspec/lib.schema@1.42.9
86
+
87
+ ## 1.42.8
88
+
89
+ ### Patch Changes
90
+
91
+ - e07b5ac: fix
92
+ - Updated dependencies [e07b5ac]
93
+ - @contractspec/module.learning-journey@1.42.8
94
+ - @contractspec/lib.contracts@1.42.8
95
+ - @contractspec/lib.schema@1.42.8
96
+
97
+ ## 1.42.7
98
+
99
+ ### Patch Changes
100
+
101
+ - e9b575d: fix release
102
+ - Updated dependencies [e9b575d]
103
+ - @contractspec/module.learning-journey@1.42.7
104
+ - @contractspec/lib.contracts@1.42.7
105
+ - @contractspec/lib.schema@1.42.7
106
+
107
+ ## 1.42.6
108
+
109
+ ### Patch Changes
110
+
111
+ - 1500242: fix tooling
112
+ - Updated dependencies [1500242]
113
+ - @contractspec/module.learning-journey@1.42.6
114
+ - @contractspec/lib.contracts@1.42.6
115
+ - @contractspec/lib.schema@1.42.6
116
+
117
+ ## 1.42.5
118
+
119
+ ### Patch Changes
120
+
121
+ - 1299719: fix vscode
122
+ - Updated dependencies [1299719]
123
+ - @contractspec/module.learning-journey@1.42.5
124
+ - @contractspec/lib.contracts@1.42.5
125
+ - @contractspec/lib.schema@1.42.5
126
+
127
+ ## 1.42.4
128
+
129
+ ### Patch Changes
130
+
131
+ - ac28b99: fix: generate from openapi
132
+ - Updated dependencies [ac28b99]
133
+ - @contractspec/module.learning-journey@1.42.4
134
+ - @contractspec/lib.contracts@1.42.4
135
+ - @contractspec/lib.schema@1.42.4
136
+
137
+ ## 1.42.3
138
+
139
+ ### Patch Changes
140
+
141
+ - 3f5d015: fix(tooling): cicd
142
+ - Updated dependencies [3f5d015]
143
+ - @contractspec/lib.contracts@1.42.3
144
+ - @contractspec/lib.schema@1.42.3
145
+ - @contractspec/module.learning-journey@1.42.3
146
+
147
+ ## 1.42.2
148
+
149
+ ### Patch Changes
150
+
151
+ - 1f9ac4c: fix
152
+ - Updated dependencies [1f9ac4c]
153
+ - @contractspec/lib.contracts@1.42.2
154
+ - @contractspec/lib.schema@1.42.2
155
+ - @contractspec/module.learning-journey@1.42.2
156
+
157
+ ## 1.42.1
158
+
159
+ ### Patch Changes
160
+
161
+ - f043995: Fix release
162
+ - Updated dependencies [f043995]
163
+ - @contractspec/module.learning-journey@1.42.1
164
+ - @contractspec/lib.contracts@1.42.1
165
+ - @contractspec/lib.schema@1.42.1
166
+
167
+ ## 1.42.0
168
+
169
+ ### Minor Changes
170
+
171
+ - 8eefd9c: initial release
172
+
173
+ ### Patch Changes
174
+
175
+ - Updated dependencies [8eefd9c]
176
+ - @contractspec/lib.contracts@1.42.0
177
+ - @contractspec/lib.schema@1.42.0
178
+ - @contractspec/module.learning-journey@1.42.0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Chaman Ventures, SASU
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,37 @@
1
+ # @contractspec/example.learning-journey-ambient-coach
2
+
3
+ Website: https://contractspec.io/
4
+
5
+
6
+ Ambient coach learning journey example that surfaces contextual tips based on user behavior and marks completion when acknowledged or acted upon.
7
+
8
+ ## What it shows
9
+
10
+ - Tip/insight model with trigger → show → acknowledge/action events
11
+ - Track steps for money and coliving behaviors
12
+ - Event and count-based completion with optional action follow-ups
13
+ - XP/engagement increments for acting on tips
14
+
15
+ ## How to run
16
+
17
+ 1. `bun test packages/examples/learning-journey-ambient-coach`
18
+ 2. Use registry helper `recordEvent` with events like:
19
+
20
+ ```ts
21
+ recordEvent({
22
+ name: 'coach.tip.triggered',
23
+ learnerId: 'u1',
24
+ payload: { tipId: 'cash_buffer_too_high' },
25
+ });
26
+ recordEvent({
27
+ name: 'coach.tip.follow_up_action_taken',
28
+ learnerId: 'u1',
29
+ payload: { tipId: 'cash_buffer_too_high' },
30
+ });
31
+ ```
32
+
33
+ ## Adapting
34
+
35
+ - Swap categories for your domain (money, coliving, product adoption).
36
+ - Adjust trigger payload filters to align with analytics events.
37
+ - Add more steps or split tracks per persona/segment.
@@ -0,0 +1 @@
1
+ export { };
@@ -0,0 +1,34 @@
1
+ import { registerDocBlocks } from "@contractspec/lib.contracts/docs";
2
+
3
+ //#region src/docs/ambient-coach.docblock.ts
4
+ registerDocBlocks([{
5
+ id: "docs.learning-journey.ambient-coach",
6
+ title: "Learning Journey — Ambient Coach",
7
+ summary: "Context-aware coaching pattern that triggers tips, shows them, and marks completion when users act or acknowledge.",
8
+ kind: "reference",
9
+ visibility: "public",
10
+ route: "/docs/learning-journey/ambient-coach",
11
+ tags: [
12
+ "learning",
13
+ "coach",
14
+ "tips"
15
+ ],
16
+ body: `## Tracks
17
+ - \`money_ambient_coach\`: cash buffer too high, no savings goal, irregular savings
18
+ - \`coliving_ambient_coach\`: noise late evening, guest frequency high, shared space conflicts
19
+
20
+ ## Steps & Events
21
+ - Trigger tip: \`coach.tip.triggered\` (payload includes \`tipId\`)
22
+ - Show tip (optional UI emission): \`coach.tip.shown\`
23
+ - Complete when acknowledged or follow-up action taken:
24
+ - \`coach.tip.acknowledged\`
25
+ - \`coach.tip.follow_up_action_taken\`
26
+
27
+ ## Usage
28
+ - Tracks export from \`@contractspec/example.learning-journey-ambient-coach/track\`.
29
+ - Registry progression is event-driven; payload filters can scope tips per category.
30
+ - XP/engagement can be awarded on completion of each tip step.`
31
+ }]);
32
+
33
+ //#endregion
34
+ //# sourceMappingURL=ambient-coach.docblock.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ambient-coach.docblock.js","names":[],"sources":["../../src/docs/ambient-coach.docblock.ts"],"sourcesContent":["import type { DocBlock } from '@contractspec/lib.contracts/docs';\nimport { registerDocBlocks } from '@contractspec/lib.contracts/docs';\n\nconst ambientCoachDocBlocks: DocBlock[] = [\n {\n id: 'docs.learning-journey.ambient-coach',\n title: 'Learning Journey — Ambient Coach',\n summary:\n 'Context-aware coaching pattern that triggers tips, shows them, and marks completion when users act or acknowledge.',\n kind: 'reference',\n visibility: 'public',\n route: '/docs/learning-journey/ambient-coach',\n tags: ['learning', 'coach', 'tips'],\n body: `## Tracks\n- \\`money_ambient_coach\\`: cash buffer too high, no savings goal, irregular savings\n- \\`coliving_ambient_coach\\`: noise late evening, guest frequency high, shared space conflicts\n\n## Steps & Events\n- Trigger tip: \\`coach.tip.triggered\\` (payload includes \\`tipId\\`)\n- Show tip (optional UI emission): \\`coach.tip.shown\\`\n- Complete when acknowledged or follow-up action taken:\n - \\`coach.tip.acknowledged\\`\n - \\`coach.tip.follow_up_action_taken\\`\n\n## Usage\n- Tracks export from \\`@contractspec/example.learning-journey-ambient-coach/track\\`.\n- Registry progression is event-driven; payload filters can scope tips per category.\n- XP/engagement can be awarded on completion of each tip step.`,\n },\n];\n\nregisterDocBlocks(ambientCoachDocBlocks);\n"],"mappings":";;;AA+BA,kBA5B0C,CACxC;CACE,IAAI;CACJ,OAAO;CACP,SACE;CACF,MAAM;CACN,YAAY;CACZ,OAAO;CACP,MAAM;EAAC;EAAY;EAAS;EAAO;CACnC,MAAM;;;;;;;;;;;;;;;CAeP,CACF,CAEuC"}
@@ -0,0 +1 @@
1
+ export { };
@@ -0,0 +1 @@
1
+ import "./ambient-coach.docblock.js";
@@ -0,0 +1,33 @@
1
+ //#region src/example.d.ts
2
+ declare const example: {
3
+ readonly id: "learning-journey-ambient-coach";
4
+ readonly title: "Learning Journey — Ambient Coach";
5
+ readonly summary: "Ambient coaching pattern: lightweight nudges driven by context and recent progress.";
6
+ readonly tags: readonly ["learning", "coaching", "ambient"];
7
+ readonly kind: "template";
8
+ readonly visibility: "public";
9
+ readonly docs: {
10
+ readonly rootDocId: "docs.learning-journey.ambient-coach";
11
+ };
12
+ readonly entrypoints: {
13
+ readonly packageName: "@contractspec/example.learning-journey-ambient-coach";
14
+ readonly docs: "./docs";
15
+ };
16
+ readonly surfaces: {
17
+ readonly templates: true;
18
+ readonly sandbox: {
19
+ readonly enabled: true;
20
+ readonly modes: readonly ["playground", "markdown"];
21
+ };
22
+ readonly studio: {
23
+ readonly enabled: true;
24
+ readonly installable: true;
25
+ };
26
+ readonly mcp: {
27
+ readonly enabled: true;
28
+ };
29
+ };
30
+ };
31
+ //#endregion
32
+ export { example as default };
33
+ //# sourceMappingURL=example.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"example.d.ts","names":[],"sources":["../src/example.ts"],"sourcesContent":[],"mappings":";cAAM;EAAA,SAAA,EAqBI,EAAA,gCAAA"}
@@ -0,0 +1,35 @@
1
+ //#region src/example.ts
2
+ const example = {
3
+ id: "learning-journey-ambient-coach",
4
+ title: "Learning Journey — Ambient Coach",
5
+ summary: "Ambient coaching pattern: lightweight nudges driven by context and recent progress.",
6
+ tags: [
7
+ "learning",
8
+ "coaching",
9
+ "ambient"
10
+ ],
11
+ kind: "template",
12
+ visibility: "public",
13
+ docs: { rootDocId: "docs.learning-journey.ambient-coach" },
14
+ entrypoints: {
15
+ packageName: "@contractspec/example.learning-journey-ambient-coach",
16
+ docs: "./docs"
17
+ },
18
+ surfaces: {
19
+ templates: true,
20
+ sandbox: {
21
+ enabled: true,
22
+ modes: ["playground", "markdown"]
23
+ },
24
+ studio: {
25
+ enabled: true,
26
+ installable: true
27
+ },
28
+ mcp: { enabled: true }
29
+ }
30
+ };
31
+ var example_default = example;
32
+
33
+ //#endregion
34
+ export { example_default as default };
35
+ //# sourceMappingURL=example.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"example.js","names":[],"sources":["../src/example.ts"],"sourcesContent":["const example = {\n id: 'learning-journey-ambient-coach',\n title: 'Learning Journey — Ambient Coach',\n summary:\n 'Ambient coaching pattern: lightweight nudges driven by context and recent progress.',\n tags: ['learning', 'coaching', 'ambient'],\n kind: 'template',\n visibility: 'public',\n docs: {\n rootDocId: 'docs.learning-journey.ambient-coach',\n },\n entrypoints: {\n packageName: '@contractspec/example.learning-journey-ambient-coach',\n docs: './docs',\n },\n surfaces: {\n templates: true,\n sandbox: { enabled: true, modes: ['playground', 'markdown'] },\n studio: { enabled: true, installable: true },\n mcp: { enabled: true },\n },\n} as const;\n\nexport default example;\n"],"mappings":";AAAA,MAAM,UAAU;CACd,IAAI;CACJ,OAAO;CACP,SACE;CACF,MAAM;EAAC;EAAY;EAAY;EAAU;CACzC,MAAM;CACN,YAAY;CACZ,MAAM,EACJ,WAAW,uCACZ;CACD,aAAa;EACX,aAAa;EACb,MAAM;EACP;CACD,UAAU;EACR,WAAW;EACX,SAAS;GAAE,SAAS;GAAM,OAAO,CAAC,cAAc,WAAW;GAAE;EAC7D,QAAQ;GAAE,SAAS;GAAM,aAAa;GAAM;EAC5C,KAAK,EAAE,SAAS,MAAM;EACvB;CACF;AAED,sBAAe"}
@@ -0,0 +1,3 @@
1
+ import example from "./example.js";
2
+ import { ambientCoachTracks, colivingAmbientCoachTrack, moneyAmbientCoachTrack } from "./track.js";
3
+ export { ambientCoachTracks, colivingAmbientCoachTrack, example, moneyAmbientCoachTrack };
package/dist/index.js ADDED
@@ -0,0 +1,5 @@
1
+ import example_default from "./example.js";
2
+ import { ambientCoachTracks, colivingAmbientCoachTrack, moneyAmbientCoachTrack } from "./track.js";
3
+ import "./docs/index.js";
4
+
5
+ export { ambientCoachTracks, colivingAmbientCoachTrack, example_default as example, moneyAmbientCoachTrack };
@@ -0,0 +1,9 @@
1
+ import { LearningJourneyTrackSpec } from "@contractspec/module.learning-journey/track-spec";
2
+
3
+ //#region src/track.d.ts
4
+ declare const moneyAmbientCoachTrack: LearningJourneyTrackSpec;
5
+ declare const colivingAmbientCoachTrack: LearningJourneyTrackSpec;
6
+ declare const ambientCoachTracks: LearningJourneyTrackSpec[];
7
+ //#endregion
8
+ export { ambientCoachTracks, colivingAmbientCoachTrack, moneyAmbientCoachTrack };
9
+ //# sourceMappingURL=track.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"track.d.ts","names":[],"sources":["../src/track.ts"],"sourcesContent":[],"mappings":";;;cAmBa,wBAAwB;cA0BxB,2BAA2B;AA1B3B,cAmDA,kBA3BZ,EA2BgC,wBA3BhC,EAAA"}
package/dist/track.js ADDED
@@ -0,0 +1,42 @@
1
+ //#region src/track.ts
2
+ const makeTipStep = (id, tipId, description) => ({
3
+ id,
4
+ title: `Resolve tip: ${tipId}`,
5
+ description,
6
+ completion: {
7
+ kind: "event",
8
+ eventName: "coach.tip.follow_up_action_taken",
9
+ payloadFilter: { tipId }
10
+ },
11
+ xpReward: 20,
12
+ metadata: { tipId }
13
+ });
14
+ const moneyAmbientCoachTrack = {
15
+ id: "money_ambient_coach",
16
+ name: "Ambient Coach — Money",
17
+ description: "Subtle coaching for money patterns (cash buffer, goals, saving rhythm).",
18
+ targetUserSegment: "money_user",
19
+ totalXp: 60,
20
+ steps: [
21
+ makeTipStep("cash_buffer_too_high", "cash_buffer_too_high", "Suggest sweeping excess cash into goals."),
22
+ makeTipStep("no_savings_goal", "no_savings_goal", "Prompt setting a first savings goal."),
23
+ makeTipStep("irregular_savings", "irregular_savings", "Recommend recurring saves after irregular deposits.")
24
+ ]
25
+ };
26
+ const colivingAmbientCoachTrack = {
27
+ id: "coliving_ambient_coach",
28
+ name: "Ambient Coach — Coliving",
29
+ description: "Contextual tips for healthy coliving habits.",
30
+ targetUserSegment: "coliving",
31
+ totalXp: 60,
32
+ steps: [
33
+ makeTipStep("noise_late_evening", "noise_late_evening", "Suggest updating quiet hours to reduce evening noise."),
34
+ makeTipStep("guest_frequency_high", "guest_frequency_high", "Set guest frequency expectations for the house."),
35
+ makeTipStep("shared_space_conflicts", "shared_space_conflicts", "Offer a shared-space checklist to reduce conflicts.")
36
+ ]
37
+ };
38
+ const ambientCoachTracks = [moneyAmbientCoachTrack, colivingAmbientCoachTrack];
39
+
40
+ //#endregion
41
+ export { ambientCoachTracks, colivingAmbientCoachTrack, moneyAmbientCoachTrack };
42
+ //# sourceMappingURL=track.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"track.js","names":["moneyAmbientCoachTrack: LearningJourneyTrackSpec","colivingAmbientCoachTrack: LearningJourneyTrackSpec","ambientCoachTracks: LearningJourneyTrackSpec[]"],"sources":["../src/track.ts"],"sourcesContent":["import type { LearningJourneyTrackSpec } from '@contractspec/module.learning-journey/track-spec';\n\nconst makeTipStep = (\n id: string,\n tipId: string,\n description: string\n): LearningJourneyTrackSpec['steps'][number] => ({\n id,\n title: `Resolve tip: ${tipId}`,\n description,\n completion: {\n kind: 'event',\n eventName: 'coach.tip.follow_up_action_taken',\n payloadFilter: { tipId },\n },\n xpReward: 20,\n metadata: { tipId },\n});\n\nexport const moneyAmbientCoachTrack: LearningJourneyTrackSpec = {\n id: 'money_ambient_coach',\n name: 'Ambient Coach — Money',\n description:\n 'Subtle coaching for money patterns (cash buffer, goals, saving rhythm).',\n targetUserSegment: 'money_user',\n totalXp: 60,\n steps: [\n makeTipStep(\n 'cash_buffer_too_high',\n 'cash_buffer_too_high',\n 'Suggest sweeping excess cash into goals.'\n ),\n makeTipStep(\n 'no_savings_goal',\n 'no_savings_goal',\n 'Prompt setting a first savings goal.'\n ),\n makeTipStep(\n 'irregular_savings',\n 'irregular_savings',\n 'Recommend recurring saves after irregular deposits.'\n ),\n ],\n};\n\nexport const colivingAmbientCoachTrack: LearningJourneyTrackSpec = {\n id: 'coliving_ambient_coach',\n name: 'Ambient Coach — Coliving',\n description: 'Contextual tips for healthy coliving habits.',\n targetUserSegment: 'coliving',\n totalXp: 60,\n steps: [\n makeTipStep(\n 'noise_late_evening',\n 'noise_late_evening',\n 'Suggest updating quiet hours to reduce evening noise.'\n ),\n makeTipStep(\n 'guest_frequency_high',\n 'guest_frequency_high',\n 'Set guest frequency expectations for the house.'\n ),\n makeTipStep(\n 'shared_space_conflicts',\n 'shared_space_conflicts',\n 'Offer a shared-space checklist to reduce conflicts.'\n ),\n ],\n};\n\nexport const ambientCoachTracks: LearningJourneyTrackSpec[] = [\n moneyAmbientCoachTrack,\n colivingAmbientCoachTrack,\n];\n"],"mappings":";AAEA,MAAM,eACJ,IACA,OACA,iBAC+C;CAC/C;CACA,OAAO,gBAAgB;CACvB;CACA,YAAY;EACV,MAAM;EACN,WAAW;EACX,eAAe,EAAE,OAAO;EACzB;CACD,UAAU;CACV,UAAU,EAAE,OAAO;CACpB;AAED,MAAaA,yBAAmD;CAC9D,IAAI;CACJ,MAAM;CACN,aACE;CACF,mBAAmB;CACnB,SAAS;CACT,OAAO;EACL,YACE,wBACA,wBACA,2CACD;EACD,YACE,mBACA,mBACA,uCACD;EACD,YACE,qBACA,qBACA,sDACD;EACF;CACF;AAED,MAAaC,4BAAsD;CACjE,IAAI;CACJ,MAAM;CACN,aAAa;CACb,mBAAmB;CACnB,SAAS;CACT,OAAO;EACL,YACE,sBACA,sBACA,wDACD;EACD,YACE,wBACA,wBACA,kDACD;EACD,YACE,0BACA,0BACA,sDACD;EACF;CACF;AAED,MAAaC,qBAAiD,CAC5D,wBACA,0BACD"}
package/example.ts ADDED
@@ -0,0 +1 @@
1
+ export { default } from './src/example';
package/package.json ADDED
@@ -0,0 +1,60 @@
1
+ {
2
+ "name": "@contractspec/example.learning-journey-ambient-coach",
3
+ "version": "1.44.0",
4
+ "description": "Ambient coach learning journey example with contextual tips and follow-up actions.",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": "./dist/index.js",
10
+ "./docs": "./dist/docs/index.js",
11
+ "./docs/ambient-coach.docblock": "./dist/docs/ambient-coach.docblock.js",
12
+ "./example": "./dist/example.js",
13
+ "./track": "./dist/track.js",
14
+ "./*": "./*"
15
+ },
16
+ "scripts": {
17
+ "publish:pkg": "bun publish --tolerate-republish --ignore-scripts --verbose",
18
+ "publish:pkg:canary": "bun publish:pkg --tag canary",
19
+ "build": "bun build:types && bun build:bundle",
20
+ "build:bundle": "tsdown",
21
+ "build:types": "tsc --noEmit",
22
+ "dev": "bun build:bundle --watch",
23
+ "clean": "rimraf dist .turbo",
24
+ "lint": "bun lint:fix",
25
+ "lint:fix": "eslint src --fix",
26
+ "lint:check": "eslint src",
27
+ "test": "bun test"
28
+ },
29
+ "dependencies": {
30
+ "@contractspec/module.learning-journey": "1.44.0",
31
+ "@contractspec/lib.schema": "1.44.0",
32
+ "@contractspec/lib.contracts": "1.44.0"
33
+ },
34
+ "devDependencies": {
35
+ "@contractspec/tool.tsdown": "1.44.0",
36
+ "@contractspec/tool.typescript": "1.44.0",
37
+ "tsdown": "^0.18.3",
38
+ "typescript": "^5.9.3"
39
+ },
40
+ "module": "./dist/index.js",
41
+ "publishConfig": {
42
+ "exports": {
43
+ ".": "./dist/index.js",
44
+ "./example": "./dist/example.js",
45
+ "./track": "./dist/track.js",
46
+ "./docs": "./dist/docs/index.js",
47
+ "./docs/ambient-coach.docblock": "./dist/docs/ambient-coach.docblock.js",
48
+ "./*": "./*"
49
+ },
50
+ "registry": "https://registry.npmjs.org/",
51
+ "access": "public"
52
+ },
53
+ "license": "MIT",
54
+ "repository": {
55
+ "type": "git",
56
+ "url": "https://github.com/lssm-tech/contractspec.git",
57
+ "directory": "packages/examples/learning-journey-ambient-coach"
58
+ },
59
+ "homepage": "https://contractspec.io"
60
+ }
@@ -0,0 +1,32 @@
1
+ import type { DocBlock } from '@contractspec/lib.contracts/docs';
2
+ import { registerDocBlocks } from '@contractspec/lib.contracts/docs';
3
+
4
+ const ambientCoachDocBlocks: DocBlock[] = [
5
+ {
6
+ id: 'docs.learning-journey.ambient-coach',
7
+ title: 'Learning Journey — Ambient Coach',
8
+ summary:
9
+ 'Context-aware coaching pattern that triggers tips, shows them, and marks completion when users act or acknowledge.',
10
+ kind: 'reference',
11
+ visibility: 'public',
12
+ route: '/docs/learning-journey/ambient-coach',
13
+ tags: ['learning', 'coach', 'tips'],
14
+ body: `## Tracks
15
+ - \`money_ambient_coach\`: cash buffer too high, no savings goal, irregular savings
16
+ - \`coliving_ambient_coach\`: noise late evening, guest frequency high, shared space conflicts
17
+
18
+ ## Steps & Events
19
+ - Trigger tip: \`coach.tip.triggered\` (payload includes \`tipId\`)
20
+ - Show tip (optional UI emission): \`coach.tip.shown\`
21
+ - Complete when acknowledged or follow-up action taken:
22
+ - \`coach.tip.acknowledged\`
23
+ - \`coach.tip.follow_up_action_taken\`
24
+
25
+ ## Usage
26
+ - Tracks export from \`@contractspec/example.learning-journey-ambient-coach/track\`.
27
+ - Registry progression is event-driven; payload filters can scope tips per category.
28
+ - XP/engagement can be awarded on completion of each tip step.`,
29
+ },
30
+ ];
31
+
32
+ registerDocBlocks(ambientCoachDocBlocks);
@@ -0,0 +1 @@
1
+ import './ambient-coach.docblock';
package/src/example.ts ADDED
@@ -0,0 +1,24 @@
1
+ const example = {
2
+ id: 'learning-journey-ambient-coach',
3
+ title: 'Learning Journey — Ambient Coach',
4
+ summary:
5
+ 'Ambient coaching pattern: lightweight nudges driven by context and recent progress.',
6
+ tags: ['learning', 'coaching', 'ambient'],
7
+ kind: 'template',
8
+ visibility: 'public',
9
+ docs: {
10
+ rootDocId: 'docs.learning-journey.ambient-coach',
11
+ },
12
+ entrypoints: {
13
+ packageName: '@contractspec/example.learning-journey-ambient-coach',
14
+ docs: './docs',
15
+ },
16
+ surfaces: {
17
+ templates: true,
18
+ sandbox: { enabled: true, modes: ['playground', 'markdown'] },
19
+ studio: { enabled: true, installable: true },
20
+ mcp: { enabled: true },
21
+ },
22
+ } as const;
23
+
24
+ export default example;
package/src/index.ts ADDED
@@ -0,0 +1,3 @@
1
+ export * from './track';
2
+ export { default as example } from './example';
3
+ import './docs';