51 lines
4.2 KiB
JavaScript
51 lines
4.2 KiB
JavaScript
// web/shapes.mjs -- the SPA's wire shapes: the REST responses the
|
|
// views consume. No runtime code: like server/shapes.mjs, this module
|
|
// exists so the tsc checker (JSDoc mode, no emit) and the humans
|
|
// reading the code agree on the load-bearing shapes. The server's own
|
|
// shared shapes (User, LogEvent, JobState, RunMeta) are imported from
|
|
// ../server/shapes.mjs at their use sites -- the API response
|
|
// envelopes live here because main.mjs's handlers build them as
|
|
// untyped literals; the smoke owns their behavioral truth.
|
|
export {};
|
|
|
|
/** One run card as GET /runs serves it (the clerk's listing,
|
|
* enriched by the server with the live-session state). fill is
|
|
* present exactly when the run is initialized. */
|
|
/** @typedef {{ id: string, package: string, models: ?{ player?: ?string, housekeeper?: ?string }, owner: ?string, ownerName: ?string, created: ?string, forked: ?number, pc: ?string, display: string, sessions: number, phase: ?string, ready: ?boolean, initialized: boolean, fill?: { a: number, b: number, cold: number }, open: boolean, session: ?number, pendingAsk: ?string }} RunCard */
|
|
|
|
/** GET /runs/:id -- the run detail: identity, the phase bookkeeping,
|
|
* her two blocks, the fill, the context meter's numbers.
|
|
* paramDefaults is the knobs' deployment layer (server.json params)
|
|
* -- the only default an unset knob honestly resolves to. */
|
|
/** @typedef {{ run: { id: string, package: ?string, created: ?string, forked: ?number, owner: ?string, ownerName: ?string, models: { player?: ?string, housekeeper?: ?string }, params: { player?: ?import('../server/shapes.mjs').RoleParams, housekeeper?: ?import('../server/shapes.mjs').RoleParams }, modelDefaults: { player?: ?string, housekeeper?: ?string }, paramDefaults: { player?: ?import('../server/shapes.mjs').RoleParams, housekeeper?: ?import('../server/shapes.mjs').RoleParams } }, display: string, open: boolean, phase: ?string, session: ?number, sessions: number, draft: boolean, ready: ?boolean, status: string[], agenda: string[], sheet: ?Record<string, unknown>, records: number, fill: Record<string, number>, events: number, pendingAsk: ?string, usage: ?{ promptTokens: number, completionTokens: number }, context: ?{ used: number, contwin: ?boolean, pct: ?number } }} RunDetail */
|
|
|
|
/** GET /api/models -- the deployment's model registry and the
|
|
* discovery job state riding along. phase 'none' is the fresh
|
|
* deployment: nothing is selectable until the op discovers. */
|
|
/** @typedef {{ phase: 'none'|'preliminary'|'refined', discovered: ?string, refined: ?string, curator: ?string, defaults: { player?: ?string, housekeeper?: ?string }, models: import('../server/shapes.mjs').RegistryModel[], job: ?import('../server/shapes.mjs').JobState }} ModelsRegistryResponse */
|
|
|
|
/** GET /runs/:id/table -- the live session's projection (thinking
|
|
* never crosses the wire, variant turns carry only the picked one). */
|
|
/** @typedef {{ run: string, session: number, entries: import('../server/shapes.mjs').LogEvent[], pendingAsk: ?string }} TableResponse */
|
|
|
|
/** GET /runs/:id/carryover -- the dormant session's opening material,
|
|
* projected like the table; ends decides the opening flow. */
|
|
/** @typedef {{ run: string, session: number, ready: boolean, entries: import('../server/shapes.mjs').LogEvent[], ends: ?('gm'|'player') }} CarryoverResponse */
|
|
|
|
/** GET /runs/:id/story -- the whole deliverable, read-only: every
|
|
* non-dropped literature turn, across all sessions in order. */
|
|
/** @typedef {{ run: string, display: string, owner: ?string, ownerName: ?string, sessions: { session: number, turns: { who: string, text: string }[] }[] }} StoryResponse */
|
|
|
|
/** GET /api/runs/:id/files -- the editor surface: a fixed whitelist,
|
|
* each file with its phase-truth mode. */
|
|
/** @typedef {{ session: number, phase: ?string, files: Record<string, { mode: string, exists: boolean, content?: string }> }} FilesResponse */
|
|
|
|
/** GET /api/prompts -- the repo-fed prompts, read-only context. */
|
|
/** @typedef {{ system: ?string, invariants: ?string, reminder: ?string }} PromptsResponse */
|
|
|
|
/** GET /api/runs/:id/notes -- the GM's notepad. */
|
|
/** @typedef {{ content: string }} NotesResponse */
|
|
|
|
/** GET /api/runs/:id/housekeeping/log -- the latest apply log. */
|
|
/** @typedef {{ content: string }} HousekeepingLogResponse */
|