Repository navigation
Expand file tree
/
Copy pathtypes.ts
More file actions
155 lines (121 loc) · 6.21 KB
/
Copy pathtypes.ts
File metadata and controls
155 lines (121 loc) · 6.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
/**
* Cognitive Modeling System - Type Definitions
* Self-documenting types for code-as-gesture cognitive modeling
*/
// ═══════════════════════════════════════════════════════════════════════════════
// PRIMITIVE TYPES
// ═══════════════════════════════════════════════════════════════════════════════
/** Uncertainty interval [min, max] representing range of possible values */
export type Interval = readonly [number, number];
/** Unique identifier for thoughts - use PascalCase: 'Consciousness' | 'SelfAwareness' */
export type NodeId = string;
/** Confidence level (0-1): 0.9 = high | 0.5 = uncertain | 0.1 = speculative */
export type ConfidenceLevel = number;
/** Relationship strength (0+): 1.0 = fundamental | 0.7 = strong | 0.3 = weak */
export type RelationshipStrength = number;
/** Property values: number | [min, max] interval */
export type PropertyValue = number | Interval;
/** Focus level (-1 to 1): 1.0 = highlighted | undefined = neutral | -1.0 = discarded/dimmed */
export type FocusLevel = number;
/** Semantic position (-1 to +1): -1 = left pole | 0 = neutral/center | +1 = right pole */
export type SemanticPosition = number;
/**
* Simplified semantic relationships between thoughts
* @example 'supports' - A reinforces or validates B (positive relationship)
* @example 'conflicts-with' - A contradicts or opposes B (negative relationship)
*/
export type RelationType = 'supports' | 'conflicts-with';
// ═══════════════════════════════════════════════════════════════════════════════
// STRUCTURED DATA
// ═══════════════════════════════════════════════════════════════════════════════
/** Semantic meaning with confidence and timestamp */
export interface Meaning {
content: string;
confidence: ConfidenceLevel;
timestamp: number;
}
/** Directed relationship between thoughts */
export interface Relationship {
type: RelationType;
target: NodeId;
strength: RelationshipStrength;
gloss?: string;
}
/** Metaphorical interpretation held in superposition */
export interface MetaphorBranch {
name: string;
interpretation: string;
weight: number;
predictiveSuccess: number;
}
/** Branch interpretation for holding multiple meanings in superposition */
export interface BranchInterpretation {
name: string;
interpretation: string;
relationships: Relationship[];
values: Map<string, PropertyValue>;
isActive: boolean;
}
/** Resolution record for collapsed branches */
export interface BranchResolution {
context: string;
selections: string[];
reason: string;
timestamp: number;
}
/** Space metadata */
export interface SpaceMetadata {
id: string;
title: string;
description: string;
createdAt: number;
}
// ═══════════════════════════════════════════════════════════════════════════════
// FLUENT API
// ═══════════════════════════════════════════════════════════════════════════════
/**
* Chainable thought building interface
* @example thought('Mind').means('Cognitive system').hasValue('complexity', 0.8)
*/
export interface ThoughtBuilder {
/** Add semantic meaning: .means('What this represents', 0.9) */
means(content: string, confidence?: ConfidenceLevel): this;
/** Transform meaning: .becomes('New understanding') */
becomes(newMeaning: string): this;
/** Add property: .hasValue('complexity', 0.8) | .hasValue('range', [0.3, 0.7]) */
hasValue(key: string, value: PropertyValue): this;
/** Support relationship: .supports('OtherThought', 0.8) */
supports(target: NodeId, strength?: RelationshipStrength): this;
/** Conflict relationship: .conflictsWith('OpposingThought', 0.7) */
conflictsWith(target: NodeId, strength?: RelationshipStrength): this;
/** Add metaphor: .forkMetaphor('ocean', 'Deep and mysterious', 1.2) */
forkMetaphor(name: string, interpretation: string, initialWeight?: number): this;
/** Express tension: .holdsTension('Between certainty and doubt') */
holdsTension(description: string): this;
/** Self-observation: .observesSelf('This thought observes itself') */
observesSelf(observation: string): this;
/** History-aware transform: .applyHistoryAwareTransform('refinement', 0.8) */
applyHistoryAwareTransform(transformType: string, magnitude: number): this;
/** Set focus level: .setFocus(1.0) | .setFocus(0.3) - 1.0 = full focus, 0.0 = background */
setFocus(level: FocusLevel): this;
/** Set semantic position: .setPosition(-1.0) | .setPosition(0.5) - left pole, center, right pole */
setPosition(position: SemanticPosition): this;
/** Add branch interpretation or access existing: .branch('interpretation name') */
branch(interpretation: string): this;
/** Resolve branches to specific interpretations: .resolve({context, selections, reason}) */
resolve(resolution: { context: string; selections: string[]; reason: string }): this;
}
/**
* Cognitive operations on thought spaces
* @example space.collapseMetaphor('Mind', 'processing') → computer metaphor
*/
export interface CognitiveOperations {
/** Collapse metaphors based on context */
collapseMetaphor(nodeId: NodeId, context: string): string | null;
/** Propagate values through causal relationships */
propagate(fromId: NodeId, key: string): void;
/** Get space summary: "5 nodes, 12 meanings, 8 relationships" */
reflect(): string;
/** Subscribe to changes for real-time updates */
subscribe(listener: (space: any) => void): () => void;
}