@parcha/agentrun-serve 0.1.0-beta.56 → 0.1.0-beta.58
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 +281 -0
- package/README.md +246 -66
- package/dist/acp-package.d.ts +2 -0
- package/dist/adapters.d.ts +15 -3
- package/dist/adapters.js +17 -6
- package/dist/agent-package.d.ts +3 -3
- package/dist/agent-package.js +17 -8
- package/dist/api-keys.d.ts +76 -0
- package/dist/api-keys.js +217 -0
- package/dist/api-only.d.ts +15 -5
- package/dist/api-only.js +32 -8
- package/dist/box-paths.d.ts +4 -3
- package/dist/box-paths.js +7 -4
- package/dist/browser-hold.d.ts +23 -0
- package/dist/browser-hold.js +48 -0
- package/dist/browser-person.d.ts +3 -0
- package/dist/browser-person.js +4 -1
- package/dist/chatgpt-plan.d.ts +18 -8
- package/dist/chatgpt-plan.js +91 -34
- package/dist/claude-login-token.d.ts +117 -0
- package/dist/claude-login-token.js +737 -0
- package/dist/claude-login.d.ts +120 -22
- package/dist/claude-login.js +347 -63
- package/dist/claude-sign-in.d.ts +17 -6
- package/dist/claude-sign-in.js +42 -39
- package/dist/cli.js +33 -10
- package/dist/composio-made.d.ts +4 -0
- package/dist/composio-made.js +4 -0
- package/dist/composio-preset.d.ts +43 -2
- package/dist/composio-preset.js +92 -4
- package/dist/computer-attach.d.ts +35 -17
- package/dist/computer-attach.js +301 -49
- package/dist/computer-held-routes.d.ts +5 -4
- package/dist/computer-held-routes.js +29 -8
- package/dist/computer-held.d.ts +6 -1
- package/dist/computer-held.js +14 -0
- package/dist/computer-record.js +4 -2
- package/dist/computer-viewer.js +4 -1
- package/dist/computers.d.ts +10 -10
- package/dist/computers.js +5 -5
- package/dist/console/assets/{backend-Boh7tC4i.js → backend-CSAWUqtZ.js} +19 -19
- package/dist/console/assets/index-Bwn1oTem.css +1 -0
- package/dist/console/assets/index-DPh29cyz.js +747 -0
- package/dist/console/index.html +2 -2
- package/dist/decisions.d.ts +1 -1
- package/dist/decisions.js +1 -1
- package/dist/dial-relay.d.ts +25 -4
- package/dist/dial-relay.js +129 -1
- package/dist/docker-host-addresses.d.ts +22 -11
- package/dist/docker-host-addresses.js +38 -26
- package/dist/env-switch.d.ts +8 -0
- package/dist/env-switch.js +31 -2
- package/dist/errors.d.ts +1 -0
- package/dist/errors.js +2 -0
- package/dist/fal-price.d.ts +56 -20
- package/dist/fal-price.js +400 -90
- package/dist/handed-values.d.ts +43 -1
- package/dist/handed-values.js +119 -2
- package/dist/harness-archive.d.ts +13 -10
- package/dist/harness-archive.js +60 -34
- package/dist/harness-check.d.ts +3 -1
- package/dist/harness-check.js +25 -46
- package/dist/harness-keys.d.ts +73 -27
- package/dist/harness-keys.js +194 -61
- package/dist/harness-recipe-entry.d.ts +8 -7
- package/dist/harness-recipe-entry.js +21 -32
- package/dist/harness-recipe.d.ts +38 -25
- package/dist/harness-recipe.js +49 -36
- package/dist/harness-sign-in.js +12 -23
- package/dist/harness-table.d.ts +10 -3
- package/dist/harness-table.js +26 -21
- package/dist/harness.d.ts +1 -0
- package/dist/harness.js +17 -5
- package/dist/hosted-search.d.ts +1 -1
- package/dist/hosted-search.js +1 -2
- package/dist/import-worker.d.ts +4 -2
- package/dist/import-worker.js +9 -2
- package/dist/in-flight.d.ts +26 -0
- package/dist/in-flight.js +52 -0
- package/dist/key-refusal.d.ts +9 -4
- package/dist/key-refusal.js +107 -25
- package/dist/learn/ledger.d.ts +170 -0
- package/dist/learn/ledger.js +218 -0
- package/dist/learn/promote.d.ts +3 -3
- package/dist/learn/promote.js +1 -1
- package/dist/learn/secrets.d.ts +13 -3
- package/dist/learn/secrets.js +118 -17
- package/dist/learning-cost.d.ts +28 -23
- package/dist/learning-cost.js +19 -23
- package/dist/link-check.js +1 -1
- package/dist/live-reach.d.ts +2 -0
- package/dist/live-reach.js +2 -0
- package/dist/llms.txt +1 -1
- package/dist/marketplace.d.ts +77 -0
- package/dist/marketplace.js +224 -0
- package/dist/mcp-api-only-origins.d.ts +35 -0
- package/dist/mcp-api-only-origins.js +57 -0
- package/dist/mcp-gateway.d.ts +7 -5
- package/dist/mcp-gateway.js +9 -12
- package/dist/mcp-secret-writes.js +5 -3
- package/dist/mcp-servers-store.d.ts +28 -6
- package/dist/mcp-servers-store.js +53 -4
- package/dist/media-duration.d.ts +3 -0
- package/dist/media-duration.js +90 -9
- package/dist/micro.d.ts +2 -0
- package/dist/micro.js +2 -0
- package/dist/model-form.d.ts +5 -4
- package/dist/model-form.js +11 -7
- package/dist/model.d.ts +10 -6
- package/dist/model.js +16 -11
- package/dist/monid.d.ts +14 -1
- package/dist/monid.js +103 -26
- package/dist/ollama-provider.d.ts +7 -1
- package/dist/ollama-provider.js +14 -2
- package/dist/openapi.js +210 -37
- package/dist/otel/genai.d.ts +65 -0
- package/dist/otel/genai.js +116 -0
- package/dist/otel/tracer.d.ts +55 -0
- package/dist/otel/tracer.js +308 -0
- package/dist/page.d.ts +2 -0
- package/dist/page.js +3 -1
- package/dist/paid-calls.d.ts +1 -32
- package/dist/paid-calls.js +4 -39
- package/dist/place-offers.d.ts +4 -0
- package/dist/place-offers.js +7 -4
- package/dist/provider.d.ts +11 -2
- package/dist/provider.js +59 -8
- package/dist/redact/match.d.ts +30 -3
- package/dist/redact/match.js +422 -41
- package/dist/refusal-words.d.ts +11 -0
- package/dist/refusal-words.js +11 -0
- package/dist/run-census.d.ts +67 -0
- package/dist/run-census.js +240 -0
- package/dist/run-computer.d.ts +6 -3
- package/dist/run-computer.js +4 -1
- package/dist/run-cut.d.ts +15 -6
- package/dist/run-cut.js +30 -9
- package/dist/run-files.d.ts +3 -0
- package/dist/run-files.js +3 -0
- package/dist/run-launch.d.ts +12 -1
- package/dist/run-launch.js +9 -10
- package/dist/run-learning-served.d.ts +4 -2
- package/dist/run-model-key.d.ts +8 -0
- package/dist/run-model-key.js +31 -1
- package/dist/run-reads-over-store.d.ts +24 -6
- package/dist/run-reads-over-store.js +67 -23
- package/dist/run-recordings.d.ts +5 -1
- package/dist/run-recordings.js +39 -14
- package/dist/run-timeline-served.d.ts +2 -0
- package/dist/run-timeline-served.js +2 -2
- package/dist/run-usage.d.ts +1 -0
- package/dist/run-view.d.ts +1 -2
- package/dist/run-view.js +2 -1
- package/dist/runnable.d.ts +10 -1
- package/dist/runnable.js +20 -8
- package/dist/runner/adapter-loop.d.ts +11 -0
- package/dist/runner/adapter-loop.js +58 -26
- package/dist/runner/adapter-run-spec.d.ts +55 -11
- package/dist/runner/adapter-run-spec.js +183 -52
- package/dist/runner/adapters/pi.js +25 -3
- package/dist/runner/beside.d.ts +9 -2
- package/dist/runner/beside.js +27 -9
- package/dist/runner/big-writes.js +1 -10
- package/dist/runner/claim-secrets.d.ts +27 -10
- package/dist/runner/claim-secrets.js +49 -22
- package/dist/runner/cli-run-spec.d.ts +6 -0
- package/dist/runner/cli-run-spec.js +97 -38
- package/dist/runner/computer-journal.d.ts +9 -1
- package/dist/runner/computer-journal.js +26 -0
- package/dist/runner/conformance/harness.js +1 -1
- package/dist/runner/feedback-round.js +3 -0
- package/dist/runner/harness-loops.d.ts +6 -5
- package/dist/runner/harness-loops.js +7 -7
- package/dist/runner/held.d.ts +24 -6
- package/dist/runner/journal-kinds.d.ts +5 -0
- package/dist/runner/journal-kinds.js +5 -0
- package/dist/runner/main.d.ts +11 -6
- package/dist/runner/main.js +19 -9
- package/dist/runner/mcp-claim.js +31 -3
- package/dist/runner/mcp-run.d.ts +9 -0
- package/dist/runner/mcp-run.js +11 -5
- package/dist/runner/model-route.d.ts +17 -0
- package/dist/runner/model-route.js +120 -2
- package/dist/runner/presence.d.ts +11 -1
- package/dist/runner/presence.js +7 -0
- package/dist/runner/reflect-hook.js +1 -1
- package/dist/runner/run-child-host.d.ts +22 -8
- package/dist/runner/run-child-host.js +128 -41
- package/dist/runner/run-child.js +5 -2
- package/dist/runner/runner.d.ts +17 -3
- package/dist/runner/runner.js +130 -34
- package/dist/runner/save-slots.js +2 -1
- package/dist/runner/store-port.d.ts +1 -1
- package/dist/runner/store-secrets.d.ts +6 -0
- package/dist/runner/store-secrets.js +49 -7
- package/dist/runner/subagent.d.ts +11 -0
- package/dist/runner/subagent.js +16 -38
- package/dist/runner/workflow-first.d.ts +35 -15
- package/dist/runner/workflow-first.js +38 -25
- package/dist/runner/workflow-spec.js +4 -3
- package/dist/runs-over-store.d.ts +15 -6
- package/dist/runs-over-store.js +33 -21
- package/dist/scrub-command.d.ts +73 -0
- package/dist/scrub-command.js +307 -0
- package/dist/secret-cut.d.ts +73 -0
- package/dist/secret-cut.js +291 -4
- package/dist/secret-rules.d.ts +143 -0
- package/dist/secret-rules.js +2564 -0
- package/dist/secrets.d.ts +7 -0
- package/dist/secrets.js +20 -0
- package/dist/server-keys.d.ts +20 -0
- package/dist/server-keys.js +25 -6
- package/dist/server.d.ts +65 -13
- package/dist/server.js +470 -157
- package/dist/skills/agentrun-serve/SKILL.md +4 -0
- package/dist/slots.d.ts +9 -0
- package/dist/slots.js +45 -0
- package/dist/store/index.d.ts +1 -1
- package/dist/store/index.js +1 -1
- package/dist/store/journal/storage.js +1 -1
- package/dist/store/postgres/migrations/0027_run_launch_census.sql +31 -0
- package/dist/store/postgres/migrations/0028_learning_ledger.sql +44 -0
- package/dist/store/schema.d.ts +23 -0
- package/dist/store/schema.js +58 -2
- package/dist/store/seal.d.ts +6 -1
- package/dist/store/seal.js +5 -3
- package/dist/store/sqlite/run-launch.d.ts +9 -1
- package/dist/store/sqlite/run-launch.js +24 -13
- package/dist/store/sqlite/run-patch.d.ts +12 -2
- package/dist/store/sqlite/run-patch.js +42 -5
- package/dist/store/sqlite/store.js +105 -12
- package/dist/store/store.d.ts +57 -2
- package/dist/store/store.js +20 -0
- package/dist/store-reads/learning.d.ts +84 -124
- package/dist/store-reads/learning.js +210 -274
- package/dist/store-view.d.ts +3 -0
- package/dist/store-view.js +3 -3
- package/dist/suggestions.js +3 -2
- package/dist/template-eval.d.ts +39 -9
- package/dist/template-eval.js +191 -60
- package/dist/template-import.js +6 -2
- package/dist/templates.d.ts +10 -2
- package/dist/templates.js +28 -8
- package/dist/timeline/labels.d.ts +6 -4
- package/dist/timeline/labels.js +18 -6
- package/dist/timeline/timeline.d.ts +5 -0
- package/dist/timeline/timeline.js +14 -8
- package/dist/timeline/util.js +1 -1
- package/dist/timeline/web-calls.d.ts +22 -7
- package/dist/timeline/web-calls.js +106 -35
- package/dist/tool-gate.d.ts +42 -3
- package/dist/tool-gate.js +66 -5
- package/dist/tool-keys-store.d.ts +2 -4
- package/dist/tool-keys-store.js +5 -21
- package/dist/tool-keys.d.ts +2 -2
- package/dist/tool-keys.js +2 -2
- package/dist/tool-list.js +1 -1
- package/dist/tool-plane.d.ts +2 -2
- package/dist/tool-plane.js +35 -33
- package/dist/tools.js +13 -7
- package/dist/trigger-targets.d.ts +4 -0
- package/dist/trigger-targets.js +9 -2
- package/dist/triggers.d.ts +67 -4
- package/dist/triggers.js +171 -22
- package/dist/until.d.ts +3 -0
- package/dist/until.js +11 -0
- package/dist/web-fake.d.ts +1 -3
- package/dist/web-fake.js +7 -18
- package/dist/web-fetch.d.ts +6 -72
- package/dist/web-fetch.js +11 -265
- package/dist/web-run.d.ts +31 -0
- package/dist/web-run.js +90 -0
- package/dist/web-save.d.ts +10 -13
- package/dist/web-save.js +13 -55
- package/dist/web-search.d.ts +9 -127
- package/dist/web-search.js +23 -259
- package/dist/wires.d.ts +13 -0
- package/dist/wires.js +11 -0
- package/dist/workflow-run.d.ts +5 -4
- package/dist/workflow-run.js +5 -4
- package/dist/workspace/attached-computers.d.ts +32 -9
- package/dist/workspace/attached-computers.js +77 -13
- package/dist/workspace/computer-deps.d.ts +8 -2
- package/dist/workspace/computer-deps.js +10 -3
- package/dist/workspace/computer-for-claim.d.ts +12 -1
- package/dist/workspace/computer-for-claim.js +83 -11
- package/dist/workspace/computer-kept.d.ts +3 -0
- package/dist/workspace/computer-kept.js +11 -2
- package/dist/workspace/index.d.ts +1 -1
- package/dist/workspace/index.js +1 -1
- package/dist/workspace/kind-skills.d.ts +4 -0
- package/dist/workspace/kind-skills.js +9 -0
- package/dist/workspace/paired-route.d.ts +91 -0
- package/dist/workspace/paired-route.js +153 -0
- package/dist/workspace/synced-folder.js +3 -4
- package/dist/wrapped.d.ts +20 -6
- package/dist/wrapped.js +66 -25
- package/package.json +17 -11
- package/skills/agentrun-serve/SKILL.md +4 -0
- package/templates/README.md +32 -10
- package/dist/console/assets/index-CQ3cJRzI.js +0 -746
- package/dist/console/assets/index-DKkaS3a0.css +0 -1
- package/dist/exa-keyless.d.ts +0 -34
- package/dist/exa-keyless.js +0 -118
- package/dist/firecrawl-keyless.d.ts +0 -41
- package/dist/firecrawl-keyless.js +0 -152
- package/dist/keyless-mcp.d.ts +0 -36
- package/dist/keyless-mcp.js +0 -127
- package/dist/text-urls.d.ts +0 -38
- package/dist/text-urls.js +0 -170
- package/dist/web-fetch-direct.d.ts +0 -119
- package/dist/web-fetch-direct.js +0 -190
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { type ItemStatus, type Learning, type Shown } from "../learning.js";
|
|
2
2
|
import { type RunLaunch } from "../run-launch.js";
|
|
3
3
|
import { type Impact, type ImpactLearning } from "../learning-run.js";
|
|
4
|
-
import {
|
|
5
|
-
import { type
|
|
4
|
+
import { type Bill, type CostReplay, type CostRun, type CostSummary, type RunPath } from "../learning-cost.js";
|
|
5
|
+
import { type Answered, type LedgerRow, type RevisionAt, type RunFigures, type Summarized } from "../learn/ledger.js";
|
|
6
|
+
import { type PastRuns, workflowCostsOf } from "../runner/workflow-first.js";
|
|
6
7
|
import { type Reflect } from "../reflect-range.js";
|
|
7
8
|
import type { EntryLike, TimelineEvent } from "../timeline/index.js";
|
|
8
9
|
import type { AnalyticsFilter } from "./analytics.js";
|
|
@@ -10,23 +11,6 @@ import { type PromotionRecord, type Refused, type ResetRevision } from "../learn
|
|
|
10
11
|
import type { LearningProposal, Store } from "../store/store.js";
|
|
11
12
|
/** A run's learning end: the Learning fields its end sets. */
|
|
12
13
|
export type RunLearningEnd = Learning;
|
|
13
|
-
/** The kept row as the end-of-run hook writes it (runner/reflect-hook.ts), read as untrusted. */
|
|
14
|
-
type KeptRow = {
|
|
15
|
-
readonly state?: unknown;
|
|
16
|
-
readonly reason?: unknown;
|
|
17
|
-
readonly detail?: unknown;
|
|
18
|
-
readonly problems?: Learning["problems"];
|
|
19
|
-
readonly merged?: unknown;
|
|
20
|
-
readonly workflows?: Learning["workflows"];
|
|
21
|
-
readonly corrections?: unknown;
|
|
22
|
-
readonly compiled?: unknown;
|
|
23
|
-
readonly draft_errors?: unknown;
|
|
24
|
-
readonly answered_at?: unknown;
|
|
25
|
-
readonly job_cost_usd?: unknown;
|
|
26
|
-
readonly look_back_usd?: unknown;
|
|
27
|
-
};
|
|
28
|
-
/** What a kept row says of a run that looked back (its compile turn's figures): none for one that did not. */
|
|
29
|
-
declare function answeredOf(row: KeptRow): Pick<Learning, "answered_at" | "job_cost_usd" | "look_back_usd">;
|
|
30
14
|
/** The reads of a run's records a learning read makes: its launch, a round of its kept learning, a run's row. The
|
|
31
15
|
* store's own reads, one a run, or an agent's read at once (agentRecordsOf). */
|
|
32
16
|
export type RunRecords = {
|
|
@@ -82,17 +66,17 @@ export declare function agentLearningOverStore(store: Store, agentId: string): P
|
|
|
82
66
|
counts: Omit<LearningCounts, "runs">;
|
|
83
67
|
impact: Impact;
|
|
84
68
|
}>;
|
|
85
|
-
/** Agent `agentId`'s cost per run from the one store (GET /agents/{id}/learning/cost, learning-cost.ts):
|
|
86
|
-
*
|
|
87
|
-
*
|
|
88
|
-
* learning
|
|
89
|
-
*
|
|
90
|
-
* the
|
|
91
|
-
* out. A run that learns whose
|
|
92
|
-
*
|
|
93
|
-
*
|
|
94
|
-
*
|
|
95
|
-
*
|
|
69
|
+
/** Agent `agentId`'s cost per run from the one store (GET /agents/{id}/learning/cost, learning-cost.ts): what its ledger
|
|
70
|
+
* says (learn/ledger.ts summarize, agentLedgerOverStore): each of its agentic runs that ended (ended, stopped or
|
|
71
|
+
* failed), oldest first, each run that does a job numbered from 1 (a replay none: the bill's numbering), with its own
|
|
72
|
+
* cost and what learning added for it, the path it took and the learned workflow it ran, the revision of that workflow
|
|
73
|
+
* and whether an audit's shadow ran for it; what the series shows (costSummary); and each learned workflow against the
|
|
74
|
+
* money rule (workflowCostsOf over the same figures, pastRunsOf). A run still at work, an imported or archived one and a
|
|
75
|
+
* workflow revision's run are left out. A run that learns whose end named no path is left out too and counted
|
|
76
|
+
* (`unknown_path_runs`): its path and cost are not known, never `agent` at $0. `limit`: the latest runs shown, each
|
|
77
|
+
* keeping its number; the summary is over every run; `bill` is the owner's bill over all of them. Its champion skips
|
|
78
|
+
* what `refused` names of the agent's promotion records (purged-workflow.ts refusedOf, the purge gate's), as a run's
|
|
79
|
+
* claim does; absent, none. */
|
|
96
80
|
export type RefusedFor = (agentId: string, records: readonly PromotionRecord[]) => Promise<Refused>;
|
|
97
81
|
export declare function agentCostOverStore(store: Store, agentId: string, limit?: number, refused?: RefusedFor): Promise<{
|
|
98
82
|
runs: CostRun[];
|
|
@@ -103,91 +87,77 @@ export declare function agentCostOverStore(store: Store, agentId: string, limit?
|
|
|
103
87
|
workflows: ReturnType<typeof workflowCostsOf>;
|
|
104
88
|
bill: Bill;
|
|
105
89
|
}>;
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
*
|
|
109
|
-
*
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
*
|
|
119
|
-
*
|
|
120
|
-
*
|
|
121
|
-
*
|
|
122
|
-
*
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
*
|
|
128
|
-
*
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
*
|
|
132
|
-
*
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
* spend is on the runs it serves, so its `learning_usd` and `all_in_usd` are 0, and the sum of every run's `all_in_usd`
|
|
137
|
-
* and the bill's `unattributed_usd` is the booked total. While the run is at work `usd` is `rowUsd` and the rest null;
|
|
138
|
-
* null while unknown (its shadow still at work, a compile's or a check's cost unknown), never $0. Undefined for an
|
|
139
|
-
* unknown run. Its revision's champion skips what `refused` names of the agent's promotion records (agentCostOverStore). */
|
|
140
|
-
export declare function runAllInOverStore(store: Store, runId: string, rowUsd?: number | null, refused?: RefusedFor): Promise<{
|
|
90
|
+
/** The agent's ledger read over the one store and summed (learn/ledger.ts summarize): its runs (as runs.list reads
|
|
91
|
+
* them), each one's ledger row and spend rows (Learning.ledger), its promotion records (the revisions' K and state,
|
|
92
|
+
* revisionsOf, skipping what `refused` names) and its audits' shadow runs. `records`: where a run's launch and rounds
|
|
93
|
+
* are read (the agent's at once by default, agentRecordsOf). */
|
|
94
|
+
export declare function agentLedgerOverStore(store: Store, agentId: string, refused?: RefusedFor, records?: RunRecords): Promise<{
|
|
95
|
+
out: Summarized;
|
|
96
|
+
promotions: PromotionRecord[];
|
|
97
|
+
skip: Refused | undefined;
|
|
98
|
+
listed: RunRecord[];
|
|
99
|
+
}>;
|
|
100
|
+
/** Whether run `run`'s ledger row stands for it as it is now: written for the end the run has (`epoch`, the run's epoch
|
|
101
|
+
* after the end that wrote it: run-patch.ts recordLedger), with no cost healed since. A runner or server of the build
|
|
102
|
+
* before the ledger writes none: its end of a run again (a follow-up's, or a grade's round that keeps the end it had, at
|
|
103
|
+
* the same ended_at) moves the run's epoch, as every end and every claim does, and its heal of a cost (Runs.healCost:
|
|
104
|
+
* only over an unknown cost, at the same epoch and end) makes the cost known. Either leaves the row for the run as it
|
|
105
|
+
* was, and its reader records it again from the run's row (record), as for a run with no row. A cancel that wins an
|
|
106
|
+
* end moves its ended_at alone (run-patch.ts refuseLeftovers): the row stands. */
|
|
107
|
+
export declare function ledgerRowStands(row: Pick<LedgerRow, "cost"> & {
|
|
108
|
+
readonly epoch: number;
|
|
109
|
+
}, run: Pick<RunRecord, "epoch" | "costUsd" | "costAtMostUsd">): boolean;
|
|
110
|
+
/** Each revision of the agent's learned workflows its promotion records name (one per workflow and digest, in the order
|
|
111
|
+
* they were first recorded), with the served runs its spend is spread over (K, its check's compile_after) and `state`
|
|
112
|
+
* from its newest record: `checking` while its check replays, `serving` for the champion (championOf, skipping what
|
|
113
|
+
* `refused` names: the purge gate's, so a purged run's revision is never said to serve), else `stopped`. A revision an
|
|
114
|
+
* earlier reset of the agent's learning deleted (`reset`, learn/promote.ts keepResetLedger) comes first, stopped, at the
|
|
115
|
+
* K it was kept with, unless the records name it again. What each one spent is the ledger's (learn/ledger.ts summarize),
|
|
116
|
+
* whatever the records say. */
|
|
117
|
+
export declare function revisionsOf(records: readonly PromotionRecord[], reset?: readonly ResetRevision[], refused?: Refused): RevisionAt[];
|
|
118
|
+
/** A run's costs as GET /runs/{id} shows them (RunAllIn, runAllInOverStore). */
|
|
119
|
+
export type RunAllIn = {
|
|
141
120
|
path: RunPath | null;
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
121
|
+
} & Pick<RunFigures, "usd" | "learning_usd" | "all_in_usd" | "compile_usd" | "followup_usd" | "shadow_usd" | "share_usd">;
|
|
122
|
+
/** Run `runId`'s path and its costs as GET /runs/{id} shows them (A8), the figures GET .../learning/cost reads for it
|
|
123
|
+
* (learn/ledger.ts figuresOf over its ledger row: one formula): `path` its record's (metrics.path, RUN_PATHS: `agent`
|
|
124
|
+
* for a run that does not learn; null while it has not ended, for a workflow revision's run, and for a run that learns
|
|
125
|
+
* whose end named none); `usd` its own spend, the job's (its look-back left out); `learning_usd` what learning spent for
|
|
126
|
+
* it: its follow-up rounds' turns, its audit shadow's cost, and its share of its revision's compile and check (its own
|
|
127
|
+
* compile turns are its revision's: `compile_usd`); `all_in_usd` the two; and `learning_usd`'s parts. A replay or a
|
|
128
|
+
* shadow run carries none: its spend is on the runs it serves, so its `learning_usd` and `all_in_usd` are 0, and the sum
|
|
129
|
+
* of every run's `all_in_usd` and the bill's `unattributed_usd` is the booked total. `rowUsd`: the cost its view reads
|
|
130
|
+
* (its row's when absent); one other than its row's (an imported run's estimate, a booking where its end stored none)
|
|
131
|
+
* is its job's, less its look-back. While the run is at work `usd` is `rowUsd` and the rest null; null while unknown (its shadow still at work, a compile's or
|
|
132
|
+
* a check's cost unknown), never $0. Undefined for an unknown run. A served run's share is the agent's ledger's
|
|
133
|
+
* (agentLedgerOverStore), its revision's champion skipping what `refused` names of the agent's promotion records. */
|
|
134
|
+
export declare function runAllInOverStore(store: Store, runId: string, rowUsd?: number | null, refused?: RefusedFor): Promise<RunAllIn | undefined>;
|
|
146
135
|
/** The check the serving promotion was decided on, as the cost summary says it: the champion (championOf) of the learned
|
|
147
136
|
* workflow the newest run a learned workflow ran first on ran (`workflow` or `handed_back`), its record's check numbers
|
|
148
137
|
* (the share of the inputs it ran on that said what the agent said, against the agent's own 100%). `cleared`: it passed
|
|
149
138
|
* (a champion is promoted), with the agreement check it passed (`agreed` of `alone`, its bar `agree_min`). Null when no run was served, nothing serves now (held, or never promoted), or it was promoted
|
|
150
139
|
* on no input (a dry run). The champion skips what `refused` names (the purge gate's). */
|
|
151
140
|
export declare function servingReplayOf(records: readonly PromotionRecord[], runs: readonly CostRun[], refused?: Refused): CostReplay | null;
|
|
152
|
-
/** What run `runId`'s learning spent, as its cost per run counts it, over every round a follow-up opened (roundsOf): what
|
|
153
|
-
* it kept as it answered (answeredOf). A run a follow-up opened again (roundsSpendOf's figures): its job is what it had
|
|
154
|
-
* cost when its first round answered, and everything after (each later round's follow-up turn and every round's
|
|
155
|
-
* look-back: feedback the run was given is learning, never the job) is its look-back here, `rowUsd` (the run's row cost)
|
|
156
|
-
* less that job (roundsLooked). */
|
|
157
|
-
export declare function learningSpendOf(store: RunRecords, runId: string, rowUsd: number | null): Promise<ReturnType<typeof answeredOf> | null>;
|
|
158
141
|
/** Every round run `runId` kept (one a follow-up opened again is a round past its first), oldest first: none when it kept
|
|
159
142
|
* no learning. The store's proposal(runId) is the newest round alone; a read of what the run's learning did or spent
|
|
160
143
|
* reads them all. */
|
|
161
144
|
export declare function roundsOf(store: Pick<RunRecords, "learning">, runId: string): Promise<LearningProposal[]>;
|
|
162
145
|
type RunRecord = NonNullable<Awaited<ReturnType<Store["runs"]["get"]>>>;
|
|
163
|
-
/**
|
|
164
|
-
*
|
|
165
|
-
* (
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
*
|
|
169
|
-
*
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
* revision that ran it and whether an audit's shadow ran for it (agentCostOverStore's loop body); `took_over` is the
|
|
179
|
-
* series' (tookOverOf). */
|
|
180
|
-
export declare function costRunOf(store: RunRecords, run: RunRecord, n: number | null, { path, workflow }: {
|
|
181
|
-
path: RunPath;
|
|
182
|
-
workflow: string | null;
|
|
183
|
-
}): Promise<Omit<CostRun, "took_over">>;
|
|
184
|
-
/** The runs the money rule reads for agent `agentId` (runner/workflow-first.ts costLineOf), one set for the run's launch
|
|
185
|
-
* and the cost page: of its newest PAST_RUNS runs on no named disk (learn/learning-of.ts: one on a named disk learns
|
|
186
|
-
* nothing), each that ended (ended, stopped or failed) since its learning's reset (learn/compile.ts sinceReset: a
|
|
187
|
-
* workflow before it is not the one it learned after, whatever its name), is neither imported nor archived nor a
|
|
188
|
-
* workflow revision's run, with its all-in cost (allInOf). `known`: all-in costs already read, by run id (the cost
|
|
189
|
-
* page's series), read again for no run; `records`, where any other's rows are read (the store's by default). */
|
|
190
|
-
export declare function pastRunsOverStore(store: Store, agentId: string, known?: ReadonlyMap<string, number | null>, records?: RunRecords): Promise<PastRun[]>;
|
|
146
|
+
/** What the money rule reads of the agent (runner/workflow-first.ts PastRuns) off its summed ledger (`out`, a
|
|
147
|
+
* summarize over `listed`, its runs as runs.list read them, newest first): of its newest PAST_RUNS runs on no named disk
|
|
148
|
+
* (learn/learning-of.ts: one on a named disk learns nothing), those since its learning's reset (`since`,
|
|
149
|
+
* learn/compile.ts sinceReset: a workflow before it is not the one it learned after, whatever its name), each series
|
|
150
|
+
* run among them with its all-in cost as the series reads it (RunFigures.series_total_usd), and the by-hand side over
|
|
151
|
+
* those same runs: the mean job's own $ (RunFigures.usd: no compile turn, follow-up or shadow) of the ones on the
|
|
152
|
+
* `agent` path, with the ones its mean left out (cost unknown or only a bound). The served side and the by-hand side
|
|
153
|
+
* read one set of runs: the cost page and a run's launch read the same window (pastRunsOverStore). */
|
|
154
|
+
export declare function pastRunsOf(out: Summarized, listed: readonly RunRecord[], since: (row: Pick<RunRecord, "id" | "startedAt">) => boolean): PastRuns;
|
|
155
|
+
/** What the money rule reads for agent `agentId` at a run's launch (pastRunsOf), bounded whatever the agent's history:
|
|
156
|
+
* its newest PAST_RUNS runs on no named disk (one runs.list page), the ledger of those runs alone (Learning.ledger with
|
|
157
|
+
* their ids), and each one's launch or rounds read only where its row needs them (no ledger row, a stale one, or no
|
|
158
|
+
* path). Summed with no revision records: the money rule reads each run's own all-in and job $, never a revision's
|
|
159
|
+
* share. The cost page reads the same window of the same figures (agentCostOverStore). */
|
|
160
|
+
export declare function pastRunsOverStore(store: Store, agentId: string): Promise<PastRuns>;
|
|
191
161
|
/** The money rule's decision for agent `agentId` (runner/workflow-first.ts costStopOf) over the runs a run's launch reads
|
|
192
162
|
* (pastRunsOverStore), as the launch reads them: runs that can't be read now stop nothing (workflowFirstOf serves). What
|
|
193
163
|
* the promotions read and the learning view fold into each workflow's state (learn/promote.ts servingStateOf). */
|
|
@@ -199,15 +169,17 @@ export declare const costStopOverStore: (store: Store, agentId: string) => Promi
|
|
|
199
169
|
* new answer is the agent's, with its digest. Else, for a run its launch offered a learned workflow, its timeline
|
|
200
170
|
* (runner/learning-end.ts runPathOf, the agent calling the tool itself): `workflow` when its job did only that,
|
|
201
171
|
* `handed_back` when the agent went on, with the workflow its job called last. Any other run's path is `agent`. Both
|
|
202
|
-
* read the run's rows less its feedback rounds' (withoutFeedbackRounds): a grade's round never moves the path.
|
|
172
|
+
* read the run's rows less its feedback rounds' (withoutFeedbackRounds): a grade's round never moves the path. `cut` on a
|
|
173
|
+
* hand-back a restart cut (servedOf: the workflow's call ended `interrupted`), never one the workflow made itself. */
|
|
203
174
|
export declare function runPathOverStore(store: Store, runId: string, started: RunLaunch["learning"], redact?: (text: string) => string): Promise<{
|
|
204
175
|
path: RunPath;
|
|
205
176
|
workflow: string | null;
|
|
206
177
|
digest?: string;
|
|
207
178
|
promotion?: number;
|
|
179
|
+
cut?: true;
|
|
208
180
|
}>;
|
|
209
181
|
/** The path a run's views say it took (GET /runs/{id} and each runs list row: `path`, and `workflow`), read off its record
|
|
210
|
-
* as the cost per run reads it (pathOfRow, revisionOfRow:
|
|
182
|
+
* as the cost per run reads it (pathOfRow, revisionOfRow: the ledger read's own, so the run views and GET
|
|
211
183
|
* .../learning/cost never disagree). `path` is null for a run not ended, a workflow revision's run, and a run that learns
|
|
212
184
|
* whose record names none; `workflow` names the learned workflow and its revision only on a run it served (path
|
|
213
185
|
* `workflow` or `handed_back`; the name only when its launch offered one, the digest null when its record names none,
|
|
@@ -229,25 +201,13 @@ type Laid = {
|
|
|
229
201
|
};
|
|
230
202
|
/** What every claim of a run laid, from its learningLaid entries, each name once. None laid when it has no entry. */
|
|
231
203
|
export declare function laidOf(entries: readonly Pick<EntryLike, "kind" | "data">[]): Laid;
|
|
232
|
-
/** What every round of
|
|
233
|
-
* round's job answered and what the job cost to then, and the look-backs of every round added up
|
|
234
|
-
* unknown
|
|
235
|
-
|
|
236
|
-
answered_at: string;
|
|
237
|
-
job_cost_usd: number | null;
|
|
238
|
-
look_back_usd: number | null;
|
|
239
|
-
};
|
|
240
|
-
/** What a run with rounds (`rounds`) kept as it answered, as its cost per run and its impact both read it: its job is
|
|
241
|
-
* what it had cost when its first round answered; everything its row (`rowUsd`) spent after that (each later round's
|
|
242
|
-
* follow-up turn and every round's look-back: feedback the run was given is learning, never the job) is its look-back;
|
|
243
|
-
* unknown when the row's cost is and the job's is known (the request no one priced came after the job answered: a later
|
|
244
|
-
* round stopped mid-request keeps no figures, so the rounds' sum would read short as if settled); the rounds'
|
|
245
|
-
* look-backs added up when the job's cost is unknown. */
|
|
246
|
-
export declare function roundsLooked(rounds: RoundsSpend, rowUsd: number | null): RoundsSpend;
|
|
247
|
-
export declare function roundsSpendOf(store: RunRecords, runId: string): Promise<RoundsSpend | undefined>;
|
|
204
|
+
/** What every round of run `runId` spent when a follow-up opened it again (learn/ledger.ts roundsSpentIn): when its first
|
|
205
|
+
* round's job answered and what the job cost to then, and the look-backs of every round added up (null once one is
|
|
206
|
+
* unknown); undefined for a run with one round, or none that answered. */
|
|
207
|
+
export declare function roundsSpendOf(store: Pick<RunRecords, "learning">, runId: string): Promise<Answered | undefined>;
|
|
248
208
|
/** What a run's learning end tells its impact: how it ended and when, the corrections and workflows it started from, when
|
|
249
209
|
* its job answered and its costs once it looked back (a look-back of 0 for an ended one that did not). */
|
|
250
|
-
export declare function impactLearningOf(end: RunLearningEnd, started: RunLaunch["learning"], laid: Laid | undefined, rounds?:
|
|
210
|
+
export declare function impactLearningOf(end: RunLearningEnd, started: RunLaunch["learning"], laid: Laid | undefined, rounds?: Answered, rowUsd?: number | null): ImpactLearning;
|
|
251
211
|
/** What a run's job did with the learned workflows its launch offered it (GET /runs/{id}/learning `used`): each learned
|
|
252
212
|
* workflow the job called, by the call's `name` (callArgsOf), how many calls and how many failed. The end-of-run turn's
|
|
253
213
|
* rows are left out. */
|
|
@@ -312,10 +272,10 @@ export declare function runLearningOverStore(store: Store, runId: string, shown:
|
|
|
312
272
|
} | {
|
|
313
273
|
graded: {
|
|
314
274
|
workflow: string | null;
|
|
315
|
-
feedback_status: "
|
|
275
|
+
feedback_status: "ended" | "running" | "not_run" | null;
|
|
316
276
|
source: "feedback" | "eval";
|
|
317
277
|
graded_at: string;
|
|
318
|
-
path: "agent" | "
|
|
278
|
+
path: "agent" | "handed_back" | "workflow" | "replay" | "audit";
|
|
319
279
|
workflow_digest: string | null;
|
|
320
280
|
feedback: "correction" | null;
|
|
321
281
|
run_id: string;
|