@medicine-wheel/ceremonial-diary 0.5.1

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 ADDED
@@ -0,0 +1,62 @@
1
+ # @medicine-wheel/ceremonial-diary
2
+
3
+ The ceremonial diary — a participant's voice across the **Five-Phase Ceremonial
4
+ Technology Methodology**. Intention, observation, and reflection entries, with
5
+ pattern detection, statistics, Markdown export, and optional projection into the
6
+ chronicle wheel.
7
+
8
+ This domain came home from Miadi (`jgwill/Miadi#506`) as a reusable package. It
9
+ persists through [`@medicine-wheel/storage-provider`](../storage-provider), where
10
+ **jsonl and neon are first-class equals** — the same code path serves both.
11
+
12
+ ## Ceremonial Phases
13
+
14
+ | Phase | Name | Direction bridge |
15
+ | :-- | :-- | :-- |
16
+ | `miigwechiwendam` | Sacred Space Creation | east |
17
+ | `nindokendaan` | Two-Eyed Research Gathering | south |
18
+ | `ningwaab` | Knowledge Integration | west |
19
+ | `nindoodam` | Creative Expression | west |
20
+ | `migwech` | Ceremonial Closing | north |
21
+
22
+ ## Usage
23
+
24
+ ```ts
25
+ import { createProvider } from '@medicine-wheel/storage-provider';
26
+ import {
27
+ createIntentionEntry,
28
+ createReflectionEntry,
29
+ queryDiaryEntries,
30
+ getDiaryStatistics,
31
+ exportToMarkdown,
32
+ projectEntryToWheel,
33
+ } from '@medicine-wheel/ceremonial-diary';
34
+
35
+ const store = await createProvider(); // jsonl by default; MW_STORAGE_PROVIDER=neon for Postgres
36
+
37
+ const intention = await createIntentionEntry(store, {
38
+ intention: 'Hold space for the film-production ceremony',
39
+ participant: 'mia',
40
+ chronicle: 'chronicle:2026-07-20-episode-074-medicine-wheel',
41
+ });
42
+
43
+ // A diary entry can write itself into the chronicle wheel (fail-open):
44
+ await projectEntryToWheel(store, intention, { ensureChronicleNode: true });
45
+
46
+ const entries = await queryDiaryEntries(store, { participant: 'mia' });
47
+ const stats = await getDiaryStatistics(store, 'mia');
48
+ const markdown = exportToMarkdown(entries);
49
+ ```
50
+
51
+ ## Relation to the chronicle
52
+
53
+ A diary entry optionally carries a `chronicle` reference — the medicine-wheel
54
+ node id `chronicle:<episode-folder-name>` (a `chronicle_episode` node under parent
55
+ `chronicle:miadi-chronicle`, normally registered by `@miadi/inquiry-weave`).
56
+ `projectEntryToWheel` draws the relation `participant --authored--> entry
57
+ --recorded_in--> chronicle episode`. Entries without a chronicle reference remain
58
+ fully valid — the diary can speak whether or not it writes into an episode.
59
+
60
+ ## License
61
+
62
+ MIT — IAIP Collaborative, Shawinigan, QC.
@@ -0,0 +1,55 @@
1
+ /**
2
+ * Diary entry creation.
3
+ *
4
+ * Every helper takes a StorageProvider (dependency injection) and persists the
5
+ * record through it, so the same code path serves jsonl and neon equally. The
6
+ * id preserves Miadi's epoch-millis lineage while adding a short random suffix
7
+ * so rapid successive entries never collide.
8
+ */
9
+ import type { StorageProvider } from '@medicine-wheel/storage-provider';
10
+ import type { CeremonialPhase, DiaryEntry, DiaryEntryMetadata, DiaryEntryType, DiaryEntryLocation, Participant } from './types.js';
11
+ export interface CreateDiaryEntryInput {
12
+ content: string;
13
+ participant: Participant;
14
+ phase: CeremonialPhase;
15
+ entryType: DiaryEntryType;
16
+ metadata?: DiaryEntryMetadata;
17
+ agent?: string;
18
+ /**
19
+ * Optional chronicle node id (`chronicle:<episode-folder-name>`). Entries
20
+ * without one remain fully valid.
21
+ */
22
+ chronicle?: string;
23
+ /** Override the generated id (rarely needed; upsert is by id). */
24
+ id?: string;
25
+ /** Override the timestamp (defaults to now). */
26
+ timestamp?: Date | string;
27
+ }
28
+ /** Create and persist a diary entry, returning the stored record. */
29
+ export declare function createDiaryEntry(store: StorageProvider, input: CreateDiaryEntryInput): Promise<DiaryEntry>;
30
+ /** Create an intention entry — the opening of a ceremony. */
31
+ export declare function createIntentionEntry(store: StorageProvider, input: {
32
+ intention: string;
33
+ participant: Participant;
34
+ agent?: string;
35
+ metadata?: DiaryEntryMetadata;
36
+ chronicle?: string;
37
+ }): Promise<DiaryEntry>;
38
+ /** Create a reflection entry — the closing of a ceremony. */
39
+ export declare function createReflectionEntry(store: StorageProvider, input: {
40
+ reflection: string;
41
+ participant: Participant;
42
+ agent?: string;
43
+ metadata?: DiaryEntryMetadata;
44
+ chronicle?: string;
45
+ }): Promise<DiaryEntry>;
46
+ /** Create a walking-mode entry — creative expression observed on the move. */
47
+ export declare function createWalkingEntry(store: StorageProvider, input: {
48
+ content: string;
49
+ participant: Participant;
50
+ location: DiaryEntryLocation;
51
+ agent?: string;
52
+ metadata?: DiaryEntryMetadata;
53
+ chronicle?: string;
54
+ }): Promise<DiaryEntry>;
55
+ //# sourceMappingURL=create.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../src/create.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AACxE,OAAO,KAAK,EACV,eAAe,EACf,UAAU,EACV,kBAAkB,EAClB,cAAc,EACd,kBAAkB,EAClB,WAAW,EACZ,MAAM,YAAY,CAAC;AAEpB,MAAM,WAAW,qBAAqB;IACpC,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,WAAW,CAAC;IACzB,KAAK,EAAE,eAAe,CAAC;IACvB,SAAS,EAAE,cAAc,CAAC;IAC1B,QAAQ,CAAC,EAAE,kBAAkB,CAAC;IAC9B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kEAAkE;IAClE,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,gDAAgD;IAChD,SAAS,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC;CAC3B;AAYD,qEAAqE;AACrE,wBAAsB,gBAAgB,CACpC,KAAK,EAAE,eAAe,EACtB,KAAK,EAAE,qBAAqB,GAC3B,OAAO,CAAC,UAAU,CAAC,CAerB;AAED,6DAA6D;AAC7D,wBAAsB,oBAAoB,CACxC,KAAK,EAAE,eAAe,EACtB,KAAK,EAAE;IACL,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,WAAW,CAAC;IACzB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,kBAAkB,CAAC;IAC9B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,GACA,OAAO,CAAC,UAAU,CAAC,CAUrB;AAED,6DAA6D;AAC7D,wBAAsB,qBAAqB,CACzC,KAAK,EAAE,eAAe,EACtB,KAAK,EAAE;IACL,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,WAAW,CAAC;IACzB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,kBAAkB,CAAC;IAC9B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,GACA,OAAO,CAAC,UAAU,CAAC,CAUrB;AAED,8EAA8E;AAC9E,wBAAsB,kBAAkB,CACtC,KAAK,EAAE,eAAe,EACtB,KAAK,EAAE;IACL,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,WAAW,CAAC;IACzB,QAAQ,EAAE,kBAAkB,CAAC;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,kBAAkB,CAAC;IAC9B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,GACA,OAAO,CAAC,UAAU,CAAC,CAerB"}
package/dist/create.js ADDED
@@ -0,0 +1,77 @@
1
+ /**
2
+ * Diary entry creation.
3
+ *
4
+ * Every helper takes a StorageProvider (dependency injection) and persists the
5
+ * record through it, so the same code path serves jsonl and neon equally. The
6
+ * id preserves Miadi's epoch-millis lineage while adding a short random suffix
7
+ * so rapid successive entries never collide.
8
+ */
9
+ import { randomUUID } from 'node:crypto';
10
+ function newEntryId(timestamp) {
11
+ return `diary-${timestamp.getTime()}-${randomUUID().slice(0, 8)}`;
12
+ }
13
+ function resolveTimestamp(value) {
14
+ if (value instanceof Date)
15
+ return value;
16
+ if (typeof value === 'string')
17
+ return new Date(value);
18
+ return new Date();
19
+ }
20
+ /** Create and persist a diary entry, returning the stored record. */
21
+ export async function createDiaryEntry(store, input) {
22
+ const timestamp = resolveTimestamp(input.timestamp);
23
+ const record = {
24
+ id: input.id ?? newEntryId(timestamp),
25
+ timestamp: timestamp.toISOString(),
26
+ participant: input.participant,
27
+ phase: input.phase,
28
+ entryType: input.entryType,
29
+ content: input.content,
30
+ metadata: input.metadata ?? {},
31
+ ...(input.agent !== undefined ? { agent: input.agent } : {}),
32
+ ...(input.chronicle !== undefined ? { chronicle: input.chronicle } : {}),
33
+ };
34
+ return store.registerDiaryEntry(record);
35
+ }
36
+ /** Create an intention entry — the opening of a ceremony. */
37
+ export async function createIntentionEntry(store, input) {
38
+ return createDiaryEntry(store, {
39
+ content: input.intention,
40
+ participant: input.participant,
41
+ phase: 'miigwechiwendam',
42
+ entryType: 'intention',
43
+ agent: input.agent,
44
+ chronicle: input.chronicle,
45
+ metadata: { ...input.metadata, ceremonyStage: 'opening' },
46
+ });
47
+ }
48
+ /** Create a reflection entry — the closing of a ceremony. */
49
+ export async function createReflectionEntry(store, input) {
50
+ return createDiaryEntry(store, {
51
+ content: input.reflection,
52
+ participant: input.participant,
53
+ phase: 'migwech',
54
+ entryType: 'reflection',
55
+ agent: input.agent,
56
+ chronicle: input.chronicle,
57
+ metadata: { ...input.metadata, ceremonyStage: 'closing' },
58
+ });
59
+ }
60
+ /** Create a walking-mode entry — creative expression observed on the move. */
61
+ export async function createWalkingEntry(store, input) {
62
+ return createDiaryEntry(store, {
63
+ content: input.content,
64
+ participant: input.participant,
65
+ phase: 'nindoodam',
66
+ entryType: 'observation',
67
+ agent: input.agent ?? 'ava',
68
+ chronicle: input.chronicle,
69
+ metadata: {
70
+ ...input.metadata,
71
+ location: input.location,
72
+ activity: 'walking',
73
+ context: 'mobile',
74
+ },
75
+ });
76
+ }
77
+ //# sourceMappingURL=create.js.map
@@ -0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K,CAAC,KAAK,IAAI,KAAK;QAC3B,SAAS,EAAE,KAAK,CAAC,SAAS;QAC1B,QAAQ,EAAE;YACR,GAAG,KAAK,CAAC,QAAQ;YACjB,QAAQ,EAAE,KAAK,CAAC,QAAQ;YACxB,QAAQ,EAAE,SAAS;YACnB,OAAO,EAAE,QAAQ;SAClB;KACF,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,30 @@
1
+ /**
2
+ * @medicine-wheel/ceremonial-diary
3
+ *
4
+ * The ceremonial diary — a participant's voice across the Five-Phase ceremonial
5
+ * methodology. Create intention / observation / reflection entries, retrieve and
6
+ * filter them, detect patterns, export to Markdown, and optionally project a
7
+ * relation into the chronicle wheel. Persistence flows through
8
+ * @medicine-wheel/storage-provider, so jsonl and neon are first-class equals.
9
+ *
10
+ * @example
11
+ * ```ts
12
+ * import { createProvider } from '@medicine-wheel/storage-provider';
13
+ * import { createIntentionEntry, queryDiaryEntries } from '@medicine-wheel/ceremonial-diary';
14
+ *
15
+ * const store = await createProvider(); // jsonl by default
16
+ * await createIntentionEntry(store, {
17
+ * intention: 'Hold space for the film-production ceremony',
18
+ * participant: 'mia',
19
+ * chronicle: 'chronicle:2026-07-20-episode-074-medicine-wheel',
20
+ * });
21
+ * const entries = await queryDiaryEntries(store, { participant: 'mia' });
22
+ * ```
23
+ */
24
+ export * from './types.js';
25
+ export * from './create.js';
26
+ export * from './query.js';
27
+ export * from './stats.js';
28
+ export * from './markdown.js';
29
+ export * from './relate.js';
30
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,30 @@
1
+ /**
2
+ * @medicine-wheel/ceremonial-diary
3
+ *
4
+ * The ceremonial diary — a participant's voice across the Five-Phase ceremonial
5
+ * methodology. Create intention / observation / reflection entries, retrieve and
6
+ * filter them, detect patterns, export to Markdown, and optionally project a
7
+ * relation into the chronicle wheel. Persistence flows through
8
+ * @medicine-wheel/storage-provider, so jsonl and neon are first-class equals.
9
+ *
10
+ * @example
11
+ * ```ts
12
+ * import { createProvider } from '@medicine-wheel/storage-provider';
13
+ * import { createIntentionEntry, queryDiaryEntries } from '@medicine-wheel/ceremonial-diary';
14
+ *
15
+ * const store = await createProvider(); // jsonl by default
16
+ * await createIntentionEntry(store, {
17
+ * intention: 'Hold space for the film-production ceremony',
18
+ * participant: 'mia',
19
+ * chronicle: 'chronicle:2026-07-20-episode-074-medicine-wheel',
20
+ * });
21
+ * const entries = await queryDiaryEntries(store, { participant: 'mia' });
22
+ * ```
23
+ */
24
+ export * from './types.js';
25
+ export * from './create.js';
26
+ export * from './query.js';
27
+ export * from './stats.js';
28
+ export * from './markdown.js';
29
+ export * from './relate.js';
30
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Diary export to Markdown. Pure functions over entry arrays — no storage.
3
+ */
4
+ import type { CeremonialPhase, DiaryEntry } from './types.js';
5
+ /** Convert a single entry to Markdown with YAML frontmatter. */
6
+ export declare function entryToMarkdown(entry: DiaryEntry): string;
7
+ /** Export multiple entries to a single Markdown document. */
8
+ export declare function exportToMarkdown(entries: readonly DiaryEntry[], includeHeader?: boolean): string;
9
+ /** Group entries by ceremonial phase. */
10
+ export declare function exportByPhase(entries: readonly DiaryEntry[]): Record<CeremonialPhase, DiaryEntry[]>;
11
+ /** Build a ceremonial journey summary organized by phase. */
12
+ export declare function createJourneySummary(entries: readonly DiaryEntry[]): string;
13
+ //# sourceMappingURL=markdown.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"markdown.d.ts","sourceRoot":"","sources":["../src/markdown.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAG9D,gEAAgE;AAChE,wBAAgB,eAAe,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAmDzD;AAED,6DAA6D;AAC7D,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,SAAS,UAAU,EAAE,EAAE,aAAa,UAAO,GAAG,MAAM,CAuB7F;AAED,yCAAyC;AACzC,wBAAgB,aAAa,CAC3B,OAAO,EAAE,SAAS,UAAU,EAAE,GAC7B,MAAM,CAAC,eAAe,EAAE,UAAU,EAAE,CAAC,CAcvC;AAED,6DAA6D;AAC7D,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,SAAS,UAAU,EAAE,GAAG,MAAM,CAoC3E"}
@@ -0,0 +1,119 @@
1
+ /**
2
+ * Diary export to Markdown. Pure functions over entry arrays — no storage.
3
+ */
4
+ import { PHASE_DESCRIPTIONS } from './types.js';
5
+ /** Convert a single entry to Markdown with YAML frontmatter. */
6
+ export function entryToMarkdown(entry) {
7
+ const phaseInfo = PHASE_DESCRIPTIONS[entry.phase];
8
+ const frontmatter = [
9
+ '---',
10
+ `id: "${entry.id}"`,
11
+ `timestamp: "${entry.timestamp}"`,
12
+ `participant: "${entry.participant}"`,
13
+ entry.agent ? `agent: "${entry.agent}"` : '',
14
+ `phase: "${entry.phase}"`,
15
+ `phaseName: "${phaseInfo.name}"`,
16
+ `entryType: "${entry.entryType}"`,
17
+ entry.chronicle ? `chronicle: "${entry.chronicle}"` : '',
18
+ ].filter(Boolean);
19
+ const { location, activity, weather, emotionalTone, tags, relatedKeys } = entry.metadata;
20
+ if (location) {
21
+ frontmatter.push('location:');
22
+ frontmatter.push(` lat: ${location.lat}`);
23
+ frontmatter.push(` lon: ${location.lon}`);
24
+ if (location.name)
25
+ frontmatter.push(` name: "${location.name}"`);
26
+ }
27
+ if (activity)
28
+ frontmatter.push(`activity: "${activity}"`);
29
+ if (weather)
30
+ frontmatter.push(`weather: "${weather}"`);
31
+ if (emotionalTone)
32
+ frontmatter.push(`emotionalTone: "${emotionalTone}"`);
33
+ if (tags && tags.length > 0) {
34
+ frontmatter.push('tags:');
35
+ for (const tag of tags)
36
+ frontmatter.push(` - ${tag}`);
37
+ }
38
+ if (relatedKeys && relatedKeys.length > 0) {
39
+ frontmatter.push('relatedKeys:');
40
+ for (const key of relatedKeys)
41
+ frontmatter.push(` - ${key}`);
42
+ }
43
+ frontmatter.push('---');
44
+ frontmatter.push('');
45
+ return [
46
+ ...frontmatter,
47
+ `# ${phaseInfo.name} - ${entry.entryType}`,
48
+ '',
49
+ `*${phaseInfo.description}*`,
50
+ '',
51
+ entry.content,
52
+ '',
53
+ '---',
54
+ '',
55
+ `*Participant: ${entry.participant}${entry.agent ? ` | Agent: ${entry.agent}` : ''}*`,
56
+ `*Timestamp: ${new Date(entry.timestamp).toLocaleString()}*`,
57
+ ].join('\n');
58
+ }
59
+ /** Export multiple entries to a single Markdown document. */
60
+ export function exportToMarkdown(entries, includeHeader = true) {
61
+ const parts = [];
62
+ if (includeHeader) {
63
+ parts.push('# Ceremonial Diary Entries');
64
+ parts.push('');
65
+ parts.push(`Generated: ${new Date().toISOString()}`);
66
+ parts.push(`Total Entries: ${entries.length}`);
67
+ parts.push('');
68
+ parts.push('---');
69
+ parts.push('');
70
+ }
71
+ entries.forEach((entry, index) => {
72
+ if (index > 0) {
73
+ parts.push('');
74
+ parts.push('---');
75
+ parts.push('');
76
+ }
77
+ parts.push(entryToMarkdown(entry));
78
+ });
79
+ return parts.join('\n');
80
+ }
81
+ /** Group entries by ceremonial phase. */
82
+ export function exportByPhase(entries) {
83
+ const byPhase = {
84
+ miigwechiwendam: [],
85
+ nindokendaan: [],
86
+ ningwaab: [],
87
+ nindoodam: [],
88
+ migwech: [],
89
+ };
90
+ for (const entry of entries) {
91
+ byPhase[entry.phase].push(entry);
92
+ }
93
+ return byPhase;
94
+ }
95
+ /** Build a ceremonial journey summary organized by phase. */
96
+ export function createJourneySummary(entries) {
97
+ const byPhase = exportByPhase(entries);
98
+ const parts = [];
99
+ parts.push('# Ceremonial Journey Summary');
100
+ parts.push('');
101
+ parts.push(`Journey Period: ${entries[0]?.timestamp ?? 'N/A'} to ${entries[entries.length - 1]?.timestamp ?? 'N/A'}`);
102
+ parts.push('');
103
+ for (const [phase, info] of Object.entries(PHASE_DESCRIPTIONS)) {
104
+ const phaseEntries = byPhase[phase];
105
+ parts.push(`## ${info.name}`);
106
+ parts.push(`*${info.description}*`);
107
+ parts.push('');
108
+ parts.push(`Entries: ${phaseEntries.length}`);
109
+ parts.push('');
110
+ if (phaseEntries.length > 0) {
111
+ for (const entry of phaseEntries) {
112
+ parts.push(`- **${entry.entryType}** (${new Date(entry.timestamp).toLocaleDateString()}): ${entry.content.substring(0, 100)}...`);
113
+ }
114
+ parts.push('');
115
+ }
116
+ }
117
+ return parts.join('\n');
118
+ }
119
+ //# sourceMappingURL=markdown.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"markdown.js","sourceRoot":"","sources":["../src/markdown.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAEhD,gEAAgE;AAChE,MAAM,UAAU,eAAe,CAAC,KAAiB;IAC/C,MAAM,SAAS,GAAG,kBAAkB,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAElD,MAAM,WAAW,GAAG;QAClB,KAAK;QACL,QAAQ,KAAK,CAAC,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}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Diary entry retrieval. Filtering, ordering, and limiting are performed by the
3
+ * provider (shared jsonl/neon semantics), so these helpers stay thin.
4
+ */
5
+ import type { StorageProvider } from '@medicine-wheel/storage-provider';
6
+ import type { CeremonialPhase, DiaryEntry, DiaryQuery, Participant } from './types.js';
7
+ /** Retrieve entries matching the query (oldest → newest, optional limit). */
8
+ export declare function queryDiaryEntries(store: StorageProvider, query?: DiaryQuery): Promise<DiaryEntry[]>;
9
+ /** Retrieve the most recent entry for a participant, or null. */
10
+ export declare function getLastDiaryEntry(store: StorageProvider, participant: Participant): Promise<DiaryEntry | null>;
11
+ /** Retrieve entries for a participant in a given ceremonial phase. */
12
+ export declare function getEntriesByPhase(store: StorageProvider, participant: Participant, phase: CeremonialPhase): Promise<DiaryEntry[]>;
13
+ /** Retrieve a participant's entries within an inclusive date range. */
14
+ export declare function getEntriesByDateRange(store: StorageProvider, participant: Participant, startDate: string, endDate: string): Promise<DiaryEntry[]>;
15
+ //# sourceMappingURL=query.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"query.d.ts","sourceRoot":"","sources":["../src/query.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AACxE,OAAO,KAAK,EACV,eAAe,EACf,UAAU,EACV,UAAU,EACV,WAAW,EACZ,MAAM,YAAY,CAAC;AAEpB,6EAA6E;AAC7E,wBAAsB,iBAAiB,CACrC,KAAK,EAAE,eAAe,EACtB,KAAK,GAAE,UAAe,GACrB,OAAO,CAAC,UAAU,EAAE,CAAC,CAEvB;AAED,iEAAiE;AACjE,wBAAsB,iBAAiB,CACrC,KAAK,EAAE,eAAe,EACtB,WAAW,EAAE,WAAW,GACvB,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC,CAG5B;AAED,sEAAsE;AACtE,wBAAsB,iBAAiB,CACrC,KAAK,EAAE,eAAe,EACtB,WAAW,EAAE,WAAW,EACxB,KAAK,EAAE,eAAe,GACrB,OAAO,CAAC,UAAU,EAAE,CAAC,CAEvB;AAED,uEAAuE;AACvE,wBAAsB,qBAAqB,CACzC,KAAK,EAAE,eAAe,EACtB,WAAW,EAAE,WAAW,EACxB,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,UAAU,EAAE,CAAC,CAKvB"}
package/dist/query.js ADDED
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Diary entry retrieval. Filtering, ordering, and limiting are performed by the
3
+ * provider (shared jsonl/neon semantics), so these helpers stay thin.
4
+ */
5
+ /** Retrieve entries matching the query (oldest → newest, optional limit). */
6
+ export async function queryDiaryEntries(store, query = {}) {
7
+ return store.listDiaryEntries(query);
8
+ }
9
+ /** Retrieve the most recent entry for a participant, or null. */
10
+ export async function getLastDiaryEntry(store, participant) {
11
+ const entries = await store.listDiaryEntries({ participant });
12
+ return entries.length > 0 ? entries[entries.length - 1] : null;
13
+ }
14
+ /** Retrieve entries for a participant in a given ceremonial phase. */
15
+ export async function getEntriesByPhase(store, participant, phase) {
16
+ return store.listDiaryEntries({ participant, phase });
17
+ }
18
+ /** Retrieve a participant's entries within an inclusive date range. */
19
+ export async function getEntriesByDateRange(store, participant, startDate, endDate) {
20
+ return store.listDiaryEntries({
21
+ participant,
22
+ dateRange: { start: startDate, end: endDate },
23
+ });
24
+ }
25
+ //# sourceMappingURL=query.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"query.js","sourceRoot":"","sources":["../src/query.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAUH,6EAA6E;AAC7E,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,KAAsB,EACtB,QAAoB,EAAE;IAEtB,OAAO,KAAK,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC;AACvC,CAAC;AAED,iEAAiE;AACjE,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,KAAsB,EACtB,WAAwB;IAExB,MAAM,OAAO,GAAG,MAAM,KAAK,CAAC,gBAAgB,CAAC,EAAE,WAAW,EAAE,CAAC,CAAC;IAC9D,OAAO,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AACjE,CAAC;AAED,sEAAsE;AACtE,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,KAAsB,EACtB,WAAwB,EACxB,KAAsB;IAEtB,OAAO,KAAK,CAAC,gBAAgB,CAAC,EAAE,WAAW,EAAE,KAAK,EAAE,CAAC,CAAC;AACxD,CAAC;AAED,uEAAuE;AACvE,MAAM,CAAC,KAAK,UAAU,qBAAqB,CACzC,KAAsB,EACtB,WAAwB,EACxB,SAAiB,EACjB,OAAe;IAEf,OAAO,KAAK,CAAC,gBAAgB,CAAC;QAC5B,WAAW;QACX,SAAS,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,EAAE,OAAO,EAAE;KAC9C,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Project a diary entry into the medicine-wheel relational graph.
3
+ *
4
+ * The diary is a participant's voice that can write into the chronicle. This
5
+ * helper draws the relation as nodes and edges:
6
+ *
7
+ * participant --authored--> diary entry --recorded_in--> chronicle episode
8
+ *
9
+ * It is deliberately fail-open, mirroring @miadi/inquiry-weave's register
10
+ * pattern: if the wheel is unreachable or a write fails, the entry is still
11
+ * valid and stored — projection just reports that it did not complete. The
12
+ * chronicle episode node itself is normally registered by @miadi/inquiry-weave
13
+ * (`chronicle:<episode-folder-name>` under parent `chronicle:miadi-chronicle`);
14
+ * set `ensureChronicleNode` to create a stub so the edge is not dangling.
15
+ */
16
+ import type { StorageProvider } from '@medicine-wheel/storage-provider';
17
+ import type { DiaryEntry } from './types.js';
18
+ export interface ProjectEntryOptions {
19
+ /** Create a stub chronicle node when one does not already exist. */
20
+ ensureChronicleNode?: boolean;
21
+ /** Create/refresh a node for the authoring participant (default true). */
22
+ ensureParticipantNode?: boolean;
23
+ }
24
+ export interface ProjectEntryResult {
25
+ projected: boolean;
26
+ /** Node id minted for the entry (`diary:<entry-id>`). */
27
+ nodeId: string;
28
+ /** Human-readable descriptions of edges drawn. */
29
+ edges: string[];
30
+ error?: string;
31
+ }
32
+ /** The wheel node id for a diary entry. */
33
+ export declare function diaryNodeId(entry: Pick<DiaryEntry, 'id'>): string;
34
+ /** The wheel node id for a participant. */
35
+ export declare function participantNodeId(participant: string): string;
36
+ /** The chronicle node id convention: `chronicle:<episode-folder-name>`. */
37
+ export declare function chronicleNodeId(episodeFolder: string): string;
38
+ export declare function projectEntryToWheel(store: StorageProvider, entry: DiaryEntry, options?: ProjectEntryOptions): Promise<ProjectEntryResult>;
39
+ //# sourceMappingURL=relate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"relate.d.ts","sourceRoot":"","sources":["../src/relate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AACxE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAG7C,MAAM,WAAW,mBAAmB;IAClC,oEAAoE;IACpE,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,0EAA0E;IAC1E,qBAAqB,CAAC,EAAE,OAAO,CAAC;CACjC;AAED,MAAM,WAAW,kBAAkB;IACjC,SAAS,EAAE,OAAO,CAAC;IACnB,yDAAyD;IACzD,MAAM,EAAE,MAAM,CAAC;IACf,kDAAkD;IAClD,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,2CAA2C;AAC3C,wBAAgB,WAAW,CAAC,KAAK,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,GAAG,MAAM,CAEjE;AAED,2CAA2C;AAC3C,wBAAgB,iBAAiB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAE7D;AAED,2EAA2E;AAC3E,wBAAgB,eAAe,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,CAE7D;AAED,wBAAsB,mBAAmB,CACvC,KAAK,EAAE,eAAe,EACtB,KAAK,EAAE,UAAU,EACjB,OAAO,GAAE,mBAAwB,GAChC,OAAO,CAAC,kBAAkB,CAAC,CAoF7B"}
package/dist/relate.js ADDED
@@ -0,0 +1,108 @@
1
+ /**
2
+ * Project a diary entry into the medicine-wheel relational graph.
3
+ *
4
+ * The diary is a participant's voice that can write into the chronicle. This
5
+ * helper draws the relation as nodes and edges:
6
+ *
7
+ * participant --authored--> diary entry --recorded_in--> chronicle episode
8
+ *
9
+ * It is deliberately fail-open, mirroring @miadi/inquiry-weave's register
10
+ * pattern: if the wheel is unreachable or a write fails, the entry is still
11
+ * valid and stored — projection just reports that it did not complete. The
12
+ * chronicle episode node itself is normally registered by @miadi/inquiry-weave
13
+ * (`chronicle:<episode-folder-name>` under parent `chronicle:miadi-chronicle`);
14
+ * set `ensureChronicleNode` to create a stub so the edge is not dangling.
15
+ */
16
+ import { PHASE_TO_DIRECTION } from './types.js';
17
+ /** The wheel node id for a diary entry. */
18
+ export function diaryNodeId(entry) {
19
+ return `diary:${entry.id}`;
20
+ }
21
+ /** The wheel node id for a participant. */
22
+ export function participantNodeId(participant) {
23
+ return `participant:${participant}`;
24
+ }
25
+ /** The chronicle node id convention: `chronicle:<episode-folder-name>`. */
26
+ export function chronicleNodeId(episodeFolder) {
27
+ return episodeFolder.startsWith('chronicle:') ? episodeFolder : `chronicle:${episodeFolder}`;
28
+ }
29
+ export async function projectEntryToWheel(store, entry, options = {}) {
30
+ const { ensureChronicleNode = false, ensureParticipantNode = true } = options;
31
+ const nodeId = diaryNodeId(entry);
32
+ const edges = [];
33
+ try {
34
+ const now = new Date().toISOString();
35
+ await store.createNode({
36
+ id: nodeId,
37
+ name: `Diary — ${entry.entryType} (${entry.phase})`,
38
+ type: 'knowledge',
39
+ direction: PHASE_TO_DIRECTION[entry.phase],
40
+ metadata: {
41
+ source: 'ceremonial-diary',
42
+ participant: entry.participant,
43
+ phase: entry.phase,
44
+ entryType: entry.entryType,
45
+ ...(entry.chronicle ? { chronicle: entry.chronicle } : {}),
46
+ },
47
+ created_at: entry.timestamp,
48
+ updated_at: now,
49
+ });
50
+ const authorId = participantNodeId(entry.participant);
51
+ if (ensureParticipantNode) {
52
+ await store.createNode({
53
+ id: authorId,
54
+ name: entry.participant,
55
+ type: 'human',
56
+ metadata: { source: 'ceremonial-diary' },
57
+ created_at: now,
58
+ updated_at: now,
59
+ });
60
+ }
61
+ await store.createEdge({
62
+ from_id: authorId,
63
+ to_id: nodeId,
64
+ relationship_type: 'authored',
65
+ strength: 1,
66
+ ceremony_honored: false,
67
+ obligations: [],
68
+ created_at: now,
69
+ });
70
+ edges.push(`${authorId} --authored--> ${nodeId}`);
71
+ if (entry.chronicle) {
72
+ const chronicleId = chronicleNodeId(entry.chronicle);
73
+ if (ensureChronicleNode) {
74
+ const existing = await store.getNode(chronicleId);
75
+ if (!existing) {
76
+ await store.createNode({
77
+ id: chronicleId,
78
+ name: chronicleId,
79
+ type: 'knowledge',
80
+ metadata: { source: 'ceremonial-diary', kind: 'chronicle_episode' },
81
+ created_at: now,
82
+ updated_at: now,
83
+ });
84
+ }
85
+ }
86
+ await store.createEdge({
87
+ from_id: nodeId,
88
+ to_id: chronicleId,
89
+ relationship_type: 'recorded_in',
90
+ strength: 1,
91
+ ceremony_honored: false,
92
+ obligations: [],
93
+ created_at: now,
94
+ });
95
+ edges.push(`${nodeId} --recorded_in--> ${chronicleId}`);
96
+ }
97
+ return { projected: true, nodeId, edges };
98
+ }
99
+ catch (error) {
100
+ return {
101
+ projected: false,
102
+ nodeId,
103
+ edges,
104
+ error: error instanceof Error ? error.message : String(error),
105
+ };
106
+ }
107
+ }
108
+ //# sourceMappingURL=relate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"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,IAAI,EAAE,WAAW;wBACjB,QAAQ,EAAE,EAAE,MAAM,EAAE,kBAAkB,EAAE,IAAI,EAAE,mBAAmB,EAAE;wBACnE,UAAU,EAAE,GAAG;wBACf,UAAU,EAAE,GAAG;qBAChB,CAAC,CAAC;gBACL,CAAC;YACH,CAAC;YAED,MAAM,KAAK,CAAC,UAAU,CAAC;gBACrB,OAAO,EAAE,MAAM;gBACf,KAAK,EAAE,WAAW;gBAClB,iBAAiB,EAAE,aAAa;gBAChC,QAAQ,EAAE,CAAC;gBACX,gBAAgB,EAAE,KAAK;gBACvB,WAAW,EAAE,EAAE;gBACf,UAAU,EAAE,GAAG;aAChB,CAAC,CAAC;YACH,KAAK,CAAC,IAAI,CAAC,GAAG,MAAM,qBAAqB,WAAW,EAAE,CAAC,CAAC;QAC1D,CAAC;QAED,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;IAC5C,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO;YACL,SAAS,EAAE,KAAK;YAChB,MAAM;YACN,KAAK;YACL,KAAK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;SAC9D,CAAC;IACJ,CAAC;AACH,CAAC"}
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Diary statistics and pattern detection.
3
+ *
4
+ * Pure computation over an entry array, plus store-backed convenience wrappers
5
+ * that fetch a participant's entries first.
6
+ */
7
+ import type { StorageProvider } from '@medicine-wheel/storage-provider';
8
+ import type { CeremonialPhase, DiaryEntry, DiaryEntryType, Participant } from './types.js';
9
+ export interface DiaryStatistics {
10
+ totalEntries: number;
11
+ byPhase: Record<CeremonialPhase, number>;
12
+ byEntryType: Record<DiaryEntryType, number>;
13
+ dateRange: {
14
+ earliest: string;
15
+ latest: string;
16
+ };
17
+ }
18
+ export interface DiaryPatterns {
19
+ mostActivePhase: CeremonialPhase;
20
+ mostCommonEntryType: DiaryEntryType;
21
+ preferredAgent?: string;
22
+ averageEntriesPerDay: number;
23
+ }
24
+ /** Compute statistics over a (chronologically ordered) entry array. */
25
+ export declare function computeDiaryStatistics(entries: readonly DiaryEntry[]): DiaryStatistics;
26
+ /** Detect patterns (most active phase, common type, preferred agent, cadence). */
27
+ export declare function computeDiaryPatterns(entries: readonly DiaryEntry[]): DiaryPatterns;
28
+ /** Fetch a participant's entries and compute statistics. */
29
+ export declare function getDiaryStatistics(store: StorageProvider, participant: Participant): Promise<DiaryStatistics>;
30
+ /** Fetch a participant's entries and detect patterns. */
31
+ export declare function findDiaryPatterns(store: StorageProvider, participant: Participant): Promise<DiaryPatterns>;
32
+ //# sourceMappingURL=stats.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stats.d.ts","sourceRoot":"","sources":["../src/stats.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AACxE,OAAO,KAAK,EACV,eAAe,EACf,UAAU,EACV,cAAc,EACd,WAAW,EACZ,MAAM,YAAY,CAAC;AAGpB,MAAM,WAAW,eAAe;IAC9B,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC,eAAe,EAAE,MAAM,CAAC,CAAC;IACzC,WAAW,EAAE,MAAM,CAAC,cAAc,EAAE,MAAM,CAAC,CAAC;IAC5C,SAAS,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;CACjD;AAED,MAAM,WAAW,aAAa;IAC5B,eAAe,EAAE,eAAe,CAAC;IACjC,mBAAmB,EAAE,cAAc,CAAC;IACpC,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,oBAAoB,EAAE,MAAM,CAAC;CAC9B;AAgBD,uEAAuE;AACvE,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,SAAS,UAAU,EAAE,GAAG,eAAe,CAmBtF;AAED,kFAAkF;AAClF,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,SAAS,UAAU,EAAE,GAAG,aAAa,CA4BlF;AAED,4DAA4D;AAC5D,wBAAsB,kBAAkB,CACtC,KAAK,EAAE,eAAe,EACtB,WAAW,EAAE,WAAW,GACvB,OAAO,CAAC,eAAe,CAAC,CAE1B;AAED,yDAAyD;AACzD,wBAAsB,iBAAiB,CACrC,KAAK,EAAE,eAAe,EACtB,WAAW,EAAE,WAAW,GACvB,OAAO,CAAC,aAAa,CAAC,CAExB"}
package/dist/stats.js ADDED
@@ -0,0 +1,60 @@
1
+ /**
2
+ * Diary statistics and pattern detection.
3
+ *
4
+ * Pure computation over an entry array, plus store-backed convenience wrappers
5
+ * that fetch a participant's entries first.
6
+ */
7
+ import { CEREMONIAL_PHASES, DIARY_ENTRY_TYPES } from './types.js';
8
+ function emptyPhaseCounts() {
9
+ return CEREMONIAL_PHASES.reduce((acc, phase) => ({ ...acc, [phase]: 0 }), {});
10
+ }
11
+ function emptyEntryTypeCounts() {
12
+ return DIARY_ENTRY_TYPES.reduce((acc, entryType) => ({ ...acc, [entryType]: 0 }), {});
13
+ }
14
+ /** Compute statistics over a (chronologically ordered) entry array. */
15
+ export function computeDiaryStatistics(entries) {
16
+ const byPhase = emptyPhaseCounts();
17
+ const byEntryType = emptyEntryTypeCounts();
18
+ for (const entry of entries) {
19
+ byPhase[entry.phase]++;
20
+ byEntryType[entry.entryType]++;
21
+ }
22
+ const now = new Date().toISOString();
23
+ return {
24
+ totalEntries: entries.length,
25
+ byPhase,
26
+ byEntryType,
27
+ dateRange: {
28
+ earliest: entries[0]?.timestamp ?? now,
29
+ latest: entries[entries.length - 1]?.timestamp ?? now,
30
+ },
31
+ };
32
+ }
33
+ /** Detect patterns (most active phase, common type, preferred agent, cadence). */
34
+ export function computeDiaryPatterns(entries) {
35
+ const stats = computeDiaryStatistics(entries);
36
+ const mostActivePhase = Object.entries(stats.byPhase).reduce((a, b) => (b[1] > a[1] ? b : a))[0];
37
+ const mostCommonEntryType = Object.entries(stats.byEntryType).reduce((a, b) => (b[1] > a[1] ? b : a))[0];
38
+ const agentCounts = {};
39
+ for (const entry of entries) {
40
+ if (entry.agent) {
41
+ agentCounts[entry.agent] = (agentCounts[entry.agent] ?? 0) + 1;
42
+ }
43
+ }
44
+ const preferredAgent = Object.entries(agentCounts).reduce((a, b) => (b[1] > a[1] ? b : a), ['', 0])[0] || undefined;
45
+ const daysDiff = entries.length > 0
46
+ ? (Date.parse(stats.dateRange.latest) - Date.parse(stats.dateRange.earliest)) /
47
+ (1000 * 60 * 60 * 24)
48
+ : 1;
49
+ const averageEntriesPerDay = entries.length / Math.max(daysDiff, 1);
50
+ return { mostActivePhase, mostCommonEntryType, preferredAgent, averageEntriesPerDay };
51
+ }
52
+ /** Fetch a participant's entries and compute statistics. */
53
+ export async function getDiaryStatistics(store, participant) {
54
+ return computeDiaryStatistics(await store.listDiaryEntries({ participant }));
55
+ }
56
+ /** Fetch a participant's entries and detect patterns. */
57
+ export async function findDiaryPatterns(store, participant) {
58
+ return computeDiaryPatterns(await store.listDiaryEntries({ participant }));
59
+ }
60
+ //# sourceMappingURL=stats.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stats.js","sourceRoot":"","sources":["../src/stats.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AASH,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAgBlE,SAAS,gBAAgB;IACvB,OAAO,iBAAiB,CAAC,MAAM,CAC7B,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,GAAG,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC,EAAE,CAAC,EACxC,EAAqC,CACtC,CAAC;AACJ,CAAC;AAED,SAAS,oBAAoB;IAC3B,OAAO,iBAAiB,CAAC,MAAM,CAC7B,CAAC,GAAG,EAAE,SAAS,EAAE,EAAE,CAAC,CA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AmB,EAAE,cAAc,EAAE,oBAAoB,EAAE,CAAC;AACxF,CAAC;AAED,4DAA4D;AAC5D,MAAM,CAAC,KAAK,UAAU,kBAAkB,CACtC,KAAsB,EACtB,WAAwB;IAExB,OAAO,sBAAsB,CAAC,MAAM,KAAK,CAAC,gBAAgB,CAAC,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC;AAC/E,CAAC;AAED,yDAAyD;AACzD,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,KAAsB,EACtB,WAAwB;IAExB,OAAO,oBAAoB,CAAC,MAAM,KAAK,CAAC,gBAAgB,CAAC,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC;AAC7E,CAAC"}
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Ceremonial Diary — domain types and phase vocabulary.
3
+ *
4
+ * The record shapes (DiaryEntryRecord, filters, phase/entry unions) are owned by
5
+ * @medicine-wheel/storage-provider so both jsonl and neon persist the same
6
+ * shape. This module re-exports them under diary-domain names and adds the
7
+ * phase descriptions and Four-Directions bridge that belong to the domain
8
+ * rather than the storage layer.
9
+ */
10
+ import type { DirectionName } from '@medicine-wheel/ontology-core';
11
+ import type { CeremonialPhase, DiaryEntryType, DiaryEntryLocation, DiaryEntryMetadata, DiaryEntryRecord, DiaryEntryFilters } from '@medicine-wheel/storage-provider';
12
+ export type { CeremonialPhase, DiaryEntryType, DiaryEntryLocation, DiaryEntryMetadata, DiaryEntryRecord, DiaryEntryFilters, };
13
+ /** A diary entry — the participant's voice, persisted as a record. */
14
+ export type DiaryEntry = DiaryEntryRecord;
15
+ /** Query shape for retrieving entries. */
16
+ export type DiaryQuery = DiaryEntryFilters;
17
+ /** Legacy participant alias — an author identity (free-form string). */
18
+ export type Participant = string;
19
+ export declare const PHASE_DESCRIPTIONS: Record<CeremonialPhase, {
20
+ name: string;
21
+ description: string;
22
+ }>;
23
+ export declare const CEREMONIAL_PHASES: readonly CeremonialPhase[];
24
+ export declare const DIARY_ENTRY_TYPES: readonly DiaryEntryType[];
25
+ /**
26
+ * Bridge each ceremonial phase onto the Four Directions, reusing ontology-core's
27
+ * DirectionName. Best-effort mapping by function: opening → east, gathering →
28
+ * south, integration/expression → west (the doing), closing → north.
29
+ */
30
+ export declare const PHASE_TO_DIRECTION: Record<CeremonialPhase, DirectionName>;
31
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,KAAK,EACV,eAAe,EACf,cAAc,EACd,kBAAkB,EAClB,kBAAkB,EAClB,gBAAgB,EAChB,iBAAiB,EAClB,MAAM,kCAAkC,CAAC;AAE1C,YAAY,EACV,eAAe,EACf,cAAc,EACd,kBAAkB,EAClB,kBAAkB,EAClB,gBAAgB,EAChB,iBAAiB,GAClB,CAAC;AAEF,sEAAsE;AACtE,MAAM,MAAM,UAAU,GAAG,gBAAgB,CAAC;AAE1C,0CAA0C;AAC1C,MAAM,MAAM,UAAU,GAAG,iBAAiB,CAAC;AAE3C,wEAAwE;AACxE,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC;AAEjC,eAAO,MAAM,kBAAkB,EAAE,MAAM,CACrC,eAAe,EACf;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE,CA2BtC,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,SAAS,eAAe,EAM9C,CAAC;AAEX,eAAO,MAAM,iBAAiB,EAAE,SAAS,cAAc,EAS7C,CAAC;AAEX;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,EAAE,MAAM,CAAC,eAAe,EAAE,aAAa,CAMrE,CAAC"}
package/dist/types.js ADDED
@@ -0,0 +1,61 @@
1
+ /**
2
+ * Ceremonial Diary — domain types and phase vocabulary.
3
+ *
4
+ * The record shapes (DiaryEntryRecord, filters, phase/entry unions) are owned by
5
+ * @medicine-wheel/storage-provider so both jsonl and neon persist the same
6
+ * shape. This module re-exports them under diary-domain names and adds the
7
+ * phase descriptions and Four-Directions bridge that belong to the domain
8
+ * rather than the storage layer.
9
+ */
10
+ export const PHASE_DESCRIPTIONS = {
11
+ miigwechiwendam: {
12
+ name: 'Sacred Space Creation',
13
+ description: 'Establishing intention and ceremonial container. Setting the sacred space for the work ahead.',
14
+ },
15
+ nindokendaan: {
16
+ name: 'Two-Eyed Research Gathering',
17
+ description: 'Research using Indigenous-Western balance. Gathering knowledge with both eyes.',
18
+ },
19
+ ningwaab: {
20
+ name: 'Knowledge Integration',
21
+ description: 'Synthesizing research into coherent understanding. Weaving together what has been learned.',
22
+ },
23
+ nindoodam: {
24
+ name: 'Creative Expression',
25
+ description: 'Transforming knowledge into accessible formats. Manifesting understanding into form.',
26
+ },
27
+ migwech: {
28
+ name: 'Ceremonial Closing',
29
+ description: 'Honoring work and capturing learning. Giving thanks and reflecting on the journey.',
30
+ },
31
+ };
32
+ export const CEREMONIAL_PHASES = [
33
+ 'miigwechiwendam',
34
+ 'nindokendaan',
35
+ 'ningwaab',
36
+ 'nindoodam',
37
+ 'migwech',
38
+ ];
39
+ export const DIARY_ENTRY_TYPES = [
40
+ 'intention',
41
+ 'observation',
42
+ 'hypothesis',
43
+ 'data',
44
+ 'synthesis',
45
+ 'action',
46
+ 'reflection',
47
+ 'learning',
48
+ ];
49
+ /**
50
+ * Bridge each ceremonial phase onto the Four Directions, reusing ontology-core's
51
+ * DirectionName. Best-effort mapping by function: opening → east, gathering →
52
+ * south, integration/expression → west (the doing), closing → north.
53
+ */
54
+ export const PHASE_TO_DIRECTION = {
55
+ miigwechiwendam: 'east',
56
+ nindokendaan: 'south',
57
+ ningwaab: 'west',
58
+ nindoodam: 'west',
59
+ migwech: 'north',
60
+ };
61
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AA8BH,MAAM,CAAC,MAAM,kBAAkB,GAG3B;IACF,eAAe,EAAE;QACf,IAAI,EAAE,uBAAuB;QAC7B,WAAW,EACT,+FAA+F;KAClG;IACD,YAAY,EAAE;QACZ,IAAI,EAAE,6BAA6B;QACnC,WAAW,EACT,gFAAgF;KACnF;IACD,QAAQ,EAAE;QACR,IAAI,EAAE,uBAAuB;QAC7B,WAAW,EACT,4FAA4F;KAC/F;IACD,SAAS,EAAE;QACT,IAAI,EAAE,qBAAqB;QAC3B,WAAW,EACT,sFAAsF;KACzF;IACD,OAAO,EAAE;QACP,IAAI,EAAE,oBAAoB;QAC1B,WAAW,EACT,oFAAoF;KACvF;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,iBAAiB,GAA+B;IAC3D,iBAAiB;IACjB,cAAc;IACd,UAAU;IACV,WAAW;IACX,SAAS;CACD,CAAC;AAEX,MAAM,CAAC,MAAM,iBAAiB,GAA8B;IAC1D,WAAW;IACX,aAAa;IACb,YAAY;IACZ,MAAM;IACN,WAAW;IACX,QAAQ;IACR,YAAY;IACZ,UAAU;CACF,CAAC;AAEX;;;;GAIG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAA2C;IACxE,eAAe,EAAE,MAAM;IACvB,YAAY,EAAE,OAAO;IACrB,QAAQ,EAAE,MAAM;IAChB,SAAS,EAAE,MAAM;IACjB,OAAO,EAAE,OAAO;CACjB,CAAC"}
package/package.json ADDED
@@ -0,0 +1,62 @@
1
+ {
2
+ "name": "@medicine-wheel/ceremonial-diary",
3
+ "version": "0.5.1",
4
+ "description": "Ceremonial Diary — a participant's voice across the Five-Phase ceremonial methodology. Intention, observation, and reflection entries with pattern detection, statistics, markdown export, and optional projection into the chronicle wheel. Persists through @medicine-wheel/storage-provider (jsonl and neon as first-class equals)",
5
+ "type": "module",
6
+ "main": "dist/index.js",
7
+ "types": "dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.js",
12
+ "default": "./dist/index.js"
13
+ },
14
+ "./types": {
15
+ "types": "./dist/types.d.ts",
16
+ "import": "./dist/types.js",
17
+ "default": "./dist/types.js"
18
+ },
19
+ "./markdown": {
20
+ "types": "./dist/markdown.d.ts",
21
+ "import": "./dist/markdown.js",
22
+ "default": "./dist/markdown.js"
23
+ },
24
+ "./relate": {
25
+ "types": "./dist/relate.d.ts",
26
+ "import": "./dist/relate.js",
27
+ "default": "./dist/relate.js"
28
+ }
29
+ },
30
+ "sideEffects": false,
31
+ "files": [
32
+ "dist",
33
+ "README.md"
34
+ ],
35
+ "scripts": {
36
+ "build": "tsc",
37
+ "dev": "tsc --watch",
38
+ "lint": "tsc --noEmit",
39
+ "clean": "rm -rf dist",
40
+ "prepublishOnly": "npm run clean && npm run build"
41
+ },
42
+ "keywords": [
43
+ "medicine-wheel",
44
+ "ceremonial-diary",
45
+ "ceremony",
46
+ "five-phase-methodology",
47
+ "indigenous-research",
48
+ "relational-accountability",
49
+ "narrative",
50
+ "chronicle"
51
+ ],
52
+ "author": "IAIP Collaborative - Shawinigan, QC",
53
+ "license": "MIT",
54
+ "dependencies": {
55
+ "@medicine-wheel/ontology-core": "^0.5.1",
56
+ "@medicine-wheel/storage-provider": "^0.5.1"
57
+ },
58
+ "devDependencies": {
59
+ "@types/node": "^20.10.0",
60
+ "typescript": "^5.7.0"
61
+ }
62
+ }