@moda-ai/cli 1.22.1 → 1.22.2
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.
- package/dist/cli-g8qs2tj9.js +9777 -0
- package/dist/cli-pwbvtes8.js +2312 -0
- package/dist/cli-qszcpda3.js +284 -0
- package/dist/cli.js +4775 -1159
- package/dist/index-6h0nc1r5.js +2765 -0
- package/dist/provision-j5gq8cvx.js +72 -0
- package/package.json +3 -2
- package/skills/integration/index.json +2 -2
- package/dist/agent-schemas.d.ts +0 -3
- package/dist/agent-schemas.js +0 -358
- package/dist/agent.d.ts +0 -5
- package/dist/agent.js +0 -477
- package/dist/analyst-tui.d.ts +0 -81
- package/dist/analyst-tui.js +0 -314
- package/dist/api-client.d.ts +0 -46
- package/dist/api-client.js +0 -120
- package/dist/ask-stream.d.ts +0 -146
- package/dist/ask-stream.js +0 -473
- package/dist/auth-storage.d.ts +0 -35
- package/dist/auth-storage.js +0 -159
- package/dist/auth.d.ts +0 -50
- package/dist/auth.js +0 -694
- package/dist/cli-session.d.ts +0 -26
- package/dist/cli-session.js +0 -169
- package/dist/cli.d.ts +0 -44
- package/dist/command-context.d.ts +0 -62
- package/dist/command-context.js +0 -57
- package/dist/command-registry.d.ts +0 -22
- package/dist/command-registry.js +0 -15
- package/dist/config.d.ts +0 -60
- package/dist/config.js +0 -110
- package/dist/doctor.d.ts +0 -79
- package/dist/doctor.js +0 -1182
- package/dist/errors.d.ts +0 -50
- package/dist/errors.js +0 -64
- package/dist/exit-funnel.d.ts +0 -14
- package/dist/exit-funnel.js +0 -53
- package/dist/harness-artifact-bodies.d.ts +0 -28
- package/dist/harness-artifact-bodies.js +0 -276
- package/dist/harness-candidates.d.ts +0 -77
- package/dist/harness-candidates.js +0 -482
- package/dist/harness-remote.d.ts +0 -135
- package/dist/harness-remote.js +0 -540
- package/dist/harness-report.d.ts +0 -145
- package/dist/harness-report.js +0 -1579
- package/dist/harness-sync-limits.d.ts +0 -8
- package/dist/harness-sync-limits.js +0 -21
- package/dist/harness.d.ts +0 -463
- package/dist/harness.js +0 -4009
- package/dist/init/index.d.ts +0 -78
- package/dist/init/index.js +0 -1442
- package/dist/init/mcp.d.ts +0 -2
- package/dist/init/mcp.js +0 -27
- package/dist/init/progress-board.d.ts +0 -80
- package/dist/init/progress-board.js +0 -225
- package/dist/init/rules.d.ts +0 -6
- package/dist/init/rules.js +0 -171
- package/dist/init/sdk-catalog.d.ts +0 -10
- package/dist/init/sdk-catalog.js +0 -80
- package/dist/init/sdk-guide.d.ts +0 -19
- package/dist/init/sdk-guide.js +0 -185
- package/dist/init/sdk-integration.d.ts +0 -53
- package/dist/init/sdk-integration.js +0 -835
- package/dist/init/sdk-protocol.d.ts +0 -135
- package/dist/init/sdk-protocol.js +0 -152
- package/dist/init/sdk-verification.d.ts +0 -27
- package/dist/init/sdk-verification.js +0 -123
- package/dist/init/tenant.d.ts +0 -67
- package/dist/init/tenant.js +0 -421
- package/dist/intelligence-schema.d.ts +0 -349
- package/dist/intelligence-schema.js +0 -174
- package/dist/keys.d.ts +0 -47
- package/dist/keys.js +0 -136
- package/dist/manifest.d.ts +0 -5
- package/dist/manifest.js +0 -114
- package/dist/markdown-terminal.d.ts +0 -49
- package/dist/markdown-terminal.js +0 -212
- package/dist/output.d.ts +0 -191
- package/dist/output.js +0 -624
- package/dist/production-intelligence.d.ts +0 -175
- package/dist/production-intelligence.js +0 -1430
- package/dist/profile-commands.d.ts +0 -10
- package/dist/profile-commands.js +0 -342
- package/dist/profiles.d.ts +0 -112
- package/dist/profiles.js +0 -573
- package/dist/prompts-ab.d.ts +0 -71
- package/dist/prompts-ab.js +0 -313
- package/dist/prompts-propose.d.ts +0 -15
- package/dist/prompts-propose.js +0 -212
- package/dist/prompts.d.ts +0 -58
- package/dist/prompts.js +0 -418
- package/dist/provision.d.ts +0 -28
- package/dist/provision.js +0 -104
- package/dist/redact.d.ts +0 -2
- package/dist/redact.js +0 -90
- package/dist/schemas.d.ts +0 -225
- package/dist/schemas.js +0 -126
- package/dist/skills-bundled.d.ts +0 -35
- package/dist/skills-bundled.js +0 -157
- package/dist/skills-manifest.d.ts +0 -33
- package/dist/skills-manifest.js +0 -244
- package/dist/skills.d.ts +0 -57
- package/dist/skills.js +0 -783
- package/dist/sync.d.ts +0 -5
- package/dist/sync.js +0 -36
- package/dist/telemetry.d.ts +0 -56
- package/dist/telemetry.js +0 -167
- package/dist/transforms.d.ts +0 -25
- package/dist/transforms.js +0 -102
- package/dist/tui.d.ts +0 -48
- package/dist/tui.js +0 -393
- package/dist/update-check.d.ts +0 -31
- package/dist/update-check.js +0 -141
- package/dist/workspace.d.ts +0 -12
- package/dist/workspace.js +0 -1294
|
@@ -1,349 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* moda.intelligence.v1 — the unified Moda intelligence wire format (MODA-388).
|
|
3
|
-
*
|
|
4
|
-
* ONE versioned payload that every surface projects from:
|
|
5
|
-
* - CLI `moda ask --json` / `--agent` (the agent-facing contract),
|
|
6
|
-
* - the backend `POST /api/cli/ask` response,
|
|
7
|
-
* - the (future) MCP server's `structuredContent`,
|
|
8
|
-
* - the dashboard UI.
|
|
9
|
-
*
|
|
10
|
-
* Design rules:
|
|
11
|
-
* - snake_case everywhere (no mixed casing — the prior split between the
|
|
12
|
-
* snake_case envelope and the camelCase `production_ask.v0.1` data payload
|
|
13
|
-
* was the main source of agent-integration pain).
|
|
14
|
-
* - It is a SUPERSET. Differentiation between a human reader and an agent is a
|
|
15
|
-
* RENDERING concern at the edge, not a forked schema:
|
|
16
|
-
* · human projection → narrative `answer_markdown`, `summary.confidence`
|
|
17
|
-
* as a word, raw ids/anchors hidden.
|
|
18
|
-
* · agent projection → full `evidence_refs` (with `anchor` + `grounding`),
|
|
19
|
-
* `answer_claims` (claim → evidence), structured
|
|
20
|
-
* `next_commands`.
|
|
21
|
-
* - Additive evolution only within v1; breaking changes bump the version.
|
|
22
|
-
*
|
|
23
|
-
* This module is the SINGLE SOURCE OF TRUTH for the shape. The backend mirrors
|
|
24
|
-
* these field names on the wire and the contract tests validate real CLI output
|
|
25
|
-
* against {@link MODA_INTELLIGENCE_V1_JSON_SCHEMA}.
|
|
26
|
-
*/
|
|
27
|
-
export declare const INTELLIGENCE_SCHEMA_VERSION: "moda.intelligence.v1";
|
|
28
|
-
export type IntelligenceConfidence = 'high' | 'medium' | 'low' | 'unknown';
|
|
29
|
-
/** Where the answer came from. `local_fallback` ⇒ degraded (lower trust). */
|
|
30
|
-
export type IntelligenceSource = 'cloud' | 'local_fallback';
|
|
31
|
-
/** How a signal was derived — a measured fact vs a model/heuristic estimate. */
|
|
32
|
-
export type Provenance = 'measured' | 'inferred';
|
|
33
|
-
/** Whether a suggested command reads, writes, or syncs state. */
|
|
34
|
-
export type CommandMutability = 'read' | 'write' | 'sync' | 'unknown';
|
|
35
|
-
/** Classification of a single quantitative/factual claim in the answer. */
|
|
36
|
-
export type ClaimKind = 'percentage' | 'count' | 'qualitative';
|
|
37
|
-
/**
|
|
38
|
-
* Verdict for one claim made in the answer, checked against the structured tool
|
|
39
|
-
* data the agent actually saw (MODA-377/378). `unverifiable` means the claim is
|
|
40
|
-
* not a checkable figure (or there was no tool data to check it against).
|
|
41
|
-
*/
|
|
42
|
-
export type ClaimStatus = 'grounded' | 'ungrounded' | 'unverifiable';
|
|
43
|
-
export interface IntelligenceSummary {
|
|
44
|
-
text: string;
|
|
45
|
-
confidence: IntelligenceConfidence;
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* A structured locator so a surface can deep-link a piece of evidence. All
|
|
49
|
-
* fields optional — different evidence kinds populate different anchors.
|
|
50
|
-
*/
|
|
51
|
-
export interface EvidenceAnchor {
|
|
52
|
-
conversation_id?: string;
|
|
53
|
-
message_index?: number;
|
|
54
|
-
run_id?: string;
|
|
55
|
-
tool_name?: string;
|
|
56
|
-
}
|
|
57
|
-
export interface IntelligenceEvidenceRef {
|
|
58
|
-
/** Stable id, referenced by `findings[].evidence_ref_ids` and `answer_claims[].evidence_ref_ids`. */
|
|
59
|
-
id: string;
|
|
60
|
-
/** 'overview' | 'conversation' | 'message' | 'tool_failure' | 'run' | 'frustration' | 'cluster' | ... */
|
|
61
|
-
kind: string;
|
|
62
|
-
label: string;
|
|
63
|
-
anchor?: EvidenceAnchor;
|
|
64
|
-
/** Short human-readable excerpt of the underlying value. */
|
|
65
|
-
snippet?: string;
|
|
66
|
-
/** measured (exact) vs inferred (model-derived estimate) — MODA-379. */
|
|
67
|
-
grounding: Provenance;
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* A claim extracted from the answer with its grounding verdict. `value` is set
|
|
71
|
-
* for numeric claims; `evidence_ref_ids` links to the evidence that supports it
|
|
72
|
-
* (empty when ungrounded/unverifiable).
|
|
73
|
-
*/
|
|
74
|
-
export interface IntelligenceClaim {
|
|
75
|
-
text: string;
|
|
76
|
-
value?: number;
|
|
77
|
-
kind: ClaimKind;
|
|
78
|
-
status: ClaimStatus;
|
|
79
|
-
evidence_ref_ids: string[];
|
|
80
|
-
/** Path into the structured tool data where the value matched, when grounded. */
|
|
81
|
-
matched_path?: string;
|
|
82
|
-
}
|
|
83
|
-
export interface IntelligenceRecommendedAction {
|
|
84
|
-
id: string;
|
|
85
|
-
title: string;
|
|
86
|
-
rationale?: string;
|
|
87
|
-
command?: string;
|
|
88
|
-
mutability: CommandMutability;
|
|
89
|
-
requires_approval: boolean;
|
|
90
|
-
}
|
|
91
|
-
export interface IntelligenceFinding {
|
|
92
|
-
id: string;
|
|
93
|
-
title: string;
|
|
94
|
-
severity?: 'critical' | 'high' | 'medium' | 'low' | 'info';
|
|
95
|
-
description?: string;
|
|
96
|
-
evidence_ref_ids: string[];
|
|
97
|
-
recommended_actions: IntelligenceRecommendedAction[];
|
|
98
|
-
}
|
|
99
|
-
export interface IntelligenceNextCommand {
|
|
100
|
-
command: string;
|
|
101
|
-
purpose?: string;
|
|
102
|
-
mutability: CommandMutability;
|
|
103
|
-
requires_approval: boolean;
|
|
104
|
-
}
|
|
105
|
-
/**
|
|
106
|
-
* The canonical `moda.intelligence.v1` payload. Emitted by the backend ask
|
|
107
|
-
* endpoint and surfaced as the CLI agent envelope's `data` (and by `--json`).
|
|
108
|
-
*/
|
|
109
|
-
export interface ModaIntelligenceV1 {
|
|
110
|
-
schema_version: typeof INTELLIGENCE_SCHEMA_VERSION;
|
|
111
|
-
generated_at: string;
|
|
112
|
-
/** The originating command, e.g. "ask". */
|
|
113
|
-
command: string;
|
|
114
|
-
source: IntelligenceSource;
|
|
115
|
-
/** True when the answer was NOT produced by Moda Cloud intelligence. */
|
|
116
|
-
degraded: boolean;
|
|
117
|
-
question: string;
|
|
118
|
-
summary: IntelligenceSummary;
|
|
119
|
-
/** Full markdown answer (the human-facing narrative). */
|
|
120
|
-
answer_markdown: string;
|
|
121
|
-
/** Per-claim grounding verdicts (agent projection). */
|
|
122
|
-
answer_claims: IntelligenceClaim[];
|
|
123
|
-
/** Ranked findings; may be empty for a plain `ask`. */
|
|
124
|
-
findings: IntelligenceFinding[];
|
|
125
|
-
evidence_refs: IntelligenceEvidenceRef[];
|
|
126
|
-
next_commands: IntelligenceNextCommand[];
|
|
127
|
-
warnings: string[];
|
|
128
|
-
meta?: Record<string, unknown>;
|
|
129
|
-
}
|
|
130
|
-
/**
|
|
131
|
-
* Published draft-07 JSON Schema for {@link ModaIntelligenceV1}. This is what
|
|
132
|
-
* `moda --json-schemas` emits and what the contract tests validate CLI/backend
|
|
133
|
-
* output against. Keep in lockstep with the interfaces above.
|
|
134
|
-
*/
|
|
135
|
-
export declare const MODA_INTELLIGENCE_V1_JSON_SCHEMA: {
|
|
136
|
-
readonly $schema: "http://json-schema.org/draft-07/schema#";
|
|
137
|
-
readonly $id: "moda.intelligence.v1";
|
|
138
|
-
readonly title: "Moda Intelligence v1";
|
|
139
|
-
readonly type: "object";
|
|
140
|
-
readonly additionalProperties: false;
|
|
141
|
-
readonly required: readonly ["schema_version", "generated_at", "command", "source", "degraded", "question", "summary", "answer_markdown", "answer_claims", "findings", "evidence_refs", "next_commands", "warnings"];
|
|
142
|
-
readonly properties: {
|
|
143
|
-
readonly schema_version: {
|
|
144
|
-
readonly const: "moda.intelligence.v1";
|
|
145
|
-
};
|
|
146
|
-
readonly generated_at: {
|
|
147
|
-
readonly type: "string";
|
|
148
|
-
readonly format: "date-time";
|
|
149
|
-
};
|
|
150
|
-
readonly command: {
|
|
151
|
-
readonly type: "string";
|
|
152
|
-
};
|
|
153
|
-
readonly source: {
|
|
154
|
-
readonly type: "string";
|
|
155
|
-
readonly enum: readonly ["cloud", "local_fallback"];
|
|
156
|
-
};
|
|
157
|
-
readonly degraded: {
|
|
158
|
-
readonly type: "boolean";
|
|
159
|
-
};
|
|
160
|
-
readonly question: {
|
|
161
|
-
readonly type: "string";
|
|
162
|
-
};
|
|
163
|
-
readonly summary: {
|
|
164
|
-
readonly type: "object";
|
|
165
|
-
readonly additionalProperties: false;
|
|
166
|
-
readonly required: readonly ["text", "confidence"];
|
|
167
|
-
readonly properties: {
|
|
168
|
-
readonly text: {
|
|
169
|
-
readonly type: "string";
|
|
170
|
-
};
|
|
171
|
-
readonly confidence: {
|
|
172
|
-
readonly type: "string";
|
|
173
|
-
readonly enum: readonly ["high", "medium", "low", "unknown"];
|
|
174
|
-
};
|
|
175
|
-
};
|
|
176
|
-
};
|
|
177
|
-
readonly answer_markdown: {
|
|
178
|
-
readonly type: "string";
|
|
179
|
-
};
|
|
180
|
-
readonly answer_claims: {
|
|
181
|
-
readonly type: "array";
|
|
182
|
-
readonly items: {
|
|
183
|
-
readonly type: "object";
|
|
184
|
-
readonly additionalProperties: false;
|
|
185
|
-
readonly required: readonly ["text", "kind", "status", "evidence_ref_ids"];
|
|
186
|
-
readonly properties: {
|
|
187
|
-
readonly text: {
|
|
188
|
-
readonly type: "string";
|
|
189
|
-
};
|
|
190
|
-
readonly value: {
|
|
191
|
-
readonly type: "number";
|
|
192
|
-
};
|
|
193
|
-
readonly kind: {
|
|
194
|
-
readonly type: "string";
|
|
195
|
-
readonly enum: readonly ["percentage", "count", "qualitative"];
|
|
196
|
-
};
|
|
197
|
-
readonly status: {
|
|
198
|
-
readonly type: "string";
|
|
199
|
-
readonly enum: readonly ["grounded", "ungrounded", "unverifiable"];
|
|
200
|
-
};
|
|
201
|
-
readonly evidence_ref_ids: {
|
|
202
|
-
readonly type: "array";
|
|
203
|
-
readonly items: {
|
|
204
|
-
readonly type: "string";
|
|
205
|
-
};
|
|
206
|
-
};
|
|
207
|
-
readonly matched_path: {
|
|
208
|
-
readonly type: "string";
|
|
209
|
-
};
|
|
210
|
-
};
|
|
211
|
-
};
|
|
212
|
-
};
|
|
213
|
-
readonly findings: {
|
|
214
|
-
readonly type: "array";
|
|
215
|
-
readonly items: {
|
|
216
|
-
readonly type: "object";
|
|
217
|
-
readonly additionalProperties: false;
|
|
218
|
-
readonly required: readonly ["id", "title", "evidence_ref_ids", "recommended_actions"];
|
|
219
|
-
readonly properties: {
|
|
220
|
-
readonly id: {
|
|
221
|
-
readonly type: "string";
|
|
222
|
-
};
|
|
223
|
-
readonly title: {
|
|
224
|
-
readonly type: "string";
|
|
225
|
-
};
|
|
226
|
-
readonly severity: {
|
|
227
|
-
readonly type: "string";
|
|
228
|
-
readonly enum: readonly ["critical", "high", "medium", "low", "info"];
|
|
229
|
-
};
|
|
230
|
-
readonly description: {
|
|
231
|
-
readonly type: "string";
|
|
232
|
-
};
|
|
233
|
-
readonly evidence_ref_ids: {
|
|
234
|
-
readonly type: "array";
|
|
235
|
-
readonly items: {
|
|
236
|
-
readonly type: "string";
|
|
237
|
-
};
|
|
238
|
-
};
|
|
239
|
-
readonly recommended_actions: {
|
|
240
|
-
readonly type: "array";
|
|
241
|
-
readonly items: {
|
|
242
|
-
readonly type: "object";
|
|
243
|
-
readonly additionalProperties: false;
|
|
244
|
-
readonly required: readonly ["id", "title", "mutability", "requires_approval"];
|
|
245
|
-
readonly properties: {
|
|
246
|
-
readonly id: {
|
|
247
|
-
readonly type: "string";
|
|
248
|
-
};
|
|
249
|
-
readonly title: {
|
|
250
|
-
readonly type: "string";
|
|
251
|
-
};
|
|
252
|
-
readonly rationale: {
|
|
253
|
-
readonly type: "string";
|
|
254
|
-
};
|
|
255
|
-
readonly command: {
|
|
256
|
-
readonly type: "string";
|
|
257
|
-
};
|
|
258
|
-
readonly mutability: {
|
|
259
|
-
readonly type: "string";
|
|
260
|
-
readonly enum: readonly ["read", "write", "sync", "unknown"];
|
|
261
|
-
};
|
|
262
|
-
readonly requires_approval: {
|
|
263
|
-
readonly type: "boolean";
|
|
264
|
-
};
|
|
265
|
-
};
|
|
266
|
-
};
|
|
267
|
-
};
|
|
268
|
-
};
|
|
269
|
-
};
|
|
270
|
-
};
|
|
271
|
-
readonly evidence_refs: {
|
|
272
|
-
readonly type: "array";
|
|
273
|
-
readonly items: {
|
|
274
|
-
readonly type: "object";
|
|
275
|
-
readonly additionalProperties: false;
|
|
276
|
-
readonly required: readonly ["id", "kind", "label", "grounding"];
|
|
277
|
-
readonly properties: {
|
|
278
|
-
readonly id: {
|
|
279
|
-
readonly type: "string";
|
|
280
|
-
};
|
|
281
|
-
readonly kind: {
|
|
282
|
-
readonly type: "string";
|
|
283
|
-
};
|
|
284
|
-
readonly label: {
|
|
285
|
-
readonly type: "string";
|
|
286
|
-
};
|
|
287
|
-
readonly anchor: {
|
|
288
|
-
readonly type: "object";
|
|
289
|
-
readonly additionalProperties: false;
|
|
290
|
-
readonly properties: {
|
|
291
|
-
readonly conversation_id: {
|
|
292
|
-
readonly type: "string";
|
|
293
|
-
};
|
|
294
|
-
readonly message_index: {
|
|
295
|
-
readonly type: "number";
|
|
296
|
-
};
|
|
297
|
-
readonly run_id: {
|
|
298
|
-
readonly type: "string";
|
|
299
|
-
};
|
|
300
|
-
readonly tool_name: {
|
|
301
|
-
readonly type: "string";
|
|
302
|
-
};
|
|
303
|
-
};
|
|
304
|
-
};
|
|
305
|
-
readonly snippet: {
|
|
306
|
-
readonly type: "string";
|
|
307
|
-
};
|
|
308
|
-
readonly grounding: {
|
|
309
|
-
readonly type: "string";
|
|
310
|
-
readonly enum: readonly ["measured", "inferred"];
|
|
311
|
-
};
|
|
312
|
-
};
|
|
313
|
-
};
|
|
314
|
-
};
|
|
315
|
-
readonly next_commands: {
|
|
316
|
-
readonly type: "array";
|
|
317
|
-
readonly items: {
|
|
318
|
-
readonly type: "object";
|
|
319
|
-
readonly additionalProperties: false;
|
|
320
|
-
readonly required: readonly ["command", "mutability", "requires_approval"];
|
|
321
|
-
readonly properties: {
|
|
322
|
-
readonly command: {
|
|
323
|
-
readonly type: "string";
|
|
324
|
-
};
|
|
325
|
-
readonly purpose: {
|
|
326
|
-
readonly type: "string";
|
|
327
|
-
};
|
|
328
|
-
readonly mutability: {
|
|
329
|
-
readonly type: "string";
|
|
330
|
-
readonly enum: readonly ["read", "write", "sync", "unknown"];
|
|
331
|
-
};
|
|
332
|
-
readonly requires_approval: {
|
|
333
|
-
readonly type: "boolean";
|
|
334
|
-
};
|
|
335
|
-
};
|
|
336
|
-
};
|
|
337
|
-
};
|
|
338
|
-
readonly warnings: {
|
|
339
|
-
readonly type: "array";
|
|
340
|
-
readonly items: {
|
|
341
|
-
readonly type: "string";
|
|
342
|
-
};
|
|
343
|
-
};
|
|
344
|
-
readonly meta: {
|
|
345
|
-
readonly type: "object";
|
|
346
|
-
};
|
|
347
|
-
};
|
|
348
|
-
};
|
|
349
|
-
//# sourceMappingURL=intelligence-schema.d.ts.map
|
|
@@ -1,174 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* moda.intelligence.v1 — the unified Moda intelligence wire format (MODA-388).
|
|
3
|
-
*
|
|
4
|
-
* ONE versioned payload that every surface projects from:
|
|
5
|
-
* - CLI `moda ask --json` / `--agent` (the agent-facing contract),
|
|
6
|
-
* - the backend `POST /api/cli/ask` response,
|
|
7
|
-
* - the (future) MCP server's `structuredContent`,
|
|
8
|
-
* - the dashboard UI.
|
|
9
|
-
*
|
|
10
|
-
* Design rules:
|
|
11
|
-
* - snake_case everywhere (no mixed casing — the prior split between the
|
|
12
|
-
* snake_case envelope and the camelCase `production_ask.v0.1` data payload
|
|
13
|
-
* was the main source of agent-integration pain).
|
|
14
|
-
* - It is a SUPERSET. Differentiation between a human reader and an agent is a
|
|
15
|
-
* RENDERING concern at the edge, not a forked schema:
|
|
16
|
-
* · human projection → narrative `answer_markdown`, `summary.confidence`
|
|
17
|
-
* as a word, raw ids/anchors hidden.
|
|
18
|
-
* · agent projection → full `evidence_refs` (with `anchor` + `grounding`),
|
|
19
|
-
* `answer_claims` (claim → evidence), structured
|
|
20
|
-
* `next_commands`.
|
|
21
|
-
* - Additive evolution only within v1; breaking changes bump the version.
|
|
22
|
-
*
|
|
23
|
-
* This module is the SINGLE SOURCE OF TRUTH for the shape. The backend mirrors
|
|
24
|
-
* these field names on the wire and the contract tests validate real CLI output
|
|
25
|
-
* against {@link MODA_INTELLIGENCE_V1_JSON_SCHEMA}.
|
|
26
|
-
*/
|
|
27
|
-
export const INTELLIGENCE_SCHEMA_VERSION = 'moda.intelligence.v1';
|
|
28
|
-
// ───────────────────────────── JSON Schema (draft-07) ─────────────────────────
|
|
29
|
-
const provenanceSchema = { type: 'string', enum: ['measured', 'inferred'] };
|
|
30
|
-
const mutabilitySchema = {
|
|
31
|
-
type: 'string',
|
|
32
|
-
enum: ['read', 'write', 'sync', 'unknown'],
|
|
33
|
-
};
|
|
34
|
-
const confidenceSchema = {
|
|
35
|
-
type: 'string',
|
|
36
|
-
enum: ['high', 'medium', 'low', 'unknown'],
|
|
37
|
-
};
|
|
38
|
-
/**
|
|
39
|
-
* Published draft-07 JSON Schema for {@link ModaIntelligenceV1}. This is what
|
|
40
|
-
* `moda --json-schemas` emits and what the contract tests validate CLI/backend
|
|
41
|
-
* output against. Keep in lockstep with the interfaces above.
|
|
42
|
-
*/
|
|
43
|
-
export const MODA_INTELLIGENCE_V1_JSON_SCHEMA = {
|
|
44
|
-
$schema: 'http://json-schema.org/draft-07/schema#',
|
|
45
|
-
$id: 'moda.intelligence.v1',
|
|
46
|
-
title: 'Moda Intelligence v1',
|
|
47
|
-
type: 'object',
|
|
48
|
-
additionalProperties: false,
|
|
49
|
-
required: [
|
|
50
|
-
'schema_version',
|
|
51
|
-
'generated_at',
|
|
52
|
-
'command',
|
|
53
|
-
'source',
|
|
54
|
-
'degraded',
|
|
55
|
-
'question',
|
|
56
|
-
'summary',
|
|
57
|
-
'answer_markdown',
|
|
58
|
-
'answer_claims',
|
|
59
|
-
'findings',
|
|
60
|
-
'evidence_refs',
|
|
61
|
-
'next_commands',
|
|
62
|
-
'warnings',
|
|
63
|
-
],
|
|
64
|
-
properties: {
|
|
65
|
-
schema_version: { const: 'moda.intelligence.v1' },
|
|
66
|
-
generated_at: { type: 'string', format: 'date-time' },
|
|
67
|
-
command: { type: 'string' },
|
|
68
|
-
source: { type: 'string', enum: ['cloud', 'local_fallback'] },
|
|
69
|
-
degraded: { type: 'boolean' },
|
|
70
|
-
question: { type: 'string' },
|
|
71
|
-
summary: {
|
|
72
|
-
type: 'object',
|
|
73
|
-
additionalProperties: false,
|
|
74
|
-
required: ['text', 'confidence'],
|
|
75
|
-
properties: { text: { type: 'string' }, confidence: confidenceSchema },
|
|
76
|
-
},
|
|
77
|
-
answer_markdown: { type: 'string' },
|
|
78
|
-
answer_claims: {
|
|
79
|
-
type: 'array',
|
|
80
|
-
items: {
|
|
81
|
-
type: 'object',
|
|
82
|
-
additionalProperties: false,
|
|
83
|
-
required: ['text', 'kind', 'status', 'evidence_ref_ids'],
|
|
84
|
-
properties: {
|
|
85
|
-
text: { type: 'string' },
|
|
86
|
-
value: { type: 'number' },
|
|
87
|
-
kind: { type: 'string', enum: ['percentage', 'count', 'qualitative'] },
|
|
88
|
-
status: {
|
|
89
|
-
type: 'string',
|
|
90
|
-
enum: ['grounded', 'ungrounded', 'unverifiable'],
|
|
91
|
-
},
|
|
92
|
-
evidence_ref_ids: { type: 'array', items: { type: 'string' } },
|
|
93
|
-
matched_path: { type: 'string' },
|
|
94
|
-
},
|
|
95
|
-
},
|
|
96
|
-
},
|
|
97
|
-
findings: {
|
|
98
|
-
type: 'array',
|
|
99
|
-
items: {
|
|
100
|
-
type: 'object',
|
|
101
|
-
additionalProperties: false,
|
|
102
|
-
required: ['id', 'title', 'evidence_ref_ids', 'recommended_actions'],
|
|
103
|
-
properties: {
|
|
104
|
-
id: { type: 'string' },
|
|
105
|
-
title: { type: 'string' },
|
|
106
|
-
severity: {
|
|
107
|
-
type: 'string',
|
|
108
|
-
enum: ['critical', 'high', 'medium', 'low', 'info'],
|
|
109
|
-
},
|
|
110
|
-
description: { type: 'string' },
|
|
111
|
-
evidence_ref_ids: { type: 'array', items: { type: 'string' } },
|
|
112
|
-
recommended_actions: {
|
|
113
|
-
type: 'array',
|
|
114
|
-
items: {
|
|
115
|
-
type: 'object',
|
|
116
|
-
additionalProperties: false,
|
|
117
|
-
required: ['id', 'title', 'mutability', 'requires_approval'],
|
|
118
|
-
properties: {
|
|
119
|
-
id: { type: 'string' },
|
|
120
|
-
title: { type: 'string' },
|
|
121
|
-
rationale: { type: 'string' },
|
|
122
|
-
command: { type: 'string' },
|
|
123
|
-
mutability: mutabilitySchema,
|
|
124
|
-
requires_approval: { type: 'boolean' },
|
|
125
|
-
},
|
|
126
|
-
},
|
|
127
|
-
},
|
|
128
|
-
},
|
|
129
|
-
},
|
|
130
|
-
},
|
|
131
|
-
evidence_refs: {
|
|
132
|
-
type: 'array',
|
|
133
|
-
items: {
|
|
134
|
-
type: 'object',
|
|
135
|
-
additionalProperties: false,
|
|
136
|
-
required: ['id', 'kind', 'label', 'grounding'],
|
|
137
|
-
properties: {
|
|
138
|
-
id: { type: 'string' },
|
|
139
|
-
kind: { type: 'string' },
|
|
140
|
-
label: { type: 'string' },
|
|
141
|
-
anchor: {
|
|
142
|
-
type: 'object',
|
|
143
|
-
additionalProperties: false,
|
|
144
|
-
properties: {
|
|
145
|
-
conversation_id: { type: 'string' },
|
|
146
|
-
message_index: { type: 'number' },
|
|
147
|
-
run_id: { type: 'string' },
|
|
148
|
-
tool_name: { type: 'string' },
|
|
149
|
-
},
|
|
150
|
-
},
|
|
151
|
-
snippet: { type: 'string' },
|
|
152
|
-
grounding: provenanceSchema,
|
|
153
|
-
},
|
|
154
|
-
},
|
|
155
|
-
},
|
|
156
|
-
next_commands: {
|
|
157
|
-
type: 'array',
|
|
158
|
-
items: {
|
|
159
|
-
type: 'object',
|
|
160
|
-
additionalProperties: false,
|
|
161
|
-
required: ['command', 'mutability', 'requires_approval'],
|
|
162
|
-
properties: {
|
|
163
|
-
command: { type: 'string' },
|
|
164
|
-
purpose: { type: 'string' },
|
|
165
|
-
mutability: mutabilitySchema,
|
|
166
|
-
requires_approval: { type: 'boolean' },
|
|
167
|
-
},
|
|
168
|
-
},
|
|
169
|
-
},
|
|
170
|
-
warnings: { type: 'array', items: { type: 'string' } },
|
|
171
|
-
meta: { type: 'object' },
|
|
172
|
-
},
|
|
173
|
-
};
|
|
174
|
-
//# sourceMappingURL=intelligence-schema.js.map
|
package/dist/keys.d.ts
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { type ModaEnvironment, type ProfileIOOptions, type SecretReference } from './profiles.js';
|
|
2
|
-
export type ModaKeyStatus = 'active' | 'rotating' | 'revoked';
|
|
3
|
-
export type ModaKeyPurpose = 'data_api' | 'ingest' | 'automation';
|
|
4
|
-
export interface ModaKeyDescriptor {
|
|
5
|
-
id: string;
|
|
6
|
-
profile: string;
|
|
7
|
-
name: string;
|
|
8
|
-
purpose: ModaKeyPurpose;
|
|
9
|
-
environment: ModaEnvironment;
|
|
10
|
-
tenant_id?: string;
|
|
11
|
-
workspace_id?: string;
|
|
12
|
-
secret_ref: SecretReference;
|
|
13
|
-
status: ModaKeyStatus;
|
|
14
|
-
created_at: string;
|
|
15
|
-
expires_at?: string;
|
|
16
|
-
last_used_at?: string;
|
|
17
|
-
metadata?: Record<string, unknown>;
|
|
18
|
-
}
|
|
19
|
-
export interface CreateLocalKeyDescriptorInput {
|
|
20
|
-
profile: string;
|
|
21
|
-
environment: ModaEnvironment;
|
|
22
|
-
name: string;
|
|
23
|
-
purpose?: ModaKeyPurpose;
|
|
24
|
-
tenant_id?: string;
|
|
25
|
-
workspace_id?: string;
|
|
26
|
-
secret_ref?: SecretReference;
|
|
27
|
-
now?: Date;
|
|
28
|
-
}
|
|
29
|
-
export interface KeyDescriptorStore {
|
|
30
|
-
version: 1;
|
|
31
|
-
keys: ModaKeyDescriptor[];
|
|
32
|
-
}
|
|
33
|
-
export declare const KEY_LIFECYCLE_ENDPOINT_REQUIREMENTS: {
|
|
34
|
-
readonly list: "GET /api/cli/keys?profile=<profile>";
|
|
35
|
-
readonly create: "POST /api/cli/keys";
|
|
36
|
-
readonly rotate: "POST /api/cli/keys/<key_id>/rotate";
|
|
37
|
-
readonly revoke: "POST /api/cli/keys/<key_id>/revoke";
|
|
38
|
-
};
|
|
39
|
-
export declare function keySecretRef(profile: string, keyId: string): SecretReference;
|
|
40
|
-
export declare function createLocalKeyDescriptor(input: CreateLocalKeyDescriptorInput): ModaKeyDescriptor;
|
|
41
|
-
export declare function validateKeyDescriptor(descriptor: ModaKeyDescriptor): void;
|
|
42
|
-
export declare function writeLocalApiKeySecret(descriptor: ModaKeyDescriptor, apiKey: string, options?: ProfileIOOptions): string;
|
|
43
|
-
export declare function keyDescriptorStorePath(options?: ProfileIOOptions): string;
|
|
44
|
-
export declare function loadLocalKeyDescriptors(options?: ProfileIOOptions): ModaKeyDescriptor[];
|
|
45
|
-
export declare function saveLocalKeyDescriptors(keys: ModaKeyDescriptor[], options?: ProfileIOOptions): void;
|
|
46
|
-
export declare function upsertLocalKeyDescriptor(descriptor: ModaKeyDescriptor, options?: ProfileIOOptions): ModaKeyDescriptor[];
|
|
47
|
-
//# sourceMappingURL=keys.d.ts.map
|