snapkitty
hardware
erlang
File size: 1,267 Bytes
b8a03fa
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
// Shadow Orchestrator — State Interface v1
// CONSTITUTION: No implementation here. Contracts only.

export interface IState_v1 {
  /** Unique ID for this state snapshot */
  readonly id: string;

  /** Tick index — monotonically increasing, never resets */
  readonly tick: number;

  /** ISO timestamp of this state */
  readonly timestamp: string;

  /** The actual state payload — shape defined by the target system */
  readonly data: Record<string, unknown>;

  /** SHA-256 of previous state (genesis = "SHADOW_GENESIS") */
  readonly parentSeal: string;

  /** History of reasoning steps attached to this state */
  getHistory(): ReadonlyArray<IReasoningStep>;

  /** Produce next state from an action — does not mutate */
  transition(action: IAction): IState_v1;

  /** Compute SHA-256 seal of this state for WORM chain */
  seal(): string;
}

export interface IReasoningStep {
  readonly stepId: string;
  readonly tick: number;
  readonly agentId: string;
  readonly input: unknown;
  readonly output: unknown;
  readonly proofObligation?: string;
  readonly satisfied: boolean;
}

export interface IAction {
  readonly actionId: string;
  readonly agentId: string;
  readonly type: string;
  readonly payload: unknown;
  readonly tick: number;
}