@medicine-wheel/prompt-decomposition 0.2.2

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,143 @@
1
+ /**
2
+ * @medicine-wheel/prompt-decomposition — Types
3
+ *
4
+ * Ontology-enriched PDE types that bridge the ava-langchain
5
+ * Prompt Decomposition Engine with the Medicine Wheel ontology.
6
+ *
7
+ * Design:
8
+ * - Uses ontology-core DirectionName as the canonical direction type
9
+ * - Enriches PDE results with relational context (obligations, ceremony, OCAP)
10
+ * - Adds ontological metadata (Ojibwe names, seasons, acts) to decompositions
11
+ * - Supports relational-query traversal of dependency graphs
12
+ *
13
+ * Lineage: mcp-pde → ava-langchain-prompt-decomposition → @medicine-wheel/prompt-decomposition
14
+ */
15
+ import type { DirectionName, RelationalObligation, CeremonyGuidance, NarrativeBeat } from '@medicine-wheel/ontology-core';
16
+ /** Epistemic source hint following Wilson's four ways of knowing */
17
+ export type EpistemicSourceHint = 'land' | 'dream' | 'code' | 'vision' | 'unknown';
18
+ export type Urgency = 'immediate' | 'session' | 'sprint' | 'ongoing';
19
+ export interface PrimaryIntent {
20
+ action: string;
21
+ target: string;
22
+ urgency: Urgency;
23
+ confidence: number;
24
+ }
25
+ export interface SecondaryIntent {
26
+ id: string;
27
+ action: string;
28
+ target: string;
29
+ implicit: boolean;
30
+ dependency: string | null;
31
+ confidence: number;
32
+ }
33
+ export interface ExtractionContext {
34
+ filesNeeded: string[];
35
+ toolsRequired: string[];
36
+ assumptions: string[];
37
+ }
38
+ export interface AmbiguityFlag {
39
+ text: string;
40
+ suggestion: string;
41
+ }
42
+ export interface ExpectedOutputs {
43
+ artifacts: string[];
44
+ updates: string[];
45
+ communications: string[];
46
+ }
47
+ export interface DirectionalInsight {
48
+ text: string;
49
+ confidence: number;
50
+ implicit: boolean;
51
+ }
52
+ /** Direction enriched with ontology-core metadata */
53
+ export interface OntologicalDirection {
54
+ name: DirectionName;
55
+ ojibwe: string;
56
+ season: string;
57
+ act: number;
58
+ insights: DirectionalInsight[];
59
+ /** Relational obligations surfaced from this direction's analysis */
60
+ obligations: RelationalObligation[];
61
+ /** Whether ceremony is recommended for this direction */
62
+ ceremonyRecommended: boolean;
63
+ }
64
+ /** Intent enriched with relational accountability context */
65
+ export interface RelationalIntent extends SecondaryIntent {
66
+ direction: DirectionName;
67
+ /** What relational obligations this intent carries */
68
+ obligations: RelationalObligation[];
69
+ /** Wilson alignment score for this intent (respect, reciprocity, responsibility) */
70
+ wilsonAlignment: number;
71
+ }
72
+ /** Dependency with ontological relationship typing */
73
+ export interface OntologicalDependency {
74
+ fromId: string;
75
+ toId: string;
76
+ type: 'depends_on' | 'validates' | 'informs' | 'ceremonies';
77
+ direction: DirectionName;
78
+ confidence: number;
79
+ }
80
+ export interface OntologicalDecomposition {
81
+ id: string;
82
+ timestamp: string;
83
+ prompt: string;
84
+ /** Primary intent */
85
+ primary: PrimaryIntent;
86
+ /** Secondary intents enriched with direction + relational context */
87
+ secondary: RelationalIntent[];
88
+ /** Context requirements */
89
+ context: ExtractionContext;
90
+ /** Expected outputs */
91
+ outputs: ExpectedOutputs;
92
+ /** Four Directions analysis enriched with ontology-core metadata */
93
+ directions: Record<DirectionName, OntologicalDirection>;
94
+ /** Action stack ordered by direction flow (east → south → west → north) */
95
+ actionStack: ActionItem[];
96
+ /** Structured ambiguity flags */
97
+ ambiguities: AmbiguityFlag[];
98
+ /** Relational balance (0-1, how evenly distributed across directions) */
99
+ balance: number;
100
+ /** Dominant direction */
101
+ leadDirection: DirectionName;
102
+ /** Directions that need more attention */
103
+ neglectedDirections: DirectionName[];
104
+ /** Ceremony guidance for the decomposition */
105
+ ceremonyGuidance: CeremonyGuidance | null;
106
+ /** Whether ceremony is required before proceeding */
107
+ ceremonyRequired: boolean;
108
+ /** Aggregate Wilson alignment across all intents */
109
+ wilsonAlignment: number;
110
+ /** Narrative beats generated from the action stack */
111
+ narrativeBeats: NarrativeBeat[];
112
+ }
113
+ export interface ActionItem {
114
+ id: string;
115
+ text: string;
116
+ direction: DirectionName;
117
+ dependency: string | null;
118
+ completed: boolean;
119
+ confidence: number;
120
+ implicit: boolean;
121
+ /** Epistemic source classification for this action */
122
+ epistemicSource?: EpistemicSourceHint;
123
+ /** Epistemic weight reflecting significance (0–1) */
124
+ epistemicWeight?: number;
125
+ }
126
+ export interface StoredDecomposition {
127
+ id: string;
128
+ timestamp: string;
129
+ prompt: string;
130
+ result: OntologicalDecomposition;
131
+ markdownPath?: string;
132
+ }
133
+ export interface DecomposerOptions {
134
+ /** Extract implicit intents from hedging language (default true) */
135
+ extractImplicit?: boolean;
136
+ /** Map dependencies between tasks (default true) */
137
+ mapDependencies?: boolean;
138
+ /** Ceremony threshold — below this, ceremony is required (default 0.3) */
139
+ ceremonyThreshold?: number;
140
+ /** Working directory for .pde/ storage (optional) */
141
+ workdir?: string;
142
+ }
143
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EACV,aAAa,EACb,oBAAoB,EACpB,gBAAgB,EAChB,aAAa,EAEd,MAAM,+BAA+B,CAAC;AAIvC,oEAAoE;AACpE,MAAM,MAAM,mBAAmB,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,GAAG,QAAQ,GAAG,SAAS,CAAC;AAInF,MAAM,MAAM,OAAO,GAAG,WAAW,GAAG,SAAS,GAAG,QAAQ,GAAG,SAAS,CAAC;AAErE,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,OAAO,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAA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mB,CAAC;IACtC,qDAAqD;IACrD,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAID,MAAM,WAAW,mBAAmB;IAClC,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,wBAAwB,CAAC;IACjC,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAID,MAAM,WAAW,iBAAiB;IAChC,oEAAoE;IACpE,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,oDAAoD;IACpD,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,0EAA0E;IAC1E,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,qDAAqD;IACrD,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB"}
package/dist/types.js ADDED
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ /**
3
+ * @medicine-wheel/prompt-decomposition — Types
4
+ *
5
+ * Ontology-enriched PDE types that bridge the ava-langchain
6
+ * Prompt Decomposition Engine with the Medicine Wheel ontology.
7
+ *
8
+ * Design:
9
+ * - Uses ontology-core DirectionName as the canonical direction type
10
+ * - Enriches PDE results with relational context (obligations, ceremony, OCAP)
11
+ * - Adds ontological metadata (Ojibwe names, seasons, acts) to decompositions
12
+ * - Supports relational-query traversal of dependency graphs
13
+ *
14
+ * Lineage: mcp-pde → ava-langchain-prompt-decomposition → @medicine-wheel/prompt-decomposition
15
+ */
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;GAaG"}
package/package.json ADDED
@@ -0,0 +1,60 @@
1
+ {
2
+ "name": "@medicine-wheel/prompt-decomposition",
3
+ "version": "0.2.2",
4
+ "description": "Prompt Decomposition Engine for the Medicine Wheel Developer Suite — ontology-enriched intent extraction, relational dependency mapping, and ceremony-aware action stacking",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "sideEffects": false,
8
+ "exports": {
9
+ ".": {
10
+ "browser": "./dist/index.browser.js",
11
+ "import": "./dist/index.js",
12
+ "types": "./dist/index.d.ts",
13
+ "require": "./dist/index.js",
14
+ "default": "./dist/index.js"
15
+ },
16
+ "./browser": {
17
+ "import": "./dist/index.browser.js",
18
+ "types": "./dist/index.browser.d.ts",
19
+ "require": "./dist/index.browser.js",
20
+ "default": "./dist/index.browser.js"
21
+ },
22
+ "./types": {
23
+ "import": "./dist/types.js",
24
+ "types": "./dist/types.d.ts",
25
+ "require": "./dist/types.js",
26
+ "default": "./dist/types.js"
27
+ }
28
+ },
29
+ "files": [
30
+ "dist",
31
+ "README.md"
32
+ ],
33
+ "scripts": {
34
+ "build": "tsc",
35
+ "dev": "tsc --watch",
36
+ "lint": "tsc --noEmit",
37
+ "clean": "rm -rf dist",
38
+ "prepublishOnly": "npm run clean && npm run build"
39
+ },
40
+ "keywords": [
41
+ "medicine-wheel",
42
+ "prompt-decomposition",
43
+ "pde",
44
+ "intent-extraction",
45
+ "four-directions",
46
+ "ontology",
47
+ "relational",
48
+ "ceremony",
49
+ "indigenous-research"
50
+ ],
51
+ "author": "IAIP Collaborative - Shawinigan, QC",
52
+ "license": "MIT",
53
+ "dependencies": {
54
+ "@medicine-wheel/ontology-core": "^0.2.2"
55
+ },
56
+ "devDependencies": {
57
+ "@types/node": "^20.10.0",
58
+ "typescript": "^5.3.0"
59
+ }
60
+ }