@parcha/agentrun-serve 0.1.0-beta.57 → 0.1.0-beta.59
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 +376 -0
- package/README.md +393 -118
- package/dist/acp-package.d.ts +5 -1
- package/dist/acp-package.js +19 -2
- package/dist/adapters.d.ts +23 -2
- package/dist/adapters.js +106 -33
- package/dist/agents-store.js +1 -1
- package/dist/answer-text.d.ts +3 -0
- package/dist/answer-text.js +22 -0
- package/dist/api-only.d.ts +2 -4
- package/dist/api-only.js +2 -4
- package/dist/attach-conformance.js +5 -4
- package/dist/box-paths.d.ts +7 -5
- package/dist/box-paths.js +12 -8
- package/dist/browser-computer.d.ts +3 -8
- package/dist/browser-computer.js +12 -35
- package/dist/browser-cost.js +94 -20
- package/dist/capacity.d.ts +1 -1
- package/dist/capacity.js +3 -3
- package/dist/chatgpt-plan.d.ts +5 -0
- package/dist/chatgpt-plan.js +25 -11
- package/dist/claude-login-token.d.ts +121 -0
- package/dist/claude-login-token.js +797 -0
- package/dist/claude-login.d.ts +119 -34
- package/dist/claude-login.js +551 -79
- package/dist/claude-sign-in.d.ts +3 -0
- package/dist/claude-sign-in.js +10 -1
- package/dist/cli.js +325 -328
- package/dist/composio-made.d.ts +1 -6
- package/dist/composio-made.js +1 -6
- package/dist/composio-owners.d.ts +26 -0
- package/dist/composio-owners.js +36 -0
- package/dist/composio-preset.d.ts +56 -23
- package/dist/composio-preset.js +173 -77
- package/dist/composio-triggers.d.ts +4 -4
- package/dist/composio-triggers.js +6 -7
- package/dist/compute-cost.js +11 -2
- package/dist/computer-attach.d.ts +40 -19
- package/dist/computer-attach.js +326 -62
- package/dist/computer-held-routes.d.ts +1 -1
- package/dist/computer-held-routes.js +9 -4
- package/dist/computer-keys.d.ts +11 -1
- package/dist/computer-keys.js +26 -1
- package/dist/computer-record.js +3 -1
- package/dist/computer-view.d.ts +5 -3
- package/dist/computer-view.js +10 -6
- package/dist/computer-viewer.js +36 -7
- package/dist/computers.d.ts +12 -11
- package/dist/computers.js +11 -8
- package/dist/console/THIRD-PARTY-NOTICES.txt +50 -0
- package/dist/console/assets/backend-BztxEAvb.js +166 -0
- package/dist/console/assets/index-LwNL4L9q.js +619 -0
- package/dist/console/assets/share-L84tlUDW.js +6 -0
- package/dist/console/assets/styles-CaRKlHke.js +291 -0
- package/dist/console/assets/styles-DQo8rzY-.css +1 -0
- package/dist/console/index.html +4 -3
- package/dist/console/share.html +17 -0
- package/dist/decisions.d.ts +17 -7
- package/dist/decisions.js +41 -15
- package/dist/dial-relay.d.ts +25 -4
- package/dist/dial-relay.js +139 -5
- package/dist/docker-daemon.js +4 -5
- package/dist/docker-host-addresses.js +29 -11
- package/dist/email/account.d.ts +6 -0
- package/dist/email/account.js +6 -0
- package/dist/email/authentication.d.ts +21 -0
- package/dist/email/authentication.js +106 -0
- package/dist/email/email-faux.d.ts +11 -2
- package/dist/email/email-faux.js +21 -5
- package/dist/email/mail.d.ts +25 -0
- package/dist/email/mail.js +58 -2
- package/dist/email/names.js +2 -2
- package/dist/email/tools.d.ts +9 -4
- package/dist/email/tools.js +95 -13
- package/dist/env-switch.d.ts +13 -5
- package/dist/env-switch.js +24 -6
- package/dist/errors.d.ts +1 -0
- package/dist/errors.js +2 -0
- package/dist/fal-price.d.ts +12 -4
- package/dist/fal-price.js +110 -26
- package/dist/faux-computers.js +1 -1
- package/dist/filed-answer.d.ts +2 -2
- package/dist/filed-answer.js +2 -2
- package/dist/graph-served.d.ts +10 -5
- package/dist/graph-served.js +40 -10
- package/dist/handed-values.js +1 -2
- package/dist/harness-check.d.ts +2 -1
- package/dist/harness-check.js +45 -12
- package/dist/harness-keys.js +9 -6
- package/dist/harness-opencode/facts.js +2 -0
- package/dist/harness-recipe-entry.d.ts +9 -3
- package/dist/harness-recipe-entry.js +18 -9
- package/dist/harness-recipe.d.ts +21 -0
- package/dist/harness-recipe.js +25 -3
- package/dist/harness-table.d.ts +8 -0
- package/dist/harness-table.js +17 -6
- package/dist/helper-env.d.ts +4 -1
- package/dist/helper-env.js +4 -1
- package/dist/host-check.d.ts +2 -3
- package/dist/host-check.js +13 -7
- package/dist/hosted-search.js +1 -1
- package/dist/import.d.ts +11 -8
- package/dist/import.js +437 -186
- package/dist/key-refusal.d.ts +9 -2
- package/dist/key-refusal.js +86 -32
- package/dist/learn/audit.d.ts +8 -5
- package/dist/learn/audit.js +15 -7
- package/dist/learn/compile.d.ts +5 -2
- package/dist/learn/compile.js +45 -21
- package/dist/learn/field-check.d.ts +111 -0
- package/dist/learn/field-check.js +174 -0
- package/dist/learn/ledger.d.ts +173 -0
- package/dist/learn/ledger.js +225 -0
- package/dist/learn/promote.d.ts +82 -39
- package/dist/learn/promote.js +61 -66
- package/dist/learn/secrets.d.ts +4 -0
- package/dist/learn/secrets.js +12 -0
- package/dist/learned-nodes.d.ts +8 -5
- package/dist/learned-nodes.js +8 -5
- package/dist/learned-workflow.d.ts +2 -1
- package/dist/learned-workflow.js +13 -10
- package/dist/learning-cost.d.ts +40 -21
- package/dist/learning-cost.js +30 -21
- package/dist/learning-setting.d.ts +6 -0
- package/dist/learning-setting.js +11 -1
- package/dist/listen-first.d.ts +5 -4
- package/dist/listen-first.js +4 -5
- package/dist/live-reach.d.ts +9 -0
- package/dist/live-reach.js +9 -0
- package/dist/mcp-api-only-origins.d.ts +23 -3
- package/dist/mcp-api-only-origins.js +57 -17
- package/dist/mcp-gateway.d.ts +16 -2
- package/dist/mcp-gateway.js +41 -3
- package/dist/mcp-oauth.d.ts +1 -1
- package/dist/mcp-oauth.js +3 -2
- package/dist/mcp-probe.d.ts +3 -0
- package/dist/mcp-probe.js +3 -0
- package/dist/mcp-secret-writes.d.ts +24 -2
- package/dist/mcp-secret-writes.js +30 -2
- package/dist/mcp-servers-store.d.ts +52 -14
- package/dist/mcp-servers-store.js +165 -61
- package/dist/mcp-sources.d.ts +1 -2
- package/dist/mcp-sources.js +1 -2
- package/dist/mcp-store.d.ts +5 -5
- package/dist/mcp-store.js +3 -3
- package/dist/mcp.js +1 -1
- package/dist/micro.d.ts +2 -0
- package/dist/micro.js +2 -0
- package/dist/model-gateway.d.ts +1 -1
- package/dist/model-gateway.js +20 -36
- package/dist/model.d.ts +5 -4
- package/dist/model.js +7 -6
- package/dist/monid.d.ts +14 -1
- package/dist/monid.js +103 -26
- package/dist/ollama-provider.d.ts +23 -9
- package/dist/ollama-provider.js +49 -20
- package/dist/openapi.js +234 -61
- package/dist/otel/genai.d.ts +83 -7
- package/dist/otel/genai.js +69 -9
- package/dist/otel/tracer.d.ts +42 -13
- package/dist/otel/tracer.js +241 -56
- package/dist/page.d.ts +7 -1
- package/dist/page.js +76 -22
- package/dist/paid-calls.d.ts +6 -4
- package/dist/paid-calls.js +15 -7
- package/dist/place-offers.d.ts +59 -34
- package/dist/place-offers.js +100 -58
- package/dist/place.d.ts +13 -14
- package/dist/place.js +56 -41
- package/dist/print.js +1 -1
- package/dist/provider.d.ts +5 -4
- package/dist/provider.js +26 -13
- package/dist/redact/match.d.ts +27 -9
- package/dist/redact/match.js +266 -57
- package/dist/run-census.d.ts +1 -1
- package/dist/run-census.js +4 -5
- package/dist/run-cut.js +4 -5
- package/dist/run-export-store.d.ts +15 -0
- package/dist/run-export-store.js +30 -0
- package/dist/run-export.d.ts +139 -0
- package/dist/run-export.js +379 -0
- package/dist/run-file-cut.d.ts +5 -0
- package/dist/run-file-cut.js +13 -0
- package/dist/run-launch.js +16 -3
- package/dist/run-learning-served.d.ts +2 -2
- package/dist/run-model-key.d.ts +15 -6
- package/dist/run-model-key.js +30 -31
- package/dist/run-reads-over-store.js +4 -4
- package/dist/run-secrets.js +3 -5
- package/dist/run-timeline-served.js +3 -1
- package/dist/run-view.d.ts +1 -2
- package/dist/run-view.js +2 -1
- package/dist/runnable.js +2 -2
- package/dist/runner/adapter-loop.d.ts +35 -18
- package/dist/runner/adapter-loop.js +97 -63
- package/dist/runner/adapter-run-spec.d.ts +34 -14
- package/dist/runner/adapter-run-spec.js +120 -75
- package/dist/runner/adapters/pi.js +4 -2
- package/dist/runner/audit.d.ts +8 -5
- package/dist/runner/audit.js +37 -17
- package/dist/runner/beside.d.ts +9 -2
- package/dist/runner/beside.js +29 -13
- package/dist/runner/claim-secrets.d.ts +27 -18
- package/dist/runner/claim-secrets.js +61 -47
- package/dist/runner/cli-run-spec.d.ts +18 -0
- package/dist/runner/cli-run-spec.js +93 -46
- package/dist/runner/compare-end.d.ts +2 -1
- package/dist/runner/compare-end.js +25 -10
- package/dist/runner/conformance/harness.js +2 -3
- package/dist/runner/conformance/subject.d.ts +4 -1
- package/dist/runner/harness-loops.js +3 -3
- package/dist/runner/held.d.ts +19 -4
- package/dist/runner/journal-kinds.d.ts +4 -1
- package/dist/runner/journal-kinds.js +22 -4
- package/dist/runner/learned-first.js +20 -4
- package/dist/runner/learning-end.d.ts +2 -8
- package/dist/runner/learning-end.js +11 -19
- package/dist/runner/live-ticker.js +7 -5
- package/dist/runner/loop-contract.d.ts +0 -2
- package/dist/runner/loop.d.ts +7 -0
- package/dist/runner/loop.js +1 -0
- package/dist/runner/main.d.ts +11 -6
- package/dist/runner/main.js +24 -18
- package/dist/runner/mcp-claim.js +24 -7
- package/dist/runner/mcp-run.d.ts +3 -6
- package/dist/runner/mcp-run.js +3 -4
- package/dist/runner/meta-tools.js +3 -2
- package/dist/runner/metrics.d.ts +7 -0
- package/dist/runner/metrics.js +19 -0
- package/dist/runner/model-route.d.ts +10 -7
- package/dist/runner/model-route.js +79 -15
- package/dist/runner/native-loop.js +10 -8
- package/dist/runner/presence.d.ts +11 -4
- package/dist/runner/presence.js +11 -6
- package/dist/runner/promotion.d.ts +25 -13
- package/dist/runner/promotion.js +125 -50
- package/dist/runner/redact.d.ts +3 -1
- package/dist/runner/redact.js +5 -3
- package/dist/runner/reflect-hook.js +1 -1
- package/dist/runner/responses-fetch.d.ts +36 -0
- package/dist/runner/responses-fetch.js +511 -0
- package/dist/runner/run-child-host.d.ts +38 -12
- package/dist/runner/run-child-host.js +231 -83
- package/dist/runner/run-child.js +11 -4
- package/dist/runner/runner-check.js +5 -1
- package/dist/runner/runner.d.ts +5 -3
- package/dist/runner/runner.js +14 -10
- package/dist/runner/save-slots.js +2 -1
- package/dist/runner/sdk-loop.js +8 -8
- package/dist/runner/spec-holds.d.ts +8 -1
- package/dist/runner/spec-holds.js +9 -4
- package/dist/runner/subagent.d.ts +11 -0
- package/dist/runner/subagent.js +17 -3
- package/dist/runner/workflow-calls.d.ts +9 -0
- package/dist/runner/workflow-calls.js +150 -0
- package/dist/runner/workflow-first.d.ts +138 -37
- package/dist/runner/workflow-first.js +230 -99
- package/dist/runner/workflow-spec.js +2 -2
- package/dist/runs-over-store.js +8 -7
- package/dist/save-once.d.ts +14 -0
- package/dist/save-once.js +31 -0
- package/dist/scrub-command.d.ts +34 -31
- package/dist/scrub-command.js +116 -147
- package/dist/sdk/runs.d.ts +6 -0
- package/dist/sdk/runs.js +89 -10
- package/dist/seal-key.js +4 -4
- package/dist/secret-cut.d.ts +3 -0
- package/dist/secret-cut.js +7 -1
- package/dist/secret-rules.d.ts +8 -1
- package/dist/secret-rules.js +482 -53
- package/dist/secrets.d.ts +51 -9
- package/dist/secrets.js +311 -21
- package/dist/server-keys.d.ts +4 -3
- package/dist/server-keys.js +4 -3
- package/dist/server-secrets-store.js +2 -4
- package/dist/server.d.ts +33 -10
- package/dist/server.js +454 -136
- package/dist/share-context.d.ts +22 -0
- package/dist/share-context.js +76 -0
- package/dist/shell-lex.d.ts +105 -0
- package/dist/shell-lex.js +646 -0
- package/dist/sign-ins-store.d.ts +5 -7
- package/dist/sign-ins-store.js +12 -16
- package/dist/sign-ins.d.ts +7 -11
- package/dist/sign-ins.js +40 -41
- package/dist/skills/agentrun-serve/SKILL.md +5 -2
- package/dist/slots.d.ts +9 -0
- package/dist/slots.js +45 -0
- package/dist/start-switches.d.ts +6 -5
- package/dist/start-switches.js +8 -4
- package/dist/stats.d.ts +5 -1
- package/dist/stats.js +1 -1
- package/dist/store/agent-body.js +2 -2
- package/dist/store/dialect.d.ts +4 -0
- package/dist/store/dialect.js +1 -0
- package/dist/store/index.d.ts +2 -2
- package/dist/store/index.js +1 -1
- package/dist/store/mcp-record-keys.d.ts +10 -0
- package/dist/store/mcp-record-keys.js +13 -0
- package/dist/store/postgres/dialect.js +2 -0
- package/dist/store/postgres/migrations/0028_learning_ledger.sql +44 -0
- package/dist/store/postgres/migrations/0029_run_launch_census_settle.sql +28 -0
- package/dist/store/postgres/migrations/0030_learning_ledger_epoch.sql +40 -0
- package/dist/store/postgres/migrations/0031_learning_ledger_calls.sql +12 -0
- package/dist/store/postgres/store.js +4 -0
- package/dist/store/schema.d.ts +44 -4
- package/dist/store/schema.js +111 -11
- package/dist/store/seal.d.ts +4 -1
- package/dist/store/sqlite/run-launch.d.ts +3 -10
- package/dist/store/sqlite/run-launch.js +12 -23
- package/dist/store/sqlite/run-patch.d.ts +19 -2
- package/dist/store/sqlite/run-patch.js +67 -2
- package/dist/store/sqlite/store.d.ts +3 -0
- package/dist/store/sqlite/store.js +177 -32
- package/dist/store/store-schema.js +3 -4
- package/dist/store/store.d.ts +74 -25
- package/dist/store/store.js +14 -11
- package/dist/store-reads/analytics.d.ts +2 -1
- package/dist/store-reads/analytics.js +7 -5
- package/dist/store-reads/learning.d.ts +102 -136
- package/dist/store-reads/learning.js +251 -302
- package/dist/store-reads/stats.d.ts +2 -2
- package/dist/store-reads/stats.js +13 -7
- package/dist/store-view.js +10 -7
- package/dist/suggestions.d.ts +1 -1
- package/dist/suggestions.js +29 -13
- package/dist/template-eval.d.ts +91 -9
- package/dist/template-eval.js +448 -105
- package/dist/template-import.d.ts +0 -10
- package/dist/template-import.js +5 -10
- package/dist/timeline/labels.d.ts +1 -1
- package/dist/timeline/labels.js +4 -3
- package/dist/timeline/timeline.d.ts +23 -11
- package/dist/timeline/timeline.js +115 -31
- package/dist/timeline/web-calls.d.ts +14 -14
- package/dist/timeline/web-calls.js +18 -30
- package/dist/tool-gate.d.ts +13 -1
- package/dist/tool-gate.js +43 -3
- package/dist/tool-keys-store.js +2 -4
- package/dist/tool-keys.d.ts +11 -0
- package/dist/tool-keys.js +16 -0
- package/dist/tool-plane.d.ts +50 -11
- package/dist/tool-plane.js +94 -30
- package/dist/tools.d.ts +5 -1
- package/dist/tools.js +7 -7
- package/dist/trigger-email.js +12 -6
- package/dist/triggers.d.ts +15 -34
- package/dist/triggers.js +119 -126
- package/dist/validate.d.ts +8 -1
- package/dist/validate.js +163 -23
- package/dist/web-fake.d.ts +2 -1
- package/dist/web-fake.js +8 -6
- package/dist/web-fetch.d.ts +8 -6
- package/dist/web-fetch.js +13 -11
- package/dist/web-holds.d.ts +32 -0
- package/dist/web-holds.js +86 -0
- package/dist/web-run.d.ts +32 -5
- package/dist/web-run.js +75 -28
- package/dist/web-save.d.ts +4 -9
- package/dist/web-save.js +27 -55
- package/dist/web-search.js +14 -25
- package/dist/wires.d.ts +4 -3
- package/dist/wires.js +5 -4
- package/dist/workspace/archil-claim.d.ts +12 -5
- package/dist/workspace/archil-claim.js +45 -5
- package/dist/workspace/attach.js +52 -19
- package/dist/workspace/attached-computers.d.ts +38 -11
- package/dist/workspace/attached-computers.js +81 -16
- package/dist/workspace/computer-deps.d.ts +29 -7
- package/dist/workspace/computer-deps.js +36 -18
- package/dist/workspace/computer-for-claim.d.ts +21 -4
- package/dist/workspace/computer-for-claim.js +166 -57
- package/dist/workspace/computer-intervals.d.ts +2 -0
- package/dist/workspace/computer-intervals.js +1 -1
- package/dist/workspace/computer-janitor.d.ts +48 -14
- package/dist/workspace/computer-janitor.js +153 -44
- package/dist/workspace/computer-kept.d.ts +158 -32
- package/dist/workspace/computer-kept.js +288 -63
- package/dist/workspace/computer-providers.d.ts +8 -3
- package/dist/workspace/computer-providers.js +12 -5
- package/dist/workspace/index.d.ts +1 -1
- package/dist/workspace/index.js +1 -1
- package/dist/workspace/local.js +41 -1
- package/dist/workspace/mount-revoke-left.d.ts +31 -0
- package/dist/workspace/mount-revoke-left.js +72 -0
- package/dist/workspace/paired-route.d.ts +91 -0
- package/dist/workspace/paired-route.js +152 -0
- package/dist/workspace/resolve-computer.d.ts +5 -2
- package/dist/workspace/resolve-computer.js +9 -3
- package/dist/workspace/run-end-computers.d.ts +11 -5
- package/dist/workspace/run-end-computers.js +153 -28
- package/dist/workspace/run-tools.d.ts +22 -3
- package/dist/workspace/run-tools.js +17 -5
- package/dist/workspace/run-workspace.d.ts +14 -1
- package/dist/workspace/run-workspace.js +34 -1
- package/dist/workspace/workspace.d.ts +6 -0
- package/dist/wrapped.d.ts +8 -2
- package/dist/wrapped.js +21 -6
- package/package.json +12 -13
- package/skills/agentrun-serve/SKILL.md +5 -2
- package/templates/README.md +25 -9
- package/dist/console/assets/backend-DVhHzJX2.js +0 -166
- package/dist/console/assets/index-Bwn1oTem.css +0 -1
- package/dist/console/assets/index-okP-y8PK.js +0 -747
|
@@ -6,8 +6,8 @@ export type RunState = RunReadState;
|
|
|
6
6
|
export type RunCounts = Record<RunState, number> & {
|
|
7
7
|
total: number;
|
|
8
8
|
};
|
|
9
|
-
/** `usd` sums the
|
|
10
|
-
*
|
|
9
|
+
/** `usd` sums the costs of the runs that ended with one and their shadows' known costs; null when there are none, never
|
|
10
|
+
* 0. A run still running, one that ended with no cost, or one whose shadow is at work or unpriced, is `unknown`. `basis`: how the summed costs were reached (metrics.ts joinedBasis over
|
|
11
11
|
* each one's stored basis, storedBasisOf). */
|
|
12
12
|
export type CostSum = {
|
|
13
13
|
usd: number | null;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { costOfRun, runReadState } from "./runs.js";
|
|
2
2
|
import { isShadowRun, shadowRunId } from "../learn/audit.js";
|
|
3
|
+
import { shadowOfRun, shadowUsdOf } from "../learn/ledger.js";
|
|
3
4
|
import { joinedBasis, storedBasisOf } from "../runner/metrics.js";
|
|
4
5
|
const RUN_STATES = ["running", "completed", "failed", "stopped", "escalated"];
|
|
5
6
|
const emptyCounts = () => ({ total: 0, running: 0, completed: 0, failed: 0, stopped: 0, escalated: 0 });
|
|
@@ -40,19 +41,24 @@ export async function stats(store) {
|
|
|
40
41
|
}
|
|
41
42
|
let g = shown.get(run.agentId);
|
|
42
43
|
if (g === undefined)
|
|
43
|
-
shown.set(run.agentId, (g = { counts: emptyCounts(), costUsd: 0, known: 0, shadowUsd: 0, bases: [] }));
|
|
44
|
+
shown.set(run.agentId, (g = { counts: emptyCounts(), costUsd: 0, priced: 0, known: 0, shadowUsd: 0, bases: [] }));
|
|
44
45
|
const shadow = shadows.get(shadowRunId(run.id));
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
46
|
+
// Its shadow's cost as the ledger reads it (shadowUsdOf): unknown while at work or unpriced, never $0.
|
|
47
|
+
const shadowUsd = shadowUsdOf(shadow && shadowOfRun(shadow));
|
|
48
|
+
if (shadow && shadowUsd !== null) {
|
|
49
|
+
g.shadowUsd += shadowUsd;
|
|
50
|
+
g.bases.push(storedBasisOf(shadow.metrics, shadowUsd));
|
|
48
51
|
}
|
|
49
52
|
g.counts.total += 1;
|
|
50
53
|
g.counts[state] += 1;
|
|
51
|
-
// Its cost as its read says it (costOfRun): an imported session's catalog estimate when its source priced none.
|
|
54
|
+
// Its cost as its read says it (costOfRun): an imported session's catalog estimate when its source priced none. Its
|
|
55
|
+
// $ is spent either way; the run is known only with its shadow's.
|
|
52
56
|
const cost = costOfRun(run);
|
|
53
57
|
if (state !== "running" && cost !== null) {
|
|
54
58
|
g.costUsd += cost;
|
|
55
|
-
g.
|
|
59
|
+
g.priced += 1;
|
|
60
|
+
if (shadowUsd !== null)
|
|
61
|
+
g.known += 1;
|
|
56
62
|
g.bases.push(storedBasisOf(run.metrics, cost));
|
|
57
63
|
}
|
|
58
64
|
}
|
|
@@ -73,7 +79,7 @@ export async function stats(store) {
|
|
|
73
79
|
stats.runs[key] += counts[key];
|
|
74
80
|
const known = g?.known ?? 0;
|
|
75
81
|
// A shadow's known $ is spent whether or not the run it audits has a known cost: never a null for its dollars.
|
|
76
|
-
if (
|
|
82
|
+
if ((g?.priced ?? 0) > 0 || (g?.shadowUsd ?? 0) > 0)
|
|
77
83
|
stats.cost.usd = (stats.cost.usd ?? 0) + (g?.costUsd ?? 0) + (g?.shadowUsd ?? 0);
|
|
78
84
|
stats.cost.known += known;
|
|
79
85
|
stats.cost.unknown += counts.total - known;
|
package/dist/store-view.js
CHANGED
|
@@ -8,7 +8,7 @@ import { isDeepStrictEqual } from "node:util";
|
|
|
8
8
|
import { BACKGROUND_CONTEXT } from "@earendil-works/chord/context";
|
|
9
9
|
import { CAPS, isMessageRow } from "./timeline/index.js";
|
|
10
10
|
import { runLink } from "./console-links.js";
|
|
11
|
-
import { redacted, redactedAnswer, redactedOutput, withheldWhole, withoutLoopback } from "./key-refusal.js";
|
|
11
|
+
import { redacted, redactedAnswer, redactedOutput, redactedOutputWhole, withheldWhole, withoutLoopback } from "./key-refusal.js";
|
|
12
12
|
import { structuredAnswer } from "./answer-json.js";
|
|
13
13
|
import { isObject } from "./validate.js";
|
|
14
14
|
import { currentLearning, holdsForOk, learningView, LEARNING_LABEL, secretsShown, shortOf } from "./learning.js";
|
|
@@ -94,9 +94,10 @@ export function forgetServed(store, runId) {
|
|
|
94
94
|
}
|
|
95
95
|
/** A run's answer as served: redactedAnswer's, once per answer and held value set. */
|
|
96
96
|
const servedOnce = (store, runId, input, values, since) => keptOnce(store, `answer ${runId}`, input, values, since, () => redactedAnswer(input, values));
|
|
97
|
-
/** Whether a run's input is served (store-view's `input`): only when the cut a run's words get
|
|
98
|
-
*
|
|
99
|
-
|
|
97
|
+
/** Whether a run's input is served (store-view's `input`): only when the cut a run's words get, read whole first
|
|
98
|
+
* (redactedOutputWhole: a held value split across two of its fields withholds it), leaves it exactly as given, so "Run
|
|
99
|
+
* again" never sends an altered task. Read once per input and held value set. */
|
|
100
|
+
const inputWhole = (store, runId, input, values, since) => keptOnce(store, `input ${runId}`, JSON.stringify(input), values, since, () => isDeepStrictEqual(redactedOutputWhole(input, values), input));
|
|
100
101
|
/** A run's whole answer as answerOfRun read it from the rows: its newest final-answer row, never the learning turn's, and
|
|
101
102
|
* never an earlier turn's: a final answer row before the person's last message belongs to the turn that message
|
|
102
103
|
* followed, so a follow-up whose own stop said nothing (no text block: a thinking-only stop) has no answer, null, not
|
|
@@ -266,6 +267,7 @@ async function storeRunIn(store, runId, deps, cut, since) {
|
|
|
266
267
|
// Its final answer whole (store-reads/journal.ts wholeAnswers), as main served a run's answer: a row's cut is no answer's.
|
|
267
268
|
// A run that ended reads settled, and its usage row says its cost ("Cost: …"), never what it has cost so far. One
|
|
268
269
|
// looking back is still going: its look-back's rows come yet.
|
|
270
|
+
// A call's arguments, or a web call's output, split across two strings are withheld whole (TimelineOptions.holds).
|
|
269
271
|
const timelineOptions = { settled: terminal && !lookingBack, ended: terminal && !lookingBack, redact: (text) => redacted(text, values), holds: (text) => withheldWhole(text, values) };
|
|
270
272
|
// Rendered from the records read above, so its usage row and the cost's `plan` (bookedSpend over the same entries) are
|
|
271
273
|
// of one read.
|
|
@@ -602,10 +604,11 @@ async function viewOfRun(store, runId, deps, run, read) {
|
|
|
602
604
|
const finalAnswer = row.kind === "workflow" || unshown ? null : answerOf(run.rows) ?? row.summary ?? null;
|
|
603
605
|
// A workflow run's output, as its end kept it; an agentic run's, its final answer's structured part when its agent has
|
|
604
606
|
// an output schema and the answer's json block (answer-json.ts jsonBlockOf) meets it (storeRunOf's `structured`), else none. Served as
|
|
605
|
-
// runs.ts serves it (servedOutput):
|
|
606
|
-
//
|
|
607
|
+
// runs.ts serves it (servedOutput): read whole first, so a held value split across two of its fields withholds it as
|
|
608
|
+
// "[redacted]" (redactedOutputWhole), else each string in it cut of the values the run holds, its shape kept; none
|
|
609
|
+
// while the run's sign-in can't be read back.
|
|
607
610
|
const ownOutput = row.kind === "workflow" ? output : status === "completed" && structured && "value" in structured ? structured.value : null;
|
|
608
|
-
const servedOutput = !unshown && ownOutput !== null && ownOutput !== undefined ?
|
|
611
|
+
const servedOutput = !unshown && ownOutput !== null && ownOutput !== undefined ? redactedOutputWhole(ownOutput, values) : null;
|
|
609
612
|
// A run its cap ended once its cost passed it (spend_cap_reached) keeps the answer it paid for, as main kept it: the
|
|
610
613
|
// response that crossed the cap was answered and billed, so its text is the run's answer, cut as it came.
|
|
611
614
|
// Its answer is the newest answer row, else (a response cut at its length) the newest text it said; never the row's
|
package/dist/suggestions.d.ts
CHANGED
|
@@ -182,7 +182,7 @@ export type SuggestionsDeps = {
|
|
|
182
182
|
}>;
|
|
183
183
|
/** The agent made here from the imported template `id` at commit `sha`, not archived; undefined when there is none. */
|
|
184
184
|
agentFrom(id: string, sha: string): Promise<string | undefined>;
|
|
185
|
-
/** This server's public URL
|
|
185
|
+
/** This server's public URL: the pull request gives it, with /v2, as AGENTRUN_BASE_URL (the banner's line, print.ts). */
|
|
186
186
|
readonly publicUrl?: string;
|
|
187
187
|
/** Told each time a scan starts, a suggestion is discarded and a suggested agent's pull request opens: the anonymous
|
|
188
188
|
* counts' `used` (telemetry.ts), which hears the event's name and nothing else. It never fails the request. */
|
package/dist/suggestions.js
CHANGED
|
@@ -272,7 +272,7 @@ function header(s, repo, commit, mark) {
|
|
|
272
272
|
`wire it in at ${oneLine(s.integration.call_site.path)}:${s.integration.call_site.line}. ${oneLine(s.integration.call_site.note)}`,
|
|
273
273
|
"",
|
|
274
274
|
"Configure in the app's environment (never commit the key):",
|
|
275
|
-
...[["
|
|
275
|
+
...[["AGENTRUN_BASE_URL", "the AgentRun server's API, like https://agentrun.example.com/v2 (the /v2 may be left out)"], ["AGENTRUN_API_KEY", "an API key of that server (make one in its console: Settings > AgentRun API keys)"], [agentVariable(s.key), "the agent's id there (the pull request that added this file names it)"]].map(([name, what], _, all) => ` ${name.padEnd(Math.max(...all.map(([n]) => n.length)) + 2)}${what}`),
|
|
276
276
|
];
|
|
277
277
|
return lines.map((line) => (line ? `${mark} ${line}` : mark)).join("\n");
|
|
278
278
|
}
|
|
@@ -306,19 +306,23 @@ const ENDED = ["completed", "failed", "cancelled", "input_required", "paused"];
|
|
|
306
306
|
${ts ? "" : `\n/**\n * @param {${input}} input\n * @param {{ signal?: AbortSignal, timeoutMs?: number }} [options]\n * @returns {Promise<${answer}>}\n */`}
|
|
307
307
|
${cjs ? "async function" : "export async function"} ${fn}(input${t(`: ${input}`)}, options${t(": { signal?: AbortSignal; timeoutMs?: number }")} = {})${t(`: Promise<${answer}>`)} {
|
|
308
308
|
const env = (globalThis${t(" as { process?: { env: Record<string, string | undefined> } }")}).process?.env ?? {};
|
|
309
|
-
const
|
|
309
|
+
const address = (env.AGENTRUN_BASE_URL ?? "").replace(/\\/+$/, "");
|
|
310
310
|
const key = env.AGENTRUN_API_KEY;
|
|
311
311
|
const agent = env.${env};
|
|
312
|
-
if (!
|
|
312
|
+
if (!address || !key || !agent) throw new Error("Set AGENTRUN_BASE_URL, AGENTRUN_API_KEY and ${env} to run the ${s.key} agent.");
|
|
313
|
+
// The address with or without /v2, as AgentRun's own clients and CLI take AGENTRUN_BASE_URL.
|
|
314
|
+
const url = (() => { try { return new URL(address); } catch { return undefined; } })();
|
|
315
|
+
if (!url || !/^https?:$/.test(url.protocol)) throw new Error("AGENTRUN_BASE_URL must be an http or https URL, like https://agentrun.example.com/v2.");
|
|
316
|
+
const base = url.pathname.split("/").includes("v2") ? address : \`\${address}/v2\`;
|
|
313
317
|
const headers = { authorization: \`Bearer \${key}\`, "content-type": "application/json" };
|
|
314
|
-
const started = await fetch(\`\${base}/
|
|
318
|
+
const started = await fetch(\`\${base}/agents/\${encodeURIComponent(agent)}/runs\`, { method: "POST", headers, body: JSON.stringify({ input }), signal: options.signal });
|
|
315
319
|
if (!started.ok) throw new Error(\`AgentRun did not start the ${s.key} agent (HTTP \${started.status}): \${await started.text()}\`);
|
|
316
320
|
let run = (await started.json())${t(" as Run")};
|
|
317
321
|
const until = Date.now() + (options.timeoutMs ?? 300_000);
|
|
318
322
|
while (!ENDED.includes(run.status)) {
|
|
319
323
|
if (Date.now() > until) throw new Error(\`The ${s.key} agent's run \${run.run_id} did not end in time.\`);
|
|
320
324
|
await new Promise((resolve) => setTimeout(resolve, 1_500));
|
|
321
|
-
const read = await fetch(\`\${base}/
|
|
325
|
+
const read = await fetch(\`\${base}/runs/\${encodeURIComponent(run.run_id)}\`, { headers, signal: options.signal });
|
|
322
326
|
if (!read.ok) throw new Error(\`AgentRun did not read the run \${run.run_id} (HTTP \${read.status}).\`);
|
|
323
327
|
run = (await read.json())${t(" as Run")};
|
|
324
328
|
}
|
|
@@ -349,6 +353,7 @@ ${s.agent.output.map((f) => `# ${f.name}: ${oneLine(f.description)}`).join("\n
|
|
|
349
353
|
import json
|
|
350
354
|
import os
|
|
351
355
|
import time
|
|
356
|
+
import urllib.parse
|
|
352
357
|
import urllib.request
|
|
353
358
|
from typing import Any, Dict, Optional, TypedDict
|
|
354
359
|
|
|
@@ -370,18 +375,26 @@ def run_${py}(inputs: ${input}, timeout_s: float = 300.0) -> Dict[str, Any]:
|
|
|
370
375
|
missing = [name for name in _REQUIRED if name not in fields]
|
|
371
376
|
if missing:
|
|
372
377
|
raise ValueError(f"run_${py} needs {', '.join(missing)}.")
|
|
373
|
-
|
|
378
|
+
address = os.environ.get("AGENTRUN_BASE_URL", "").rstrip("/")
|
|
374
379
|
key = os.environ.get("AGENTRUN_API_KEY")
|
|
375
380
|
agent = os.environ.get("${env}")
|
|
376
|
-
if not
|
|
377
|
-
raise RuntimeError("Set
|
|
378
|
-
|
|
381
|
+
if not address or not key or not agent:
|
|
382
|
+
raise RuntimeError("Set AGENTRUN_BASE_URL, AGENTRUN_API_KEY and ${env} to run the ${s.key} agent.")
|
|
383
|
+
# The address with or without /v2, as AgentRun's own clients and CLI take AGENTRUN_BASE_URL.
|
|
384
|
+
try:
|
|
385
|
+
url = urllib.parse.urlsplit(address)
|
|
386
|
+
except ValueError:
|
|
387
|
+
url = None
|
|
388
|
+
if url is None or url.scheme not in ("http", "https") or not url.netloc:
|
|
389
|
+
raise RuntimeError("AGENTRUN_BASE_URL must be an http or https URL, like https://agentrun.example.com/v2.")
|
|
390
|
+
base = address if "v2" in url.path.split("/") else f"{address}/v2"
|
|
391
|
+
run = _call("POST", f"{base}/agents/{agent}/runs", key, {"input": fields})
|
|
379
392
|
until = time.monotonic() + timeout_s
|
|
380
393
|
while run.get("status") not in _ENDED:
|
|
381
394
|
if time.monotonic() > until:
|
|
382
395
|
raise TimeoutError(f"The ${s.key} agent's run {run.get('run_id')} did not end in time.")
|
|
383
396
|
time.sleep(1.5)
|
|
384
|
-
run = _call("GET", f"{base}/
|
|
397
|
+
run = _call("GET", f"{base}/runs/{run['run_id']}", key)
|
|
385
398
|
output = (run.get("result") or {}).get("output")
|
|
386
399
|
if run.get("status") != "completed" or not output:
|
|
387
400
|
raise RuntimeError(f"The ${s.key} agent's run {run.get('run_id')} ended {run.get('status')}.")
|
|
@@ -400,11 +413,14 @@ Added by AgentRun's agent scout from a scan of ${repo}${commit ? ` at ${commit.s
|
|
|
400
413
|
|
|
401
414
|
Start a run, then read it until its \`status\` is \`completed\`; the answer is its \`result.output\`.
|
|
402
415
|
|
|
416
|
+
\`AGENTRUN_BASE_URL\` is the AgentRun server's API, ending in \`/v2\`, like \`https://agentrun.example.com/v2\`: the value
|
|
417
|
+
the pull request that added this file gives, and the one the server prints when it starts.
|
|
418
|
+
|
|
403
419
|
\`\`\`sh
|
|
404
|
-
curl -sS -X POST "$
|
|
420
|
+
curl -sS -X POST "$AGENTRUN_BASE_URL/agents/$${env}/runs" \\
|
|
405
421
|
-H "authorization: Bearer $AGENTRUN_API_KEY" -H "content-type: application/json" \\
|
|
406
422
|
-d '${JSON.stringify({ input: example }).replace(/'/g, "'\\''")}'
|
|
407
|
-
curl -sS "$
|
|
423
|
+
curl -sS "$AGENTRUN_BASE_URL/runs/<run_id>" -H "authorization: Bearer $AGENTRUN_API_KEY"
|
|
408
424
|
\`\`\`
|
|
409
425
|
|
|
410
426
|
| Answer field | Type | What it holds |
|
|
@@ -443,7 +459,7 @@ The app's own code is not changed: nothing calls the agent until you wire it in.
|
|
|
443
459
|
|
|
444
460
|
| Variable | Value |
|
|
445
461
|
| --- | --- |
|
|
446
|
-
| \`
|
|
462
|
+
| \`AGENTRUN_BASE_URL\` | ${at.publicUrl ? `\`${at.publicUrl.replace(/\/+$/, "")}/v2\`` : "your AgentRun server's address, ending in `/v2`"} |
|
|
447
463
|
| \`AGENTRUN_API_KEY\` | an API key of that server, made in its console under ${at.publicUrl ? `[Settings → AgentRun API keys](${at.publicUrl.replace(/\/+$/, "")}${API_KEYS_PAGE})` : "Settings → AgentRun API keys"} and shown once: keep it in your secrets, never in the repository |
|
|
448
464
|
| \`${agentVariable(s.key)}\` | \`${at.agentId}\` |
|
|
449
465
|
|
package/dist/template-eval.d.ts
CHANGED
|
@@ -3,6 +3,10 @@ import { type FeedFixture } from "./eval-feed.js";
|
|
|
3
3
|
import { type PreviousFixture } from "./eval-previous.js";
|
|
4
4
|
import type { PreviousHandover } from "./trigger-targets.js";
|
|
5
5
|
import type { MonidFake } from "./runner/monid-run.js";
|
|
6
|
+
import { CALLS_PAGE_ROWS } from "./timeline/index.js";
|
|
7
|
+
/** The rows a calls=whole timeline page holds at most, the page size this eval reads with: learn-bench reads its steps'
|
|
8
|
+
* timelines the same way. */
|
|
9
|
+
export { CALLS_PAGE_ROWS };
|
|
6
10
|
import { type WebFake } from "./web-fake.js";
|
|
7
11
|
import { type Package } from "./templates.js";
|
|
8
12
|
import { type Json } from "./validate.js";
|
|
@@ -11,8 +15,10 @@ export declare const GRADER_INSTRUCTIONS = "You grade one run of an AI agent aga
|
|
|
11
15
|
/** Each grader run's cap, in dollars. */
|
|
12
16
|
export declare const GRADER_CAP_USD = 0.5;
|
|
13
17
|
/** The most characters an llm grader's prompt takes (about 30k tokens, under GRADER_CAP_USD at $15 per million input
|
|
14
|
-
* tokens): past it,
|
|
15
|
-
*
|
|
18
|
+
* tokens): past it, the final files take room first, never so much that the calls' arguments get less than half of it,
|
|
19
|
+
* the tool state's texts left out before a file of the run's own is cut (fitFiles); its calls and a fake MCP server's
|
|
20
|
+
* calls share what is left, each list cut in proportion to its size and the fake's given at least half, the middle of
|
|
21
|
+
* the longest results (or arguments) first, then the middle calls (fitCalls), and a <cuts> note counts it all. The rubric, the task
|
|
16
22
|
* and the answer are never cut: they are what the grader judges, so a prompt can pass the cap by what they hold alone,
|
|
17
23
|
* and then the calls are cut to a note that says so. */
|
|
18
24
|
export declare const GRADER_PROMPT_MAX = 120000;
|
|
@@ -47,7 +53,9 @@ export type Grader = ({
|
|
|
47
53
|
expect: "called" | "not_called";
|
|
48
54
|
count?: number;
|
|
49
55
|
atLeast?: number;
|
|
56
|
+
atMost?: number;
|
|
50
57
|
args?: Json;
|
|
58
|
+
argsFile?: string;
|
|
51
59
|
} | {
|
|
52
60
|
file: string;
|
|
53
61
|
type: "file_exists";
|
|
@@ -159,7 +167,8 @@ export declare function readCases(dir: string, names?: readonly string[]): {
|
|
|
159
167
|
cases: EvalCase[];
|
|
160
168
|
};
|
|
161
169
|
/** A call a run made: from its timeline (`tool`, its gate name, a preview of its input, its `arguments` through the run's
|
|
162
|
-
* redaction,
|
|
170
|
+
* redaction, the head of its `result`, and `refused` when the run refused it before it ran) or, in RunRecord.fakeLog
|
|
171
|
+
* alone, from a fake MCP server's own log (`arguments` whole). */
|
|
163
172
|
export type ToolCall = {
|
|
164
173
|
tool: string;
|
|
165
174
|
name?: string;
|
|
@@ -167,6 +176,7 @@ export type ToolCall = {
|
|
|
167
176
|
status?: string | null;
|
|
168
177
|
result?: string | null;
|
|
169
178
|
arguments?: Json;
|
|
179
|
+
refused?: true;
|
|
170
180
|
};
|
|
171
181
|
/** A file a run left in its work folder, as a grader is told of it: its name (its path under the run's cut, the listing's
|
|
172
182
|
* `name`; absent from a server that doesn't cut its listing's names, when the file is shown by no name, never its path),
|
|
@@ -180,15 +190,28 @@ export type FinalFile = {
|
|
|
180
190
|
export type RunRecord = {
|
|
181
191
|
/** The run's final answer, or "" when it has none. */
|
|
182
192
|
answer: string;
|
|
183
|
-
/** Its tool calls as its timeline shows them, in order. */
|
|
193
|
+
/** Its tool calls as its timeline shows them, in order (callRecordOf). */
|
|
184
194
|
calls: ToolCall[];
|
|
185
|
-
/** The calls
|
|
195
|
+
/** The calls on the fake MCP servers' tools that ran, as its timeline shows them (the faked servers' calls of `calls`
|
|
196
|
+
* not refused and with a result, mcpCallsOf, each argument through the run's redaction), in order: what an llm grader
|
|
197
|
+
* and the report are shown. */
|
|
186
198
|
mcpCalls: ToolCall[];
|
|
199
|
+
/** Each fake MCP server's own log of the calls that reached it, their arguments whole: read only to match a tool_used
|
|
200
|
+
* grader's `args` on a faked tool, never shown to a grader nor put in the report (a value the run's cut holds, handed
|
|
201
|
+
* to a fake tool, is whole here). */
|
|
202
|
+
fakeLog: ToolCall[];
|
|
187
203
|
/** The paths of its files, from its work folder. */
|
|
188
204
|
files: string[];
|
|
189
205
|
/** Its work folder's files as it left them, for its llm graders (finalFilesOf): each text file with its whole `text`,
|
|
190
206
|
* any other (media, a binary, one past what was read) with its size alone. */
|
|
191
207
|
finalFiles?: FinalFile[];
|
|
208
|
+
/** Each file a tool_used grader's args_file names, by its path: its whole text under the run's cut, or why it has none
|
|
209
|
+
* (argsFilesOf). */
|
|
210
|
+
argsFiles?: Record<string, {
|
|
211
|
+
text: string;
|
|
212
|
+
} | {
|
|
213
|
+
why: string;
|
|
214
|
+
}>;
|
|
192
215
|
/** The clock it ran on, its case's `now`; absent, the real one. */
|
|
193
216
|
now?: string;
|
|
194
217
|
/** Its fake mailbox after it, for a case with `email` (eval-mailbox.ts). */
|
|
@@ -210,6 +233,15 @@ export declare function searched(search: FakeSearch, query: string): string;
|
|
|
210
233
|
export declare function gradeDeterministic(grader: Exclude<Grader, {
|
|
211
234
|
type: "llm";
|
|
212
235
|
}>, run: RunRecord, faked: readonly string[]): Verdict;
|
|
236
|
+
/** A tool_used grader's verdict on its args_file: each listed argument object carried (carries) by its own call of
|
|
237
|
+
* `calls` (the grader's tools, its `args` kept), no call standing for two entries, and as many calls as the list has
|
|
238
|
+
* entries (or `count`). The entries are given calls by a maximum matching, so one call that carries two entries counts
|
|
239
|
+
* for one of them, whatever order they are listed in. */
|
|
240
|
+
export declare function argsFileVerdict(path: string, file: {
|
|
241
|
+
text: string;
|
|
242
|
+
} | {
|
|
243
|
+
why: string;
|
|
244
|
+
} | undefined, calls: readonly ToolCall[], said: string, count?: number): Verdict;
|
|
213
245
|
/** The output check of a completed run of a package that declares `output`, beside its case's graders: the server's own
|
|
214
246
|
* verdict (`result.output_error`, why the answer still missed the schema after the runner's one retry), so no case
|
|
215
247
|
* carries a grader for it. Undefined for a package with no output schema. */
|
|
@@ -220,6 +252,12 @@ export declare function outputVerdict(pkg: Package, result: unknown): GraderResu
|
|
|
220
252
|
export declare function graderInput(grader: Extract<Grader, {
|
|
221
253
|
type: "llm";
|
|
222
254
|
}>, input: string, run: RunRecord, max?: number): string;
|
|
255
|
+
/** Each call's arguments (their JSON, none for a call with none) in at most `room` characters in all: undefined when they
|
|
256
|
+
* fit whole; else each past a length L keeps its first two thirds and last third of L with its middle cut and marked
|
|
257
|
+
* (middle), L the longest that fits, so the longest are cut first. A list no longer than L and a marker (40 characters)
|
|
258
|
+
* stays whole, so a cut never takes a short list's text for a marker as long; when even L = 0 passes the room, the
|
|
259
|
+
* short lists stay whole, the long ones show their marker alone, and fitCalls drops calls as it does. */
|
|
260
|
+
export declare function fitArgs(args: readonly (string | undefined)[], room: number): (string | undefined)[] | undefined;
|
|
223
261
|
/** A grader's calls, one line each (`head`, then `: <result>`), in at most `room` characters: whole when they fit; else
|
|
224
262
|
* each result past a length L keeps its first two thirds and last third of L with its middle cut and marked, L the
|
|
225
263
|
* longest that fits, a web call's (`tool`, web-calls.ts) every url whole and each of its snippets or its page's text cut
|
|
@@ -238,6 +276,9 @@ export declare function fitCalls(lines: readonly {
|
|
|
238
276
|
* its size on a last line, cut to the room when even that passes it. Each file is named by its cut name alone: one with
|
|
239
277
|
* none is in a block with no path, or counted. */
|
|
240
278
|
export declare function fitFiles(files: readonly FinalFile[], room: number): string;
|
|
279
|
+
/** Whether a final file is a tool's state, not the run's work: under a folder whose name starts with "." (the package's
|
|
280
|
+
* own skills copied under `.agents/skills`, a tool's cache such as `film/.hyperframes`). A file with no name is not. */
|
|
281
|
+
export declare function toolState(name: string | undefined): boolean;
|
|
241
282
|
/** A grader run's answer read as its verdict: its json block's (jsonBlockOf), else the last flat JSON object's, {pass, reason}. */
|
|
242
283
|
export declare function verdictOf(answer: string): {
|
|
243
284
|
pass: boolean;
|
|
@@ -250,7 +291,8 @@ export type Fake = {
|
|
|
250
291
|
close: () => Promise<void>;
|
|
251
292
|
};
|
|
252
293
|
/** A fake MCP server for `fixture` on loopback, Streamable HTTP through the official SDK, one stateless server per
|
|
253
|
-
* request; every tool call is recorded (its gate name and arguments) and answered from the fixture
|
|
294
|
+
* request; every tool call is recorded (its gate name and arguments) and answered from the fixture as it is written, so
|
|
295
|
+
* the agent and a script it runs read the answer a real server of that shape gives (a JSON text parses as JSON). */
|
|
254
296
|
export declare function startFake(name: string, fixture: McpFixture): Promise<Fake>;
|
|
255
297
|
type Answered = {
|
|
256
298
|
status: number;
|
|
@@ -271,11 +313,42 @@ export declare function apiOf(baseUrl: string, token: string): Api;
|
|
|
271
313
|
export declare const CLAIM_READ_TIMEOUT_MS = 10000;
|
|
272
314
|
/** The least time between two of those reads of one run. */
|
|
273
315
|
export declare const CLAIM_READ_EVERY_MS = 5000;
|
|
316
|
+
/** How long that read may take: its wait, and 10 s for the answer to arrive. */
|
|
317
|
+
export declare const PAGE_READ_TIMEOUT_MS: number;
|
|
318
|
+
/** The bound of a read in waitRun made at `now`: `capMs`, or the time left to `deadline` when that is less (`ms`, whole
|
|
319
|
+
* milliseconds and never below 0, as AbortSignal.timeout takes them), and whether the time left is what bounds it
|
|
320
|
+
* (`atDeadline`). */
|
|
321
|
+
export declare function readBound(deadline: number, capMs: number, now: number): {
|
|
322
|
+
ms: number;
|
|
323
|
+
atDeadline: boolean;
|
|
324
|
+
};
|
|
325
|
+
/** A run waited for: its rows until it ends (completed, failed, cancelled) or waits on a person (input_required), or
|
|
326
|
+
* `deadline` passes (then it is cancelled). A stop of the eval (`signal`) cancels it too, and throws. Each of its reads
|
|
327
|
+
* ends at the deadline and at the stop (bounded), so a server that stalls one never holds the wait past either.
|
|
328
|
+
* Exported for its tests. */
|
|
329
|
+
export declare function waitRun(api: Api, runId: string, deadline: number, signal?: AbortSignal, queueTimeoutMs?: number): Promise<{
|
|
330
|
+
status: string;
|
|
331
|
+
rows: Json[];
|
|
332
|
+
waiting?: string;
|
|
333
|
+
why?: string;
|
|
334
|
+
}>;
|
|
335
|
+
/** The calls on the faked MCP servers `faked` that ran, as the run's timeline shows them (`calls`, from callsOf: each
|
|
336
|
+
* argument through the run's redaction): each call on a faked server's tool the run did not refuse before it ran and
|
|
337
|
+
* whose result row the timeline holds. A call refused (a deny, a cap, an approval never given) never reached the fake,
|
|
338
|
+
* and one with no result (cut off) has no outcome to show. One that failed on its way to the fake shows, with its
|
|
339
|
+
* error as its result, never as a success; a tool_used grader counts only what the fake logged (fakeLog). What an llm
|
|
340
|
+
* grader's <mcp-calls> and the report's `mcp_calls` show, never the fake's own log. */
|
|
341
|
+
export declare function mcpCallsOf(calls: readonly ToolCall[], faked: readonly string[]): ToolCall[];
|
|
342
|
+
/** A run's calls for its graders and its report, from its timeline's (callsOf) and the fakes it ran against: its calls,
|
|
343
|
+
* its fake MCP calls (mcpCallsOf) and the fakes' own log whole. The template eval's runs and learn-bench's steps both
|
|
344
|
+
* read them here. */
|
|
345
|
+
export declare function callRecordOf(calls: readonly ToolCall[], faked: readonly string[], fakes: readonly Pick<Fake, "calls">[]): Pick<RunRecord, "calls" | "mcpCalls" | "fakeLog">;
|
|
274
346
|
/** A run's tool calls, each named as a grader names it: the gate's own rule (RunGate.enter), its settings key, but a
|
|
275
347
|
* shell tool held to bash's setting (bash_background, bash_output, ...) keeps its own name, so its grader sees it. A
|
|
276
348
|
* call on a saved server `toolkits` names ({<saved server>: <the package's toolkit>}, a need an owner's server filled
|
|
277
349
|
* under another name) is named on the package's toolkit, as the package's graders name it. Each with its arguments and
|
|
278
|
-
* its output as the rows of a calls=whole read carry them (tool_input, tool_result_text), else its previews
|
|
350
|
+
* its output as the rows of a calls=whole read carry them (tool_input, tool_result_text), else its previews, and
|
|
351
|
+
* `refused` when its result row says the run refused it before it ran (a deny, a pin, an approval never given). */
|
|
279
352
|
export declare function callsOf(rows: readonly Json[], harness: string, toolkits?: Readonly<Record<string, string>>): ToolCall[];
|
|
280
353
|
/** A file of a run's work folder as its listing names it: its path (for this eval's own reads, never a grader's prompt),
|
|
281
354
|
* its name under the run's cut (the listing's `name`, absent from a server that doesn't cut it), its size, its type
|
|
@@ -294,13 +367,23 @@ export declare const FILE_READ_TIMEOUT_MS = 10000;
|
|
|
294
367
|
export declare const FILE_READS_TIMEOUT_MS = 30000;
|
|
295
368
|
/** A run's final files for its llm graders: each text file's whole text, read smallest first while the texts read stay
|
|
296
369
|
* within GRADER_PROMPT_MAX UTF-8 bytes in all (one grader input holds that many characters, and a character is at least
|
|
297
|
-
* a byte), every other file by its size alone. Each is read under the run's own cut, on the server that holds its
|
|
370
|
+
* a byte), the run's own files before any of tool state (toolState), every other file by its size alone. Each is read under the run's own cut, on the server that holds its
|
|
298
371
|
* secrets (`?cut=run`, run-reads-over-store.ts cutRunFile): every value its timeline's calls are cut of, and every secret
|
|
299
372
|
* shape, is "[redacted]" in the text a grader sees. An answer without the cut's mark (`x-agentrun-cut: run`: a server
|
|
300
373
|
* that doesn't know the cut and would serve the raw bytes) leaves the text out. A read that fails, is refused (403, 413,
|
|
301
374
|
* 415), takes longer than `readTimeoutMs`, or would pass the budget leaves that file's text out, never the grade, and
|
|
302
375
|
* the files after it are still read; past FILE_READS_TIMEOUT_MS in all, the rest are left out. In the listing's order. */
|
|
303
376
|
export declare function finalFilesOf(api: Api, runId: string, listed: readonly Listed[], signal?: AbortSignal, readTimeoutMs?: number): Promise<FinalFile[]>;
|
|
377
|
+
/** The most bytes of an args_file a tool_used grader reads: the most a cut read answers (run-files.ts). */
|
|
378
|
+
export declare const ARGS_FILE_MAX: number;
|
|
379
|
+
/** Each file a tool_used grader's args_file names, read whole under the run's cut (as finalFilesOf reads a file: an
|
|
380
|
+
* answer without the cut's mark is refused), by its path: its text, or why there is none (absent, refused, past
|
|
381
|
+
* ARGS_FILE_MAX bytes, a read that failed or took past `readTimeoutMs`). */
|
|
382
|
+
export declare function argsFilesOf(api: Api, runId: string, paths: readonly string[], signal?: AbortSignal, readTimeoutMs?: number): Promise<Record<string, {
|
|
383
|
+
text: string;
|
|
384
|
+
} | {
|
|
385
|
+
why: string;
|
|
386
|
+
}>>;
|
|
304
387
|
/** How long a run's metrics read may take before the run is reported without them. */
|
|
305
388
|
export declare const METRICS_TIMEOUT_MS = 10000;
|
|
306
389
|
/** The metrics of the one run `agentId` made (RunMetrics), from GET /stats?agent=; null when the server kept none (the run
|
|
@@ -441,4 +524,3 @@ export declare const CANCEL_WAIT_MS = 30000;
|
|
|
441
524
|
* any case failed, however many passed beside it. (2: nothing ran, and 130: stopped, are the CLI's own.) */
|
|
442
525
|
export declare const exitCodeOf: (report: Pick<Report, "cases">) => 0 | 1;
|
|
443
526
|
export declare function markdownReport(report: Report): string;
|
|
444
|
-
export {};
|