@parcha/agentrun-serve 0.1.0-beta.59 → 0.1.0-beta.61
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/CHANGELOG.md +135 -0
- package/README.md +230 -120
- package/dist/acp-package.d.ts +4 -0
- package/dist/agent-delete.d.ts +6 -9
- package/dist/agent-delete.js +5 -3
- package/dist/agent-package.js +11 -1
- package/dist/api-only.d.ts +21 -3
- package/dist/api-only.js +41 -6
- package/dist/archil-routes.d.ts +4 -1
- package/dist/archil-routes.js +15 -12
- package/dist/archil-settings.d.ts +18 -8
- package/dist/archil-settings.js +35 -17
- package/dist/browser-person.d.ts +1 -1
- package/dist/browser-person.js +1 -1
- package/dist/calendar/tools.js +1 -1
- package/dist/chatgpt-plan.d.ts +4 -2
- package/dist/chatgpt-plan.js +13 -3
- package/dist/claude-login-token.d.ts +5 -0
- package/dist/claude-login-token.js +8 -0
- package/dist/claude-login.d.ts +49 -3
- package/dist/claude-login.js +140 -10
- package/dist/cli-learning/connections.js +1 -1
- package/dist/cli.js +42 -10
- package/dist/console/assets/{backend-BztxEAvb.js → backend-C9ffXUR5.js} +1 -1
- package/dist/console/assets/index-BnZV3lvW.js +639 -0
- package/dist/console/assets/{share-L84tlUDW.js → share-B1o5mJ56.js} +2 -2
- package/dist/console/assets/{styles-CaRKlHke.js → styles-D_znYrHR.js} +31 -31
- package/dist/console/assets/styles-fjQBFfMv.css +1 -0
- package/dist/console/index.html +3 -3
- package/dist/console/share.html +3 -3
- package/dist/decisions.d.ts +1 -1
- package/dist/decisions.js +2 -2
- package/dist/errors.d.ts +1 -0
- package/dist/errors.js +2 -0
- package/dist/factory-activity.d.ts +68 -0
- package/dist/factory-activity.js +153 -0
- package/dist/factory-runs.d.ts +11 -0
- package/dist/factory-runs.js +52 -0
- package/dist/filed-tool.d.ts +32 -0
- package/dist/filed-tool.js +122 -0
- package/dist/harness-check.js +2 -1
- package/dist/harness-keys.d.ts +1 -2
- package/dist/harness-keys.js +1 -2
- package/dist/harness-recipe.d.ts +13 -2
- package/dist/harness-recipe.js +30 -7
- package/dist/harness-sign-in.js +2 -1
- package/dist/harness-table.d.ts +9 -3
- package/dist/harness-table.js +11 -5
- package/dist/harness.js +6 -2
- package/dist/import-worker.js +2 -2
- package/dist/import.d.ts +9 -0
- package/dist/import.js +11 -1
- package/dist/key-refusal.d.ts +5 -0
- package/dist/key-refusal.js +30 -18
- package/dist/learn/audit.d.ts +20 -22
- package/dist/learn/audit.js +72 -55
- package/dist/learn/check.js +1 -1
- package/dist/learn/commit.d.ts +35 -43
- package/dist/learn/commit.js +62 -270
- package/dist/learn/compile.d.ts +4 -4
- package/dist/learn/compile.js +6 -7
- package/dist/learn/corrections.js +1 -1
- package/dist/learn/delete.d.ts +5 -12
- package/dist/learn/delete.js +17 -30
- package/dist/learn/forget-run.d.ts +16 -0
- package/dist/learn/forget-run.js +53 -0
- package/dist/learn/index.js +1 -1
- package/dist/learn/learning-of.d.ts +0 -4
- package/dist/learn/learning-of.js +0 -5
- package/dist/learn/{folder.d.ts → legacy/folder.d.ts} +2 -1
- package/dist/learn/{folder.js → legacy/folder.js} +4 -7
- package/dist/learn/legacy/place.d.ts +16 -0
- package/dist/{workspace/learning-workspace.js → learn/legacy/place.js} +12 -42
- package/dist/learn/legacy/scrub.d.ts +28 -0
- package/dist/learn/legacy/scrub.js +258 -0
- package/dist/learn/promote.d.ts +40 -66
- package/dist/learn/promote.js +69 -207
- package/dist/learn/reset-ledger.d.ts +18 -0
- package/dist/learn/reset-ledger.js +14 -0
- package/dist/learn/rows.d.ts +186 -0
- package/dist/learn/rows.js +376 -0
- package/dist/learn/secrets.d.ts +2 -1
- package/dist/learn/secrets.js +2 -2
- package/dist/learn/workflow-draft.d.ts +4 -1
- package/dist/learn/workflow-draft.js +12 -2
- package/dist/learned-nodes.d.ts +36 -0
- package/dist/learned-nodes.js +23 -0
- package/dist/learning-reset.d.ts +1 -1
- package/dist/learning-reset.js +9 -11
- package/dist/learning-routes.d.ts +60 -81
- package/dist/learning-routes.js +187 -360
- package/dist/learning-words.d.ts +2 -0
- package/dist/learning-words.js +2 -0
- package/dist/learning.d.ts +18 -24
- package/dist/learning.js +35 -66
- package/dist/local-model.d.ts +144 -0
- package/dist/local-model.js +214 -0
- package/dist/mcp-gateway.d.ts +6 -0
- package/dist/mcp-gateway.js +44 -8
- package/dist/mcp-probe.d.ts +7 -0
- package/dist/mcp-probe.js +7 -0
- package/dist/mcp-resources.d.ts +1 -1
- package/dist/native/discovery.d.ts +6 -0
- package/dist/native/discovery.js +14 -1
- package/dist/native/remote.d.ts +5 -0
- package/dist/native/remote.js +16 -0
- package/dist/native/runtime.js +3 -2
- package/dist/observation/observer.d.ts +6 -6
- package/dist/ollama-provider.d.ts +35 -0
- package/dist/ollama-provider.js +108 -2
- package/dist/openapi.js +147 -35
- package/dist/place-offers.d.ts +3 -0
- package/dist/place-offers.js +3 -0
- package/dist/place.d.ts +35 -12
- package/dist/place.js +67 -29
- package/dist/print.js +1 -1
- package/dist/purged-workflow.d.ts +0 -33
- package/dist/purged-workflow.js +3 -71
- package/dist/redact/match.d.ts +36 -8
- package/dist/redact/match.js +179 -44
- package/dist/run-export.js +4 -2
- package/dist/run-launch.d.ts +3 -3
- package/dist/run-learning-served.d.ts +3 -3
- package/dist/run-learning-served.js +1 -1
- package/dist/run-listing.d.ts +1 -1
- package/dist/run-timeline-served.d.ts +1 -1
- package/dist/run-timeline-served.js +6 -5
- package/dist/run-usage.js +3 -2
- package/dist/runnable.js +25 -8
- package/dist/runner/adapter-loop.d.ts +8 -1
- package/dist/runner/adapter-loop.js +100 -20
- package/dist/runner/adapter-run-spec.d.ts +3 -5
- package/dist/runner/adapter-run-spec.js +35 -61
- package/dist/runner/adapters/pi.d.ts +3 -2
- package/dist/runner/adapters/pi.js +3 -1
- package/dist/runner/audit.d.ts +3 -5
- package/dist/runner/audit.js +28 -51
- package/dist/runner/cli-run-spec.js +19 -22
- package/dist/runner/compare-end.d.ts +1 -3
- package/dist/runner/compare-end.js +6 -2
- package/dist/runner/disk-free.d.ts +15 -4
- package/dist/runner/disk-free.js +25 -7
- package/dist/runner/dispatch.js +2 -2
- package/dist/runner/feedback-round.d.ts +1 -1
- package/dist/runner/feedback-round.js +2 -2
- package/dist/runner/harness-loops.d.ts +9 -0
- package/dist/runner/harness-loops.js +49 -7
- package/dist/runner/held.d.ts +4 -11
- package/dist/runner/held.js +0 -25
- package/dist/runner/journal-kinds.d.ts +4 -1
- package/dist/runner/journal-kinds.js +1 -1
- package/dist/runner/learned-first.d.ts +0 -2
- package/dist/runner/learned-first.js +3 -3
- package/dist/runner/learning-end.d.ts +12 -16
- package/dist/runner/learning-end.js +41 -75
- package/dist/runner/learning-seed.d.ts +13 -16
- package/dist/runner/learning-seed.js +13 -23
- package/dist/runner/live-ticker.js +3 -4
- package/dist/runner/main.js +1 -1
- package/dist/runner/mcp-claim.js +3 -2
- package/dist/runner/mcp-run.d.ts +23 -4
- package/dist/runner/mcp-run.js +31 -2
- package/dist/runner/metrics.d.ts +4 -0
- package/dist/runner/metrics.js +9 -3
- package/dist/runner/monid-run.js +3 -1
- package/dist/runner/native-loop.js +3 -4
- package/dist/runner/promotion.d.ts +19 -28
- package/dist/runner/promotion.js +50 -69
- package/dist/runner/redact.d.ts +3 -0
- package/dist/runner/redact.js +7 -0
- package/dist/runner/reflect-hook.d.ts +2 -2
- package/dist/runner/reflect-hook.js +4 -1
- package/dist/runner/run-child-host.d.ts +1 -9
- package/dist/runner/run-child-host.js +12 -68
- package/dist/runner/runner.d.ts +1 -1
- package/dist/runner/sdk-loop.js +7 -7
- package/dist/runner/workflow-calls.d.ts +4 -1
- package/dist/runner/workflow-calls.js +35 -18
- package/dist/runner/workflow-loop.d.ts +1 -1
- package/dist/runner/workflow-loop.js +3 -1
- package/dist/runner/workflow-spec.d.ts +4 -0
- package/dist/runner/workflow-spec.js +18 -13
- package/dist/runs-over-store.d.ts +2 -2
- package/dist/runs-over-store.js +1 -1
- package/dist/sdk/check.d.ts +1 -4
- package/dist/sdk/check.js +2 -3
- package/dist/sdk/runs.d.ts +20 -7
- package/dist/sdk/runs.js +105 -68
- package/dist/secret-cut.js +7 -4
- package/dist/secret-rules.js +97 -83
- package/dist/secrets.d.ts +4 -0
- package/dist/secrets.js +44 -10
- package/dist/server-fs.d.ts +1 -1
- package/dist/server-fs.js +1 -1
- package/dist/server-keys.d.ts +6 -0
- package/dist/server-keys.js +12 -0
- package/dist/server.d.ts +22 -15
- package/dist/server.js +311 -198
- package/dist/slack.js +2 -1
- package/dist/source-sync/auxiliary.js +2 -2
- package/dist/store/index.d.ts +1 -1
- package/dist/store/index.js +1 -1
- package/dist/store/postgres/migrate.js +3 -1
- package/dist/store/postgres/migrations/0032_learning_rows.sql +65 -0
- package/dist/store/schema.d.ts +28 -2
- package/dist/store/schema.js +81 -5
- package/dist/store/sqlite/learning-rows.d.ts +23 -0
- package/dist/store/sqlite/learning-rows.js +559 -0
- package/dist/store/sqlite/store.d.ts +7 -1
- package/dist/store/sqlite/store.js +84 -18
- package/dist/store/store.d.ts +219 -6
- package/dist/store/store.js +13 -0
- package/dist/store-reads/journal.d.ts +33 -3
- package/dist/store-reads/journal.js +99 -4
- package/dist/store-reads/learning.d.ts +23 -26
- package/dist/store-reads/learning.js +42 -30
- package/dist/store-reads/loop.js +1 -1
- package/dist/store-view.d.ts +24 -2
- package/dist/store-view.js +40 -11
- package/dist/templates.d.ts +10 -2
- package/dist/templates.js +31 -4
- package/dist/tool-plane.d.ts +27 -3
- package/dist/tool-plane.js +79 -4
- package/dist/tools.d.ts +12 -2
- package/dist/tools.js +42 -7
- package/dist/trigger-launch-hook.d.ts +2 -2
- package/dist/trigger-launch-hook.js +1 -1
- package/dist/triggers.d.ts +7 -4
- package/dist/triggers.js +4 -4
- package/dist/web-holds.d.ts +2 -0
- package/dist/web-holds.js +5 -2
- package/dist/web-run.js +2 -1
- package/dist/workspace/archil-exec.js +1 -1
- package/dist/workspace/archil.d.ts +1 -1
- package/dist/workspace/archil.js +1 -1
- package/dist/workspace/computer-deps.js +5 -3
- package/dist/workspace/computer-providers.d.ts +11 -1
- package/dist/workspace/computer-providers.js +29 -2
- package/dist/workspace/index.d.ts +1 -2
- package/dist/workspace/index.js +1 -2
- package/dist/workspace/paths.d.ts +0 -4
- package/dist/workspace/paths.js +0 -6
- package/dist/workspace/workspace.d.ts +1 -1
- package/dist/workspace/workspace.js +1 -1
- package/package.json +13 -13
- package/templates/TOOLS.md +46 -0
- package/dist/console/assets/index-LwNL4L9q.js +0 -619
- package/dist/console/assets/styles-DQo8rzY-.css +0 -1
- package/dist/workspace/learning-workspace.d.ts +0 -24
- /package/dist/learn/{learning.sh → legacy/learning.sh} +0 -0
package/dist/secret-rules.js
CHANGED
|
@@ -2517,6 +2517,10 @@ function after(lines, at, fits) {
|
|
|
2517
2517
|
/** A shell's prompt opening a line: the next command, where a file's printed contents end. */
|
|
2518
2518
|
const PROMPT_LINE = /^\s{0,8}(?:[$#%❯]|>>?)\s{1,3}\S/;
|
|
2519
2519
|
const notPrompt = (body) => !PROMPT_LINE.test(body);
|
|
2520
|
+
/** A user's prompt opening a line, `$`, `%` or `❯`, and the command after it. `#` and `>` are left out: they open a
|
|
2521
|
+
* markdown heading or quote far more often than a root prompt (`# Export`), and their env commands are read by
|
|
2522
|
+
* ENV_COMMAND as before. */
|
|
2523
|
+
const PROMPT_HEAD = /^\s{0,8}[$%❯]\s{1,3}(?=\S)/;
|
|
2520
2524
|
/** A line that is a dump's cut already made: no file's content (ruling VIII: a cut text read again is cut no more). */
|
|
2521
2525
|
const DUMP_MARKER_LINE = /^\s{0,8}\[redacted:[a-z0-9-]{1,64}(?: \d{1,9} lines)?\]\s{0,8}$/;
|
|
2522
2526
|
const notMarker = (body) => !DUMP_MARKER_LINE.test(body);
|
|
@@ -2534,12 +2538,28 @@ const ENV_NAMES = new Set(["PATH", "HOME", "SHELL", "USER", "PWD", "LANG"]);
|
|
|
2534
2538
|
const ENV_UNCOMMANDED_LINES = 8;
|
|
2535
2539
|
/** NAME=value lines in a row printed by an env command on the line before (a blank between allowed), any number of
|
|
2536
2540
|
* them; eight or more holding two login names; or all `declare -x` lines (export -p's own output, its command's mark).
|
|
2537
|
-
* And the values printenv NAME... or echo $KEY prints, one line a name
|
|
2541
|
+
* And the values printenv NAME... or echo $KEY prints, one line a name; and all of a prompted command's output when
|
|
2542
|
+
* the command prints the environment. */
|
|
2538
2543
|
function envDumps(text) {
|
|
2539
2544
|
const lines = linesOf(text);
|
|
2540
2545
|
const out = [];
|
|
2541
2546
|
for (let at = 0; at < lines.length;) {
|
|
2542
2547
|
const body = lines[at].body;
|
|
2548
|
+
// A prompt line whose command prints the environment (11-25 r2): its output runs to the next `$`, `%` or `❯`
|
|
2549
|
+
// prompt or a dump's marker, whatever its lines look like: a multi-line value no longer ends it.
|
|
2550
|
+
const prompt = PROMPT_HEAD.exec(body);
|
|
2551
|
+
if (prompt && printsEnvironment(body.slice(prompt[0].length))) {
|
|
2552
|
+
let to = at;
|
|
2553
|
+
// Only a `$`, `%` or `❯` prompt ends it: a `#` or `>` line is a value's comment or quote, or a continued command.
|
|
2554
|
+
while (to + 1 < lines.length && !PROMPT_HEAD.test(lines[to + 1].body) && notMarker(lines[to + 1].body))
|
|
2555
|
+
to++;
|
|
2556
|
+
while (to > at && blank(lines[to]))
|
|
2557
|
+
to--;
|
|
2558
|
+
if (to > at)
|
|
2559
|
+
out.push({ start: rawStart(text, lines[at + 1].start), end: lines[to].end });
|
|
2560
|
+
at = to + 1;
|
|
2561
|
+
continue;
|
|
2562
|
+
}
|
|
2543
2563
|
const named = PRINTENV_NAMES.exec(body);
|
|
2544
2564
|
const echoed = ECHO_VARIABLE.exec(body);
|
|
2545
2565
|
if (named || (echoed && secretName(echoed[2]))) {
|
|
@@ -2579,63 +2599,56 @@ const readPath = (body) => READ_COMMAND.exec(body)?.[2] ?? READ_TOOL.exec(body)?
|
|
|
2579
2599
|
/** The file a command prints whole, when it is one read alone (`cat ~/.pgpass`): its output is that file's content
|
|
2580
2600
|
* (ruling LVI). */
|
|
2581
2601
|
export const commandReadPath = (command) => (command === undefined ? undefined : readPath(command));
|
|
2602
|
+
/** Quote and escape characters, dropped before a command line is read: a quoted script's words are the line's own
|
|
2603
|
+
* words however deep its shells nest (`bash -c "bash -c 'env'"`), and a word spelled across quotes or behind a
|
|
2604
|
+
* backslash (`e"n"v`, `\env`) reads whole. No depth is followed, so none can run out. */
|
|
2605
|
+
const COMMAND_QUOTES = /["'\\]/g;
|
|
2582
2606
|
/** Where a command line splits into the commands it runs: `;`, `&&`, `||`, a pipe, a lone `&` (not a redirection's:
|
|
2583
|
-
* `2>&1`, `&>`), a line break, a subshell's or a substitution's `(` and `)`, a backtick.
|
|
2584
|
-
* inside them only makes more pieces to read, and an env word in one is read as a command (`echo "a; env"`, an over-cut
|
|
2585
|
-
* that fails closed). */
|
|
2607
|
+
* `2>&1`, `&>`), a line break, a subshell's or a substitution's `(` and `)`, a backtick. */
|
|
2586
2608
|
const COMMAND_SPLIT = /;|&&|\|\||\||(?<![<>&])&(?![&>])|\n|\(|\)|`/;
|
|
2587
2609
|
const COMMAND_BLANKS = /[ \t\r]{1,4096}/;
|
|
2588
|
-
/** A shell prompt standing as a piece's first word (`$ env`, `C:\app> set`). */
|
|
2589
|
-
const PROMPT_WORD = /^(?:[$#%>❯]|[A-Za-z]:\\[^>\n]{0,256}>)$/;
|
|
2590
|
-
/** A leading assignment (`FOO=1 printenv A`): the command follows it. */
|
|
2591
|
-
const ASSIGNMENT_WORD = /^[A-Za-z_][A-Za-z0-9_]{0,127}=/;
|
|
2592
2610
|
/** A redirection (`2>&1`, `>/tmp/e`, `&>log`); one that is its operator alone takes the next word as its file. */
|
|
2593
2611
|
const REDIRECT_WORD = /^(?:\d{1,2}|&)?(?:<<?|>>?)(?:&\d{0,2}-?)?/;
|
|
2594
2612
|
const REDIRECT_ALONE = /^(?:\d{1,2}|&)?(?:<<?|>>?)$/;
|
|
2595
|
-
/** A
|
|
2596
|
-
const
|
|
2597
|
-
/**
|
|
2598
|
-
|
|
2599
|
-
|
|
2600
|
-
const
|
|
2601
|
-
|
|
2613
|
+
/** A redirection written against a word (`env>/tmp/e`): the word is what comes before it. */
|
|
2614
|
+
const WORD_REDIRECT = /\d{0,2}[<>]/;
|
|
2615
|
+
/** Where a line, quotes dropped and lower-cased, splits into the tokens an env name is read from: anything but a
|
|
2616
|
+
* letter, a digit, `_` or `-`. A name joined to other characters is a token of its own (`process["env"]`,
|
|
2617
|
+
* `env.APP_SEED`, `o.environ`, `Bun.env`, `ENVIRON[`, `</proc/1/environ`, `$env:A`, `std::env`). */
|
|
2618
|
+
const ENV_TOKEN_BREAK = /[^a-z0-9_-]{1,4096}/;
|
|
2619
|
+
/** A dotfile `.env` (`.env`, `.env.example`, `src/.env`) named as a word or after a path's `/`, `=`, `<`, `>`, `,` or
|
|
2620
|
+
* `:`: a file, which env-file reads, not the environment. `process.env`, `process?.env`, `Bun.env` keep the character
|
|
2621
|
+
* before their dot and are read. */
|
|
2622
|
+
const DOT_ENV_FILE = /(^|[ \t/=<>,:])\.env(?![a-z0-9_-])/gi;
|
|
2623
|
+
/** A token that runs, names or reads the environment wherever it stands in a line: env, printenv, envsubst, environ (a
|
|
2624
|
+
* /proc file, awk's ENVIRON, Python's os.environ), getenv and GetEnvironmentVariables, PHP's $_ENV and $_SERVER,
|
|
2625
|
+
* compgen, systemd's show-environment, a container's inspect, xtrace. An env token in a file's name is read so too
|
|
2626
|
+
* (`ls src/env.ts`, `cp .env.example .env`): an over-cut, ruled so. */
|
|
2627
|
+
const ENV_WORD = /^(?:(?:print)?env|envsubst|environ|compgen|show-environment|inspect|_env|_server|xtrace)$|^getenv/;
|
|
2628
|
+
/** A variable's expansion: sh's `$NAME` and any `${...}` (`${!v}` too), cmd's `%NAME%`. */
|
|
2629
|
+
const VARIABLE_WORD = /\$(?:\{|[A-Za-z_])|%[A-Za-z_][A-Za-z0-9_]{0,127}%/;
|
|
2630
|
+
/** A flag that turns xtrace on (`set -x`, `set -ex`, `bash -x`, `sh -xc`): each command is printed with its variables
|
|
2631
|
+
* expanded. */
|
|
2632
|
+
const XTRACE_FLAG = /^-[a-z]{0,8}x[a-z]{0,8}$/;
|
|
2633
|
+
/** A here-document or here-string: what it holds is expanded into a command's input. */
|
|
2634
|
+
const HERE_INPUT = /<</;
|
|
2602
2635
|
/** export's or declare's flag that prints (`-p`, `-px`). */
|
|
2603
2636
|
const PRINT_FLAG = /^-[A-Za-z]{0,8}p/;
|
|
2604
|
-
/**
|
|
2605
|
-
const
|
|
2606
|
-
/** Commands that
|
|
2607
|
-
const
|
|
2608
|
-
|
|
2609
|
-
const
|
|
2610
|
-
|
|
2611
|
-
const
|
|
2612
|
-
|
|
2613
|
-
|
|
2637
|
+
/** ps's BSD-style option word that adds each process's environment (`ps e`, `ps eww`, `ps auxe`). */
|
|
2638
|
+
const PS_ENV_OPTION = /^[a-z]{0,16}e[a-z]{0,16}$/;
|
|
2639
|
+
/** Commands that print their arguments: with a variable anywhere in the line, its value is read as printed. */
|
|
2640
|
+
const PRINT_WORDS = new Set(["echo", "printf", "print", "puts", "say", "write-output", "write-host"]);
|
|
2641
|
+
/** Builtins that print every variable given no name to set: with flags alone, or a printing flag. */
|
|
2642
|
+
const DECLARE_WORDS = new Set(["export", "declare", "typeset", "readonly"]);
|
|
2643
|
+
/** set and the shells, whose -x flag turns xtrace on. */
|
|
2644
|
+
const XTRACE_WORDS = new Set(["set", "sh", "bash", "zsh", "dash", "ksh"]);
|
|
2645
|
+
/** A word's name: before a redirection written against it, past its path, lower case. */
|
|
2646
|
+
const wordName = (word) => {
|
|
2647
|
+
const bare = word.split(WORD_REDIRECT)[0];
|
|
2648
|
+
return bare.slice(bare.lastIndexOf("/") + 1).toLowerCase();
|
|
2614
2649
|
};
|
|
2615
|
-
/**
|
|
2616
|
-
|
|
2617
|
-
* or printf of a variable, or a shell's `-c` script that does. Read past a prompt, grouping and control-flow words,
|
|
2618
|
-
* wrappers (`sudo -E`, `nice -n 5`, `exec`, a path), leading assignments and redirections. An echo of any variable
|
|
2619
|
-
* counts, a secret name or not (`cd x && echo $PWD && npm test` cuts the test's output too: an over-cut, fails
|
|
2620
|
-
* closed). */
|
|
2621
|
-
function pieceDumps(piece, depth) {
|
|
2622
|
-
const words = piece.split(COMMAND_BLANKS).filter(Boolean);
|
|
2623
|
-
let at = 0;
|
|
2624
|
-
while (at < words.length) {
|
|
2625
|
-
const word = words[at];
|
|
2626
|
-
if (PROMPT_WORD.test(word) || LEAD_WORDS.has(word) || ASSIGNMENT_WORD.test(word)) {
|
|
2627
|
-
at++;
|
|
2628
|
-
continue;
|
|
2629
|
-
}
|
|
2630
|
-
if (!WRAPPERS.has(commandName(word)))
|
|
2631
|
-
break;
|
|
2632
|
-
at++;
|
|
2633
|
-
while (at < words.length && (words[at].startsWith("-") || NUMBER_WORD.test(words[at])))
|
|
2634
|
-
at += WRAPPER_ARG_FLAGS.has(words[at]) ? 2 : 1;
|
|
2635
|
-
}
|
|
2636
|
-
if (at >= words.length)
|
|
2637
|
-
return false;
|
|
2638
|
-
const name = commandName(words[at]);
|
|
2650
|
+
/** A command's arguments after the word at `at`, its redirections left out. */
|
|
2651
|
+
function argsAfter(words, at) {
|
|
2639
2652
|
const args = [];
|
|
2640
2653
|
for (let i = at + 1; i < words.length; i++) {
|
|
2641
2654
|
if (REDIRECT_ALONE.test(words[i]))
|
|
@@ -2643,44 +2656,45 @@ function pieceDumps(piece, depth) {
|
|
|
2643
2656
|
else if (!REDIRECT_WORD.test(words[i]))
|
|
2644
2657
|
args.push(words[i]);
|
|
2645
2658
|
}
|
|
2646
|
-
|
|
2647
|
-
|
|
2648
|
-
|
|
2649
|
-
|
|
2650
|
-
|
|
2651
|
-
|
|
2652
|
-
|
|
2653
|
-
|
|
2654
|
-
|
|
2655
|
-
|
|
2656
|
-
|
|
2659
|
+
return args;
|
|
2660
|
+
}
|
|
2661
|
+
/** Whether a command of a line, quotes dropped, prints the environment by its builtins' arguments: set with nothing
|
|
2662
|
+
* after it, or set or a shell with an xtrace flag; export, declare, typeset or readonly with flags alone or a printing
|
|
2663
|
+
* flag; ps with an `e` option. */
|
|
2664
|
+
function pieceDumps(piece) {
|
|
2665
|
+
const words = piece.split(COMMAND_BLANKS).filter(Boolean);
|
|
2666
|
+
return words.some((word, at) => {
|
|
2667
|
+
const name = wordName(word);
|
|
2668
|
+
if (!XTRACE_WORDS.has(name) && !DECLARE_WORDS.has(name) && name !== "ps")
|
|
2669
|
+
return false;
|
|
2670
|
+
const args = argsAfter(words, at);
|
|
2671
|
+
if (XTRACE_WORDS.has(name) && args.some((arg) => XTRACE_FLAG.test(arg.toLowerCase())))
|
|
2657
2672
|
return true;
|
|
2658
|
-
|
|
2673
|
+
if (name === "set")
|
|
2659
2674
|
return args.length === 0;
|
|
2660
|
-
|
|
2661
|
-
|
|
2662
|
-
|
|
2663
|
-
|
|
2664
|
-
case "compgen":
|
|
2665
|
-
return args.includes("-v");
|
|
2666
|
-
case "echo":
|
|
2667
|
-
case "printf":
|
|
2668
|
-
return args.some((arg) => VARIABLE_WORD.test(arg));
|
|
2669
|
-
default: {
|
|
2670
|
-
if (!SHELLS.has(name) || depth >= 2)
|
|
2671
|
-
return false;
|
|
2672
|
-
const flag = args.findIndex((arg) => SCRIPT_FLAG.test(arg));
|
|
2673
|
-
return flag >= 0 && printsEnvironment(args.slice(flag + 1).join(" ").replace(WORD_EDGE_QUOTES, ""), depth + 1);
|
|
2674
|
-
}
|
|
2675
|
-
}
|
|
2675
|
+
if (DECLARE_WORDS.has(name))
|
|
2676
|
+
return args.every((arg) => arg.startsWith("-")) || args.some((arg) => PRINT_FLAG.test(arg));
|
|
2677
|
+
return name === "ps" && args.some((arg) => PS_ENV_OPTION.test(arg));
|
|
2678
|
+
});
|
|
2676
2679
|
}
|
|
2677
|
-
/** Whether a call's command line prints the environment or a variable's value
|
|
2678
|
-
* `
|
|
2679
|
-
*
|
|
2680
|
-
|
|
2680
|
+
/** Whether a call's command line prints the environment or a variable's value (`env`, `cd app && env | sort`,
|
|
2681
|
+
* `bash -c "bash -c 'env'"`, `cat</proc/self/environ`, `node -p 'process["env"]'`). Quotes and escapes are dropped,
|
|
2682
|
+
* and the line is read as tokens, not command shapes (11-25 r2: a reader of shapes, wrappers, env's own command or
|
|
2683
|
+
* nested shells, missed one more each time). A dump when any token is an env token (`sudo -n env`, `ssh host env`,
|
|
2684
|
+
* `jq -rn 'env.A'`), a builtin's arguments make one (pieceDumps), or a token that prints (echo, printf, print, an
|
|
2685
|
+
* awk program's print) or a here-string stands in a line with a variable anywhere (`cd x && echo $PWD && npm test`
|
|
2686
|
+
* cuts the test's output too: an over-cut, fails closed). A line longer than is read is read so too. Not seen: what
|
|
2687
|
+
* an earlier call set up (an alias, a symlink to an environ file, a script it wrote), which no line reader can. */
|
|
2688
|
+
function printsEnvironment(command) {
|
|
2681
2689
|
if (command.length > COMMAND_MAX)
|
|
2682
2690
|
return true;
|
|
2683
|
-
|
|
2691
|
+
const line = command.replace(COMMAND_QUOTES, "").replace(DOT_ENV_FILE, "$1");
|
|
2692
|
+
const tokens = line.toLowerCase().split(ENV_TOKEN_BREAK);
|
|
2693
|
+
if (tokens.some((token) => ENV_WORD.test(token)))
|
|
2694
|
+
return true;
|
|
2695
|
+
if (VARIABLE_WORD.test(command) && (HERE_INPUT.test(command) || tokens.some((token) => PRINT_WORDS.has(token))))
|
|
2696
|
+
return true;
|
|
2697
|
+
return line.split(COMMAND_SPLIT).some(pieceDumps);
|
|
2684
2698
|
}
|
|
2685
2699
|
/** All of a call's output as one dump, from its first character that is not a blank to its last (11-25 read): its
|
|
2686
2700
|
* lines can't be told apart by command, a value can span lines, and a first line that opens like a JSON field or a
|
|
@@ -2984,7 +2998,7 @@ export const RULE_PATTERNS = Object.freeze({
|
|
|
2984
2998
|
CODE_CALL, IDENT_CHAIN, MEMBER_CHAIN, CODE_CASE, CAMEL_OR_SNAKE, CALL_AFTER, LITERAL_START, YAML_NODE, ELIDED_AFTER, REFERENCE, ELIDED, TRAILING_PUNCTUATION, SENTENCE_END, BARE_START, EDGE_BLANK, EDGE_TOKEN_PUNCT, SLUG_OFF, SLUG_ENDS, PEM_END, PEM_BEGIN, PEM_OFF, PEM_TAIL, PEM_BODY_LINE, PEM_LAST_LINE, PEM_END_LINE, LEAD_TOKEN, DIGIT_START, BASE64_CHAR, BACKSLASH_RUN, BARE_STOP, URL_USERINFO, NAME_KEY_OFF, IDENTIFIER, ENDS_ENTRY, ENTRY_END_AFTER, TYPE_SUFFIX, TYPE_AFTER, LOCAL_LEAD, LOCAL_END, NESTED_ESCAPE, COOKIE_SPLIT, LINT_URL, CAMEL_HUMP, NAME_SEPARATORS, DIGITS_ONLY,
|
|
2985
2999
|
UPPER_NAME, LEAD_AT_START, LINE_PREFIX, LINE_REST, CODE_KEYWORD, CODE_EXPRESSION, OPENERS, CLOSERS, INI_HEADER, INI_LINE, NPMRC_AUTH, NPM_COMMAND, NPM_SET_SCAN, NPM_SET_AUTH, NPM_AUTH_KEY, ESCAPED_QUOTE_BEFORE, ESCAPED_QUOTE_AFTER, DOTTED_KEY_BEFORE, CODE_END, MEMBER_OBJECT_BEFORE, CODE_ROOT_BEFORE, STATEMENT_END_AFTER, REFERENCE_START, ENV_ASSIGN, HF_TOKEN, DIGITALOCEAN_TOKEN, PYPI_TOKEN, SENDGRID_KEY, ASSIGN, ASSIGN_SPACED, ASSIGN_COLON, SSHPASS, MYSQL_COMMAND, PASSWORD_FLAG, LOGIN_COMMAND,
|
|
2986
3000
|
REDIS_COMMAND, LOGIN_SCAN, LOGIN_P, REDIS_SCAN, REDIS_A, MYSQL_SCAN, MYSQL_P, OPENSSL_PASS, NETRC, AUTH_HEADER, TOKEN_RUN, CODE_KEY_BEFORE, URL_SAFE_RUN, BASE64_RUN_BEFORE, BASE64_RUN_AFTER, LETTER_OR_DIGIT, ENV_NAME_RUN, BASE64_CHARS, COOKIE_HEADER, COOKIE_PAIR, CURL_COMMAND, CURL_SCAN, CURL_USER, GLUED_STOP, NUMBERED, JSON_FIELD_OPEN, PROMPT_LINE,
|
|
2987
|
-
ENV_LINE, ENV_COMMAND, PRINTENV_NAMES, ECHO_VARIABLE, COMMAND_SPLIT, COMMAND_BLANKS,
|
|
3001
|
+
ENV_LINE, ENV_COMMAND, PRINTENV_NAMES, ECHO_VARIABLE, COMMAND_QUOTES, COMMAND_SPLIT, COMMAND_BLANKS, REDIRECT_WORD, REDIRECT_ALONE, WORD_REDIRECT, ENV_TOKEN_BREAK, DOT_ENV_FILE, ENV_WORD, VARIABLE_WORD, XTRACE_FLAG, HERE_INPUT, PRINT_FLAG, PS_ENV_OPTION, PROMPT_HEAD, NAME_RUN, READ_COMMAND, READ_TOOL, PATH_SEPARATOR, ENV_FILE_NAME, ENV_TEMPLATE, SSH_FILE,
|
|
2988
3002
|
CREDENTIAL_FILE, FILE_VARIABLE, ENV_FILE_LINE, KEY_LINE, SSH_CONFIG, COMMENT_LINE, PEM_LINE, BASE64_LINE, PEM_HEADER_LINE, HOME_UNIX, HOME_WINDOWS, SEGMENT_AFTER,
|
|
2989
3003
|
TRAILING_SLASHES, HOME_USER, CLAUDE_SLUG, CLAUDE_PROJECTS_BEFORE, SLUG_OFF_CHARS, SLUG_USER, BOT_TRAILER, DUMP_MARKER_LINE, EMAIL, EXAMPLE_DOMAIN, NO_REPLY_LOCAL, NO_REPLY_DOMAIN, FORGE_NO_REPLY, USER_ONLY_BEFORE, PORT_PASSWORD, HOST_SHAPED, IPV4, VERSION_BEFORE, PRE_RELEASE_AFTER,
|
|
2990
3004
|
BUILD_AFTER, RANGE_AFTER, IPV6, IPV6_GROUPS, ENV_PREFIX_BEFORE, ENV_PREFIX_AFTER, ENV_PREFIX_CHAIN, ENV_PREFIX_STATEMENT, ENV_FLAG, HELM_LIST_FLAG, HELM_SET, HELM_NAME, RESOURCE_NAME, SECRET_OBJECT_NAME, CONNECTION_PASSWORD, ADO_PAIR, CONNECTION_KEY_PAIR, BLANKS, LIBPQ_PAIR_AFTER, FORMAT_FIELD, PWD_PATH, QUERY_VALUE_STOP, QUERY_PASSWORD, ARGUMENT_TAIL, NEXT_ASSIGNMENT, ASSIGNMENT_BEFORE,
|
package/dist/secrets.d.ts
CHANGED
|
@@ -43,6 +43,10 @@ export declare const secret: (name: string, stored?: StoredKeys) => string | und
|
|
|
43
43
|
* the object, or a spawn given it (Node builds a child's environment from its enumerable keys), leaves it out. Which
|
|
44
44
|
* came from a saved key is said too (savedIn), never a value. */
|
|
45
45
|
export declare const withSecrets: (env: NodeJS.ProcessEnv, which?: "all" | "own", stored?: StoredKeys) => NodeJS.ProcessEnv;
|
|
46
|
+
/** A copy of `env` (one withSecrets made) with every own property as it is: each secret still read by name and never
|
|
47
|
+
* enumerated, savedIn still saying which were saved, and its symbols. A spread keeps none of the secrets, so a copy
|
|
48
|
+
* that is read for a key is made with this (env-copy.test.mjs scans for spreads). */
|
|
49
|
+
export declare const copyEnv: <T extends object>(env: T) => T;
|
|
46
50
|
/** The secrets of `env` (one withSecrets made) that were saved on the server, not its own, by name. */
|
|
47
51
|
export declare const savedIn: (env: NodeJS.ProcessEnv) => ReadonlySet<string>;
|
|
48
52
|
/** The environment a child gets: `env` with every secret name taken out, and every other name shaped like a key
|
package/dist/secrets.js
CHANGED
|
@@ -182,6 +182,10 @@ export const withSecrets = (env, which = "all", stored) => {
|
|
|
182
182
|
Object.defineProperty(out, SAVED, { value: saved, enumerable: false });
|
|
183
183
|
return out;
|
|
184
184
|
};
|
|
185
|
+
/** A copy of `env` (one withSecrets made) with every own property as it is: each secret still read by name and never
|
|
186
|
+
* enumerated, savedIn still saying which were saved, and its symbols. A spread keeps none of the secrets, so a copy
|
|
187
|
+
* that is read for a key is made with this (env-copy.test.mjs scans for spreads). */
|
|
188
|
+
export const copyEnv = (env) => Object.create(Object.getPrototypeOf(env), Object.getOwnPropertyDescriptors(env));
|
|
185
189
|
/** The secrets of `env` (one withSecrets made) that were saved on the server, not its own, by name. */
|
|
186
190
|
export const savedIn = (env) => env[SAVED] ?? new Set();
|
|
187
191
|
/** The environment a child gets: `env` with every secret name taken out, and every other name shaped like a key
|
|
@@ -398,26 +402,54 @@ const urlSpans = (value) => {
|
|
|
398
402
|
};
|
|
399
403
|
/** The breaks between a header value's `name=value` pairs: `;`, `&`, a comma (or its `%2C`) and spaces; and, for a
|
|
400
404
|
* second, finer read, also `?`, `#` and `/`, so a pair inside a URL that is itself a pair's value
|
|
401
|
-
* (`upstream=https://relay/v1#access_token=<token>`) or a path's segment stands alone; and
|
|
402
|
-
* so a credential with a
|
|
405
|
+
* (`upstream=https://relay/v1#access_token=<token>`) or a path's segment stands alone; and three whole reads, which keep
|
|
406
|
+
* a raw `;` in a value: all but `;` (LIST_BREAK), so a credential with a `;` in a list joined by `%2C`, the usual way to
|
|
407
|
+
* write one (`api_key=<key;rest>%2Cregion=us`), is held as itself, and `&` and spaces alone (WHOLE_BREAK), so one with
|
|
408
|
+
* a comma in it too (`api_key=<key;rest%2Cmore>®ion=us`) is held whole, and again at their `%26` and `%20`
|
|
409
|
+
* (ENCODED_BREAK), so that key before an encoded `&` or space is held as written too, not only decoded, and again at
|
|
410
|
+
* `%26` alone (ENCODED_AMP_BREAK), so a key with a `%20` in it before a `%26` is held, as written and decoded; a text
|
|
411
|
+
* with neither (ENCODED_SEEN) splits at both as at WHOLE_BREAK, so those reads are skipped for it. All are held:
|
|
412
|
+
* every redactor matches a held value exactly, so the longer reading of any never covers a line quoting the key alone.
|
|
413
|
+
* WHOLE_BREAK also holds a value with the comma that ends it (sentry's `sentry_key=<key>%2C`); the others hold the value
|
|
414
|
+
* alone. */
|
|
403
415
|
const PAIR_BREAK = /[;&,\s]+|%2C/i;
|
|
404
416
|
const PIECE_BREAK = /[;&,\s?#/]+|%2C/i;
|
|
405
|
-
const
|
|
417
|
+
const LIST_BREAK = /[&,\s]+|%2C/i;
|
|
418
|
+
const WHOLE_BREAK = /[&\s]+/;
|
|
419
|
+
const ENCODED_BREAK = /[&\s]+|%26|%20/i;
|
|
420
|
+
const ENCODED_AMP_BREAK = /[&\s]+|%26/i;
|
|
421
|
+
const ENCODED_SEEN = /%26|%20/i;
|
|
422
|
+
/** What a credential's value whose part before its first `;` is empty (`;<key>`) holds after that `;`, whole and up to
|
|
423
|
+
* its next `;`, as a reader that skips an empty part reads it; nothing for any other value. */
|
|
424
|
+
const afterEmpty = (value) => {
|
|
425
|
+
if (!value.startsWith(";"))
|
|
426
|
+
return [];
|
|
427
|
+
const after = value.replace(/^;+/, "");
|
|
428
|
+
return [after, after.split(";")[0]];
|
|
429
|
+
};
|
|
406
430
|
/** The value of each `name=value` pair of `text` split at `breaks` whose name says it is a credential (credentialNamed),
|
|
407
|
-
* out of any quotes around it, as written and decoded. A name is what follows the last
|
|
408
|
-
* `=` (a URL's query or fragment, `https://relay/v1?region=us`, names `region`). A
|
|
409
|
-
*
|
|
431
|
+
* out of any quotes around it, raw or written `%22` or `%27`, as written and decoded. A name is what follows the last
|
|
432
|
+
* `/`, `?`, `#` or `:` before its `=` (a URL's query or fragment, `https://relay/v1?region=us`, names `region`). A
|
|
433
|
+
* value whose part before its first `;` is empty, as written or decoded (`token=;<key>` read whole, `token=%3B<key>`),
|
|
434
|
+
* is taken after that `;` too (afterEmpty). A value of only `=`, `;` and quotes, as written or decoded (a base64 credential's padding read as a
|
|
435
|
+
* pair, `token=;` before a space, a lone `'` or its `%27`), is not taken: otlpHeaderCut has no length floor, and it
|
|
436
|
+
* would cut that character everywhere in the tracer's lines. */
|
|
410
437
|
const pairValues = (text, breaks) => text.split(breaks).flatMap((pair) => {
|
|
411
438
|
const at = pair.indexOf("=");
|
|
412
439
|
if (at <= 0)
|
|
413
440
|
return [];
|
|
414
441
|
const name = pair.slice(0, at).split(/[/?#:]/).at(-1) ?? "";
|
|
415
|
-
|
|
416
|
-
|
|
442
|
+
if (!credentialNamed(decoded(name) ?? name))
|
|
443
|
+
return [];
|
|
444
|
+
const inner = pair.slice(at + 1).replace(/^(["']|%22|%27)(.*)\1$/, "$2");
|
|
445
|
+
return [inner, ...afterEmpty(inner)]
|
|
446
|
+
.flatMap((value) => [value, decoded(value) ?? value])
|
|
447
|
+
.concat(afterEmpty(decoded(inner) ?? inner))
|
|
448
|
+
.filter((value) => /[^=;"']/.test(value));
|
|
417
449
|
});
|
|
418
450
|
/** The credentials a header value carries inside it, the union of two reads over the whole value as written: the value
|
|
419
|
-
* of each `name=value` pair whose name says it is a credential (pairValues, at each of PAIR_BREAK, PIECE_BREAK
|
|
420
|
-
* WHOLE_BREAK: a cookie's `session=<token>`, sentry's
|
|
451
|
+
* of each `name=value` pair whose name says it is a credential (pairValues, at each of PAIR_BREAK, PIECE_BREAK,
|
|
452
|
+
* LIST_BREAK, WHOLE_BREAK, ENCODED_BREAK and ENCODED_AMP_BREAK: a cookie's `session=<token>`, sentry's
|
|
421
453
|
* `sentry_key=<key>`, a path's `;jsessionid=<id>`, a URL query's or fragment's `session=` or `access_token=`), and the
|
|
422
454
|
* user, password and key parameters of each URL in it (urlSpans, urlCredentials: a DSN's `https://<key>@host/1`, a
|
|
423
455
|
* relay's whole `user:pa;ss`). A URL only adds readings: the pair read covers its text too. A value that escapes its
|
|
@@ -429,7 +461,9 @@ const innerCredentials = (value) => {
|
|
|
429
461
|
return [
|
|
430
462
|
...pairValues(text, PAIR_BREAK),
|
|
431
463
|
...pairValues(text, PIECE_BREAK),
|
|
464
|
+
...pairValues(text, LIST_BREAK),
|
|
432
465
|
...pairValues(text, WHOLE_BREAK),
|
|
466
|
+
...(ENCODED_SEEN.test(text) ? [...pairValues(text, ENCODED_BREAK), ...pairValues(text, ENCODED_AMP_BREAK)] : []),
|
|
433
467
|
...urlSpans(text).flatMap(({ start, end }) => urlCredentials(text, start, end, queriesRead)),
|
|
434
468
|
];
|
|
435
469
|
};
|
package/dist/server-fs.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ export declare const defaultData: (env?: NodeJS.ProcessEnv) => string;
|
|
|
15
15
|
/** The server's own data directory, on its reading of the environment (startServe): an npx hint names it (adapters.ts
|
|
16
16
|
* npxLine). */
|
|
17
17
|
export declare const DATA_ENV = "AGENTRUN_SERVE_DATA";
|
|
18
|
-
/** Agent `agentId`'s folder on the disk, which holds its
|
|
18
|
+
/** Agent `agentId`'s folder on the disk, which holds its runs: `<data>/disk/agents/<agent>`. */
|
|
19
19
|
/** The folder of a data directory that holds each agent's disk: its runs and its learning. */
|
|
20
20
|
export declare const DISK_DIR = "disk";
|
|
21
21
|
/** Agent `agentId`'s folder on the disk of data directory `data`: `<data>/disk/agents/<name>`. */
|
package/dist/server-fs.js
CHANGED
|
@@ -31,7 +31,7 @@ export const defaultData = (env = process.env) => join(env.XDG_DATA_HOME || join
|
|
|
31
31
|
/** The server's own data directory, on its reading of the environment (startServe): an npx hint names it (adapters.ts
|
|
32
32
|
* npxLine). */
|
|
33
33
|
export const DATA_ENV = "AGENTRUN_SERVE_DATA";
|
|
34
|
-
/** Agent `agentId`'s folder on the disk, which holds its
|
|
34
|
+
/** Agent `agentId`'s folder on the disk, which holds its runs: `<data>/disk/agents/<agent>`. */
|
|
35
35
|
/** The folder of a data directory that holds each agent's disk: its runs and its learning. */
|
|
36
36
|
export const DISK_DIR = "disk";
|
|
37
37
|
/** An agent's folder's name on the disk: its id in lower case, then 16 hex digits of the id's SHA-256, so ids that differ
|
package/dist/server-keys.d.ts
CHANGED
|
@@ -24,6 +24,12 @@ export declare function openSealed(sealKey: Buffer, name: string, sealed: Uint8A
|
|
|
24
24
|
export declare function putSealedKey(store: {
|
|
25
25
|
sealedKeys: Pick<SealedKeys, "put">;
|
|
26
26
|
}, sealKey: Buffer, name: string, value: string): Promise<void>;
|
|
27
|
+
/** The value kept under `name`, opened now: the one saved there that opens under `sealKey`, else `value`, saved so that of
|
|
28
|
+
* writers racing on the row one's is kept and every one reads it back. A row that does not open (sealed under another
|
|
29
|
+
* key, or damaged) is replaced only while it holds the bytes read. Undefined only when the row still does not open. */
|
|
30
|
+
export declare function keepSealedKey(store: {
|
|
31
|
+
sealedKeys: Pick<SealedKeys, "get" | "putIfAbsent" | "replaceIf">;
|
|
32
|
+
}, sealKey: Buffer, name: string, value: string): Promise<string | undefined>;
|
|
27
33
|
/** The value saved under `name`, opened now; undefined with none saved, or one that does not open under this seal key
|
|
28
34
|
* (sealed under another key, or damaged). Never a value the store could read in the clear. */
|
|
29
35
|
export declare function getSealedKey(store: {
|
package/dist/server-keys.js
CHANGED
|
@@ -32,6 +32,18 @@ export function openSealed(sealKey, name, sealed, fp) {
|
|
|
32
32
|
export async function putSealedKey(store, sealKey, name, value) {
|
|
33
33
|
await store.sealedKeys.put(name, sealColumn(sealKey, sealedAt.sealedKey(name), value));
|
|
34
34
|
}
|
|
35
|
+
/** The value kept under `name`, opened now: the one saved there that opens under `sealKey`, else `value`, saved so that of
|
|
36
|
+
* writers racing on the row one's is kept and every one reads it back. A row that does not open (sealed under another
|
|
37
|
+
* key, or damaged) is replaced only while it holds the bytes read. Undefined only when the row still does not open. */
|
|
38
|
+
export async function keepSealedKey(store, sealKey, name, value) {
|
|
39
|
+
const was = await store.sealedKeys.get(name);
|
|
40
|
+
const sealed = sealColumn(sealKey, sealedAt.sealedKey(name), value);
|
|
41
|
+
if (was === undefined)
|
|
42
|
+
await store.sealedKeys.putIfAbsent(name, sealed);
|
|
43
|
+
else if (!("value" in openSealed(sealKey, name, was, undefined)))
|
|
44
|
+
await store.sealedKeys.replaceIf(name, was, sealed);
|
|
45
|
+
return getSealedKey(store, sealKey, name);
|
|
46
|
+
}
|
|
35
47
|
/** The value saved under `name`, opened now; undefined with none saved, or one that does not open under this seal key
|
|
36
48
|
* (sealed under another key, or damaged). Never a value the store could read in the clear. */
|
|
37
49
|
export async function getSealedKey(store, sealKey, name) {
|
package/dist/server.d.ts
CHANGED
|
@@ -9,6 +9,7 @@ import { type Place } from "./place.js";
|
|
|
9
9
|
import { type ApiToken } from "./api-token.js";
|
|
10
10
|
import { type CutScrub } from "./run-export.js";
|
|
11
11
|
import { type Store } from "./store/index.js";
|
|
12
|
+
import { type Machine } from "./local-model.js";
|
|
12
13
|
import { type BoxOffer, type ContainerFacts } from "./place-offers.js";
|
|
13
14
|
import { type Wait } from "./docker-host-addresses.js";
|
|
14
15
|
import { type StoredKeys } from "./secrets.js";
|
|
@@ -202,6 +203,12 @@ export type ServeOptions = {
|
|
|
202
203
|
/** How often a timeline page that waits (`wait_ms`) reads the store again while nothing changed (default 1000 ms,
|
|
203
204
|
* run-reads-over-store.ts). A test's server reads sooner, so a change is served without the rest of a second's wait. */
|
|
204
205
|
timelinePollMs?: number;
|
|
206
|
+
/** For tests: this machine as GET /settings/local-model reads it (local-model.ts Machine), in place of the real one, so no
|
|
207
|
+
* test reads the hardware it runs on. */
|
|
208
|
+
machine?: () => Promise<Machine>;
|
|
209
|
+
/** For tests: how long a local model pull may go with no byte from Ollama before it stops (ollama-provider.ts
|
|
210
|
+
* PULL_STALL_MS, two minutes, by default). */
|
|
211
|
+
pullStallMs?: number;
|
|
205
212
|
/** No runner beside this server in its process (the CLI's --no-runner, the image's server-and-runner): a paired
|
|
206
213
|
* computer's socket is held here while no run holds it, and relayed to the runner that holds a run of it
|
|
207
214
|
* (workspace/paired-route.ts); while no runner relays, a pairing code, the pair answer and each paired computer say no
|
|
@@ -257,7 +264,7 @@ export type ServeOptions = {
|
|
|
257
264
|
/** A test's seam: the scrubber GET /runs/{id}/export cuts with (run-export.ts), in place of secret-cut.ts scrub. */
|
|
258
265
|
shareScrub?: CutScrub;
|
|
259
266
|
/** A test's seam: step 2 of DELETE /agents/{id} (agent-delete.ts) in place of the learning module's deleteLearning over
|
|
260
|
-
* the agent's learning
|
|
267
|
+
* the agent's learning (learn/delete.ts), the server's own. */
|
|
261
268
|
deleteLearning?: DeleteLearning;
|
|
262
269
|
/** A test's seam: awaited at each step's point of DELETE /agents/{id} and DELETE /runs/{id} (agent-delete.ts
|
|
263
270
|
* AgentDeleteStep), with the agent's id or the run's, so a throw there stops the delete as a crash would. */
|
|
@@ -439,16 +446,18 @@ export declare function readingOf(base: NodeJS.ProcessEnv, maxRuns: number, stor
|
|
|
439
446
|
run_memory_mib: number;
|
|
440
447
|
needs?: import("./harness.js").HarnessNeed[];
|
|
441
448
|
}[];
|
|
442
|
-
/** The places a revision may name (`definition.place`), this host's default
|
|
449
|
+
/** The places a revision may name (`definition.place`), this host's default (null where a new agent must name one),
|
|
450
|
+
* and whether this server has each box. */
|
|
443
451
|
places: {
|
|
444
452
|
boxes: BoxOffer[];
|
|
445
453
|
allow: string[];
|
|
446
454
|
default_place: Place;
|
|
455
|
+
default_reason?: undefined;
|
|
447
456
|
modes: ("runner" | "sandbox")[];
|
|
448
457
|
} | {
|
|
449
458
|
boxes: BoxOffer[];
|
|
450
459
|
allow: string[];
|
|
451
|
-
default_place:
|
|
460
|
+
default_place: null;
|
|
452
461
|
default_reason: string;
|
|
453
462
|
modes: ("runner" | "sandbox")[];
|
|
454
463
|
};
|
|
@@ -561,7 +570,7 @@ export declare function readingOf(base: NodeJS.ProcessEnv, maxRuns: number, stor
|
|
|
561
570
|
* `models.default`, `models.strong`) with the tools it names of `node_tools`; a node that names no thinking level
|
|
562
571
|
* thinks at the run's effort, or medium. */
|
|
563
572
|
workflows: {
|
|
564
|
-
nodes: ("agent" | "
|
|
573
|
+
nodes: ("agent" | "decide" | "extract" | "report")[];
|
|
565
574
|
node_tools: string[];
|
|
566
575
|
adapters: string[];
|
|
567
576
|
decisions: {
|
|
@@ -656,14 +665,12 @@ export declare function readingOf(base: NodeJS.ProcessEnv, maxRuns: number, stor
|
|
|
656
665
|
at_rest: string;
|
|
657
666
|
};
|
|
658
667
|
/** GET /settings/harness-keys and PUT/DELETE of one key: a plan-billed recipe's keys, saved for that harness alone
|
|
659
|
-
* (harness-keys.ts); `harnesses` its ids here
|
|
660
|
-
*
|
|
661
|
-
* there is one or a key to remove. */
|
|
668
|
+
* (harness-keys.ts); `harnesses` its ids here. The page's own GET lists the ids with keys kept whose recipe the
|
|
669
|
+
* server no longer names, so the console offers the page on `routes`, as it does tool keys'. */
|
|
662
670
|
harness_keys: {
|
|
663
671
|
routes: boolean;
|
|
664
672
|
at_rest: string;
|
|
665
673
|
harnesses: string[];
|
|
666
|
-
kept: string[];
|
|
667
674
|
};
|
|
668
675
|
/** /settings/mcp-servers: remote MCP servers previewed and saved, each credential sealed under the server's seal key,
|
|
669
676
|
* which always exists (seal-key.ts), so MCP credentials are always kept sealed. Every harness of the table runs a
|
|
@@ -790,16 +797,18 @@ export declare function capabilities(env?: NodeJS.ProcessEnv, maxRuns?: number,
|
|
|
790
797
|
run_memory_mib: number;
|
|
791
798
|
needs?: import("./harness.js").HarnessNeed[];
|
|
792
799
|
}[];
|
|
793
|
-
/** The places a revision may name (`definition.place`), this host's default
|
|
800
|
+
/** The places a revision may name (`definition.place`), this host's default (null where a new agent must name one),
|
|
801
|
+
* and whether this server has each box. */
|
|
794
802
|
places: {
|
|
795
803
|
boxes: BoxOffer[];
|
|
796
804
|
allow: string[];
|
|
797
805
|
default_place: Place;
|
|
806
|
+
default_reason?: undefined;
|
|
798
807
|
modes: ("runner" | "sandbox")[];
|
|
799
808
|
} | {
|
|
800
809
|
boxes: BoxOffer[];
|
|
801
810
|
allow: string[];
|
|
802
|
-
default_place:
|
|
811
|
+
default_place: null;
|
|
803
812
|
default_reason: string;
|
|
804
813
|
modes: ("runner" | "sandbox")[];
|
|
805
814
|
};
|
|
@@ -912,7 +921,7 @@ export declare function capabilities(env?: NodeJS.ProcessEnv, maxRuns?: number,
|
|
|
912
921
|
* `models.default`, `models.strong`) with the tools it names of `node_tools`; a node that names no thinking level
|
|
913
922
|
* thinks at the run's effort, or medium. */
|
|
914
923
|
workflows: {
|
|
915
|
-
nodes: ("agent" | "
|
|
924
|
+
nodes: ("agent" | "decide" | "extract" | "report")[];
|
|
916
925
|
node_tools: string[];
|
|
917
926
|
adapters: string[];
|
|
918
927
|
decisions: {
|
|
@@ -1007,14 +1016,12 @@ export declare function capabilities(env?: NodeJS.ProcessEnv, maxRuns?: number,
|
|
|
1007
1016
|
at_rest: string;
|
|
1008
1017
|
};
|
|
1009
1018
|
/** GET /settings/harness-keys and PUT/DELETE of one key: a plan-billed recipe's keys, saved for that harness alone
|
|
1010
|
-
* (harness-keys.ts); `harnesses` its ids here
|
|
1011
|
-
*
|
|
1012
|
-
* there is one or a key to remove. */
|
|
1019
|
+
* (harness-keys.ts); `harnesses` its ids here. The page's own GET lists the ids with keys kept whose recipe the
|
|
1020
|
+
* server no longer names, so the console offers the page on `routes`, as it does tool keys'. */
|
|
1013
1021
|
harness_keys: {
|
|
1014
1022
|
routes: boolean;
|
|
1015
1023
|
at_rest: string;
|
|
1016
1024
|
harnesses: string[];
|
|
1017
|
-
kept: string[];
|
|
1018
1025
|
};
|
|
1019
1026
|
/** /settings/mcp-servers: remote MCP servers previewed and saved, each credential sealed under the server's seal key,
|
|
1020
1027
|
* which always exists (seal-key.ts), so MCP credentials are always kept sealed. Every harness of the table runs a
|