@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
package/dist/sync.d.ts
DELETED
package/dist/sync.js
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { CliInputError } from './errors.js';
|
|
2
|
-
import { runHarnessCommand } from './harness.js';
|
|
3
|
-
import { runPromptsCommand } from './prompts.js';
|
|
4
|
-
import { runSkillsCommand } from './skills.js';
|
|
5
|
-
export async function runSyncCommand(context) {
|
|
6
|
-
const resource = context.positionals[0] ?? 'harness';
|
|
7
|
-
const rest = context.positionals.slice(1);
|
|
8
|
-
if (resource === 'harness') {
|
|
9
|
-
return runHarnessCommand({
|
|
10
|
-
...context,
|
|
11
|
-
command: 'harness',
|
|
12
|
-
positional: 'sync',
|
|
13
|
-
positionals: ['sync', ...rest],
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
if (resource === 'prompts') {
|
|
17
|
-
await runPromptsCommand(['sync', ...rest], context.flags, {
|
|
18
|
-
profile: context.profile,
|
|
19
|
-
env: context.env,
|
|
20
|
-
});
|
|
21
|
-
return { exitCode: 0 };
|
|
22
|
-
}
|
|
23
|
-
if (resource === 'skills') {
|
|
24
|
-
// Skills surface is pull-oriented (install approved skills locally), unlike
|
|
25
|
-
// prompts sync which pushes authored config upstream.
|
|
26
|
-
const exitCode = await runSkillsCommand({
|
|
27
|
-
...context,
|
|
28
|
-
command: 'skills',
|
|
29
|
-
positional: 'pull',
|
|
30
|
-
positionals: ['pull', ...rest],
|
|
31
|
-
});
|
|
32
|
-
return { exitCode };
|
|
33
|
-
}
|
|
34
|
-
throw new CliInputError(`Unknown sync resource '${resource}'.`, 'Usage: moda sync [harness|prompts|skills] [--dry-run] [--profile=NAME]');
|
|
35
|
-
}
|
|
36
|
-
//# sourceMappingURL=sync.js.map
|
package/dist/telemetry.d.ts
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import type { CliOutputMode } from './output.js';
|
|
2
|
-
import type { CommandTelemetryMeta } from './command-context.js';
|
|
3
|
-
export type TelemetryStatus = 'success' | 'error';
|
|
4
|
-
export type TelemetryErrorType = 'validation_error' | 'api_error' | 'network_error' | 'unknown_error';
|
|
5
|
-
export type SearchSurface = 'none' | 'conversation' | 'world_state' | 'cluster' | 'message' | 'context';
|
|
6
|
-
export type SearchMode = 'na' | 'keyword' | 'semantic' | 'hybrid';
|
|
7
|
-
export type Tristate = 'na' | 'no' | 'yes';
|
|
8
|
-
/**
|
|
9
|
-
* Phase 6 search-adoption telemetry. Every field is optional and the backend
|
|
10
|
-
* defaults absent values, so it is always safe to omit a field we can't derive.
|
|
11
|
-
*/
|
|
12
|
-
export interface SearchAdoptionTelemetry {
|
|
13
|
-
output_mode?: CliOutputMode;
|
|
14
|
-
subcommand?: string;
|
|
15
|
-
search_surface?: SearchSurface;
|
|
16
|
-
search_mode_requested?: SearchMode;
|
|
17
|
-
search_mode_effective?: SearchMode;
|
|
18
|
-
query_length?: number;
|
|
19
|
-
query_term_count?: number;
|
|
20
|
-
result_count?: number;
|
|
21
|
-
zero_result?: Tristate;
|
|
22
|
-
has_more?: Tristate;
|
|
23
|
-
used_msg_index?: 0 | 1;
|
|
24
|
-
skill_version?: string;
|
|
25
|
-
}
|
|
26
|
-
export interface CliUsageTelemetryInput {
|
|
27
|
-
apiKey: string | undefined;
|
|
28
|
-
command: string;
|
|
29
|
-
flags: Record<string, string>;
|
|
30
|
-
status: TelemetryStatus;
|
|
31
|
-
errorType?: TelemetryErrorType;
|
|
32
|
-
exitCode: number;
|
|
33
|
-
durationMs: number;
|
|
34
|
-
apiRequestCount: number;
|
|
35
|
-
adoption?: SearchAdoptionTelemetry;
|
|
36
|
-
}
|
|
37
|
-
export declare const SEARCH_MODES: readonly SearchMode[];
|
|
38
|
-
/**
|
|
39
|
-
* Derive the search-adoption telemetry for a command. Static fields come from
|
|
40
|
-
* the command name + flags; response-derived fields (effective mode, result
|
|
41
|
-
* count, has_more) are read from whatever the handler recorded on the context.
|
|
42
|
-
*/
|
|
43
|
-
export declare function buildSearchAdoptionTelemetry(input: {
|
|
44
|
-
command: string;
|
|
45
|
-
positional: string | undefined;
|
|
46
|
-
flags: Record<string, string>;
|
|
47
|
-
outputMode: CliOutputMode;
|
|
48
|
-
recorded: CommandTelemetryMeta;
|
|
49
|
-
skillVersion?: string;
|
|
50
|
-
}): SearchAdoptionTelemetry;
|
|
51
|
-
export declare function stripTelemetryFlag(flags: Record<string, string>): Record<string, string>;
|
|
52
|
-
export declare function isTelemetryDisabled(flags: Record<string, string>): boolean;
|
|
53
|
-
export declare function getInvocationId(): string;
|
|
54
|
-
export declare function sanitizedFlagNames(flags: Record<string, string>): string[];
|
|
55
|
-
export declare function sendCliUsageTelemetry(input: CliUsageTelemetryInput): Promise<void>;
|
|
56
|
-
//# sourceMappingURL=telemetry.d.ts.map
|
package/dist/telemetry.js
DELETED
|
@@ -1,167 +0,0 @@
|
|
|
1
|
-
import { randomUUID } from 'node:crypto';
|
|
2
|
-
import { VERSION, resolveModaBaseUrl } from './config.js';
|
|
3
|
-
const TELEMETRY_TIMEOUT_MS = 500;
|
|
4
|
-
const INVOCATION_ID = randomUUID();
|
|
5
|
-
const TELEMETRY_FLAG = 'no-telemetry';
|
|
6
|
-
const SEARCH_SURFACE_BY_COMMAND = {
|
|
7
|
-
search: 'message',
|
|
8
|
-
conversations: 'conversation',
|
|
9
|
-
clusters: 'cluster',
|
|
10
|
-
'cluster-conversations': 'cluster',
|
|
11
|
-
'world-state': 'world_state',
|
|
12
|
-
context: 'context',
|
|
13
|
-
};
|
|
14
|
-
export const SEARCH_MODES = ['keyword', 'semantic', 'hybrid'];
|
|
15
|
-
function termCount(query) {
|
|
16
|
-
return query.trim().split(/\s+/).filter(Boolean).length;
|
|
17
|
-
}
|
|
18
|
-
function clampInt(value, min, max) {
|
|
19
|
-
if (typeof value !== 'number' || !Number.isFinite(value))
|
|
20
|
-
return undefined;
|
|
21
|
-
return Math.min(max, Math.max(min, Math.round(value)));
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Derive the search-adoption telemetry for a command. Static fields come from
|
|
25
|
-
* the command name + flags; response-derived fields (effective mode, result
|
|
26
|
-
* count, has_more) are read from whatever the handler recorded on the context.
|
|
27
|
-
*/
|
|
28
|
-
export function buildSearchAdoptionTelemetry(input) {
|
|
29
|
-
const { command, positional, flags, outputMode, recorded } = input;
|
|
30
|
-
const adoption = {
|
|
31
|
-
output_mode: outputMode,
|
|
32
|
-
search_surface: SEARCH_SURFACE_BY_COMMAND[command] ?? 'none',
|
|
33
|
-
};
|
|
34
|
-
// The query lives in the positional for `moda search`, but in `--search` for
|
|
35
|
-
// the conversations list surface.
|
|
36
|
-
let queryText;
|
|
37
|
-
if (command === 'search')
|
|
38
|
-
queryText = positional;
|
|
39
|
-
else if (command === 'conversations')
|
|
40
|
-
queryText = flags.search;
|
|
41
|
-
// Trim before measuring both dimensions so query_length and query_term_count
|
|
42
|
-
// describe the same (trimmed) query the backend actually sees.
|
|
43
|
-
const trimmedQuery = queryText?.trim() ?? '';
|
|
44
|
-
if (trimmedQuery !== '') {
|
|
45
|
-
adoption.query_length = trimmedQuery.length;
|
|
46
|
-
adoption.query_term_count = termCount(trimmedQuery);
|
|
47
|
-
}
|
|
48
|
-
// search_mode is only meaningful for the message-grain search command.
|
|
49
|
-
if (command === 'search') {
|
|
50
|
-
const requested = (flags.mode ?? '').toLowerCase();
|
|
51
|
-
adoption.search_mode_requested = SEARCH_MODES.includes(requested)
|
|
52
|
-
? requested
|
|
53
|
-
: 'hybrid'; // mirrors SearchSchema's default
|
|
54
|
-
}
|
|
55
|
-
// used_msg_index only applies to the conversation context surface.
|
|
56
|
-
if (command === 'context') {
|
|
57
|
-
adoption.used_msg_index = flags['msg-index'] !== undefined ? 1 : 0;
|
|
58
|
-
}
|
|
59
|
-
if (recorded.search_mode_effective) {
|
|
60
|
-
adoption.search_mode_effective = recorded.search_mode_effective;
|
|
61
|
-
}
|
|
62
|
-
if (typeof recorded.result_count === 'number') {
|
|
63
|
-
adoption.result_count = recorded.result_count;
|
|
64
|
-
adoption.zero_result = recorded.result_count === 0 ? 'yes' : 'no';
|
|
65
|
-
}
|
|
66
|
-
if (recorded.has_more)
|
|
67
|
-
adoption.has_more = recorded.has_more;
|
|
68
|
-
const skill = input.skillVersion?.trim();
|
|
69
|
-
if (skill)
|
|
70
|
-
adoption.skill_version = skill.slice(0, 64);
|
|
71
|
-
return adoption;
|
|
72
|
-
}
|
|
73
|
-
function serializeAdoption(adoption) {
|
|
74
|
-
if (!adoption)
|
|
75
|
-
return {};
|
|
76
|
-
const out = {};
|
|
77
|
-
if (adoption.output_mode)
|
|
78
|
-
out.output_mode = adoption.output_mode;
|
|
79
|
-
if (adoption.subcommand)
|
|
80
|
-
out.subcommand = adoption.subcommand.slice(0, 64);
|
|
81
|
-
if (adoption.search_surface)
|
|
82
|
-
out.search_surface = adoption.search_surface;
|
|
83
|
-
if (adoption.search_mode_requested) {
|
|
84
|
-
out.search_mode_requested = adoption.search_mode_requested;
|
|
85
|
-
}
|
|
86
|
-
if (adoption.search_mode_effective) {
|
|
87
|
-
out.search_mode_effective = adoption.search_mode_effective;
|
|
88
|
-
}
|
|
89
|
-
const queryLength = clampInt(adoption.query_length, 0, 2000);
|
|
90
|
-
if (queryLength !== undefined)
|
|
91
|
-
out.query_length = queryLength;
|
|
92
|
-
const queryTermCount = clampInt(adoption.query_term_count, 0, 200);
|
|
93
|
-
if (queryTermCount !== undefined)
|
|
94
|
-
out.query_term_count = queryTermCount;
|
|
95
|
-
const resultCount = clampInt(adoption.result_count, 0, 100_000);
|
|
96
|
-
if (resultCount !== undefined)
|
|
97
|
-
out.result_count = resultCount;
|
|
98
|
-
if (adoption.zero_result)
|
|
99
|
-
out.zero_result = adoption.zero_result;
|
|
100
|
-
if (adoption.has_more)
|
|
101
|
-
out.has_more = adoption.has_more;
|
|
102
|
-
if (adoption.used_msg_index !== undefined) {
|
|
103
|
-
out.used_msg_index = adoption.used_msg_index ? 1 : 0;
|
|
104
|
-
}
|
|
105
|
-
if (adoption.skill_version)
|
|
106
|
-
out.skill_version = adoption.skill_version.slice(0, 64);
|
|
107
|
-
return out;
|
|
108
|
-
}
|
|
109
|
-
export function stripTelemetryFlag(flags) {
|
|
110
|
-
const { [TELEMETRY_FLAG]: _drop, ...rest } = flags;
|
|
111
|
-
return rest;
|
|
112
|
-
}
|
|
113
|
-
export function isTelemetryDisabled(flags) {
|
|
114
|
-
return (flags[TELEMETRY_FLAG] === 'true' ||
|
|
115
|
-
process.env.MODA_CLI_TELEMETRY === '0' ||
|
|
116
|
-
process.env.DO_NOT_TRACK === '1');
|
|
117
|
-
}
|
|
118
|
-
export function getInvocationId() {
|
|
119
|
-
return INVOCATION_ID;
|
|
120
|
-
}
|
|
121
|
-
export function sanitizedFlagNames(flags) {
|
|
122
|
-
return Object.keys(stripTelemetryFlag(flags)).sort();
|
|
123
|
-
}
|
|
124
|
-
export async function sendCliUsageTelemetry(input) {
|
|
125
|
-
if (!input.apiKey || isTelemetryDisabled(input.flags)) {
|
|
126
|
-
return;
|
|
127
|
-
}
|
|
128
|
-
const controller = new AbortController();
|
|
129
|
-
const timeout = setTimeout(() => controller.abort(), TELEMETRY_TIMEOUT_MS);
|
|
130
|
-
// Allow Node's event loop to drain naturally without the timer keeping
|
|
131
|
-
// the process alive after telemetry resolves.
|
|
132
|
-
if (typeof timeout.unref === 'function') {
|
|
133
|
-
timeout.unref();
|
|
134
|
-
}
|
|
135
|
-
try {
|
|
136
|
-
await fetch(`${resolveModaBaseUrl()}/api/v1/data/cli-usage`, {
|
|
137
|
-
method: 'POST',
|
|
138
|
-
headers: {
|
|
139
|
-
'x-api-key': input.apiKey,
|
|
140
|
-
'Content-Type': 'application/json',
|
|
141
|
-
},
|
|
142
|
-
body: JSON.stringify({
|
|
143
|
-
invocation_id: INVOCATION_ID,
|
|
144
|
-
command: input.command.slice(0, 64),
|
|
145
|
-
status: input.status,
|
|
146
|
-
error_type: input.errorType,
|
|
147
|
-
exit_code: input.exitCode,
|
|
148
|
-
duration_ms: Math.max(0, Math.round(input.durationMs)),
|
|
149
|
-
api_request_count: Math.max(0, Math.round(input.apiRequestCount)),
|
|
150
|
-
cli_version: VERSION,
|
|
151
|
-
node_version: process.versions.node,
|
|
152
|
-
platform: process.platform,
|
|
153
|
-
arch: process.arch,
|
|
154
|
-
flags_json: { names: sanitizedFlagNames(input.flags) },
|
|
155
|
-
...serializeAdoption(input.adoption),
|
|
156
|
-
}),
|
|
157
|
-
signal: controller.signal,
|
|
158
|
-
});
|
|
159
|
-
}
|
|
160
|
-
catch {
|
|
161
|
-
// Telemetry must never affect command output or exit behavior.
|
|
162
|
-
}
|
|
163
|
-
finally {
|
|
164
|
-
clearTimeout(timeout);
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
//# sourceMappingURL=telemetry.js.map
|
package/dist/transforms.d.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
export interface FrustrationAnchor {
|
|
2
|
-
kind: 'frustration';
|
|
3
|
-
conversation_id: string;
|
|
4
|
-
msg_index: number | null;
|
|
5
|
-
signal: string | null;
|
|
6
|
-
quote_preview: string | null;
|
|
7
|
-
all_turns: number[];
|
|
8
|
-
no_anchor: boolean;
|
|
9
|
-
}
|
|
10
|
-
export interface ToolFailureAnchor {
|
|
11
|
-
kind: 'tool_failure';
|
|
12
|
-
conversation_id: string;
|
|
13
|
-
msg_index: number | null;
|
|
14
|
-
tool_name: string;
|
|
15
|
-
tool_use_id: string | null;
|
|
16
|
-
error_subtype: string | null;
|
|
17
|
-
no_anchor: boolean;
|
|
18
|
-
}
|
|
19
|
-
export declare function asRecord(value: unknown): Record<string, unknown> | null;
|
|
20
|
-
export declare function asString(value: unknown): string | null;
|
|
21
|
-
export declare function asNumber(value: unknown): number | null;
|
|
22
|
-
export declare function withFrustrationAnchors(response: Record<string, unknown>): Record<string, unknown>;
|
|
23
|
-
export declare function withToolFailureAnchors(response: Record<string, unknown>): Record<string, unknown>;
|
|
24
|
-
export declare function embeddedWindowSize(conversation: Record<string, unknown> | null | undefined): number | null;
|
|
25
|
-
//# sourceMappingURL=transforms.d.ts.map
|
package/dist/transforms.js
DELETED
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
export function asRecord(value) {
|
|
2
|
-
if (value && typeof value === 'object' && !Array.isArray(value)) {
|
|
3
|
-
return value;
|
|
4
|
-
}
|
|
5
|
-
return null;
|
|
6
|
-
}
|
|
7
|
-
export function asString(value) {
|
|
8
|
-
return typeof value === 'string' ? value : null;
|
|
9
|
-
}
|
|
10
|
-
export function asNumber(value) {
|
|
11
|
-
return typeof value === 'number' && Number.isFinite(value) ? value : null;
|
|
12
|
-
}
|
|
13
|
-
function buildFrustrationAnchor(row) {
|
|
14
|
-
const conversation_id = asString(row.conversation_id) ?? '';
|
|
15
|
-
const userQuotes = Array.isArray(row.user_quotes) ? row.user_quotes : [];
|
|
16
|
-
const firstQuote = asRecord(userQuotes[0]);
|
|
17
|
-
const keyTurnsRaw = Array.isArray(row.key_turns) ? row.key_turns : [];
|
|
18
|
-
const all_turns = keyTurnsRaw.filter((t) => typeof t === 'number');
|
|
19
|
-
// Prefer key_turns[0] because the backend Data API centers the embedded
|
|
20
|
-
// windowed conversation on it; anchor must match that center so
|
|
21
|
-
// --include-window stays consistent.
|
|
22
|
-
let msg_index = null;
|
|
23
|
-
if (all_turns.length > 0) {
|
|
24
|
-
msg_index = all_turns[0];
|
|
25
|
-
}
|
|
26
|
-
if (msg_index === null && firstQuote) {
|
|
27
|
-
const turn = asNumber(firstQuote.turn);
|
|
28
|
-
if (turn !== null)
|
|
29
|
-
msg_index = turn;
|
|
30
|
-
}
|
|
31
|
-
let signal = null;
|
|
32
|
-
let quote_preview = null;
|
|
33
|
-
if (firstQuote) {
|
|
34
|
-
signal = asString(firstQuote.signal);
|
|
35
|
-
const quote = asString(firstQuote.quote);
|
|
36
|
-
if (quote !== null)
|
|
37
|
-
quote_preview = quote.slice(0, 200);
|
|
38
|
-
}
|
|
39
|
-
return {
|
|
40
|
-
kind: 'frustration',
|
|
41
|
-
conversation_id,
|
|
42
|
-
msg_index,
|
|
43
|
-
signal,
|
|
44
|
-
quote_preview,
|
|
45
|
-
all_turns,
|
|
46
|
-
no_anchor: msg_index === null,
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
function buildToolFailureAnchor(row, toolName) {
|
|
50
|
-
const conversation_id = asString(row.conversation_id) ?? '';
|
|
51
|
-
const msg_index = asNumber(row.msg_index);
|
|
52
|
-
const tool_use_id = asString(row.tool_use_id);
|
|
53
|
-
const error_subtype = asString(row.error_subtype);
|
|
54
|
-
return {
|
|
55
|
-
kind: 'tool_failure',
|
|
56
|
-
conversation_id,
|
|
57
|
-
msg_index,
|
|
58
|
-
tool_name: toolName,
|
|
59
|
-
tool_use_id,
|
|
60
|
-
error_subtype,
|
|
61
|
-
no_anchor: msg_index === null,
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
export function withFrustrationAnchors(response) {
|
|
65
|
-
if (!Array.isArray(response.frustrations))
|
|
66
|
-
return response;
|
|
67
|
-
const frustrations = response.frustrations.map((item) => {
|
|
68
|
-
const row = asRecord(item);
|
|
69
|
-
if (!row)
|
|
70
|
-
return item;
|
|
71
|
-
const anchor = buildFrustrationAnchor(row);
|
|
72
|
-
return { ...row, anchor };
|
|
73
|
-
});
|
|
74
|
-
return { ...response, frustrations };
|
|
75
|
-
}
|
|
76
|
-
export function withToolFailureAnchors(response) {
|
|
77
|
-
if (!Array.isArray(response.examples))
|
|
78
|
-
return response;
|
|
79
|
-
const toolName = asString(response.tool_name) ?? '';
|
|
80
|
-
const examples = response.examples.map((item) => {
|
|
81
|
-
const row = asRecord(item);
|
|
82
|
-
if (!row)
|
|
83
|
-
return item;
|
|
84
|
-
const anchor = buildToolFailureAnchor(row, toolName);
|
|
85
|
-
return { ...row, anchor };
|
|
86
|
-
});
|
|
87
|
-
return { ...response, examples };
|
|
88
|
-
}
|
|
89
|
-
export function embeddedWindowSize(conversation) {
|
|
90
|
-
if (!conversation)
|
|
91
|
-
return null;
|
|
92
|
-
const ctx = asRecord(conversation.context);
|
|
93
|
-
if (!ctx)
|
|
94
|
-
return null;
|
|
95
|
-
const center = asNumber(ctx.center_index);
|
|
96
|
-
const from = asNumber(ctx.from_index);
|
|
97
|
-
const to = asNumber(ctx.to_index);
|
|
98
|
-
if (center === null || from === null || to === null)
|
|
99
|
-
return null;
|
|
100
|
-
return Math.min(center - from, to - center);
|
|
101
|
-
}
|
|
102
|
-
//# sourceMappingURL=transforms.js.map
|
package/dist/tui.d.ts
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import type { DoctorCheckStatus, DoctorReport, StatusPayload } from './doctor.js';
|
|
2
|
-
import type { InitSetupAction } from './init/index.js';
|
|
3
|
-
type TerminalBadge = DoctorCheckStatus | 'info' | 'run';
|
|
4
|
-
export declare function renderDoctorHuman(report: DoctorReport, options?: {
|
|
5
|
-
color?: boolean;
|
|
6
|
-
width?: number;
|
|
7
|
-
}): string;
|
|
8
|
-
export declare function renderStatusHuman(status: StatusPayload, options?: {
|
|
9
|
-
color?: boolean;
|
|
10
|
-
width?: number;
|
|
11
|
-
}): string;
|
|
12
|
-
export declare function renderInitBanner(): string;
|
|
13
|
-
export declare function renderInitStep(index: number, total: number, title: string, detail?: string): string;
|
|
14
|
-
export declare function renderInitNote(message: string, status?: DoctorCheckStatus | 'info'): string;
|
|
15
|
-
export declare function renderInitSetupPlan(actions: InitSetupAction[], options?: {
|
|
16
|
-
snapshotConsent?: boolean;
|
|
17
|
-
}): string;
|
|
18
|
-
export declare function renderInitComplete(options: {
|
|
19
|
-
tenantName: string;
|
|
20
|
-
filesChanged: string[];
|
|
21
|
-
skipped: InitSetupAction[];
|
|
22
|
-
dashboardUrl?: string;
|
|
23
|
-
harness?: {
|
|
24
|
-
state: 'mapped' | 'pending';
|
|
25
|
-
agents?: number;
|
|
26
|
-
artifacts?: number;
|
|
27
|
-
};
|
|
28
|
-
telemetrySeen?: boolean;
|
|
29
|
-
}): string;
|
|
30
|
-
export declare function renderHarnessProgress(message: string, status?: TerminalBadge): string;
|
|
31
|
-
export declare function renderHarnessAnalystPreflight(options: {
|
|
32
|
-
root: string;
|
|
33
|
-
willRead: readonly string[];
|
|
34
|
-
willSkip: readonly string[];
|
|
35
|
-
}): string;
|
|
36
|
-
export declare function renderHarnessAnalystLaunch(options: {
|
|
37
|
-
adapterName: string;
|
|
38
|
-
command: string;
|
|
39
|
-
root: string;
|
|
40
|
-
reportPath: string;
|
|
41
|
-
}): string;
|
|
42
|
-
export declare function renderHarnessAnalystChoice(options: {
|
|
43
|
-
detected: readonly string[];
|
|
44
|
-
}): string;
|
|
45
|
-
export declare function renderHarnessAnalyzeHumanResult(data: unknown): string;
|
|
46
|
-
export declare function renderOverviewHuman(data: unknown): string;
|
|
47
|
-
export {};
|
|
48
|
-
//# sourceMappingURL=tui.d.ts.map
|