Intelligence
Artifacts
Browse the repository, read documents, and manage the governance folders. Source, runtime, and infrastructure are read-only.
Repository
repositories/aaf-holdings/hq01/lib/missions/types.ts
10.5 KB
/**
* Types for the HQ01 Mission Registry (PASS M0).
*
* A Mission is the highest operational object (CANONICAL_MISSION_OS_DOCTRINE):
* everything executed attaches to exactly one Mission. This pass implements the
* Mission object, its registry, and its history only — not objectives, work
* orders, assignments, or workers.
*/
export type MissionStatus =
| "Draft"
| "Proposed"
| "Approved"
| "Planning"
| "Active"
| "Blocked"
| "Review"
| "Completed"
| "Archived"
| "Cancelled";
export type MissionPriority = "P0" | "P1" | "P2" | "P3";
export interface Mission {
id: string; // MISSION-000001
title: string;
description: string;
organization: string;
company: string | null;
product: string;
repository: string;
executive_owner: string | null;
status: MissionStatus;
priority: MissionPriority;
created_at: string;
updated_at: string;
}
export type MissionEventType =
| "mission_created"
| "mission_updated"
| "executive_assigned"
| "state_changed"
| "dispatch_started"
| "dispatch_completed"
| "report_added";
export interface MissionEvent {
type: MissionEventType;
at: string;
detail?: string;
by?: string;
session_id?: string;
report_id?: string;
// state_changed events:
previous_state?: MissionStatus;
new_state?: MissionStatus;
actor?: string;
reason?: string;
}
export interface MissionReport {
id: string; // filename without extension (the session id)
file: string; // filename
session_id: string | null;
stored_at: string;
size: number;
}
export interface CreateMissionInput {
title: string;
description: string;
product: string;
repository: string;
executive_owner: string;
priority: MissionPriority;
company?: string | null;
organization?: string;
}
export interface UpdateMissionInput {
title?: string;
description?: string;
product?: string;
repository?: string;
executive_owner?: string | null;
priority?: MissionPriority;
status?: MissionStatus;
company?: string | null;
}
/** A mission plus its derived history and stored reports. */
export interface MissionView {
mission: Mission;
history: MissionEvent[];
reports: MissionReport[];
}
// ---------------------------------------------------------------------------
// Objectives (PASS M2) — measurable outcomes a mission owns. Not work orders,
// not assignments, not tasks. Objectives organize future execution only.
// ---------------------------------------------------------------------------
export type ObjectiveStatus =
| "Draft"
| "Planned"
| "Active"
| "Blocked"
| "Completed"
| "Cancelled"
| "Archived";
export interface Objective {
id: string; // OBJECTIVE-000001 (sequential within its mission)
title: string;
description: string;
mission_id: string;
owner_executive: string | null;
status: ObjectiveStatus;
priority: MissionPriority;
success_criteria: string[];
completion_percentage: number;
created_at: string;
updated_at: string;
}
export type ObjectiveEventType =
| "objective_created"
| "objective_updated"
| "state_changed"
| "executive_changed";
export interface ObjectiveEvent {
type: ObjectiveEventType;
at: string;
detail?: string;
actor?: string;
reason?: string;
previous_state?: ObjectiveStatus;
new_state?: ObjectiveStatus;
}
export interface CreateObjectiveInput {
title: string;
description: string;
owner_executive: string;
priority: MissionPriority;
success_criteria?: string[];
}
export interface UpdateObjectiveInput {
title?: string;
description?: string;
owner_executive?: string | null;
priority?: MissionPriority;
success_criteria?: string[];
completion_percentage?: number;
}
export interface ObjectiveView {
objective: Objective;
history: ObjectiveEvent[];
}
/** Mission progress over its active (non-cancelled, non-archived) objectives. */
export interface MissionProgress {
total: number;
completed: number;
percentage: number;
}
// ---------------------------------------------------------------------------
// Execution chain (PASS M3): Objective → Work Order → Assignment → Execution
// Context → (Session placeholder). No workers, no worker templates, no
// intelligence — just the governed organizational chain.
// ---------------------------------------------------------------------------
export type WorkOrderStatus =
| "Draft"
| "Planned"
| "Active"
| "Blocked"
| "Completed"
| "Cancelled"
| "Archived";
export interface WorkOrder {
id: string; // WORKORDER-000001
mission_id: string;
objective_id: string;
title: string;
description: string;
owner_executive: string | null;
priority: MissionPriority;
status: WorkOrderStatus;
created_at: string;
updated_at: string;
}
export type AssignmentStatus =
| "Pending"
| "Dispatched"
| "Completed"
| "Failed"
| "Cancelled";
/** Lightweight reference to a dispatched session (placeholder — no worker logic). */
export interface SessionRef {
session_id: string;
assignment_id: string;
executive: string;
status: string;
report_path: string | null;
}
export interface Assignment {
id: string; // ASSIGNMENT-000001
mission_id: string;
objective_id: string;
work_order_id: string;
executive: string;
/** Worker template instantiated for this assignment (PASS M7). */
worker_template: string | null;
/** The current/last worker instance instantiated for this assignment. */
worker_instance_id: string | null;
repository: string;
workspace: string;
status: AssignmentStatus;
priority: MissionPriority;
created_at: string;
updated_at: string;
session: SessionRef | null;
}
/** Immutable frame generated for every assignment. */
export interface ExecutionContext {
organization: string;
company: string | null;
product: string;
repository: string;
mission_id: string;
objective_id: string;
work_order_id: string;
assignment_id: string;
executive: string;
workspace: string;
allowed_paths: string[];
expected_outputs: string[];
success_criteria: string[];
report_location: string;
runtime_root: string;
created_at: string;
}
export type ExecChainEventType =
| "work_order_created"
| "work_order_updated"
| "state_changed"
| "assignment_created"
| "execution_context_created"
| "dispatch_started"
| "dispatch_completed";
export interface ExecChainEvent {
type: ExecChainEventType;
at: string;
detail?: string;
actor?: string;
session_id?: string;
previous_state?: string;
new_state?: string;
}
export interface CreateWorkOrderInput {
objective_id: string;
title: string;
description: string;
owner_executive: string;
priority: MissionPriority;
}
export interface CreateAssignmentInput {
work_order_id: string;
executive: string;
repository?: string;
}
export interface WorkOrderView {
work_order: WorkOrder;
history: ExecChainEvent[];
}
export interface AssignmentView {
assignment: Assignment;
execution_context: ExecutionContext | null;
history: ExecChainEvent[];
}
// ---------------------------------------------------------------------------
// Reports (PASS M4) — immutable, fully-traceable evidence. Not Hermes/Honcho/
// MemPalace; the evidence layer they will later consume.
// ---------------------------------------------------------------------------
export interface Report {
report_id: string; // REPORT-000001 (sequential within its assignment)
mission_id: string;
objective_id: string;
work_order_id: string;
assignment_id: string;
session_id: string;
executive: string;
repository: string;
workspace: string;
started_at: string | null;
completed_at: string | null;
status: string;
summary: string;
files_changed: string[];
files_created: string[];
commands_executed: string[];
artifacts_produced: string[];
recommendations: string[];
doctrine_candidates: string[];
next_pass: string;
created_at: string;
// --- Worker provenance (PASS M7) ---
worker_template_id: string | null;
worker_instance_id: string | null;
worker_version: string | null;
model_used: string | null;
execution_duration: string | null;
}
// ---------------------------------------------------------------------------
// Governance instruments (PASS M6) — the control layer. Records only; no
// intelligence, no automation, no automatic transitions.
// ---------------------------------------------------------------------------
export type GovernanceEventType = "created" | "updated" | "state_changed";
export interface GovernanceEvent {
type: GovernanceEventType;
at: string;
detail?: string;
previous?: string;
next?: string;
}
export type RiskSeverity = "Low" | "Medium" | "High" | "Critical";
export type RiskLikelihood = "Low" | "Medium" | "High";
export type RiskStatus = "Open" | "Mitigating" | "Resolved" | "Accepted" | "Closed";
export interface Risk {
id: string; // RISK-000001
mission_id: string;
title: string;
description: string;
severity: RiskSeverity;
likelihood: RiskLikelihood;
owner_executive: string | null;
status: RiskStatus;
mitigation: string;
created_at: string;
updated_at: string;
}
export interface Decision {
id: string; // DECISION-000001 (immutable)
mission_id: string;
title: string;
description: string;
decision: string;
rationale: string;
alternatives_considered: string[];
approved_by: string;
created_at: string;
}
export type DependencyType =
| "Mission"
| "Objective"
| "WorkOrder"
| "Assignment"
| "Asset"
| "External";
export type DependencyStatus = "Pending" | "Active" | "Resolved" | "Cancelled";
export interface Dependency {
id: string; // DEPENDENCY-000001
mission_id: string;
depends_on: string;
type: DependencyType;
status: DependencyStatus;
blocking: boolean;
description: string;
created_at: string;
updated_at: string;
}
export type KpiStatus = "On Track" | "At Risk" | "Off Track" | "Achieved";
export interface Kpi {
id: string; // KPI-000001
mission_id: string;
name: string;
description: string;
current_value: string;
target_value: string;
unit: string;
status: KpiStatus;
created_at: string;
updated_at: string;
}
export interface WithHistory<T> {
item: T;
history: GovernanceEvent[];
}
/** A reason a mission is eligible to be Blocked (governance, not automation). */
export interface BlockReason {
kind: "dependency" | "risk";
id: string;
detail: string;
}
/** A report with its raw markdown and full upward lineage. */
export interface ReportView {
report: Report;
markdown: string;
mission: Mission | null;
objective: Objective | null;
work_order: WorkOrder | null;
assignment: Assignment | null;
}
root · /srv/aaf