prismalens 0.1.1 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +68 -20
- package/dist/bin/prismalens.js +24 -10
- package/dist/bin/prismalens.js.map +1 -1
- package/dist/src/cli/auth.d.ts +3 -0
- package/dist/src/cli/auth.d.ts.map +1 -0
- package/dist/src/cli/auth.js +108 -0
- package/dist/src/cli/auth.js.map +1 -0
- package/dist/src/cli/doctor.d.ts +1 -0
- package/dist/src/cli/doctor.d.ts.map +1 -1
- package/dist/src/cli/doctor.js +3 -3
- package/dist/src/cli/doctor.js.map +1 -1
- package/dist/src/cli/flags.d.ts.map +1 -1
- package/dist/src/cli/flags.js +7 -0
- package/dist/src/cli/flags.js.map +1 -1
- package/dist/src/cli/init.d.ts.map +1 -1
- package/dist/src/cli/init.js +7 -6
- package/dist/src/cli/init.js.map +1 -1
- package/dist/src/cli/investigate.d.ts.map +1 -1
- package/dist/src/cli/investigate.js +13 -12
- package/dist/src/cli/investigate.js.map +1 -1
- package/dist/src/cli/listen.d.ts +6 -0
- package/dist/src/cli/listen.d.ts.map +1 -1
- package/dist/src/cli/listen.js +13 -6
- package/dist/src/cli/listen.js.map +1 -1
- package/dist/src/cli/report.d.ts +7 -2
- package/dist/src/cli/report.d.ts.map +1 -1
- package/dist/src/cli/report.js +17 -4
- package/dist/src/cli/report.js.map +1 -1
- package/dist/src/cli/serve.js +1 -1
- package/dist/src/cli/serve.js.map +1 -1
- package/dist/src/cli/status.d.ts +7 -2
- package/dist/src/cli/status.d.ts.map +1 -1
- package/dist/src/cli/status.js +14 -4
- package/dist/src/cli/status.js.map +1 -1
- package/dist/src/config/loader.d.ts.map +1 -1
- package/dist/src/config/loader.js +24 -10
- package/dist/src/config/loader.js.map +1 -1
- package/dist/src/config/schema.d.ts +40 -32
- package/dist/src/config/schema.d.ts.map +1 -1
- package/dist/src/config/schema.js +25 -12
- package/dist/src/config/schema.js.map +1 -1
- package/dist/src/core/parse-stdin.d.ts.map +1 -1
- package/dist/src/core/parse-stdin.js +3 -12
- package/dist/src/core/parse-stdin.js.map +1 -1
- package/dist/src/core/run-investigation.js +10 -8
- package/dist/src/core/run-investigation.js.map +1 -1
- package/dist/src/core/session.js +3 -3
- package/dist/src/core/session.js.map +1 -1
- package/dist/src/http/server.d.ts +5 -0
- package/dist/src/http/server.d.ts.map +1 -1
- package/dist/src/http/server.js +14 -1
- package/dist/src/http/server.js.map +1 -1
- package/dist/src/jsonrpc/server.d.ts +29 -0
- package/dist/src/jsonrpc/server.d.ts.map +1 -1
- package/dist/src/jsonrpc/server.js +34 -11
- package/dist/src/jsonrpc/server.js.map +1 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@ published on npm as the unscoped [`prismalens`](https://www.npmjs.com/package/pr
|
|
|
5
5
|
|
|
6
6
|
Per **ADR-0010**, the engine *is* a CLI: the desktop app and web API drive it
|
|
7
7
|
rather than embedding it. The CLI is a thin **Tier-1 supervisor** that rents a
|
|
8
|
-
**Tier-2 agent harness** (ADR-0008) to do the
|
|
8
|
+
**Tier-2 agent harness** (ADR-0008) to do the investigative legwork, then reduces the
|
|
9
9
|
harness's canonical event stream into an **ordered-evidence report** (ADR-0002 —
|
|
10
10
|
hypotheses ranked most-to-least plausible, with supporting/contradicting
|
|
11
11
|
evidence; no numeric confidence scores).
|
|
@@ -18,8 +18,27 @@ evidence; no numeric confidence scores).
|
|
|
18
18
|
- `claude-code` — driven over the **Claude Agent SDK**,
|
|
19
19
|
- `codex` — **stubbed** (not implemented; selecting it throws).
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
## How the harness is contained
|
|
22
|
+
|
|
23
|
+
By default prismalens removes the harness's edit tools (`Edit`, `Write`,
|
|
24
|
+
`MultiEdit`, `NotebookEdit`). That is a **guardrail, not a security boundary**
|
|
25
|
+
(ADR-0017): the shell is untouched, so writes remain possible via `Bash`. It is
|
|
26
|
+
there to stop a *helpful* agent from editing the repo it was asked to investigate
|
|
27
|
+
— it will not stop a determined one.
|
|
28
|
+
|
|
29
|
+
**Without a sandbox, the harness runs as you** — your machine, your credentials,
|
|
30
|
+
your shell — exactly as if you had invoked the agent CLI yourself. prismalens
|
|
31
|
+
makes no safety claim in this mode, and none of the above should be read as one.
|
|
32
|
+
|
|
33
|
+
The **only** real boundary is an enforced sandbox (`--sandbox srt` or `e2b`,
|
|
34
|
+
ADR-0020): an OS-level box in which your host and credentials are read-only, the
|
|
35
|
+
harness gets a read-write **workspace**, and network egress is **allowlisted**.
|
|
36
|
+
Note that this is *confined writes*, not "read-only" — an investigation has to be
|
|
37
|
+
able to clone a repo and download artifacts. `--sandbox auto` is not yet an
|
|
38
|
+
enforced default; it can degrade to an unenforced floor.
|
|
39
|
+
|
|
40
|
+
Provider credentials are **BYO-key** (ADR-0006), resolved from the environment or
|
|
41
|
+
the local auth store — never hard-bound in the CLI.
|
|
23
42
|
|
|
24
43
|
Every run is persisted to a durable workspace under `~/.prismalens/runs/<runId>/`
|
|
25
44
|
(`events.jsonl` + `report.json` + `session.json`), regardless of how it was
|
|
@@ -83,6 +102,7 @@ prismalens <command> [flags] # alias: pl
|
|
|
83
102
|
serve Run the JSON-RPC 2.0 server over stdio (the LIVE channel for apps).
|
|
84
103
|
doctor Preflight-check the investigation environment.
|
|
85
104
|
init Scaffold a prismalens.config.yaml in the current directory.
|
|
105
|
+
auth Manage stored BYO-key credentials for providers.
|
|
86
106
|
```
|
|
87
107
|
|
|
88
108
|
### `investigate`
|
|
@@ -138,8 +158,11 @@ Preflight checklist that gates a run. Prints pass/fail per check; exits non-zero
|
|
|
138
158
|
`claude-code` → `claude`, `codex` → `codex` (for the harness from config).
|
|
139
159
|
- **HARD — an LLM credential:** any of `ANTHROPIC_API_KEY` / `OPENAI_API_KEY` /
|
|
140
160
|
`GOOGLE_API_KEY` / `OLLAMA_API_KEY` / `GROQ_API_KEY` / `CUSTOM_LLM_API_KEY`,
|
|
141
|
-
|
|
142
|
-
-
|
|
161
|
+
a credential stored via `pl auth login` (`auth.json`), or, for `claude-code`,
|
|
162
|
+
a signed-in `~/.claude/.credentials.json`. Doctor reports which layer supplied
|
|
163
|
+
the credential (`source: env | file | stored | none`). (Performs a live
|
|
164
|
+
provider model ping by default, while `--no-ping` skips it.)
|
|
165
|
+
- **SOFT — workspace writable:** `workspace.dir` can be created/written.
|
|
143
166
|
|
|
144
167
|
### `init`
|
|
145
168
|
|
|
@@ -210,7 +233,19 @@ stdout).
|
|
|
210
233
|
```
|
|
211
234
|
|
|
212
235
|
**`investigate`** — `params`: `{ alert?: FiringAlert, query?: string, repo?: string,
|
|
213
|
-
harness?: string, model?: string, config?: string
|
|
236
|
+
harness?: string, model?: string, config?: string, service?: string, mode?: string,
|
|
237
|
+
dangerouslySkipPermissions?: boolean, sandbox?: string, maxTurns?: number }`.
|
|
238
|
+
|
|
239
|
+
CLI-parity params (each falls back to config when absent):
|
|
240
|
+
|
|
241
|
+
- `sandbox` — the isolation boundary (ADR-0020), the CLI's `--sandbox`: one of
|
|
242
|
+
`auto` | `process` | `srt` | `e2b`. Absent ⇒ `agent.sandbox` from config. A
|
|
243
|
+
supplied value that is not a known mode (or a mode the resolved harness cannot
|
|
244
|
+
honour, e.g. `srt` on a non-ACP harness) is a `-32602` error — never a silent
|
|
245
|
+
fall-back to the cooperative floor.
|
|
246
|
+
- `maxTurns` — per-run turn ceiling, the CLI's `--max-turns`: a positive integer.
|
|
247
|
+
A supplied zero, negative, fractional, or non-numeric value is a `-32602` error —
|
|
248
|
+
never a silently-removed cap.
|
|
214
249
|
|
|
215
250
|
Streams a **notification per canonical event** (including the terminal `report`
|
|
216
251
|
event), then **resolves the request** with `{ runId, report }`:
|
|
@@ -240,7 +275,7 @@ concurrently and interleave their notifications — each notification carries it
|
|
|
240
275
|
| `-32700` | Parse error (invalid JSON on a line). |
|
|
241
276
|
| `-32600` | Invalid request (not a well-formed JSON-RPC 2.0 request). |
|
|
242
277
|
| `-32601` | Method not found. |
|
|
243
|
-
| `-32602` | Invalid params (includes `resolveInvestigation` input errors — e.g. no alert/query, unknown or unbuilt harness). |
|
|
278
|
+
| `-32602` | Invalid params (includes an invalid `sandbox` mode or `maxTurns` value, and `resolveInvestigation` input errors — e.g. no alert/query, unknown or unbuilt harness). |
|
|
244
279
|
| `-32603` | Internal error (mid-stream failure; `data` carries `{ runId }`). |
|
|
245
280
|
| `-32000` | No evidence — the harness branch failed and produced no report (`data` carries `{ runId }`). |
|
|
246
281
|
|
|
@@ -269,7 +304,8 @@ var is an error).
|
|
|
269
304
|
# Tier-2 harness backend the supervisor rents (ADR-0008).
|
|
270
305
|
agent:
|
|
271
306
|
default: deepagents # deepagents | claude-code | codex
|
|
272
|
-
# model:
|
|
307
|
+
# model: gpt-oss:120b # bare id — the harness applies its own provider
|
|
308
|
+
# prefix; omit to let the harness default
|
|
273
309
|
sandbox: auto # auto | process | srt — isolation boundary (ADR-0020).
|
|
274
310
|
# auto (default): srt (enforced OS boundary) WHEN its
|
|
275
311
|
# egress bridge is healthy (a self-check catches WSL
|
|
@@ -278,19 +314,19 @@ agent:
|
|
|
278
314
|
|
|
279
315
|
# Read-only telemetry + app endpoints the harness may query.
|
|
280
316
|
telemetry:
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
317
|
+
prometheus_url: http://localhost:9090
|
|
318
|
+
alertmanager_url: http://localhost:9093
|
|
319
|
+
api_url: http://localhost:3000
|
|
284
320
|
|
|
285
321
|
# Where runs, events, and reports are stored.
|
|
286
322
|
workspace:
|
|
287
|
-
|
|
323
|
+
dir: ~/.prismalens
|
|
288
324
|
|
|
289
325
|
# Per-harness native passthrough (ADR-0017) — untyped, forwarded straight to the
|
|
290
326
|
# rented harness. For `deepagents` (the npm `deepagents-acp` binary, driven over
|
|
291
327
|
# ACP), `args` is appended verbatim to the CLI invocation. The binary has no
|
|
292
|
-
# shell-allowlist or sandbox flags —
|
|
293
|
-
# port's enforced providers land (ADR-0020/B.1).
|
|
328
|
+
# shell-allowlist or sandbox flags — so the harness is unsandboxed (runs as you)
|
|
329
|
+
# until the Sandbox port's enforced providers land (ADR-0020/B.1).
|
|
294
330
|
harnesses:
|
|
295
331
|
deepagents:
|
|
296
332
|
native:
|
|
@@ -298,10 +334,13 @@ harnesses:
|
|
|
298
334
|
```
|
|
299
335
|
|
|
300
336
|
Notes:
|
|
301
|
-
- `agent.model`
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
- `
|
|
337
|
+
- `agent.model` sets the **Tier-2 harness** model only (a bare id, e.g. `gpt-oss:120b`;
|
|
338
|
+
each harness applies its own provider prefix). `--model` overrides it.
|
|
339
|
+
- `synth.model` sets the **Tier-1 reduce** (report-synthesis) model — a separate call
|
|
340
|
+
to a separate provider (ADR-0013/0016). `agent.model` never feeds it, so a harness on
|
|
341
|
+
one provider (e.g. `claude-code`) can't misroute the reduce call to another (ollama).
|
|
342
|
+
- `telemetry.*` keys are snake_case (`prometheus_url`, `alertmanager_url`, `api_url`)
|
|
343
|
+
and default to host-local URLs when unset.
|
|
305
344
|
- There is currently no `agent.timeout_ms`, `budget.*`, or `logging.*` config —
|
|
306
345
|
an overall per-run wall-clock budget and a Tier-1 reduce token/retry budget are
|
|
307
346
|
planned alongside the Phase B.1 Sandbox port's resource limits (ADR-0020), not
|
|
@@ -309,7 +348,16 @@ Notes:
|
|
|
309
348
|
|
|
310
349
|
### BYO-key environment (ADR-0006)
|
|
311
350
|
|
|
312
|
-
Credentials are read from the environment
|
|
351
|
+
Credentials are BYO-key and never hard-bound in the CLI. They can be read from the environment or stored locally via the `auth` command.
|
|
352
|
+
|
|
353
|
+
The resolution precedence for any credential is: **env** (`PROVIDER_API_KEY`) → **_FILE** (`PROVIDER_API_KEY_FILE`) → **stored** (from `auth.json`) → **none**.
|
|
354
|
+
|
|
355
|
+
**Auth commands:**
|
|
356
|
+
- `pl auth login <provider> [--api-key <key>]` — save a credential (prompts securely if `--api-key` is omitted).
|
|
357
|
+
- `pl auth list` — view saved providers.
|
|
358
|
+
- `pl auth logout <provider>` — remove a saved credential.
|
|
359
|
+
|
|
360
|
+
Stored credentials live in `auth.json` inside the app-data dir (`~/.prismalens` by default, honors `PRISMALENS_WORKSPACE_DIR`), enforced to mode `0600`.
|
|
313
361
|
|
|
314
362
|
- **Tier-1 reduce + the `deepagents` harness** use an OpenAI-compatible endpoint:
|
|
315
363
|
- `OLLAMA_API_KEY` or `OPENAI_API_KEY` (the API key),
|
|
@@ -318,5 +366,5 @@ Credentials are read from the environment, never stored by the CLI.
|
|
|
318
366
|
- **The `claude-code` harness** uses your signed-in `~/.claude` session, or
|
|
319
367
|
`ANTHROPIC_API_KEY`.
|
|
320
368
|
|
|
321
|
-
If no
|
|
369
|
+
If no matching credential is found across the resolution chain, the reduce (synthesis) call will
|
|
322
370
|
likely fail — `investigate` warns up front, and `doctor` checks for a credential.
|
package/dist/bin/prismalens.js
CHANGED
|
@@ -6,22 +6,22 @@
|
|
|
6
6
|
* app + API drive it). Command bodies live in ../src/cli/* and are loaded lazily so
|
|
7
7
|
* a fast `--help` doesn't pull in the engine. Bodies are implemented separately.
|
|
8
8
|
*/
|
|
9
|
-
import { defineCommand, runMain } from "citty";
|
|
9
|
+
import { defineCommand, runMain, showUsage } from "citty";
|
|
10
|
+
import consola from "consola";
|
|
10
11
|
import { cliVersion } from "../src/version.js";
|
|
11
12
|
// The AI SDK's one-time "AI SDK Warning System" banner prints via console.info
|
|
12
13
|
// (STDOUT) mid-run — noise in the live timeline and corruption in piped JSON.
|
|
13
14
|
// Off for the whole CLI; real per-warning notices still reach stderr via
|
|
14
15
|
// process.emitWarning.
|
|
15
16
|
globalThis.AI_SDK_LOG_WARNINGS = false;
|
|
16
|
-
const
|
|
17
|
-
process.
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
return;
|
|
22
|
-
for (const listener of originalWarningListeners) {
|
|
23
|
-
listener(warning);
|
|
17
|
+
const originalEmit = process.emit;
|
|
18
|
+
process.emit = ((name, ...args) => {
|
|
19
|
+
if (name === "warning" &&
|
|
20
|
+
args[0]?.name === "ExperimentalWarning" &&
|
|
21
|
+
args[0]?.message?.includes("SQLite")) {
|
|
22
|
+
return false;
|
|
24
23
|
}
|
|
24
|
+
return originalEmit.apply(process, [name, ...args]);
|
|
25
25
|
});
|
|
26
26
|
/** Lazily import a command body's default export from src/cli. */
|
|
27
27
|
const lazy = (name) => () => import(`../src/cli/${name}.js`).then((m) => m.default);
|
|
@@ -39,7 +39,21 @@ const main = defineCommand({
|
|
|
39
39
|
init: lazy("init"),
|
|
40
40
|
status: lazy("status"),
|
|
41
41
|
report: lazy("report"),
|
|
42
|
+
auth: lazy("auth"),
|
|
43
|
+
},
|
|
44
|
+
});
|
|
45
|
+
runMain(main, {
|
|
46
|
+
showUsage: async (cmd, parent) => {
|
|
47
|
+
const rawArgs = process.argv.slice(2);
|
|
48
|
+
if (rawArgs.includes("--help") ||
|
|
49
|
+
rawArgs.includes("-h") ||
|
|
50
|
+
rawArgs.length === 0) {
|
|
51
|
+
await showUsage(cmd, parent);
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
const cmdName = `pl${rawArgs[0] && !rawArgs[0].startsWith("-") ? ` ${rawArgs[0]}` : ""}`;
|
|
55
|
+
consola.info(`Run \`${cmdName} --help\` for usage.`);
|
|
56
|
+
}
|
|
42
57
|
},
|
|
43
58
|
});
|
|
44
|
-
runMain(main);
|
|
45
59
|
//# sourceMappingURL=prismalens.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prismalens.js","sourceRoot":"","sources":["../../bin/prismalens.ts"],"names":[],"mappings":";AACA,sCAAsC;AACtC,6BAA6B;AAE7B;;;;GAIG;AACH,OAAO,EAAmB,aAAa,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"prismalens.js","sourceRoot":"","sources":["../../bin/prismalens.ts"],"names":[],"mappings":";AACA,sCAAsC;AACtC,6BAA6B;AAE7B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AAM,EAAE,IAAI,CAAC,QAAQ,CAAC;QACtB,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC;QAClB,MAAM,EAAE,IAAI,CAAC,QAAQ,CAAC;QACtB,MAAM,EAAE,IAAI,CAAC,QAAQ,CAAC;QACtB,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC;KAClB;CACD,CAAC,CAAC;AAEH,OAAO,CAAC,IAAI,EAAE;IACb,SAAS,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,EAAE;QAChC,MAAM,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QACtC,IACC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC;YAC1B,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC;YACtB,OAAO,CAAC,MAAM,KAAK,CAAC,EACnB,CAAC;YACF,MAAM,SAAS,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;QAC9B,CAAC;aAAM,CAAC;YACP,MAAM,OAAO,GAAG,KAAK,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;YACzF,OAAO,CAAC,IAAI,CAAC,SAAS,OAAO,sBAAsB,CAAC,CAAC;QACtD,CAAC;IACF,CAAC;CACD,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../src/cli/auth.ts"],"names":[],"mappings":";AA+GA,wBAUG"}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
// Copyright 2026 Sumit Patel
|
|
3
|
+
import { removeStoredCredential, setStoredCredential, } from "@prismalens/config/auth";
|
|
4
|
+
import { resolveCredentials } from "@prismalens/config/credentials";
|
|
5
|
+
import { LLM_PROVIDERS } from "@prismalens/config/llm";
|
|
6
|
+
import { defineCommand } from "citty";
|
|
7
|
+
import consola from "consola";
|
|
8
|
+
const login = defineCommand({
|
|
9
|
+
meta: {
|
|
10
|
+
name: "login",
|
|
11
|
+
description: "Log in to a model provider",
|
|
12
|
+
},
|
|
13
|
+
args: {
|
|
14
|
+
provider: {
|
|
15
|
+
type: "positional",
|
|
16
|
+
description: "Provider ID (e.g. openai, anthropic)",
|
|
17
|
+
required: true,
|
|
18
|
+
},
|
|
19
|
+
"api-key": {
|
|
20
|
+
type: "string",
|
|
21
|
+
description: "API key",
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
async run({ args }) {
|
|
25
|
+
const provider = args.provider;
|
|
26
|
+
if (!Object.hasOwn(LLM_PROVIDERS, provider)) {
|
|
27
|
+
consola.error(`Unknown provider: ${provider}`);
|
|
28
|
+
process.exit(1);
|
|
29
|
+
}
|
|
30
|
+
let apiKey = args["api-key"];
|
|
31
|
+
if (!apiKey) {
|
|
32
|
+
if (process.stdin.isTTY) {
|
|
33
|
+
apiKey = (await consola.prompt(`Enter API key for ${LLM_PROVIDERS[provider].name}:`, {
|
|
34
|
+
// @ts-expect-error type password passes through to clack
|
|
35
|
+
type: "password",
|
|
36
|
+
}));
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
consola.error("--api-key is required in non-interactive mode");
|
|
40
|
+
process.exit(1);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
if (!apiKey || typeof apiKey !== "string" || !apiKey.trim()) {
|
|
44
|
+
consola.error("API key is required");
|
|
45
|
+
process.exit(1);
|
|
46
|
+
}
|
|
47
|
+
setStoredCredential(provider, apiKey.trim());
|
|
48
|
+
consola.success(`Saved credential for ${LLM_PROVIDERS[provider].name}`);
|
|
49
|
+
},
|
|
50
|
+
});
|
|
51
|
+
const list = defineCommand({
|
|
52
|
+
meta: {
|
|
53
|
+
name: "list",
|
|
54
|
+
description: "List configured providers",
|
|
55
|
+
},
|
|
56
|
+
async run() {
|
|
57
|
+
for (const provider of Object.values(LLM_PROVIDERS)) {
|
|
58
|
+
const creds = resolveCredentials(provider.id);
|
|
59
|
+
if (creds.source !== "none") {
|
|
60
|
+
const key = creds.apiKey ?? "";
|
|
61
|
+
const masked = key.length > 4 ? `...${key.slice(-4)}` : "<set>";
|
|
62
|
+
consola.log(`${provider.name} (${provider.id})`);
|
|
63
|
+
consola.log(` Source: ${creds.source}`);
|
|
64
|
+
consola.log(` Key: ${masked}`);
|
|
65
|
+
consola.log("");
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
consola.log(`${provider.name} (${provider.id})`);
|
|
69
|
+
consola.log(` Source: none`);
|
|
70
|
+
consola.log("");
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
});
|
|
75
|
+
const logout = defineCommand({
|
|
76
|
+
meta: {
|
|
77
|
+
name: "logout",
|
|
78
|
+
description: "Remove stored credential",
|
|
79
|
+
},
|
|
80
|
+
args: {
|
|
81
|
+
provider: {
|
|
82
|
+
type: "positional",
|
|
83
|
+
description: "Provider ID",
|
|
84
|
+
required: true,
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
async run({ args }) {
|
|
88
|
+
const provider = args.provider;
|
|
89
|
+
if (!Object.hasOwn(LLM_PROVIDERS, provider)) {
|
|
90
|
+
consola.error(`Unknown provider: ${provider}`);
|
|
91
|
+
process.exit(1);
|
|
92
|
+
}
|
|
93
|
+
removeStoredCredential(provider);
|
|
94
|
+
consola.success(`Removed stored credential for ${LLM_PROVIDERS[provider].name}`);
|
|
95
|
+
},
|
|
96
|
+
});
|
|
97
|
+
export default defineCommand({
|
|
98
|
+
meta: {
|
|
99
|
+
name: "auth",
|
|
100
|
+
description: "Manage provider credentials",
|
|
101
|
+
},
|
|
102
|
+
subCommands: {
|
|
103
|
+
login,
|
|
104
|
+
list,
|
|
105
|
+
logout,
|
|
106
|
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D,CAAC;IACH,CAAC;CACD,CAAC,CAAC;AAEH,eAAe,aAAa,CAAC;IAC5B,IAAI,EAAE;QACL,IAAI,EAAE,MAAM;QACZ,WAAW,EAAE,6BAA6B;KAC1C;IACD,WAAW,EAAE;QACZ,KAAK;QACL,IAAI;QACJ,MAAM;KACN;CACD,CAAC,CAAC"}
|
package/dist/src/cli/doctor.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ interface Check {
|
|
|
5
5
|
detail: string;
|
|
6
6
|
hard: boolean;
|
|
7
7
|
}
|
|
8
|
+
export declare function checkCredential(config: PlConfig, noPing: boolean): Promise<Check>;
|
|
8
9
|
export declare function checkListenToken(config: PlConfig): Check;
|
|
9
10
|
declare const _default: import("citty").CommandDef<{
|
|
10
11
|
readonly ping: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"doctor.d.ts","sourceRoot":"","sources":["../../../src/cli/doctor.ts"],"names":[],"mappings":"AAgCA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAMpD,UAAU,KAAK;IACd,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,OAAO,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,OAAO,CAAC;CACd;
|
|
1
|
+
{"version":3,"file":"doctor.d.ts","sourceRoot":"","sources":["../../../src/cli/doctor.ts"],"names":[],"mappings":"AAgCA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAMpD,UAAU,KAAK;IACd,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,OAAO,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,OAAO,CAAC;CACd;AAmCD,wBAAsB,eAAe,CACpC,MAAM,EAAE,QAAQ,EAChB,MAAM,EAAE,OAAO,GACb,OAAO,CAAC,KAAK,CAAC,CAiEhB;AAuBD,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,QAAQ,GAAG,KAAK,CAgBxD;;;;;;;;AAED,wBAoDG"}
|
package/dist/src/cli/doctor.js
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* - HARD: an LLM credential is present
|
|
11
11
|
* (any provider credential env var from LLM_PROVIDERS, or, for claude-code,
|
|
12
12
|
* a signed-in ~/.claude/.credentials.json)
|
|
13
|
-
* - SOFT: workspace.
|
|
13
|
+
* - SOFT: workspace.dir is writable
|
|
14
14
|
*
|
|
15
15
|
* Prints pass/fail per check; exits non-zero iff a HARD check fails. No tinyexec /
|
|
16
16
|
* check-tool helper here — availability is a dependency-free PATH scan.
|
|
@@ -59,7 +59,7 @@ function checkHarness(harness) {
|
|
|
59
59
|
hard: true,
|
|
60
60
|
};
|
|
61
61
|
}
|
|
62
|
-
async function checkCredential(config, noPing) {
|
|
62
|
+
export async function checkCredential(config, noPing) {
|
|
63
63
|
let providerId = config.synth.provider;
|
|
64
64
|
let creds;
|
|
65
65
|
if (providerId) {
|
|
@@ -118,7 +118,7 @@ async function checkCredential(config, noPing) {
|
|
|
118
118
|
}
|
|
119
119
|
}
|
|
120
120
|
async function checkWorkspace(config) {
|
|
121
|
-
const baseDir = resolveBaseDir(config.workspace.
|
|
121
|
+
const baseDir = resolveBaseDir(config.workspace.dir);
|
|
122
122
|
try {
|
|
123
123
|
await mkdir(baseDir, { recursive: true });
|
|
124
124
|
await access(baseDir, fsConstants.W_OK);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"doctor.js","sourceRoot":"","sources":["../../../src/cli/doctor.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,6BAA6B;AAE7B;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAAE,UAAU,EAAE,SAAS,IAAI,WAAW,EAAE,MAAM,SAAS,CAAC;AAC/D,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC5C,O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YACD,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;YAEhB,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;YAC7D,IAAI,YAAY,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBAC7B,OAAO,CAAC,KAAK,CACZ,GAAG,YAAY,CAAC,MAAM,iEAAiE,CACvF,CAAC;gBACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YACjB,CAAC;YACD,OAAO,CAAC,OAAO,CAAC,6BAA6B,CAAC,CAAC;QAChD,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACd,OAAO,CAAC,KAAK,CAAC,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;YAChE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACjB,CAAC;IACF,CAAC;CACD,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flags.d.ts","sourceRoot":"","sources":["../../../src/cli/flags.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"flags.d.ts","sourceRoot":"","sources":["../../../src/cli/flags.ts"],"names":[],"mappings":"AAaA,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,GAAG,EAAE,OAAO,QAuB3E"}
|
package/dist/src/cli/flags.js
CHANGED
|
@@ -4,6 +4,9 @@ import consola from "consola";
|
|
|
4
4
|
function kebabToCamel(str) {
|
|
5
5
|
return str.replace(/-([a-z])/g, (_, g) => g.toUpperCase());
|
|
6
6
|
}
|
|
7
|
+
function camelToKebab(str) {
|
|
8
|
+
return str.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
|
|
9
|
+
}
|
|
7
10
|
export function assertKnownFlags(args, cmd) {
|
|
8
11
|
const declaredArgs = cmd?.args || {};
|
|
9
12
|
const allowedKeys = new Set(["_"]);
|
|
@@ -11,12 +14,16 @@ export function assertKnownFlags(args, cmd) {
|
|
|
11
14
|
if (Object.hasOwn(declaredArgs, key)) {
|
|
12
15
|
allowedKeys.add(key);
|
|
13
16
|
allowedKeys.add(kebabToCamel(key));
|
|
17
|
+
allowedKeys.add(camelToKebab(key));
|
|
14
18
|
}
|
|
15
19
|
}
|
|
16
20
|
for (const key in args) {
|
|
17
21
|
if (Object.hasOwn(args, key)) {
|
|
18
22
|
if (!allowedKeys.has(key)) {
|
|
19
23
|
consola.error(`Unknown option: --${key}`);
|
|
24
|
+
const rawArgs = process.argv.slice(2);
|
|
25
|
+
const cmdName = `pl${rawArgs[0] && !rawArgs[0].startsWith("-") ? ` ${rawArgs[0]}` : ""}`;
|
|
26
|
+
consola.info(`Run \`${cmdName} --help\` for usage.`);
|
|
20
27
|
process.exit(1);
|
|
21
28
|
}
|
|
22
29
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flags.js","sourceRoot":"","sources":["../../../src/cli/flags.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,6BAA6B;AAE7B,OAAO,OAAO,MAAM,SAAS,CAAC;AAE9B,SAAS,YAAY,CAAC,GAAW;IAChC,OAAO,GAAG,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC;AAC5D,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,IAA6B,EAAE,GAAY;IAC3E,MAAM,YAAY,GAAI,GAA0C,EAAE,IAAI,IAAI,EAAE,CAAC;IAC7E,MAAM,WAAW,GAAG,IAAI,GAAG,CAAS,CAAC,GAAG,CAAC,CAAC,CAAC;IAE3C,KAAK,MAAM,GAAG,IAAI,YAAY,EAAE,C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AE,CAAC;QAChC,IAAI,MAAM,CAAC,MAAM,CAAC,YAAY,EAAE,GAAG,CAAC,EAAE,CAAC;YACtC,WAAW,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YACrB,WAAW,CAAC,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC;YACnC,WAAW,CAAC,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC;QACpC,CAAC;IACF,CAAC;IAED,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;QACxB,IAAI,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,GAAG,CAAC,EAAE,CAAC;YAC9B,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;gBAC3B,OAAO,CAAC,KAAK,CAAC,qBAAqB,GAAG,EAAE,CAAC,CAAC;gBAC1C,MAAM,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;gBACtC,MAAM,OAAO,GAAG,KAAK,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;gBACzF,OAAO,CAAC,IAAI,CAAC,SAAS,OAAO,sBAAsB,CAAC,CAAC;gBACrD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YACjB,CAAC;QACF,CAAC;IACF,CAAC;AACF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../src/cli/init.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../src/cli/init.ts"],"names":[],"mappings":";AAkFA,wBA8BG"}
|
package/dist/src/cli/init.js
CHANGED
|
@@ -41,9 +41,9 @@ agent:
|
|
|
41
41
|
# Read-only telemetry + app endpoints the harness may query. Point these at your
|
|
42
42
|
# stack; defaults assume a local dev setup.
|
|
43
43
|
telemetry:
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
44
|
+
prometheus_url: ${INVESTIGATION_DEFAULTS.telemetry.prometheusUrl}
|
|
45
|
+
alertmanager_url: ${INVESTIGATION_DEFAULTS.telemetry.alertmanagerUrl}
|
|
46
|
+
api_url: ${INVESTIGATION_DEFAULTS.telemetry.apiUrl}
|
|
47
47
|
|
|
48
48
|
# Read-only log-query system the harness may curl (Loki, Elasticsearch, …).
|
|
49
49
|
# logs:
|
|
@@ -61,11 +61,12 @@ telemetry:
|
|
|
61
61
|
|
|
62
62
|
# Where runs, events, and reports are stored.
|
|
63
63
|
workspace:
|
|
64
|
-
|
|
64
|
+
dir: ${d.workspace.dir}
|
|
65
65
|
|
|
66
66
|
# \`pl listen\` — token-authed local webhook intake (Alertmanager). The token is
|
|
67
|
-
# REQUIRED to start listening; keep it out of the file via env interpolation.
|
|
67
|
+
# REQUIRED to start listening regardless of bind address; keep it out of the file via env interpolation.
|
|
68
68
|
# listen:
|
|
69
|
+
# host: ${d.listen.host}
|
|
69
70
|
# port: ${d.listen.port}
|
|
70
71
|
# token: "\${PRISMALENS_LISTEN_TOKEN}"
|
|
71
72
|
# max_pending: ${d.listen.max_pending}
|
|
@@ -74,7 +75,7 @@ workspace:
|
|
|
74
75
|
export default defineCommand({
|
|
75
76
|
meta: {
|
|
76
77
|
name: "init",
|
|
77
|
-
description: `Scaffold a ${CONFIG_FILENAME} in the current directory`,
|
|
78
|
+
description: `Scaffold a ${CONFIG_FILENAME} in the current directory\n\nExamples:\n $ pl init\n $ pl init --force`,
|
|
78
79
|
},
|
|
79
80
|
async run({ args, cmd }) {
|
|
80
81
|
try {
|
package/dist/src/cli/init.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../../src/cli/init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C;YAC1C,MAAM,SAAS,CAAC,UAAU,EAAE,mBAAmB,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC,CAAC;YAEpE,OAAO,CAAC,OAAO,CAAC,WAAW,UAAU,EAAE,CAAC,CAAC;YACzC,OAAO,CAAC,IAAI,CACX,kFAAkF,CAClF,CAAC;QACH,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACd,OAAO,CAAC,KAAK,CAAC,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;YAChE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACjB,CAAC;IACF,CAAC;CACD,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"investigate.d.ts","sourceRoot":"","sources":["../../../src/cli/investigate.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"investigate.d.ts","sourceRoot":"","sources":["../../../src/cli/investigate.ts"],"names":[],"mappings":"AAyBA,OAAO,EAAoB,KAAK,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAE9E,OAAO,KAAK,EACX,cAAc,EAKd,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAIN,KAAK,WAAW,EAChB,KAAK,gBAAgB,EACrB,MAAM,oBAAoB,CAAC;AAI5B,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAWpD,wBAyQG;AAEH;;;;;;;;;;GAUG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,QAAQ,GAAG,MAAM,EAAE,CA0BhE;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,iBAAiB,CACtC,OAAO,EAAE,SAAS,EAClB,IAAI,EAAE,WAAW,EACjB,MAAM,EAAE,QAAQ,GACd,OAAO,CAAC;IACV,SAAS,EAAE,gBAAgB,GAAG,IAAI,CAAC;IACnC,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,gFAAgF;IAChF,eAAe,EAAE,OAAO,CAAC;CACzB,CAAC,CAyBD;AA2BD;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CAClC,OAAO,EAAE,SAAS,EAClB,IAAI,EAAE,WAAW,GACf;IAAE,YAAY,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,CAI7C;AAMD;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,cAAc,GAAG,MAAM,GAAG,IAAI,CAkBtE"}
|
|
@@ -3,15 +3,16 @@
|
|
|
3
3
|
/**
|
|
4
4
|
* `prismalens investigate` — the core investigation command (ADR-0008/0010).
|
|
5
5
|
*
|
|
6
|
-
* Seeds a
|
|
6
|
+
* Seeds a root-cause investigation from a firing alert (piped on stdin
|
|
7
7
|
* as a FiringAlert JSON, or synthesized from `--query`), rents a Tier-2 harness
|
|
8
8
|
* (deepagents over ACP, or Claude Code over the Agent SDK), drives the Tier-1
|
|
9
9
|
* supervisor LIVE via the shared conductor (`conductRun`, ADR-0018), and renders
|
|
10
10
|
* the ordered-evidence report (ADR-0002).
|
|
11
11
|
*
|
|
12
12
|
* BYO-key (ADR-0006): provider creds come from the environment
|
|
13
|
-
* (OLLAMA_ / OPENAI_ vars), never hard-bound here. The
|
|
14
|
-
*
|
|
13
|
+
* (OLLAMA_ / OPENAI_ vars), never hard-bound here. The `read-only` posture is a
|
|
14
|
+
* GUARDRAIL (edit tools removed), not a boundary — Bash writes remain possible.
|
|
15
|
+
* The only real boundary is an enforced sandbox (ADR-0017 Amdt 3 / ADR-0020).
|
|
15
16
|
*
|
|
16
17
|
* LIVE (ADR-0007/0010): `conductRun` fans each CanonicalEvent to a file-session
|
|
17
18
|
* STORE (append) and a terminal-line SINK, then this command renders the
|
|
@@ -36,7 +37,7 @@ import { assertKnownFlags } from "./flags.js";
|
|
|
36
37
|
export default defineCommand({
|
|
37
38
|
meta: {
|
|
38
39
|
name: "investigate",
|
|
39
|
-
description: "Run a
|
|
40
|
+
description: "Run a root-cause investigation of a firing alert (two-tier engine, ADR-0008).\n\nExamples:\n $ pl investigate -q 'Why did the database crash?' --max-turns 30",
|
|
40
41
|
},
|
|
41
42
|
args: {
|
|
42
43
|
repo: {
|
|
@@ -191,10 +192,10 @@ export default defineCommand({
|
|
|
191
192
|
if (!synth.configured) {
|
|
192
193
|
info("No Tier-1 provider configured (checked env + _FILE for: ANTHROPIC_API_KEY, OPENAI_API_KEY, GOOGLE_API_KEY, GROQ_API_KEY, OLLAMA_API_KEY) — reports will be RAW harness pass-through (un-synthesized). This is supported.");
|
|
193
194
|
}
|
|
194
|
-
// (2) Create the run workspace + session under workspace.
|
|
195
|
+
// (2) Create the run workspace + session under workspace.dir, wrapped as
|
|
195
196
|
// a conductRun store adapter (ADR-0018).
|
|
196
197
|
const runId = randomUUID();
|
|
197
|
-
const sessions = createSessionManager(config.workspace.
|
|
198
|
+
const sessions = createSessionManager(config.workspace.dir);
|
|
198
199
|
const fileSession = createFileSessionStore(sessions, {
|
|
199
200
|
runId,
|
|
200
201
|
alertname: primaryAlert.alertname,
|
|
@@ -274,11 +275,11 @@ export function collectAllowedDomains(config) {
|
|
|
274
275
|
INVESTIGATION_DEFAULTS.synth.baseURL;
|
|
275
276
|
const urls = [
|
|
276
277
|
llmBaseUrl,
|
|
277
|
-
config.telemetry.
|
|
278
|
+
config.telemetry.prometheus_url ??
|
|
278
279
|
INVESTIGATION_DEFAULTS.telemetry.prometheusUrl,
|
|
279
|
-
config.telemetry.
|
|
280
|
+
config.telemetry.alertmanager_url ??
|
|
280
281
|
INVESTIGATION_DEFAULTS.telemetry.alertmanagerUrl,
|
|
281
|
-
config.telemetry.
|
|
282
|
+
config.telemetry.api_url ?? INVESTIGATION_DEFAULTS.telemetry.apiUrl,
|
|
282
283
|
config.logs.url,
|
|
283
284
|
];
|
|
284
285
|
const hosts = new Set();
|
|
@@ -337,9 +338,9 @@ export async function resolveRunSandbox(harness, mode, config) {
|
|
|
337
338
|
*/
|
|
338
339
|
function firstProbeUrl(config) {
|
|
339
340
|
const urls = [
|
|
340
|
-
config.telemetry.
|
|
341
|
-
config.telemetry.
|
|
342
|
-
config.telemetry.
|
|
341
|
+
config.telemetry.prometheus_url,
|
|
342
|
+
config.telemetry.alertmanager_url,
|
|
343
|
+
config.telemetry.api_url,
|
|
343
344
|
config.logs.url,
|
|
344
345
|
];
|
|
345
346
|
for (const url of urls) {
|