@moda-ai/cli 1.22.1 → 1.23.0
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-c4se7a5d.js +762 -0
- package/dist/cli-mnqa4rp6.js +1563 -0
- package/dist/cli-stmjdgvy.js +2842 -0
- package/dist/cli-y55bgg14.js +6980 -0
- package/dist/cli-ysegdrm5.js +286 -0
- package/dist/cli.js +4779 -1159
- package/dist/harness-github-actions-7t3cncnt.js +95 -0
- package/dist/index-4ser01zr.js +2769 -0
- package/dist/provision-hm1ppwj6.js +74 -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
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import {
|
|
2
|
+
selectTenantAndCreateKey
|
|
3
|
+
} from "./cli-ysegdrm5.js";
|
|
4
|
+
import {
|
|
5
|
+
loadAuthSession
|
|
6
|
+
} from "./cli-c4se7a5d.js";
|
|
7
|
+
import {
|
|
8
|
+
CliAuthError,
|
|
9
|
+
resolveIngestUrl,
|
|
10
|
+
resolveModaBaseUrl,
|
|
11
|
+
stringOption
|
|
12
|
+
} from "./cli-mnqa4rp6.js";
|
|
13
|
+
|
|
14
|
+
// src/provision.ts
|
|
15
|
+
async function runProvision(context, options = {}) {
|
|
16
|
+
const resumeCommand = options.resumeCommand ?? ["moda", "provision"];
|
|
17
|
+
const profileFlag = stringOption(context.rawFlags.profile);
|
|
18
|
+
const authOptions = { profile: profileFlag, env: context.env };
|
|
19
|
+
const session = loadAuthSession(authOptions);
|
|
20
|
+
if (!session) {
|
|
21
|
+
const expiredSession = loadAuthSession({ ...authOptions, includeExpired: true });
|
|
22
|
+
throw new CliAuthError("moda provision requires an existing CLI session and never opens a browser. " + 'Run "moda auth login" on a machine with a browser first, then re-run provision here ' + "(or skip provisioning and set MODA_API_KEY directly).", {
|
|
23
|
+
reason: expiredSession ? "token_expired" : "no_stored_credentials",
|
|
24
|
+
login_command: ["moda", "auth", "login"],
|
|
25
|
+
resume_command: resumeCommand
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
const flagTenantId = stringOption(context.rawFlags["tenant-id"] ?? context.rawFlags.tenant_id);
|
|
29
|
+
const envTenantId = stringOption(context.env.MODA_TENANT_ID);
|
|
30
|
+
const label = stringOption(context.rawFlags.label);
|
|
31
|
+
const save = context.flags.save === "true";
|
|
32
|
+
let result;
|
|
33
|
+
try {
|
|
34
|
+
result = await selectTenantAndCreateKey({
|
|
35
|
+
tenantId: flagTenantId ?? envTenantId,
|
|
36
|
+
tenantIdSource: flagTenantId !== undefined ? "flag" : envTenantId !== undefined ? "env" : undefined,
|
|
37
|
+
nonInteractive: true,
|
|
38
|
+
silent: true,
|
|
39
|
+
resumeCommand,
|
|
40
|
+
label,
|
|
41
|
+
persistConfig: save,
|
|
42
|
+
profile: profileFlag,
|
|
43
|
+
env: context.env
|
|
44
|
+
});
|
|
45
|
+
} catch (error) {
|
|
46
|
+
if (error instanceof CliAuthError && !error.auth.resume_command) {
|
|
47
|
+
throw new CliAuthError(error.message, {
|
|
48
|
+
reason: error.auth.reason,
|
|
49
|
+
login_command: error.auth.login_command,
|
|
50
|
+
resume_command: resumeCommand
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
throw error;
|
|
54
|
+
}
|
|
55
|
+
const payload = {
|
|
56
|
+
apiKey: result.apiKey,
|
|
57
|
+
tenantId: result.tenantId,
|
|
58
|
+
tenantName: result.tenantName,
|
|
59
|
+
tenantSlug: result.tenantSlug,
|
|
60
|
+
ingestUrl: resolveIngestUrl(authOptions),
|
|
61
|
+
baseUrl: resolveModaBaseUrl(authOptions),
|
|
62
|
+
reused: result.reused
|
|
63
|
+
};
|
|
64
|
+
console.error("Output contains a live API key. Avoid piping to logs.");
|
|
65
|
+
if (save) {
|
|
66
|
+
console.error("Saved API key + tenant to ~/.moda/config.json (--save).");
|
|
67
|
+
}
|
|
68
|
+
process.stdout.write(`${JSON.stringify(payload, null, 2)}
|
|
69
|
+
`);
|
|
70
|
+
return { exitCode: 0, apiKey: result.apiKey };
|
|
71
|
+
}
|
|
72
|
+
export {
|
|
73
|
+
runProvision
|
|
74
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moda-ai/cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.23.0",
|
|
4
4
|
"description": "CLI for Moda - AI agent analytics and observability",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
},
|
|
21
21
|
"scripts": {
|
|
22
22
|
"bundle:skills": "bun scripts/bundle-skills.ts",
|
|
23
|
-
"build": "bun run bundle:skills && tsc",
|
|
23
|
+
"build": "bun run bundle:skills && tsc --noEmit && bun build ./src/cli.ts --target=node --format=esm --outdir=dist --splitting --external @inquirer/prompts --external open --external zod",
|
|
24
24
|
"dev": "tsc --watch",
|
|
25
25
|
"typecheck": "tsc --noEmit",
|
|
26
26
|
"test": "bun run bundle:skills && vitest run",
|
|
@@ -53,6 +53,7 @@
|
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
55
|
"@moda/eslint-config": "*",
|
|
56
|
+
"@moda/harness-snapshot": "*",
|
|
56
57
|
"@moda/integration-skills": "*",
|
|
57
58
|
"@types/node": "^22.10.5",
|
|
58
59
|
"eslint": "^9.17.0",
|
package/dist/agent-schemas.d.ts
DELETED
package/dist/agent-schemas.js
DELETED
|
@@ -1,358 +0,0 @@
|
|
|
1
|
-
// agent-schemas.ts
|
|
2
|
-
//
|
|
3
|
-
// Machine-readable JSON Schemas (JSON Schema draft-07) for the moda CLI's
|
|
4
|
-
// agent output contract. It is consumed by `moda --json-schemas`, which prints
|
|
5
|
-
// the document produced by `renderJsonSchemas()` so an external coding agent can
|
|
6
|
-
// introspect the exact shape of moda's agent-mode output.
|
|
7
|
-
//
|
|
8
|
-
// The canonical `moda.intelligence.v1` schema is imported from its
|
|
9
|
-
// single-source-of-truth module rather than re-declared here, so the published
|
|
10
|
-
// contract can never drift from the runtime payload.
|
|
11
|
-
//
|
|
12
|
-
// Keep these schemas in sync with:
|
|
13
|
-
// - AgentEnvelope / AgentEvent in ./output.ts (moda.agent.v1 / moda.agent_event.v1)
|
|
14
|
-
// - ProductionAskResult in ./production-intelligence.ts (production_ask.v0.1)
|
|
15
|
-
// - ModaIntelligenceV1 in ./intelligence-schema.ts (moda.intelligence.v1)
|
|
16
|
-
import { MODA_INTELLIGENCE_V1_JSON_SCHEMA } from './intelligence-schema.js';
|
|
17
|
-
import { AGENT_ERROR_CODES } from './output.js';
|
|
18
|
-
const agentSummarySchema = {
|
|
19
|
-
type: 'object',
|
|
20
|
-
additionalProperties: false,
|
|
21
|
-
required: ['text', 'confidence'],
|
|
22
|
-
properties: {
|
|
23
|
-
text: { type: 'string' },
|
|
24
|
-
confidence: { type: 'string', enum: ['high', 'medium', 'low', 'unknown'] },
|
|
25
|
-
},
|
|
26
|
-
};
|
|
27
|
-
const agentFindingSchema = {
|
|
28
|
-
type: 'object',
|
|
29
|
-
additionalProperties: false,
|
|
30
|
-
required: ['id', 'title'],
|
|
31
|
-
properties: {
|
|
32
|
-
id: { type: 'string' },
|
|
33
|
-
title: { type: 'string' },
|
|
34
|
-
status: { type: 'string' },
|
|
35
|
-
severity: { type: 'string' },
|
|
36
|
-
description: { type: 'string' },
|
|
37
|
-
evidence_ref_ids: { type: 'array', items: { type: 'string' } },
|
|
38
|
-
},
|
|
39
|
-
};
|
|
40
|
-
const agentEvidenceRefSchema = {
|
|
41
|
-
type: 'object',
|
|
42
|
-
additionalProperties: false,
|
|
43
|
-
required: ['id', 'kind', 'label'],
|
|
44
|
-
properties: {
|
|
45
|
-
id: { type: 'string' },
|
|
46
|
-
kind: { type: 'string' },
|
|
47
|
-
label: { type: 'string' },
|
|
48
|
-
path: { type: 'string' },
|
|
49
|
-
line: { type: 'number' },
|
|
50
|
-
status: { type: 'string' },
|
|
51
|
-
href: {
|
|
52
|
-
type: 'string',
|
|
53
|
-
description: 'Root-relative Moda dashboard deep-link for this evidence (e.g. /dashboard/conversations/<id>?turn=5). Prefix the Moda base URL to open.',
|
|
54
|
-
},
|
|
55
|
-
},
|
|
56
|
-
};
|
|
57
|
-
const agentRecommendedActionSchema = {
|
|
58
|
-
type: 'object',
|
|
59
|
-
additionalProperties: false,
|
|
60
|
-
required: ['id', 'title', 'mutability', 'requires_approval'],
|
|
61
|
-
properties: {
|
|
62
|
-
id: { type: 'string' },
|
|
63
|
-
title: { type: 'string' },
|
|
64
|
-
rationale: { type: 'string' },
|
|
65
|
-
command: { type: 'string' },
|
|
66
|
-
mutability: { type: 'string', enum: ['read', 'write', 'sync', 'unknown'] },
|
|
67
|
-
requires_approval: { type: 'boolean' },
|
|
68
|
-
},
|
|
69
|
-
};
|
|
70
|
-
const agentNextCommandSchema = {
|
|
71
|
-
type: 'object',
|
|
72
|
-
additionalProperties: false,
|
|
73
|
-
required: ['command', 'purpose', 'mutability', 'requires_approval'],
|
|
74
|
-
properties: {
|
|
75
|
-
command: { type: 'string' },
|
|
76
|
-
purpose: { type: 'string' },
|
|
77
|
-
mutability: { type: 'string', enum: ['read', 'write', 'sync', 'unknown'] },
|
|
78
|
-
requires_approval: { type: 'boolean' },
|
|
79
|
-
},
|
|
80
|
-
};
|
|
81
|
-
const agentArtifactSchema = {
|
|
82
|
-
type: 'object',
|
|
83
|
-
additionalProperties: false,
|
|
84
|
-
required: ['kind', 'path'],
|
|
85
|
-
properties: {
|
|
86
|
-
kind: { type: 'string' },
|
|
87
|
-
path: { type: 'string' },
|
|
88
|
-
description: { type: 'string' },
|
|
89
|
-
},
|
|
90
|
-
};
|
|
91
|
-
const agentInputRequestSchema = {
|
|
92
|
-
type: 'object',
|
|
93
|
-
additionalProperties: false,
|
|
94
|
-
required: ['id', 'question', 'kind'],
|
|
95
|
-
properties: {
|
|
96
|
-
id: { type: 'string' },
|
|
97
|
-
question: { type: 'string' },
|
|
98
|
-
kind: { type: 'string', enum: ['select', 'confirm', 'text'] },
|
|
99
|
-
choices: {
|
|
100
|
-
type: 'array',
|
|
101
|
-
items: {
|
|
102
|
-
type: 'object',
|
|
103
|
-
additionalProperties: false,
|
|
104
|
-
required: ['value', 'label', 'resume_flags'],
|
|
105
|
-
properties: {
|
|
106
|
-
value: { type: 'string' },
|
|
107
|
-
label: { type: 'string' },
|
|
108
|
-
resume_flags: { type: 'array', items: { type: 'string' } },
|
|
109
|
-
},
|
|
110
|
-
},
|
|
111
|
-
},
|
|
112
|
-
resume_command: { type: 'array', items: { type: 'string' } },
|
|
113
|
-
},
|
|
114
|
-
};
|
|
115
|
-
const agentAuthSchema = {
|
|
116
|
-
type: 'object',
|
|
117
|
-
additionalProperties: false,
|
|
118
|
-
required: ['reason', 'login_command'],
|
|
119
|
-
properties: {
|
|
120
|
-
reason: {
|
|
121
|
-
type: 'string',
|
|
122
|
-
enum: ['no_stored_credentials', 'token_expired', 'token_revoked', 'renew_failed'],
|
|
123
|
-
},
|
|
124
|
-
login_command: { type: 'array', items: { type: 'string' } },
|
|
125
|
-
resume_command: { type: 'array', items: { type: 'string' } },
|
|
126
|
-
},
|
|
127
|
-
};
|
|
128
|
-
const agentErrorSchema = {
|
|
129
|
-
type: 'object',
|
|
130
|
-
additionalProperties: false,
|
|
131
|
-
required: ['code', 'message', 'blocking'],
|
|
132
|
-
properties: {
|
|
133
|
-
code: { type: 'string', enum: AGENT_ERROR_CODES },
|
|
134
|
-
message: { type: 'string' },
|
|
135
|
-
cause: { type: 'string' },
|
|
136
|
-
suggested_commands: { type: 'array', items: { type: 'string' } },
|
|
137
|
-
input_request: agentInputRequestSchema,
|
|
138
|
-
auth: agentAuthSchema,
|
|
139
|
-
blocking: { type: 'boolean' },
|
|
140
|
-
},
|
|
141
|
-
};
|
|
142
|
-
const agentEnvelopeSchema = {
|
|
143
|
-
$id: 'moda.agent.v1',
|
|
144
|
-
title: 'AgentEnvelope',
|
|
145
|
-
description: 'Top-level agent-mode output envelope emitted by the moda CLI.',
|
|
146
|
-
type: 'object',
|
|
147
|
-
additionalProperties: false,
|
|
148
|
-
required: [
|
|
149
|
-
'schema_version',
|
|
150
|
-
'command',
|
|
151
|
-
'status',
|
|
152
|
-
'generated_at',
|
|
153
|
-
'summary',
|
|
154
|
-
'findings',
|
|
155
|
-
'evidence_refs',
|
|
156
|
-
'recommended_actions',
|
|
157
|
-
'next_commands',
|
|
158
|
-
'artifacts',
|
|
159
|
-
'warnings',
|
|
160
|
-
'errors',
|
|
161
|
-
'data',
|
|
162
|
-
],
|
|
163
|
-
properties: {
|
|
164
|
-
schema_version: { type: 'string', const: 'moda.agent.v1' },
|
|
165
|
-
command: { type: 'string' },
|
|
166
|
-
status: { type: 'string', enum: ['ok', 'degraded', 'error'] },
|
|
167
|
-
generated_at: { type: 'string', format: 'date-time' },
|
|
168
|
-
profile: { type: 'string' },
|
|
169
|
-
summary: agentSummarySchema,
|
|
170
|
-
findings: { type: 'array', items: agentFindingSchema },
|
|
171
|
-
evidence_refs: { type: 'array', items: agentEvidenceRefSchema },
|
|
172
|
-
recommended_actions: { type: 'array', items: agentRecommendedActionSchema },
|
|
173
|
-
next_commands: { type: 'array', items: agentNextCommandSchema },
|
|
174
|
-
artifacts: { type: 'array', items: agentArtifactSchema },
|
|
175
|
-
warnings: { type: 'array', items: { type: 'string' } },
|
|
176
|
-
errors: { type: 'array', items: agentErrorSchema },
|
|
177
|
-
data: { description: 'Command-specific payload. Shape varies by command.', additionalProperties: true },
|
|
178
|
-
meta: { type: 'object', additionalProperties: true },
|
|
179
|
-
truncation: { type: 'object', additionalProperties: true },
|
|
180
|
-
},
|
|
181
|
-
};
|
|
182
|
-
const agentEventSchema = {
|
|
183
|
-
$id: 'moda.agent_event.v1',
|
|
184
|
-
title: 'AgentEvent',
|
|
185
|
-
description: 'Streaming NDJSON event emitted in agent-stream mode by the moda CLI. The first event is started; run_id is constant; seq starts at 1 and increments without gaps; exactly one terminal event (completed, error, cancelled, needs_input, auth_required) ends every stream; heartbeat absence for more than 30 seconds is the stall signal.',
|
|
186
|
-
type: 'object',
|
|
187
|
-
additionalProperties: false,
|
|
188
|
-
required: ['schema_version', 'event', 'command', 'generated_at'],
|
|
189
|
-
properties: {
|
|
190
|
-
schema_version: { type: 'string', const: 'moda.agent_event.v1' },
|
|
191
|
-
event: {
|
|
192
|
-
type: 'string',
|
|
193
|
-
enum: [
|
|
194
|
-
'started',
|
|
195
|
-
'progress',
|
|
196
|
-
'artifact',
|
|
197
|
-
'approval_required',
|
|
198
|
-
'completed',
|
|
199
|
-
'error',
|
|
200
|
-
'heartbeat',
|
|
201
|
-
'needs_input',
|
|
202
|
-
'auth_required',
|
|
203
|
-
'cancelled',
|
|
204
|
-
'warning',
|
|
205
|
-
],
|
|
206
|
-
},
|
|
207
|
-
command: { type: 'string' },
|
|
208
|
-
generated_at: { type: 'string', format: 'date-time' },
|
|
209
|
-
run_id: { type: 'string' },
|
|
210
|
-
seq: { type: 'number' },
|
|
211
|
-
event_version: { type: 'number' },
|
|
212
|
-
status: { type: 'string', enum: ['ok', 'degraded', 'error'] },
|
|
213
|
-
phase: { type: 'string' },
|
|
214
|
-
message: { type: 'string' },
|
|
215
|
-
elapsed_ms: { type: 'number' },
|
|
216
|
-
artifact: agentArtifactSchema,
|
|
217
|
-
result: agentEnvelopeSchema,
|
|
218
|
-
error: agentErrorSchema,
|
|
219
|
-
input_request: agentInputRequestSchema,
|
|
220
|
-
auth: agentAuthSchema,
|
|
221
|
-
},
|
|
222
|
-
};
|
|
223
|
-
const productionEvidenceRefSchema = {
|
|
224
|
-
type: 'object',
|
|
225
|
-
additionalProperties: false,
|
|
226
|
-
required: ['id', 'kind', 'label'],
|
|
227
|
-
properties: {
|
|
228
|
-
id: { type: 'string' },
|
|
229
|
-
kind: {
|
|
230
|
-
type: 'string',
|
|
231
|
-
enum: ['data_api', 'tool_failure', 'frustration', 'run', 'harness', 'ask'],
|
|
232
|
-
},
|
|
233
|
-
label: { type: 'string' },
|
|
234
|
-
endpoint: { type: 'string' },
|
|
235
|
-
conversationId: { type: 'string' },
|
|
236
|
-
runId: { type: 'string' },
|
|
237
|
-
detectionId: { type: 'string' },
|
|
238
|
-
toolName: { type: 'string' },
|
|
239
|
-
path: { type: 'string' },
|
|
240
|
-
line: { type: 'number' },
|
|
241
|
-
value: { description: 'Arbitrary evidence payload.', additionalProperties: true },
|
|
242
|
-
},
|
|
243
|
-
};
|
|
244
|
-
const likelyLocationSchema = {
|
|
245
|
-
type: 'object',
|
|
246
|
-
additionalProperties: false,
|
|
247
|
-
required: ['kind', 'label', 'confidence', 'reason'],
|
|
248
|
-
properties: {
|
|
249
|
-
kind: { type: 'string', enum: ['tool', 'prompt', 'skill', 'entrypoint', 'harness', 'unknown'] },
|
|
250
|
-
path: { type: 'string' },
|
|
251
|
-
label: { type: 'string' },
|
|
252
|
-
confidence: { type: 'string', enum: ['high', 'medium', 'low', 'unknown'] },
|
|
253
|
-
reason: { type: 'string' },
|
|
254
|
-
},
|
|
255
|
-
};
|
|
256
|
-
const productionActionSchema = {
|
|
257
|
-
type: 'object',
|
|
258
|
-
additionalProperties: false,
|
|
259
|
-
required: ['id', 'title', 'rationale', 'command', 'mutability', 'requiresApproval'],
|
|
260
|
-
properties: {
|
|
261
|
-
id: { type: 'string' },
|
|
262
|
-
title: { type: 'string' },
|
|
263
|
-
rationale: { type: 'string' },
|
|
264
|
-
command: { type: 'string' },
|
|
265
|
-
mutability: { type: 'string', enum: ['read', 'write', 'sync', 'unknown'] },
|
|
266
|
-
requiresApproval: { type: 'boolean' },
|
|
267
|
-
},
|
|
268
|
-
};
|
|
269
|
-
const productionFindingSchema = {
|
|
270
|
-
type: 'object',
|
|
271
|
-
additionalProperties: false,
|
|
272
|
-
required: [
|
|
273
|
-
'id',
|
|
274
|
-
'kind',
|
|
275
|
-
'title',
|
|
276
|
-
'severity',
|
|
277
|
-
'confidence',
|
|
278
|
-
'impactScore',
|
|
279
|
-
'rankReason',
|
|
280
|
-
'summary',
|
|
281
|
-
'evidenceRefIds',
|
|
282
|
-
'likelyLocations',
|
|
283
|
-
'recommendedActions',
|
|
284
|
-
],
|
|
285
|
-
properties: {
|
|
286
|
-
id: { type: 'string' },
|
|
287
|
-
kind: {
|
|
288
|
-
type: 'string',
|
|
289
|
-
enum: [
|
|
290
|
-
'tool_failure',
|
|
291
|
-
'frustration',
|
|
292
|
-
'partial_run',
|
|
293
|
-
'prompt_regression',
|
|
294
|
-
'skill_gap',
|
|
295
|
-
'insufficient_data',
|
|
296
|
-
],
|
|
297
|
-
},
|
|
298
|
-
title: { type: 'string' },
|
|
299
|
-
severity: { type: 'string', enum: ['critical', 'high', 'medium', 'low', 'info'] },
|
|
300
|
-
confidence: { type: 'string', enum: ['high', 'medium', 'low', 'unknown'] },
|
|
301
|
-
impactScore: { type: 'number' },
|
|
302
|
-
rankReason: { type: 'string' },
|
|
303
|
-
summary: { type: 'string' },
|
|
304
|
-
evidenceRefIds: { type: 'array', items: { type: 'string' } },
|
|
305
|
-
likelyLocations: { type: 'array', items: likelyLocationSchema },
|
|
306
|
-
recommendedActions: { type: 'array', items: productionActionSchema },
|
|
307
|
-
},
|
|
308
|
-
};
|
|
309
|
-
const productionAskResultSchema = {
|
|
310
|
-
$id: 'production_ask.v0.1',
|
|
311
|
-
title: 'ProductionAskResult',
|
|
312
|
-
description: 'Result payload for `moda ask`, sourced from cloud intelligence or local fallback.',
|
|
313
|
-
type: 'object',
|
|
314
|
-
additionalProperties: false,
|
|
315
|
-
required: [
|
|
316
|
-
'schemaVersion',
|
|
317
|
-
'generatedAt',
|
|
318
|
-
'source',
|
|
319
|
-
'question',
|
|
320
|
-
'answer',
|
|
321
|
-
'confidence',
|
|
322
|
-
'evidenceRefs',
|
|
323
|
-
'findings',
|
|
324
|
-
'nextCommands',
|
|
325
|
-
'warnings',
|
|
326
|
-
'degraded',
|
|
327
|
-
],
|
|
328
|
-
properties: {
|
|
329
|
-
schemaVersion: { type: 'string', const: 'production_ask.v0.1' },
|
|
330
|
-
generatedAt: { type: 'string', format: 'date-time' },
|
|
331
|
-
source: { type: 'string', enum: ['cloud', 'local_fallback'] },
|
|
332
|
-
question: { type: 'string' },
|
|
333
|
-
answer: { type: 'string' },
|
|
334
|
-
confidence: { type: 'string', enum: ['high', 'medium', 'low', 'unknown'] },
|
|
335
|
-
evidenceRefs: { type: 'array', items: productionEvidenceRefSchema },
|
|
336
|
-
findings: { type: 'array', items: productionFindingSchema },
|
|
337
|
-
nextCommands: { type: 'array', items: { type: 'string' } },
|
|
338
|
-
warnings: { type: 'array', items: { type: 'string' } },
|
|
339
|
-
degraded: { type: 'boolean' },
|
|
340
|
-
},
|
|
341
|
-
};
|
|
342
|
-
export const AGENT_JSON_SCHEMAS = {
|
|
343
|
-
'moda.agent.v1': agentEnvelopeSchema,
|
|
344
|
-
'moda.agent_event.v1': agentEventSchema,
|
|
345
|
-
// Canonical unified payload (MODA-388). Now the shape of the ask command's
|
|
346
|
-
// agent `data`. The legacy `production_ask.v0.1` schema is kept for
|
|
347
|
-
// back-compat with older agent integrations.
|
|
348
|
-
'moda.intelligence.v1': MODA_INTELLIGENCE_V1_JSON_SCHEMA,
|
|
349
|
-
'production_ask.v0.1': productionAskResultSchema,
|
|
350
|
-
};
|
|
351
|
-
export function renderJsonSchemas() {
|
|
352
|
-
return JSON.stringify({
|
|
353
|
-
$schema: 'http://json-schema.org/draft-07/schema#',
|
|
354
|
-
generated_by: 'moda-cli',
|
|
355
|
-
schemas: AGENT_JSON_SCHEMAS,
|
|
356
|
-
}, null, 2);
|
|
357
|
-
}
|
|
358
|
-
//# sourceMappingURL=agent-schemas.js.map
|