rei-lang 0.5.3 → 0.5.4

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 CHANGED
@@ -267,7 +267,9 @@ See [full command reference](./docs/KANJI-README.md) for the complete bilingual
267
267
  | Document | Content |
268
268
  |----------|---------|
269
269
  | [TUTORIAL.md](./docs/TUTORIAL.md) | Getting started in 15 minutes |
270
+ | [API-STABILITY.md](./docs/API-STABILITY.md) | API stability levels (Stable/Provisional/Experimental) |
270
271
  | [KANJI-README.md](./docs/KANJI-README.md) | Full bilingual command reference |
272
+ | [ROADMAP-v1.md](./docs/ROADMAP-v1.md) | Path to v1.0 |
271
273
  | [PHASE4D-DESIGN.md](./PHASE4D-DESIGN.md) | Current development phase |
272
274
  | [ARCH.md](./ARCH.md) | Architecture overview |
273
275
  | [spec/](./spec/) | BNF specification (v0.3) |
package/dist/index.d.mts CHANGED
@@ -350,6 +350,7 @@ declare class ReiAgent {
350
350
  private _parentId;
351
351
  private _childIds;
352
352
  private _depth;
353
+ private _deepMeta;
353
354
  private _memory;
354
355
  private _memoryLimit;
355
356
  private _eventBus;
@@ -440,6 +441,9 @@ declare class ReiAgent {
440
441
  private actDissolve;
441
442
  /** 結合情報を更新 */
442
443
  updateBindings(bindings: BindingSummary[]): void;
444
+ /** Phase 4d: sigma-deep メタデータの取得・設定 */
445
+ get deepMeta(): Record<string, any> | null;
446
+ setDeepMeta(meta: Record<string, any>): void;
443
447
  /** 意志を設定 */
444
448
  setIntention(intention: ReiIntention): void;
445
449
  /** 意志をクリア */
@@ -1158,6 +1162,45 @@ interface AgentSpaceResult {
1158
1162
  difficulty?: DifficultyAnalysis;
1159
1163
  reasoningTrace?: ReasoningTrace[];
1160
1164
  matchAnalysis?: MatchAnalysis;
1165
+ relationSummary?: RelationSummary;
1166
+ _bindingRegistry?: BindingRegistry;
1167
+ willSummary?: WillSummary;
1168
+ _willMetas?: [DeepSigmaMeta, DeepSigmaMeta];
1169
+ }
1170
+ /** 意志サマリー(ゲーム対局の意志追跡要約) */
1171
+ interface WillSummary {
1172
+ players: Array<{
1173
+ player: number;
1174
+ initialTendency: string;
1175
+ finalTendency: string;
1176
+ strengthGrowth: number;
1177
+ totalEvolutions: number;
1178
+ }>;
1179
+ willHistory: Array<{
1180
+ round: number;
1181
+ player: number;
1182
+ evolution: WillEvolution;
1183
+ }>;
1184
+ conflictAnalysis: WillConflict | null;
1185
+ }
1186
+ /** 関係サマリー(縁起的追跡の要約) */
1187
+ interface RelationSummary {
1188
+ totalBindings: number;
1189
+ constraintBindings: {
1190
+ row: number;
1191
+ column: number;
1192
+ block: number;
1193
+ other: number;
1194
+ };
1195
+ avgBindingsPerAgent: number;
1196
+ mostConnectedAgent: {
1197
+ id: string;
1198
+ bindingCount: number;
1199
+ } | null;
1200
+ leastConnectedAgent: {
1201
+ id: string;
1202
+ bindingCount: number;
1203
+ } | null;
1161
1204
  }
1162
1205
  /** AgentSpace σ */
1163
1206
  interface AgentSpaceSigma {
@@ -1186,6 +1229,7 @@ interface AgentSpace {
1186
1229
  eventBus: ReiEventBus;
1187
1230
  mediator: ReiMediator;
1188
1231
  agentIds: string[];
1232
+ bindingRegistry?: BindingRegistry;
1189
1233
  puzzleData?: PuzzleAgentData;
1190
1234
  gameData?: GameAgentData;
1191
1235
  rounds: AgentSpaceRound[];
@@ -1218,6 +1262,12 @@ interface GameAgentData {
1218
1262
  player: number;
1219
1263
  patterns: TacticalPattern[];
1220
1264
  }>;
1265
+ willMetas: [DeepSigmaMeta, DeepSigmaMeta];
1266
+ willHistory: Array<{
1267
+ round: number;
1268
+ player: number;
1269
+ evolution: WillEvolution;
1270
+ }>;
1221
1271
  }
1222
1272
  /** 推論層レベル (Phase 4b) */
1223
1273
  type ReasoningLayer = 'layer1_elimination' | 'layer2_naked_pair' | 'layer2_hidden_single' | 'layer2_pointing_pair' | 'layer3_backtrack';
@@ -1313,6 +1363,93 @@ declare function getReasoningTrace(space: AgentSpace): ReasoningTrace[];
1313
1363
  */
1314
1364
  declare function getMatchAnalysis(space: AgentSpace): MatchAnalysis;
1315
1365
 
1366
+ /**
1367
+ * sigma-reactive.ts — 6属性相互反応エンジン
1368
+ *
1369
+ * 6属性が互いに影響し合う「生きた系」を実現する。
1370
+ *
1371
+ * カスケード連鎖:
1372
+ * relation → will: 関係の変化が意志を揺らす
1373
+ * will → flow: 意志の変化がflowの位相を変える
1374
+ * flow → memory: 位相遷移が記憶に自動記録される
1375
+ * memory → layer: 記憶の蓄積が層の深度を変える
1376
+ * layer → relation: 層の深化が関係の影響範囲を広げる
1377
+ *
1378
+ * @author Nobuki Fujimoto (D-FUMT)
1379
+ * @version 0.5.3
1380
+ */
1381
+
1382
+ /** 単一の属性変化 */
1383
+ interface AttributeReaction {
1384
+ attribute: 'field' | 'flow' | 'memory' | 'layer' | 'relation' | 'will';
1385
+ trigger: string;
1386
+ before: any;
1387
+ after: any;
1388
+ reason: string;
1389
+ }
1390
+ /** カスケード全体の結果 */
1391
+ interface CascadeResult {
1392
+ reiType: 'CascadeResult';
1393
+ reactions: AttributeReaction[];
1394
+ depth: number;
1395
+ stable: boolean;
1396
+ pulse: number;
1397
+ }
1398
+ /**
1399
+ * 関係の変化が意志に与える影響
1400
+ * - 新しいbindが生まれると、意志のstrengthが微増する(つながりが意志を強める)
1401
+ * - entangleが生まれると、tendencyが相手の方向に引き寄せられる
1402
+ * - 孤立(isolated)なら意志は弱まる
1403
+ */
1404
+ declare function reactRelationToWill(meta: DeepSigmaMeta, event: 'bind' | 'entangle' | 'unbind', partnerTendency?: string): AttributeReaction | null;
1405
+ /**
1406
+ * 意志の変化がflowに与える影響
1407
+ * - conflict(高tension) → flow.phase = 'reversing'
1408
+ * - align(高harmony) → flow.phase = 'steady'
1409
+ * - evolve(strength増) → flow.phase = 'accelerating'
1410
+ * - 意志の弱化 → flow.phase = 'decelerating'
1411
+ */
1412
+ declare function reactWillToFlow(meta: DeepSigmaMeta, event: 'evolve' | 'align' | 'conflict' | 'weaken', intensity?: number): AttributeReaction | null;
1413
+ /**
1414
+ * flowの位相変化を記憶に自動記録
1415
+ * - 位相遷移はSigmaMemoryEntryとして構造化記録される
1416
+ * - 記憶は「忘却不能」— 一度記録されたら消えない
1417
+ */
1418
+ declare function reactFlowToMemory(meta: DeepSigmaMeta, phaseTransition: {
1419
+ from: FlowPhase;
1420
+ to: FlowPhase;
1421
+ velocity: number;
1422
+ }, cause: string): AttributeReaction;
1423
+ /**
1424
+ * 記憶の蓄積が層構造に与える影響
1425
+ * - 記憶5件以上 → depth 2, structure 'nested'
1426
+ * - 記憶10件以上 → depth 3, structure 'recursive'
1427
+ * - 記憶20件以上 → depth 4, structure 'fractal'
1428
+ */
1429
+ declare function reactMemoryToLayer(meta: DeepSigmaMeta): AttributeReaction | null;
1430
+ /**
1431
+ * 層の深化が関係に与える影響
1432
+ * - 深い層は、より遠い依存関係を「見る」ことができる
1433
+ * - depth 2以上 → 影響範囲拡大
1434
+ * - depth 3以上 → entanglementの共鳴強化
1435
+ */
1436
+ declare function reactLayerToRelation(meta: DeepSigmaMeta, depthBefore: number, depthAfter: number): AttributeReaction | null;
1437
+ /**
1438
+ * 関係変化からのフルカスケード
1439
+ * relation → will → flow → memory → layer → relation
1440
+ */
1441
+ declare function cascadeFromRelation(meta: DeepSigmaMeta, event: 'bind' | 'entangle' | 'unbind', partnerTendency?: string): CascadeResult;
1442
+ /**
1443
+ * 意志変化からのカスケード
1444
+ * will → flow → memory → layer → relation
1445
+ */
1446
+ declare function cascadeFromWill(meta: DeepSigmaMeta, event: 'evolve' | 'align' | 'conflict', intensity?: number): CascadeResult;
1447
+ /**
1448
+ * 脈動(pulse) — 明示的にフルカスケードを実行
1449
+ * 全属性の現在状態を基に、安定するまでカスケードを繰り返す
1450
+ */
1451
+ declare function pulse(meta: DeepSigmaMeta, maxPulses?: number): CascadeResult;
1452
+
1316
1453
  declare function reiFn(source: string): any;
1317
1454
  declare namespace reiFn {
1318
1455
  var reset: () => void;
@@ -1320,4 +1457,4 @@ declare namespace reiFn {
1320
1457
  }
1321
1458
  declare const rei: typeof reiFn;
1322
1459
 
1323
- export { AgentRegistry, type DeepSigmaMeta, type DeepSigmaResult, type EntanglementResult, Evaluator, type FlowPhase, type InfluenceResult, type LayerStructure, Lexer, type MemoryTrajectory, Parser, ReiAgent, ReiEventBus, ReiMediator, type RelationDependency, type RelationRole, type SigmaMemoryEntry, type TraceNode, type TraceResult, type WillAlignment, type WillConflict, type WillEvolution, agentSpaceRun, agentSpaceRunRound, alignWills, buildDeepSigmaResult, computeInfluence, createDeepSigmaMeta, createEntanglement, createGameAgentSpace, createPuzzleAgentSpace, detectWillConflict, evolveWill, formatAgentSpaceGame, formatAgentSpacePuzzle, getAgentSpaceGameState, getAgentSpaceGrid, getAgentSpaceSigma, getDifficultyAnalysis, getMatchAnalysis, getReasoningTrace, mergeRelationBindings, mergeWillIntention, rei, traceRelationChain, wrapWithDeepSigma };
1460
+ export { AgentRegistry, type AttributeReaction, type CascadeResult, type DeepSigmaMeta, type DeepSigmaResult, type EntanglementResult, Evaluator, type FlowPhase, type InfluenceResult, type LayerStructure, Lexer, type MemoryTrajectory, Parser, ReiAgent, ReiEventBus, ReiMediator, type RelationDependency, type RelationRole, type SigmaMemoryEntry, type TraceNode, type TraceResult, type WillAlignment, type WillConflict, type WillEvolution, agentSpaceRun, agentSpaceRunRound, alignWills, buildDeepSigmaResult, cascadeFromRelation, cascadeFromWill, computeInfluence, createDeepSigmaMeta, createEntanglement, createGameAgentSpace, createPuzzleAgentSpace, detectWillConflict, evolveWill, formatAgentSpaceGame, formatAgentSpacePuzzle, getAgentSpaceGameState, getAgentSpaceGrid, getAgentSpaceSigma, getDifficultyAnalysis, getMatchAnalysis, getReasoningTrace, mergeRelationBindings, mergeWillIntention, reactFlowToMemory, reactLayerToRelation, reactMemoryToLayer, reactRelationToWill, reactWillToFlow, rei, pulse as sigmaReactivePulse, traceRelationChain, wrapWithDeepSigma };
package/dist/index.d.ts CHANGED
@@ -350,6 +350,7 @@ declare class ReiAgent {
350
350
  private _parentId;
351
351
  private _childIds;
352
352
  private _depth;
353
+ private _deepMeta;
353
354
  private _memory;
354
355
  private _memoryLimit;
355
356
  private _eventBus;
@@ -440,6 +441,9 @@ declare class ReiAgent {
440
441
  private actDissolve;
441
442
  /** 結合情報を更新 */
442
443
  updateBindings(bindings: BindingSummary[]): void;
444
+ /** Phase 4d: sigma-deep メタデータの取得・設定 */
445
+ get deepMeta(): Record<string, any> | null;
446
+ setDeepMeta(meta: Record<string, any>): void;
443
447
  /** 意志を設定 */
444
448
  setIntention(intention: ReiIntention): void;
445
449
  /** 意志をクリア */
@@ -1158,6 +1162,45 @@ interface AgentSpaceResult {
1158
1162
  difficulty?: DifficultyAnalysis;
1159
1163
  reasoningTrace?: ReasoningTrace[];
1160
1164
  matchAnalysis?: MatchAnalysis;
1165
+ relationSummary?: RelationSummary;
1166
+ _bindingRegistry?: BindingRegistry;
1167
+ willSummary?: WillSummary;
1168
+ _willMetas?: [DeepSigmaMeta, DeepSigmaMeta];
1169
+ }
1170
+ /** 意志サマリー(ゲーム対局の意志追跡要約) */
1171
+ interface WillSummary {
1172
+ players: Array<{
1173
+ player: number;
1174
+ initialTendency: string;
1175
+ finalTendency: string;
1176
+ strengthGrowth: number;
1177
+ totalEvolutions: number;
1178
+ }>;
1179
+ willHistory: Array<{
1180
+ round: number;
1181
+ player: number;
1182
+ evolution: WillEvolution;
1183
+ }>;
1184
+ conflictAnalysis: WillConflict | null;
1185
+ }
1186
+ /** 関係サマリー(縁起的追跡の要約) */
1187
+ interface RelationSummary {
1188
+ totalBindings: number;
1189
+ constraintBindings: {
1190
+ row: number;
1191
+ column: number;
1192
+ block: number;
1193
+ other: number;
1194
+ };
1195
+ avgBindingsPerAgent: number;
1196
+ mostConnectedAgent: {
1197
+ id: string;
1198
+ bindingCount: number;
1199
+ } | null;
1200
+ leastConnectedAgent: {
1201
+ id: string;
1202
+ bindingCount: number;
1203
+ } | null;
1161
1204
  }
1162
1205
  /** AgentSpace σ */
1163
1206
  interface AgentSpaceSigma {
@@ -1186,6 +1229,7 @@ interface AgentSpace {
1186
1229
  eventBus: ReiEventBus;
1187
1230
  mediator: ReiMediator;
1188
1231
  agentIds: string[];
1232
+ bindingRegistry?: BindingRegistry;
1189
1233
  puzzleData?: PuzzleAgentData;
1190
1234
  gameData?: GameAgentData;
1191
1235
  rounds: AgentSpaceRound[];
@@ -1218,6 +1262,12 @@ interface GameAgentData {
1218
1262
  player: number;
1219
1263
  patterns: TacticalPattern[];
1220
1264
  }>;
1265
+ willMetas: [DeepSigmaMeta, DeepSigmaMeta];
1266
+ willHistory: Array<{
1267
+ round: number;
1268
+ player: number;
1269
+ evolution: WillEvolution;
1270
+ }>;
1221
1271
  }
1222
1272
  /** 推論層レベル (Phase 4b) */
1223
1273
  type ReasoningLayer = 'layer1_elimination' | 'layer2_naked_pair' | 'layer2_hidden_single' | 'layer2_pointing_pair' | 'layer3_backtrack';
@@ -1313,6 +1363,93 @@ declare function getReasoningTrace(space: AgentSpace): ReasoningTrace[];
1313
1363
  */
1314
1364
  declare function getMatchAnalysis(space: AgentSpace): MatchAnalysis;
1315
1365
 
1366
+ /**
1367
+ * sigma-reactive.ts — 6属性相互反応エンジン
1368
+ *
1369
+ * 6属性が互いに影響し合う「生きた系」を実現する。
1370
+ *
1371
+ * カスケード連鎖:
1372
+ * relation → will: 関係の変化が意志を揺らす
1373
+ * will → flow: 意志の変化がflowの位相を変える
1374
+ * flow → memory: 位相遷移が記憶に自動記録される
1375
+ * memory → layer: 記憶の蓄積が層の深度を変える
1376
+ * layer → relation: 層の深化が関係の影響範囲を広げる
1377
+ *
1378
+ * @author Nobuki Fujimoto (D-FUMT)
1379
+ * @version 0.5.3
1380
+ */
1381
+
1382
+ /** 単一の属性変化 */
1383
+ interface AttributeReaction {
1384
+ attribute: 'field' | 'flow' | 'memory' | 'layer' | 'relation' | 'will';
1385
+ trigger: string;
1386
+ before: any;
1387
+ after: any;
1388
+ reason: string;
1389
+ }
1390
+ /** カスケード全体の結果 */
1391
+ interface CascadeResult {
1392
+ reiType: 'CascadeResult';
1393
+ reactions: AttributeReaction[];
1394
+ depth: number;
1395
+ stable: boolean;
1396
+ pulse: number;
1397
+ }
1398
+ /**
1399
+ * 関係の変化が意志に与える影響
1400
+ * - 新しいbindが生まれると、意志のstrengthが微増する(つながりが意志を強める)
1401
+ * - entangleが生まれると、tendencyが相手の方向に引き寄せられる
1402
+ * - 孤立(isolated)なら意志は弱まる
1403
+ */
1404
+ declare function reactRelationToWill(meta: DeepSigmaMeta, event: 'bind' | 'entangle' | 'unbind', partnerTendency?: string): AttributeReaction | null;
1405
+ /**
1406
+ * 意志の変化がflowに与える影響
1407
+ * - conflict(高tension) → flow.phase = 'reversing'
1408
+ * - align(高harmony) → flow.phase = 'steady'
1409
+ * - evolve(strength増) → flow.phase = 'accelerating'
1410
+ * - 意志の弱化 → flow.phase = 'decelerating'
1411
+ */
1412
+ declare function reactWillToFlow(meta: DeepSigmaMeta, event: 'evolve' | 'align' | 'conflict' | 'weaken', intensity?: number): AttributeReaction | null;
1413
+ /**
1414
+ * flowの位相変化を記憶に自動記録
1415
+ * - 位相遷移はSigmaMemoryEntryとして構造化記録される
1416
+ * - 記憶は「忘却不能」— 一度記録されたら消えない
1417
+ */
1418
+ declare function reactFlowToMemory(meta: DeepSigmaMeta, phaseTransition: {
1419
+ from: FlowPhase;
1420
+ to: FlowPhase;
1421
+ velocity: number;
1422
+ }, cause: string): AttributeReaction;
1423
+ /**
1424
+ * 記憶の蓄積が層構造に与える影響
1425
+ * - 記憶5件以上 → depth 2, structure 'nested'
1426
+ * - 記憶10件以上 → depth 3, structure 'recursive'
1427
+ * - 記憶20件以上 → depth 4, structure 'fractal'
1428
+ */
1429
+ declare function reactMemoryToLayer(meta: DeepSigmaMeta): AttributeReaction | null;
1430
+ /**
1431
+ * 層の深化が関係に与える影響
1432
+ * - 深い層は、より遠い依存関係を「見る」ことができる
1433
+ * - depth 2以上 → 影響範囲拡大
1434
+ * - depth 3以上 → entanglementの共鳴強化
1435
+ */
1436
+ declare function reactLayerToRelation(meta: DeepSigmaMeta, depthBefore: number, depthAfter: number): AttributeReaction | null;
1437
+ /**
1438
+ * 関係変化からのフルカスケード
1439
+ * relation → will → flow → memory → layer → relation
1440
+ */
1441
+ declare function cascadeFromRelation(meta: DeepSigmaMeta, event: 'bind' | 'entangle' | 'unbind', partnerTendency?: string): CascadeResult;
1442
+ /**
1443
+ * 意志変化からのカスケード
1444
+ * will → flow → memory → layer → relation
1445
+ */
1446
+ declare function cascadeFromWill(meta: DeepSigmaMeta, event: 'evolve' | 'align' | 'conflict', intensity?: number): CascadeResult;
1447
+ /**
1448
+ * 脈動(pulse) — 明示的にフルカスケードを実行
1449
+ * 全属性の現在状態を基に、安定するまでカスケードを繰り返す
1450
+ */
1451
+ declare function pulse(meta: DeepSigmaMeta, maxPulses?: number): CascadeResult;
1452
+
1316
1453
  declare function reiFn(source: string): any;
1317
1454
  declare namespace reiFn {
1318
1455
  var reset: () => void;
@@ -1320,4 +1457,4 @@ declare namespace reiFn {
1320
1457
  }
1321
1458
  declare const rei: typeof reiFn;
1322
1459
 
1323
- export { AgentRegistry, type DeepSigmaMeta, type DeepSigmaResult, type EntanglementResult, Evaluator, type FlowPhase, type InfluenceResult, type LayerStructure, Lexer, type MemoryTrajectory, Parser, ReiAgent, ReiEventBus, ReiMediator, type RelationDependency, type RelationRole, type SigmaMemoryEntry, type TraceNode, type TraceResult, type WillAlignment, type WillConflict, type WillEvolution, agentSpaceRun, agentSpaceRunRound, alignWills, buildDeepSigmaResult, computeInfluence, createDeepSigmaMeta, createEntanglement, createGameAgentSpace, createPuzzleAgentSpace, detectWillConflict, evolveWill, formatAgentSpaceGame, formatAgentSpacePuzzle, getAgentSpaceGameState, getAgentSpaceGrid, getAgentSpaceSigma, getDifficultyAnalysis, getMatchAnalysis, getReasoningTrace, mergeRelationBindings, mergeWillIntention, rei, traceRelationChain, wrapWithDeepSigma };
1460
+ export { AgentRegistry, type AttributeReaction, type CascadeResult, type DeepSigmaMeta, type DeepSigmaResult, type EntanglementResult, Evaluator, type FlowPhase, type InfluenceResult, type LayerStructure, Lexer, type MemoryTrajectory, Parser, ReiAgent, ReiEventBus, ReiMediator, type RelationDependency, type RelationRole, type SigmaMemoryEntry, type TraceNode, type TraceResult, type WillAlignment, type WillConflict, type WillEvolution, agentSpaceRun, agentSpaceRunRound, alignWills, buildDeepSigmaResult, cascadeFromRelation, cascadeFromWill, computeInfluence, createDeepSigmaMeta, createEntanglement, createGameAgentSpace, createPuzzleAgentSpace, detectWillConflict, evolveWill, formatAgentSpaceGame, formatAgentSpacePuzzle, getAgentSpaceGameState, getAgentSpaceGrid, getAgentSpaceSigma, getDifficultyAnalysis, getMatchAnalysis, getReasoningTrace, mergeRelationBindings, mergeWillIntention, reactFlowToMemory, reactLayerToRelation, reactMemoryToLayer, reactRelationToWill, reactWillToFlow, rei, pulse as sigmaReactivePulse, traceRelationChain, wrapWithDeepSigma };