@moda-ai/cli 1.55.15 → 1.55.17
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/{agent-a2xwfeeh.js → agent-cha3kg9d.js} +9 -9
- package/dist/{cli-86q35fpq.js → cli-0e8bfvn7.js} +8 -8
- package/dist/{cli-3gwbg0xp.js → cli-1exddmc0.js} +2 -2
- package/dist/{cli-b3cxcxgn.js → cli-3ezzeqcy.js} +669 -37
- package/dist/{cli-kf3d6y8c.js → cli-5hq827jt.js} +8 -2
- package/dist/{cli-xy6zn80e.js → cli-5q1gyvxn.js} +5 -5
- package/dist/{cli-7fc44hhq.js → cli-a1mv0ypm.js} +5 -5
- package/dist/{cli-zdeywyn9.js → cli-av3dqgj5.js} +4 -4
- package/dist/cli-bb7133m7.js +144 -0
- package/dist/{cli-2ars875d.js → cli-c8p69n55.js} +2 -2
- package/dist/{cli-atx672xv.js → cli-eazeanvt.js} +1 -1
- package/dist/{cli-53mvsfgn.js → cli-kg0kz05e.js} +3 -3
- package/dist/{cli-6ca1sz0a.js → cli-qmjnh4z9.js} +1 -1
- package/dist/cli.js +299 -103
- package/dist/{doctor-e2xrbpmp.js → doctor-kg0yq1wf.js} +9 -9
- package/dist/{fix-v8xka487.js → fix-q8er8egx.js} +7 -7
- package/dist/{harness-github-actions-301nak95.js → harness-github-actions-ver6cprq.js} +6 -6
- package/dist/{harness-28wbzncq.js → harness-v9s0k9s7.js} +6 -6
- package/dist/{index-ccdpy9ma.js → index-7zqa7t5c.js} +11 -11
- package/dist/{production-intelligence-0wqcvvxk.js → production-intelligence-k36jsvqx.js} +13 -13
- package/dist/{profile-commands-f5kysjrv.js → profile-commands-88sdwzbg.js} +3 -3
- package/dist/prompt-source-mcp.js +6 -6
- package/dist/{prompts-jg0stjfb.js → prompts-2r756vtd.js} +7 -7
- package/dist/{provision-25bw5rd7.js → provision-n3r7yway.js} +4 -4
- package/dist/{registry-39xzetsc.js → registry-5v63ga01.js} +4 -4
- package/dist/{skills-gjesa81c.js → skills-fed17et3.js} +6 -6
- package/dist/{sync-7ts9psky.js → sync-r4tncne4.js} +8 -8
- package/package.json +1 -1
- package/skills/integration/index.json +2 -2
- package/skills/moda-cli/SKILL.md +20 -8
- package/dist/cli-438g4nwh.js +0 -465
package/dist/cli.js
CHANGED
|
@@ -1,25 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
MODA_INTELLIGENCE_V1_JSON_SCHEMA,
|
|
6
|
-
asNumber,
|
|
7
|
-
asRecord,
|
|
8
|
-
asString,
|
|
9
|
-
collectBatchTargets,
|
|
10
|
-
contextTarget,
|
|
11
|
-
embeddedWindowSize,
|
|
12
|
-
frustrationsFromEmotions,
|
|
13
|
-
mapWithConcurrency,
|
|
14
|
-
parseBatchTarget,
|
|
15
|
-
trimToolFailureConversations,
|
|
16
|
-
withFrustrationAnchors,
|
|
17
|
-
withToolFailureAnchors
|
|
18
|
-
} from "./cli-438g4nwh.js";
|
|
3
|
+
MODA_INTELLIGENCE_V1_JSON_SCHEMA
|
|
4
|
+
} from "./cli-bb7133m7.js";
|
|
19
5
|
import {
|
|
20
6
|
createCommandContext,
|
|
21
7
|
parseBooleanFlagValue
|
|
22
|
-
} from "./cli-
|
|
8
|
+
} from "./cli-5hq827jt.js";
|
|
23
9
|
import {
|
|
24
10
|
SIGNALS_MANAGEMENT_SUBCOMMANDS,
|
|
25
11
|
assertFlags,
|
|
@@ -29,19 +15,21 @@ import {
|
|
|
29
15
|
runUserCommand,
|
|
30
16
|
runUsersCommand,
|
|
31
17
|
unknownSignalsSubcommandError
|
|
32
|
-
} from "./cli-
|
|
18
|
+
} from "./cli-kg0kz05e.js";
|
|
33
19
|
import {
|
|
34
20
|
ApiError,
|
|
35
21
|
callControlAPI,
|
|
36
22
|
callDataAPI
|
|
37
|
-
} from "./cli-
|
|
23
|
+
} from "./cli-c8p69n55.js";
|
|
38
24
|
import {
|
|
39
25
|
apiKeyHeaders,
|
|
40
26
|
isPlatformApiKey,
|
|
41
27
|
setPlatformTenantOverride
|
|
42
|
-
} from "./cli-
|
|
28
|
+
} from "./cli-eazeanvt.js";
|
|
43
29
|
import {
|
|
44
30
|
AGENT_ERROR_CODES,
|
|
31
|
+
BATCH_CONCURRENCY,
|
|
32
|
+
BATCH_MAX_TARGETS,
|
|
45
33
|
CliAccessError,
|
|
46
34
|
CliAuthError,
|
|
47
35
|
CliCancellationError,
|
|
@@ -59,14 +47,24 @@ import {
|
|
|
59
47
|
agentEnvelopeFits,
|
|
60
48
|
agentMaxOutputBytes,
|
|
61
49
|
apiErrorStatus,
|
|
50
|
+
asNumber,
|
|
51
|
+
asRecord,
|
|
52
|
+
asString,
|
|
53
|
+
collectBatchTargets,
|
|
54
|
+
compactProblemDossier,
|
|
55
|
+
contextTarget,
|
|
62
56
|
createCliOutput,
|
|
63
57
|
embeddedTenantIdFromApiKey,
|
|
58
|
+
embeddedWindowSize,
|
|
64
59
|
errorToAgentError,
|
|
60
|
+
frustrationsFromEmotions,
|
|
65
61
|
getApiRequestCount,
|
|
66
62
|
getModaDir,
|
|
67
63
|
isApiLikeError,
|
|
68
64
|
isNetworkLikeError,
|
|
69
65
|
loadProfileConfig,
|
|
66
|
+
mapWithConcurrency,
|
|
67
|
+
parseBatchTarget,
|
|
70
68
|
resetApiRequestCount,
|
|
71
69
|
resolveApiKey,
|
|
72
70
|
resolveApiTenantId,
|
|
@@ -75,9 +73,13 @@ import {
|
|
|
75
73
|
safeWriteStderr,
|
|
76
74
|
safeWriteStdout,
|
|
77
75
|
setAgentUpdateNotice,
|
|
76
|
+
trimToolFailureConversations,
|
|
78
77
|
validateConfig,
|
|
79
|
-
wasOutputCancelled
|
|
80
|
-
|
|
78
|
+
wasOutputCancelled,
|
|
79
|
+
withFrustrationAnchors,
|
|
80
|
+
withToolFailureAnchors,
|
|
81
|
+
withoutDetectionWindows
|
|
82
|
+
} from "./cli-3ezzeqcy.js";
|
|
81
83
|
import {
|
|
82
84
|
__require
|
|
83
85
|
} from "./cli-0v6na3yp.js";
|
|
@@ -216,6 +218,7 @@ var ProblemSchema = z.object({
|
|
|
216
218
|
traces: boolFlag(),
|
|
217
219
|
conversations: boolFlag(),
|
|
218
220
|
feedback: boolFlag(),
|
|
221
|
+
full: boolFlag(),
|
|
219
222
|
limit: z.number().min(1).max(50).optional(),
|
|
220
223
|
cursor: z.string().optional(),
|
|
221
224
|
family: z.enum(PROBLEM_FAMILIES).optional(),
|
|
@@ -321,7 +324,8 @@ var EmotionsSchema = z.object({
|
|
|
321
324
|
offset: z.number().min(0).max(1e4).optional(),
|
|
322
325
|
family: z.enum(EMOTION_FAMILIES).optional(),
|
|
323
326
|
user_id: z.string().min(1).max(256).optional(),
|
|
324
|
-
conversation_id: z.string().min(1).max(256).optional()
|
|
327
|
+
conversation_id: z.string().min(1).max(256).optional(),
|
|
328
|
+
include_window: boolFlag()
|
|
325
329
|
});
|
|
326
330
|
var HallucinationsSchema = z.object({
|
|
327
331
|
days_back: daysBackFlag(7),
|
|
@@ -684,10 +688,14 @@ async function runReplaysCommand(context) {
|
|
|
684
688
|
}
|
|
685
689
|
|
|
686
690
|
// src/telemetry.ts
|
|
691
|
+
import { spawn } from "node:child_process";
|
|
687
692
|
import { randomUUID } from "node:crypto";
|
|
688
|
-
var
|
|
693
|
+
var INLINE_TELEMETRY_TIMEOUT_MS = 500;
|
|
694
|
+
var DETACHED_TELEMETRY_TIMEOUT_MS = 5000;
|
|
689
695
|
var INVOCATION_ID = randomUUID();
|
|
690
696
|
var TELEMETRY_FLAG = "no-telemetry";
|
|
697
|
+
var TELEMETRY_REQUEST_ENV = "MODA_CLI_TELEMETRY_REQUEST";
|
|
698
|
+
var TELEMETRY_TRANSPORT_ENV = "MODA_CLI_TELEMETRY_TRANSPORT";
|
|
691
699
|
var MAX_TELEMETRY_DURATION_MS = 86400000;
|
|
692
700
|
var MAX_TELEMETRY_API_REQUEST_COUNT = 1e6;
|
|
693
701
|
var SEARCH_SURFACE_BY_COMMAND = {
|
|
@@ -715,6 +723,8 @@ function buildSearchAdoptionTelemetry(input) {
|
|
|
715
723
|
};
|
|
716
724
|
if (positional && input.subcommands?.includes(positional)) {
|
|
717
725
|
adoption.subcommand = positional;
|
|
726
|
+
} else if (positional === undefined && input.defaultSubcommand) {
|
|
727
|
+
adoption.subcommand = input.defaultSubcommand;
|
|
718
728
|
}
|
|
719
729
|
let queryText;
|
|
720
730
|
if (command === "search")
|
|
@@ -742,6 +752,8 @@ function buildSearchAdoptionTelemetry(input) {
|
|
|
742
752
|
}
|
|
743
753
|
if (recorded.has_more)
|
|
744
754
|
adoption.has_more = recorded.has_more;
|
|
755
|
+
if (recorded.degrade_reason)
|
|
756
|
+
adoption.degrade_reason = recorded.degrade_reason;
|
|
745
757
|
const skill = input.skillVersion?.trim();
|
|
746
758
|
if (skill)
|
|
747
759
|
adoption.skill_version = skill.slice(0, 64);
|
|
@@ -776,6 +788,9 @@ function serializeAdoption(adoption) {
|
|
|
776
788
|
out.zero_result = adoption.zero_result;
|
|
777
789
|
if (adoption.has_more)
|
|
778
790
|
out.has_more = adoption.has_more;
|
|
791
|
+
const degradeReason = sanitizeReasonCode(adoption.degrade_reason, DEGRADE_REASON_MAX);
|
|
792
|
+
if (degradeReason)
|
|
793
|
+
out.degrade_reason = degradeReason;
|
|
779
794
|
if (adoption.used_msg_index !== undefined) {
|
|
780
795
|
out.used_msg_index = adoption.used_msg_index ? 1 : 0;
|
|
781
796
|
}
|
|
@@ -791,52 +806,152 @@ function isTelemetryDisabled(flags) {
|
|
|
791
806
|
return flags[TELEMETRY_FLAG] === "true" || process.env.MODA_CLI_TELEMETRY === "0" || process.env.DO_NOT_TRACK === "1";
|
|
792
807
|
}
|
|
793
808
|
var VALIDATION_REASON_MAX = 128;
|
|
794
|
-
|
|
795
|
-
|
|
809
|
+
var DEGRADE_REASON_MAX = 64;
|
|
810
|
+
function sanitizeReasonCode(reason, max) {
|
|
811
|
+
const cleaned = reason?.replace(/[^A-Za-z0-9_.:-]/g, "_").slice(0, max);
|
|
796
812
|
return cleaned ? cleaned : undefined;
|
|
797
813
|
}
|
|
814
|
+
function sanitizeValidationReason(reason) {
|
|
815
|
+
return sanitizeReasonCode(reason, VALIDATION_REASON_MAX);
|
|
816
|
+
}
|
|
798
817
|
function sanitizedFlagNames(flags) {
|
|
799
818
|
return Object.keys(stripTelemetryFlag(flags)).sort();
|
|
800
819
|
}
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
820
|
+
var TELEMETRY_SENDER_SCRIPT = [
|
|
821
|
+
"try {",
|
|
822
|
+
` const raw = process.env.${TELEMETRY_REQUEST_ENV};`,
|
|
823
|
+
` delete process.env.${TELEMETRY_REQUEST_ENV};`,
|
|
824
|
+
" const r = raw ? JSON.parse(raw) : null;",
|
|
825
|
+
" if (r && typeof r.url === 'string' && typeof fetch === 'function') {",
|
|
826
|
+
" const c = new AbortController();",
|
|
827
|
+
` const t = setTimeout(() => c.abort(), ${DETACHED_TELEMETRY_TIMEOUT_MS});`,
|
|
828
|
+
" fetch(r.url, { method: 'POST', headers: r.headers, body: r.body, signal: c.signal })",
|
|
829
|
+
" .then((res) => (res.body && res.body.cancel ? res.body.cancel() : undefined))",
|
|
830
|
+
" .catch(() => {})",
|
|
831
|
+
" .finally(() => clearTimeout(t));",
|
|
832
|
+
" }",
|
|
833
|
+
"} catch {}"
|
|
834
|
+
].join(`
|
|
835
|
+
`);
|
|
836
|
+
var INSPECTOR_VALUE_OPTIONS = new Set(["--inspect-port", "--debug-port", "--inspect-publish-uid"]);
|
|
837
|
+
function nodeOptionTokens(nodeOptions) {
|
|
838
|
+
const tokens = [];
|
|
839
|
+
let start = -1;
|
|
840
|
+
let quoted = false;
|
|
841
|
+
for (let i = 0;i < nodeOptions.length; i += 1) {
|
|
842
|
+
const ch = nodeOptions[i];
|
|
843
|
+
if (start === -1) {
|
|
844
|
+
if (/\s/.test(ch))
|
|
845
|
+
continue;
|
|
846
|
+
start = i;
|
|
847
|
+
}
|
|
848
|
+
if (quoted && ch === "\\") {
|
|
849
|
+
i += 1;
|
|
850
|
+
} else if (ch === '"') {
|
|
851
|
+
quoted = !quoted;
|
|
852
|
+
} else if (!quoted && /\s/.test(ch)) {
|
|
853
|
+
tokens.push(nodeOptions.slice(start, i));
|
|
854
|
+
start = -1;
|
|
855
|
+
}
|
|
804
856
|
}
|
|
805
|
-
|
|
857
|
+
if (start !== -1)
|
|
858
|
+
tokens.push(nodeOptions.slice(start));
|
|
859
|
+
return tokens;
|
|
860
|
+
}
|
|
861
|
+
function withoutInspectorOptions(nodeOptions) {
|
|
862
|
+
const tokens = nodeOptionTokens(nodeOptions);
|
|
863
|
+
const kept = [];
|
|
864
|
+
for (let i = 0;i < tokens.length; i += 1) {
|
|
865
|
+
const name = tokens[i].split("=")[0];
|
|
866
|
+
if (!name.startsWith("--inspect") && name !== "--debug-port") {
|
|
867
|
+
kept.push(tokens[i]);
|
|
868
|
+
continue;
|
|
869
|
+
}
|
|
870
|
+
if (INSPECTOR_VALUE_OPTIONS.has(tokens[i]) && tokens[i + 1] && !tokens[i + 1].startsWith("-"))
|
|
871
|
+
i += 1;
|
|
872
|
+
}
|
|
873
|
+
return kept.join(" ");
|
|
874
|
+
}
|
|
875
|
+
function spawnDetachedTelemetrySender(request, spawnImpl = spawn) {
|
|
876
|
+
try {
|
|
877
|
+
const env = { ...process.env, [TELEMETRY_REQUEST_ENV]: JSON.stringify(request) };
|
|
878
|
+
if (env.NODE_OPTIONS?.includes("--inspect")) {
|
|
879
|
+
const kept = withoutInspectorOptions(env.NODE_OPTIONS);
|
|
880
|
+
if (kept)
|
|
881
|
+
env.NODE_OPTIONS = kept;
|
|
882
|
+
else
|
|
883
|
+
delete env.NODE_OPTIONS;
|
|
884
|
+
}
|
|
885
|
+
const child = spawnImpl(process.execPath, ["-e", TELEMETRY_SENDER_SCRIPT], {
|
|
886
|
+
detached: true,
|
|
887
|
+
stdio: "ignore",
|
|
888
|
+
windowsHide: true,
|
|
889
|
+
env
|
|
890
|
+
});
|
|
891
|
+
child.on("error", () => {});
|
|
892
|
+
if (child.pid === undefined)
|
|
893
|
+
return false;
|
|
894
|
+
child.unref();
|
|
895
|
+
return true;
|
|
896
|
+
} catch {
|
|
897
|
+
return false;
|
|
898
|
+
}
|
|
899
|
+
}
|
|
900
|
+
async function sendInline(request) {
|
|
806
901
|
const controller = new AbortController;
|
|
807
|
-
const timeout = setTimeout(() => controller.abort(),
|
|
902
|
+
const timeout = setTimeout(() => controller.abort(), INLINE_TELEMETRY_TIMEOUT_MS);
|
|
808
903
|
if (typeof timeout.unref === "function") {
|
|
809
904
|
timeout.unref();
|
|
810
905
|
}
|
|
811
906
|
try {
|
|
812
|
-
await fetch(
|
|
907
|
+
await fetch(request.url, {
|
|
813
908
|
method: "POST",
|
|
814
|
-
headers:
|
|
815
|
-
|
|
816
|
-
"Content-Type": "application/json"
|
|
817
|
-
},
|
|
818
|
-
body: JSON.stringify({
|
|
819
|
-
invocation_id: INVOCATION_ID,
|
|
820
|
-
command: input.command.slice(0, 64),
|
|
821
|
-
status: input.status,
|
|
822
|
-
error_type: input.errorType,
|
|
823
|
-
...validationReason ? { validation_reason: validationReason } : {},
|
|
824
|
-
exit_code: input.exitCode,
|
|
825
|
-
duration_ms: clampInt(input.durationMs, 0, MAX_TELEMETRY_DURATION_MS) ?? 0,
|
|
826
|
-
api_request_count: clampInt(input.apiRequestCount, 0, MAX_TELEMETRY_API_REQUEST_COUNT) ?? 0,
|
|
827
|
-
cli_version: VERSION,
|
|
828
|
-
node_version: process.versions.node,
|
|
829
|
-
platform: process.platform,
|
|
830
|
-
arch: process.arch,
|
|
831
|
-
flags_json: { names: sanitizedFlagNames(input.flags) },
|
|
832
|
-
...serializeAdoption(input.adoption)
|
|
833
|
-
}),
|
|
909
|
+
headers: request.headers,
|
|
910
|
+
body: request.body,
|
|
834
911
|
signal: controller.signal
|
|
835
912
|
});
|
|
836
913
|
} catch {} finally {
|
|
837
914
|
clearTimeout(timeout);
|
|
838
915
|
}
|
|
839
916
|
}
|
|
917
|
+
function buildCliUsageRequest(input) {
|
|
918
|
+
const validationReason = sanitizeValidationReason(input.validationReason);
|
|
919
|
+
return {
|
|
920
|
+
url: `${resolveModaBaseUrl({ profile: input.profile })}/api/v1/data/cli-usage`,
|
|
921
|
+
headers: {
|
|
922
|
+
...apiKeyHeaders(input.apiKey),
|
|
923
|
+
"Content-Type": "application/json"
|
|
924
|
+
},
|
|
925
|
+
body: JSON.stringify({
|
|
926
|
+
invocation_id: INVOCATION_ID,
|
|
927
|
+
command: input.command.slice(0, 64),
|
|
928
|
+
status: input.status,
|
|
929
|
+
error_type: input.errorType,
|
|
930
|
+
...validationReason ? { validation_reason: validationReason } : {},
|
|
931
|
+
exit_code: input.exitCode,
|
|
932
|
+
duration_ms: clampInt(input.durationMs, 0, MAX_TELEMETRY_DURATION_MS) ?? 0,
|
|
933
|
+
api_request_count: clampInt(input.apiRequestCount, 0, MAX_TELEMETRY_API_REQUEST_COUNT) ?? 0,
|
|
934
|
+
cli_version: VERSION,
|
|
935
|
+
node_version: process.versions.node,
|
|
936
|
+
platform: process.platform,
|
|
937
|
+
arch: process.arch,
|
|
938
|
+
flags_json: { names: sanitizedFlagNames(input.flags) },
|
|
939
|
+
...serializeAdoption(input.adoption)
|
|
940
|
+
})
|
|
941
|
+
};
|
|
942
|
+
}
|
|
943
|
+
async function sendCliUsageTelemetry(input) {
|
|
944
|
+
try {
|
|
945
|
+
if (!input.apiKey || isTelemetryDisabled(input.flags)) {
|
|
946
|
+
return;
|
|
947
|
+
}
|
|
948
|
+
const request = buildCliUsageRequest({ ...input, apiKey: input.apiKey });
|
|
949
|
+
if (process.env[TELEMETRY_TRANSPORT_ENV] !== "inline" && spawnDetachedTelemetrySender(request)) {
|
|
950
|
+
return;
|
|
951
|
+
}
|
|
952
|
+
await sendInline(request);
|
|
953
|
+
} catch {}
|
|
954
|
+
}
|
|
840
955
|
|
|
841
956
|
// src/update-check.ts
|
|
842
957
|
import { mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
@@ -2090,46 +2205,46 @@ function exitCodesForCommand(command) {
|
|
|
2090
2205
|
import { fileURLToPath } from "url";
|
|
2091
2206
|
import { realpathSync } from "fs";
|
|
2092
2207
|
async function runPromptsCommand(...args) {
|
|
2093
|
-
return (await import("./prompts-
|
|
2208
|
+
return (await import("./prompts-2r756vtd.js")).runPromptsCommand(...args);
|
|
2094
2209
|
}
|
|
2095
2210
|
async function runSkillsCommand(...args) {
|
|
2096
|
-
return (await import("./skills-
|
|
2211
|
+
return (await import("./skills-fed17et3.js")).runSkillsCommand(...args);
|
|
2097
2212
|
}
|
|
2098
2213
|
async function runFixCommand(...args) {
|
|
2099
|
-
return (await import("./fix-
|
|
2214
|
+
return (await import("./fix-q8er8egx.js")).runFixCommand(...args);
|
|
2100
2215
|
}
|
|
2101
2216
|
async function runFixesCommand(...args) {
|
|
2102
|
-
return (await import("./fix-
|
|
2217
|
+
return (await import("./fix-q8er8egx.js")).runFixesCommand(...args);
|
|
2103
2218
|
}
|
|
2104
2219
|
async function runHarnessCommand(...args) {
|
|
2105
|
-
return (await import("./harness-
|
|
2220
|
+
return (await import("./harness-v9s0k9s7.js")).runHarnessCommand(...args);
|
|
2106
2221
|
}
|
|
2107
2222
|
async function runSyncCommand(...args) {
|
|
2108
|
-
return (await import("./sync-
|
|
2223
|
+
return (await import("./sync-r4tncne4.js")).runSyncCommand(...args);
|
|
2109
2224
|
}
|
|
2110
2225
|
async function runRegistryCommand(...args) {
|
|
2111
|
-
return (await import("./registry-
|
|
2226
|
+
return (await import("./registry-5v63ga01.js")).runRegistryCommand(...args);
|
|
2112
2227
|
}
|
|
2113
2228
|
async function runDoctorCommand(...args) {
|
|
2114
|
-
return (await import("./doctor-
|
|
2229
|
+
return (await import("./doctor-kg0yq1wf.js")).runDoctorCommand(...args);
|
|
2115
2230
|
}
|
|
2116
2231
|
async function runStatusCommand(...args) {
|
|
2117
|
-
return (await import("./doctor-
|
|
2232
|
+
return (await import("./doctor-kg0yq1wf.js")).runStatusCommand(...args);
|
|
2118
2233
|
}
|
|
2119
2234
|
async function runAuthCommand(...args) {
|
|
2120
|
-
return (await import("./profile-commands-
|
|
2235
|
+
return (await import("./profile-commands-88sdwzbg.js")).runAuthCommand(...args);
|
|
2121
2236
|
}
|
|
2122
2237
|
async function runConfigCommand(...args) {
|
|
2123
|
-
return (await import("./profile-commands-
|
|
2238
|
+
return (await import("./profile-commands-88sdwzbg.js")).runConfigCommand(...args);
|
|
2124
2239
|
}
|
|
2125
2240
|
async function runProfilesCommand(...args) {
|
|
2126
|
-
return (await import("./profile-commands-
|
|
2241
|
+
return (await import("./profile-commands-88sdwzbg.js")).runProfilesCommand(...args);
|
|
2127
2242
|
}
|
|
2128
2243
|
async function runAgentCommand(...args) {
|
|
2129
|
-
return (await import("./agent-
|
|
2244
|
+
return (await import("./agent-cha3kg9d.js")).runAgentCommand(...args);
|
|
2130
2245
|
}
|
|
2131
2246
|
async function runProductionCommand(...args) {
|
|
2132
|
-
return (await import("./production-intelligence-
|
|
2247
|
+
return (await import("./production-intelligence-k36jsvqx.js")).runProductionCommand(...args);
|
|
2133
2248
|
}
|
|
2134
2249
|
function parseArgs(argv) {
|
|
2135
2250
|
const args = argv.slice(2);
|
|
@@ -2255,6 +2370,7 @@ var META_SWITCHES = new Set([
|
|
|
2255
2370
|
"no-telemetry",
|
|
2256
2371
|
"no-update-check"
|
|
2257
2372
|
]);
|
|
2373
|
+
var AGENT_VALUE_COMMANDS = new Set(["harness", "sync"]);
|
|
2258
2374
|
var COMMAND_BOOLEAN_FLAGS = {
|
|
2259
2375
|
context: new Set(["all", "metadata-only"])
|
|
2260
2376
|
};
|
|
@@ -2280,7 +2396,7 @@ function parseFlag(args, index, flags, beforeCommand, bareFlags, command = "") {
|
|
|
2280
2396
|
return index;
|
|
2281
2397
|
}
|
|
2282
2398
|
const switchName = key.replace(/_/g, "-");
|
|
2283
|
-
if (META_SWITCHES.has(switchName)) {
|
|
2399
|
+
if (META_SWITCHES.has(switchName) || switchName === "agent" && !AGENT_VALUE_COMMANDS.has(command)) {
|
|
2284
2400
|
set(key, "true", true);
|
|
2285
2401
|
return index;
|
|
2286
2402
|
}
|
|
@@ -2511,6 +2627,8 @@ Emotions flags:
|
|
|
2511
2627
|
--family=F frustration|disapproval|sadness|confusion|anxiety|trust|positive
|
|
2512
2628
|
--days-back=N --limit=N Window 1-90 (default 7); page size 1-20 (default 10)
|
|
2513
2629
|
--offset=N Skip N detections (0-10000)
|
|
2630
|
+
--include-window Keep each detection's conversation window in agent output
|
|
2631
|
+
(also frustrations; omitted by default, use context_command)
|
|
2514
2632
|
|
|
2515
2633
|
Laziness flags:
|
|
2516
2634
|
--family=F One laziness family (e.g. omission_phrase, stub_body, deflection, completion, tool_selection)
|
|
@@ -2523,6 +2641,8 @@ Hallucinations flags:
|
|
|
2523
2641
|
--days-back=N --limit=N Window 1-90 (default 7); page size 1-20 (default 10)
|
|
2524
2642
|
|
|
2525
2643
|
Problem flags (moda problem <id>):
|
|
2644
|
+
--full Whole dossier in agent output (default there: header, summary,
|
|
2645
|
+
top 5 evidence anchors, report titles)
|
|
2526
2646
|
--evidence|--reports|--traces|--feedback
|
|
2527
2647
|
Open one sub-resource page (at most one)
|
|
2528
2648
|
--limit=N --cursor=TOKEN Keyset paging (1-50; pass next_cursor back verbatim)
|
|
@@ -2821,6 +2941,19 @@ async function printWithOptionalWindows(enriched, listKey, includeWindow, window
|
|
|
2821
2941
|
data = finalize(data, allWarnings);
|
|
2822
2942
|
output.writeData(data, allWarnings.length > 0 ? { warnings: allWarnings } : undefined);
|
|
2823
2943
|
}
|
|
2944
|
+
function withoutRepeatedFrustrationWindow(data) {
|
|
2945
|
+
if (!Array.isArray(data.frustrations))
|
|
2946
|
+
return data;
|
|
2947
|
+
const frustrations = data.frustrations.map((item) => {
|
|
2948
|
+
const row = asRecord(item);
|
|
2949
|
+
const window = asRecord(row?.window);
|
|
2950
|
+
if (!row || !window || "error" in window)
|
|
2951
|
+
return item;
|
|
2952
|
+
const { conversation: _conversation, ...rest } = row;
|
|
2953
|
+
return rest;
|
|
2954
|
+
});
|
|
2955
|
+
return { ...data, frustrations };
|
|
2956
|
+
}
|
|
2824
2957
|
var NOT_FOUND_HINTS = {
|
|
2825
2958
|
trace: 'Find trace ids with: moda search "<text>" or moda traces --search=<text>',
|
|
2826
2959
|
cluster: "List cluster node ids with: moda clusters",
|
|
@@ -3123,7 +3256,8 @@ function recordSearchTelemetry(context, data) {
|
|
|
3123
3256
|
context.recordTelemetry({
|
|
3124
3257
|
search_mode_effective: SEARCH_MODES2.includes(effective) ? effective : undefined,
|
|
3125
3258
|
result_count: results.length,
|
|
3126
|
-
has_more: hasMore === true ? "yes" : hasMore === false ? "no" : "na"
|
|
3259
|
+
has_more: hasMore === true ? "yes" : hasMore === false ? "no" : "na",
|
|
3260
|
+
...typeof record.degrade_reason === "string" && record.degrade_reason ? { degrade_reason: record.degrade_reason.slice(0, 64) } : {}
|
|
3127
3261
|
});
|
|
3128
3262
|
}
|
|
3129
3263
|
function recordConversationsTelemetry(context, data) {
|
|
@@ -3850,7 +3984,7 @@ async function readAuditItem(command, params, budget) {
|
|
|
3850
3984
|
if (budget && !budget.fits(page.data, page.options)) {
|
|
3851
3985
|
page.options.warnings = [
|
|
3852
3986
|
...page.options.warnings ?? [],
|
|
3853
|
-
"This page is
|
|
3987
|
+
"This page is larger than the agent output budget even at the smallest page the server returns, so some of its spans are cut from this output. Rerun this command with --json (no byte limit) or a higher MODA_AGENT_MAX_OUTPUT_BYTES to see the whole row before following next_cursor."
|
|
3854
3988
|
];
|
|
3855
3989
|
}
|
|
3856
3990
|
return page;
|
|
@@ -4020,7 +4154,7 @@ async function runAuditBatch(command, positionals, flags, context) {
|
|
|
4020
4154
|
const base = parseCommandFlags(AuditSchema, flagsToArgs(rest, "id", targets[0].id), command, { positionalKey: "id" });
|
|
4021
4155
|
const agentMode = context.output.mode === "agent" || context.output.mode === "agent-stream";
|
|
4022
4156
|
const share = agentMode ? auditItemByteShare(targets.length) : undefined;
|
|
4023
|
-
const results = await mapWithConcurrency(targets, BATCH_CONCURRENCY, (target) => readBatchItem(target, () => readAuditItem(command, { ...base, id: target.id }, share !== undefined ? { maxBytes: share, fits: fitsShare(share) } : undefined)));
|
|
4157
|
+
const results = await mapWithConcurrency(targets, BATCH_CONCURRENCY, (target) => readBatchItem(target, () => readAuditItem(command, { ...base, id: target.id }, share !== undefined ? { maxBytes: Math.max(AUDIT_MIN_PAGE_BYTES, share), fits: fitsShare(share) } : undefined)));
|
|
4024
4158
|
return writeBatchResult(command, context, targets, results, [], rest);
|
|
4025
4159
|
}
|
|
4026
4160
|
async function runCommand(command, positional, flags, positionals = positional ? [positional] : [], context = createCommandContext({ command, positional, positionals, flags })) {
|
|
@@ -4284,7 +4418,10 @@ async function runCommand(command, positional, flags, positionals = positional ?
|
|
|
4284
4418
|
query2.set("conversation_id", params.conversation_id);
|
|
4285
4419
|
query2.set("family", "frustration");
|
|
4286
4420
|
const data = frustrationsFromEmotions(await callDataAPI(`/emotions?${query2.toString()}`));
|
|
4287
|
-
|
|
4421
|
+
const includeWindow = params.include_window === true;
|
|
4422
|
+
const agentMode = context.output.mode === "agent" || context.output.mode === "agent-stream";
|
|
4423
|
+
const anchored = withFrustrationAnchors(data);
|
|
4424
|
+
await printWithOptionalWindows(agentMode && !includeWindow ? withoutDetectionWindows(anchored, "frustrations", "conversation") : anchored, "frustrations", includeWindow, params.window ?? 1, context.output, processingDisabledWarning(data, "frustration"), agentMode && includeWindow ? (payload) => withoutRepeatedFrustrationWindow(payload) : undefined);
|
|
4288
4425
|
break;
|
|
4289
4426
|
}
|
|
4290
4427
|
case "tool-failures": {
|
|
@@ -4411,7 +4548,7 @@ async function runCommand(command, positional, flags, positionals = positional ?
|
|
|
4411
4548
|
break;
|
|
4412
4549
|
}
|
|
4413
4550
|
if (!positional) {
|
|
4414
|
-
throw new CliInputError("<problem_id> is required", "Usage: moda problem <problem_id> [--evidence|--reports|--traces|--feedback] [--limit=N] [--cursor=TOKEN] [--family=F] [--door=D]");
|
|
4551
|
+
throw new CliInputError("<problem_id> is required", "Usage: moda problem <problem_id> [--full | --evidence|--reports|--traces|--feedback] [--limit=N] [--cursor=TOKEN] [--family=F] [--door=D]");
|
|
4415
4552
|
}
|
|
4416
4553
|
const args = flagsToArgs(flags, "id", positional);
|
|
4417
4554
|
const params = parseCommandFlags(ProblemSchema, args, command, { positionalKey: "id" });
|
|
@@ -4422,10 +4559,25 @@ async function runCommand(command, positional, flags, positionals = positional ?
|
|
|
4422
4559
|
throw new CliInputError(`Choose at most one of --evidence, --reports, --traces, --feedback (got ${got}).`, "Usage: moda problem <problem_id> [--evidence|--reports|--traces|--feedback]");
|
|
4423
4560
|
}
|
|
4424
4561
|
const view = views[0];
|
|
4562
|
+
if (view !== undefined && params.full === true) {
|
|
4563
|
+
throw new CliInputError("--full applies to the dossier only; the --evidence/--reports/--traces/--feedback pages are always whole.", "Usage: moda problem <problem_id> [--full] | moda problem <problem_id> --evidence|--reports|--traces|--feedback");
|
|
4564
|
+
}
|
|
4425
4565
|
if (view === undefined) {
|
|
4426
4566
|
const data2 = await callDataAPI(`/problems/${encodeURIComponent(params.id)}`);
|
|
4427
4567
|
const record = asRecord(data2) ?? {};
|
|
4428
4568
|
throwIfNotFound("problem", params.id, record.found === false, `No problem found for id "${params.id}" in this tenant; it may have been merged into another problem.`);
|
|
4569
|
+
const agentMode = context.output.mode === "agent" || context.output.mode === "agent-stream";
|
|
4570
|
+
if (agentMode) {
|
|
4571
|
+
const compact = compactProblemDossier(record, params.id);
|
|
4572
|
+
if (params.full === true) {
|
|
4573
|
+
context.output.writeData(data2, {
|
|
4574
|
+
nextCommands: compact.nextCommands.filter((next) => !next.command.endsWith(" --full"))
|
|
4575
|
+
});
|
|
4576
|
+
} else {
|
|
4577
|
+
context.output.writeData(compact.data, { nextCommands: compact.nextCommands });
|
|
4578
|
+
}
|
|
4579
|
+
break;
|
|
4580
|
+
}
|
|
4429
4581
|
context.output.writeData(data2);
|
|
4430
4582
|
break;
|
|
4431
4583
|
}
|
|
@@ -4781,8 +4933,11 @@ async function runCommand(command, positional, flags, positionals = positional ?
|
|
|
4781
4933
|
if (params.conversation_id)
|
|
4782
4934
|
query2.set("conversation_id", params.conversation_id);
|
|
4783
4935
|
const queryString = query2.toString() ? `?${query2.toString()}` : "";
|
|
4784
|
-
const
|
|
4785
|
-
const processingWarnings = processingDisabledWarning(
|
|
4936
|
+
const raw = await callDataAPI(`/emotions${queryString}`);
|
|
4937
|
+
const processingWarnings = processingDisabledWarning(raw, "emotion");
|
|
4938
|
+
const agentMode = context.output.mode === "agent" || context.output.mode === "agent-stream";
|
|
4939
|
+
const record = asRecord(raw);
|
|
4940
|
+
const data = agentMode && params.include_window !== true && record ? withoutDetectionWindows(record, "detections", "conversation_context") : raw;
|
|
4786
4941
|
context.output.writeData(data, processingWarnings.length > 0 ? { warnings: processingWarnings } : undefined);
|
|
4787
4942
|
break;
|
|
4788
4943
|
}
|
|
@@ -4879,6 +5034,13 @@ async function runCommand(command, positional, flags, positionals = positional ?
|
|
|
4879
5034
|
function telemetryCommandName(definition) {
|
|
4880
5035
|
return definition.telemetryCommand ?? definition.name;
|
|
4881
5036
|
}
|
|
5037
|
+
var TELEMETRY_EXEMPT_COMMANDS = {};
|
|
5038
|
+
function telemetrySubcommandNames(definition) {
|
|
5039
|
+
return [
|
|
5040
|
+
...definition.subcommands?.map((subcommand) => subcommand.name) ?? [],
|
|
5041
|
+
...definition.telemetrySubcommands ?? []
|
|
5042
|
+
];
|
|
5043
|
+
}
|
|
4882
5044
|
var OFFLINE_PROMPTS_SUBCOMMANDS = new Set(["init", "status", "diff", "migrate"]);
|
|
4883
5045
|
function legacyCommand(metadata) {
|
|
4884
5046
|
return {
|
|
@@ -4973,9 +5135,9 @@ var commandRegistry = createCommandRegistry([
|
|
|
4973
5135
|
mutability: "write",
|
|
4974
5136
|
validateConfigBeforeRun: false,
|
|
4975
5137
|
resetApiRequestCountBeforeRun: true,
|
|
4976
|
-
telemetry: "result",
|
|
5138
|
+
telemetry: "result-and-error",
|
|
4977
5139
|
handler: async (context) => {
|
|
4978
|
-
const { runInit } = await import("./index-
|
|
5140
|
+
const { runInit } = await import("./index-7zqa7t5c.js");
|
|
4979
5141
|
if (context.outputMode === "agent-stream") {
|
|
4980
5142
|
context.output.writeEvent({
|
|
4981
5143
|
event: "started",
|
|
@@ -5016,7 +5178,7 @@ var commandRegistry = createCommandRegistry([
|
|
|
5016
5178
|
resetApiRequestCountBeforeRun: true,
|
|
5017
5179
|
telemetry: "result-and-error",
|
|
5018
5180
|
handler: async (context) => {
|
|
5019
|
-
const { runProvision } = await import("./provision-
|
|
5181
|
+
const { runProvision } = await import("./provision-n3r7yway.js");
|
|
5020
5182
|
return runProvision(context, {
|
|
5021
5183
|
resumeCommand: buildResumeCommand("provision", context.rawFlags)
|
|
5022
5184
|
});
|
|
@@ -5031,7 +5193,7 @@ var commandRegistry = createCommandRegistry([
|
|
|
5031
5193
|
mutability: "read",
|
|
5032
5194
|
validateConfigBeforeRun: false,
|
|
5033
5195
|
resetApiRequestCountBeforeRun: false,
|
|
5034
|
-
telemetry: "
|
|
5196
|
+
telemetry: "result-and-error",
|
|
5035
5197
|
handler: async (context) => {
|
|
5036
5198
|
const manifest = buildManifest(commandRegistry.all());
|
|
5037
5199
|
if (context.outputMode === "human") {
|
|
@@ -5138,7 +5300,7 @@ var commandRegistry = createCommandRegistry([
|
|
|
5138
5300
|
mutability: "write",
|
|
5139
5301
|
validateConfigBeforeRun: false,
|
|
5140
5302
|
resetApiRequestCountBeforeRun: false,
|
|
5141
|
-
telemetry: "
|
|
5303
|
+
telemetry: "result-and-error",
|
|
5142
5304
|
handler: runAuthCommand
|
|
5143
5305
|
},
|
|
5144
5306
|
{
|
|
@@ -5150,7 +5312,7 @@ var commandRegistry = createCommandRegistry([
|
|
|
5150
5312
|
mutability: "read",
|
|
5151
5313
|
validateConfigBeforeRun: false,
|
|
5152
5314
|
resetApiRequestCountBeforeRun: false,
|
|
5153
|
-
telemetry: "
|
|
5315
|
+
telemetry: "result-and-error",
|
|
5154
5316
|
handler: runStatusCommand
|
|
5155
5317
|
},
|
|
5156
5318
|
{
|
|
@@ -5163,7 +5325,7 @@ var commandRegistry = createCommandRegistry([
|
|
|
5163
5325
|
mutability: "read",
|
|
5164
5326
|
validateConfigBeforeRun: false,
|
|
5165
5327
|
resetApiRequestCountBeforeRun: false,
|
|
5166
|
-
telemetry: "
|
|
5328
|
+
telemetry: "result-and-error",
|
|
5167
5329
|
handler: runDoctorCommand
|
|
5168
5330
|
},
|
|
5169
5331
|
{
|
|
@@ -5175,7 +5337,8 @@ var commandRegistry = createCommandRegistry([
|
|
|
5175
5337
|
mutability: "write",
|
|
5176
5338
|
validateConfigBeforeRun: false,
|
|
5177
5339
|
resetApiRequestCountBeforeRun: false,
|
|
5178
|
-
telemetry: "
|
|
5340
|
+
telemetry: "result-and-error",
|
|
5341
|
+
telemetrySubcommands: ["list", "use", "create", "doctor"],
|
|
5179
5342
|
handler: runProfilesCommand
|
|
5180
5343
|
},
|
|
5181
5344
|
{
|
|
@@ -5187,7 +5350,8 @@ var commandRegistry = createCommandRegistry([
|
|
|
5187
5350
|
mutability: "read",
|
|
5188
5351
|
validateConfigBeforeRun: false,
|
|
5189
5352
|
resetApiRequestCountBeforeRun: false,
|
|
5190
|
-
telemetry: "
|
|
5353
|
+
telemetry: "result-and-error",
|
|
5354
|
+
telemetrySubcommands: ["show"],
|
|
5191
5355
|
handler: runConfigCommand
|
|
5192
5356
|
},
|
|
5193
5357
|
{
|
|
@@ -5210,7 +5374,8 @@ var commandRegistry = createCommandRegistry([
|
|
|
5210
5374
|
mutability: "write",
|
|
5211
5375
|
validateConfigBeforeRun: false,
|
|
5212
5376
|
resetApiRequestCountBeforeRun: false,
|
|
5213
|
-
telemetry: "
|
|
5377
|
+
telemetry: "result-and-error",
|
|
5378
|
+
defaultSubcommand: "scan",
|
|
5214
5379
|
handler: runHarnessCommand
|
|
5215
5380
|
},
|
|
5216
5381
|
{
|
|
@@ -5226,7 +5391,9 @@ var commandRegistry = createCommandRegistry([
|
|
|
5226
5391
|
mutability: "read",
|
|
5227
5392
|
validateConfigBeforeRun: false,
|
|
5228
5393
|
resetApiRequestCountBeforeRun: false,
|
|
5229
|
-
telemetry: "
|
|
5394
|
+
telemetry: "result-and-error",
|
|
5395
|
+
telemetrySubcommands: ["context", "next-action", "next-actions", "evidence", "investigate"],
|
|
5396
|
+
defaultSubcommand: "context",
|
|
5230
5397
|
handler: runAgentCommand
|
|
5231
5398
|
},
|
|
5232
5399
|
{
|
|
@@ -5242,7 +5409,9 @@ var commandRegistry = createCommandRegistry([
|
|
|
5242
5409
|
mutability: "write",
|
|
5243
5410
|
validateConfigBeforeRun: false,
|
|
5244
5411
|
resetApiRequestCountBeforeRun: false,
|
|
5245
|
-
telemetry: "
|
|
5412
|
+
telemetry: "result-and-error",
|
|
5413
|
+
telemetrySubcommands: ["harness", "prompts", "skills"],
|
|
5414
|
+
defaultSubcommand: "harness",
|
|
5246
5415
|
handler: runSyncCommand
|
|
5247
5416
|
},
|
|
5248
5417
|
{
|
|
@@ -5382,7 +5551,8 @@ var commandRegistry = createCommandRegistry([
|
|
|
5382
5551
|
mutability: "write",
|
|
5383
5552
|
validateConfigBeforeRun: false,
|
|
5384
5553
|
resetApiRequestCountBeforeRun: false,
|
|
5385
|
-
telemetry: "
|
|
5554
|
+
telemetry: "result-and-error",
|
|
5555
|
+
defaultSubcommand: "push",
|
|
5386
5556
|
handler: runRegistryCommand
|
|
5387
5557
|
},
|
|
5388
5558
|
legacyCommand({
|
|
@@ -5496,7 +5666,10 @@ var commandRegistry = createCommandRegistry([
|
|
|
5496
5666
|
legacyCommand({
|
|
5497
5667
|
name: "frustrations",
|
|
5498
5668
|
description: "User frustration detections: the frustration family of `emotions` (same data as the dashboard), legacy field names",
|
|
5499
|
-
examples: [
|
|
5669
|
+
examples: [
|
|
5670
|
+
"moda frustrations --days-back=14",
|
|
5671
|
+
"moda frustrations --days-back=14 --include-window # agent output omits conversation windows unless asked"
|
|
5672
|
+
],
|
|
5500
5673
|
...dataApiDefaults
|
|
5501
5674
|
}),
|
|
5502
5675
|
legacyCommand({
|
|
@@ -5520,6 +5693,7 @@ var commandRegistry = createCommandRegistry([
|
|
|
5520
5693
|
description: "Rank cross-signal Problems by root cause (what to fix first)",
|
|
5521
5694
|
examples: ["moda problems", "moda problems --days-back=7 --limit=10", "moda problems remainder --family=emotion"],
|
|
5522
5695
|
subcommands: PROBLEMS_SUBCOMMAND_HELP,
|
|
5696
|
+
defaultSubcommand: "list",
|
|
5523
5697
|
...dataApiDefaults
|
|
5524
5698
|
}),
|
|
5525
5699
|
legacyCommand({
|
|
@@ -5542,6 +5716,7 @@ var commandRegistry = createCommandRegistry([
|
|
|
5542
5716
|
description: "Open one Problem: dossier, or --evidence/--reports/--traces/--feedback pages (--conversations is a legacy alias of --traces)",
|
|
5543
5717
|
examples: [
|
|
5544
5718
|
"moda problem <problem_id>",
|
|
5719
|
+
"moda problem <problem_id> --full # whole dossier (agent output defaults to a compact one)",
|
|
5545
5720
|
"moda problem <problem_id> --evidence --limit=10",
|
|
5546
5721
|
"moda problem <problem_id> --reports",
|
|
5547
5722
|
"moda problem <problem_id> --traces --family=tool_failure",
|
|
@@ -5634,6 +5809,7 @@ var commandRegistry = createCommandRegistry([
|
|
|
5634
5809
|
"moda signals activate <signal_id>"
|
|
5635
5810
|
],
|
|
5636
5811
|
subcommands: SIGNALS_SUBCOMMAND_HELP,
|
|
5812
|
+
defaultSubcommand: "list",
|
|
5637
5813
|
...dataApiDefaults,
|
|
5638
5814
|
mutability: "write"
|
|
5639
5815
|
}),
|
|
@@ -5667,7 +5843,8 @@ var commandRegistry = createCommandRegistry([
|
|
|
5667
5843
|
description: "Multi-family emotion detections (frustration, disapproval, sadness, confusion, anxiety, trust, positive)",
|
|
5668
5844
|
examples: [
|
|
5669
5845
|
"moda emotions --days-back=7",
|
|
5670
|
-
"moda emotions --family=confusion --limit=20"
|
|
5846
|
+
"moda emotions --family=confusion --limit=20",
|
|
5847
|
+
"moda emotions --include-window # keep conversation windows in agent output"
|
|
5671
5848
|
],
|
|
5672
5849
|
...dataApiDefaults
|
|
5673
5850
|
}),
|
|
@@ -5821,7 +5998,8 @@ var commandRegistry = createCommandRegistry([
|
|
|
5821
5998
|
mutability: "write",
|
|
5822
5999
|
validateConfigBeforeRun: (parsed) => !OFFLINE_PROMPTS_SUBCOMMANDS.has(parsed.positional ?? "status"),
|
|
5823
6000
|
resetApiRequestCountBeforeRun: true,
|
|
5824
|
-
telemetry: "result-and-error"
|
|
6001
|
+
telemetry: "result-and-error",
|
|
6002
|
+
defaultSubcommand: "status"
|
|
5825
6003
|
}),
|
|
5826
6004
|
{
|
|
5827
6005
|
name: "skills",
|
|
@@ -5841,7 +6019,7 @@ var commandRegistry = createCommandRegistry([
|
|
|
5841
6019
|
mutability: "write",
|
|
5842
6020
|
validateConfigBeforeRun: false,
|
|
5843
6021
|
resetApiRequestCountBeforeRun: false,
|
|
5844
|
-
telemetry: "result",
|
|
6022
|
+
telemetry: "result-and-error",
|
|
5845
6023
|
handler: async (context) => ({
|
|
5846
6024
|
exitCode: await runSkillsCommand(context)
|
|
5847
6025
|
})
|
|
@@ -5861,9 +6039,10 @@ var commandRegistry = createCommandRegistry([
|
|
|
5861
6039
|
outputModes: ["human", "json", "agent"],
|
|
5862
6040
|
mutability: "write",
|
|
5863
6041
|
subcommands: FIXES_SUBCOMMAND_HELP,
|
|
6042
|
+
defaultSubcommand: "list",
|
|
5864
6043
|
validateConfigBeforeRun: false,
|
|
5865
6044
|
resetApiRequestCountBeforeRun: false,
|
|
5866
|
-
telemetry: "result",
|
|
6045
|
+
telemetry: "result-and-error",
|
|
5867
6046
|
handler: async (context) => ({
|
|
5868
6047
|
exitCode: await runFixesCommand(context)
|
|
5869
6048
|
})
|
|
@@ -5887,7 +6066,7 @@ var commandRegistry = createCommandRegistry([
|
|
|
5887
6066
|
mutability: "write",
|
|
5888
6067
|
validateConfigBeforeRun: false,
|
|
5889
6068
|
resetApiRequestCountBeforeRun: false,
|
|
5890
|
-
telemetry: "result",
|
|
6069
|
+
telemetry: "result-and-error",
|
|
5891
6070
|
handler: async (context) => ({
|
|
5892
6071
|
exitCode: await runFixCommand(context)
|
|
5893
6072
|
})
|
|
@@ -6003,6 +6182,12 @@ function printAgentCliError(command, error, mode = "agent") {
|
|
|
6003
6182
|
});
|
|
6004
6183
|
output.writeError(error);
|
|
6005
6184
|
}
|
|
6185
|
+
function existingFlagProfile(flags) {
|
|
6186
|
+
const name = flags.profile;
|
|
6187
|
+
if (!name || name === "true")
|
|
6188
|
+
return;
|
|
6189
|
+
return Object.hasOwn(loadProfileConfig({ env: process.env }).profiles, name) ? name : undefined;
|
|
6190
|
+
}
|
|
6006
6191
|
async function dispatchParsedCommand(parsed, startedAt = Date.now()) {
|
|
6007
6192
|
const previousProfileEnv = process.env.MODA_PROFILE;
|
|
6008
6193
|
try {
|
|
@@ -6055,8 +6240,7 @@ async function dispatchParsedCommandInner(parsed, startedAt) {
|
|
|
6055
6240
|
const telemetryOptOut = telemetryDisabled || flags["no-telemetry"] !== undefined && flags["no-telemetry"] !== "false";
|
|
6056
6241
|
if (commandDefinition && !telemetryOptOut && commandDefinition.telemetry === "result-and-error") {
|
|
6057
6242
|
const telemetryCommand2 = telemetryCommandName(commandDefinition);
|
|
6058
|
-
const
|
|
6059
|
-
const telemetryProfile = flagProfile && Object.hasOwn(loadProfileConfig({ env: process.env }).profiles, flagProfile) ? flagProfile : undefined;
|
|
6243
|
+
const telemetryProfile = existingFlagProfile(commandFlags);
|
|
6060
6244
|
sendCliUsageTelemetry({
|
|
6061
6245
|
apiKey: resolveApiKey({ profile: telemetryProfile }),
|
|
6062
6246
|
profile: telemetryProfile,
|
|
@@ -6075,7 +6259,8 @@ async function dispatchParsedCommandInner(parsed, startedAt) {
|
|
|
6075
6259
|
outputMode: mode,
|
|
6076
6260
|
recorded: {},
|
|
6077
6261
|
skillVersion: process.env.MODA_SKILL_VERSION,
|
|
6078
|
-
subcommands: commandDefinition
|
|
6262
|
+
subcommands: telemetrySubcommandNames(commandDefinition),
|
|
6263
|
+
defaultSubcommand: commandDefinition.defaultSubcommand
|
|
6079
6264
|
})
|
|
6080
6265
|
});
|
|
6081
6266
|
}
|
|
@@ -6130,15 +6315,17 @@ async function dispatchParsedCommandInner(parsed, startedAt) {
|
|
|
6130
6315
|
});
|
|
6131
6316
|
setActiveContext(context);
|
|
6132
6317
|
const telemetryCommand = telemetryCommandName(definition);
|
|
6133
|
-
const telemetrySubcommands = definition
|
|
6318
|
+
const telemetrySubcommands = telemetrySubcommandNames(definition);
|
|
6134
6319
|
const needsConfig = typeof definition.validateConfigBeforeRun === "function" ? definition.validateConfigBeforeRun(parsed) : definition.validateConfigBeforeRun;
|
|
6135
6320
|
if (needsConfig) {
|
|
6136
6321
|
try {
|
|
6137
6322
|
validateConfig();
|
|
6138
6323
|
} catch (error) {
|
|
6139
6324
|
if (!telemetryDisabled && definition.telemetry === "result-and-error") {
|
|
6325
|
+
const telemetryProfile = existingFlagProfile(commandFlags);
|
|
6140
6326
|
sendCliUsageTelemetry({
|
|
6141
|
-
apiKey: resolveApiKey(),
|
|
6327
|
+
apiKey: resolveApiKey({ profile: telemetryProfile }),
|
|
6328
|
+
profile: telemetryProfile,
|
|
6142
6329
|
command: telemetryCommand,
|
|
6143
6330
|
flags: commandFlags,
|
|
6144
6331
|
status: "error",
|
|
@@ -6154,7 +6341,8 @@ async function dispatchParsedCommandInner(parsed, startedAt) {
|
|
|
6154
6341
|
outputMode: context.outputMode,
|
|
6155
6342
|
recorded: context.getTelemetryMeta(),
|
|
6156
6343
|
skillVersion: process.env.MODA_SKILL_VERSION,
|
|
6157
|
-
subcommands: telemetrySubcommands
|
|
6344
|
+
subcommands: telemetrySubcommands,
|
|
6345
|
+
defaultSubcommand: definition.defaultSubcommand
|
|
6158
6346
|
})
|
|
6159
6347
|
});
|
|
6160
6348
|
}
|
|
@@ -6172,8 +6360,10 @@ async function dispatchParsedCommandInner(parsed, startedAt) {
|
|
|
6172
6360
|
try {
|
|
6173
6361
|
const result = await definition.handler(context);
|
|
6174
6362
|
if (!telemetryDisabled && definition.telemetry !== "none") {
|
|
6363
|
+
const telemetryProfile = existingFlagProfile(commandFlags);
|
|
6175
6364
|
sendCliUsageTelemetry({
|
|
6176
|
-
apiKey: result.apiKey ?? resolveApiKey(),
|
|
6365
|
+
apiKey: result.apiKey ?? resolveApiKey({ profile: telemetryProfile }),
|
|
6366
|
+
profile: telemetryProfile,
|
|
6177
6367
|
command: telemetryCommand,
|
|
6178
6368
|
flags: commandFlags,
|
|
6179
6369
|
status: result.exitCode === 0 ? "success" : "error",
|
|
@@ -6187,7 +6377,8 @@ async function dispatchParsedCommandInner(parsed, startedAt) {
|
|
|
6187
6377
|
outputMode: context.outputMode,
|
|
6188
6378
|
recorded: context.getTelemetryMeta(),
|
|
6189
6379
|
skillVersion: process.env.MODA_SKILL_VERSION,
|
|
6190
|
-
subcommands: telemetrySubcommands
|
|
6380
|
+
subcommands: telemetrySubcommands,
|
|
6381
|
+
defaultSubcommand: definition.defaultSubcommand
|
|
6191
6382
|
})
|
|
6192
6383
|
});
|
|
6193
6384
|
}
|
|
@@ -6198,8 +6389,10 @@ async function dispatchParsedCommandInner(parsed, startedAt) {
|
|
|
6198
6389
|
return finishRun(context, { kind: "completed", exitCode: result.exitCode });
|
|
6199
6390
|
} catch (error) {
|
|
6200
6391
|
if (!telemetryDisabled && definition.telemetry === "result-and-error") {
|
|
6392
|
+
const telemetryProfile = existingFlagProfile(commandFlags);
|
|
6201
6393
|
sendCliUsageTelemetry({
|
|
6202
|
-
apiKey: resolveApiKey(),
|
|
6394
|
+
apiKey: resolveApiKey({ profile: telemetryProfile }),
|
|
6395
|
+
profile: telemetryProfile,
|
|
6203
6396
|
command: telemetryCommand,
|
|
6204
6397
|
flags: commandFlags,
|
|
6205
6398
|
status: "error",
|
|
@@ -6215,7 +6408,8 @@ async function dispatchParsedCommandInner(parsed, startedAt) {
|
|
|
6215
6408
|
outputMode: context.outputMode,
|
|
6216
6409
|
recorded: context.getTelemetryMeta(),
|
|
6217
6410
|
skillVersion: process.env.MODA_SKILL_VERSION,
|
|
6218
|
-
subcommands: telemetrySubcommands
|
|
6411
|
+
subcommands: telemetrySubcommands,
|
|
6412
|
+
defaultSubcommand: definition.defaultSubcommand
|
|
6219
6413
|
})
|
|
6220
6414
|
});
|
|
6221
6415
|
}
|
|
@@ -6267,6 +6461,7 @@ if (isMain) {
|
|
|
6267
6461
|
});
|
|
6268
6462
|
}
|
|
6269
6463
|
export {
|
|
6464
|
+
telemetrySubcommandNames,
|
|
6270
6465
|
telemetryCommandName,
|
|
6271
6466
|
stripLoneSurrogates,
|
|
6272
6467
|
searchOutcomeWarnings,
|
|
@@ -6290,6 +6485,7 @@ export {
|
|
|
6290
6485
|
capProblemsBlocks,
|
|
6291
6486
|
buildResumeCommand,
|
|
6292
6487
|
auditCapStatus,
|
|
6488
|
+
TELEMETRY_EXEMPT_COMMANDS,
|
|
6293
6489
|
TAIL_LIMITS,
|
|
6294
6490
|
RAW_BOOLEAN_FLAGS,
|
|
6295
6491
|
LEGACY_WINDOW_MAX_MESSAGES,
|