@nola-lang/console 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,173 @@
1
+ import type { AskKind, NolaIngestEnvelope, NolaIngestKind } from "@nola-lang/core";
2
+ /**
3
+ * One project — keyed by the config `project` name riding the envelopes
4
+ * (tracing model spec §1: the config string IS the identity; no minted ids).
5
+ * `name: null` is the `(no project)` bucket for project-less envelopes.
6
+ */
7
+ export interface ProjectSummary {
8
+ name: string | null;
9
+ firstSeenAt: number;
10
+ lastSeenAt: number;
11
+ traceCount: number;
12
+ }
13
+ export type RecordKind = "invocation" | AskKind;
14
+ /** Shared by every record in the flattened tree (records-view spec §5). */
15
+ export interface RecordBase {
16
+ /** invocationId for an invocation, askId for an ask */
17
+ id: string;
18
+ kind: RecordKind;
19
+ /** the root invocation's id */
20
+ traceId: string;
21
+ /** absent on a root invocation */
22
+ parentId?: string;
23
+ depth: number;
24
+ /** display label built server-side (labels.ts) — never identity */
25
+ label: string;
26
+ status: "running" | "ok" | "error";
27
+ startedAt: number;
28
+ durationMs?: number;
29
+ }
30
+ /** One infer-function call — a root (opened its own frame) or attached (called by a parent invocation). */
31
+ export interface InvocationRecord extends RecordBase {
32
+ kind: "invocation";
33
+ fn?: string;
34
+ file?: string;
35
+ detached: boolean;
36
+ project?: string;
37
+ runId: string;
38
+ pid: number;
39
+ completedAt?: number;
40
+ /** over the subtree */
41
+ askCount: number;
42
+ errorCount: number;
43
+ }
44
+ /** One ask execution — the extract or call as its askStart/askEnd described it. */
45
+ export interface AskRecord extends RecordBase {
46
+ kind: AskKind;
47
+ site?: string;
48
+ def?: string;
49
+ instruction?: string;
50
+ callee?: string;
51
+ hint?: string;
52
+ typeText?: string;
53
+ provider?: string;
54
+ profile?: string;
55
+ attempts?: number;
56
+ error?: string;
57
+ }
58
+ export type TraceRecord = InvocationRecord | AskRecord;
59
+ /** The subtree of one invocation: the node itself first, then every descendant in display order. */
60
+ export interface TraceDetail {
61
+ node: InvocationRecord;
62
+ records: TraceRecord[];
63
+ /** the invocationEnd span tree (InvocationTrace), verbatim, once a ROOT completed */
64
+ trace?: unknown;
65
+ }
66
+ /** One provider round trip, materialized from providerRequest/providerResponse pairs. */
67
+ export interface AttemptSummary {
68
+ attempt: number;
69
+ provider?: string;
70
+ at: number;
71
+ durationMs?: number;
72
+ /** 'failed' when a validationFailed event named this attempt; the final attempt of an ok ask implicitly passed */
73
+ validation?: "failed";
74
+ }
75
+ /** One ask as a definition's execution list shows it — assembled from askStart/askEnd events. */
76
+ export interface AskSummary {
77
+ askId: string;
78
+ /** the root invocation the ask belongs to (`spanPath[0]`, or the synthetic `run:<runId>` fallback) */
79
+ traceId: string;
80
+ /** the trace's process id — a filter attribute of the execution */
81
+ pid?: number;
82
+ /** compiler-stamped source identity — groups executions of the same authored ask */
83
+ def?: string;
84
+ /** what the ask executed; legacy rows without one read as extract */
85
+ kind?: AskKind;
86
+ /** "file:line:col" display text from the ask's Site. */
87
+ site?: string;
88
+ instruction?: string;
89
+ callee?: string;
90
+ hint?: string;
91
+ typeText?: string;
92
+ provider?: string;
93
+ profile?: string;
94
+ status: "running" | "ok" | "error";
95
+ startedAt: number;
96
+ durationMs?: number;
97
+ attempts?: number;
98
+ error?: string;
99
+ }
100
+ /** One stored hook event belonging to an ask, ordered by the sender's seq. */
101
+ export interface AskEventRow {
102
+ seq: number;
103
+ at: number;
104
+ kind: NolaIngestKind;
105
+ event: unknown;
106
+ }
107
+ /** One link of the owning invocation chain, root first. */
108
+ export interface InvocationLink {
109
+ invocationId: string;
110
+ fn?: string;
111
+ depth: number;
112
+ }
113
+ /** The ask-detail view: the summary plus attempts, the receipt, every event, and the owning chain. */
114
+ export interface AskDetail extends AskSummary {
115
+ attemptRows: AttemptSummary[];
116
+ receipt?: unknown;
117
+ events: AskEventRow[];
118
+ invocationChain: InvocationLink[];
119
+ }
120
+ /**
121
+ * One AskDefinition — the static ask construct in source, identified by the
122
+ * compiler-stamped `def` hash (AskDefinition spec §2). Stats are computed by
123
+ * query over the asks, never stored.
124
+ */
125
+ export interface DefinitionSummary {
126
+ def: string;
127
+ project?: string;
128
+ /** last-seen kind */
129
+ kind?: AskKind;
130
+ file?: string;
131
+ /** last-seen "line:col" — display only; the identity excludes positions */
132
+ loc?: string;
133
+ /** last-seen instruction label */
134
+ instruction?: string;
135
+ firstSeenAt: number;
136
+ lastSeenAt: number;
137
+ executions: number;
138
+ okCount: number;
139
+ errorCount: number;
140
+ avgDurationMs?: number;
141
+ p95DurationMs?: number;
142
+ avgAttempts?: number;
143
+ providers: string[];
144
+ }
145
+ /** The definition drill-down: the stats plus recent executions (newest first). */
146
+ export interface DefinitionDetail extends DefinitionSummary {
147
+ asks: AskSummary[];
148
+ }
149
+ export interface RecordsQuery {
150
+ project?: string;
151
+ noProject?: boolean;
152
+ runId?: string;
153
+ /** counts ROOTS; every returned root's subtree is complete */
154
+ limit?: number;
155
+ }
156
+ /** Replaceable persistence seam (console design §13) — SQLite locally, others later. */
157
+ export interface ConsoleStorage {
158
+ ingest(envelope: NolaIngestEnvelope): Promise<void>;
159
+ listProjects(): Promise<ProjectSummary[]>;
160
+ /** the flattened tree in display order: roots newest first, children in start order beneath each */
161
+ listRecords(query?: RecordsQuery): Promise<TraceRecord[]>;
162
+ getTrace(invocationId: string): Promise<TraceDetail | undefined>;
163
+ getAsk(askId: string): Promise<AskDetail | undefined>;
164
+ listDefinitions(query?: {
165
+ project?: string;
166
+ noProject?: boolean;
167
+ }): Promise<DefinitionSummary[]>;
168
+ getDefinition(def: string): Promise<DefinitionDetail | undefined>;
169
+ /** Delete everything — every project, invocation, ask, definition, attempt and event. */
170
+ clear(): Promise<void>;
171
+ close(): Promise<void>;
172
+ }
173
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/storage/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,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