@moda-ai/cli 1.22.0 → 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 -777
- 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,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Maximum serialized harness graph size accepted by the backend sync endpoint.
|
|
3
|
-
* Must match `MAX_HARNESS_SYNC_GRAPH_BYTES` in
|
|
4
|
-
* `apps/moda-backend/src/harnesses/harness-sync-limits.ts`.
|
|
5
|
-
*/
|
|
6
|
-
export declare const MAX_HARNESS_SYNC_GRAPH_BYTES = 2000000;
|
|
7
|
-
export declare function assertHarnessGraphSyncSize(graph: unknown): void;
|
|
8
|
-
//# sourceMappingURL=harness-sync-limits.d.ts.map
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { CliInputError } from './errors.js';
|
|
2
|
-
/**
|
|
3
|
-
* Maximum serialized harness graph size accepted by the backend sync endpoint.
|
|
4
|
-
* Must match `MAX_HARNESS_SYNC_GRAPH_BYTES` in
|
|
5
|
-
* `apps/moda-backend/src/harnesses/harness-sync-limits.ts`.
|
|
6
|
-
*/
|
|
7
|
-
export const MAX_HARNESS_SYNC_GRAPH_BYTES = 2_000_000;
|
|
8
|
-
export function assertHarnessGraphSyncSize(graph) {
|
|
9
|
-
if (!graph || typeof graph !== 'object' || Array.isArray(graph)) {
|
|
10
|
-
throw new CliInputError('Harness graph must be an object before sync.');
|
|
11
|
-
}
|
|
12
|
-
const graphBytes = Buffer.byteLength(JSON.stringify(graph), 'utf8');
|
|
13
|
-
if (graphBytes > MAX_HARNESS_SYNC_GRAPH_BYTES) {
|
|
14
|
-
throw new CliInputError(`Harness graph is too large to sync (${graphBytes.toLocaleString()} bytes; limit ${MAX_HARNESS_SYNC_GRAPH_BYTES.toLocaleString()}).`, [
|
|
15
|
-
'Run `moda harness analyze --path=<agent-dir>` to narrow the harness root.',
|
|
16
|
-
'Reduce captured prompt/tool bodies if the graph grew too large.',
|
|
17
|
-
'Split multiple agent roots into separate harness syncs per tenant.',
|
|
18
|
-
].join('\n'));
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
//# sourceMappingURL=harness-sync-limits.js.map
|
package/dist/harness.d.ts
DELETED
|
@@ -1,463 +0,0 @@
|
|
|
1
|
-
import { type AnalystTuiEvent } from './analyst-tui.js';
|
|
2
|
-
import type { CommandContext } from './command-context.js';
|
|
3
|
-
import type { HarnessReport } from './harness-report.js';
|
|
4
|
-
declare const SCHEMA_VERSION = "harness.v0.1";
|
|
5
|
-
export interface HarnessEvidence {
|
|
6
|
-
path: string;
|
|
7
|
-
reason: string;
|
|
8
|
-
/**
|
|
9
|
-
* 1-based line where the cited item is defined. Optional in general, but
|
|
10
|
-
* required for `prompt` and `tool` artifacts so downstream prompt/tool
|
|
11
|
-
* optimization can retrieve the exact source text of every enumerated item.
|
|
12
|
-
*/
|
|
13
|
-
line?: number;
|
|
14
|
-
}
|
|
15
|
-
export interface HarnessDetection {
|
|
16
|
-
confidence: number;
|
|
17
|
-
evidence: HarnessEvidence[];
|
|
18
|
-
}
|
|
19
|
-
export interface HarnessRepo {
|
|
20
|
-
root: string;
|
|
21
|
-
name: string;
|
|
22
|
-
packageManagers: string[];
|
|
23
|
-
languages: string[];
|
|
24
|
-
remoteHash?: string;
|
|
25
|
-
}
|
|
26
|
-
export interface HarnessScanMetadata {
|
|
27
|
-
createdAt: string;
|
|
28
|
-
scannerVersion: string;
|
|
29
|
-
mode: 'permissioned' | 'dry-run';
|
|
30
|
-
rootPaths: string[];
|
|
31
|
-
readPlan: HarnessScanReadPlan;
|
|
32
|
-
skipped: Array<{
|
|
33
|
-
path: string;
|
|
34
|
-
reason: string;
|
|
35
|
-
}>;
|
|
36
|
-
/** True when the scan dropped files due to size/budget caps or snapshot limits. */
|
|
37
|
-
truncated?: boolean;
|
|
38
|
-
/** Human-readable reasons the scan is partial (budget skips, upload cap, etc.). */
|
|
39
|
-
truncationReasons?: string[];
|
|
40
|
-
/** Prompt/tool artifacts still missing a captured body after hydration. */
|
|
41
|
-
incompleteArtifactCount?: number;
|
|
42
|
-
}
|
|
43
|
-
export interface HarnessScanReadPlan {
|
|
44
|
-
scope: 'broad' | 'narrow';
|
|
45
|
-
rootPaths: string[];
|
|
46
|
-
willRead: string[];
|
|
47
|
-
willSkip: string[];
|
|
48
|
-
skipsSecretFiles: boolean;
|
|
49
|
-
followsSymlinks: boolean;
|
|
50
|
-
uploadsSourceByDefault: boolean;
|
|
51
|
-
}
|
|
52
|
-
export interface HarnessTenantContext {
|
|
53
|
-
tenantId: string;
|
|
54
|
-
source: 'flag' | 'env_or_config' | 'scan_option';
|
|
55
|
-
}
|
|
56
|
-
export interface HarnessAgentFamily extends HarnessDetection {
|
|
57
|
-
id: string;
|
|
58
|
-
name: string;
|
|
59
|
-
description?: string;
|
|
60
|
-
runtimeAgentIds: string[];
|
|
61
|
-
sharedArtifactIds: string[];
|
|
62
|
-
}
|
|
63
|
-
export interface HarnessRuntimeAgent extends HarnessDetection {
|
|
64
|
-
id: string;
|
|
65
|
-
name: string;
|
|
66
|
-
kind: 'runtime_agent';
|
|
67
|
-
purpose?: string;
|
|
68
|
-
familyId?: string;
|
|
69
|
-
root: string;
|
|
70
|
-
entrypointIds: string[];
|
|
71
|
-
channelAdapterIds: string[];
|
|
72
|
-
artifactIds: string[];
|
|
73
|
-
identityNamespaceIds: string[];
|
|
74
|
-
deploymentIds: string[];
|
|
75
|
-
frameworkIds: string[];
|
|
76
|
-
modelProviderIds: string[];
|
|
77
|
-
}
|
|
78
|
-
export interface HarnessDeveloperAgentAdapter extends HarnessDetection {
|
|
79
|
-
id: string;
|
|
80
|
-
name: string;
|
|
81
|
-
kind: 'developer_agent_adapter';
|
|
82
|
-
sourcePath: string;
|
|
83
|
-
}
|
|
84
|
-
export interface HarnessChannelAdapter extends HarnessDetection {
|
|
85
|
-
id: string;
|
|
86
|
-
name: string;
|
|
87
|
-
kind: string;
|
|
88
|
-
sourcePath?: string;
|
|
89
|
-
}
|
|
90
|
-
export type HarnessArtifactType = 'entrypoint' | 'prompt' | 'tool' | 'skill' | 'eval' | 'retrieval_index' | 'memory' | 'guardrail' | 'model_config' | 'unknown';
|
|
91
|
-
export interface HarnessArtifact extends HarnessDetection {
|
|
92
|
-
id: string;
|
|
93
|
-
type: HarnessArtifactType;
|
|
94
|
-
name: string;
|
|
95
|
-
scope: 'agent' | 'shared' | 'global';
|
|
96
|
-
sourcePath?: string;
|
|
97
|
-
contentHash?: string;
|
|
98
|
-
ownedByAgentId?: string;
|
|
99
|
-
usedByAgentIds: string[];
|
|
100
|
-
/**
|
|
101
|
-
* The actual usable content of the artifact, captured so downstream
|
|
102
|
-
* consumers (prompt optimization, tool optimization) can use it without
|
|
103
|
-
* re-reading the repo: the full prompt text for `prompt`, the signature +
|
|
104
|
-
* docstring/description for `tool`, the rule for `guardrail`, the assertion
|
|
105
|
-
* for `eval`, the config values for `model_config`, etc.
|
|
106
|
-
*/
|
|
107
|
-
body?: string;
|
|
108
|
-
}
|
|
109
|
-
export interface HarnessIdentityNamespace extends HarnessDetection {
|
|
110
|
-
id: string;
|
|
111
|
-
name: string;
|
|
112
|
-
kind: string;
|
|
113
|
-
canonicalId?: string;
|
|
114
|
-
sourcePath?: string;
|
|
115
|
-
}
|
|
116
|
-
export interface HarnessEnvironment extends HarnessDetection {
|
|
117
|
-
id: string;
|
|
118
|
-
name: string;
|
|
119
|
-
kind: string;
|
|
120
|
-
sourcePath?: string;
|
|
121
|
-
}
|
|
122
|
-
export interface HarnessAgentFramework extends HarnessDetection {
|
|
123
|
-
id: string;
|
|
124
|
-
name: string;
|
|
125
|
-
kind: string;
|
|
126
|
-
packageNames: string[];
|
|
127
|
-
runtimeAgentIds: string[];
|
|
128
|
-
}
|
|
129
|
-
export interface HarnessModelProvider extends HarnessDetection {
|
|
130
|
-
id: string;
|
|
131
|
-
name: string;
|
|
132
|
-
kind: string;
|
|
133
|
-
packageNames: string[];
|
|
134
|
-
runtimeAgentIds: string[];
|
|
135
|
-
envVars: string[];
|
|
136
|
-
modelHints: string[];
|
|
137
|
-
}
|
|
138
|
-
export interface HarnessDeployment extends HarnessDetection {
|
|
139
|
-
id: string;
|
|
140
|
-
name: string;
|
|
141
|
-
environmentId?: string;
|
|
142
|
-
sourcePath?: string;
|
|
143
|
-
}
|
|
144
|
-
export interface HarnessRelationship {
|
|
145
|
-
type: 'uses_artifact' | 'owns_artifact' | 'shares_artifact_with' | 'invoked_by_channel' | 'deployed_as' | 'runs_in_environment' | 'resolves_identity_to' | 'covered_by_eval' | 'emits_telemetry';
|
|
146
|
-
from: string;
|
|
147
|
-
to: string;
|
|
148
|
-
artifactId?: string;
|
|
149
|
-
evidence: HarnessEvidence[];
|
|
150
|
-
}
|
|
151
|
-
export interface HarnessUnknown {
|
|
152
|
-
id: string;
|
|
153
|
-
question: string;
|
|
154
|
-
candidateIds: string[];
|
|
155
|
-
evidence: HarnessEvidence[];
|
|
156
|
-
}
|
|
157
|
-
export interface HarnessGraph {
|
|
158
|
-
schemaVersion: typeof SCHEMA_VERSION;
|
|
159
|
-
harnessId: string;
|
|
160
|
-
tenant?: HarnessTenantContext;
|
|
161
|
-
repo: HarnessRepo;
|
|
162
|
-
scan: HarnessScanMetadata;
|
|
163
|
-
agentFamilies: HarnessAgentFamily[];
|
|
164
|
-
runtimeAgents: HarnessRuntimeAgent[];
|
|
165
|
-
developerAgentAdapters: HarnessDeveloperAgentAdapter[];
|
|
166
|
-
channelAdapters: HarnessChannelAdapter[];
|
|
167
|
-
artifacts: HarnessArtifact[];
|
|
168
|
-
identityNamespaces: HarnessIdentityNamespace[];
|
|
169
|
-
environments: HarnessEnvironment[];
|
|
170
|
-
agentFrameworks: HarnessAgentFramework[];
|
|
171
|
-
modelProviders: HarnessModelProvider[];
|
|
172
|
-
deployments: HarnessDeployment[];
|
|
173
|
-
relationships: HarnessRelationship[];
|
|
174
|
-
unknowns: HarnessUnknown[];
|
|
175
|
-
}
|
|
176
|
-
export interface FileInventoryItem {
|
|
177
|
-
path: string;
|
|
178
|
-
absPath: string;
|
|
179
|
-
rootDir: string;
|
|
180
|
-
text?: string;
|
|
181
|
-
}
|
|
182
|
-
interface ScanOptions {
|
|
183
|
-
rootDir?: string;
|
|
184
|
-
dryRun?: boolean;
|
|
185
|
-
scannerVersion?: string;
|
|
186
|
-
tenantId?: string;
|
|
187
|
-
tenantSource?: HarnessTenantContext['source'];
|
|
188
|
-
pathWasExplicit?: boolean;
|
|
189
|
-
}
|
|
190
|
-
export interface HarnessSummary {
|
|
191
|
-
schemaVersion: string;
|
|
192
|
-
harnessId: string;
|
|
193
|
-
tenantId?: string;
|
|
194
|
-
runtimeAgentCount: number;
|
|
195
|
-
agentFamilyCount: number;
|
|
196
|
-
sharedArtifactCount: number;
|
|
197
|
-
channelAdapterCount: number;
|
|
198
|
-
identityNamespaceCount: number;
|
|
199
|
-
agentFrameworkCount: number;
|
|
200
|
-
modelProviderCount: number;
|
|
201
|
-
deploymentCount: number;
|
|
202
|
-
unknownCount: number;
|
|
203
|
-
}
|
|
204
|
-
interface HarnessSyncResponse {
|
|
205
|
-
tenantId: string;
|
|
206
|
-
harnessId: string;
|
|
207
|
-
harnessKey: string;
|
|
208
|
-
versionId: string;
|
|
209
|
-
graphHash: string;
|
|
210
|
-
changed: boolean;
|
|
211
|
-
dryRun: boolean;
|
|
212
|
-
reportHash?: string | null;
|
|
213
|
-
reportValidationStatus?: string | null;
|
|
214
|
-
counts: Record<string, number>;
|
|
215
|
-
}
|
|
216
|
-
interface HarnessSyncPlan {
|
|
217
|
-
endpoint: '/api/harnesses/sync';
|
|
218
|
-
resource: 'harness';
|
|
219
|
-
source: 'local_scan' | 'approved_report';
|
|
220
|
-
profile: string;
|
|
221
|
-
tenantId?: string;
|
|
222
|
-
rootPath: string;
|
|
223
|
-
sourceCommit?: string;
|
|
224
|
-
harnessId: string;
|
|
225
|
-
localGraphHash: string;
|
|
226
|
-
counts: Record<string, number>;
|
|
227
|
-
uploads: string[];
|
|
228
|
-
localWrites: string[];
|
|
229
|
-
privacy: string[];
|
|
230
|
-
}
|
|
231
|
-
export interface HarnessSyncState {
|
|
232
|
-
schemaVersion: 'sync_state.v0.1';
|
|
233
|
-
updatedAt: string;
|
|
234
|
-
resource: 'harness';
|
|
235
|
-
source: HarnessSyncPlan['source'];
|
|
236
|
-
profile: string;
|
|
237
|
-
tenantId?: string;
|
|
238
|
-
rootPath: string;
|
|
239
|
-
sourceCommit?: string;
|
|
240
|
-
harnessId: string;
|
|
241
|
-
localGraphHash: string;
|
|
242
|
-
report?: {
|
|
243
|
-
reportId: string;
|
|
244
|
-
reportHash: string;
|
|
245
|
-
validationStatus: string;
|
|
246
|
-
};
|
|
247
|
-
remote: HarnessSyncResponse;
|
|
248
|
-
summary: HarnessSummary;
|
|
249
|
-
uploads: string[];
|
|
250
|
-
privacy: string[];
|
|
251
|
-
written: string[];
|
|
252
|
-
}
|
|
253
|
-
type HarnessAnalystAdapter = 'claude' | 'codex' | 'cursor' | 'local-scan';
|
|
254
|
-
type ExternalHarnessAnalystAdapter = Exclude<HarnessAnalystAdapter, 'local-scan'>;
|
|
255
|
-
export type CodingAgentMode = 'read-only' | 'write';
|
|
256
|
-
export declare function runHarnessCommand(context: CommandContext): Promise<{
|
|
257
|
-
exitCode: number;
|
|
258
|
-
}>;
|
|
259
|
-
/** Scan plan (scope, approval, read plan) built for every harness command run. */
|
|
260
|
-
export type HarnessCommandScanPlan = ReturnType<typeof buildCommandScanPlan>;
|
|
261
|
-
interface HarnessAnalyzePayload {
|
|
262
|
-
scanPlan: HarnessCommandScanPlan;
|
|
263
|
-
summary: HarnessSummary | Record<string, unknown>;
|
|
264
|
-
report: unknown;
|
|
265
|
-
validation: {
|
|
266
|
-
status: string;
|
|
267
|
-
warnings?: unknown[];
|
|
268
|
-
errors?: unknown[];
|
|
269
|
-
};
|
|
270
|
-
written: string[];
|
|
271
|
-
dryRun: boolean;
|
|
272
|
-
}
|
|
273
|
-
export declare function writeHarnessAnalyzeResult(context: CommandContext, payload: HarnessAnalyzePayload): void;
|
|
274
|
-
/**
|
|
275
|
-
* Emit one `artifact` lifecycle event per written file, classifying report vs
|
|
276
|
-
* graph artifacts. Shared by the local-scan, external-analyst, and remote
|
|
277
|
-
* analyze paths.
|
|
278
|
-
*/
|
|
279
|
-
export declare function emitWrittenArtifacts(context: CommandContext, written: string[], description: string): void;
|
|
280
|
-
export declare function repairExternalAnalystReport(report: HarnessReport, rootDir: string): HarnessReport;
|
|
281
|
-
/**
|
|
282
|
-
* A parsed coding-agent stream event handed to `onAgentEvent` consumers.
|
|
283
|
-
* Extends the analyst TUI event with an optional `detail` (file path or
|
|
284
|
-
* command extracted from tool input) so callers can render richer one-line
|
|
285
|
-
* progress cards. The analyst TUI ignores the extra field.
|
|
286
|
-
*/
|
|
287
|
-
export type CodingAgentEvent = AnalystTuiEvent & {
|
|
288
|
-
detail?: string;
|
|
289
|
-
};
|
|
290
|
-
/**
|
|
291
|
-
* Translate a parsed coding-agent stream event into a one-line progress card
|
|
292
|
-
* ("editing src/llm/client.ts", "running bun add moda-ai", trimmed agent text).
|
|
293
|
-
* Returns undefined for low-signal events (system noise) so they never reach
|
|
294
|
-
* the user. Shared by the init progress board (via sdk-integration) and the
|
|
295
|
-
* agent-stream analyst progress events below.
|
|
296
|
-
*/
|
|
297
|
-
export declare function describeCodingAgentEvent(event: CodingAgentEvent): string | undefined;
|
|
298
|
-
/**
|
|
299
|
-
* Map a parsed analyst stream event to the `progress` agent event the CLI
|
|
300
|
-
* writes in agent-stream mode. Tool/command events get a `tool_use` phase so
|
|
301
|
-
* downstream consumers (the hosted analyze runner's progress parser counts
|
|
302
|
-
* phases starting with "tool") can track tool-call activity; agent text gets
|
|
303
|
-
* the generic `analyst` phase. Low-signal events map to undefined.
|
|
304
|
-
*/
|
|
305
|
-
export declare function analystEventProgress(event: CodingAgentEvent): {
|
|
306
|
-
phase: string;
|
|
307
|
-
message: string;
|
|
308
|
-
} | undefined;
|
|
309
|
-
export declare function sleep(ms: number): Promise<void>;
|
|
310
|
-
export declare function summarizeInvalidAnalystReport(report: unknown): Record<string, unknown>;
|
|
311
|
-
/**
|
|
312
|
-
* The analyst spellings that select the deterministic local scanner (no LLM,
|
|
313
|
-
* no remote analyze). Shared by `normalizeAnalystAdapter` and `moda init`'s
|
|
314
|
-
* `resolveHarnessRemote` so the set cannot drift between the two.
|
|
315
|
-
*/
|
|
316
|
-
export declare function isDeterministicLocalAnalyst(raw: string | undefined): boolean;
|
|
317
|
-
export type CodingAgentAdapter = ExternalHarnessAnalystAdapter;
|
|
318
|
-
export interface CodingAgentRun {
|
|
319
|
-
adapter: CodingAgentAdapter;
|
|
320
|
-
command: string;
|
|
321
|
-
status: number | null;
|
|
322
|
-
stdout: string;
|
|
323
|
-
stderr: string;
|
|
324
|
-
timedOut: boolean;
|
|
325
|
-
failedToStart: boolean;
|
|
326
|
-
}
|
|
327
|
-
/** Coding-agent CLIs found on PATH, ranked best-first (claude > codex > cursor). */
|
|
328
|
-
export declare function detectAvailableCodingAgents(): Array<{
|
|
329
|
-
adapter: CodingAgentAdapter;
|
|
330
|
-
command: string;
|
|
331
|
-
}>;
|
|
332
|
-
export declare function codingAgentDisplayName(adapter: CodingAgentAdapter): string;
|
|
333
|
-
/** Spawn an installed coding-agent CLI with a prompt; capture its output. */
|
|
334
|
-
export declare function runCodingAgent(options: {
|
|
335
|
-
adapter: CodingAgentAdapter;
|
|
336
|
-
prompt: string;
|
|
337
|
-
rootDir: string;
|
|
338
|
-
mode: CodingAgentMode;
|
|
339
|
-
env?: NodeJS.ProcessEnv;
|
|
340
|
-
stream?: boolean;
|
|
341
|
-
timeoutMs?: number;
|
|
342
|
-
progressToStderr?: boolean;
|
|
343
|
-
onProgress?: (message: string, phase?: string) => void;
|
|
344
|
-
/**
|
|
345
|
-
* Receive parsed agent stream events incrementally while output stays
|
|
346
|
-
* buffered. Requires the streaming invocation, so passing it defaults
|
|
347
|
-
* `stream` to true when not set explicitly.
|
|
348
|
-
*/
|
|
349
|
-
onAgentEvent?: (event: CodingAgentEvent) => void;
|
|
350
|
-
}): Promise<CodingAgentRun>;
|
|
351
|
-
export declare function truncateText(value: string, maxLength: number): string;
|
|
352
|
-
export declare function scanHarness(options?: ScanOptions): HarnessGraph;
|
|
353
|
-
export declare function summarizeHarness(graph: HarnessGraph): HarnessSummary;
|
|
354
|
-
/** One repo-relative source file included in a {@link SourceSnapshot}. */
|
|
355
|
-
export interface SourceSnapshotFile {
|
|
356
|
-
path: string;
|
|
357
|
-
text: string;
|
|
358
|
-
}
|
|
359
|
-
/**
|
|
360
|
-
* A safe, bounded source snapshot uploaded to Moda for server-side ("Moda-hosted")
|
|
361
|
-
* harness analysis. Built by reusing the same permissioned inventory the local
|
|
362
|
-
* scanner uses, so it inherits every safety property already implemented in
|
|
363
|
-
* `inventoryFiles`: secret-bearing files are skipped, symlinks are skipped, and
|
|
364
|
-
* the per-file (512KB) plus whole-scan (12k-file / 48MB) budgets bound the size.
|
|
365
|
-
* Only files whose text was actually read are included; `truncated` records
|
|
366
|
-
* whether any file was dropped for exceeding a size/budget cap.
|
|
367
|
-
*/
|
|
368
|
-
export interface SourceSnapshot {
|
|
369
|
-
repo: {
|
|
370
|
-
name: string;
|
|
371
|
-
root: '.';
|
|
372
|
-
};
|
|
373
|
-
files: SourceSnapshotFile[];
|
|
374
|
-
truncated: boolean;
|
|
375
|
-
fileCount: number;
|
|
376
|
-
byteCount: number;
|
|
377
|
-
gitCommit?: string;
|
|
378
|
-
}
|
|
379
|
-
/**
|
|
380
|
-
* Build a safe source snapshot of `rootDir` by reusing the permissioned
|
|
381
|
-
* `inventoryFiles` walk (secret-skip, symlink-skip, 512KB/file, 12k-file/48MB
|
|
382
|
-
* caps) plus `detectRepo`/`getGitCommit`. Only files with text content are
|
|
383
|
-
* included; `truncated` is set when the scan dropped any file for a size/budget
|
|
384
|
-
* cap so the server knows the snapshot is incomplete.
|
|
385
|
-
*/
|
|
386
|
-
export declare function buildSourceSnapshot(rootDir: string): SourceSnapshot;
|
|
387
|
-
declare function buildCommandScanPlan(context: CommandContext, rootDir: string): {
|
|
388
|
-
scope: 'broad' | 'narrow';
|
|
389
|
-
root: string;
|
|
390
|
-
approval: {
|
|
391
|
-
required: boolean;
|
|
392
|
-
granted: boolean;
|
|
393
|
-
reason: string;
|
|
394
|
-
};
|
|
395
|
-
readPlan: HarnessScanReadPlan;
|
|
396
|
-
};
|
|
397
|
-
export declare function writeHumanProgress(context: CommandContext, message: string): void;
|
|
398
|
-
export declare function readHarnessSyncState(rootDir: string): HarnessSyncState | undefined;
|
|
399
|
-
/**
|
|
400
|
-
* The identity a sync-style upload will actually authenticate as, resolved
|
|
401
|
-
* with the same precedence as the API call itself (MODA_API_KEY env wins over
|
|
402
|
-
* the active profile / legacy config). Used for the pre-upload
|
|
403
|
-
* "Syncing as <credential> → tenant <id>" banner so a shadowed or stale key
|
|
404
|
-
* is visible BEFORE data lands in the wrong tenant.
|
|
405
|
-
*
|
|
406
|
-
* The destination tenant is derived from the WINNING KEY itself (signed CLI
|
|
407
|
-
* keys embed their tenant, and the server resolves the destination from the
|
|
408
|
-
* key alone) — never from flag/env/profile config, which is exactly what a
|
|
409
|
-
* shadowing stale key disagrees with. When the key does not embed a tenant,
|
|
410
|
-
* the config-resolved id is returned with `tenantSource: 'config'` so
|
|
411
|
-
* callers must label it unverified. Best-effort: never throws (a broken
|
|
412
|
-
* MODA_PROFILE must not abort onboarding).
|
|
413
|
-
*/
|
|
414
|
-
export declare function describeSyncIdentity(options?: {
|
|
415
|
-
profile?: string;
|
|
416
|
-
env?: NodeJS.ProcessEnv;
|
|
417
|
-
}): {
|
|
418
|
-
credential: string;
|
|
419
|
-
tenantId?: string;
|
|
420
|
-
/** 'api-key' = decoded from the winning key (authoritative); 'config' = flag/env/profile fallback (unverified). */
|
|
421
|
-
tenantSource?: 'api-key' | 'config';
|
|
422
|
-
} | undefined;
|
|
423
|
-
/**
|
|
424
|
-
* Human tenant label for the identity banner: key-derived ids are printed
|
|
425
|
-
* bare; config-derived ids are explicitly marked unverified so the banner
|
|
426
|
-
* never asserts a destination the server might not use.
|
|
427
|
-
*/
|
|
428
|
-
export declare function describeSyncTenantLabel(identity: {
|
|
429
|
-
tenantId?: string;
|
|
430
|
-
tenantSource?: 'api-key' | 'config';
|
|
431
|
-
}): string;
|
|
432
|
-
/**
|
|
433
|
-
* Reports in subdirectories that are FRESHER than the root's
|
|
434
|
-
* `.moda/harness-report.json` (a missing root report counts as infinitely
|
|
435
|
-
* old). Catches the `--path` trap: `harness analyze --path=<subdir>` writes
|
|
436
|
-
* `<subdir>/.moda/harness-report.json`, and a later root-level
|
|
437
|
-
* `harness approve`/`sync` silently targets the stale (or absent) root report.
|
|
438
|
-
* Newest first.
|
|
439
|
-
*/
|
|
440
|
-
export declare function findFresherHarnessReports(rootDir: string): Array<{
|
|
441
|
-
path: string;
|
|
442
|
-
mtimeMs: number;
|
|
443
|
-
}>;
|
|
444
|
-
export declare function writeHarnessArtifacts(graph: HarnessGraph, rootDir: string, options?: {
|
|
445
|
-
summary?: boolean;
|
|
446
|
-
}): string[];
|
|
447
|
-
export declare function graphForSync(graph: HarnessGraph): HarnessGraph;
|
|
448
|
-
/**
|
|
449
|
-
* Bounded repo walk shared by `harness scan`, snapshot upload, and the static
|
|
450
|
-
* candidates pre-pass: skips ignored/secret-bearing paths and symlinks,
|
|
451
|
-
* enforces the file-count and text-byte budgets, and reads text for known
|
|
452
|
-
* text extensions plus any file admitted by `options.includeFile`.
|
|
453
|
-
* `options.includeFile` widens (ORs with) the default inventory predicate and
|
|
454
|
-
* also opts its files into text reading — it can never re-admit secret-bearing
|
|
455
|
-
* or oversized files, which are rejected before the predicate runs.
|
|
456
|
-
*/
|
|
457
|
-
export declare function inventoryFiles(rootDir: string, skipped: HarnessScanMetadata['skipped'], options?: {
|
|
458
|
-
includeFile?: (relPath: string) => boolean;
|
|
459
|
-
}): FileInventoryItem[];
|
|
460
|
-
export declare function numericEnv(name: string, fallback: number): number;
|
|
461
|
-
export declare function numericEnvAllowZero(name: string, fallback: number): number;
|
|
462
|
-
export {};
|
|
463
|
-
//# sourceMappingURL=harness.d.ts.map
|