@medicine-wheel/fire-keeper 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,111 @@
1
+ "use strict";
2
+ /**
3
+ * @medicine-wheel/fire-keeper — Human-in-the-Loop Decisions
4
+ *
5
+ * Determines when human involvement is required, manages permission
6
+ * escalation, and triggers circle review processes. The Fire Keeper
7
+ * decides autonomously except at defined decision points.
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.humanNeeded = humanNeeded;
11
+ exports.permissionEscalation = permissionEscalation;
12
+ exports.circleReview = circleReview;
13
+ // ── Permission Tier Ordering ────────────────────────────────────────────────
14
+ const TIER_ORDER = ['observe', 'analyze', 'propose', 'act'];
15
+ /** Tiers that require human approval */
16
+ const HUMAN_REQUIRED_TIERS = ['act'];
17
+ /**
18
+ * Determine if a human decision is required given the current context.
19
+ * Checks trajectory confidence, value divergence, and decision point triggers.
20
+ * @param context - Current Fire Keeper context
21
+ * @param decisionPoints - Configured decision points to check
22
+ * @param trajectoryThreshold - Minimum acceptable trajectory confidence (default: 0.65)
23
+ */
24
+ function humanNeeded(context, decisionPoints, trajectoryThreshold = 0.65) {
25
+ // Check trajectory confidence
26
+ const history = context.ceremonyState.trajectoryHistory;
27
+ if (history.length > 0) {
28
+ const latest = history[history.length - 1];
29
+ if (latest.confidence < trajectoryThreshold) {
30
+ return {
31
+ needed: true,
32
+ decisionType: 'value-conflict',
33
+ reason: `Trajectory confidence (${latest.confidence}) below threshold (${trajectoryThreshold})`,
34
+ };
35
+ }
36
+ }
37
+ // Check configured decision points
38
+ for (const dp of decisionPoints) {
39
+ if (dp.requiresHuman && dp.trigger(context)) {
40
+ return {
41
+ needed: true,
42
+ decisionType: dp.type,
43
+ reason: `Decision point triggered: ${dp.type}`,
44
+ };
45
+ }
46
+ }
47
+ return { needed: false, decisionType: null, reason: null };
48
+ }
49
+ /**
50
+ * Evaluate a permission escalation request.
51
+ * The 'act' tier always requires human approval.
52
+ * @param currentTier - Agent's current permission tier
53
+ * @param requestedAction - The action the agent wants to perform
54
+ */
55
+ function permissionEscalation(currentTier, requestedAction) {
56
+ const currentIdx = TIER_ORDER.indexOf(currentTier);
57
+ const requestedIdx = TIER_ORDER.indexOf(requestedAction);
58
+ if (requestedIdx <= currentIdx) {
59
+ return {
60
+ allowed: true,
61
+ humanRequired: false,
62
+ fromTier: currentTier,
63
+ toTier: requestedAction,
64
+ reason: 'Requested action is within current permission tier',
65
+ };
66
+ }
67
+ const humanRequired = HUMAN_REQUIRED_TIERS.includes(requestedAction);
68
+ return {
69
+ allowed: !humanRequired,
70
+ humanRequired,
71
+ fromTier: currentTier,
72
+ toTier: requestedAction,
73
+ reason: humanRequired
74
+ ? `Escalation to '${requestedAction}' tier requires human approval`
75
+ : `Escalation from '${currentTier}' to '${requestedAction}' permitted`,
76
+ };
77
+ }
78
+ /**
79
+ * Trigger a circle review process when an ImportanceUnit reaches
80
+ * circle completion (all four quadrants visited). Human must confirm
81
+ * before the unit can be archived or pruned.
82
+ * @param context - Current Fire Keeper context
83
+ */
84
+ function circleReview(context) {
85
+ const milestones = context.ceremonyState.relationalMilestones;
86
+ const completeMilestones = milestones.filter((m) => m.quadrantsTouched.length >= m.quadrantsRequired.length &&
87
+ !m.complete);
88
+ if (completeMilestones.length === 0) {
89
+ return { reviewNeeded: false, message: null };
90
+ }
91
+ const milestone = completeMilestones[0];
92
+ const requestId = `review-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
93
+ return {
94
+ reviewNeeded: true,
95
+ message: {
96
+ type: 'human.needed',
97
+ payload: {
98
+ requestId,
99
+ reason: `Relational circle complete: "${milestone.milestone}" — all quadrants visited`,
100
+ decisionType: 'circle-completion-review',
101
+ context: {
102
+ unitId: context.unitId,
103
+ summary: `Milestone "${milestone.milestone}" has touched all required quadrants: ${milestone.quadrantsTouched.join(', ')}. Human confirmation needed before archival.`,
104
+ options: ['approve-archive', 'request-deepening', 'continue-tending'],
105
+ },
106
+ suggestedModality: 'protocol',
107
+ },
108
+ },
109
+ };
110
+ }
111
+ //# sourceMappingURL=decisions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"decisions.js","sourceRoot":"","sources":["../src/decisions.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;AAoCH,kCA8BC;AAwBD,oDA4BC;AAkBD,oCAgCC;AA9JD,+EAA+E;AAE/E,MAAM,UAAU,GAAqB,CAAC,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC;AAE9E,wCAAwC;AACxC,MAAM,oBAAoB,GAAqB,CAAC,KAAK,CAAC,CAAC;AAcvD;;;;;;GAMG;AACH,SAAgB,WAAW,CACzB,OAA0B,EAC1B,cAA+B,EAC/B,sBAA8B,IAAI;IAElC,8BAA8B;IAC9B,MAAM,OAAO,GAAG,OAAO,CAAC,aAAa,CAAC,iBAAiB,CAAC;IACxD,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACvB,MAAM,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QAC3C,IAAI,MAAM,CAAC,UAAU,GAAG,mBAAmB,EAAE,CAAC;YAC5C,OAAO;gBACL,MAAM,EAAE,IAAI;gBACZ,YAAY,EAAE,gBAAgB;gBAC9B,MAAM,EAAE,0BAA0B,MAAM,CAAC,UAAU,sBAAsB,mBAAmB,GAAG;aAChG,CAAC;QACJ,CAAC;IACH,CAAC;IAED,mCAAmC;IACnC,KAAK,MAAM,EAAE,IAAI,cAAc,EAAE,CAAC;QAChC,IAAI,EAAE,CAAC,aAAa,IAAI,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;YAC5C,OAAO;gBACL,MAAM,EAAE,IAAI;gBACZ,YAAY,EAAE,EAAE,CAAC,IAAI;gBACrB,MAAM,EAAE,6BAA6B,EAAE,CAAC,IAAI,EAAE;aAC/C,CAAC;QACJ,CA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K,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;IAChD,CAAC;IAED,MAAM,SAAS,GAAG,kBAAkB,CAAC,CAAC,CAAC,CAAC;IACxC,MAAM,SAAS,GAAG,UAAU,IAAI,CAAC,GAAG,EAAE,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC;IAEnF,OAAO;QACL,YAAY,EAAE,IAAI;QAClB,OAAO,EAAE;YACP,IAAI,EAAE,cAAc;YACpB,OAAO,EAAE;gBACP,SAAS;gBACT,MAAM,EAAE,gCAAgC,SAAS,CAAC,SAAS,2BAA2B;gBACtF,YAAY,EAAE,0BAA0B;gBACxC,OAAO,EAAE;oBACP,MAAM,EAAE,OAAO,CAAC,MAAM;oBACtB,OAAO,EAAE,cAAc,SAAS,CAAC,SAAS,yCAAyC,SAAS,CAAC,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,8CAA8C;oBACtK,OAAO,EAAE,CAAC,iBAAiB,EAAE,mBAAmB,EAAE,kBAAkB,CAAC;iBACtE;gBACD,iBAAiB,EAAE,UAAU;aAC9B;SACF;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,55 @@
1
+ /**
2
+ * @medicine-wheel/fire-keeper — Gate Evaluation
3
+ *
4
+ * Evaluates gating conditions that must be satisfied before ceremony
5
+ * work can proceed. Implements Wilson's relational accountability
6
+ * as active gates rather than passive metrics.
7
+ */
8
+ import type { GatingCondition, GatingConditionStatus, FireKeeperContext } from './types.js';
9
+ /** Result of evaluating all gating conditions */
10
+ export interface GateEvaluationResult {
11
+ /** Whether all required gates are satisfied */
12
+ allSatisfied: boolean;
13
+ /** Status of each individual gate */
14
+ statuses: GatingConditionStatus[];
15
+ /** Conditions that are not yet satisfied */
16
+ unsatisfied: GatingConditionStatus[];
17
+ }
18
+ /**
19
+ * Evaluate all gating conditions against the current context.
20
+ * Returns detailed status of each gate and whether all required gates pass.
21
+ */
22
+ export declare function evaluateGates(conditions: GatingCondition[], context: FireKeeperContext): GateEvaluationResult;
23
+ /**
24
+ * Create a new gating condition with a custom evaluator.
25
+ * @param condition - Human-readable description
26
+ * @param evaluator - Function that checks whether the condition is met
27
+ * @param required - Whether the condition is mandatory (default: true)
28
+ */
29
+ export declare function createGate(condition: string, evaluator: (context: FireKeeperContext) => boolean, required?: boolean): GatingCondition;
30
+ /**
31
+ * Resolve a held gate by updating its status in the ceremony state.
32
+ * @param gateStatuses - Current gating condition statuses
33
+ * @param gateCondition - The condition string to resolve
34
+ * @param resolvedBy - Who/what resolved the gate
35
+ * @returns Updated gating condition statuses
36
+ */
37
+ export declare function resolveHold(gateStatuses: GatingConditionStatus[], gateCondition: string, resolvedBy: string): GatingConditionStatus[];
38
+ /**
39
+ * Wilson alignment threshold gate.
40
+ * Blocks when Wilson alignment score drops below the configured threshold.
41
+ */
42
+ export declare const GATE_WILSON_ALIGNMENT: GatingCondition;
43
+ /**
44
+ * OCAP compliance gate.
45
+ * Blocks when OCAP® compliance has not been verified.
46
+ */
47
+ export declare const GATE_OCAP_COMPLIANCE: GatingCondition;
48
+ /**
49
+ * Ceremony phase appropriateness gate.
50
+ * Blocks when the ceremony is in a resting phase (no active work allowed).
51
+ */
52
+ export declare const GATE_CEREMONY_PHASE: GatingCondition;
53
+ /** All default gating conditions */
54
+ export declare const DEFAULT_GATES: GatingCondition[];
55
+ //# sourceMappingURL=gating.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gating.d.ts","sourceRoot":"","sources":["../src/gating.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EACV,eAAe,EACf,qBAAqB,EACrB,iBAAiB,EAClB,MAAM,YAAY,CAAC;AAIpB,iDAAiD;AACjD,MAAM,WAAW,oBAAoB;IACnC,+CAA+C;IAC/C,YAAY,EAAE,OAAO,CAAC;IACtB,qCAAqC;IACrC,QAAQ,EAAE,qBAAqB,EAAE,CAAC;IAClC,4CAA4C;IAC5C,WAAW,EAAE,qBAAqB,EAAE,CAAC;CACtC;AAID;;;GAGG;AACH,wBAAgB,aAAa,CAC3B,UAAU,EAAE,eAAe,EAAE,EAC7B,OAAO,EAAE,iBAAiB,GACzB,oBAAoB,CAkBtB;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CACxB,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,CAAC,OAAO,EAAE,iBAAiB,KAAK,OAAO,EAClD,QAAQ,GAAE,OAAc,GACvB,eAAe,CAEjB;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,CACzB,YAAY,EAAE,qBAAqB,EAAE,EACrC,aAAa,EAAE,MAAM,EACrB,UAAU,EAAE,MAAM,GACjB,qBAAqB,EAAE,CAazB;AAID;;;GAGG;AACH,eAAO,MAAM,qBAAqB,EAAE,eAInC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,oBAAoB,EAAE,eAIlC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,mBAAmB,EAAE,eAIjC,CAAC;AAEF,oCAAoC;AACpC,eAAO,MAAM,aAAa,EAAE,eAAe,EAI1C,CAAC"}
package/dist/gating.js ADDED
@@ -0,0 +1,88 @@
1
+ "use strict";
2
+ /**
3
+ * @medicine-wheel/fire-keeper — Gate Evaluation
4
+ *
5
+ * Evaluates gating conditions that must be satisfied before ceremony
6
+ * work can proceed. Implements Wilson's relational accountability
7
+ * as active gates rather than passive metrics.
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.DEFAULT_GATES = exports.GATE_CEREMONY_PHASE = exports.GATE_OCAP_COMPLIANCE = exports.GATE_WILSON_ALIGNMENT = void 0;
11
+ exports.evaluateGates = evaluateGates;
12
+ exports.createGate = createGate;
13
+ exports.resolveHold = resolveHold;
14
+ // ── Gate Evaluation ─────────────────────────────────────────────────────────
15
+ /**
16
+ * Evaluate all gating conditions against the current context.
17
+ * Returns detailed status of each gate and whether all required gates pass.
18
+ */
19
+ function evaluateGates(conditions, context) {
20
+ const now = new Date().toISOString();
21
+ const statuses = conditions.map((gate) => {
22
+ const satisfied = gate.evaluator(context);
23
+ return {
24
+ condition: gate.condition,
25
+ satisfied,
26
+ satisfiedAt: satisfied ? now : null,
27
+ satisfiedBy: satisfied ? 'fire-keeper' : null,
28
+ };
29
+ });
30
+ const unsatisfied = statuses.filter((s) => !s.satisfied);
31
+ const allSatisfied = conditions
32
+ .filter((c) => c.required)
33
+ .every((c) => c.evaluator(context));
34
+ return { allSatisfied, statuses, unsatisfied };
35
+ }
36
+ /**
37
+ * Create a new gating condition with a custom evaluator.
38
+ * @param condition - Human-readable description
39
+ * @param evaluator - Function that checks whether the condition is met
40
+ * @param required - Whether the condition is mandatory (default: true)
41
+ */
42
+ function createGate(condition, evaluator, required = true) {
43
+ return { condition, required, evaluator };
44
+ }
45
+ /**
46
+ * Resolve a held gate by updating its status in the ceremony state.
47
+ * @param gateStatuses - Current gating condition statuses
48
+ * @param gateCondition - The condition string to resolve
49
+ * @param resolvedBy - Who/what resolved the gate
50
+ * @returns Updated gating condition statuses
51
+ */
52
+ function resolveHold(gateStatuses, gateCondition, resolvedBy) {
53
+ const now = new Date().toISOString();
54
+ return gateStatuses.map((status) => {
55
+ if (status.condition === gateCondition && !status.satisfied) {
56
+ return {
57
+ ...status,
58
+ satisfied: true,
59
+ satisfiedAt: now,
60
+ satisfiedBy: resolvedBy,
61
+ };
62
+ }
63
+ return status;
64
+ });
65
+ }
66
+ // ── Default Gates ───────────────────────────────────────────────────────────
67
+ /**
68
+ * Wilson alignment threshold gate.
69
+ * Blocks when Wilson alignment score drops below the configured threshold.
70
+ */
71
+ exports.GATE_WILSON_ALIGNMENT = createGate('Wilson alignment above threshold', (context) => (context.wilsonAlignment ?? 0) >= 0.65, true);
72
+ /**
73
+ * OCAP compliance gate.
74
+ * Blocks when OCAP® compliance has not been verified.
75
+ */
76
+ exports.GATE_OCAP_COMPLIANCE = createGate('OCAP compliance verified', (context) => context.ocapCompliant === true, true);
77
+ /**
78
+ * Ceremony phase appropriateness gate.
79
+ * Blocks when the ceremony is in a resting phase (no active work allowed).
80
+ */
81
+ exports.GATE_CEREMONY_PHASE = createGate('Ceremony phase allows active work', (context) => context.ceremonyState.ceremonyPhase !== 'resting', true);
82
+ /** All default gating conditions */
83
+ exports.DEFAULT_GATES = [
84
+ exports.GATE_WILSON_ALIGNMENT,
85
+ exports.GATE_OCAP_COMPLIANCE,
86
+ exports.GATE_CEREMONY_PHASE,
87
+ ];
88
+ //# sourceMappingURL=gating.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gating.js","sourceRoot":"","sources":["../src/gating.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AA0BH,sCAqBC;AAQD,gCAMC;AASD,kCAiBC;AAnED,+EAA+E;AAE/E;;;GAGG;AACH,SAAgB,aAAa,CAC3B,UAA6B,EAC7B,OAA0B;IAE1B,MAAM,GAAG,GAAG,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IACrC,MAAM,QAAQ,GAA4B,UAAU,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;QAChE,MAAM,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;QAC1C,OAAO;YACL,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,SAAS;YACT,WAAW,EAAE,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI;YACnC,WAAW,EAAE,SAAS,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI;SAC9C,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,MAAM,WAAW,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;IACzD,MAAM,YAAY,GAAG,UAAU;SAC5B,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ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E,EAAE,CAAC,OAAO,CAAC,aAAa,CAAC,aAAa,KAAK,SAAS,EAC9D,IAAI,CACL,CAAC;AAEF,oCAAoC;AACvB,QAAA,aAAa,GAAsB;IAC9C,6BAAqB;IACrB,4BAAoB;IACpB,2BAAmB;CACpB,CAAC"}
@@ -0,0 +1,27 @@
1
+ /**
2
+ * @medicine-wheel/fire-keeper
3
+ *
4
+ * The Fire Keeper coordination agent for Medicine Wheel.
5
+ * Tends the ceremony fire, ensures relational integrity through gating
6
+ * conditions, and maintains Wilson alignment as an active agent.
7
+ *
8
+ * The Fire Keeper does not write code or produce artifacts directly.
9
+ * It receives, evaluates, routes, and gates the work of sub-agents.
10
+ *
11
+ * @packageDocumentation
12
+ */
13
+ export type { CeremonyPhaseExtended, QuadrantStatus, FireKeeperContext, GatingCondition, GatingConditionStatus, PermissionTier, DecisionPointType, DecisionPoint, TrajectoryCheckpoint, RelationalMilestone, StopWorkOrder, CeremonyStateExtended, FireKeeperConfig, FireKeeperState, } from './types.js';
14
+ export type { ImportanceSubmittedMessage, CircleReturnMessage, AgentReportMessage, HumanResponseMessage, ImportanceAcceptedMessage, ImportanceHeldMessage, DeepenRequestedMessage, HumanNeededMessage, CeremonyStateUpdateMessage, StopWorkOrderMessage, FireKeeperMessage, } from './messages.js';
15
+ export { FireKeeper } from './keeper.js';
16
+ export type { ImportanceEvaluationResult, RelationalAlignmentResult } from './keeper.js';
17
+ export { evaluateGates, createGate, resolveHold, GATE_WILSON_ALIGNMENT, GATE_OCAP_COMPLIANCE, GATE_CEREMONY_PHASE, DEFAULT_GATES, } from './gating.js';
18
+ export type { GateEvaluationResult } from './gating.js';
19
+ export { humanNeeded, permissionEscalation, circleReview } from './decisions.js';
20
+ export type { HumanDecisionResult, EscalationResult, CircleReviewResult, } from './decisions.js';
21
+ export { relationalCheckBack } from './check-back.js';
22
+ export type { CheckBackStep, CheckBackResult } from './check-back.js';
23
+ export { CeremonyStateManager, createCeremonyState } from './ceremony-state.js';
24
+ export type { CompletionReadiness } from './ceremony-state.js';
25
+ export { trajectoryConfidence, valueDivergenceDetect } from './trajectory.js';
26
+ export type { DivergenceResult } from './trajectory.js';
27
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAIH,YAAY,EACV,qBAAqB,EACrB,cAAc,EACd,iBAAiB,EACjB,eAAe,EACf,qBAAqB,EACrB,cAAc,EACd,iBAAiB,EACjB,aAAa,EACb,oBAAoB,EACpB,mBAAmB,EACnB,aAAa,EACb,qBAAqB,EACrB,gBAAgB,EAChB,eAAe,GAChB,MAAM,YAAY,CAAC;AAIpB,YAAY,EACV,0BAA0B,EAC1B,mBAAmB,EACnB,kBAAkB,EAClB,oBAAoB,EACpB,yBAAyB,EACzB,qBAAqB,EACrB,sBAAsB,EACtB,kBAAkB,EAClB,0BAA0B,EAC1B,oBAAoB,EACpB,iBAAiB,GAClB,MAAM,eAAe,CAAC;AAIvB,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,YAAY,EAAE,0BAA0B,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAC;AAIzF,OAAO,EACL,aAAa,EACb,UAAU,EACV,WAAW,EACX,qBAAqB,EACrB,oBAAoB,EACpB,mBAAmB,EACnB,aAAa,GACd,MAAM,aAAa,CAAC;AACrB,YAAY,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAIxD,OAAO,EAAE,WAAW,EAAE,oBAAoB,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACjF,YAAY,EACV,mBAAmB,EACnB,gBAAgB,EAChB,kBAAkB,GACnB,MAAM,gBAAgB,CAAC;AAIxB,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACtD,YAAY,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAItE,OAAO,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAChF,YAAY,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAI/D,OAAO,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAC9E,YAAY,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ /**
3
+ * @medicine-wheel/fire-keeper
4
+ *
5
+ * The Fire Keeper coordination agent for Medicine Wheel.
6
+ * Tends the ceremony fire, ensures relational integrity through gating
7
+ * conditions, and maintains Wilson alignment as an active agent.
8
+ *
9
+ * The Fire Keeper does not write code or produce artifacts directly.
10
+ * It receives, evaluates, routes, and gates the work of sub-agents.
11
+ *
12
+ * @packageDocumentation
13
+ */
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.valueDivergenceDetect = exports.trajectoryConfidence = exports.createCeremonyState = exports.CeremonyStateManager = exports.relationalCheckBack = exports.circleReview = exports.permissionEscalation = exports.humanNeeded = exports.DEFAULT_GATES = exports.GATE_CEREMONY_PHASE = exports.GATE_OCAP_COMPLIANCE = exports.GATE_WILSON_ALIGNMENT = exports.resolveHold = exports.createGate = exports.evaluateGates = exports.FireKeeper = void 0;
16
+ // ── Fire Keeper ─────────────────────────────────────────────────────────────
17
+ var keeper_js_1 = require("./keeper.js");
18
+ Object.defineProperty(exports, "FireKeeper", { enumerable: true, get: function () { return keeper_js_1.FireKeeper; } });
19
+ // ── Gating ──────────────────────────────────────────────────────────────────
20
+ var gating_js_1 = require("./gating.js");
21
+ Object.defineProperty(exports, "evaluateGates", { enumerable: true, get: function () { return gating_js_1.evaluateGates; } });
22
+ Object.defineProperty(exports, "createGate", { enumerable: true, get: function () { return gating_js_1.createGate; } });
23
+ Object.defineProperty(exports, "resolveHold", { enumerable: true, get: function () { return gating_js_1.resolveHold; } });
24
+ Object.defineProperty(exports, "GATE_WILSON_ALIGNMENT", { enumerable: true, get: function () { return gating_js_1.GATE_WILSON_ALIGNMENT; } });
25
+ Object.defineProperty(exports, "GATE_OCAP_COMPLIANCE", { enumerable: true, get: function () { return gating_js_1.GATE_OCAP_COMPLIANCE; } });
26
+ Object.defineProperty(exports, "GATE_CEREMONY_PHASE", { enumerable: true, get: function () { return gating_js_1.GATE_CEREMONY_PHASE; } });
27
+ Object.defineProperty(exports, "DEFAULT_GATES", { enumerable: true, get: function () { return gating_js_1.DEFAULT_GATES; } });
28
+ // ── Decisions ───────────────────────────────────────────────────────────────
29
+ var decisions_js_1 = require("./decisions.js");
30
+ Object.defineProperty(exports, "humanNeeded", { enumerable: true, get: function () { return decisions_js_1.humanNeeded; } });
31
+ Object.defineProperty(exports, "permissionEscalation", { enumerable: true, get: function () { return decisions_js_1.permissionEscalation; } });
32
+ Object.defineProperty(exports, "circleReview", { enumerable: true, get: function () { return decisions_js_1.circleReview; } });
33
+ // ── Check-Back Protocol ─────────────────────────────────────────────────────
34
+ var check_back_js_1 = require("./check-back.js");
35
+ Object.defineProperty(exports, "relationalCheckBack", { enumerable: true, get: function () { return check_back_js_1.relationalCheckBack; } });
36
+ // ── Ceremony State ──────────────────────────────────────────────────────────
37
+ var ceremony_state_js_1 = require("./ceremony-state.js");
38
+ Object.defineProperty(exports, "CeremonyStateManager", { enumerable: true, get: function () { return ceremony_state_js_1.CeremonyStateManager; } });
39
+ Object.defineProperty(exports, "createCeremonyState", { enumerable: true, get: function () { return ceremony_state_js_1.createCeremonyState; } });
40
+ // ── Trajectory ──────────────────────────────────────────────────────────────
41
+ var trajectory_js_1 = require("./trajectory.js");
42
+ Object.defineProperty(exports, "trajectoryConfidence", { enumerable: true, get: function () { return trajectory_js_1.trajectoryConfidence; } });
43
+ Object.defineProperty(exports, "valueDivergenceDetect", { enumerable: true, get: function () { return trajectory_js_1.valueDivergenceDetect; } });
44
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;GAWG;;;AAqCH,+EAA+E;AAE/E,yCAAyC;AAAhC,uGAAA,UAAU,OAAA;AAGnB,+EAA+E;AAE/E,yCAQqB;AAPnB,0GAAA,aAAa,OAAA;AACb,uGAAA,UAAU,OAAA;AACV,wGAAA,WAAW,OAAA;AACX,kHAAA,qBAAqB,OAAA;AACrB,iHAAA,oBAAoB,OAAA;AACpB,gHAAA,mBAAmB,OAAA;AACnB,0GAAA,aAAa,OAAA;AAIf,+EAA+E;AAE/E,+CAAiF;AAAxE,2GAAA,WAAW,OAAA;AAAE,oHAAA,oBAAoB,OAAA;AAAE,4GAAA,YAAY,OAAA;AAOxD,+EAA+E;AAE/E,iDAAsD;AAA7C,oHAAA,mBAAmB,OAAA;AAG5B,+EAA+E;AAE/E,yDAAgF;AAAvE,yHAAA,oBAAoB,OAAA;AAAE,wHAAA,mBAAmB,OAAA;AAGlD,+EAA+E;AAE/E,iDAA8E;AAArE,qHAAA,oBAAoB,OAAA;AAAE,sHAAA,qBAAqB,OAAA"}
@@ -0,0 +1,85 @@
1
+ /**
2
+ * @medicine-wheel/fire-keeper — Fire Keeper Class
3
+ *
4
+ * The core coordination engine. The Fire Keeper tends the ceremony fire,
5
+ * receives and evaluates ImportanceUnits, gates work through relational
6
+ * conditions, and issues stop-work orders when accountability is violated.
7
+ *
8
+ * The Fire Keeper does not write code or produce artifacts directly.
9
+ * It receives, evaluates, routes, and gates the work of sub-agents.
10
+ */
11
+ import type { DirectionName } from '@medicine-wheel/ontology-core';
12
+ import type { FireKeeperConfig, FireKeeperState, CeremonyStateExtended } from './types.js';
13
+ import type { ImportanceAcceptedMessage, ImportanceHeldMessage, DeepenRequestedMessage, StopWorkOrderMessage, HumanNeededMessage } from './messages.js';
14
+ /** Result of evaluating an ImportanceUnit */
15
+ export type ImportanceEvaluationResult = ImportanceAcceptedMessage | ImportanceHeldMessage | DeepenRequestedMessage | HumanNeededMessage;
16
+ /**
17
+ * The Fire Keeper — ceremony coordination agent.
18
+ * Tends the fire so the ceremony can proceed with relational integrity.
19
+ */
20
+ export declare class FireKeeper {
21
+ private config;
22
+ private state;
23
+ private managers;
24
+ constructor(config: FireKeeperConfig);
25
+ /** Get the current Fire Keeper state */
26
+ getState(): FireKeeperState;
27
+ /**
28
+ * Begin tending a ceremony for a given inquiry.
29
+ * @param inquiryRef - Reference to the inquiry
30
+ * @param startDirection - Initial direction (default: east)
31
+ */
32
+ beginCeremony(inquiryRef: string, startDirection?: DirectionName): CeremonyStateExtended;
33
+ /**
34
+ * Evaluate an incoming ImportanceUnit against gating conditions,
35
+ * ceremony state, and relational check-back protocol.
36
+ * @param unit - The ImportanceUnit payload
37
+ * @param inquiryRef - Reference to the active inquiry
38
+ */
39
+ evaluateImportance(unit: Record<string, unknown>, inquiryRef: string): ImportanceEvaluationResult;
40
+ /**
41
+ * Check the current ceremony state for a given inquiry.
42
+ * @param inquiryRef - Reference to the inquiry
43
+ */
44
+ checkCeremonyState(inquiryRef: string): CeremonyStateExtended | null;
45
+ /**
46
+ * Request that a participant deepen their work in a specific direction.
47
+ * @param unitId - The ImportanceUnit to deepen
48
+ * @param direction - Direction to return to
49
+ * @param guidance - Guidance for the deepening
50
+ */
51
+ requestDeepening(unitId: string, direction: DirectionName, guidance: string): DeepenRequestedMessage;
52
+ /**
53
+ * Issue a stop-work order when relational accountability is violated.
54
+ * This is an emergency halt — the Fire Keeper's most serious action.
55
+ * @param targetAgentId - Agent to halt
56
+ * @param reason - Reason for the stop work order
57
+ * @param unitId - Related ImportanceUnit, if any
58
+ */
59
+ issueStopWork(targetAgentId: string, reason: string, unitId?: string | null): StopWorkOrderMessage;
60
+ /**
61
+ * Verify Wilson alignment across the current ceremony.
62
+ * Checks trajectory confidence, gating conditions, and relational milestones.
63
+ * @param inquiryRef - Reference to the inquiry
64
+ */
65
+ checkRelationalAlignment(inquiryRef: string): RelationalAlignmentResult;
66
+ private buildContext;
67
+ private estimateWilsonAlignment;
68
+ private getMissingQuadrants;
69
+ }
70
+ /** Result of a relational alignment check */
71
+ export interface RelationalAlignmentResult {
72
+ /** Whether the ceremony is relationally aligned */
73
+ aligned: boolean;
74
+ /** Current trajectory confidence */
75
+ confidence: number;
76
+ /** Issues found during alignment check */
77
+ issues: string[];
78
+ /** Unsatisfied gating conditions */
79
+ unsatisfiedGates?: string[];
80
+ /** Incomplete relational milestones */
81
+ incompleteMilestones?: string[];
82
+ /** Number of active stop-work orders */
83
+ activeStopWorkOrders?: number;
84
+ }
85
+ //# sourceMappingURL=keeper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"keeper.d.ts","sourceRoot":"","sources":["../src/keeper.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,KAAK,EACV,gBAAgB,EAChB,eAAe,EAEf,qBAAqB,EAGtB,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EACV,yBAAyB,EACzB,qBAAqB,EACrB,sBAAsB,EACtB,oBAAoB,EACpB,kBAAkB,EACnB,MAAM,eAAe,CAAC;AASvB,6CAA6C;AAC7C,MAAM,MAAM,0BAA0B,GAClC,yBAAyB,GACzB,qBAAqB,GACrB,sBAAsB,GACtB,kBAAkB,CAAC;AAIvB;;;GAGG;AACH,qBAAa,UAAU;IACrB,OAAO,CAAC,MAAM,CAAmB;IACjC,OAAO,CAAC,KAAK,CAAkB;IAC/B,OAAO,CAAC,QAAQ,CAAgD;gBAEpD,MAAM,EAAE,gBAAgB;IAWpC,wCAAwC;IACxC,QAAQ,IAAI,eAAe;IAI3B;;;;OAIG;IACH,aAAa,CACX,UAAU,EAAE,MAAM,EAClB,cAAc,GAAE,aAAsB,GACrC,qBAAqB;IAYxB;;;;;OAKG;IACH,kBAAkB,CAChB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,UAAU,EAAE,MAAM,GACjB,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