@parcha/agentrun-serve 0.1.0-beta.58 → 0.1.0-beta.60
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 +402 -1
- package/README.md +516 -190
- 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/agent-delete.d.ts +6 -9
- package/dist/agent-delete.js +5 -3
- package/dist/agent-package.js +11 -1
- 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 -2
- package/dist/api-only.js +3 -3
- 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/attach-conformance.js +5 -4
- package/dist/box-paths.d.ts +3 -2
- package/dist/box-paths.js +5 -4
- 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 +7 -0
- package/dist/chatgpt-plan.js +35 -11
- package/dist/claude-login-token.d.ts +20 -11
- package/dist/claude-login-token.js +175 -107
- package/dist/claude-login.d.ts +124 -33
- package/dist/claude-login.js +562 -85
- package/dist/claude-sign-in.d.ts +3 -0
- package/dist/claude-sign-in.js +10 -1
- package/dist/cli-learning/connections.js +1 -1
- package/dist/cli.js +323 -292
- 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 +6 -3
- package/dist/computer-attach.js +41 -29
- 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 +2 -1
- package/dist/computers.js +6 -3
- package/dist/console/THIRD-PARTY-NOTICES.txt +50 -0
- package/dist/console/assets/backend-QnwGVBeU.js +166 -0
- package/dist/console/assets/index-DZi-muIj.js +629 -0
- package/dist/console/assets/share-pz61zIn9.js +6 -0
- package/dist/console/assets/styles-CcceGcu2.js +291 -0
- package/dist/console/assets/styles-fjQBFfMv.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.js +10 -4
- 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 +12 -2
- package/dist/env-switch.js +23 -3
- 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/fal-price.d.ts +11 -1
- package/dist/fal-price.js +33 -0
- package/dist/faux-computers.js +1 -1
- package/dist/filed-answer.d.ts +2 -2
- package/dist/filed-answer.js +2 -2
- package/dist/filed-tool.d.ts +32 -0
- package/dist/filed-tool.js +122 -0
- 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.d.ts +1 -2
- package/dist/harness-keys.js +10 -8
- 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 +12 -0
- package/dist/harness-table.js +21 -6
- package/dist/harness.js +6 -2
- 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-worker.js +2 -2
- package/dist/import.d.ts +20 -8
- package/dist/import.js +448 -187
- package/dist/key-refusal.d.ts +14 -2
- package/dist/key-refusal.js +97 -33
- package/dist/learn/audit.d.ts +28 -27
- package/dist/learn/audit.js +87 -62
- 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 +9 -6
- package/dist/learn/compile.js +51 -28
- 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/field-check.d.ts +111 -0
- package/dist/learn/field-check.js +174 -0
- 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/ledger.d.ts +32 -29
- package/dist/learn/ledger.js +26 -19
- 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 +119 -102
- package/dist/learn/promote.js +119 -262
- 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 +4 -0
- package/dist/learn/secrets.js +12 -0
- package/dist/learn/workflow-draft.d.ts +4 -1
- package/dist/learn/workflow-draft.js +12 -2
- 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 +25 -8
- package/dist/learning-cost.js +23 -8
- 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-setting.d.ts +6 -0
- package/dist/learning-setting.js +11 -1
- 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/listen-first.d.ts +5 -4
- package/dist/listen-first.js +4 -5
- package/dist/live-reach.d.ts +7 -0
- package/dist/live-reach.js +7 -0
- package/dist/mcp-api-only-origins.d.ts +15 -0
- package/dist/mcp-api-only-origins.js +40 -0
- package/dist/mcp-gateway.d.ts +22 -2
- package/dist/mcp-gateway.js +85 -11
- 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-resources.d.ts +1 -1
- 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/model-gateway.d.ts +1 -1
- package/dist/model-gateway.js +20 -36
- 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 +23 -9
- package/dist/ollama-provider.js +49 -20
- package/dist/openapi.js +290 -79
- 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 +58 -34
- package/dist/place-offers.js +96 -54
- package/dist/place.d.ts +41 -20
- package/dist/place.js +97 -47
- package/dist/print.js +1 -1
- package/dist/provider.d.ts +3 -2
- package/dist/provider.js +17 -8
- package/dist/purged-workflow.d.ts +0 -33
- package/dist/purged-workflow.js +3 -71
- package/dist/redact/match.d.ts +42 -9
- package/dist/redact/match.js +356 -54
- 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.d.ts +3 -3
- package/dist/run-launch.js +16 -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-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.d.ts +1 -1
- package/dist/run-timeline-served.js +8 -5
- package/dist/runnable.js +26 -9
- package/dist/runner/adapter-loop.d.ts +35 -18
- package/dist/runner/adapter-loop.js +94 -47
- package/dist/runner/adapter-run-spec.d.ts +14 -1
- package/dist/runner/adapter-run-spec.js +73 -46
- package/dist/runner/adapters/pi.js +4 -2
- package/dist/runner/audit.d.ts +10 -9
- package/dist/runner/audit.js +64 -67
- package/dist/runner/beside.js +5 -6
- package/dist/runner/claim-secrets.d.ts +10 -3
- package/dist/runner/claim-secrets.js +29 -13
- package/dist/runner/cli-run-spec.d.ts +18 -0
- package/dist/runner/cli-run-spec.js +87 -58
- package/dist/runner/compare-end.d.ts +2 -3
- package/dist/runner/compare-end.js +30 -11
- package/dist/runner/conformance/harness.js +2 -3
- package/dist/runner/conformance/subject.d.ts +4 -1
- package/dist/runner/disk-free.d.ts +15 -4
- package/dist/runner/disk-free.js +25 -7
- package/dist/runner/feedback-round.d.ts +1 -1
- package/dist/runner/feedback-round.js +2 -2
- package/dist/runner/harness-loops.js +3 -4
- package/dist/runner/held.d.ts +5 -12
- package/dist/runner/held.js +0 -25
- package/dist/runner/journal-kinds.d.ts +8 -2
- package/dist/runner/journal-kinds.js +23 -5
- package/dist/runner/learned-first.d.ts +0 -2
- package/dist/runner/learned-first.js +23 -7
- package/dist/runner/learning-end.d.ts +14 -24
- package/dist/runner/learning-end.js +52 -94
- package/dist/runner/learning-seed.d.ts +13 -16
- package/dist/runner/learning-seed.js +13 -23
- 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.js +13 -12
- package/dist/runner/mcp-claim.js +21 -5
- package/dist/runner/mcp-run.d.ts +4 -0
- package/dist/runner/mcp-run.js +2 -0
- 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 +12 -11
- package/dist/runner/presence.d.ts +1 -4
- package/dist/runner/presence.js +6 -8
- package/dist/runner/promotion.d.ts +39 -36
- package/dist/runner/promotion.js +168 -112
- package/dist/runner/redact.d.ts +3 -1
- package/dist/runner/redact.js +5 -3
- package/dist/runner/reflect-hook.d.ts +2 -2
- package/dist/runner/reflect-hook.js +4 -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 +21 -14
- package/dist/runner/run-child-host.js +187 -141
- package/dist/runner/run-child.js +11 -4
- package/dist/runner/runner-check.js +5 -1
- package/dist/runner/runner.d.ts +3 -4
- package/dist/runner/runner.js +13 -9
- package/dist/runner/sdk-loop.js +10 -12
- package/dist/runner/spec-holds.d.ts +8 -1
- package/dist/runner/spec-holds.js +9 -4
- package/dist/runner/workflow-calls.d.ts +9 -0
- package/dist/runner/workflow-calls.js +150 -0
- package/dist/runner/workflow-first.d.ts +120 -32
- package/dist/runner/workflow-first.js +218 -94
- package/dist/runner/workflow-spec.js +1 -1
- 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/check.d.ts +1 -4
- package/dist/sdk/check.js +2 -3
- package/dist/sdk/runs.d.ts +26 -7
- package/dist/sdk/runs.js +194 -78
- 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 +55 -9
- package/dist/secrets.js +345 -21
- package/dist/server-fs.d.ts +1 -1
- package/dist/server-fs.js +1 -1
- package/dist/server-keys.d.ts +10 -3
- package/dist/server-keys.js +16 -3
- package/dist/server-secrets-store.js +2 -4
- package/dist/server.d.ts +30 -18
- package/dist/server.js +520 -238
- 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/source-sync/auxiliary.js +2 -2
- 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/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/migrations/0032_learning_rows.sql +65 -0
- package/dist/store/postgres/store.js +4 -0
- package/dist/store/schema.d.ts +60 -11
- package/dist/store/schema.js +147 -17
- package/dist/store/seal.d.ts +4 -1
- package/dist/store/sqlite/learning-rows.d.ts +23 -0
- package/dist/store/sqlite/learning-rows.js +559 -0
- 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 +17 -10
- package/dist/store/sqlite/run-patch.js +50 -13
- package/dist/store/sqlite/store.d.ts +9 -0
- package/dist/store/sqlite/store.js +194 -46
- package/dist/store/store-schema.js +3 -4
- package/dist/store/store.d.ts +286 -38
- package/dist/store/store.js +27 -11
- package/dist/store-reads/analytics.d.ts +2 -1
- package/dist/store-reads/analytics.js +7 -5
- package/dist/store-reads/journal.d.ts +33 -3
- package/dist/store-reads/journal.js +99 -4
- package/dist/store-reads/learning.d.ts +50 -45
- package/dist/store-reads/learning.js +153 -116
- package/dist/store-reads/loop.js +1 -1
- package/dist/store-reads/stats.d.ts +2 -2
- package/dist/store-reads/stats.js +13 -7
- package/dist/store-view.d.ts +24 -2
- package/dist/store-view.js +49 -17
- package/dist/suggestions.d.ts +1 -1
- package/dist/suggestions.js +29 -13
- package/dist/template-eval.d.ts +72 -9
- package/dist/template-eval.js +358 -64
- package/dist/templates.d.ts +10 -2
- package/dist/templates.js +31 -4
- 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 +8 -6
- package/dist/timeline/web-calls.js +10 -6
- 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 +54 -13
- package/dist/tool-plane.js +103 -32
- 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 +34 -0
- package/dist/web-holds.js +89 -0
- package/dist/web-run.d.ts +32 -5
- package/dist/web-run.js +76 -28
- package/dist/web-save.js +23 -12
- 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/archil-exec.js +1 -1
- package/dist/workspace/archil.d.ts +1 -1
- package/dist/workspace/archil.js +1 -1
- package/dist/workspace/attach.js +52 -19
- package/dist/workspace/attached-computers.d.ts +6 -2
- package/dist/workspace/attached-computers.js +5 -4
- package/dist/workspace/computer-deps.d.ts +23 -6
- package/dist/workspace/computer-deps.js +38 -18
- package/dist/workspace/computer-for-claim.d.ts +21 -4
- package/dist/workspace/computer-for-claim.js +160 -54
- 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 +19 -4
- package/dist/workspace/computer-providers.js +40 -6
- package/dist/workspace/index.d.ts +2 -3
- package/dist/workspace/index.js +2 -3
- 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.js +4 -5
- package/dist/workspace/paths.d.ts +0 -4
- package/dist/workspace/paths.js +0 -6
- 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 +7 -1
- package/dist/workspace/workspace.js +1 -1
- package/package.json +13 -14
- package/skills/agentrun-serve/SKILL.md +5 -2
- package/templates/README.md +22 -6
- package/templates/TOOLS.md +46 -0
- package/dist/console/assets/backend-CSAWUqtZ.js +0 -166
- package/dist/console/assets/index-Bwn1oTem.css +0 -1
- package/dist/console/assets/index-DPh29cyz.js +0 -747
- package/dist/workspace/learning-workspace.d.ts +0 -24
- /package/dist/learn/{learning.sh → legacy/learning.sh} +0 -0
package/dist/runner/promotion.js
CHANGED
|
@@ -2,10 +2,11 @@
|
|
|
2
2
|
// serves first only when its digest is promoted (learn/promote.ts). Promote once: a digest with no record yet, the learning
|
|
3
3
|
// folder's newest revision, is checked once (startCheck): a replay run of it (RunLaunch.replay, at workflow cost) on the
|
|
4
4
|
// input of each of the agent's last compile_after completed runs of its own (its definition's `learning`,
|
|
5
|
-
// learning-setting.ts), the agent taking the runs meanwhile. A later claim that finds every check run ended
|
|
6
|
-
//
|
|
7
|
-
//
|
|
8
|
-
//
|
|
5
|
+
// learning-setting.ts), the agent taking the runs meanwhile. A later claim that finds every check run ended judges each
|
|
6
|
+
// field (agree_on's, else the whole answer) against its best known answer, the agent run's grade's expected answer, else
|
|
7
|
+
// the agent's own recorded answer (learn/field-check.ts check), and promotes the digest when, of the inputs it ran on, it
|
|
8
|
+
// answered at least alone_min alone and every field passes; else it is held, its record naming the failing fields and
|
|
9
|
+
// keeping the inputs it disagreed on, which the agent's next run's compile
|
|
9
10
|
// turn reads to write its one recompile (learn/compile.ts); that revision is checked the same way, once, and a hold of
|
|
10
11
|
// it stops (nothing compiles again). A check-promoted digest is never checked again: no grade, no refit, no queue, no
|
|
11
12
|
// second replay. Every reserved input counts: one whose replay run was never created, or never ended, by the check's
|
|
@@ -55,11 +56,11 @@ import { pinAnnotations, recordedCalls, replayCalls, SKIPPED_WRITE, toolClassOf,
|
|
|
55
56
|
import { listed } from "../learning-words.js";
|
|
56
57
|
import { isObject } from "../validate.js";
|
|
57
58
|
import { agentRun, lastOwnRuns, newCompileAttempt, sinceReset } from "../learn/compile.js";
|
|
58
|
-
import {
|
|
59
|
-
import {
|
|
59
|
+
import { answerAt, answerValue, checkShares, CHECK_TEXT_MAX, championOf, compareAnswers, comparedGrade, comparedOf, gradesOf, knownAnswerText, promotionOf, promotionsOf, recordPromotion, replayingOf, sameAnswer, skippedToolsOf, valueAtPath } from "../learn/promote.js";
|
|
60
|
+
import { check as checkFields, jointSaid, KNOWN, tallyOf } from "../learn/field-check.js";
|
|
60
61
|
import { sendCommand } from "./commands.js";
|
|
61
62
|
import { ClaimRefused } from "./loop-contract.js";
|
|
62
|
-
import {
|
|
63
|
+
import { readView, learningOf } from "../learn/rows.js";
|
|
63
64
|
import { fits, laidFor, servedOf, workflowDigest } from "./workflow-first.js";
|
|
64
65
|
import { excerptShown } from "../learn/secrets.js";
|
|
65
66
|
import { dslRefusalOf } from "../learn/workflow-draft.js";
|
|
@@ -71,25 +72,17 @@ export const REPLAY_DEADLINE_MS = 60 * 60 * 1000;
|
|
|
71
72
|
/** A reserved replay run still not created this long after its record was reserved is a launch that was interrupted (the
|
|
72
73
|
* reserving claim crashed, or its create failed): the next claim creates it (relaunch). Before then it is pending. */
|
|
73
74
|
export const REPLAY_LAUNCH_GRACE_MS = 5 * 60 * 1000;
|
|
74
|
-
/** The claim's promotion ports:
|
|
75
|
-
*
|
|
76
|
-
*
|
|
75
|
+
/** The claim's promotion ports: a champion read from the agent's learning at its record's save, cut of the server's
|
|
76
|
+
* secrets (`shown`) as the claim's lay is; and the workflow an earlier claim of this run served (`kept`, from its
|
|
77
|
+
* journal: none on a first claim). */
|
|
77
78
|
export function claimPromotion(deps) {
|
|
78
79
|
return {
|
|
79
80
|
...deps,
|
|
80
81
|
kept: async () => (deps.runId ? servedOf(await runEntries(deps.store, deps.runId, deps.context).catch(() => [])) : undefined),
|
|
81
|
-
champion: async (name, commit) => (await workflowsAt(
|
|
82
|
-
refused: refusedIn(deps.folder, deps.store, deps.log),
|
|
82
|
+
champion: async (name, commit) => (await workflowsAt(deps, commit)).find((one) => one.name === name),
|
|
83
83
|
newest: async (name) => {
|
|
84
|
-
const
|
|
85
|
-
|
|
86
|
-
try {
|
|
87
|
-
main = (await readSnapshot(folder.workspace))?.main;
|
|
88
|
-
}
|
|
89
|
-
finally {
|
|
90
|
-
await folder.end().catch(() => undefined);
|
|
91
|
-
}
|
|
92
|
-
const text = main ? (await workflowsAt({ folder: deps.folder, store: deps.store, shown: deps.shown }, main)).find((one) => one.name === name) : undefined;
|
|
84
|
+
const main = (await readView(learningOf(deps.store, deps.agentId)))?.main;
|
|
85
|
+
const text = main ? (await workflowsAt(deps, main)).find((one) => one.name === name) : undefined;
|
|
93
86
|
return text ? workflowDigest(text) : undefined;
|
|
94
87
|
},
|
|
95
88
|
};
|
|
@@ -104,7 +97,7 @@ export async function replayClaimed(store, agentId, runId, launch, choice) {
|
|
|
104
97
|
if (!launch.replay)
|
|
105
98
|
return;
|
|
106
99
|
const { workflow, digest } = launch.replay;
|
|
107
|
-
const record = promotionOf(await promotionsOf(store.
|
|
100
|
+
const record = promotionOf(await promotionsOf(store.learning, agentId), workflow, digest);
|
|
108
101
|
if (record && record.decided !== "replaying")
|
|
109
102
|
throw new ClaimRefused(`This replay of ${workflow} at ${digest} did not run: that revision is ${record.decided === "promote" ? "promoted already" : "held already"}.`);
|
|
110
103
|
if (record && !record.runs?.includes(runId))
|
|
@@ -121,20 +114,21 @@ export function replayLaid(launch, laid) {
|
|
|
121
114
|
return laid.filter((one) => one.name !== workflow || workflowDigest(one) === digest);
|
|
122
115
|
}
|
|
123
116
|
/** The learned workflows a run's learned_workflow tool runs, once its first choice is made: what serves, never a
|
|
124
|
-
* revision its promotion has not promoted. The one its first choice served
|
|
125
|
-
*
|
|
126
|
-
*
|
|
127
|
-
*
|
|
128
|
-
*
|
|
129
|
-
*
|
|
117
|
+
* revision its promotion has not promoted. The one its first choice served (laidFor: its champion in place of the laid
|
|
118
|
+
* revision) as chosen; any other the records name, its champion (championOf: the laid text when that is the champion,
|
|
119
|
+
* else its text at its record's commit), and none while nothing of it serves (none promoted yet, or the champion
|
|
120
|
+
* held): a revision replaying, held or never decided is never handed to the agent to run in its place. One the records
|
|
121
|
+
* never named is an unchecked draft and is not offered. A replay run's as laid (replayLaid). The records unread: only
|
|
122
|
+
* the one served first, as the gate leaves a run to its agent. The money rule over what this hands the tool, the one
|
|
123
|
+
* its first choice stopped included, is runner/learned-first.ts's (workflow-first.ts toolStopsOf). */
|
|
130
124
|
export async function toolFlowsFor(deps, launch, laid, choice) {
|
|
131
125
|
const chosen = laidFor(laid, choice);
|
|
132
126
|
if (launch.replay || !chosen.length)
|
|
133
127
|
return chosen;
|
|
134
|
-
const name = choice.serve?.name
|
|
128
|
+
const name = choice.serve?.name;
|
|
135
129
|
let records;
|
|
136
130
|
try {
|
|
137
|
-
records = await promotionsOf(deps.store.
|
|
131
|
+
records = await promotionsOf(deps.store.learning, deps.agentId);
|
|
138
132
|
}
|
|
139
133
|
catch (error) {
|
|
140
134
|
deps.log(`workflow-first: the promotions could not be read (${error?.message ?? error}); the learned_workflow tool runs only the workflow chosen first`);
|
|
@@ -147,7 +141,7 @@ export async function toolFlowsFor(deps, launch, laid, choice) {
|
|
|
147
141
|
continue;
|
|
148
142
|
}
|
|
149
143
|
const digest = workflowDigest(one);
|
|
150
|
-
const { champion, text } = await championTextOf(records, one, deps.champion
|
|
144
|
+
const { champion, text } = await championTextOf(records, one, deps.champion);
|
|
151
145
|
if (text === one)
|
|
152
146
|
out.push(one);
|
|
153
147
|
else if (text) {
|
|
@@ -161,11 +155,10 @@ export async function toolFlowsFor(deps, launch, laid, choice) {
|
|
|
161
155
|
}
|
|
162
156
|
/** `flow`'s champion (championOf) and the text it serves from: `flow` itself when it is the champion, else the
|
|
163
157
|
* champion's text read at its record's commit (`read`), kept only when its digest is the champion's. No text: none is
|
|
164
|
-
* promoted, or its text cannot be read
|
|
165
|
-
* refused), so after a purge of its run the newest promotion the gate lets through serves. The one champion lookup a
|
|
158
|
+
* promoted, or its text cannot be read (a purged run's text went with its rows). The one champion lookup a
|
|
166
159
|
* claim's gate (servingNow), the learned_workflow tool (toolFlowsFor) and a connected agent's start (sdk/runs.ts) share. */
|
|
167
|
-
export async function championTextOf(records, flow, read
|
|
168
|
-
const champion = championOf(records, flow.name
|
|
160
|
+
export async function championTextOf(records, flow, read) {
|
|
161
|
+
const champion = championOf(records, flow.name);
|
|
169
162
|
if (!champion)
|
|
170
163
|
return {};
|
|
171
164
|
if (champion.digest === workflowDigest(flow))
|
|
@@ -219,8 +212,8 @@ export const promotionGate = (deps) => {
|
|
|
219
212
|
* does not take the input). Another champion: its text at its record's commit (its digest checked). Undefined when none
|
|
220
213
|
* serves: none promoted, the champion held, or its text cannot be read (the agent takes the run). */
|
|
221
214
|
async function servingNow(deps, workflow, digest, laid) {
|
|
222
|
-
const records = await promotionsOf(deps.store.
|
|
223
|
-
const { champion, text } = await championTextOf(records, workflow, deps.champion
|
|
215
|
+
const records = await promotionsOf(deps.store.learning, deps.agentId);
|
|
216
|
+
const { champion, text } = await championTextOf(records, workflow, deps.champion);
|
|
224
217
|
const own = promotionOf(records, workflow.name, digest);
|
|
225
218
|
if (!champion) {
|
|
226
219
|
if (own?.decided === "promote")
|
|
@@ -257,12 +250,12 @@ async function holdRefused(deps, serving) {
|
|
|
257
250
|
return serving;
|
|
258
251
|
const { name } = serving.workflow;
|
|
259
252
|
const digest = workflowDigest(serving.workflow);
|
|
260
|
-
const current = promotionOf(await promotionsOf(deps.store.
|
|
253
|
+
const current = promotionOf(await promotionsOf(deps.store.learning, deps.agentId), name, digest);
|
|
261
254
|
if (current?.decided !== "promote")
|
|
262
255
|
return serving;
|
|
263
256
|
const reason = excerptShown(`${DSL_REFUSES}: ${refused}`, await deps.shown(), CHECK_TEXT_MAX);
|
|
264
257
|
const record = { workflow: name, digest, at: iso((deps.now ?? Date.now)()), decided: "hold", reason, ...(current.commit ? { commit: current.commit } : {}) };
|
|
265
|
-
const kept = await recordPromotion(deps.store.
|
|
258
|
+
const kept = await recordPromotion(deps.store.learning, deps.agentId, record, (was) => was?.decided === "promote" && was.at === current.at);
|
|
266
259
|
if (kept.won)
|
|
267
260
|
deps.log(`workflow-first: ${name} at ${digest} is held: ${reason}; the agent's next run recompiles it once`);
|
|
268
261
|
return serving;
|
|
@@ -278,7 +271,7 @@ async function keptFor(deps, workflow, digest) {
|
|
|
278
271
|
return undefined;
|
|
279
272
|
if (kept.digest !== digest) {
|
|
280
273
|
// Its newest record naming a commit.
|
|
281
|
-
const record = (await promotionsOf(deps.store.
|
|
274
|
+
const record = (await promotionsOf(deps.store.learning, deps.agentId)).findLast((one) => one.workflow === workflow.name && one.digest === kept.digest && one.commit);
|
|
282
275
|
const text = record?.commit && deps.champion ? await deps.champion(workflow.name, record.commit).catch(() => undefined) : undefined;
|
|
283
276
|
if (text && workflowDigest(text) === kept.digest) {
|
|
284
277
|
deps.log(`workflow-first: ${workflow.name} at ${kept.digest} served this run on an earlier claim; it keeps that revision`);
|
|
@@ -292,7 +285,7 @@ async function keptFor(deps, workflow, digest) {
|
|
|
292
285
|
* (after finishing a launch that was interrupted). It decides nothing about who serves (servingNow does). */
|
|
293
286
|
async function decide(deps, workflow, digest) {
|
|
294
287
|
const { store, agentId, log } = deps;
|
|
295
|
-
const record = promotionOf(await promotionsOf(store.
|
|
288
|
+
const record = promotionOf(await promotionsOf(store.learning, agentId), workflow.name, digest);
|
|
296
289
|
if (record?.decided === "promote")
|
|
297
290
|
return;
|
|
298
291
|
if (record?.decided === "hold") {
|
|
@@ -394,17 +387,17 @@ async function startCheck(deps, workflow, digest) {
|
|
|
394
387
|
const off = deps.spendOff?.("A learned workflow's replay check");
|
|
395
388
|
if (off)
|
|
396
389
|
return void log(`workflow-first: ${off} ${workflow.name} at ${digest} is not checked and does not serve this run`);
|
|
397
|
-
// Only the
|
|
390
|
+
// Only the agent's newest revision is checked: a run pinned to an older save lays an older text.
|
|
398
391
|
const newest = deps.newest ? await deps.newest(workflow.name) : undefined;
|
|
399
392
|
if (newest !== undefined && newest !== digest) {
|
|
400
|
-
log(`workflow-first: ${workflow.name} at ${digest} is not the
|
|
393
|
+
log(`workflow-first: ${workflow.name} at ${digest} is not the agent's newest revision of it (${newest}); it is not checked and does not serve this run`);
|
|
401
394
|
return;
|
|
402
395
|
}
|
|
403
396
|
// One check at a time, and one at work finishes: decided here once its runs ended (its verdict stands), never
|
|
404
397
|
// cancelled. While it runs, this revision waits, recording nothing: the claim after it is decided starts this one.
|
|
405
|
-
for (const ahead of replayingOf(await promotionsOf(store.
|
|
398
|
+
for (const ahead of replayingOf(await promotionsOf(store.learning, agentId), workflow.name, digest))
|
|
406
399
|
await settleAhead(deps, workflow.name, ahead);
|
|
407
|
-
const records = await promotionsOf(store.
|
|
400
|
+
const records = await promotionsOf(store.learning, agentId);
|
|
408
401
|
const rival = replayingOf(records, workflow.name, digest)[0];
|
|
409
402
|
if (rival) {
|
|
410
403
|
log(`workflow-first: ${workflow.name} at ${digest} waits: ${rival.digest} is being checked (one check at a time); it does not serve this run`);
|
|
@@ -443,7 +436,7 @@ export const differentDecisionWords = (k, n, example) => `its answers reached a
|
|
|
443
436
|
* or its owner acts, and `extra` on the record (a connected agent's check: what its reservation carries). Kept only while
|
|
444
437
|
* `still` holds of the digest's record (the one write), and logged. */
|
|
445
438
|
async function holdUnchecked(deps, name, digest, bar, reason, still, { stopped = false, check = {}, extra = {} } = {}) {
|
|
446
|
-
const decided = await recordPromotion(deps.store.
|
|
439
|
+
const decided = await recordPromotion(deps.store.learning, deps.agentId, { workflow: name, digest, at: iso((deps.now ?? Date.now)()), decided: "hold", reason, check: { ...bar, n: 0, agreed: 0, alone: 0, agent_agreed: 0, of: [], ...check, ...(stopped ? { stopped: true } : {}) }, ...seedOf(deps), ...extra }, still);
|
|
447
440
|
if (decided.won)
|
|
448
441
|
deps.log(`workflow-first: ${name} at ${digest} ${stopped ? "stopped" : "held"}: ${reason}`);
|
|
449
442
|
return decided;
|
|
@@ -454,6 +447,46 @@ async function holdUnchecked(deps, name, digest, bar, reason, still, { stopped =
|
|
|
454
447
|
* would have nothing to be checked on either, and a stop with nothing checked never counts as a compile's first check
|
|
455
448
|
* (attemptOf). */
|
|
456
449
|
const stopUnchecked = (deps, name, digest, bar, why, still, check = {}, extra = {}) => holdUnchecked(deps, name, digest, bar, `${NOTHING_TO_CHECK}: ${why}. It is not promoted, and it stops: nothing compiles again until a hold or its owner acts`, still, { stopped: true, check, extra });
|
|
450
|
+
/** The field a check judges a whole answer as, with no agree_on. */
|
|
451
|
+
export const WHOLE_ANSWER = "answer";
|
|
452
|
+
/** A check row as learn/field-check.ts judges it, the one comparison a check and an audit make: an input answered alone
|
|
453
|
+
* with one field per agree_on path (the draft's, the agent's and the grade's value there, compared as values: a path
|
|
454
|
+
* that does not resolve on a side is never right), else one field, the whole answer (`answer`), right as compareAnswers
|
|
455
|
+
* says (`compared`, answered with it: equal, or the same decision by the grader's verdict its run kept) against its
|
|
456
|
+
* best known answer: a grade's expected answer written over the agent's (learn/promote.ts knownAnswerText), the grade
|
|
457
|
+
* saying whether the agent's was right; else the agent's answer, known wrong when a grade with no expected answer said
|
|
458
|
+
* so. The field's `grade` is the grade's own expected answer, the part its owner gave, which a disagreement shows the
|
|
459
|
+
* recompile (and a purge blanks). Field names are never taken from a grade: its keys are a person's data, which a
|
|
460
|
+
* run's purge must leave nowhere. Under agree_on a grade that said the answer was wrong, with no expected answer, names
|
|
461
|
+
* no field, so it changes nothing there. */
|
|
462
|
+
function checkInputOf(row, on) {
|
|
463
|
+
const outcome = row.outcome === "skipped_write" ? "skipped" : row.outcome;
|
|
464
|
+
if (outcome !== "answered")
|
|
465
|
+
return { input: { input_id: row.of, outcome } };
|
|
466
|
+
if (on?.length) {
|
|
467
|
+
return { input: { input_id: row.of, outcome, fields: Object.fromEntries(on.map((path) => {
|
|
468
|
+
const grade = row.expected ? valueAtPath(row.expected, path) : undefined;
|
|
469
|
+
return [path, { workflow: answerAt(row.answer, path), agent: answerAt(row.agent, path), ...(grade !== undefined ? { grade } : {}) }];
|
|
470
|
+
})) } };
|
|
471
|
+
}
|
|
472
|
+
// A grade that marked the agent's answer wrong, yet whose expected answer written over it is that answer, contradicts
|
|
473
|
+
// itself: no known answer there, neither right nor wrong (unjudged).
|
|
474
|
+
const contradicts = row.correct === false && row.expected !== undefined && row.agent !== null && sameAnswer(knownAnswerText(row.agent, row.expected), row.agent);
|
|
475
|
+
const graded = contradicts ? { no_known: true } : row.expected ? { grade: row.expected, ...(row.correct !== undefined ? { agent_correct: row.correct } : {}) } : row.correct === false ? { agent_correct: false } : {};
|
|
476
|
+
const compared = compareAnswers(row.answer, row.expected ? knownAnswerText(row.agent, row.expected) : row.agent, row.compared);
|
|
477
|
+
// The answers as sameAnswer reads them, so a draft that says the agent's answer in another dress repeats it.
|
|
478
|
+
return { input: { input_id: row.of, outcome, fields: { [WHOLE_ANSWER]: { workflow: answerValue(row.answer), agent: answerValue(row.agent), agrees: compared.same, ...graded } } }, compared };
|
|
479
|
+
}
|
|
480
|
+
/** One answer judged as the check judges an input it answered alone (checkInputOf, learn/field-check.ts): `answer`
|
|
481
|
+
* against its known answer, a grade's expected answer (`expected`, written over `agent`'s, whose rightness `correct`
|
|
482
|
+
* says) where one exists, else `agent`'s. True: right on every field. False: wrong on one. Null: a field had no known
|
|
483
|
+
* answer and none was wrong (a grade that contradicts itself). The audit's one verdict (runner/audit.ts). */
|
|
484
|
+
export function answerJudged(row, on) {
|
|
485
|
+
const { agreed, fields } = tallyOf([checkInputOf({ of: "", input: "", outcome: "answered", ...row }, on).input]);
|
|
486
|
+
if (agreed)
|
|
487
|
+
return true;
|
|
488
|
+
return Object.values(fields).some((by) => KNOWN.some((known) => (by[known]?.workflow_right ?? 0) < (by[known]?.n ?? 0))) ? false : null;
|
|
489
|
+
}
|
|
457
490
|
/** Decides `ahead`, the check at work for a revision older than the laid (newest) one, as a claim laying it would
|
|
458
491
|
* (relaunch, then settleCheck) once its runs ended: its text read at its record's commit, its verdict standing (promote
|
|
459
492
|
* or hold) though a newer revision waits. Left replaying while a run of it is at work, or when its text cannot be read
|
|
@@ -471,14 +504,19 @@ async function settleAhead(deps, name, ahead) {
|
|
|
471
504
|
* created yet. One row per reserved input, so every one counts: a run not ended by the deadline failed, and so did one
|
|
472
505
|
* never created by then (`unstarted`: the server stopped after reserving it, say), its input read from the agent's run
|
|
473
506
|
* the record names for it. With what its runs cost, the rows' outcomes (one per row, the never created failed), and how
|
|
474
|
-
* many were never created by the deadline.
|
|
475
|
-
*
|
|
507
|
+
* many were never created by the deadline. Each row carries its agent run's newest grade's expected answer (when not
|
|
508
|
+
* empty) and whether it was right (CheckRow.expected, correct). */
|
|
476
509
|
async function checkRows(deps, record) {
|
|
477
510
|
const { store, context } = deps;
|
|
478
511
|
const runs = await Promise.all((record.runs ?? []).map((id) => store.runs.get(id)));
|
|
479
512
|
const late = (deps.now ?? Date.now)() - Date.parse(record.at) > REPLAY_DEADLINE_MS;
|
|
480
513
|
if (!late && runs.some((row) => !row || !FINAL_STATES.includes(row.state)))
|
|
481
514
|
return undefined;
|
|
515
|
+
// The newest grade of each run (gradesOf keeps them oldest first): a re-grade replaces what an earlier one said.
|
|
516
|
+
const grades = new Map((await gradesOf(store.learning, deps.agentId)).map((grade) => [grade.run, grade]));
|
|
517
|
+
// An input whose grader was asked is judged on the grade it was asked against (Compared.graded): a grade given after
|
|
518
|
+
// that is not the pair's, so it counts from the next check, never makes this verdict stale.
|
|
519
|
+
const graded = (of, compared) => (compared?.graded !== undefined ? compared.graded : comparedGrade(grades.get(of))) ?? {};
|
|
482
520
|
const rows = [];
|
|
483
521
|
for (const [i, run] of runs.entries()) {
|
|
484
522
|
const reservedOf = record.inputs?.[i];
|
|
@@ -501,6 +539,7 @@ async function checkRows(deps, record) {
|
|
|
501
539
|
answer: outcome === "answered" ? await answerOf(store, run.id, context) : null,
|
|
502
540
|
...(outcome === "handed_back" ? { escalated: (await handedBackOf(store, run.id, context)) ?? "" } : {}),
|
|
503
541
|
...(stoppedAt ? { skipped: stoppedAt } : {}),
|
|
542
|
+
...graded(replayed, compared),
|
|
504
543
|
});
|
|
505
544
|
}
|
|
506
545
|
// The outcomes are the rows', so they add up to its n: a reserved run never created is a failed input there too.
|
|
@@ -536,46 +575,66 @@ async function settleCheck(deps, workflow, digest, record) {
|
|
|
536
575
|
}
|
|
537
576
|
return decided.record?.decided === "replaying" ? undefined : decided.record;
|
|
538
577
|
}
|
|
539
|
-
/** A check's rows
|
|
540
|
-
*
|
|
541
|
-
*
|
|
542
|
-
*
|
|
543
|
-
*
|
|
544
|
-
|
|
545
|
-
async function scoreRows(deps, bar, rows, before) {
|
|
578
|
+
/** A check's rows judged field by field (learn/field-check.ts check) on its bar, added to `before` (a connected agent's
|
|
579
|
+
* turns checked so far): each field of agree_on, else the whole answer (checkInputOf), against its best known answer;
|
|
580
|
+
* the inputs it did not agree on (not answered alone, or a field wrong), each naming the fields it had wrong, each text
|
|
581
|
+
* cut of the host's secrets whole, then shortened (learn/secrets.ts excerptShown); and the fast model that compared,
|
|
582
|
+
* when it read any input's answers. */
|
|
583
|
+
async function judgeRows(deps, bar, rows, before) {
|
|
546
584
|
const ran = rows.filter((row) => row.outcome !== "skipped_write");
|
|
547
|
-
|
|
548
|
-
//
|
|
549
|
-
//
|
|
550
|
-
const
|
|
551
|
-
const
|
|
552
|
-
const
|
|
553
|
-
const
|
|
585
|
+
// With no agree_on, the draft's answer is compared whole with its known answer: equal, else the grader's verdict on
|
|
586
|
+
// that pair, which its replay run asked (with no grader, no fast model, they differ). Under agree_on, fields and
|
|
587
|
+
// grades are compared as values (checkInputOf).
|
|
588
|
+
const on = bar.agree_on?.length ? bar.agree_on : undefined;
|
|
589
|
+
const judged = new Map(rows.map((row) => [row, checkInputOf(row, on)]));
|
|
590
|
+
const verdict = checkFields([...judged.values()].map((one) => one.input), bar, before);
|
|
591
|
+
const missed = new Map();
|
|
592
|
+
for (const miss of verdict.misses)
|
|
593
|
+
missed.set(miss.input_id, [...(missed.get(miss.input_id) ?? []), miss.field]);
|
|
594
|
+
const grader = [...judged.values()].find((one) => one.compared?.grader !== undefined)?.compared?.grader;
|
|
554
595
|
const shown = await deps.shown();
|
|
555
596
|
const cut = (text) => excerptShown(text, shown, CHECK_TEXT_MAX);
|
|
556
|
-
|
|
557
|
-
|
|
597
|
+
// The known answers (a grade's) each input's draft missed, for the recompile: never the agent's own (shown);
|
|
598
|
+
// where a grade marked the agent's answer wrong without the right one ("unknown") or contradicts itself
|
|
599
|
+
// ("contradicts"), that it did, no value made up.
|
|
600
|
+
const known = new Map();
|
|
601
|
+
for (const miss of verdict.misses) {
|
|
602
|
+
if (miss.known === "agent")
|
|
603
|
+
continue;
|
|
604
|
+
const value = miss.known !== "grade" ? undefined : cut(typeof miss.expected === "string" ? miss.expected : JSON.stringify(miss.expected) ?? "");
|
|
605
|
+
known.set(miss.input_id, [...(known.get(miss.input_id) ?? []), { field: miss.field, known: miss.known, ...(value !== undefined ? { value } : {}) }]);
|
|
606
|
+
}
|
|
607
|
+
const disagreements = [...(before?.disagreements ?? []), ...ran.filter((row) => row.outcome !== "answered" || missed.has(row.of)).map((row) => {
|
|
608
|
+
const differs = judged.get(row).compared?.differs_on;
|
|
609
|
+
const fields = row.outcome === "answered" ? missed.get(row.of) : undefined;
|
|
610
|
+
const expected = row.outcome === "answered" ? known.get(row.of) : undefined;
|
|
558
611
|
return {
|
|
559
612
|
run: row.of, input: cut(row.input), agent: row.agent === null ? null : cut(row.agent),
|
|
560
613
|
...(row.outcome === "answered" ? { draft: cut(row.answer ?? "") } : row.outcome === "handed_back" ? { escalated: cut(row.escalated ?? "") } : { failed: true }),
|
|
561
614
|
...(differs ? { differs_on: cut(differs) } : {}),
|
|
615
|
+
...(fields ? { fields } : {}),
|
|
616
|
+
...(expected ? { expected } : {}),
|
|
562
617
|
};
|
|
563
618
|
})];
|
|
564
|
-
return {
|
|
619
|
+
return { verdict, disagreements, grader };
|
|
565
620
|
}
|
|
566
621
|
/** Two outcome counts added. */
|
|
567
622
|
const outcomesAdded = (a, b) => b ? { answered: a.answered + b.answered, handed_back: a.handed_back + b.handed_back, failed: a.failed + b.failed, skipped_write: a.skipped_write + b.skipped_write } : a;
|
|
568
|
-
/** Decides a check on its rows, with a connected agent's turns checked before them (`before`),
|
|
569
|
-
* (
|
|
570
|
-
*
|
|
571
|
-
*
|
|
572
|
-
*
|
|
573
|
-
*
|
|
623
|
+
/** Decides a check on its rows, with a connected agent's turns checked before them (`before`), judged field by field on
|
|
624
|
+
* its bar (judgeRows). Promoted when it serves (learn/field-check.ts: enough answered alone, every field passes); else
|
|
625
|
+
* held on its failing fields with the inputs it did not agree on, which the agent's next run's compile turn reads as
|
|
626
|
+
* data (its one recompile); a recompile's check that holds it too stops: nothing compiles again. No refit, queue or
|
|
627
|
+
* second replay. Kept only while `still` holds of the digest's record (the one write: of two claims at once, one
|
|
628
|
+
* decides). */
|
|
574
629
|
export async function decideCheck(deps, name, digest, bar, read, still, extra) {
|
|
575
630
|
const now = deps.now ?? Date.now;
|
|
576
631
|
const { before } = read;
|
|
577
|
-
const {
|
|
578
|
-
const
|
|
632
|
+
const { verdict, disagreements, grader } = await judgeRows(deps, bar, read.rows, before);
|
|
633
|
+
const { tally, fields, failing, joint } = verdict;
|
|
634
|
+
const score = { n: tally.n, agreed: tally.agreed, alone: tally.alone };
|
|
635
|
+
const fieldCount = Object.keys(fields).length;
|
|
636
|
+
const saysJoint = jointSaid(Object.values(fields).map((one) => one.pass), joint.pass);
|
|
637
|
+
const ok = verdict.verdict === "serve";
|
|
579
638
|
const stopped = !ok && bar.attempt === 2;
|
|
580
639
|
const pct = (value) => `${(value * 100).toFixed(1)}%`;
|
|
581
640
|
const shares = checkShares(score);
|
|
@@ -600,23 +659,25 @@ export async function decideCheck(deps, name, digest, bar, read, still, extra) {
|
|
|
600
659
|
// and the words say none ran.
|
|
601
660
|
const said = read.unstarted === score.n
|
|
602
661
|
? `none of its ${plural(score.n, "check run")} started by the check's deadline (its launch was interrupted: the server stopped after reserving it, say): nothing was checked`
|
|
603
|
-
: `checked on ${score.n} of the agent's inputs: answered ${score.alone} alone (${pct(shares.alone)}, the bar ${pct(bar.alone_min)})
|
|
604
|
-
// The
|
|
605
|
-
// once the same
|
|
606
|
-
|
|
662
|
+
: `checked on ${score.n} of the agent's inputs: answered ${score.alone} alone (${pct(shares.alone)}, the bar ${pct(bar.alone_min)})${Object.keys(fields).length ? `; ${Object.values(fields).map((one) => one.reason).join("; ")}` : ""}${saysJoint ? `; right on every field at once: ${joint.agreed} of ${joint.alone} (${pct(shares.agreement)}, the bar ${pct(bar.agree_min)})` : ""}${grader ? `; compared by the fast model (${grader})` : ""}${aside ? ` (${aside})` : ""}`;
|
|
663
|
+
// The whole answer compared with the agent's: with the grader, how many answered alone reached another decision, with
|
|
664
|
+
// one it named; never once the same and no grader: free text two runs never repeat, most likely, so the owner is told
|
|
665
|
+
// what to set.
|
|
666
|
+
const whole = bar.agree_on?.length ? undefined : fields[WHOLE_ANSWER]?.by.agent;
|
|
667
|
+
const differed = whole ? whole.n - whole.workflow_right : 0;
|
|
607
668
|
const example = disagreements.find((one) => one.differs_on !== undefined)?.differs_on;
|
|
608
|
-
const verbatim = ok ||
|
|
609
|
-
const
|
|
610
|
-
const
|
|
669
|
+
const verbatim = ok || !whole ? "" : grader ? (differed > 0 ? `; ${differentDecisionWords(differed, whole.n, example)}` : "") : whole.workflow_right === 0 ? `; ${read.exactMismatchReason ?? NEVER_WORD_FOR_WORD}` : "";
|
|
670
|
+
const heldOn = `held${failing.length ? ` on ${listed(failing)}` : !joint.pass && fieldCount ? " on its fields together" : ""}${verbatim}`;
|
|
671
|
+
const reason = ok ? `${said}: promoted` : stopped ? `${said}: ${heldOn}, and this was the recompile's check, so it stops: nothing compiles again until a hold or its owner acts` : `${said}: ${heldOn}; the agent's next run recompiles it once with the inputs it did not agree on`;
|
|
672
|
+
const check = { ...bar, ...score, agent_agreed: tally.agent_agreed, joint: joint.pass, ...(fieldCount ? { fields } : {}), ...numbers, ...(disagreements.length ? { disagreements } : {}), ...(stopped ? { stopped: true } : {}), ...(grader ? { grader } : {}) };
|
|
611
673
|
const record = { workflow: name, digest, at: iso(now()), decided: ok ? "promote" : "hold", reason, check, ...seedOf(deps), ...extra };
|
|
612
674
|
// A check that outlives its revision's run: the run's purge never stops it (it replays other runs' inputs), and the
|
|
613
|
-
// purge
|
|
614
|
-
//
|
|
615
|
-
|
|
616
|
-
const
|
|
617
|
-
const decided = await recordPromotion(deps.store.settings, deps.agentId, kept, still, deps.refused);
|
|
675
|
+
// purge deletes the revision's rows and records. No version of the workflow holds the digest then: nothing is written
|
|
676
|
+
// (recordPromotion), no hold and no promote of the purged run's text. Read in the record's own write, so no purge goes
|
|
677
|
+
// between.
|
|
678
|
+
const decided = await recordPromotion(deps.store.learning, deps.agentId, record, still);
|
|
618
679
|
if (decided.won)
|
|
619
|
-
deps.log(`workflow-first: ${name} at ${digest} ${
|
|
680
|
+
deps.log(`workflow-first: ${name} at ${digest} ${decided.record?.decided === "promote" ? "promoted" : "held"}: ${decided.record?.reason}`);
|
|
620
681
|
return decided;
|
|
621
682
|
}
|
|
622
683
|
/** Reserves a check of `workflow` at `digest` on `inputs`, then starts its runs: its replaying record names the replay
|
|
@@ -628,7 +689,7 @@ async function reserve(deps, workflow, digest, inputs, reason, still, check) {
|
|
|
628
689
|
const now = deps.now ?? Date.now;
|
|
629
690
|
const ids = inputs.map(() => uuidv7());
|
|
630
691
|
const launch = replayLaunchOf(deps);
|
|
631
|
-
const reserved = await recordPromotion(deps.store.
|
|
692
|
+
const reserved = await recordPromotion(deps.store.learning, deps.agentId, { workflow: workflow.name, digest, at: iso(now()), decided: "replaying", reason, runs: ids, inputs: inputs.map((one) => one.run), replay_id: uuidv7(), launch, ...seedOf(deps), check }, (was, items) => still(was) && replayingOf(items, workflow.name, digest).length === 0);
|
|
632
693
|
if (reserved.won)
|
|
633
694
|
for (const [i, one] of inputs.entries())
|
|
634
695
|
await startReplay(deps, workflow, digest, one.run, one.launch, ids[i], launch);
|
|
@@ -686,7 +747,7 @@ export async function reserveSdkCheck(deps, turn) {
|
|
|
686
747
|
const now = deps.now ?? Date.now;
|
|
687
748
|
for (const flow of turn.flows) {
|
|
688
749
|
const digest = workflowDigest(flow);
|
|
689
|
-
const before = await promotionsOf(deps.store.
|
|
750
|
+
const before = await promotionsOf(deps.store.learning, deps.agentId);
|
|
690
751
|
for (const pending of replayingOf(before, flow.name, null)) {
|
|
691
752
|
if (pending.via !== "sdk" || overtaken(before, pending))
|
|
692
753
|
continue;
|
|
@@ -699,17 +760,17 @@ export async function reserveSdkCheck(deps, turn) {
|
|
|
699
760
|
}
|
|
700
761
|
if (!turn.takes(flow))
|
|
701
762
|
continue;
|
|
702
|
-
const records = await promotionsOf(deps.store.
|
|
763
|
+
const records = await promotionsOf(deps.store.learning, deps.agentId);
|
|
703
764
|
const own = promotionOf(records, flow.name, digest);
|
|
704
765
|
if ((own && !waitingSdk(own)) || blocking(records, flow.name, digest).length)
|
|
705
766
|
continue;
|
|
706
767
|
const id = uuidv7();
|
|
707
768
|
const check = own?.check ?? { ...loopOf(turn.learning), attempt: attemptOf(records, flow.name, digest) };
|
|
708
|
-
const reserved = await recordPromotion(deps.store.
|
|
769
|
+
const reserved = await recordPromotion(deps.store.learning, deps.agentId, {
|
|
709
770
|
workflow: flow.name, digest, at: iso(now()), decided: "replaying", via: "sdk",
|
|
710
771
|
reason: `Checking it in the connected agent against an independent native turn before it can be reused: ${sdkTurnsWords(check)}.`,
|
|
711
772
|
replay_id: id, runs: [turn.runId], inputs: [turn.runId], commit: revision, check,
|
|
712
|
-
}, (was, current) => (own ? waitingSdk(was) && was.replay_id === own.replay_id : was === undefined) && blocking(current, flow.name, digest).length === 0
|
|
773
|
+
}, (was, current) => (own ? waitingSdk(was) && was.replay_id === own.replay_id : was === undefined) && blocking(current, flow.name, digest).length === 0);
|
|
713
774
|
if (reserved.won)
|
|
714
775
|
return { id, revision, digest, workflow: flow };
|
|
715
776
|
}
|
|
@@ -733,13 +794,13 @@ export async function sdkCheckTurn(deps, record, row, still, read = {}) {
|
|
|
733
794
|
const turnStill = (was, current) => still(was, current) && heldTurn(was, record);
|
|
734
795
|
if ((before?.n ?? 0) + 1 >= bar.compile_after)
|
|
735
796
|
return decideCheck(deps, record.workflow, record.digest, bar, { rows: [row], cost: null, outcomes, unstarted: 0, ...read, ...(before ? { before } : {}) }, turnStill, sdkExtra(record));
|
|
736
|
-
if (overtaken(await promotionsOf(deps.store.
|
|
797
|
+
if (overtaken(await promotionsOf(deps.store.learning, deps.agentId), record)) {
|
|
737
798
|
deps.log(`workflow-first: ${record.workflow} at ${record.digest} checked a native turn; a newer revision has a record since, so it is left as it is`);
|
|
738
799
|
return;
|
|
739
800
|
}
|
|
740
|
-
const {
|
|
801
|
+
const { verdict: { tally }, disagreements } = await judgeRows(deps, bar, [row], before);
|
|
741
802
|
const fresh = (before?.fresh_reads ?? 0) + (read.fresh_reads ?? 0);
|
|
742
|
-
const turns = {
|
|
803
|
+
const turns = { n: tally.n, agreed: tally.agreed, alone: tally.alone, agent_agreed: tally.agent_agreed, fields: tally.fields, of: [row.of, ...(before?.of ?? [])], outcomes: outcomesAdded(outcomes, before?.outcomes), ...(disagreements.length ? { disagreements } : {}), ...(fresh ? { fresh_reads: fresh } : {}) };
|
|
743
804
|
const check = { ...bar, turns };
|
|
744
805
|
const kept = await waitAgain(deps, record, check, `Waiting for the next native turn of the connected agent that it takes: ${sdkTurnsWords(check)}. Nothing was promoted.`, still);
|
|
745
806
|
if (kept.won)
|
|
@@ -753,7 +814,7 @@ export async function sdkCheckTurn(deps, record, row, still, read = {}) {
|
|
|
753
814
|
* as waiting: a turn's row (sdkCheckTurn) and a give-back (releaseSdkCheck). */
|
|
754
815
|
function waitAgain(deps, record, check, reason, still = () => true) {
|
|
755
816
|
const { runs: _runs, inputs: _inputs, ...rest } = record;
|
|
756
|
-
return recordPromotion(deps.store.
|
|
817
|
+
return recordPromotion(deps.store.learning, deps.agentId, { ...rest, at: iso((deps.now ?? Date.now)()), check, reason }, (was, current) => still(was, current) && sameReplay(was, record) && heldTurn(was, record) && !overtaken(current, was));
|
|
757
818
|
}
|
|
758
819
|
/** A connected agent's check whose native turn did not settle it by REPLAY_DEADLINE_MS (the backend never completed the
|
|
759
820
|
* turn, or the server stopped before the run's end): one failed row of its turns (sdkCheckTurn), as a managed check's
|
|
@@ -762,7 +823,7 @@ function waitAgain(deps, record, check, reason, still = () => true) {
|
|
|
762
823
|
export async function sdkCheckDeadline(deps, pending) {
|
|
763
824
|
const runId = pending.runs?.[0];
|
|
764
825
|
const { check } = pending;
|
|
765
|
-
if (!runId || !check || overtaken(await promotionsOf(deps.store.
|
|
826
|
+
if (!runId || !check || overtaken(await promotionsOf(deps.store.learning, deps.agentId), pending))
|
|
766
827
|
return;
|
|
767
828
|
const launch = await deps.store.runs.launch(runId).then((one) => readLaunchBody(one.body), () => undefined);
|
|
768
829
|
return sdkCheckTurn(deps, { ...pending, check }, { of: runId, input: sdkInputText(launch), agent: null, outcome: "failed", answer: null }, (was, current) => sameReplay(was, pending) && !overtaken(current, was));
|
|
@@ -775,7 +836,7 @@ export async function sdkCheckDeadline(deps, pending) {
|
|
|
775
836
|
export async function releaseSdkCheck(deps, record, cause, counted = true) {
|
|
776
837
|
if (!record.check)
|
|
777
838
|
return;
|
|
778
|
-
if (overtaken(await promotionsOf(deps.store.
|
|
839
|
+
if (overtaken(await promotionsOf(deps.store.learning, deps.agentId), record)) {
|
|
779
840
|
deps.log(`workflow-first: ${record.workflow} at ${record.digest} gave back its native turn (${cause}); a newer revision has a record since, so it is left as it is`);
|
|
780
841
|
return;
|
|
781
842
|
}
|
|
@@ -1002,14 +1063,7 @@ export class ReplayRefused extends Error {
|
|
|
1002
1063
|
* first), else the folder's main. When neither holds it, whether the agent has a workflow by that name at all (`named`:
|
|
1003
1064
|
* a record names it, or main holds it). */
|
|
1004
1065
|
async function revisionOf(ask, records, name, digest) {
|
|
1005
|
-
const
|
|
1006
|
-
let main;
|
|
1007
|
-
try {
|
|
1008
|
-
main = (await readSnapshot(folder.workspace))?.main;
|
|
1009
|
-
}
|
|
1010
|
-
finally {
|
|
1011
|
-
await folder.end().catch(() => undefined);
|
|
1012
|
-
}
|
|
1066
|
+
const main = (await readView(learningOf(ask.store, ask.agentId)))?.main;
|
|
1013
1067
|
const named = records.filter((one) => one.workflow === name && one.digest === digest && one.commit).map((one) => one.commit).reverse();
|
|
1014
1068
|
let onMain = false;
|
|
1015
1069
|
for (const commit of new Set([...named, ...(main ? [main] : [])])) {
|
|
@@ -1022,8 +1076,7 @@ async function revisionOf(ask, records, name, digest) {
|
|
|
1022
1076
|
return { named: onMain || records.some((one) => one.workflow === name) };
|
|
1023
1077
|
}
|
|
1024
1078
|
/** The agent runs `name` at `digest` was last checked on: its newest record that names them, a decided
|
|
1025
|
-
* check's `check.of` or a reservation's `inputs
|
|
1026
|
-
* its decision stays, so the decision's own list is read first. Undefined when no record names any. */
|
|
1079
|
+
* check's `check.of` or a reservation's `inputs`, the decision's own list read first. Undefined when no record names any. */
|
|
1027
1080
|
function heldInputsOf(records, name, digest) {
|
|
1028
1081
|
const checked = (one) => (one.decided !== "replaying" && one.check?.of?.length ? one.check.of : undefined);
|
|
1029
1082
|
const last = records.findLast((one) => one.workflow === name && one.digest === digest && (checked(one) ?? one.inputs)?.length);
|
|
@@ -1037,10 +1090,10 @@ function heldInputsOf(records, name, digest) {
|
|
|
1037
1090
|
* (it serves already); no input it fits (nothing is reserved); an agent that does not learn here. The replay's id and
|
|
1038
1091
|
* its inputs. */
|
|
1039
1092
|
export async function askReplay(ask, name, digest, inputs) {
|
|
1040
|
-
const records = await promotionsOf(ask.store.
|
|
1093
|
+
const records = await promotionsOf(ask.store.learning, ask.agentId);
|
|
1041
1094
|
const found = await revisionOf(ask, records, name, digest);
|
|
1042
1095
|
if ("named" in found)
|
|
1043
|
-
throw new ReplayRefused("missing", found.named ? `The learned workflow ${name} has no revision ${digest}: no promotion record names it, and the learning
|
|
1096
|
+
throw new ReplayRefused("missing", found.named ? `The learned workflow ${name} has no revision ${digest}: no promotion record names it, and the newest learning save holds another.` : `The agent has no learned workflow ${name}.`);
|
|
1044
1097
|
const own = promotionOf(records, name, digest);
|
|
1045
1098
|
if (own?.decided === "replaying")
|
|
1046
1099
|
throw new ReplayRefused("conflict", `${name} at ${digest} is replaying already: read that replay, or wait for it to end.`);
|
|
@@ -1062,7 +1115,7 @@ export async function askReplay(ask, name, digest, inputs) {
|
|
|
1062
1115
|
throw new ReplayRefused("conflict", PROJECT_REPLAY_REFUSED);
|
|
1063
1116
|
if (!launch.learning || launch.learning.noWorkflows)
|
|
1064
1117
|
throw new ReplayRefused("conflict", `A replay runs ${name} as a run of the agent that learns does, and the agent's runs do not take learned workflows here (its learning is off, it takes no workflows, or this server's is off).`);
|
|
1065
|
-
const deps = { store: ask.store, agentId: ask.agentId, revisionId, launch: { ...launch, learning: { ...launch.learning, seed: found.commit } }, context: ask.context, log: ask.log, shown: ask.shown,
|
|
1118
|
+
const deps = { store: ask.store, agentId: ask.agentId, revisionId, launch: { ...launch, learning: { ...launch.learning, seed: found.commit } }, context: ask.context, log: ask.log, shown: ask.shown, ...(ask.admitAuxiliary ? { admitAuxiliary: ask.admitAuxiliary } : {}), ...(ask.now ? { now: ask.now } : {}) };
|
|
1066
1119
|
const bar = { ...loop, attempt: attemptOf(records, name, digest) };
|
|
1067
1120
|
const said = `checking it on ${plural(picked.length, "input")} of the agent's own runs, as its owner asked`;
|
|
1068
1121
|
// Kept only while the revision's newest record is still the one read here: each record write stamps a new `at`.
|
|
@@ -1083,8 +1136,11 @@ async function checkView(ask, record, id, name, digest) {
|
|
|
1083
1136
|
const n = check.n ?? 0;
|
|
1084
1137
|
const handedBack = check.outcomes.handed_back;
|
|
1085
1138
|
const wf = n ? Math.round(((check.agreed ?? 0) + handedBack) / n * 1e4) / 1e4 : 0;
|
|
1139
|
+
// The agent's misses are counted where the workflow's are, on the inputs it answered alone (agent_agreed).
|
|
1140
|
+
const alone = check.alone ?? 0;
|
|
1141
|
+
const agent = n ? Math.round((n - (alone - (check.agent_agreed ?? 0))) / n * 1e4) / 1e4 : 0;
|
|
1086
1142
|
const neverStarted = inputs > 0 && check.unstarted === inputs;
|
|
1087
|
-
return { replay: id, workflow: name, digest, status: neverStarted ? "failed" : "done", inputs, outcomes: check.outcomes, score: { n, agree: check.agreed ?? 0, agent_acc:
|
|
1143
|
+
return { replay: id, workflow: name, digest, status: neverStarted ? "failed" : "done", inputs, outcomes: check.outcomes, score: { n, agree: check.agreed ?? 0, agent_acc: agent, wf_acc: wf, delta: n ? Math.round((wf - agent) * 1e4) / 1e4 : 0, handed_back: handedBack }, cost_usd: check.cost_usd ?? null, decided, reason: record.reason };
|
|
1088
1144
|
}
|
|
1089
1145
|
const runs = await Promise.all((record.runs ?? []).map((run) => ask.store.runs.get(run)));
|
|
1090
1146
|
return { replay: id, workflow: name, digest, status: decided ? "done" : "running", inputs, outcomes: outcomesOf(runs, false), score: NO_SCORE, cost_usd: replayCost(runs, false), ...(decided ? { decided, reason: record.reason } : {}) };
|
|
@@ -1103,7 +1159,7 @@ function readPorts(ask, launch) {
|
|
|
1103
1159
|
* older, held one) is decided too, and never running forever. Once decided, it reads only its record. Refused
|
|
1104
1160
|
* (missing) when the agent has no such replay. */
|
|
1105
1161
|
export async function replayView(ask, name, digest, id) {
|
|
1106
|
-
const find = async () => (await promotionsOf(ask.store.
|
|
1162
|
+
const find = async () => (await promotionsOf(ask.store.learning, ask.agentId)).findLast((one) => one.workflow === name && one.digest === digest && one.replay_id === id);
|
|
1107
1163
|
let record = await find();
|
|
1108
1164
|
if (!record)
|
|
1109
1165
|
throw new ReplayRefused("missing", `${name} at ${digest} has no replay ${id}.`);
|
package/dist/runner/redact.d.ts
CHANGED
|
@@ -11,7 +11,9 @@ export declare const keepText: Redact;
|
|
|
11
11
|
/** Every secret value `env` holds for the runner: the server's held secrets, the MCP credentials and every key-, token-,
|
|
12
12
|
* secret- or password-named value (secrets.ts hostSecrets), and the value `env` itself gives each launcher name (a
|
|
13
13
|
* runner's key comes in its env, which hostSecrets reads only for names off the launcher's list), with any `extra` a
|
|
14
|
-
* caller holds. One shorter than MIN_SECRET, whitespace aside, matches too much text by
|
|
14
|
+
* caller holds, and each OTLP header value. One shorter than MIN_SECRET, whitespace aside, matches too much text by
|
|
15
|
+
* chance and is left out, an OTLP header value's too (secrets.ts keptSecrets); the tracer's own lines cut a short
|
|
16
|
+
* header value as well (secrets.ts otlpHeaderCut). */
|
|
15
17
|
export declare function runnerSecrets(env: NodeJS.ProcessEnv, extra?: readonly string[]): string[];
|
|
16
18
|
/** The redactor over `values`: each one, in every form, replaced with "[redacted]". With none, text is left as it is. */
|
|
17
19
|
export declare function secretRedactor(values: readonly string[]): Redact;
|