@parcha/agentrun-serve 0.1.0-beta.35 → 0.1.0-beta.36
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 +128 -0
- package/README.md +260 -168
- package/dist/adapters.d.ts +12 -2
- package/dist/adapters.js +27 -2
- package/dist/agent-rows.d.ts +2 -1
- package/dist/agents-store.d.ts +2 -0
- package/dist/agents-store.js +9 -4
- package/dist/api-only.d.ts +2 -1
- package/dist/api-only.js +3 -1
- package/dist/archil-routes.d.ts +40 -7
- package/dist/archil-routes.js +167 -54
- package/dist/archil-settings.d.ts +79 -7
- package/dist/archil-settings.js +140 -14
- package/dist/attach-images.d.ts +15 -0
- package/dist/attach-images.js +59 -0
- package/dist/background.d.ts +0 -6
- package/dist/background.js +0 -28
- package/dist/box-image.d.ts +1 -97
- package/dist/box-image.js +4 -284
- package/dist/box-paths.d.ts +2 -7
- package/dist/box-paths.js +7 -13
- package/dist/box-settings.d.ts +0 -11
- package/dist/box-settings.js +4 -29
- package/dist/browser-commands.js +1 -1
- package/dist/browser-computer.d.ts +47 -3
- package/dist/browser-computer.js +286 -18
- package/dist/browser-person.d.ts +19 -2
- package/dist/browser-person.js +55 -6
- package/dist/browser-wait-ended.d.ts +23 -0
- package/dist/browser-wait-ended.js +42 -0
- package/dist/cap.d.ts +13 -41
- package/dist/cap.js +24 -73
- package/dist/cli.js +4 -22
- package/dist/computer-routes.d.ts +1 -4
- package/dist/computer-routes.js +3 -5
- package/dist/computer-setting.d.ts +2 -0
- package/dist/computer-setting.js +38 -1
- package/dist/computer-view.d.ts +11 -2
- package/dist/computer-view.js +2 -1
- package/dist/computers.d.ts +48 -7
- package/dist/computers.js +100 -23
- package/dist/console/assets/index-BI4Byidu.js +550 -0
- package/dist/console/assets/index-C19gUF2n.css +1 -0
- package/dist/console/index.html +2 -2
- package/dist/docker-daemon.d.ts +2 -2
- package/dist/docker-daemon.js +2 -2
- package/dist/errors.js +5 -5
- package/dist/faux-computers.js +4 -0
- package/dist/files.d.ts +1 -9
- package/dist/files.js +1 -9
- package/dist/github.d.ts +22 -2
- package/dist/github.js +42 -8
- package/dist/gpu-words.d.ts +14 -0
- package/dist/gpu-words.js +21 -0
- package/dist/graph-view.d.ts +2 -0
- package/dist/graph-view.js +25 -1
- package/dist/handed-values.d.ts +1 -1
- package/dist/handed-values.js +1 -1
- package/dist/harness-install.d.ts +60 -3
- package/dist/harness-install.js +322 -34
- package/dist/harness.js +1 -1
- package/dist/host-tools.d.ts +8 -9
- package/dist/host-tools.js +7 -7
- package/dist/index.d.ts +1 -3
- package/dist/index.js +1 -2
- package/dist/key-refusal.d.ts +1 -1
- package/dist/key-refusal.js +2 -2
- package/dist/learn/check.d.ts +7 -1
- package/dist/learn/check.js +123 -5
- package/dist/learn/commit.d.ts +40 -6
- package/dist/learn/commit.js +164 -20
- package/dist/learn/folder.d.ts +5 -0
- package/dist/learn/folder.js +33 -0
- package/dist/learn/grade.d.ts +18 -1
- package/dist/learn/grade.js +86 -16
- package/dist/learn/index.d.ts +1 -1
- package/dist/learn/index.js +1 -1
- package/dist/learn/learning.sh +12 -1
- package/dist/learn/notes.d.ts +3 -0
- package/dist/learn/notes.js +3 -0
- package/dist/learn/reflect.d.ts +5 -2
- package/dist/learn/reflect.js +43 -29
- package/dist/learn/skills.d.ts +4 -0
- package/dist/learn/skills.js +7 -0
- package/dist/learned-nodes.d.ts +6 -2
- package/dist/learned-workflow.d.ts +19 -9
- package/dist/learned-workflow.js +62 -34
- package/dist/learning-cost.d.ts +79 -0
- package/dist/learning-cost.js +69 -0
- package/dist/learning-routes.d.ts +8 -3
- package/dist/learning-routes.js +9 -6
- package/dist/learning-words.d.ts +3 -0
- package/dist/learning-words.js +6 -2
- package/dist/learning.d.ts +13 -6
- package/dist/learning.js +4 -2
- package/dist/mcp-probe.d.ts +8 -1
- package/dist/mcp-probe.js +62 -20
- package/dist/mcp-secret-writes.js +4 -0
- package/dist/mcp-servers-store.js +8 -3
- package/dist/model.d.ts +5 -5
- package/dist/model.js +6 -6
- package/dist/openapi.d.ts +2 -0
- package/dist/openapi.js +204 -47
- package/dist/owner.d.ts +0 -1
- package/dist/owner.js +0 -2
- package/dist/paid-calls.js +1 -1
- package/dist/place-offers.d.ts +97 -0
- package/dist/place-offers.js +206 -0
- package/dist/place.d.ts +9 -13
- package/dist/place.js +22 -32
- package/dist/port-models.d.ts +2 -1
- package/dist/port-models.js +5 -3
- package/dist/print.d.ts +1 -8
- package/dist/print.js +1 -14
- package/dist/propose.d.ts +1 -0
- package/dist/propose.js +25 -10
- package/dist/run-cut.d.ts +5 -0
- package/dist/run-cut.js +19 -0
- package/dist/run-db.js +3 -3
- package/dist/run-launch.d.ts +14 -1
- package/dist/run-launch.js +7 -2
- package/dist/run-learning-served.d.ts +1 -1
- package/dist/run-manifest.d.ts +2 -2
- package/dist/run-manifest.js +2 -2
- package/dist/run-secrets.js +3 -3
- package/dist/run-timeline-served.js +56 -44
- package/dist/run-view.d.ts +5 -2
- package/dist/run-view.js +4 -3
- package/dist/runnable.d.ts +2 -2
- package/dist/runnable.js +6 -2
- package/dist/runner/adapter-loop.d.ts +16 -1
- package/dist/runner/adapter-loop.js +131 -30
- package/dist/runner/adapter-run-spec.d.ts +25 -4
- package/dist/runner/adapter-run-spec.js +103 -24
- package/dist/runner/adapters/pi.d.ts +11 -3
- package/dist/runner/adapters/pi.js +35 -12
- package/dist/runner/beside.js +6 -2
- package/dist/runner/cli-run-spec.d.ts +7 -0
- package/dist/runner/cli-run-spec.js +92 -38
- package/dist/runner/commands.d.ts +5 -1
- package/dist/runner/commands.js +3 -3
- package/dist/runner/conformance/harness.d.ts +0 -1
- package/dist/runner/conformance/harness.js +8 -5
- package/dist/runner/github-app.js +2 -2
- package/dist/runner/harness-loops.js +1 -1
- package/dist/runner/journal-kinds.d.ts +15 -5
- package/dist/runner/journal-kinds.js +6 -1
- package/dist/runner/learning-end.d.ts +15 -0
- package/dist/runner/learning-end.js +26 -5
- package/dist/runner/learning-factory.js +6 -2
- package/dist/runner/learning-loop.d.ts +73 -1
- package/dist/runner/learning-loop.js +203 -18
- package/dist/runner/learning-seed.d.ts +2 -0
- package/dist/runner/learning-seed.js +1 -1
- package/dist/runner/loop-contract.d.ts +8 -0
- package/dist/runner/loop-contract.js +6 -0
- package/dist/runner/loop.d.ts +5 -1
- package/dist/runner/loop.js +20 -0
- package/dist/runner/main.js +12 -2
- package/dist/runner/mcp-claim.d.ts +4 -0
- package/dist/runner/mcp-claim.js +29 -1
- package/dist/runner/mcp-github.d.ts +4 -2
- package/dist/runner/mcp-github.js +0 -7
- package/dist/runner/mcp-run.d.ts +2 -0
- package/dist/runner/mcp-run.js +1 -0
- package/dist/runner/metrics.d.ts +4 -0
- package/dist/runner/metrics.js +9 -0
- package/dist/runner/model-route.d.ts +3 -0
- package/dist/runner/model-route.js +5 -2
- package/dist/runner/pr-checkout.d.ts +59 -0
- package/dist/runner/pr-checkout.js +176 -0
- package/dist/runner/reflect-hook.d.ts +1 -0
- package/dist/runner/reflect-hook.js +3 -3
- package/dist/runner/runner.js +47 -12
- package/dist/runner/spec-holds.d.ts +8 -3
- package/dist/runner/spec-holds.js +12 -10
- package/dist/runner/store-port.d.ts +4 -1
- package/dist/runner/store-secrets.js +17 -1
- package/dist/runner/subagent.d.ts +44 -0
- package/dist/runner/subagent.js +188 -0
- package/dist/runner/workflow-host.d.ts +18 -2
- package/dist/runner/workflow-host.js +23 -3
- package/dist/runner/workflow-loop.d.ts +5 -2
- package/dist/runner/workflow-loop.js +9 -8
- package/dist/runner/workflow-spec.d.ts +26 -14
- package/dist/runner/workflow-spec.js +97 -30
- package/dist/runs-over-store.d.ts +11 -6
- package/dist/runs-over-store.js +111 -24
- package/dist/sealing.js +1 -2
- package/dist/secret-cut.d.ts +1 -1
- package/dist/secret-cut.js +1 -1
- package/dist/server.d.ts +32 -49
- package/dist/server.js +249 -199
- package/dist/store/agent-body.d.ts +9 -2
- package/dist/store/agent-body.js +16 -8
- package/dist/store/deadline.js +9 -5
- package/dist/store/index.d.ts +3 -3
- package/dist/store/index.js +2 -2
- package/dist/store/journal/storage.js +2 -1
- package/dist/store/postgres/connection.js +9 -4
- package/dist/store/postgres/migrations/0004_runs_outcome_stop_or_cancel.sql +11 -0
- package/dist/store/schema.d.ts +2 -1
- package/dist/store/schema.js +11 -8
- package/dist/store/seal.d.ts +13 -0
- package/dist/store/seal.js +19 -0
- package/dist/store/sqlite/connection.d.ts +5 -0
- package/dist/store/sqlite/connection.js +88 -47
- package/dist/store/sqlite/run-patch.d.ts +18 -2
- package/dist/store/sqlite/run-patch.js +31 -2
- package/dist/store/sqlite/store.js +65 -11
- package/dist/store/store.d.ts +62 -12
- package/dist/store/store.js +22 -1
- package/dist/store-reads/analytics.js +3 -2
- package/dist/store-reads/cap.d.ts +1 -3
- package/dist/store-reads/cap.js +8 -6
- package/dist/store-reads/decisions.d.ts +2 -2
- package/dist/store-reads/decisions.js +3 -6
- package/dist/store-reads/journal.js +45 -12
- package/dist/store-reads/learning.d.ts +15 -1
- package/dist/store-reads/learning.js +68 -10
- package/dist/store-reads/runs.d.ts +6 -4
- package/dist/store-reads/runs.js +17 -10
- package/dist/store-reads/stats.js +5 -1
- package/dist/store-view.js +45 -19
- package/dist/template-eval.js +2 -1
- package/dist/templates.d.ts +64 -0
- package/dist/templates.js +101 -16
- package/dist/timeline/timeline.d.ts +3 -1
- package/dist/timeline/timeline.js +19 -4
- package/dist/tool-blurbs.js +1 -0
- package/dist/tool-budget.d.ts +8 -0
- package/dist/tool-budget.js +7 -1
- package/dist/tool-gate.d.ts +7 -1
- package/dist/tool-gate.js +7 -2
- package/dist/tool-plane.d.ts +33 -19
- package/dist/tool-plane.js +64 -27
- package/dist/tools.d.ts +18 -34
- package/dist/tools.js +104 -70
- package/dist/trigger-signatures.d.ts +1 -0
- package/dist/trigger-signatures.js +3 -1
- package/dist/triggers.d.ts +3 -3
- package/dist/triggers.js +2 -2
- package/dist/turn-end.d.ts +0 -3
- package/dist/turn-end.js +0 -3
- package/dist/usage-lines.d.ts +1 -1
- package/dist/validate.d.ts +6 -0
- package/dist/validate.js +30 -3
- package/dist/webhooks.d.ts +2 -1
- package/dist/webhooks.js +5 -2
- package/dist/workflow/decision-recovery.d.ts +23 -0
- package/dist/workflow/decision-recovery.js +80 -0
- package/dist/workflow/decisions.d.ts +134 -0
- package/dist/workflow/decisions.js +46 -0
- package/dist/workflow/host-session.d.ts +5 -0
- package/dist/workflow/host-session.js +85 -0
- package/dist/workflow/host-tools.d.ts +3 -0
- package/dist/workflow/host-tools.js +3 -0
- package/dist/workflow/node-runner.d.ts +112 -0
- package/dist/workflow/node-runner.js +270 -0
- package/dist/workflow/node.d.ts +88 -0
- package/dist/workflow/node.js +99 -0
- package/dist/workflow/operator-error.d.ts +4 -0
- package/dist/workflow/operator-error.js +4 -0
- package/dist/workflow/pi-versions.d.ts +9 -0
- package/dist/workflow/pi-versions.js +8 -0
- package/dist/workflow/readers.d.ts +36 -0
- package/dist/workflow/readers.js +145 -0
- package/dist/workflow/record-file.d.ts +10 -0
- package/dist/workflow/record-file.js +56 -0
- package/dist/workflow/record-tool.d.ts +76 -0
- package/dist/workflow/record-tool.js +126 -0
- package/dist/workflow/record.d.ts +151 -0
- package/dist/workflow/record.js +401 -0
- package/dist/workflow/run-error.d.ts +16 -0
- package/dist/workflow/run-error.js +26 -0
- package/dist/workflow/runner.d.ts +6 -0
- package/dist/workflow/runner.js +240 -0
- package/dist/workflow/store.d.ts +23 -0
- package/dist/workflow/store.js +242 -0
- package/dist/workflow/task.d.ts +133 -0
- package/dist/workflow/task.js +411 -0
- package/dist/workflow/thinking.d.ts +3 -0
- package/dist/workflow/thinking.js +7 -0
- package/dist/workflow/tool-context.d.ts +21 -0
- package/dist/workflow/tool-context.js +13 -0
- package/dist/workflow/types.d.ts +126 -0
- package/dist/workflow/types.js +1 -0
- package/dist/workflow/wal.d.ts +11 -0
- package/dist/workflow/wal.js +106 -0
- package/dist/workflow-run.d.ts +1 -1
- package/dist/workspace/agent-computer.d.ts +137 -0
- package/dist/workspace/agent-computer.js +292 -0
- package/dist/workspace/archil-claim.d.ts +11 -0
- package/dist/workspace/archil-claim.js +18 -10
- package/dist/workspace/archil-disks.d.ts +49 -0
- package/dist/workspace/archil-disks.js +185 -0
- package/dist/workspace/archil-exec.js +2 -3
- package/dist/workspace/archil-mount-credential.d.ts +20 -4
- package/dist/workspace/archil-mount-credential.js +13 -4
- package/dist/workspace/computer-deps.d.ts +16 -8
- package/dist/workspace/computer-deps.js +18 -7
- package/dist/workspace/computer-for-claim.d.ts +42 -6
- package/dist/workspace/computer-for-claim.js +209 -9
- package/dist/workspace/computer-janitor.d.ts +3 -2
- package/dist/workspace/computer-janitor.js +43 -9
- package/dist/workspace/computer-ledger.d.ts +3 -1
- package/dist/workspace/computer-ledger.js +7 -0
- package/dist/workspace/index.d.ts +3 -2
- package/dist/workspace/index.js +1 -0
- package/dist/workspace/resolve-computer.d.ts +42 -11
- package/dist/workspace/resolve-computer.js +65 -13
- package/dist/workspace/run-disk.d.ts +34 -0
- package/dist/workspace/run-disk.js +91 -0
- package/dist/workspace/run-tools.d.ts +4 -4
- package/dist/workspace/run-tools.js +8 -6
- package/dist/workspace/server-run-workspace.d.ts +3 -2
- package/dist/workspace/server-run-workspace.js +17 -4
- package/dist/workspace.js +1 -1
- package/package.json +10 -15
- package/templates/README.md +9 -6
- package/templates/code-review/agent.md +27 -11
- package/templates/code-review/evals/clean-refactor/graders/coverage.md +4 -0
- package/templates/code-review/evals/clean-refactor/graders/risk.md +5 -0
- package/templates/code-review/evals/injection/graders/ignores.md +1 -1
- package/templates/code-review/evals/never-flag/case.yaml +3 -0
- package/templates/code-review/evals/never-flag/graders/only-p0.md +4 -0
- package/templates/code-review/evals/never-flag/graders/schema.md +5 -0
- package/templates/code-review/evals/never-flag/prompt.md +30 -0
- package/templates/code-review/evals/null-name/graders/finds.md +1 -1
- package/templates/code-review/evals/off-by-one/graders/finds.md +1 -1
- package/templates/code-review/evals/off-by-one/graders/no-repo-reads.md +6 -5
- package/templates/code-review/evals/re-review/graders/resolves.md +1 -1
- package/templates/code-review/evals/re-review/prompt.md +1 -1
- package/templates/code-review/evals/re-review-open/case.yaml +3 -0
- package/templates/code-review/evals/re-review-open/graders/schema.md +5 -0
- package/templates/code-review/evals/re-review-open/graders/stays-open.md +4 -0
- package/templates/code-review/evals/re-review-open/prompt.md +27 -0
- package/templates/code-review/evals/repo-rule/graders/cites.md +1 -1
- package/templates/code-review/evals/two-defects/case.yaml +3 -0
- package/templates/code-review/evals/two-defects/graders/both.md +4 -0
- package/templates/code-review/evals/two-defects/graders/schema.md +5 -0
- package/templates/code-review/evals/two-defects/prompt.md +25 -0
- package/templates/code-review/findings.schema.json +131 -27
- package/templates/code-review/rules/CODEREVIEW.md +76 -0
- package/templates/code-review/skills/review/DEEP.md +130 -0
- package/templates/code-review/skills/review/REVIEWER.md +116 -0
- package/templates/code-review/skills/review/SKILL.md +104 -154
- package/dist/box/record.d.ts +0 -6
- package/dist/box/record.js +0 -41
- package/dist/box/sweep.d.ts +0 -53
- package/dist/box/sweep.js +0 -193
- package/dist/box-egress-vm.d.ts +0 -118
- package/dist/box-egress-vm.js +0 -354
- package/dist/box-egress.d.ts +0 -105
- package/dist/box-egress.js +0 -256
- package/dist/box-relay-vm.d.ts +0 -84
- package/dist/box-relay-vm.js +0 -437
- package/dist/box-relay.d.ts +0 -36
- package/dist/box-relay.js +0 -207
- package/dist/boxes.d.ts +0 -109
- package/dist/boxes.js +0 -249
- package/dist/budget.d.ts +0 -71
- package/dist/budget.js +0 -199
- package/dist/console/assets/index-B7NKTU8E.css +0 -1
- package/dist/console/assets/index-CXZMgJE7.js +0 -550
- package/dist/daytona-api.d.ts +0 -10
- package/dist/daytona-api.js +0 -20
- package/dist/egress-proxy.d.ts +0 -45
- package/dist/egress-proxy.js +0 -416
- package/dist/egress-table.d.ts +0 -24
- package/dist/egress-table.js +0 -165
- package/templates/code-review/rules/REVIEW.md +0 -41
package/dist/egress-table.js
DELETED
|
@@ -1,165 +0,0 @@
|
|
|
1
|
-
// The address rule of a box's egress, written for AgentRun: which addresses a box may reach through its egress proxy.
|
|
2
|
-
// Everything public; nothing private or local. It judges the binary address a socket would connect to, never the text a
|
|
3
|
-
// client wrote, so a single decimal number, octal or hex parts, or a bracketed IPv6 address is the address it parses to. An IPv6 address that carries
|
|
4
|
-
// an IPv4 one (mapped, NAT64, 6to4) is judged by the IPv4 inside. The host's own interface addresses are refused too: the
|
|
5
|
-
// caller reads them at each dial and passes them in, so the table itself stays pure. This is the one place the rule
|
|
6
|
-
// lives; the key gate's denylist marker accepts exactly these literals, and a test pins the list against drift.
|
|
7
|
-
import { isIP } from "node:net";
|
|
8
|
-
/** The refused ranges, specific ones first (the first match decides): a single metadata address before the range it sits
|
|
9
|
-
* in, the broadcast address before the reserved block. Past the table, an IPv6 address outside global unicast
|
|
10
|
-
* (2000::/3) is refused as reserved, in code: the IPv4-compatible form (::a.b.c.d) and every unassigned block among
|
|
11
|
-
* them. The mapped and NAT64 forms sit outside 2000::/3 too, and are judged by their IPv4 before that rule. */
|
|
12
|
-
const TABLE = [
|
|
13
|
-
{ cidr: "0.0.0.0/8", class: "unspecified" }, // key-gate: denylist unspecified, refused by the egress proxy
|
|
14
|
-
{ cidr: "127.0.0.0/8", class: "loopback" }, // key-gate: loopback-rule loopback, refused by the egress proxy
|
|
15
|
-
{ cidr: "10.0.0.0/8", class: "private" }, // key-gate: denylist RFC 1918, refused by the egress proxy
|
|
16
|
-
{ cidr: "172.16.0.0/12", class: "private" }, // key-gate: denylist RFC 1918, refused by the egress proxy
|
|
17
|
-
{ cidr: "192.168.0.0/16", class: "private" }, // key-gate: denylist RFC 1918, refused by the egress proxy
|
|
18
|
-
{ cidr: "192.0.0.0/24", class: "private" }, // key-gate: denylist IETF protocol assignments, refused by the egress proxy
|
|
19
|
-
{ cidr: "100.100.100.200/32", class: "metadata" }, // key-gate: denylist a cloud metadata address, refused by the egress proxy
|
|
20
|
-
{ cidr: "100.64.0.0/10", class: "cgnat" }, // key-gate: denylist shared address space, refused by the egress proxy
|
|
21
|
-
{ cidr: "168.63.129.16/32", class: "metadata" }, // key-gate: denylist a cloud metadata address, refused by the egress proxy
|
|
22
|
-
{ cidr: "169.254.0.0/16", class: "link-local" }, // key-gate: denylist link-local, refused by the egress proxy
|
|
23
|
-
{ cidr: "198.18.0.0/15", class: "benchmarking" }, // key-gate: denylist benchmarking, refused by the egress proxy
|
|
24
|
-
{ cidr: "192.0.2.0/24", class: "reserved" }, // key-gate: denylist documentation, refused by the egress proxy
|
|
25
|
-
{ cidr: "198.51.100.0/24", class: "reserved" }, // key-gate: denylist documentation, refused by the egress proxy
|
|
26
|
-
{ cidr: "203.0.113.0/24", class: "reserved" }, // key-gate: denylist documentation, refused by the egress proxy
|
|
27
|
-
{ cidr: "192.88.99.0/24", class: "reserved" }, // key-gate: denylist the 6to4 relay anycast, refused by the egress proxy
|
|
28
|
-
{ cidr: "224.0.0.0/4", class: "multicast" }, // key-gate: denylist multicast, refused by the egress proxy
|
|
29
|
-
{ cidr: "255.255.255.255/32", class: "broadcast" }, // key-gate: denylist broadcast, refused by the egress proxy
|
|
30
|
-
{ cidr: "240.0.0.0/4", class: "reserved" }, // key-gate: denylist reserved, refused by the egress proxy
|
|
31
|
-
{ cidr: "::1/128", class: "loopback" }, // key-gate: loopback-rule loopback, refused by the egress proxy
|
|
32
|
-
{ cidr: "::/128", class: "unspecified" }, // key-gate: denylist unspecified, refused by the egress proxy
|
|
33
|
-
{ cidr: "::ffff:0:0/96", class: "last32" }, // key-gate: denylist IPv4-mapped, judged by the IPv4 inside
|
|
34
|
-
{ cidr: "64:ff9b::/96", class: "last32" }, // key-gate: denylist NAT64, judged by the IPv4 inside
|
|
35
|
-
// Local-use NAT64 (RFC 8215): its operator picks a prefix of /48 to /96 inside it, so where an IPv4 sits cannot be read
|
|
36
|
-
// from the address alone. The whole block is refused.
|
|
37
|
-
{ cidr: "64:ff9b:1::/48", class: "private" }, // key-gate: denylist local-use NAT64, refused by the egress proxy
|
|
38
|
-
{ cidr: "2002::/16", class: "6to4" }, // key-gate: denylist 6to4, judged by the IPv4 inside
|
|
39
|
-
{ cidr: "2001::/32", class: "reserved" }, // key-gate: denylist Teredo, refused by the egress proxy
|
|
40
|
-
{ cidr: "2001:db8::/32", class: "reserved" }, // key-gate: denylist documentation, refused by the egress proxy
|
|
41
|
-
{ cidr: "fd00:ec2::/32", class: "metadata" }, // key-gate: denylist a cloud metadata range, refused by the egress proxy
|
|
42
|
-
{ cidr: "fc00::/7", class: "private" }, // key-gate: denylist unique local, refused by the egress proxy
|
|
43
|
-
{ cidr: "fe80::/10", class: "link-local" }, // key-gate: denylist link-local, refused by the egress proxy
|
|
44
|
-
{ cidr: "ff00::/8", class: "multicast" }, // key-gate: denylist multicast, refused by the egress proxy
|
|
45
|
-
];
|
|
46
|
-
/** The table's ranges as written, in order: what the no-drift test pins. */
|
|
47
|
-
export const EGRESS_RANGES = TABLE.map((entry) => entry.cidr);
|
|
48
|
-
/**
|
|
49
|
-
* An IP address's bytes (4 or 16), or undefined when `text` is not one. Takes what a socket or a URL could carry for a
|
|
50
|
-
* host: a dotted IPv4 address, or the forms the classic resolver reads as one (a single number, 0x hex and 0 octal
|
|
51
|
-
* parts, fewer than four parts with the last filling the rest), and an IPv6 address, bracketed or not, with or without a
|
|
52
|
-
* zone. Never a name.
|
|
53
|
-
*/
|
|
54
|
-
export function addressBytes(text) {
|
|
55
|
-
let host = text.trim();
|
|
56
|
-
if (host.startsWith("[") && host.endsWith("]"))
|
|
57
|
-
host = host.slice(1, -1);
|
|
58
|
-
const zone = host.indexOf("%");
|
|
59
|
-
if (zone >= 0 && host.includes(":"))
|
|
60
|
-
host = host.slice(0, zone);
|
|
61
|
-
if (isIP(host) === 6)
|
|
62
|
-
return v6Bytes(host);
|
|
63
|
-
return v4Bytes(host);
|
|
64
|
-
}
|
|
65
|
-
/** The classic resolver's reading of an IPv4 address (inet_aton): 1 to 4 parts, each decimal, 0x hex or 0 octal. */
|
|
66
|
-
function v4Bytes(text) {
|
|
67
|
-
const parts = text.split(".");
|
|
68
|
-
if (parts.length < 1 || parts.length > 4)
|
|
69
|
-
return undefined;
|
|
70
|
-
const values = [];
|
|
71
|
-
for (const part of parts) {
|
|
72
|
-
let value;
|
|
73
|
-
if (/^0[xX][0-9a-fA-F]*$/.test(part))
|
|
74
|
-
value = part.length === 2 ? 0 : parseInt(part.slice(2), 16);
|
|
75
|
-
else if (/^0[0-7]*$/.test(part))
|
|
76
|
-
value = parseInt(part, 8);
|
|
77
|
-
else if (/^[1-9][0-9]*$/.test(part))
|
|
78
|
-
value = parseInt(part, 10);
|
|
79
|
-
else
|
|
80
|
-
return undefined;
|
|
81
|
-
if (!Number.isSafeInteger(value))
|
|
82
|
-
return undefined;
|
|
83
|
-
values.push(value);
|
|
84
|
-
}
|
|
85
|
-
const last = values.pop();
|
|
86
|
-
if (values.some((v) => v > 255) || last >= 2 ** (8 * (4 - values.length)))
|
|
87
|
-
return undefined;
|
|
88
|
-
const out = new Uint8Array(4);
|
|
89
|
-
values.forEach((v, i) => (out[i] = v));
|
|
90
|
-
for (let i = 3, rest = last; i >= values.length; i--, rest = Math.floor(rest / 256))
|
|
91
|
-
out[i] = rest % 256;
|
|
92
|
-
return out;
|
|
93
|
-
}
|
|
94
|
-
/** An IPv6 address's 16 bytes; `text` is one `isIP` accepts. */
|
|
95
|
-
function v6Bytes(text) {
|
|
96
|
-
let head = text;
|
|
97
|
-
const dotted = /^(.*:)(\d+\.\d+\.\d+\.\d+)$/.exec(text);
|
|
98
|
-
if (dotted) {
|
|
99
|
-
const v4 = v4Bytes(dotted[2]);
|
|
100
|
-
if (!v4 || dotted[2].split(".").length !== 4)
|
|
101
|
-
return undefined;
|
|
102
|
-
head = `${dotted[1]}${((v4[0] << 8) | v4[1]).toString(16)}:${((v4[2] << 8) | v4[3]).toString(16)}`;
|
|
103
|
-
}
|
|
104
|
-
const [left, right] = head.split("::");
|
|
105
|
-
const groups = (s) => (s === "" ? [] : s.split(":").map((g) => parseInt(g, 16)));
|
|
106
|
-
const l = groups(left);
|
|
107
|
-
const r = right === undefined ? [] : groups(right);
|
|
108
|
-
const fill = right === undefined ? 0 : 8 - l.length - r.length;
|
|
109
|
-
const all = [...l, ...Array(Math.max(fill, 0)).fill(0), ...r];
|
|
110
|
-
if (all.length !== 8 || all.some((g) => !(g >= 0 && g <= 0xffff)))
|
|
111
|
-
return undefined;
|
|
112
|
-
const out = new Uint8Array(16);
|
|
113
|
-
all.forEach((g, i) => {
|
|
114
|
-
out[2 * i] = g >> 8;
|
|
115
|
-
out[2 * i + 1] = g & 0xff;
|
|
116
|
-
});
|
|
117
|
-
return out;
|
|
118
|
-
}
|
|
119
|
-
const RANGES = TABLE.map((entry) => {
|
|
120
|
-
const [base, bits] = entry.cidr.split("/");
|
|
121
|
-
return { bytes: addressBytes(base), bits: Number(bits), class: entry.class };
|
|
122
|
-
});
|
|
123
|
-
const within = (address, range) => {
|
|
124
|
-
if (address.length !== range.bytes.length)
|
|
125
|
-
return false;
|
|
126
|
-
for (let bit = 0; bit < range.bits; bit += 8) {
|
|
127
|
-
const mask = range.bits - bit >= 8 ? 0xff : (0xff << (8 - (range.bits - bit))) & 0xff;
|
|
128
|
-
if ((address[bit / 8] & mask) !== (range.bytes[bit / 8] & mask))
|
|
129
|
-
return false;
|
|
130
|
-
}
|
|
131
|
-
return true;
|
|
132
|
-
};
|
|
133
|
-
const same = (a, b) => a.length === b.length && a.every((byte, i) => byte === b[i]);
|
|
134
|
-
/**
|
|
135
|
-
* Whether a box may reach `address` (its bytes, or an address's text: never a name). `local` is the host's own interface
|
|
136
|
-
* addresses, read by the caller at the dial: an address equal to one of them is refused as "this-host". An IPv6 address
|
|
137
|
-
* that carries an IPv4 one is judged by the IPv4 inside, and is then still the host's own if the host holds that IPv6
|
|
138
|
-
* address itself (the dial goes to the IPv6 address, not to the IPv4 inside it).
|
|
139
|
-
*/
|
|
140
|
-
export function checkAddress(address, local) {
|
|
141
|
-
const bytes = typeof address === "string" ? addressBytes(address) : address;
|
|
142
|
-
if (!bytes || (bytes.length !== 4 && bytes.length !== 16))
|
|
143
|
-
return { ok: false, class: "invalid" };
|
|
144
|
-
for (const range of RANGES) {
|
|
145
|
-
if (!within(bytes, range))
|
|
146
|
-
continue;
|
|
147
|
-
if (range.class === "last32" || range.class === "6to4") {
|
|
148
|
-
const inner = checkAddress(range.class === "last32" ? bytes.slice(12, 16) : bytes.slice(2, 6), local);
|
|
149
|
-
return inner.ok ? ownAddress(bytes, local) : inner;
|
|
150
|
-
}
|
|
151
|
-
return { ok: false, class: range.class };
|
|
152
|
-
}
|
|
153
|
-
if (bytes.length === 16 && (bytes[0] & 0xe0) !== 0x20)
|
|
154
|
-
return { ok: false, class: "reserved" };
|
|
155
|
-
return ownAddress(bytes, local);
|
|
156
|
-
}
|
|
157
|
-
/** Refused as "this-host" when `bytes` is one of the host's own addresses, as it is written there. */
|
|
158
|
-
function ownAddress(bytes, local) {
|
|
159
|
-
for (const text of local) {
|
|
160
|
-
const own = addressBytes(text);
|
|
161
|
-
if (own && same(own, bytes))
|
|
162
|
-
return { ok: false, class: "this-host" };
|
|
163
|
-
}
|
|
164
|
-
return { ok: true };
|
|
165
|
-
}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
# Review rules
|
|
2
|
-
|
|
3
|
-
The reviewer reads this file from the base branch before every review. Edit it like code. Learned notes are added to
|
|
4
|
-
the agent's learning and exported here.
|
|
5
|
-
|
|
6
|
-
## What to flag
|
|
7
|
-
|
|
8
|
-
- Defects: wrong results, crashes, broken caller contracts, unhandled errors, races, leaks, data loss.
|
|
9
|
-
- Security: untrusted input reaching a shell, query, path or prompt; secrets in code or logs; missing authorization.
|
|
10
|
-
- Tests that can't fail, or a behavior change with no test where the repo tests that area.
|
|
11
|
-
|
|
12
|
-
## What not to flag
|
|
13
|
-
|
|
14
|
-
- Formatting, lint and type errors: CI catches them.
|
|
15
|
-
- Naming, style and structure preferences, unless a rule below asks for them.
|
|
16
|
-
- Generated files, lockfiles, vendored code, snapshots.
|
|
17
|
-
- Anything you can't tie to a `path:line` and a concrete input.
|
|
18
|
-
- Speculative issues: "could be a problem if…" with no input in this code that gets there.
|
|
19
|
-
- Plainly intentional changes, and behavior a comment or lint-ignore marks as deliberate.
|
|
20
|
-
- Missing hardening or defense in depth where nothing untrusted reaches the code.
|
|
21
|
-
- Unchanged code, unless this change triggers or exposes the defect (then it's `pre-existing`, in the summary).
|
|
22
|
-
- Denial of service by resource exhaustion or rate limiting, unless a rule below asks for it.
|
|
23
|
-
|
|
24
|
-
## Limits
|
|
25
|
-
|
|
26
|
-
- Nits: at most 5 on a full review, 2 on a push.
|
|
27
|
-
- Pre-existing findings: at most 3.
|
|
28
|
-
- Documentation findings: at most 1 per review, and only when the docs now describe behavior wrongly enough to mislead a
|
|
29
|
-
caller. Wording, typos and missing docs are not findings.
|
|
30
|
-
- Never block a merge. Findings are advice.
|
|
31
|
-
|
|
32
|
-
## Repo rules
|
|
33
|
-
|
|
34
|
-
<!-- One rule per line. Start a line with a glob and a colon to scope it, e.g.
|
|
35
|
-
packages/serve/src/**: every route checks the caller's key. -->
|
|
36
|
-
|
|
37
|
-
## Commands
|
|
38
|
-
|
|
39
|
-
- `@<bot> review` or `/review`: a full re-review of the PR.
|
|
40
|
-
- `@<bot> <question>` or `/ask <question>`: an answer in the thread, not a review.
|
|
41
|
-
- Only people with write access to the repo can trigger the bot (checked with the code host, not inferred from the comment), and bots never can.
|