Something went wrong. Try again.
a digital entity named phi that roams bsky phi.zzstoatzz.io
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497// Shape mirrors phi's PDS record schemas + bot API responses.// Keep in sync with bot/src/bot/core/goals.py and the json// returned by /api/* endpoints.
// --- PDS records ---
export interface Goal { rkey: string; title: string; description: string; progress_signal: string; created_at: string; updated_at: string;}
export interface BlogDoc { rkey: string; title: string; content: string; tags: string[]; publishedAt: string; url: string; // greengale.app URL}
// --- /api/activity (existing endpoint, mixed feed) ---
export type ActivityType = 'post' | 'note' | 'url';
export interface ActivityItem { type: ActivityType; text: string; title?: string | null; time: string; uri: string; url?: string | null;}
// --- a person in the logbook ---
export interface GraphNode { id: string; label: string; type: 'phi' | 'user'; x: number | null; y: number | null;}
// --- discovery pool (hub /api/agents/discovery-pool) ---
export interface DiscoveryPost { uri: string; text: string; liked_at: string;}
export interface DiscoveryEntry { handle: string; did: string; likes_in_window: number; last_liked_at: string; sample_posts: DiscoveryPost[];}
// --- /health ---
export interface HealthInfo { status: string; polling_active: boolean; paused: boolean; last_tick_age_s: number | null; reason: string | null; models_unavailable?: { model: string; reason: string; since: string }[];}
// --- /api/abilities ---
export interface Capability { name: string; description: string; operator_only: boolean;}
// --- /api/skills ---
export interface Skill { name: string; description: string; resources: string[];}
// --- /api/users/{handle} ---
export interface UserViewObservation { content: string; tags: string[]; created_at: string | null; source_uris: string[];}
export interface UserViewSummary { content: string; created_at: string | null; recalled: boolean;}
export interface UserView { handle: string; did: string | null; is_stranger: boolean; counts: { observation: number; interaction: number; summary: number; }; first_seen: string | null; last_seen: string | null; summary: UserViewSummary | null; recent_observations: UserViewObservation[]; recent_interactions?: UserViewInteraction[] | null;}
export interface UserViewInteraction { id: string; content: string; created_at: string | null; source_uris: string[];}
// --- bsky public API minimal types (used by feed/blog) ---
export interface BskyAuthor { did: string; handle: string; displayName?: string; avatar?: string;}
export interface BskyPostRecord { text: string; createdAt: string; reply?: { parent: { uri: string; cid: string }; root: { uri: string; cid: string } }; facets?: unknown[]; embed?: unknown;}
export interface BskyPost { uri: string; cid: string; author: BskyAuthor; record: BskyPostRecord; indexedAt: string; likeCount?: number; replyCount?: number; repostCount?: number;}
export interface BskyFeedItem { post: BskyPost; reply?: { parent?: { author?: BskyAuthor; record?: BskyPostRecord; uri?: string } };}
// --- /api/docket (daily promotion object) ---
export interface DocketEvidenceRef { atlas_point_id: string; kind: string; snippet: string;}
export interface DocketAnchorRef { at_uri: string; kind: string; snippet: string;}
export interface DocketCandidate { id: string; title: string; rationale: string; private_evidence: DocketEvidenceRef[]; existing_public_anchors: DocketAnchorRef[]; related_tags: string[]; // knownValues-style — not a closed enum; the bot may emit new strings as // the rubric evolves. Renderer falls back to a neutral badge. suggested_shape: string; atlas_cluster_fine: number; atlas_cluster_coarse: number;}
export interface Docket { generated_at: string; atlas_record_cid: string; atlas_point_count: number; candidates: DocketCandidate[];}
// --- /api/atlas ---
export interface AtlasCluster { id: number; label?: string; count?: number; x?: number; y?: number; kind_counts?: Record<string, number>; parent_coarse?: number | null; [key: string]: unknown;}
export interface Atlas { generated_at: string; points: { id?: string; kind?: string; label?: string; x?: number; y?: number; layer?: string; promotion_status?: string; created_at?: string; updated_at?: string; memory_status?: string; supersedes?: string; cluster_coarse?: number; cluster_fine?: number; tags?: string[]; [key: string]: unknown; }[]; clusters_coarse: AtlasCluster[]; clusters_fine: AtlasCluster[];}
// --- cockpit / hud ---
/** * AtlasPoint is the unifying primitive across the mind lens. Every "object of * phi's attention" — concept-shaped (goal) and people-shaped (engaged, * candidate) — becomes a point with a kind, a position, and a payload that * becomes the logbook entry on click. */export type AtlasKind = | 'phi' | 'handle-engaged' | 'handle-candidate' | 'goal';
export interface AtlasPoint { id: string; kind: AtlasKind; label: string; // 1-line for hover readout x: number; // normalized -1..1 (canvas scales) y: number; // normalized -1..1 avatar?: string | null; payload: unknown; // pulled from the underlying record; logbook renders it}
/** * Logbook entries are what slide in from the right when you click a thing. * The kind drives the renderer; the payload is the matching record shape. */export type LogbookEntry = | { kind: 'handle'; handle: string; did?: string; engaged: boolean; payload: unknown } | { kind: 'goal'; goal: Goal } | { kind: 'docket'; candidate: DocketCandidate } | { kind: 'docket-list'; docket: Docket } | { kind: 'store'; store: 'pds' | 'memory' | 'atlas'; goals?: Goal[]; known?: GraphNode[]; atlas?: Atlas | null; } | { kind: 'activity'; item: ActivityItem } | { kind: 'blog'; doc: BlogDoc } | { kind: 'discovery'; entry: DiscoveryEntry };
// --- top chicken market (external: topchicken.cee.wtf) ---//// phi trades the play-money prediction market on the daily Top Chicken game.// all money fields are integer subcents (10000 subc = $1). trades are public// records; the trader endpoint is public, keyed by DID.
export interface ChickenTrade { ts: number; // unix seconds round_id: string; // "2026-07-07" — the UTC day the round is named for contender_did: string; contender_handle: string; side: 'buy' | 'sell'; shares: number; price_subc: number; total_subc: number; source: string;}
export interface ChickenPosition { round_id?: string; round?: string; contender_did?: string; contender_handle?: string; shares?: number; avg_price_subc?: number; cost_subc?: number; value_subc?: number; unrealized_subc?: number;}
export interface ChickenTrader { did: string; handle: string; balance_subc: number; networth_subc: number; pnl_subc: number; positions: ChickenPosition[]; trades: ChickenTrade[]; networth_series: [number, number][]; // [unix seconds, networth subc] season_start: number; past_seasons: ChickenPastSeason[];}
export interface ChickenContender { did: string; handle: string; likes: number; p: number | null; mid_subc: number | null; bid_subc: number | null; ask_subc: number | null;}
export interface ChickenRound { id: string; status: string; contenders: ChickenContender[];}
export interface ChickenResultRound { id: string; status: string; winner_did: string; winner_handle: string; winner_likes: number;}
// --- prompt cache stability (/api/cache) ---//// the provider's own verdict on whether phi's cacheable prefix held. see// bot/core/cache_stability.py for what each field means.
export interface CacheSample { at: string; model: string; provider: string; input_tokens: number; cache_read: number; cache_write: number; gap_seconds: number | null; collapsed: boolean; maybe_expiry: boolean;}
export interface CacheRun { label: string; started_at: string; trace_id: string | null; trace_url: string | null; requests: number; cache_read: number; cache_write: number; uncached: number; hit_rate: number; saved: number | null; collapses: number; warm_start: boolean; samples: CacheSample[];}
export interface CacheStability { // the live TTLs, read from the same dict agent.py configures from strategy: Record<string, string> | null; // input-token prices as multiples of the base rate prices: { read: number; write: number; uncached: number } | null; window_runs: number; cache_read: number; cache_write: number; uncached: number; hit_rate: number; billed_tokens: number | null; uncached_cost_tokens: number; saved: number | null; collapses: number; warm_starts: number; runs: CacheRun[];}
// --- /diagnostic: next-run context preview ---
export interface ContextBlock { name: string; text: string; chars: number; ms: number; error: string | null;}
export interface ContextPreview { generated_at: string; path: string; total_chars: number; blocks: ContextBlock[];}
// --- /api/context/budget: the next run's context, weighed against the window ---
export type ContextSectionKind = 'static' | 'block' | 'tool';
export interface ContextSection { kind: ContextSectionKind; name: string; chars: number; tokens: number; ms: number; error: string | null; // 'function' | 'skills' | 'mcp:<prefix>' for tools; empty for prompt sections origin: string;}
export interface ContextModelLimits { spec: string; provider: string; name: string; // null when the catalog does not list the model — render "unknown", never a guess max_input_tokens: number | null; max_output_tokens: number | null; input_cost_per_token: number | null; output_cost_per_token: number | null; cache_read_cost_per_token: number | null; cache_write_cost_per_token: number | null; source: string;}
export interface ContextRequestUsage { input_tokens: number; cache_read: number; cache_write: number; billed_prefix: number;}
export interface ContextLastRun { label: string; started_at: string; model: string; trace_url: string | null; requests: ContextRequestUsage[];}
// request sizes the provider reported over the recent runs — measured, not composedexport interface ContextRecentRequests { runs: number; requests: number; first_mean: number; first_max: number; p50: number; p90: number; max: number;}
export interface ContextBudget { generated_at: string; path: string; model: ContextModelLimits; counting: 'exact' | 'estimated'; sections: ContextSection[]; totals: { static: number; blocks: number; tools: number; prompt: number }; recent: ContextRecentRequests | null; last_run: ContextLastRun | null;}
export interface ChickenPastSeason { season: number; pnl_subc: number; rank: number; trades: number; networth_subc: number;}export interface ChickenMarket { season: { num: number; day: number; total_days: number; start_round: string; end_round: string; settling: boolean; ends_at: number; }; round: ChickenRound | null;}