Initialize project structure with core files, environment settings, and basic configurations
Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
76
charactergarden/app/src/types.ts
Normal file
76
charactergarden/app/src/types.ts
Normal file
@@ -0,0 +1,76 @@
|
||||
// Core contracts — DO NOT modify without updating project.md
|
||||
|
||||
// ── Section 2.1 ─────────────────────────────────────────────
|
||||
export interface Entity {
|
||||
id: string;
|
||||
type: string;
|
||||
name: string;
|
||||
attributes: Record<string, unknown>;
|
||||
}
|
||||
|
||||
// ── Section 2.2 ─────────────────────────────────────────────
|
||||
export const ALLOWED_VERBS = [
|
||||
"move",
|
||||
"open",
|
||||
"close",
|
||||
"take",
|
||||
"drop",
|
||||
"use",
|
||||
"inspect",
|
||||
"speak",
|
||||
] as const;
|
||||
|
||||
export type Verb = (typeof ALLOWED_VERBS)[number];
|
||||
|
||||
export interface Action {
|
||||
actor: string; // entity id
|
||||
verb: Verb;
|
||||
target?: string; // entity id
|
||||
params?: Record<string, unknown>;
|
||||
}
|
||||
|
||||
// ── Section 2.3 ─────────────────────────────────────────────
|
||||
export interface ValidationResult {
|
||||
accepted: Action[];
|
||||
rejected: { action: Action; reason: string }[];
|
||||
state_changes: StateChange[];
|
||||
}
|
||||
|
||||
// ── Section 2.4 ─────────────────────────────────────────────
|
||||
export interface StateChange {
|
||||
entity_id: string;
|
||||
field: string;
|
||||
old_value: unknown;
|
||||
new_value: unknown;
|
||||
}
|
||||
|
||||
// ── Section 2.5 ─────────────────────────────────────────────
|
||||
export interface GameEvent {
|
||||
id: string;
|
||||
turn: number;
|
||||
action: Action;
|
||||
result: "success" | "fail";
|
||||
timestamp: number;
|
||||
}
|
||||
|
||||
// ── Section 4 — Memory types ─────────────────────────────────
|
||||
export interface Turn {
|
||||
id: string;
|
||||
turn: number;
|
||||
input: string;
|
||||
output: string;
|
||||
timestamp: number;
|
||||
}
|
||||
|
||||
export interface Belief {
|
||||
entity_id: string;
|
||||
claim: string;
|
||||
confidence: number;
|
||||
}
|
||||
|
||||
export interface Summary {
|
||||
id: string;
|
||||
turn_range: [number, number];
|
||||
text: string;
|
||||
timestamp: number;
|
||||
}
|
||||
Reference in New Issue
Block a user