@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.
- package/README.md +93 -0
- package/dist/decomposer.d.ts +61 -0
- package/dist/decomposer.d.ts.map +1 -0
- package/dist/decomposer.js +593 -0
- package/dist/decomposer.js.map +1 -0
- package/dist/index.browser.d.ts +10 -0
- package/dist/index.browser.d.ts.map +1 -0
- package/dist/index.browser.js +19 -0
- package/dist/index.browser.js.map +1 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +32 -0
- package/dist/index.js.map +1 -0
- package/dist/relational_enricher.d.ts +55 -0
- package/dist/relational_enricher.d.ts.map +1 -0
- package/dist/relational_enricher.js +142 -0
- package/dist/relational_enricher.js.map +1 -0
- package/dist/storage.d.ts +16 -0
- package/dist/storage.d.ts.map +1 -0
- package/dist/storage.js +181 -0
- package/dist/storage.js.map +1 -0
- package/dist/types.d.ts +143 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +17 -0
- package/dist/types.js.map +1 -0
- package/package.json +60 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @medicine-wheel/prompt-decomposition — Browser Entry
|
|
4
|
+
*
|
|
5
|
+
* Re-exports everything EXCEPT storage (which requires Node.js built-ins).
|
|
6
|
+
* Use this entry when bundling for browser/edge environments.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.RelationalEnricher = exports.MedicineWheelDecomposer = void 0;
|
|
10
|
+
// Decomposer
|
|
11
|
+
var decomposer_js_1 = require("./decomposer.js");
|
|
12
|
+
Object.defineProperty(exports, "MedicineWheelDecomposer", { enumerable: true, get: function () { return decomposer_js_1.MedicineWheelDecomposer; } });
|
|
13
|
+
// Relational Enricher
|
|
14
|
+
var relational_enricher_js_1 = require("./relational_enricher.js");
|
|
15
|
+
Object.defineProperty(exports, "RelationalEnricher", { enumerable: true, get: function () { return relational_enricher_js_1.RelationalEnricher; } });
|
|
16
|
+
// NOTE: Storage functions (saveDecomposition, loadDecomposition, etc.)
|
|
17
|
+
// are NOT exported here — they require Node.js built-in modules.
|
|
18
|
+
// Import from '@medicine-wheel/prompt-decomposition' (main entry) for server usage.
|
|
19
|
+
//# sourceMappingURL=index.browser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.browser.js","sourceRoot":"","sources":["../src/index.browser.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAoBH,aAAa;AACb,iDAA0D;AAAjD,wHAAA,uBAAuB,OAAA;AAEhC,sBAAsB;AACtB,mEAMkC;AALhC,4HAAA,kBAAkB,OAAA;AAOpB,uEAAuE;AACvE,iEAAiE;AACjE,oFAAoF"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @medicine-wheel/prompt-decomposition
|
|
3
|
+
*
|
|
4
|
+
* Ontology-enriched Prompt Decomposition Engine for the Medicine Wheel
|
|
5
|
+
* Developer Suite. Bridges the ava-langchain-prompt-decomposition primitives
|
|
6
|
+
* with @medicine-wheel/ontology-core types.
|
|
7
|
+
*
|
|
8
|
+
* Architecture:
|
|
9
|
+
* - MedicineWheelDecomposer: heuristic decomposer grounded in Four Directions
|
|
10
|
+
* - RelationalEnricher: enriches decompositions with relational-query traversal
|
|
11
|
+
* - Storage: .pde/ persistence (JSON + Markdown)
|
|
12
|
+
* - Types: ontology-enriched PDE types (OntologicalDecomposition, RelationalIntent, etc.)
|
|
13
|
+
*
|
|
14
|
+
* Lineage: mcp-pde → ava-langchain-prompt-decomposition → @medicine-wheel/prompt-decomposition
|
|
15
|
+
*/
|
|
16
|
+
export type { Urgency, PrimaryIntent, SecondaryIntent, ExtractionContext, AmbiguityFlag, ExpectedOutputs, DirectionalInsight, OntologicalDirection, RelationalIntent, OntologicalDependency, OntologicalDecomposition, ActionItem, StoredDecomposition, DecomposerOptions, EpistemicSourceHint, } from './types.js';
|
|
17
|
+
export { MedicineWheelDecomposer, detectEpistemicSource } from './decomposer.js';
|
|
18
|
+
export { RelationalEnricher, type RelationalGraph, type EnrichmentResult, type IntentNodeMapping, type AccountabilityGap, } from './relational_enricher.js';
|
|
19
|
+
export { saveDecomposition, loadDecomposition, listDecompositions, decompositionToMarkdown, } from './storage.js';
|
|
20
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,YAAY,EACV,OAAO,EACP,aAAa,EACb,eAAe,EACf,iBAAiB,EACjB,aAAa,EACb,eAAe,EACf,kBAAkB,EAClB,oBAAoB,EACpB,gBAAgB,EAChB,qBAAqB,EACrB,wBAAwB,EACxB,UAAU,EACV,mBAAmB,EACnB,iBAAiB,EACjB,mBAAmB,GACpB,MAAM,YAAY,CAAC;AAGpB,OAAO,EAAE,uBAAuB,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAGjF,OAAO,EACL,kBAAkB,EAClB,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,GACvB,MAAM,0BAA0B,CAAC;AAGlC,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EACjB,kBAAkB,EAClB,uBAAuB,GACxB,MAAM,cAAc,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @medicine-wheel/prompt-decomposition
|
|
4
|
+
*
|
|
5
|
+
* Ontology-enriched Prompt Decomposition Engine for the Medicine Wheel
|
|
6
|
+
* Developer Suite. Bridges the ava-langchain-prompt-decomposition primitives
|
|
7
|
+
* with @medicine-wheel/ontology-core types.
|
|
8
|
+
*
|
|
9
|
+
* Architecture:
|
|
10
|
+
* - MedicineWheelDecomposer: heuristic decomposer grounded in Four Directions
|
|
11
|
+
* - RelationalEnricher: enriches decompositions with relational-query traversal
|
|
12
|
+
* - Storage: .pde/ persistence (JSON + Markdown)
|
|
13
|
+
* - Types: ontology-enriched PDE types (OntologicalDecomposition, RelationalIntent, etc.)
|
|
14
|
+
*
|
|
15
|
+
* Lineage: mcp-pde → ava-langchain-prompt-decomposition → @medicine-wheel/prompt-decomposition
|
|
16
|
+
*/
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.decompositionToMarkdown = exports.listDecompositions = exports.loadDecomposition = exports.saveDecomposition = exports.RelationalEnricher = exports.detectEpistemicSource = exports.MedicineWheelDecomposer = void 0;
|
|
19
|
+
// Decomposer
|
|
20
|
+
var decomposer_js_1 = require("./decomposer.js");
|
|
21
|
+
Object.defineProperty(exports, "MedicineWheelDecomposer", { enumerable: true, get: function () { return decomposer_js_1.MedicineWheelDecomposer; } });
|
|
22
|
+
Object.defineProperty(exports, "detectEpistemicSource", { enumerable: true, get: function () { return decomposer_js_1.detectEpistemicSource; } });
|
|
23
|
+
// Relational Enricher
|
|
24
|
+
var relational_enricher_js_1 = require("./relational_enricher.js");
|
|
25
|
+
Object.defineProperty(exports, "RelationalEnricher", { enumerable: true, get: function () { return relational_enricher_js_1.RelationalEnricher; } });
|
|
26
|
+
// Storage
|
|
27
|
+
var storage_js_1 = require("./storage.js");
|
|
28
|
+
Object.defineProperty(exports, "saveDecomposition", { enumerable: true, get: function () { return storage_js_1.saveDecomposition; } });
|
|
29
|
+
Object.defineProperty(exports, "loadDecomposition", { enumerable: true, get: function () { return storage_js_1.loadDecomposition; } });
|
|
30
|
+
Object.defineProperty(exports, "listDecompositions", { enumerable: true, get: function () { return storage_js_1.listDecompositions; } });
|
|
31
|
+
Object.defineProperty(exports, "decompositionToMarkdown", { enumerable: true, get: function () { return storage_js_1.decompositionToMarkdown; } });
|
|
32
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAqBH,aAAa;AACb,iDAAiF;AAAxE,wHAAA,uBAAuB,OAAA;AAAE,sHAAA,qBAAqB,OAAA;AAEvD,sBAAsB;AACtB,mEAMkC;AALhC,4HAAA,kBAAkB,OAAA;AAOpB,UAAU;AACV,2CAKsB;AAJpB,+GAAA,iBAAiB,OAAA;AACjB,+GAAA,iBAAiB,OAAA;AACjB,gHAAA,kBAAkB,OAAA;AAClB,qHAAA,uBAAuB,OAAA"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @medicine-wheel/prompt-decomposition — Relational Enricher
|
|
3
|
+
*
|
|
4
|
+
* Enriches decomposition results with relational-query traversal.
|
|
5
|
+
* Takes a decomposition and a relational graph, then:
|
|
6
|
+
* - Maps intents to RelationalNodes in the graph
|
|
7
|
+
* - Traverses dependency webs for each intent
|
|
8
|
+
* - Scores Wilson alignment (respect, reciprocity, responsibility)
|
|
9
|
+
* - Checks OCAP® compliance for data-related intents
|
|
10
|
+
* - Identifies accountability gaps
|
|
11
|
+
*
|
|
12
|
+
* This module bridges PDE output with the relational-query and
|
|
13
|
+
* ontology-core packages.
|
|
14
|
+
*/
|
|
15
|
+
import type { RelationalNode, RelationalEdge, Relation, DirectionName } from '@medicine-wheel/ontology-core';
|
|
16
|
+
import type { OntologicalDecomposition } from './types.js';
|
|
17
|
+
export interface RelationalGraph {
|
|
18
|
+
nodes: RelationalNode[];
|
|
19
|
+
edges: RelationalEdge[];
|
|
20
|
+
relations: Relation[];
|
|
21
|
+
}
|
|
22
|
+
export interface EnrichmentResult {
|
|
23
|
+
/** Updated decomposition with enriched Wilson alignment */
|
|
24
|
+
decomposition: OntologicalDecomposition;
|
|
25
|
+
/** Intent-to-node mappings found */
|
|
26
|
+
mappings: IntentNodeMapping[];
|
|
27
|
+
/** Accountability gaps detected */
|
|
28
|
+
accountabilityGaps: AccountabilityGap[];
|
|
29
|
+
/** Overall relational health score (0-1) */
|
|
30
|
+
relationalHealth: number;
|
|
31
|
+
}
|
|
32
|
+
export interface IntentNodeMapping {
|
|
33
|
+
intentId: string;
|
|
34
|
+
nodeId: string;
|
|
35
|
+
nodeName: string;
|
|
36
|
+
nodeType: string;
|
|
37
|
+
confidence: number;
|
|
38
|
+
}
|
|
39
|
+
export interface AccountabilityGap {
|
|
40
|
+
intentId: string;
|
|
41
|
+
direction: DirectionName;
|
|
42
|
+
gap: string;
|
|
43
|
+
suggestion: string;
|
|
44
|
+
}
|
|
45
|
+
export declare class RelationalEnricher {
|
|
46
|
+
/**
|
|
47
|
+
* Enrich a decomposition with relational context from a graph.
|
|
48
|
+
* Finds matching nodes for intents, computes Wilson alignment,
|
|
49
|
+
* and identifies accountability gaps.
|
|
50
|
+
*/
|
|
51
|
+
enrich(decomposition: OntologicalDecomposition, graph: RelationalGraph): EnrichmentResult;
|
|
52
|
+
private findMatchingNode;
|
|
53
|
+
private enrichIntentFromNode;
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=relational_enricher.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"relational_enricher.d.ts","sourceRoot":"","sources":["../src/relational_enricher.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EACV,cAAc,EACd,cAAc,EACd,QAAQ,EAER,aAAa,EACd,MAAM,+BAA+B,CAAC;AAMvC,OAAO,KAAK,EACV,wBAAwB,EAGzB,MAAM,YAAY,CAAC;AAIpB,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,cAAc,EAAE,CAAC;IACxB,KAAK,EAAE,cAAc,EAAE,CAAC;IACxB,SAAS,EAAE,QAAQ,EAAE,CAAC;CACvB;AAED,MAAM,WAAW,gBAAgB;IAC/B,2DAA2D;IAC3D,aAAa,EAAE,wBAAwB,CAAC;IACxC,oCAAoC;IACpC,QAAQ,EAAE,iBAAiB,EAAE,CAAC;IAC9B,mCAAmC;IACnC,kBAAkB,EAAE,iBAAiB,EAAE,CAAC;IACxC,4CAA4C;IAC5C,gBAAgB,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,aAAa,CAAC;IACzB,GAAG,EAAE,MAAM,CAAC;IACZ,UAAU,EAAE,MAAM,CAAC;CACpB;AAID,qBAAa,kBAAkB;IAC7B;;;;OAIG;IACH,MAAM,CACJ,aAAa,EAAE,wBAAwB,EACvC,KAAK,EAAE,eAAe,GACrB,gBAAgB;IA2EnB,OAAO,CAAC,gBAAgB;IAwCxB,OAAO,CAAC,oBAAoB;CAgC7B"}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @medicine-wheel/prompt-decomposition — Relational Enricher
|
|
4
|
+
*
|
|
5
|
+
* Enriches decomposition results with relational-query traversal.
|
|
6
|
+
* Takes a decomposition and a relational graph, then:
|
|
7
|
+
* - Maps intents to RelationalNodes in the graph
|
|
8
|
+
* - Traverses dependency webs for each intent
|
|
9
|
+
* - Scores Wilson alignment (respect, reciprocity, responsibility)
|
|
10
|
+
* - Checks OCAP® compliance for data-related intents
|
|
11
|
+
* - Identifies accountability gaps
|
|
12
|
+
*
|
|
13
|
+
* This module bridges PDE output with the relational-query and
|
|
14
|
+
* ontology-core packages.
|
|
15
|
+
*/
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.RelationalEnricher = void 0;
|
|
18
|
+
const ontology_core_1 = require("@medicine-wheel/ontology-core");
|
|
19
|
+
// ── Enricher ────────────────────────────────────────────────────────────────
|
|
20
|
+
class RelationalEnricher {
|
|
21
|
+
/**
|
|
22
|
+
* Enrich a decomposition with relational context from a graph.
|
|
23
|
+
* Finds matching nodes for intents, computes Wilson alignment,
|
|
24
|
+
* and identifies accountability gaps.
|
|
25
|
+
*/
|
|
26
|
+
enrich(decomposition, graph) {
|
|
27
|
+
const mappings = [];
|
|
28
|
+
const accountabilityGaps = [];
|
|
29
|
+
// Map intents to graph nodes
|
|
30
|
+
const enrichedIntents = decomposition.secondary.map(intent => {
|
|
31
|
+
const mapping = this.findMatchingNode(intent, graph.nodes);
|
|
32
|
+
if (mapping) {
|
|
33
|
+
mappings.push(mapping);
|
|
34
|
+
const enriched = this.enrichIntentFromNode(intent, mapping, graph);
|
|
35
|
+
return enriched;
|
|
36
|
+
}
|
|
37
|
+
return intent;
|
|
38
|
+
});
|
|
39
|
+
// Compute overall Wilson alignment
|
|
40
|
+
const wilsonScores = enrichedIntents.map(i => i.wilsonAlignment);
|
|
41
|
+
const avgWilson = wilsonScores.length > 0
|
|
42
|
+
? wilsonScores.reduce((a, b) => a + b, 0) / wilsonScores.length
|
|
43
|
+
: 0.5;
|
|
44
|
+
// Find accountability gaps via ontology-core
|
|
45
|
+
// findAccountabilityGaps returns Relation[] with low Wilson alignment
|
|
46
|
+
const gapRelations = (0, ontology_core_1.findAccountabilityGaps)(graph.relations);
|
|
47
|
+
for (const rel of gapRelations) {
|
|
48
|
+
const relatedIntent = enrichedIntents.find(i => i.target.toLowerCase().includes(rel.relationship_type.toLowerCase()));
|
|
49
|
+
const wilson = (0, ontology_core_1.computeWilsonAlignment)(rel.accountability);
|
|
50
|
+
if (relatedIntent) {
|
|
51
|
+
accountabilityGaps.push({
|
|
52
|
+
intentId: relatedIntent.id,
|
|
53
|
+
direction: relatedIntent.direction,
|
|
54
|
+
gap: `Relation "${rel.relationship_type}" (${rel.from_id} → ${rel.to_id}) has low Wilson alignment (${Math.round(wilson * 100)}%)`,
|
|
55
|
+
suggestion: `Address accountability in: respect=${rel.accountability.respect}, reciprocity=${rel.accountability.reciprocity}, responsibility=${rel.accountability.responsibility}`,
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
// For intents without node mappings, check direction-based gaps
|
|
60
|
+
for (const intent of enrichedIntents) {
|
|
61
|
+
if (!mappings.some(m => m.intentId === intent.id)) {
|
|
62
|
+
if (intent.wilsonAlignment < 0.3) {
|
|
63
|
+
accountabilityGaps.push({
|
|
64
|
+
intentId: intent.id,
|
|
65
|
+
direction: intent.direction,
|
|
66
|
+
gap: `Intent "${intent.action}" has no relational grounding in the graph`,
|
|
67
|
+
suggestion: 'Consider creating a relational node to track accountability for this action.',
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
// Relational health: combine balance + Wilson + gap ratio
|
|
73
|
+
const gapPenalty = accountabilityGaps.length > 0
|
|
74
|
+
? Math.max(0, 1 - (accountabilityGaps.length * 0.15))
|
|
75
|
+
: 1;
|
|
76
|
+
const relationalHealth = Math.min(1, (decomposition.balance + avgWilson + gapPenalty) / 3);
|
|
77
|
+
const enrichedDecomposition = {
|
|
78
|
+
...decomposition,
|
|
79
|
+
secondary: enrichedIntents,
|
|
80
|
+
wilsonAlignment: avgWilson,
|
|
81
|
+
};
|
|
82
|
+
return {
|
|
83
|
+
decomposition: enrichedDecomposition,
|
|
84
|
+
mappings,
|
|
85
|
+
accountabilityGaps,
|
|
86
|
+
relationalHealth,
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
// ── Node Matching ───────────────────────────────────────────────────────────
|
|
90
|
+
findMatchingNode(intent, nodes) {
|
|
91
|
+
const targetWords = new Set(intent.target.toLowerCase().split(/\s+/).filter(w => w.length > 3));
|
|
92
|
+
let bestNode = null;
|
|
93
|
+
let bestScore = 0;
|
|
94
|
+
for (const node of nodes) {
|
|
95
|
+
const nameWords = new Set(node.name.toLowerCase().split(/\s+/).filter(w => w.length > 3));
|
|
96
|
+
let overlap = 0;
|
|
97
|
+
for (const w of targetWords) {
|
|
98
|
+
if (nameWords.has(w))
|
|
99
|
+
overlap++;
|
|
100
|
+
}
|
|
101
|
+
const score = nameWords.size > 0 ? overlap / nameWords.size : 0;
|
|
102
|
+
if (score > bestScore && score >= 0.3) {
|
|
103
|
+
bestScore = score;
|
|
104
|
+
bestNode = node;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
if (bestNode) {
|
|
108
|
+
return {
|
|
109
|
+
intentId: intent.id,
|
|
110
|
+
nodeId: bestNode.id,
|
|
111
|
+
nodeName: bestNode.name,
|
|
112
|
+
nodeType: bestNode.type,
|
|
113
|
+
confidence: bestScore,
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
return null;
|
|
117
|
+
}
|
|
118
|
+
// ── Intent Enrichment ─────────────────────────────────────────────────────
|
|
119
|
+
enrichIntentFromNode(intent, mapping, graph) {
|
|
120
|
+
// Find relations involving this node
|
|
121
|
+
const nodeRelations = graph.relations.filter(r => r.from_id === mapping.nodeId || r.to_id === mapping.nodeId);
|
|
122
|
+
// Compute Wilson alignment from node's relations
|
|
123
|
+
let wilson = 0.5;
|
|
124
|
+
if (nodeRelations.length > 0) {
|
|
125
|
+
const alignments = nodeRelations.map(r => {
|
|
126
|
+
const w = (0, ontology_core_1.computeWilsonAlignment)(r.accountability);
|
|
127
|
+
return w;
|
|
128
|
+
});
|
|
129
|
+
wilson = alignments.reduce((a, b) => a + b, 0) / alignments.length;
|
|
130
|
+
}
|
|
131
|
+
// Gather obligations from connected relations
|
|
132
|
+
const obligations = nodeRelations.flatMap(r => r.obligations);
|
|
133
|
+
const uniqueObligations = obligations.filter((o, i, arr) => arr.findIndex(x => x.category === o.category) === i);
|
|
134
|
+
return {
|
|
135
|
+
...intent,
|
|
136
|
+
wilsonAlignment: wilson,
|
|
137
|
+
obligations: uniqueObligations.length > 0 ? uniqueObligations : intent.obligations,
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
exports.RelationalEnricher = RelationalEnricher;
|
|
142
|
+
//# sourceMappingURL=relational_enricher.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"relational_enricher.js","sourceRoot":"","sources":["../src/relational_enricher.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;GAaG;;;AASH,iEAGuC;AA0CvC,+EAA+E;AAE/E,MAAa,kBAAkB;IAC7B;;;;OAIG;IACH,MAAM,CACJ,aAAuC,EACvC,KAAsB;QAEtB,MAAM,QAAQ,GAAwB,EAAE,CAAC;QACzC,MAAM,kBAAkB,GAAwB,EAAE,CAAC;QAEnD,6BAA6B;QAC7B,MAAM,eAAe,GAAG,aAAa,CAAC,SAAS,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE;YAC3D,MAAM,OAAO,GAAG,IAAI,CAAC,gBAAgB,CAAC,MAAM,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;YAC3D,IAAI,OAAO,EAAE,CAAC;gBACZ,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;gBACvB,MAAM,QAAQ,GAAG,IAAI,CAAC,oBAAoB,CAAC,MAAM,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;gBACnE,OAAO,QAAQ,CAAC;YAClB,CAAC;YACD,OAAO,MAAM,CAAC;QAChB,CAAC,CAAC,CAAC;QAEH,mCAAmC;QACnC,MAAM,YAAY,GAAG,eAAe,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC;QACjE,MAAM,SAAS,GAAG,YAAY,CAAC,MAAM,GAAG,CAAC;YACvC,CAAC,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC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AAE,CAAC;YAC7B,MAAM,UAAU,GAAG,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE;gBACvC,MAAM,CAAC,GAAG,IAAA,sCAAsB,EAAC,CAAC,CAAC,cAAc,CAAC,CAAC;gBACnD,OAAO,CAAC,CAAC;YACX,CAAC,CAAC,CAAC;YACH,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,GAAG,UAAU,CAAC,MAAM,CAAC;QACrE,CAAC;QAED,8CAA8C;QAC9C,MAAM,WAAW,GAAG,aAAa,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC;QAC9D,MAAM,iBAAiB,GAAG,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,GAAG,EAAE,EAAE,CACzD,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,KAAK,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CACpD,CAAC;QAEF,OAAO;YACL,GAAG,MAAM;YACT,eAAe,EAAE,MAAM;YACvB,WAAW,EAAE,iBAAiB,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,MAAM,CAAC,WAAW;SACnF,CAAC;IACJ,CAAC;CACF;AA5JD,gDA4JC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @medicine-wheel/prompt-decomposition — Storage
|
|
3
|
+
*
|
|
4
|
+
* Persists ontological decompositions to .pde/ folder.
|
|
5
|
+
* Lineage: mcp-pde/src/storage.ts → ava-langchain storage.ts → this.
|
|
6
|
+
*
|
|
7
|
+
* Files:
|
|
8
|
+
* .pde/{id}.json — machine-readable full result
|
|
9
|
+
* .pde/{id}.md — git-diffable Markdown summary
|
|
10
|
+
*/
|
|
11
|
+
import type { OntologicalDecomposition, StoredDecomposition } from './types.js';
|
|
12
|
+
export declare function saveDecomposition(workdir: string, result: OntologicalDecomposition): StoredDecomposition;
|
|
13
|
+
export declare function loadDecomposition(workdir: string, id: string): StoredDecomposition | null;
|
|
14
|
+
export declare function listDecompositions(workdir: string): StoredDecomposition[];
|
|
15
|
+
export declare function decompositionToMarkdown(result: OntologicalDecomposition): string;
|
|
16
|
+
//# sourceMappingURL=storage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../src/storage.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAOH,OAAO,KAAK,EAAE,wBAAwB,EAAE,mBAAmB,EAAc,MAAM,YAAY,CAAC;AAI5F,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,wBAAwB,GAC/B,mBAAmB,CAsBrB;AAID,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,MAAM,EACf,EAAE,EAAE,MAAM,GACT,mBAAmB,GAAG,IAAI,CAI5B;AAID,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,mBAAmB,EAAE,CAOzE;AAID,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,wBAAwB,GAAG,MAAM,CAkIhF"}
|
package/dist/storage.js
ADDED
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @medicine-wheel/prompt-decomposition — Storage
|
|
4
|
+
*
|
|
5
|
+
* Persists ontological decompositions to .pde/ folder.
|
|
6
|
+
* Lineage: mcp-pde/src/storage.ts → ava-langchain storage.ts → this.
|
|
7
|
+
*
|
|
8
|
+
* Files:
|
|
9
|
+
* .pde/{id}.json — machine-readable full result
|
|
10
|
+
* .pde/{id}.md — git-diffable Markdown summary
|
|
11
|
+
*/
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.saveDecomposition = saveDecomposition;
|
|
14
|
+
exports.loadDecomposition = loadDecomposition;
|
|
15
|
+
exports.listDecompositions = listDecompositions;
|
|
16
|
+
exports.decompositionToMarkdown = decompositionToMarkdown;
|
|
17
|
+
const node_fs_1 = require("node:fs");
|
|
18
|
+
const node_path_1 = require("node:path");
|
|
19
|
+
// ── Save ────────────────────────────────────────────────────────────────────
|
|
20
|
+
function saveDecomposition(workdir, result) {
|
|
21
|
+
const pdeDir = (0, node_path_1.join)(workdir, '.pde');
|
|
22
|
+
if (!(0, node_fs_1.existsSync)(pdeDir))
|
|
23
|
+
(0, node_fs_1.mkdirSync)(pdeDir, { recursive: true });
|
|
24
|
+
const stored = {
|
|
25
|
+
id: result.id,
|
|
26
|
+
timestamp: result.timestamp,
|
|
27
|
+
prompt: result.prompt,
|
|
28
|
+
result,
|
|
29
|
+
};
|
|
30
|
+
// JSON
|
|
31
|
+
const jsonPath = (0, node_path_1.join)(pdeDir, `${result.id}.json`);
|
|
32
|
+
(0, node_fs_1.writeFileSync)(jsonPath, JSON.stringify(stored, null, 2), 'utf-8');
|
|
33
|
+
// Markdown
|
|
34
|
+
const mdPath = (0, node_path_1.join)(pdeDir, `${result.id}.md`);
|
|
35
|
+
const md = decompositionToMarkdown(result);
|
|
36
|
+
(0, node_fs_1.writeFileSync)(mdPath, md, 'utf-8');
|
|
37
|
+
stored.markdownPath = mdPath;
|
|
38
|
+
return stored;
|
|
39
|
+
}
|
|
40
|
+
// ── Load ────────────────────────────────────────────────────────────────────
|
|
41
|
+
function loadDecomposition(workdir, id) {
|
|
42
|
+
const jsonPath = (0, node_path_1.join)(workdir, '.pde', `${id}.json`);
|
|
43
|
+
if (!(0, node_fs_1.existsSync)(jsonPath))
|
|
44
|
+
return null;
|
|
45
|
+
return JSON.parse((0, node_fs_1.readFileSync)(jsonPath, 'utf-8'));
|
|
46
|
+
}
|
|
47
|
+
// ── List ────────────────────────────────────────────────────────────────────
|
|
48
|
+
function listDecompositions(workdir) {
|
|
49
|
+
const pdeDir = (0, node_path_1.join)(workdir, '.pde');
|
|
50
|
+
if (!(0, node_fs_1.existsSync)(pdeDir))
|
|
51
|
+
return [];
|
|
52
|
+
return (0, node_fs_1.readdirSync)(pdeDir)
|
|
53
|
+
.filter(f => f.endsWith('.json'))
|
|
54
|
+
.map(f => JSON.parse((0, node_fs_1.readFileSync)((0, node_path_1.join)(pdeDir, f), 'utf-8')))
|
|
55
|
+
.sort((a, b) => b.timestamp.localeCompare(a.timestamp));
|
|
56
|
+
}
|
|
57
|
+
// ── Markdown ────────────────────────────────────────────────────────────────
|
|
58
|
+
function decompositionToMarkdown(result) {
|
|
59
|
+
const lines = [];
|
|
60
|
+
const { primary, secondary, directions, actionStack, ambiguities, outputs } = result;
|
|
61
|
+
lines.push(`# Prompt Decomposition — ${result.id}`);
|
|
62
|
+
lines.push(`> ${result.timestamp}`);
|
|
63
|
+
lines.push('');
|
|
64
|
+
lines.push(`## Prompt`);
|
|
65
|
+
lines.push(`\`\`\`\n${result.prompt.substring(0, 500)}\n\`\`\``);
|
|
66
|
+
lines.push('');
|
|
67
|
+
// ── Canonical sections (Four Directions first) ───────────────────────────
|
|
68
|
+
const dirMeta = {
|
|
69
|
+
east: { emoji: '🌅', label: 'Vision' },
|
|
70
|
+
south: { emoji: '🔥', label: 'Analysis' },
|
|
71
|
+
west: { emoji: '🌊', label: 'Validation' },
|
|
72
|
+
north: { emoji: '❄️', label: 'Action' },
|
|
73
|
+
};
|
|
74
|
+
lines.push(`## Four Directions`);
|
|
75
|
+
lines.push('');
|
|
76
|
+
const allDirs = ['east', 'south', 'west', 'north'];
|
|
77
|
+
for (const dir of allDirs) {
|
|
78
|
+
const d = directions[dir];
|
|
79
|
+
const m = dirMeta[dir];
|
|
80
|
+
lines.push(`### ${m.emoji} ${dir.toUpperCase()} — ${m.label}`);
|
|
81
|
+
lines.push(`> Ojibwe: ${d.ojibwe} | Season: ${d.season} | Act: ${d.act}${d.ceremonyRecommended ? ' | 🔥 Ceremony recommended' : ''}`);
|
|
82
|
+
if (d.insights.length > 0) {
|
|
83
|
+
for (const insight of d.insights) {
|
|
84
|
+
const tag = insight.implicit ? ' _(implicit)_' : '';
|
|
85
|
+
lines.push(`- ${insight.text} [${Math.round(insight.confidence * 100)}%]${tag}`);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
else {
|
|
89
|
+
lines.push('- _(no insights)_');
|
|
90
|
+
}
|
|
91
|
+
lines.push('');
|
|
92
|
+
}
|
|
93
|
+
// Primary Intent
|
|
94
|
+
lines.push(`## Primary Intent`);
|
|
95
|
+
lines.push(`- **Action:** ${primary.action}`);
|
|
96
|
+
lines.push(`- **Target:** ${primary.target}`);
|
|
97
|
+
lines.push(`- **Urgency:** ${primary.urgency}`);
|
|
98
|
+
lines.push(`- **Confidence:** ${Math.round(primary.confidence * 100)}%`);
|
|
99
|
+
lines.push('');
|
|
100
|
+
// Secondary Intents
|
|
101
|
+
if (secondary.length > 0) {
|
|
102
|
+
lines.push(`## Secondary Intents`);
|
|
103
|
+
for (const s of secondary) {
|
|
104
|
+
const tag = s.implicit ? ' _(implicit)_' : '';
|
|
105
|
+
const dep = s.dependency ? ` (after: ${s.dependency})` : '';
|
|
106
|
+
lines.push(`- ${s.action} → ${s.target} [${Math.round(s.confidence * 100)}%]${tag}${dep}`);
|
|
107
|
+
}
|
|
108
|
+
lines.push('');
|
|
109
|
+
}
|
|
110
|
+
// Context Requirements
|
|
111
|
+
const { context } = result;
|
|
112
|
+
if (context.filesNeeded.length > 0 || context.toolsRequired.length > 0 || context.assumptions.length > 0) {
|
|
113
|
+
lines.push(`## Context Requirements`);
|
|
114
|
+
if (context.filesNeeded.length > 0)
|
|
115
|
+
lines.push(`- **Files needed:** ${context.filesNeeded.join(', ')}`);
|
|
116
|
+
if (context.toolsRequired.length > 0)
|
|
117
|
+
lines.push(`- **Tools required:** ${context.toolsRequired.join(', ')}`);
|
|
118
|
+
if (context.assumptions.length > 0)
|
|
119
|
+
lines.push(`- **Assumptions:** ${context.assumptions.join('; ')}`);
|
|
120
|
+
lines.push('');
|
|
121
|
+
}
|
|
122
|
+
// Expected Outputs
|
|
123
|
+
if (outputs.artifacts.length > 0 || outputs.updates.length > 0 || outputs.communications.length > 0) {
|
|
124
|
+
lines.push(`## Expected Outputs`);
|
|
125
|
+
if (outputs.artifacts.length > 0)
|
|
126
|
+
lines.push(`- **Artifacts:** ${outputs.artifacts.join(', ')}`);
|
|
127
|
+
if (outputs.updates.length > 0)
|
|
128
|
+
lines.push(`- **Updates:** ${outputs.updates.join(', ')}`);
|
|
129
|
+
if (outputs.communications.length > 0)
|
|
130
|
+
lines.push(`- **Communications:** ${outputs.communications.join(', ')}`);
|
|
131
|
+
lines.push('');
|
|
132
|
+
}
|
|
133
|
+
// Action Stack
|
|
134
|
+
if (actionStack.length > 0) {
|
|
135
|
+
lines.push(`## Action Stack`);
|
|
136
|
+
for (const item of actionStack) {
|
|
137
|
+
const marker = item.implicit ? '◊' : '●';
|
|
138
|
+
const dep = item.dependency ? ` (after: ${item.dependency})` : '';
|
|
139
|
+
lines.push(`- ${marker} [${item.direction}] ${item.text}${dep} — ${Math.round(item.confidence * 100)}%`);
|
|
140
|
+
}
|
|
141
|
+
lines.push('');
|
|
142
|
+
}
|
|
143
|
+
// Ambiguity Flags
|
|
144
|
+
if (ambiguities.length > 0) {
|
|
145
|
+
lines.push(`## Ambiguity Flags`);
|
|
146
|
+
for (const amb of ambiguities) {
|
|
147
|
+
lines.push(`- ⚠ ${amb.text}`);
|
|
148
|
+
lines.push(` → ${amb.suggestion}`);
|
|
149
|
+
}
|
|
150
|
+
lines.push('');
|
|
151
|
+
}
|
|
152
|
+
// ── Medicine-Wheel–specific sections ────────────────────────────────────
|
|
153
|
+
// Balance
|
|
154
|
+
lines.push(`## Balance`);
|
|
155
|
+
lines.push(`- **Score:** ${Math.round(result.balance * 100)}%`);
|
|
156
|
+
lines.push(`- **Lead Direction:** ${result.leadDirection}`);
|
|
157
|
+
if (result.neglectedDirections.length > 0) {
|
|
158
|
+
lines.push(`- **Neglected:** ${result.neglectedDirections.join(', ')}`);
|
|
159
|
+
}
|
|
160
|
+
lines.push(`- **Wilson Alignment:** ${Math.round(result.wilsonAlignment * 100)}%`);
|
|
161
|
+
lines.push(`- **Ceremony Required:** ${result.ceremonyRequired ? 'Yes' : 'No'}`);
|
|
162
|
+
lines.push('');
|
|
163
|
+
// Ceremony Guidance
|
|
164
|
+
if (result.ceremonyGuidance) {
|
|
165
|
+
lines.push(`## Ceremony Guidance`);
|
|
166
|
+
lines.push(`- **Opening:** ${result.ceremonyGuidance.opening_practice}`);
|
|
167
|
+
lines.push(`- **Intention:** ${result.ceremonyGuidance.intention}`);
|
|
168
|
+
lines.push(`- **Protocol:** ${result.ceremonyGuidance.protocol}`);
|
|
169
|
+
lines.push('');
|
|
170
|
+
}
|
|
171
|
+
// Narrative Beats
|
|
172
|
+
if (result.narrativeBeats.length > 0) {
|
|
173
|
+
lines.push(`## Narrative Beats`);
|
|
174
|
+
for (const beat of result.narrativeBeats) {
|
|
175
|
+
lines.push(`- Act ${beat.act} [${beat.direction}]: ${beat.title}`);
|
|
176
|
+
}
|
|
177
|
+
lines.push('');
|
|
178
|
+
}
|
|
179
|
+
return lines.join('\n');
|
|
180
|
+
}
|
|
181
|
+
//# sourceMappingURL=storage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storage.js","sourceRoot":"","sources":["../src/storage.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;AAWH,8CAyBC;AAID,8CAOC;AAID,gDAOC;AAID,0DAkIC;AA9LD,qCAA0F;AAC1F,yCAAiC;AAMjC,+EAA+E;AAE/E,SAAgB,iBAAiB,CAC/B,OAAe,EACf,MAAgC;IAEhC,MAAM,MAAM,GAAG,IAAA,gBAAI,EAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IACrC,IAAI,CAAC,IAAA,oBAAU,EAAC,MAAM,CAAC;QAAE,IAAA,mBAAS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