File size: 1,332 Bytes
39b3fb5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
export type VmTarget = "apl-wasm" | "rust" | "python" | "wasm" | "docker";
export type IdeTarget = "vscode" | "neovim" | "jetbrains" | "none";
export type TaskStatus = "queued" | "blocked" | "running" | "succeeded" | "failed";

export type EntropyInput = {
  dependencies: string[];
  failRate: number;
  latencyMs: number;
};

export type KittyAgentContext = {
  id: string;
  label: string;
  url: string;
  memory: Record<string, unknown>;
  vmTarget: VmTarget;
  ideTarget: IdeTarget;
  entropy: number;
  createdAt: string;
};

export type TaskRequest = EntropyInput & {
  id: string;
  contextId: string;
  command: string;
  payload: Record<string, unknown>;
  vmTarget: VmTarget;
  ideTarget: IdeTarget;
};

export type TaskEnvelope = {
  subject: string;
  issuedAt: string;
  task: TaskRequest;
  signature?: string;
};

export type TaskResult = {
  id: string;
  contextId: string;
  status: TaskStatus;
  entropy: number;
  message: string;
  output: Record<string, unknown>;
  completedAt?: string;
};

export type RuntimeSnapshot = {
  mesh: "nats" | "local";
  contexts: KittyAgentContext[];
  results: TaskResult[];
};

export const TOPICS = {
  TASK_RUN: "kitty.task.run",
  TASK_RESULT: "kitty.task.result",
  AGENT_STATE: "kitty.agent.state",
} as const;