@moda-ai/cli 1.55.22 → 1.55.23
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-mj622k8s.js → agent-f8a1kejk.js} +8 -9
- package/dist/{cli-569hj0bj.js → cli-2cggp8ww.js} +1 -1
- package/dist/{cli-a5c9te95.js → cli-4f6jkrnm.js} +5 -5
- package/dist/cli-4yarp5s1.js +61 -0
- package/dist/{cli-0ef72tqx.js → cli-54zhv6cx.js} +4 -4
- package/dist/{cli-9x9adrtj.js → cli-9g8vz4sv.js} +1 -1
- package/dist/{cli-cehskjde.js → cli-cv3jt1ms.js} +5 -7
- package/dist/{cli-033n2mpb.js → cli-d2zews6c.js} +6 -9
- package/dist/{cli-wf7gfa1e.js → cli-s6tw1fje.js} +8 -10
- package/dist/{cli-5ke3xe6y.js → cli-t3a6eknn.js} +26 -1
- package/dist/{cli-rqk6f6n6.js → cli-wkmdw40s.js} +24 -5
- package/dist/{cli-pc5cw7mx.js → cli-z3g07t65.js} +5 -5
- package/dist/cli.js +43 -33
- package/dist/{doctor-mx6jf435.js → doctor-snb87jvy.js} +8 -9
- package/dist/{fix-9fmy6p2x.js → fix-fr48gr0w.js} +6 -7
- package/dist/{harness-github-actions-c826bfxs.js → harness-github-actions-cfkx9ty9.js} +5 -6
- package/dist/{harness-xvg6ws6x.js → harness-m63b6s0k.js} +5 -6
- package/dist/{index-1wbjz3jc.js → index-nsaph4as.js} +11 -11
- package/dist/{production-intelligence-dbe9dmc5.js → production-intelligence-fwjh572m.js} +8 -7
- package/dist/{profile-commands-kmmd9y86.js → profile-commands-548ts402.js} +7 -48
- package/dist/prompt-source-mcp.js +5 -6
- package/dist/{prompts-1tkhrxkq.js → prompts-p66y7wep.js} +6 -7
- package/dist/{provision-wzttap58.js → provision-r9fhrvpw.js} +5 -4
- package/dist/{registry-atqyb5fa.js → registry-n7dsdxmg.js} +3 -4
- package/dist/{skills-gejdvjak.js → skills-c17gg69y.js} +5 -6
- package/dist/{sync-57ercmh9.js → sync-bne90xvj.js} +7 -8
- package/package.json +1 -1
- package/skills/integration/index.json +2 -2
- package/dist/cli-7ea02wca.js +0 -30
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
buildDoctorReport
|
|
3
|
-
} from "./cli-
|
|
4
|
-
import"./cli-
|
|
5
|
-
import"./cli-
|
|
3
|
+
} from "./cli-z3g07t65.js";
|
|
4
|
+
import"./cli-9g8vz4sv.js";
|
|
5
|
+
import"./cli-s6tw1fje.js";
|
|
6
6
|
import"./cli-mm48br00.js";
|
|
7
7
|
import {
|
|
8
8
|
HARNESS_REPORT_APPROVAL_PATH,
|
|
@@ -14,19 +14,18 @@ import {
|
|
|
14
14
|
readHarnessSyncState,
|
|
15
15
|
summarizeHarness,
|
|
16
16
|
validateHarnessReport
|
|
17
|
-
} from "./cli-
|
|
17
|
+
} from "./cli-4f6jkrnm.js";
|
|
18
18
|
import"./cli-97fnztpy.js";
|
|
19
|
-
import"./cli-
|
|
20
|
-
import"./cli-
|
|
21
|
-
import"./cli-
|
|
22
|
-
import"./cli-7ea02wca.js";
|
|
19
|
+
import"./cli-2cggp8ww.js";
|
|
20
|
+
import"./cli-cv3jt1ms.js";
|
|
21
|
+
import"./cli-wkmdw40s.js";
|
|
23
22
|
import {
|
|
24
23
|
CliInputError,
|
|
25
24
|
resolveApiKey,
|
|
26
25
|
resolveIngestUrl,
|
|
27
26
|
resolveModaBaseUrl,
|
|
28
27
|
resolveTenantId
|
|
29
|
-
} from "./cli-
|
|
28
|
+
} from "./cli-t3a6eknn.js";
|
|
30
29
|
import"./cli-0v6na3yp.js";
|
|
31
30
|
|
|
32
31
|
// src/agent.ts
|
|
@@ -4,16 +4,16 @@ import {
|
|
|
4
4
|
import {
|
|
5
5
|
createCommandContext,
|
|
6
6
|
stringOption
|
|
7
|
-
} from "./cli-
|
|
7
|
+
} from "./cli-2cggp8ww.js";
|
|
8
8
|
import {
|
|
9
9
|
assertFlags,
|
|
10
10
|
assertPositionals,
|
|
11
11
|
requireTenant
|
|
12
|
-
} from "./cli-
|
|
12
|
+
} from "./cli-cv3jt1ms.js";
|
|
13
13
|
import {
|
|
14
14
|
ApiError,
|
|
15
15
|
callControlAPI
|
|
16
|
-
} from "./cli-
|
|
16
|
+
} from "./cli-wkmdw40s.js";
|
|
17
17
|
import {
|
|
18
18
|
CliInputError,
|
|
19
19
|
CliInputRequiredError,
|
|
@@ -39,7 +39,7 @@ import {
|
|
|
39
39
|
resolveModaBaseUrl,
|
|
40
40
|
resolveTenantId,
|
|
41
41
|
shouldInventoryFile
|
|
42
|
-
} from "./cli-
|
|
42
|
+
} from "./cli-t3a6eknn.js";
|
|
43
43
|
import {
|
|
44
44
|
__commonJS,
|
|
45
45
|
__require,
|
|
@@ -195871,7 +195871,7 @@ async function runHarnessCommand(context) {
|
|
|
195871
195871
|
throw new CliInputError("Focused remote prompt analysis is not supported yet.", "Use local --analyst=claude|codex|cursor|local-scan, or drop --concern for a full remote report.");
|
|
195872
195872
|
}
|
|
195873
195873
|
if (context.flags["github-actions"] === "true") {
|
|
195874
|
-
const { runGithubActionsAnalyze } = await import("./harness-github-actions-
|
|
195874
|
+
const { runGithubActionsAnalyze } = await import("./harness-github-actions-cfkx9ty9.js");
|
|
195875
195875
|
const result = await runGithubActionsAnalyze(rootDir, {
|
|
195876
195876
|
writeReport: (report2) => {
|
|
195877
195877
|
const normalized = normalizeHarnessReport(report2);
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import {
|
|
2
|
+
apiKeyHeaders,
|
|
3
|
+
embeddedTenantIdFromApiKey,
|
|
4
|
+
recordApiRequest,
|
|
5
|
+
resolveApiKey,
|
|
6
|
+
resolveApiKeyFromActiveProfile,
|
|
7
|
+
resolveModaBaseUrl
|
|
8
|
+
} from "./cli-t3a6eknn.js";
|
|
9
|
+
|
|
10
|
+
// src/api-key-auth.ts
|
|
11
|
+
var PROBE_TIMEOUT_MS = 1e4;
|
|
12
|
+
function resolveApiKeyCredential(options = {}) {
|
|
13
|
+
const key = resolveApiKey(options);
|
|
14
|
+
if (!key)
|
|
15
|
+
return;
|
|
16
|
+
const env = options.env ?? process.env;
|
|
17
|
+
const source = env.MODA_API_KEY === key ? "env" : resolveApiKeyFromActiveProfile(options) === key ? "profile" : "config";
|
|
18
|
+
return { key, source, tenantId: embeddedTenantIdFromApiKey(key) };
|
|
19
|
+
}
|
|
20
|
+
function redactApiKey(key) {
|
|
21
|
+
if (key.length <= 12)
|
|
22
|
+
return "<redacted>";
|
|
23
|
+
return `${key.slice(0, 8)}...${key.slice(-4)}`;
|
|
24
|
+
}
|
|
25
|
+
async function fetchApiKeyProbe(baseUrl, headers, timeoutMs) {
|
|
26
|
+
const probe = (path) => {
|
|
27
|
+
recordApiRequest();
|
|
28
|
+
return fetch(`${baseUrl}/api/v1/data/${path}`, {
|
|
29
|
+
method: "GET",
|
|
30
|
+
headers,
|
|
31
|
+
signal: AbortSignal.timeout(timeoutMs)
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
const response = await probe("whoami");
|
|
35
|
+
if (response.status !== 404)
|
|
36
|
+
return response;
|
|
37
|
+
return probe("overview");
|
|
38
|
+
}
|
|
39
|
+
async function probeApiKey(key, options = {}) {
|
|
40
|
+
let response;
|
|
41
|
+
try {
|
|
42
|
+
response = await fetchApiKeyProbe(resolveModaBaseUrl(options), apiKeyHeaders(key, options), PROBE_TIMEOUT_MS);
|
|
43
|
+
} catch (error) {
|
|
44
|
+
const reason = error instanceof Error ? error.message : String(error);
|
|
45
|
+
return { outcome: "unreachable", reason };
|
|
46
|
+
}
|
|
47
|
+
if (response.status === 401 || response.status === 403) {
|
|
48
|
+
return { outcome: "rejected", status: response.status };
|
|
49
|
+
}
|
|
50
|
+
if (response.status !== 200) {
|
|
51
|
+
return { outcome: "unreachable", reason: `HTTP ${response.status}` };
|
|
52
|
+
}
|
|
53
|
+
try {
|
|
54
|
+
await response.json();
|
|
55
|
+
} catch {
|
|
56
|
+
return { outcome: "unreachable", reason: "non-JSON response from the Data API" };
|
|
57
|
+
}
|
|
58
|
+
return { outcome: "live" };
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export { resolveApiKeyCredential, redactApiKey, fetchApiKeyProbe, probeApiKey };
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createCommandContext
|
|
3
|
-
} from "./cli-
|
|
3
|
+
} from "./cli-2cggp8ww.js";
|
|
4
4
|
import {
|
|
5
5
|
assertFlags,
|
|
6
6
|
assertPositionals
|
|
7
|
-
} from "./cli-
|
|
7
|
+
} from "./cli-cv3jt1ms.js";
|
|
8
8
|
import {
|
|
9
9
|
callControlAPI
|
|
10
|
-
} from "./cli-
|
|
10
|
+
} from "./cli-wkmdw40s.js";
|
|
11
11
|
import {
|
|
12
12
|
CliInputError,
|
|
13
13
|
recordApiRequest,
|
|
14
14
|
resolveApiKey,
|
|
15
15
|
resolveIngestUrl,
|
|
16
16
|
resolveTenantId
|
|
17
|
-
} from "./cli-
|
|
17
|
+
} from "./cli-t3a6eknn.js";
|
|
18
18
|
import {
|
|
19
19
|
SKILL_SOURCE_HARNESS,
|
|
20
20
|
SKILL_SOURCE_INTEGRATION_BUNDLED,
|
|
@@ -2,18 +2,16 @@ import {
|
|
|
2
2
|
ApiError,
|
|
3
3
|
callControlAPI,
|
|
4
4
|
callDataAPI
|
|
5
|
-
} from "./cli-
|
|
6
|
-
import {
|
|
7
|
-
isPlatformApiKey,
|
|
8
|
-
setPlatformTenantOverride
|
|
9
|
-
} from "./cli-7ea02wca.js";
|
|
5
|
+
} from "./cli-wkmdw40s.js";
|
|
10
6
|
import {
|
|
11
7
|
CliAccessError,
|
|
12
8
|
CliInputError,
|
|
13
9
|
embeddedTenantIdFromApiKey,
|
|
10
|
+
isPlatformApiKey,
|
|
14
11
|
resolveApiKey,
|
|
15
|
-
resolveApiTenantId
|
|
16
|
-
|
|
12
|
+
resolveApiTenantId,
|
|
13
|
+
setPlatformTenantOverride
|
|
14
|
+
} from "./cli-t3a6eknn.js";
|
|
17
15
|
|
|
18
16
|
// src/schemas.ts
|
|
19
17
|
import { z } from "zod";
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
+
import {
|
|
2
|
+
fetchApiKeyProbe
|
|
3
|
+
} from "./cli-4yarp5s1.js";
|
|
1
4
|
import {
|
|
2
5
|
authFetch,
|
|
3
6
|
getCachedLoginContext
|
|
4
|
-
} from "./cli-
|
|
7
|
+
} from "./cli-9g8vz4sv.js";
|
|
5
8
|
import {
|
|
6
9
|
CliAccessError,
|
|
7
10
|
CliInputError,
|
|
@@ -9,14 +12,13 @@ import {
|
|
|
9
12
|
embeddedTenantIdFromApiKey,
|
|
10
13
|
getModaDir,
|
|
11
14
|
loadCliConfig,
|
|
12
|
-
recordApiRequest,
|
|
13
15
|
resolveApiKeyFromActiveProfile,
|
|
14
16
|
resolveIngestUrl,
|
|
15
17
|
resolveModaBaseUrl,
|
|
16
18
|
resolveTenantIdFromActiveProfile,
|
|
17
19
|
saveCliConfig,
|
|
18
20
|
writeSecretJsonFile
|
|
19
|
-
} from "./cli-
|
|
21
|
+
} from "./cli-t3a6eknn.js";
|
|
20
22
|
|
|
21
23
|
// src/init/tenant.ts
|
|
22
24
|
import { randomUUID } from "node:crypto";
|
|
@@ -115,12 +117,7 @@ function bootstrapLabel(custom) {
|
|
|
115
117
|
var embeddedTenantId = embeddedTenantIdFromApiKey;
|
|
116
118
|
async function isStoredKeyLive(key, options = {}) {
|
|
117
119
|
try {
|
|
118
|
-
|
|
119
|
-
const response = await fetch(`${resolveModaBaseUrl(options)}/api/v1/data/overview`, {
|
|
120
|
-
method: "GET",
|
|
121
|
-
headers: { "x-api-key": key },
|
|
122
|
-
signal: AbortSignal.timeout(VALIDATE_TIMEOUT_MS)
|
|
123
|
-
});
|
|
120
|
+
const response = await fetchApiKeyProbe(resolveModaBaseUrl(options), { "x-api-key": key }, VALIDATE_TIMEOUT_MS);
|
|
124
121
|
if (response.status !== 200)
|
|
125
122
|
return false;
|
|
126
123
|
await response.json();
|
|
@@ -12,28 +12,26 @@ import {
|
|
|
12
12
|
require_typescript,
|
|
13
13
|
resolvePromptSource,
|
|
14
14
|
safePromptEvidencePath
|
|
15
|
-
} from "./cli-
|
|
15
|
+
} from "./cli-4f6jkrnm.js";
|
|
16
16
|
import {
|
|
17
17
|
createCommandContext
|
|
18
|
-
} from "./cli-
|
|
18
|
+
} from "./cli-2cggp8ww.js";
|
|
19
19
|
import {
|
|
20
20
|
assertFlags,
|
|
21
21
|
assertPositionals
|
|
22
|
-
} from "./cli-
|
|
22
|
+
} from "./cli-cv3jt1ms.js";
|
|
23
23
|
import {
|
|
24
24
|
callControlAPI,
|
|
25
25
|
callDataAPI
|
|
26
|
-
} from "./cli-
|
|
27
|
-
import {
|
|
28
|
-
setPlatformTenantOverride
|
|
29
|
-
} from "./cli-7ea02wca.js";
|
|
26
|
+
} from "./cli-wkmdw40s.js";
|
|
30
27
|
import {
|
|
31
28
|
CliInputError,
|
|
32
29
|
EXIT_ERROR,
|
|
33
30
|
EXIT_OK,
|
|
34
31
|
resolveApiTenantId,
|
|
32
|
+
setPlatformTenantOverride,
|
|
35
33
|
validateConfig
|
|
36
|
-
} from "./cli-
|
|
34
|
+
} from "./cli-t3a6eknn.js";
|
|
37
35
|
import {
|
|
38
36
|
__commonJS,
|
|
39
37
|
__require,
|
|
@@ -6731,7 +6729,7 @@ async function runPromptSyncExclusive(flags, profileOptions, options) {
|
|
|
6731
6729
|
const analyzedDefinitions = new Map;
|
|
6732
6730
|
if (flags["no-analyze"] !== "true") {
|
|
6733
6731
|
options.onProgress?.("Analyzing prompt sources before sync.");
|
|
6734
|
-
const { analyzeHarnessPrompts } = await import("./harness-
|
|
6732
|
+
const { analyzeHarnessPrompts } = await import("./harness-m63b6s0k.js");
|
|
6735
6733
|
const result = await analyzeHarnessPrompts({
|
|
6736
6734
|
rootDir: process.cwd(),
|
|
6737
6735
|
existing: established.flatMap((prompt) => prompt.sourceDefinition ? [prompt.sourceDefinition.source] : []),
|
|
@@ -7061,7 +7059,7 @@ async function migratePromptManifest(options = {}) {
|
|
|
7061
7059
|
let addedSources = [];
|
|
7062
7060
|
let pendingSources = [];
|
|
7063
7061
|
if (options.discover) {
|
|
7064
|
-
const { analyzeHarnessPrompts } = await import("./harness-
|
|
7062
|
+
const { analyzeHarnessPrompts } = await import("./harness-m63b6s0k.js");
|
|
7065
7063
|
const result = await analyzeHarnessPrompts({
|
|
7066
7064
|
rootDir: root,
|
|
7067
7065
|
existing: manifest.sources,
|
|
@@ -2622,4 +2622,29 @@ function extractSuggestedCommands(text) {
|
|
|
2622
2622
|
return commands.length > 0 ? commands : undefined;
|
|
2623
2623
|
}
|
|
2624
2624
|
|
|
2625
|
-
|
|
2625
|
+
// src/api-key-headers.ts
|
|
2626
|
+
var PLATFORM_API_KEY_PREFIX = "moda_pk_";
|
|
2627
|
+
var TENANT_HEADER = "x-moda-tenant-id";
|
|
2628
|
+
function isPlatformApiKey(key) {
|
|
2629
|
+
return Boolean(key?.startsWith(PLATFORM_API_KEY_PREFIX));
|
|
2630
|
+
}
|
|
2631
|
+
var platformTenantOverride;
|
|
2632
|
+
function setPlatformTenantOverride(tenantId) {
|
|
2633
|
+
platformTenantOverride = tenantId;
|
|
2634
|
+
}
|
|
2635
|
+
var TENANT_PATH = /\/tenants\/([^/?#]+)/;
|
|
2636
|
+
function tenantFromUrl(url) {
|
|
2637
|
+
const match = url ? TENANT_PATH.exec(url) : null;
|
|
2638
|
+
return match ? decodeURIComponent(match[1]) : undefined;
|
|
2639
|
+
}
|
|
2640
|
+
function apiKeyHeaders(key, options = {}, url) {
|
|
2641
|
+
const headers = { "x-api-key": key };
|
|
2642
|
+
if (isPlatformApiKey(key)) {
|
|
2643
|
+
const tenantId = tenantFromUrl(url) || platformTenantOverride || resolveTenantId(options);
|
|
2644
|
+
if (tenantId)
|
|
2645
|
+
headers[TENANT_HEADER] = tenantId;
|
|
2646
|
+
}
|
|
2647
|
+
return headers;
|
|
2648
|
+
}
|
|
2649
|
+
|
|
2650
|
+
export { PROD_BASE_URL, DEFAULT_INGEST_URL, getModaPaths, getModaDir, isLoopbackBaseUrl, describeBaseUrlSource, loadProfileConfig, saveProfileConfig, getActiveProfile, setActiveProfile, upsertProfile, clearStoredApiKeyCredentials, secretFilePathFromRef, resolveSecretReference, resolveApiKeyFromActiveProfile, resolveTenantIdFromActiveProfile, ensureSecretFilePermissions, writeSecretJsonFile, CliInputError, attachInputDetails, CliAccessError, CliInputRequiredError, CliAuthError, CliNotFoundError, CliCancellationError, isNetworkLikeError, isApiLikeError, apiErrorStatus, VERSION, MODA_BASE_URL, loadCliConfig, saveCliConfig, resolveApiKey, embeddedTenantIdFromApiKey, resolveIngestUrl2 as resolveIngestUrl, resolveTenantId, resolveApiTenantId, resolveModaBaseUrl, validateConfig, isPlatformApiKey, setPlatformTenantOverride, apiKeyHeaders, recordApiRequest, getApiRequestCount, resetApiRequestCount, BATCH_MAX_TARGETS, BATCH_CONCURRENCY, parseBatchTarget, collectBatchTargets, mapWithConcurrency, contextTarget, asRecord, asString, asNumber, frustrationAnchorIndex, frustrationsFromEmotions, withFrustrationAnchors, shellWord, trimToolFailureConversations, withToolFailureAnchors, embeddedWindowSize, withoutDetectionWindows, compactProblemDossier, MAX_SCANNED_FILE_BYTES, DEFAULT_MAX_INVENTORY_FILES, DEFAULT_MAX_INVENTORY_TEXT_BYTES, MAX_RECORDED_SKIPS, SKIPPED_DIRS, isSkippedDir, isSkippedPathPrefix, isEvalLikePath, shouldInventoryFile, isTextFile, isSecretishPath, SECRET_KEYS, redactDeep, redactString, packSnapshot, setAgentUpdateNotice, EXIT_OK, EXIT_ERROR, EXIT_DEGRADED, EXIT_AUTH_REQUIRED, EXIT_INPUT_REQUIRED, EXIT_CANCELLED, AGENT_ERROR_CODES, wasOutputCancelled, safeWriteStdout, safeWriteStderr, explicitOutputMode, outputModeFromFlags, resolveOutputMode, createCliOutput, agentEnvelopeFits, errorToAgentError, agentMaxOutputBytes };
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
|
-
apiKeyHeaders
|
|
3
|
-
} from "./cli-7ea02wca.js";
|
|
4
|
-
import {
|
|
2
|
+
apiKeyHeaders,
|
|
5
3
|
recordApiRequest,
|
|
6
4
|
resolveApiKey,
|
|
7
5
|
resolveModaBaseUrl
|
|
8
|
-
} from "./cli-
|
|
6
|
+
} from "./cli-t3a6eknn.js";
|
|
9
7
|
|
|
10
8
|
// src/api-client.ts
|
|
11
9
|
var REQUEST_TIMEOUT_MS = 30000;
|
|
@@ -87,7 +85,28 @@ function isRetryable(status) {
|
|
|
87
85
|
}
|
|
88
86
|
async function callDataAPI(endpoint, init = { method: "GET" }, requestOptions = {}) {
|
|
89
87
|
const url = `${resolveModaBaseUrl()}/api/v1/data${endpoint}`;
|
|
90
|
-
|
|
88
|
+
try {
|
|
89
|
+
return await callModaAPI(url, init, {}, requestOptions);
|
|
90
|
+
} catch (error) {
|
|
91
|
+
const fallback = withoutIncludeContext(endpoint);
|
|
92
|
+
if (fallback === endpoint || !isUnknownIncludeContextError(error))
|
|
93
|
+
throw error;
|
|
94
|
+
return callModaAPI(`${resolveModaBaseUrl()}/api/v1/data${fallback}`, init, {}, requestOptions);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
function withoutIncludeContext(endpoint) {
|
|
98
|
+
const [path, query] = endpoint.split("?", 2);
|
|
99
|
+
if (query === undefined)
|
|
100
|
+
return endpoint;
|
|
101
|
+
const params = new URLSearchParams(query);
|
|
102
|
+
if (!params.has("include_context"))
|
|
103
|
+
return endpoint;
|
|
104
|
+
params.delete("include_context");
|
|
105
|
+
const rest = params.toString();
|
|
106
|
+
return rest ? `${path}?${rest}` : path;
|
|
107
|
+
}
|
|
108
|
+
function isUnknownIncludeContextError(error) {
|
|
109
|
+
return error instanceof ApiError && error.statusCode === 400 && /property include_context should not exist/i.test(error.responseBody ?? "");
|
|
91
110
|
}
|
|
92
111
|
async function callControlAPI(endpoint, options = {}, profileOptions = {}, requestOptions = {}) {
|
|
93
112
|
const url = `${resolveModaBaseUrl(profileOptions)}/api${endpoint}`;
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import {
|
|
2
2
|
isAuthSessionValid,
|
|
3
3
|
loadAuthSession
|
|
4
|
-
} from "./cli-
|
|
4
|
+
} from "./cli-9g8vz4sv.js";
|
|
5
5
|
import {
|
|
6
6
|
inspectPromptManifest
|
|
7
|
-
} from "./cli-
|
|
7
|
+
} from "./cli-s6tw1fje.js";
|
|
8
8
|
import {
|
|
9
9
|
readHarnessSyncState,
|
|
10
10
|
renderDoctorHuman,
|
|
11
11
|
renderStatusHuman,
|
|
12
12
|
scanHarness
|
|
13
|
-
} from "./cli-
|
|
13
|
+
} from "./cli-4f6jkrnm.js";
|
|
14
14
|
import {
|
|
15
15
|
callDataAPI
|
|
16
|
-
} from "./cli-
|
|
16
|
+
} from "./cli-wkmdw40s.js";
|
|
17
17
|
import {
|
|
18
18
|
ensureSecretFilePermissions,
|
|
19
19
|
getActiveProfile,
|
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
resolveSecretReference,
|
|
28
28
|
resolveTenantId,
|
|
29
29
|
secretFilePathFromRef
|
|
30
|
-
} from "./cli-
|
|
30
|
+
} from "./cli-t3a6eknn.js";
|
|
31
31
|
|
|
32
32
|
// src/doctor.ts
|
|
33
33
|
import { createHash } from "node:crypto";
|
package/dist/cli.js
CHANGED
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
import {
|
|
6
6
|
createCommandContext,
|
|
7
7
|
parseBooleanFlagValue
|
|
8
|
-
} from "./cli-
|
|
8
|
+
} from "./cli-2cggp8ww.js";
|
|
9
9
|
import {
|
|
10
10
|
AuditSchema,
|
|
11
11
|
COMMAND_FLAG_SPECS,
|
|
@@ -43,17 +43,12 @@ import {
|
|
|
43
43
|
specFlagNames,
|
|
44
44
|
subcommandHelpFlags,
|
|
45
45
|
unknownSignalsSubcommandError
|
|
46
|
-
} from "./cli-
|
|
46
|
+
} from "./cli-cv3jt1ms.js";
|
|
47
47
|
import {
|
|
48
48
|
ApiError,
|
|
49
49
|
callControlAPI,
|
|
50
50
|
callDataAPI
|
|
51
|
-
} from "./cli-
|
|
52
|
-
import {
|
|
53
|
-
apiKeyHeaders,
|
|
54
|
-
isPlatformApiKey,
|
|
55
|
-
setPlatformTenantOverride
|
|
56
|
-
} from "./cli-7ea02wca.js";
|
|
51
|
+
} from "./cli-wkmdw40s.js";
|
|
57
52
|
import {
|
|
58
53
|
AGENT_ERROR_CODES,
|
|
59
54
|
BATCH_CONCURRENCY,
|
|
@@ -75,6 +70,7 @@ import {
|
|
|
75
70
|
agentEnvelopeFits,
|
|
76
71
|
agentMaxOutputBytes,
|
|
77
72
|
apiErrorStatus,
|
|
73
|
+
apiKeyHeaders,
|
|
78
74
|
asNumber,
|
|
79
75
|
asRecord,
|
|
80
76
|
asString,
|
|
@@ -91,6 +87,7 @@ import {
|
|
|
91
87
|
getModaDir,
|
|
92
88
|
isApiLikeError,
|
|
93
89
|
isNetworkLikeError,
|
|
90
|
+
isPlatformApiKey,
|
|
94
91
|
loadProfileConfig,
|
|
95
92
|
mapWithConcurrency,
|
|
96
93
|
parseBatchTarget,
|
|
@@ -102,13 +99,14 @@ import {
|
|
|
102
99
|
safeWriteStderr,
|
|
103
100
|
safeWriteStdout,
|
|
104
101
|
setAgentUpdateNotice,
|
|
102
|
+
setPlatformTenantOverride,
|
|
105
103
|
trimToolFailureConversations,
|
|
106
104
|
validateConfig,
|
|
107
105
|
wasOutputCancelled,
|
|
108
106
|
withFrustrationAnchors,
|
|
109
107
|
withToolFailureAnchors,
|
|
110
108
|
withoutDetectionWindows
|
|
111
|
-
} from "./cli-
|
|
109
|
+
} from "./cli-t3a6eknn.js";
|
|
112
110
|
import {
|
|
113
111
|
__require
|
|
114
112
|
} from "./cli-0v6na3yp.js";
|
|
@@ -1850,46 +1848,46 @@ function exitCodesForCommand(command) {
|
|
|
1850
1848
|
import { fileURLToPath } from "url";
|
|
1851
1849
|
import { realpathSync } from "fs";
|
|
1852
1850
|
async function runPromptsCommand(...args) {
|
|
1853
|
-
return (await import("./prompts-
|
|
1851
|
+
return (await import("./prompts-p66y7wep.js")).runPromptsCommand(...args);
|
|
1854
1852
|
}
|
|
1855
1853
|
async function runSkillsCommand(...args) {
|
|
1856
|
-
return (await import("./skills-
|
|
1854
|
+
return (await import("./skills-c17gg69y.js")).runSkillsCommand(...args);
|
|
1857
1855
|
}
|
|
1858
1856
|
async function runFixCommand(...args) {
|
|
1859
|
-
return (await import("./fix-
|
|
1857
|
+
return (await import("./fix-fr48gr0w.js")).runFixCommand(...args);
|
|
1860
1858
|
}
|
|
1861
1859
|
async function runFixesCommand(...args) {
|
|
1862
|
-
return (await import("./fix-
|
|
1860
|
+
return (await import("./fix-fr48gr0w.js")).runFixesCommand(...args);
|
|
1863
1861
|
}
|
|
1864
1862
|
async function runHarnessCommand(...args) {
|
|
1865
|
-
return (await import("./harness-
|
|
1863
|
+
return (await import("./harness-m63b6s0k.js")).runHarnessCommand(...args);
|
|
1866
1864
|
}
|
|
1867
1865
|
async function runSyncCommand(...args) {
|
|
1868
|
-
return (await import("./sync-
|
|
1866
|
+
return (await import("./sync-bne90xvj.js")).runSyncCommand(...args);
|
|
1869
1867
|
}
|
|
1870
1868
|
async function runRegistryCommand(...args) {
|
|
1871
|
-
return (await import("./registry-
|
|
1869
|
+
return (await import("./registry-n7dsdxmg.js")).runRegistryCommand(...args);
|
|
1872
1870
|
}
|
|
1873
1871
|
async function runDoctorCommand(...args) {
|
|
1874
|
-
return (await import("./doctor-
|
|
1872
|
+
return (await import("./doctor-snb87jvy.js")).runDoctorCommand(...args);
|
|
1875
1873
|
}
|
|
1876
1874
|
async function runStatusCommand(...args) {
|
|
1877
|
-
return (await import("./doctor-
|
|
1875
|
+
return (await import("./doctor-snb87jvy.js")).runStatusCommand(...args);
|
|
1878
1876
|
}
|
|
1879
1877
|
async function runAuthCommand(...args) {
|
|
1880
|
-
return (await import("./profile-commands-
|
|
1878
|
+
return (await import("./profile-commands-548ts402.js")).runAuthCommand(...args);
|
|
1881
1879
|
}
|
|
1882
1880
|
async function runConfigCommand(...args) {
|
|
1883
|
-
return (await import("./profile-commands-
|
|
1881
|
+
return (await import("./profile-commands-548ts402.js")).runConfigCommand(...args);
|
|
1884
1882
|
}
|
|
1885
1883
|
async function runProfilesCommand(...args) {
|
|
1886
|
-
return (await import("./profile-commands-
|
|
1884
|
+
return (await import("./profile-commands-548ts402.js")).runProfilesCommand(...args);
|
|
1887
1885
|
}
|
|
1888
1886
|
async function runAgentCommand(...args) {
|
|
1889
|
-
return (await import("./agent-
|
|
1887
|
+
return (await import("./agent-f8a1kejk.js")).runAgentCommand(...args);
|
|
1890
1888
|
}
|
|
1891
1889
|
async function runProductionCommand(...args) {
|
|
1892
|
-
return (await import("./production-intelligence-
|
|
1890
|
+
return (await import("./production-intelligence-fwjh572m.js")).runProductionCommand(...args);
|
|
1893
1891
|
}
|
|
1894
1892
|
function parseArgs(argv) {
|
|
1895
1893
|
const args = argv.slice(2);
|
|
@@ -2945,14 +2943,20 @@ async function searchFallbackToTraces(params) {
|
|
|
2945
2943
|
function capProblemsBlocks(data, limit) {
|
|
2946
2944
|
const truncated = {};
|
|
2947
2945
|
const payload = { ...data };
|
|
2948
|
-
if (Array.isArray(data.emerging)
|
|
2949
|
-
|
|
2950
|
-
|
|
2946
|
+
if (Array.isArray(data.emerging)) {
|
|
2947
|
+
const total = Math.max(asNumber(data.emerging_total) ?? 0, data.emerging.length);
|
|
2948
|
+
if (total > limit)
|
|
2949
|
+
truncated.emerging = total - Math.min(limit, data.emerging.length);
|
|
2950
|
+
if (data.emerging.length > limit)
|
|
2951
|
+
payload.emerging = data.emerging.slice(0, limit);
|
|
2951
2952
|
}
|
|
2952
2953
|
const hierarchy = asRecord(data.hierarchy);
|
|
2953
|
-
if (hierarchy && Array.isArray(hierarchy.macros)
|
|
2954
|
-
|
|
2955
|
-
|
|
2954
|
+
if (hierarchy && Array.isArray(hierarchy.macros)) {
|
|
2955
|
+
const total = Math.max(asNumber(hierarchy.macro_total) ?? 0, hierarchy.macros.length);
|
|
2956
|
+
if (total > limit)
|
|
2957
|
+
truncated.hierarchy_macros = total - Math.min(limit, hierarchy.macros.length);
|
|
2958
|
+
if (hierarchy.macros.length > limit)
|
|
2959
|
+
payload.hierarchy = { ...hierarchy, macros: hierarchy.macros.slice(0, limit) };
|
|
2956
2960
|
}
|
|
2957
2961
|
return Object.keys(truncated).length > 0 ? { payload, truncated } : { payload };
|
|
2958
2962
|
}
|
|
@@ -3789,9 +3793,11 @@ async function runCommand(command, positional, flags, positionals = positional ?
|
|
|
3789
3793
|
if (params.conversation_id)
|
|
3790
3794
|
query2.set("conversation_id", params.conversation_id);
|
|
3791
3795
|
query2.set("family", "frustration");
|
|
3792
|
-
const data = frustrationsFromEmotions(await callDataAPI(`/emotions?${query2.toString()}`));
|
|
3793
3796
|
const includeWindow = params.include_window === true;
|
|
3794
3797
|
const agentMode = context.output.mode === "agent" || context.output.mode === "agent-stream";
|
|
3798
|
+
if (agentMode && !includeWindow)
|
|
3799
|
+
query2.set("include_context", "0");
|
|
3800
|
+
const data = frustrationsFromEmotions(await callDataAPI(`/emotions?${query2.toString()}`));
|
|
3795
3801
|
const anchored = withFrustrationAnchors(data);
|
|
3796
3802
|
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);
|
|
3797
3803
|
break;
|
|
@@ -3829,6 +3835,8 @@ async function runCommand(command, positional, flags, positionals = positional ?
|
|
|
3829
3835
|
query2.set("limit", (params.limit ?? TOOL_FAILURE_DETAIL_DEFAULT_LIMIT).toString());
|
|
3830
3836
|
if (params.offset !== undefined)
|
|
3831
3837
|
query2.set("offset", params.offset.toString());
|
|
3838
|
+
if (dropConversation)
|
|
3839
|
+
query2.set("include_context", "0");
|
|
3832
3840
|
const queryString = query2.toString() ? `?${query2.toString()}` : "";
|
|
3833
3841
|
const data = await callDataAPI(`/tool-failures/${encodeURIComponent(params.tool_name)}${queryString}`);
|
|
3834
3842
|
const tfRecord = asRecord(data) ?? {};
|
|
@@ -4304,10 +4312,12 @@ async function runCommand(command, positional, flags, positionals = positional ?
|
|
|
4304
4312
|
query2.set("user_id", params.user_id);
|
|
4305
4313
|
if (params.conversation_id)
|
|
4306
4314
|
query2.set("conversation_id", params.conversation_id);
|
|
4315
|
+
const agentMode = context.output.mode === "agent" || context.output.mode === "agent-stream";
|
|
4316
|
+
if (agentMode && params.include_window !== true)
|
|
4317
|
+
query2.set("include_context", "0");
|
|
4307
4318
|
const queryString = query2.toString() ? `?${query2.toString()}` : "";
|
|
4308
4319
|
const raw = await callDataAPI(`/emotions${queryString}`);
|
|
4309
4320
|
const processingWarnings = processingDisabledWarning(raw, "emotion");
|
|
4310
|
-
const agentMode = context.output.mode === "agent" || context.output.mode === "agent-stream";
|
|
4311
4321
|
const record = asRecord(raw);
|
|
4312
4322
|
const data = agentMode && params.include_window !== true && record ? withoutDetectionWindows(record, "detections", "conversation_context") : raw;
|
|
4313
4323
|
context.output.writeData(data, processingWarnings.length > 0 ? { warnings: processingWarnings } : undefined);
|
|
@@ -4535,7 +4545,7 @@ var commandRegistry = createCommandRegistry([
|
|
|
4535
4545
|
resetApiRequestCountBeforeRun: true,
|
|
4536
4546
|
telemetry: "result-and-error",
|
|
4537
4547
|
handler: async (context) => {
|
|
4538
|
-
const { runInit } = await import("./index-
|
|
4548
|
+
const { runInit } = await import("./index-nsaph4as.js");
|
|
4539
4549
|
if (context.outputMode === "agent-stream") {
|
|
4540
4550
|
context.output.writeEvent({
|
|
4541
4551
|
event: "started",
|
|
@@ -4585,7 +4595,7 @@ var commandRegistry = createCommandRegistry([
|
|
|
4585
4595
|
resetApiRequestCountBeforeRun: true,
|
|
4586
4596
|
telemetry: "result-and-error",
|
|
4587
4597
|
handler: async (context) => {
|
|
4588
|
-
const { runProvision } = await import("./provision-
|
|
4598
|
+
const { runProvision } = await import("./provision-r9fhrvpw.js");
|
|
4589
4599
|
return runProvision(context, {
|
|
4590
4600
|
resumeCommand: buildResumeCommand("provision", context.rawFlags)
|
|
4591
4601
|
});
|
|
@@ -3,17 +3,16 @@ import {
|
|
|
3
3
|
promptsDiscoveredCheck,
|
|
4
4
|
runDoctorCommand,
|
|
5
5
|
runStatusCommand
|
|
6
|
-
} from "./cli-
|
|
7
|
-
import"./cli-
|
|
8
|
-
import"./cli-
|
|
6
|
+
} from "./cli-z3g07t65.js";
|
|
7
|
+
import"./cli-9g8vz4sv.js";
|
|
8
|
+
import"./cli-s6tw1fje.js";
|
|
9
9
|
import"./cli-mm48br00.js";
|
|
10
|
-
import"./cli-
|
|
10
|
+
import"./cli-4f6jkrnm.js";
|
|
11
11
|
import"./cli-97fnztpy.js";
|
|
12
|
-
import"./cli-
|
|
13
|
-
import"./cli-
|
|
14
|
-
import"./cli-
|
|
15
|
-
import"./cli-
|
|
16
|
-
import"./cli-5ke3xe6y.js";
|
|
12
|
+
import"./cli-2cggp8ww.js";
|
|
13
|
+
import"./cli-cv3jt1ms.js";
|
|
14
|
+
import"./cli-wkmdw40s.js";
|
|
15
|
+
import"./cli-t3a6eknn.js";
|
|
17
16
|
import"./cli-0v6na3yp.js";
|
|
18
17
|
export {
|
|
19
18
|
runStatusCommand,
|
|
@@ -2,18 +2,17 @@ import {
|
|
|
2
2
|
DEFAULT_POLL_INTERVAL_MS,
|
|
3
3
|
DEFAULT_WAIT_TIMEOUT_MS,
|
|
4
4
|
fetchLatestRun
|
|
5
|
-
} from "./cli-
|
|
5
|
+
} from "./cli-s6tw1fje.js";
|
|
6
6
|
import"./cli-mm48br00.js";
|
|
7
|
-
import"./cli-
|
|
7
|
+
import"./cli-4f6jkrnm.js";
|
|
8
8
|
import"./cli-97fnztpy.js";
|
|
9
|
-
import"./cli-
|
|
9
|
+
import"./cli-2cggp8ww.js";
|
|
10
10
|
import {
|
|
11
11
|
assertFlags
|
|
12
|
-
} from "./cli-
|
|
12
|
+
} from "./cli-cv3jt1ms.js";
|
|
13
13
|
import {
|
|
14
14
|
callControlAPI
|
|
15
|
-
} from "./cli-
|
|
16
|
-
import"./cli-7ea02wca.js";
|
|
15
|
+
} from "./cli-wkmdw40s.js";
|
|
17
16
|
import {
|
|
18
17
|
CliInputError,
|
|
19
18
|
EXIT_DEGRADED,
|
|
@@ -22,7 +21,7 @@ import {
|
|
|
22
21
|
getModaPaths,
|
|
23
22
|
resolveApiTenantId,
|
|
24
23
|
validateConfig
|
|
25
|
-
} from "./cli-
|
|
24
|
+
} from "./cli-t3a6eknn.js";
|
|
26
25
|
import"./cli-0v6na3yp.js";
|
|
27
26
|
|
|
28
27
|
// src/fix.ts
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
buildSourceSnapshot
|
|
3
|
-
} from "./cli-
|
|
3
|
+
} from "./cli-4f6jkrnm.js";
|
|
4
4
|
import"./cli-97fnztpy.js";
|
|
5
|
-
import"./cli-
|
|
6
|
-
import"./cli-
|
|
7
|
-
import"./cli-
|
|
8
|
-
import"./cli-7ea02wca.js";
|
|
5
|
+
import"./cli-2cggp8ww.js";
|
|
6
|
+
import"./cli-cv3jt1ms.js";
|
|
7
|
+
import"./cli-wkmdw40s.js";
|
|
9
8
|
import {
|
|
10
9
|
recordApiRequest
|
|
11
|
-
} from "./cli-
|
|
10
|
+
} from "./cli-t3a6eknn.js";
|
|
12
11
|
import"./cli-0v6na3yp.js";
|
|
13
12
|
|
|
14
13
|
// src/harness-github-actions.ts
|
|
@@ -42,13 +42,12 @@ import {
|
|
|
42
42
|
writeHarnessAnalyzeResult,
|
|
43
43
|
writeHarnessArtifacts,
|
|
44
44
|
writeHumanProgress
|
|
45
|
-
} from "./cli-
|
|
45
|
+
} from "./cli-4f6jkrnm.js";
|
|
46
46
|
import"./cli-97fnztpy.js";
|
|
47
|
-
import"./cli-
|
|
48
|
-
import"./cli-
|
|
49
|
-
import"./cli-
|
|
50
|
-
import"./cli-
|
|
51
|
-
import"./cli-5ke3xe6y.js";
|
|
47
|
+
import"./cli-2cggp8ww.js";
|
|
48
|
+
import"./cli-cv3jt1ms.js";
|
|
49
|
+
import"./cli-wkmdw40s.js";
|
|
50
|
+
import"./cli-t3a6eknn.js";
|
|
52
51
|
import"./cli-0v6na3yp.js";
|
|
53
52
|
export {
|
|
54
53
|
writeHumanProgress,
|
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
import {
|
|
2
2
|
selectTenantAndCreateKey
|
|
3
|
-
} from "./cli-
|
|
3
|
+
} from "./cli-d2zews6c.js";
|
|
4
|
+
import"./cli-4yarp5s1.js";
|
|
4
5
|
import {
|
|
5
6
|
buildDoctorReport
|
|
6
|
-
} from "./cli-
|
|
7
|
+
} from "./cli-z3g07t65.js";
|
|
7
8
|
import {
|
|
8
9
|
ConnectCodeError,
|
|
9
10
|
connectWithCode,
|
|
10
11
|
loadAuthSession,
|
|
11
12
|
loadToken,
|
|
12
13
|
login
|
|
13
|
-
} from "./cli-
|
|
14
|
+
} from "./cli-9g8vz4sv.js";
|
|
14
15
|
import {
|
|
15
16
|
initPrompts,
|
|
16
17
|
runPromptSync
|
|
17
|
-
} from "./cli-
|
|
18
|
+
} from "./cli-s6tw1fje.js";
|
|
18
19
|
import"./cli-mm48br00.js";
|
|
19
20
|
import {
|
|
20
21
|
canonicalText,
|
|
@@ -34,7 +35,7 @@ import {
|
|
|
34
35
|
runCodingAgent,
|
|
35
36
|
runHarnessCommand,
|
|
36
37
|
startRemoteAnalyze
|
|
37
|
-
} from "./cli-
|
|
38
|
+
} from "./cli-4f6jkrnm.js";
|
|
38
39
|
import {
|
|
39
40
|
stripAnsi
|
|
40
41
|
} from "./cli-97fnztpy.js";
|
|
@@ -46,13 +47,12 @@ import {
|
|
|
46
47
|
import {
|
|
47
48
|
agentsMdProblem,
|
|
48
49
|
runSkillSync
|
|
49
|
-
} from "./cli-
|
|
50
|
+
} from "./cli-54zhv6cx.js";
|
|
50
51
|
import {
|
|
51
52
|
createCommandContext
|
|
52
|
-
} from "./cli-
|
|
53
|
-
import"./cli-
|
|
54
|
-
import"./cli-
|
|
55
|
-
import"./cli-7ea02wca.js";
|
|
53
|
+
} from "./cli-2cggp8ww.js";
|
|
54
|
+
import"./cli-cv3jt1ms.js";
|
|
55
|
+
import"./cli-wkmdw40s.js";
|
|
56
56
|
import {
|
|
57
57
|
CliAuthError,
|
|
58
58
|
CliInputError,
|
|
@@ -60,7 +60,7 @@ import {
|
|
|
60
60
|
recordApiRequest,
|
|
61
61
|
resolveIngestUrl,
|
|
62
62
|
resolveModaBaseUrl
|
|
63
|
-
} from "./cli-
|
|
63
|
+
} from "./cli-t3a6eknn.js";
|
|
64
64
|
import {
|
|
65
65
|
detectAgents,
|
|
66
66
|
installRules,
|
|
@@ -10,15 +10,13 @@ import {
|
|
|
10
10
|
import {
|
|
11
11
|
callControlAPI,
|
|
12
12
|
callDataAPI
|
|
13
|
-
} from "./cli-
|
|
14
|
-
import {
|
|
15
|
-
apiKeyHeaders
|
|
16
|
-
} from "./cli-7ea02wca.js";
|
|
13
|
+
} from "./cli-wkmdw40s.js";
|
|
17
14
|
import {
|
|
18
15
|
CliAuthError,
|
|
19
16
|
CliInputError,
|
|
20
17
|
EXIT_DEGRADED,
|
|
21
18
|
EXIT_OK,
|
|
19
|
+
apiKeyHeaders,
|
|
22
20
|
asNumber,
|
|
23
21
|
asRecord,
|
|
24
22
|
asString,
|
|
@@ -30,7 +28,7 @@ import {
|
|
|
30
28
|
resolveModaBaseUrl,
|
|
31
29
|
safeWriteStderr,
|
|
32
30
|
shellWord
|
|
33
|
-
} from "./cli-
|
|
31
|
+
} from "./cli-t3a6eknn.js";
|
|
34
32
|
import"./cli-0v6na3yp.js";
|
|
35
33
|
|
|
36
34
|
// src/production-intelligence.ts
|
|
@@ -509,7 +507,7 @@ async function investigateProduction(options) {
|
|
|
509
507
|
const hints = loadHarnessHints(options.cwd);
|
|
510
508
|
const overviewEndpoint = `/overview?days_back=${options.daysBack}`;
|
|
511
509
|
const toolEndpoint = options.toolName ? `/tool-failures/${encodeURIComponent(options.toolName)}?days_back=${options.daysBack}&limit=5` : `/tool-failures?days_back=${options.daysBack}`;
|
|
512
|
-
const frustrationsEndpoint =
|
|
510
|
+
const frustrationsEndpoint = `${investigateFrustrationsEndpoint(options.daysBack)}${options.conversationId ? `&conversation_id=${encodeURIComponent(options.conversationId)}` : ""}`;
|
|
513
511
|
const problemsEndpoint = `/problems?days_back=${options.daysBack}&limit=${INVESTIGATION_PROBLEM_LIMIT}`;
|
|
514
512
|
const skipped = { data: null, status: "ok" };
|
|
515
513
|
const [overview, tools, frustrations, problems] = await Promise.all([
|
|
@@ -854,6 +852,9 @@ function toolFailureFindings(data, daysBack, hints, evidenceRefs, scopedTool) {
|
|
|
854
852
|
}];
|
|
855
853
|
});
|
|
856
854
|
}
|
|
855
|
+
function investigateFrustrationsEndpoint(daysBack) {
|
|
856
|
+
return `/emotions?family=frustration&days_back=${daysBack}&limit=1&include_context=0`;
|
|
857
|
+
}
|
|
857
858
|
function frustrationFindings(data, daysBack, evidenceRefs) {
|
|
858
859
|
data = frustrationsFromEmotions(asRecord(data) ?? {});
|
|
859
860
|
const summary = asRecord(valueAt(data, ["summary"]));
|
|
@@ -871,7 +872,7 @@ function frustrationFindings(data, daysBack, evidenceRefs) {
|
|
|
871
872
|
id: evidenceId,
|
|
872
873
|
kind: "frustration",
|
|
873
874
|
label: quote ? `Frustration anchor: "${quote}"` : `${count} frustrated trace(s)`,
|
|
874
|
-
endpoint:
|
|
875
|
+
endpoint: investigateFrustrationsEndpoint(daysBack),
|
|
875
876
|
...conversationId ? { conversationId } : {},
|
|
876
877
|
value: first ?? summary ?? data
|
|
877
878
|
});
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
import {
|
|
2
|
+
probeApiKey,
|
|
3
|
+
redactApiKey,
|
|
4
|
+
resolveApiKeyCredential
|
|
5
|
+
} from "./cli-4yarp5s1.js";
|
|
1
6
|
import {
|
|
2
7
|
authFetch,
|
|
3
8
|
clearAuthSession,
|
|
@@ -5,10 +10,7 @@ import {
|
|
|
5
10
|
loadAuthSession,
|
|
6
11
|
login,
|
|
7
12
|
revokeCliSessionToken
|
|
8
|
-
} from "./cli-
|
|
9
|
-
import {
|
|
10
|
-
apiKeyHeaders
|
|
11
|
-
} from "./cli-7ea02wca.js";
|
|
13
|
+
} from "./cli-9g8vz4sv.js";
|
|
12
14
|
import {
|
|
13
15
|
CliInputError,
|
|
14
16
|
DEFAULT_INGEST_URL,
|
|
@@ -23,7 +25,6 @@ import {
|
|
|
23
25
|
getActiveProfile,
|
|
24
26
|
getModaPaths,
|
|
25
27
|
loadProfileConfig,
|
|
26
|
-
recordApiRequest,
|
|
27
28
|
resolveApiKey,
|
|
28
29
|
resolveApiKeyFromActiveProfile,
|
|
29
30
|
resolveApiTenantId,
|
|
@@ -34,51 +35,9 @@ import {
|
|
|
34
35
|
secretFilePathFromRef,
|
|
35
36
|
setActiveProfile,
|
|
36
37
|
upsertProfile
|
|
37
|
-
} from "./cli-
|
|
38
|
+
} from "./cli-t3a6eknn.js";
|
|
38
39
|
import"./cli-0v6na3yp.js";
|
|
39
40
|
|
|
40
|
-
// src/api-key-auth.ts
|
|
41
|
-
var PROBE_TIMEOUT_MS = 1e4;
|
|
42
|
-
function resolveApiKeyCredential(options = {}) {
|
|
43
|
-
const key = resolveApiKey(options);
|
|
44
|
-
if (!key)
|
|
45
|
-
return;
|
|
46
|
-
const env = options.env ?? process.env;
|
|
47
|
-
const source = env.MODA_API_KEY === key ? "env" : resolveApiKeyFromActiveProfile(options) === key ? "profile" : "config";
|
|
48
|
-
return { key, source, tenantId: embeddedTenantIdFromApiKey(key) };
|
|
49
|
-
}
|
|
50
|
-
function redactApiKey(key) {
|
|
51
|
-
if (key.length <= 12)
|
|
52
|
-
return "<redacted>";
|
|
53
|
-
return `${key.slice(0, 8)}...${key.slice(-4)}`;
|
|
54
|
-
}
|
|
55
|
-
async function probeApiKey(key, options = {}) {
|
|
56
|
-
let response;
|
|
57
|
-
try {
|
|
58
|
-
recordApiRequest();
|
|
59
|
-
response = await fetch(`${resolveModaBaseUrl(options)}/api/v1/data/overview`, {
|
|
60
|
-
method: "GET",
|
|
61
|
-
headers: apiKeyHeaders(key, options),
|
|
62
|
-
signal: AbortSignal.timeout(PROBE_TIMEOUT_MS)
|
|
63
|
-
});
|
|
64
|
-
} catch (error) {
|
|
65
|
-
const reason = error instanceof Error ? error.message : String(error);
|
|
66
|
-
return { outcome: "unreachable", reason };
|
|
67
|
-
}
|
|
68
|
-
if (response.status === 401 || response.status === 403) {
|
|
69
|
-
return { outcome: "rejected", status: response.status };
|
|
70
|
-
}
|
|
71
|
-
if (response.status !== 200) {
|
|
72
|
-
return { outcome: "unreachable", reason: `HTTP ${response.status}` };
|
|
73
|
-
}
|
|
74
|
-
try {
|
|
75
|
-
await response.json();
|
|
76
|
-
} catch {
|
|
77
|
-
return { outcome: "unreachable", reason: "non-JSON response from the Data API" };
|
|
78
|
-
}
|
|
79
|
-
return { outcome: "live" };
|
|
80
|
-
}
|
|
81
|
-
|
|
82
41
|
// src/profile-commands.ts
|
|
83
42
|
var ONLINE_PROBE_TIMEOUT_MS = 5000;
|
|
84
43
|
function subcommand(context) {
|
|
@@ -5,13 +5,12 @@ import {
|
|
|
5
5
|
inspectCodeSelectors,
|
|
6
6
|
inspectPythonSelectors,
|
|
7
7
|
safePromptEvidencePath
|
|
8
|
-
} from "./cli-
|
|
8
|
+
} from "./cli-4f6jkrnm.js";
|
|
9
9
|
import"./cli-97fnztpy.js";
|
|
10
|
-
import"./cli-
|
|
11
|
-
import"./cli-
|
|
12
|
-
import"./cli-
|
|
13
|
-
import"./cli-
|
|
14
|
-
import"./cli-5ke3xe6y.js";
|
|
10
|
+
import"./cli-2cggp8ww.js";
|
|
11
|
+
import"./cli-cv3jt1ms.js";
|
|
12
|
+
import"./cli-wkmdw40s.js";
|
|
13
|
+
import"./cli-t3a6eknn.js";
|
|
15
14
|
import {
|
|
16
15
|
__commonJS,
|
|
17
16
|
__toESM
|
|
@@ -11,17 +11,16 @@ import {
|
|
|
11
11
|
runPromptSync,
|
|
12
12
|
runPromptsCommand,
|
|
13
13
|
writePromptSyncProgress
|
|
14
|
-
} from "./cli-
|
|
14
|
+
} from "./cli-s6tw1fje.js";
|
|
15
15
|
import {
|
|
16
16
|
promptSourceHashPayload
|
|
17
17
|
} from "./cli-mm48br00.js";
|
|
18
|
-
import"./cli-
|
|
18
|
+
import"./cli-4f6jkrnm.js";
|
|
19
19
|
import"./cli-97fnztpy.js";
|
|
20
|
-
import"./cli-
|
|
21
|
-
import"./cli-
|
|
22
|
-
import"./cli-
|
|
23
|
-
import"./cli-
|
|
24
|
-
import"./cli-5ke3xe6y.js";
|
|
20
|
+
import"./cli-2cggp8ww.js";
|
|
21
|
+
import"./cli-cv3jt1ms.js";
|
|
22
|
+
import"./cli-wkmdw40s.js";
|
|
23
|
+
import"./cli-t3a6eknn.js";
|
|
25
24
|
import"./cli-0v6na3yp.js";
|
|
26
25
|
export {
|
|
27
26
|
writePromptSyncProgress,
|
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
import {
|
|
2
2
|
selectTenantAndCreateKey
|
|
3
|
-
} from "./cli-
|
|
3
|
+
} from "./cli-d2zews6c.js";
|
|
4
|
+
import"./cli-4yarp5s1.js";
|
|
4
5
|
import {
|
|
5
6
|
loadAuthSession
|
|
6
|
-
} from "./cli-
|
|
7
|
+
} from "./cli-9g8vz4sv.js";
|
|
7
8
|
import {
|
|
8
9
|
stringOption
|
|
9
|
-
} from "./cli-
|
|
10
|
+
} from "./cli-2cggp8ww.js";
|
|
10
11
|
import {
|
|
11
12
|
CliAuthError,
|
|
12
13
|
resolveIngestUrl,
|
|
13
14
|
resolveModaBaseUrl
|
|
14
|
-
} from "./cli-
|
|
15
|
+
} from "./cli-t3a6eknn.js";
|
|
15
16
|
import"./cli-0v6na3yp.js";
|
|
16
17
|
|
|
17
18
|
// src/provision.ts
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
assertFlags
|
|
3
|
-
} from "./cli-
|
|
3
|
+
} from "./cli-cv3jt1ms.js";
|
|
4
4
|
import {
|
|
5
5
|
callControlAPI
|
|
6
|
-
} from "./cli-
|
|
7
|
-
import"./cli-7ea02wca.js";
|
|
6
|
+
} from "./cli-wkmdw40s.js";
|
|
8
7
|
import {
|
|
9
8
|
CliInputError,
|
|
10
9
|
explicitOutputMode,
|
|
11
10
|
resolveApiKey
|
|
12
|
-
} from "./cli-
|
|
11
|
+
} from "./cli-t3a6eknn.js";
|
|
13
12
|
import"./cli-0v6na3yp.js";
|
|
14
13
|
|
|
15
14
|
// src/registry.ts
|
|
@@ -3,12 +3,11 @@ import {
|
|
|
3
3
|
pullSkills,
|
|
4
4
|
runSkillSync,
|
|
5
5
|
runSkillsCommand
|
|
6
|
-
} from "./cli-
|
|
7
|
-
import"./cli-
|
|
8
|
-
import"./cli-
|
|
9
|
-
import"./cli-
|
|
10
|
-
import"./cli-
|
|
11
|
-
import"./cli-5ke3xe6y.js";
|
|
6
|
+
} from "./cli-54zhv6cx.js";
|
|
7
|
+
import"./cli-2cggp8ww.js";
|
|
8
|
+
import"./cli-cv3jt1ms.js";
|
|
9
|
+
import"./cli-wkmdw40s.js";
|
|
10
|
+
import"./cli-t3a6eknn.js";
|
|
12
11
|
import"./cli-8dtnwp9r.js";
|
|
13
12
|
import"./cli-0v6na3yp.js";
|
|
14
13
|
export {
|
|
@@ -1,21 +1,20 @@
|
|
|
1
1
|
import {
|
|
2
2
|
runPromptsCommand
|
|
3
|
-
} from "./cli-
|
|
3
|
+
} from "./cli-s6tw1fje.js";
|
|
4
4
|
import"./cli-mm48br00.js";
|
|
5
5
|
import {
|
|
6
6
|
runHarnessCommand
|
|
7
|
-
} from "./cli-
|
|
7
|
+
} from "./cli-4f6jkrnm.js";
|
|
8
8
|
import"./cli-97fnztpy.js";
|
|
9
9
|
import {
|
|
10
10
|
runSkillsCommand
|
|
11
|
-
} from "./cli-
|
|
12
|
-
import"./cli-
|
|
13
|
-
import"./cli-
|
|
14
|
-
import"./cli-
|
|
15
|
-
import"./cli-7ea02wca.js";
|
|
11
|
+
} from "./cli-54zhv6cx.js";
|
|
12
|
+
import"./cli-2cggp8ww.js";
|
|
13
|
+
import"./cli-cv3jt1ms.js";
|
|
14
|
+
import"./cli-wkmdw40s.js";
|
|
16
15
|
import {
|
|
17
16
|
CliInputError
|
|
18
|
-
} from "./cli-
|
|
17
|
+
} from "./cli-t3a6eknn.js";
|
|
19
18
|
import"./cli-8dtnwp9r.js";
|
|
20
19
|
import"./cli-0v6na3yp.js";
|
|
21
20
|
|
package/package.json
CHANGED
package/dist/cli-7ea02wca.js
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
resolveTenantId
|
|
3
|
-
} from "./cli-5ke3xe6y.js";
|
|
4
|
-
|
|
5
|
-
// src/api-key-headers.ts
|
|
6
|
-
var PLATFORM_API_KEY_PREFIX = "moda_pk_";
|
|
7
|
-
var TENANT_HEADER = "x-moda-tenant-id";
|
|
8
|
-
function isPlatformApiKey(key) {
|
|
9
|
-
return Boolean(key?.startsWith(PLATFORM_API_KEY_PREFIX));
|
|
10
|
-
}
|
|
11
|
-
var platformTenantOverride;
|
|
12
|
-
function setPlatformTenantOverride(tenantId) {
|
|
13
|
-
platformTenantOverride = tenantId;
|
|
14
|
-
}
|
|
15
|
-
var TENANT_PATH = /\/tenants\/([^/?#]+)/;
|
|
16
|
-
function tenantFromUrl(url) {
|
|
17
|
-
const match = url ? TENANT_PATH.exec(url) : null;
|
|
18
|
-
return match ? decodeURIComponent(match[1]) : undefined;
|
|
19
|
-
}
|
|
20
|
-
function apiKeyHeaders(key, options = {}, url) {
|
|
21
|
-
const headers = { "x-api-key": key };
|
|
22
|
-
if (isPlatformApiKey(key)) {
|
|
23
|
-
const tenantId = tenantFromUrl(url) || platformTenantOverride || resolveTenantId(options);
|
|
24
|
-
if (tenantId)
|
|
25
|
-
headers[TENANT_HEADER] = tenantId;
|
|
26
|
-
}
|
|
27
|
-
return headers;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export { isPlatformApiKey, setPlatformTenantOverride, apiKeyHeaders };
|