@parcha/agentrun-serve 0.1.0-beta.44 → 0.1.0-beta.45
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 +131 -5
- package/README.md +371 -300
- package/dist/acp-package.d.ts +28 -0
- package/dist/acp-package.js +23 -0
- package/dist/adapter-facts.d.ts +8 -1
- package/dist/adapter-facts.js +9 -1
- package/dist/adapters.d.ts +5 -0
- package/dist/adapters.js +36 -3
- package/dist/agent-delete.d.ts +50 -0
- package/dist/agent-delete.js +125 -0
- package/dist/agents-store.d.ts +9 -3
- package/dist/agents-store.js +22 -8
- package/dist/agents.d.ts +5 -1
- package/dist/agents.js +8 -4
- package/dist/api-only.d.ts +8 -3
- package/dist/api-only.js +10 -4
- package/dist/archil-routes.d.ts +5 -1
- package/dist/archil-routes.js +57 -2
- package/dist/browser-wait-ended.d.ts +2 -0
- package/dist/browser-wait-ended.js +2 -0
- package/dist/calendar/ics-faux.d.ts +3 -1
- package/dist/calendar/ics-faux.js +12 -2
- package/dist/calendar/tools.js +5 -2
- package/dist/chatgpt-plan.js +3 -1
- package/dist/claude-login.d.ts +135 -0
- package/dist/claude-login.js +244 -0
- package/dist/cli.js +52 -16
- package/dist/composio-preset.js +69 -7
- package/dist/composio-triggers.d.ts +14 -0
- package/dist/composio-triggers.js +79 -15
- package/dist/computer-attach.d.ts +40 -5
- package/dist/computer-attach.js +130 -15
- package/dist/computer-keys.d.ts +3 -0
- package/dist/computer-keys.js +7 -1
- package/dist/computer-live.js +3 -2
- package/dist/computers.d.ts +21 -10
- package/dist/computers.js +39 -28
- package/dist/console/assets/index-3O2Yl6hZ.js +701 -0
- package/dist/console/assets/index-DaFsZuzQ.css +1 -0
- package/dist/console/index.html +2 -2
- package/dist/decisions.d.ts +1 -1
- package/dist/dial-relay.d.ts +29 -0
- package/dist/dial-relay.js +94 -0
- package/dist/email/tools.js +10 -5
- package/dist/env-proxy.d.ts +2 -0
- package/dist/env-proxy.js +35 -0
- package/dist/errors.d.ts +3 -1
- package/dist/errors.js +7 -4
- package/dist/faux-computers.d.ts +8 -2
- package/dist/faux-computers.js +83 -6
- package/dist/harness-archive.d.ts +67 -0
- package/dist/harness-archive.js +177 -0
- package/dist/harness-goose.d.ts +34 -0
- package/dist/harness-goose.js +87 -0
- package/dist/harness-install.d.ts +21 -0
- package/dist/harness-install.js +24 -11
- package/dist/harness-opencode/adapter.js +1 -1
- package/dist/harness-table.d.ts +9 -1
- package/dist/harness-table.js +20 -3
- package/dist/harness.d.ts +1 -2
- package/dist/harness.js +3 -4
- package/dist/host.js +2 -1
- package/dist/key-check.js +3 -0
- package/dist/learn/audit.d.ts +6 -6
- package/dist/learn/audit.js +3 -7
- package/dist/learn/check.d.ts +23 -89
- package/dist/learn/check.js +57 -335
- package/dist/learn/commit.d.ts +63 -90
- package/dist/learn/commit.js +124 -316
- package/dist/learn/compile.d.ts +53 -50
- package/dist/learn/compile.js +87 -102
- package/dist/learn/corrections.d.ts +13 -0
- package/dist/learn/corrections.js +23 -0
- package/dist/learn/delete.d.ts +5 -5
- package/dist/learn/delete.js +8 -10
- package/dist/learn/folder.d.ts +35 -47
- package/dist/learn/folder.js +118 -134
- package/dist/learn/index.d.ts +3 -5
- package/dist/learn/index.js +6 -9
- package/dist/learn/learning.sh +45 -15
- package/dist/learn/promote.d.ts +13 -1
- package/dist/learn/promote.js +9 -0
- package/dist/learn/{skills.d.ts → workflow-draft.d.ts} +30 -38
- package/dist/learn/{skills.js → workflow-draft.js} +48 -58
- package/dist/learn/workflow-nodes.js +1 -1
- package/dist/learned-workflow.js +2 -2
- package/dist/learning-cost.d.ts +38 -24
- package/dist/learning-cost.js +41 -24
- package/dist/learning-routes.d.ts +91 -170
- package/dist/learning-routes.js +183 -421
- package/dist/learning-run.d.ts +19 -40
- package/dist/learning-run.js +23 -93
- package/dist/learning-setting.d.ts +4 -4
- package/dist/learning-setting.js +6 -6
- package/dist/learning-words.d.ts +28 -74
- package/dist/learning-words.js +64 -162
- package/dist/learning.d.ts +61 -392
- package/dist/learning.js +101 -651
- package/dist/live-reach.d.ts +25 -2
- package/dist/live-reach.js +46 -4
- package/dist/llms.txt +1 -1
- package/dist/local-models.d.ts +3 -11
- package/dist/local-models.js +5 -6
- package/dist/mcp-servers-store.d.ts +4 -4
- package/dist/model-form.js +6 -5
- package/dist/model.d.ts +4 -0
- package/dist/model.js +26 -9
- package/dist/native/binding.js +1 -1
- package/dist/native/connection.js +1 -1
- package/dist/native/discovery.js +1 -1
- package/dist/native/instructions.d.ts +3 -0
- package/dist/native/instructions.js +5 -3
- package/dist/native/remote-worker-bridge.js +9 -43
- package/dist/native/remote.d.ts +8 -15
- package/dist/native/remote.js +3 -3
- package/dist/native/schema.js +1 -1
- package/dist/native/types.d.ts +2 -2
- package/dist/openapi.js +268 -316
- package/dist/paid-calls.d.ts +8 -0
- package/dist/paid-calls.js +20 -0
- package/dist/particle-provider.d.ts +11 -0
- package/dist/particle-provider.js +135 -0
- package/dist/port-models.d.ts +12 -4
- package/dist/port-models.js +28 -11
- package/dist/print.d.ts +27 -0
- package/dist/print.js +21 -0
- package/dist/provider.d.ts +7 -0
- package/dist/provider.js +15 -1
- package/dist/reflect-range.js +2 -3
- package/dist/run-launch.d.ts +14 -28
- package/dist/run-launch.js +9 -12
- package/dist/run-learning-served.d.ts +15 -89
- package/dist/run-listing.d.ts +34 -0
- package/dist/run-listing.js +128 -0
- package/dist/run-model-key.js +1 -1
- package/dist/run-timeline-served.js +5 -3
- package/dist/run-trace.d.ts +97 -0
- package/dist/run-trace.js +253 -0
- package/dist/run-view.d.ts +15 -0
- package/dist/run-view.js +9 -0
- package/dist/runnable.js +2 -1
- package/dist/runner/adapter-loop.d.ts +8 -6
- package/dist/runner/adapter-loop.js +16 -12
- package/dist/runner/adapter-run-spec.d.ts +16 -4
- package/dist/runner/adapter-run-spec.js +64 -58
- package/dist/runner/adapters/index.js +22 -0
- package/dist/runner/adapters/pi.d.ts +4 -12
- package/dist/runner/adapters/pi.js +2 -2
- package/dist/runner/audit.d.ts +1 -1
- package/dist/runner/audit.js +16 -8
- package/dist/runner/beside.d.ts +6 -2
- package/dist/runner/beside.js +38 -9
- package/dist/runner/claim-secrets.d.ts +18 -2
- package/dist/runner/claim-secrets.js +42 -18
- package/dist/runner/cli-run-spec.js +55 -51
- package/dist/runner/conformance/harness.d.ts +6 -0
- package/dist/runner/conformance/harness.js +16 -5
- package/dist/runner/dispatch.d.ts +2 -2
- package/dist/runner/end-of-run.d.ts +6 -14
- package/dist/runner/end-of-run.js +8 -33
- package/dist/runner/feedback-round.d.ts +2 -2
- package/dist/runner/feedback-round.js +7 -7
- package/dist/runner/github-app.js +3 -1
- package/dist/runner/harness-loops.d.ts +0 -8
- package/dist/runner/harness-loops.js +11 -59
- package/dist/runner/held.d.ts +170 -0
- package/dist/runner/held.js +57 -0
- package/dist/runner/journal-kinds.d.ts +2 -3
- package/dist/runner/journal-kinds.js +2 -3
- package/dist/runner/learned-first.d.ts +40 -0
- package/dist/runner/learned-first.js +32 -0
- package/dist/runner/learning-end.d.ts +77 -69
- package/dist/runner/learning-end.js +250 -303
- package/dist/runner/learning-seed.d.ts +15 -33
- package/dist/runner/learning-seed.js +24 -45
- package/dist/runner/loop-contract.d.ts +2 -3
- package/dist/runner/main.d.ts +17 -9
- package/dist/runner/main.js +63 -20
- package/dist/runner/mcp-run.d.ts +11 -0
- package/dist/runner/mcp-run.js +67 -0
- package/dist/runner/memory-claim.d.ts +10 -5
- package/dist/runner/memory-claim.js +12 -6
- package/dist/runner/model-route.d.ts +7 -4
- package/dist/runner/model-route.js +22 -10
- package/dist/runner/native-loop.d.ts +0 -7
- package/dist/runner/native-loop.js +9 -101
- package/dist/runner/promotion.d.ts +8 -6
- package/dist/runner/promotion.js +19 -12
- package/dist/runner/reflect-hook.d.ts +64 -95
- package/dist/runner/reflect-hook.js +112 -225
- package/dist/runner/run-channel.d.ts +43 -0
- package/dist/runner/run-channel.js +467 -0
- package/dist/runner/run-child-host.d.ts +169 -0
- package/dist/runner/run-child-host.js +1222 -0
- package/dist/runner/run-child.d.ts +1 -0
- package/dist/runner/run-child.js +254 -0
- package/dist/runner/run-errors.d.ts +2 -0
- package/dist/runner/run-errors.js +20 -0
- package/dist/runner/runner.js +1 -5
- package/dist/runner/sdk-ask.d.ts +78 -0
- package/dist/runner/sdk-ask.js +158 -0
- package/dist/runner/sdk-loop.d.ts +2 -4
- package/dist/runner/sdk-loop.js +29 -49
- package/dist/runner/store-secrets.d.ts +5 -3
- package/dist/runner/store-secrets.js +5 -1
- package/dist/runner/workflow-first.d.ts +5 -0
- package/dist/runner/workflow-first.js +4 -0
- package/dist/runner/workflow-spec.js +7 -2
- package/dist/runs-over-store.d.ts +16 -28
- package/dist/runs-over-store.js +31 -38
- package/dist/sdk/runs.d.ts +6 -11
- package/dist/sdk/runs.js +20 -41
- package/dist/sdk/schema.js +3 -4
- package/dist/seal-key.d.ts +5 -0
- package/dist/seal-key.js +7 -0
- package/dist/secrets.d.ts +3 -0
- package/dist/secrets.js +16 -3
- package/dist/server.d.ts +55 -33
- package/dist/server.js +685 -320
- package/dist/sign-ins-store.d.ts +8 -0
- package/dist/sign-ins-store.js +36 -1
- package/dist/skills.js +1 -1
- package/dist/store/index.d.ts +2 -2
- package/dist/store/index.js +1 -1
- package/dist/store/journal/storage.js +3 -0
- package/dist/store/postgres/migrations/0017_run_listing.sql +83 -0
- package/dist/store/postgres/migrations/0018_trigger_template.sql +6 -0
- package/dist/store/postgres/migrations/0019_runner_relays.sql +28 -0
- package/dist/store/schema.d.ts +53 -4
- package/dist/store/schema.js +137 -6
- package/dist/store/sqlite/connection.d.ts +2 -0
- package/dist/store/sqlite/connection.js +3 -1
- package/dist/store/sqlite/run-patch.d.ts +0 -17
- package/dist/store/sqlite/run-patch.js +4 -33
- package/dist/store/sqlite/store.js +246 -63
- package/dist/store/sqlite/worker.js +25 -0
- package/dist/store/store.d.ts +193 -36
- package/dist/store/store.js +25 -3
- package/dist/store-reads/learning.d.ts +102 -204
- package/dist/store-reads/learning.js +159 -321
- package/dist/store-reads/loop.d.ts +0 -1
- package/dist/store-reads/loop.js +1 -1
- package/dist/store-view.d.ts +29 -1
- package/dist/store-view.js +97 -31
- package/dist/template-eval.d.ts +3 -6
- package/dist/template-eval.js +22 -36
- package/dist/templates.d.ts +2 -1
- package/dist/templates.js +6 -3
- package/dist/timeline/index.d.ts +1 -1
- package/dist/timeline/index.js +1 -1
- package/dist/timeline/timeline.d.ts +5 -1
- package/dist/timeline/timeline.js +16 -0
- package/dist/tool-gate.d.ts +0 -7
- package/dist/tool-gate.js +1 -15
- package/dist/tool-keys-store.d.ts +1 -1
- package/dist/tool-keys.d.ts +6 -4
- package/dist/tool-keys.js +12 -6
- package/dist/tools.d.ts +2 -2
- package/dist/tools.js +11 -4
- package/dist/triggers.d.ts +60 -5
- package/dist/triggers.js +123 -18
- package/dist/validate.js +1 -1
- package/dist/webhooks.d.ts +4 -1
- package/dist/webhooks.js +11 -4
- package/dist/workspace/agent-computer.d.ts +2 -0
- package/dist/workspace/agent-computer.js +2 -0
- package/dist/workspace/archil-claim.d.ts +7 -0
- package/dist/workspace/archil-claim.js +29 -0
- package/dist/workspace/archil.d.ts +9 -1
- package/dist/workspace/archil.js +165 -3
- package/dist/workspace/attach.d.ts +3 -1
- package/dist/workspace/attach.js +2 -0
- package/dist/workspace/attached-computers.d.ts +16 -5
- package/dist/workspace/attached-computers.js +25 -9
- package/dist/workspace/computer-deps.js +1 -1
- package/dist/workspace/computer-for-claim.d.ts +7 -3
- package/dist/workspace/computer-for-claim.js +119 -22
- package/dist/workspace/computer-hold.js +2 -1
- package/dist/workspace/computer-kept.d.ts +11 -1
- package/dist/workspace/computer-kept.js +24 -3
- package/dist/workspace/resolve-computer.d.ts +33 -19
- package/dist/workspace/resolve-computer.js +172 -64
- package/dist/workspace/revision-skills.d.ts +1 -2
- package/dist/workspace/revision-skills.js +3 -4
- package/dist/workspace/run-workspace.d.ts +1 -1
- package/dist/workspace/run-workspace.js +5 -0
- package/dist/workspace/synced-folder.d.ts +85 -0
- package/dist/workspace/synced-folder.js +230 -0
- package/dist/workspace/workspace.d.ts +4 -0
- package/launcher/agentrun-serve +1 -1
- package/package.json +10 -10
- package/templates/README.md +7 -7
- package/templates/inbound-lead/agent.md +3 -3
- package/templates/inbound-lead/evals/learned-correction/case.yaml +3 -3
- package/templates/inbound-lead/evals/learned-correction/fixtures/corrections.md +1 -0
- package/templates/inbound-lead/evals/learned-correction/graders/applies-correction.md +22 -0
- package/templates/inbound-lead/evals/learned-correction/graders/learned-origin.md +1 -1
- package/templates/inbound-lead/evals/learned-correction/prompt.md +1 -1
- package/templates/inbound-lead/lead.schema.json +6 -5
- package/templates/inbound-lead/rules/RUBRIC.md +4 -4
- package/templates/inbound-lead/skills/lead/SKILL.md +4 -4
- package/templates/market-monitor/evals/learned-preference/case.yaml +4 -4
- package/templates/market-monitor/evals/learned-preference/fixtures/corrections.md +1 -0
- package/templates/market-monitor/evals/learned-preference/graders/omits-junior-post.md +3 -3
- package/templates/market-monitor/evals/learned-preference/prompt.md +1 -1
- package/templates/release-notes/evals/learned-style/case.yaml +4 -4
- package/templates/release-notes/evals/learned-style/fixtures/corrections.md +1 -0
- package/templates/release-notes/evals/learned-style/graders/same-changes.md +2 -2
- package/templates/release-notes/evals/learned-style/prompt.md +1 -1
- package/dist/console/assets/index-BUktRvS-.css +0 -1
- package/dist/console/assets/index-nB9kTfIN.js +0 -711
- package/dist/learn/grade.d.ts +0 -138
- package/dist/learn/grade.js +0 -682
- package/dist/learn/notes.d.ts +0 -81
- package/dist/learn/notes.js +0 -178
- package/dist/learn/reflect.d.ts +0 -77
- package/dist/learn/reflect.js +0 -228
- package/dist/learn/relevance.d.ts +0 -24
- package/dist/learn/relevance.js +0 -91
- package/dist/learn/seed-check.d.ts +0 -74
- package/dist/learn/seed-check.js +0 -103
- package/dist/learning-batch.d.ts +0 -291
- package/dist/learning-batch.js +0 -600
- package/dist/learning-evals.d.ts +0 -35
- package/dist/learning-evals.js +0 -99
- package/dist/native/context.d.ts +0 -6
- package/dist/native/context.js +0 -22
- package/dist/propose.d.ts +0 -52
- package/dist/propose.js +0 -224
- package/dist/runner/learning-ask.d.ts +0 -47
- package/dist/runner/learning-ask.js +0 -128
- package/dist/runner/learning-dispatch.d.ts +0 -45
- package/dist/runner/learning-dispatch.js +0 -99
- package/dist/runner/learning-factory.d.ts +0 -16
- package/dist/runner/learning-factory.js +0 -50
- package/dist/runner/learning-loop.d.ts +0 -273
- package/dist/runner/learning-loop.js +0 -521
- package/dist/usage.d.ts +0 -11
- package/dist/usage.js +0 -11
- package/templates/inbound-lead/evals/learned-correction/fixtures/learning/MEMORY.md +0 -1
- package/templates/inbound-lead/evals/learned-correction/fixtures/learning/no-agencies.md +0 -14
- package/templates/inbound-lead/evals/learned-correction/graders/applies-note.md +0 -21
- package/templates/market-monitor/evals/learned-preference/fixtures/learning/MEMORY.md +0 -1
- package/templates/market-monitor/evals/learned-preference/fixtures/learning/skip-junior-job-posts.md +0 -8
- package/templates/release-notes/evals/learned-style/fixtures/learning/MEMORY.md +0 -1
- package/templates/release-notes/evals/learned-style/fixtures/learning/say-agent-not-bot.md +0 -13
|
@@ -1,20 +1,22 @@
|
|
|
1
1
|
import { type EntryLike, type TimelineEvent } from "../timeline/index.js";
|
|
2
|
+
import { type LearningChange, type LearningCommitResult } from "../learn/commit.js";
|
|
2
3
|
import { type LearningFolder } from "../learn/folder.js";
|
|
3
|
-
import { type CompileAsk, type CompileTrace } from "../learn/compile.js";
|
|
4
|
+
import { type CompileAsk, type CompileTrace, type DraftChecked } from "../learn/compile.js";
|
|
4
5
|
import type { RunPath } from "../learning-cost.js";
|
|
5
6
|
import { type RunLaunch } from "../run-launch.js";
|
|
6
|
-
import {
|
|
7
|
-
import { type
|
|
7
|
+
import type { SignInReader } from "../run-view.js";
|
|
8
|
+
import { type Store } from "../store/store.js";
|
|
8
9
|
import type { EndOfRunTurn } from "./loop-contract.js";
|
|
10
|
+
import { type DraftCommit } from "./reflect-hook.js";
|
|
9
11
|
/** What the step reads: the run's store, the data directory (the server's tool settings a draft's tools are read with),
|
|
10
|
-
* the agent's learning folder (where the run's place keeps it), the runner's environment (the host's secrets a
|
|
11
|
-
*
|
|
12
|
-
*
|
|
12
|
+
* the agent's learning folder (where the run's place keeps it), the runner's environment (the host's secrets a draft or
|
|
13
|
+
* a correction is refused for), and what the run was handed (its claim's keys, its sign-in's pointers through
|
|
14
|
+
* `signIns`), which it never learns. */
|
|
13
15
|
export interface LearningEndDeps {
|
|
14
16
|
readonly store: Store;
|
|
15
17
|
readonly data: string;
|
|
16
18
|
/** Agent `agentId`'s learning folder, where the run's place keeps it: learningWorkspace({ mode: "local", agentId, data })
|
|
17
|
-
* in Mode 1, { mode: "archil", agentId, archil } in Mode 2. Opened for each
|
|
19
|
+
* in Mode 1, { mode: "archil", agentId, archil } in Mode 2. Opened for each read or write, and ended after it. */
|
|
18
20
|
readonly learningFolder: (agentId: string) => LearningFolder;
|
|
19
21
|
readonly env?: NodeJS.ProcessEnv;
|
|
20
22
|
/** The agent's sign-ins, opened (sign-ins-store.ts signInReads over the store and the seal key): the pointers the run's
|
|
@@ -35,33 +37,25 @@ export interface LearningEndDeps {
|
|
|
35
37
|
} | undefined>;
|
|
36
38
|
/** The runner's log: what the compile turn left out for holding a secret, by name and count, never a value. */
|
|
37
39
|
readonly log?: (line: string) => void;
|
|
38
|
-
/** Why model spend beside the run is skipped (claim-secrets.ts claimSpendOff): its learning run's grade, which runs after
|
|
39
|
-
* the run's turn ended, is not queued then, in these words. Absent: it is queued. */
|
|
40
|
-
readonly spendOff?: (what: string) => string | undefined;
|
|
41
40
|
}
|
|
42
41
|
/** The end-of-run step for a run launched with `launch`: undefined when its launch records no learning start (a run that
|
|
43
42
|
* does not learn is asked nothing and keeps nothing), else the reflect hook over the run's store. */
|
|
44
43
|
export declare function learningEndOfRun(launch: RunLaunch, deps: LearningEndDeps): EndOfRunTurn | undefined;
|
|
45
44
|
/** What every cap gate of run `runId` reads as spent beside it on its behalf (adapter-loop.ts RunCapConfig.beside): its
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
*
|
|
52
|
-
|
|
53
|
-
* it has not (the most it may take) or when it ended at a cost not known, 0 when none was started. Null: unknown. */
|
|
54
|
-
export declare function besideOf(store: Pick<Store, "learning" | "runs">, runId: string, options?: {
|
|
55
|
-
beforeRound?: number;
|
|
56
|
-
}): Promise<number | null>;
|
|
45
|
+
* audit's shadow run (shadowBesideOf), for a capped run with a learning start, the only run whose end may start one;
|
|
46
|
+
* none for any other, whose gates read only its own sessions. */
|
|
47
|
+
export declare function spentBesideOf(launch: RunLaunch, store: Pick<Store, "runs">, runId: string): (() => Promise<number | null>) | undefined;
|
|
48
|
+
/** What run `runId`'s audit's shadow run took beside it (runner/audit.ts, started at its end with what its cap left): at
|
|
49
|
+
* its cost once it ended, at its own cap while it has not (the most it may take) or when it ended at a cost not known,
|
|
50
|
+
* 0 when none was started. Null: unknown. */
|
|
51
|
+
export declare function shadowBesideOf(store: Pick<Store, "runs">, runId: string): Promise<number | null>;
|
|
57
52
|
/** What run `runId`'s cap leaves its audit's shadow run at its end (runner/audit.ts startAudit): the cap it is held to now
|
|
58
53
|
* (capNowOf: its newest raise's, else `launchCapUsd`), less what it spent under it (capSpendOf over `entries`, its
|
|
59
|
-
* journal: its job, its
|
|
60
|
-
|
|
61
|
-
export declare function auditRoomOf(store: Pick<Store, "learning" | "runs">, runId: string, launchCapUsd: number, entries: readonly EntryLike[], queued: readonly AlsoRow[]): Promise<number | null>;
|
|
54
|
+
* journal: its job, its follow-ups, its compile turns). Null when that spend is unknown. */
|
|
55
|
+
export declare function auditRoomOf(store: Pick<Store, "runs">, runId: string, launchCapUsd: number, entries: readonly EntryLike[]): Promise<number | null>;
|
|
62
56
|
/** What capped run `runId` has spent under its cap, as every gate of the run reads it: its sessions' booking as the kernel
|
|
63
|
-
* cap counts it (metrics.ts bookedCapSpend over `entries`, its journal) and what
|
|
64
|
-
* (
|
|
57
|
+
* cap counts it (metrics.ts bookedCapSpend over `entries`, its journal) and what its audit's shadow took beside it
|
|
58
|
+
* (shadowBesideOf). Null when either is unknown.
|
|
65
59
|
*
|
|
66
60
|
* The rule for a cost no one knows (a request answered with no price of its own, one cut short or lost): under a cap it
|
|
67
61
|
* counts at the figure the cap held it at when it was admitted (its worst case at the model's price, and a lost one's
|
|
@@ -70,28 +64,25 @@ export declare function auditRoomOf(store: Pick<Store, "learning" | "runs">, run
|
|
|
70
64
|
* unknown (a held figure is the cap's, never a charge). Only a request held at no figure (none is, under a cap) leaves
|
|
71
65
|
* the spend itself unknown: then nothing more is sent under the cap, and the words say the spend is unknown, as the
|
|
72
66
|
* kernel's unknownSpend refusal does, never "no room". */
|
|
73
|
-
export declare function capSpendOf(store: Pick<Store, "
|
|
74
|
-
/**
|
|
75
|
-
*
|
|
76
|
-
*
|
|
77
|
-
*
|
|
78
|
-
*
|
|
79
|
-
*
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
* one direct commit a runner makes outside a learning run (a compile turn's revision). A file changed on main since the
|
|
83
|
-
* seed is a conflict, never written over. The learning commit it landed as, or null when it did not (the reason is
|
|
84
|
-
* logged). The folder is always released. */
|
|
67
|
+
export declare function capSpendOf(store: Pick<Store, "runs">, runId: string, entries: readonly EntryLike[]): Promise<number | null>;
|
|
68
|
+
/**
|
|
69
|
+
* A run's merge on the agent's learning folder, written by the runner directly (learn/commit.ts learningCommit, one
|
|
70
|
+
* exec): its compiled draft's files and its owner's correction, committed by `change.runId` (its Run-Id trailer). A file
|
|
71
|
+
* changed on main since the run's seed (or a revision's `bases` commit) is a conflict, never written over; a correction
|
|
72
|
+
* that holds what must never be stored, or would take corrections.md past its cap, is refused (past the cap beside a
|
|
73
|
+
* draft, it is left out alone and the draft merges). Any failure is logged by its reason alone. The folder is always
|
|
74
|
+
* released.
|
|
75
|
+
*/
|
|
85
76
|
export declare function commitDirect(deps: {
|
|
86
77
|
readonly folder: () => LearningFolder;
|
|
87
78
|
readonly log: (line: string) => void;
|
|
88
|
-
},
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
*
|
|
94
|
-
export declare
|
|
79
|
+
}, change: LearningChange): Promise<LearningCommitResult>;
|
|
80
|
+
/** What a run's owner said of it, in order, each a line for corrections.md: the grade's words its end closes (a feedback
|
|
81
|
+
* round, feedback-round.ts pendingFeedbackOf over its root `entries`), and each message a person sent in this round of
|
|
82
|
+
* its timeline `rows`: after the job's first on its first round, after its previous end on a later one (a follow-up
|
|
83
|
+
* opened it again). A grade's round's rows, the end-of-run turn's and a subagent's (a child conversation's rows carry
|
|
84
|
+
* its spawning call, parent_tool_use_id: its task prompt is the job's, not the owner's) are left out. */
|
|
85
|
+
export declare function ownerWords(entries: readonly EntryLike[], rows: readonly TimelineEvent[]): string[];
|
|
95
86
|
/** learned_workflow by every name a harness calls it: its own, and claude-agent's host-tool alias (`mcp__hands__<name>`).
|
|
96
87
|
* A harness that names it another way reads as another tool, so its run is asked as before. */
|
|
97
88
|
export declare const LEARNED_NAMES: ReadonlySet<string>;
|
|
@@ -100,24 +91,14 @@ export declare const LEARNED_NAMES: ReadonlySet<string>;
|
|
|
100
91
|
* subagent's row or a call another tool nested (a learned workflow's own). */
|
|
101
92
|
export declare function modelsOwn(rows: readonly TimelineEvent[]): (row: TimelineEvent) => boolean;
|
|
102
93
|
/** Whether a run's job, by its timeline `rows` (the end-of-run turn's own, labelled LEARNING_LABEL, left out), gave
|
|
103
|
-
* nothing new
|
|
104
|
-
*
|
|
105
|
-
*
|
|
106
|
-
* feedback round is no message of the job's. */
|
|
94
|
+
* nothing new: it called tools, every one of them learned_workflow (a workflow's own nested calls are its), each
|
|
95
|
+
* answering; no tool result failed or was refused; no error, approval or wait; and one message, its first, came in.
|
|
96
|
+
* Read on the job's turns (withoutFeedbackRounds): a grade's feedback round is no message of the job's. */
|
|
107
97
|
export declare function onlyLearnedWorkflows(rows: readonly TimelineEvent[]): boolean;
|
|
108
|
-
/** Whether a run carries its owner's feedback, the only thing a run of a job that compiles workflows is looked back on
|
|
109
|
-
* for: a grade's words its end closes (a feedback round, feedback-round.ts pendingFeedbackOf over its root `entries`),
|
|
110
|
-
* or a person's message after its first in its timeline `rows` (a follow-up, or a word while it ran: traceFrom's
|
|
111
|
-
* feedback), the end-of-run turn's own, a grade's round's and a subagent's (a child conversation's rows carry its
|
|
112
|
-
* spawning call, parent_tool_use_id: its task prompt is the job's, not the owner's) rows left out. */
|
|
113
|
-
export declare function ownerSaid(entries: readonly {
|
|
114
|
-
readonly kind: string;
|
|
115
|
-
readonly data?: unknown;
|
|
116
|
-
}[], rows: readonly TimelineEvent[]): boolean;
|
|
117
98
|
/** The path a run took (learning-cost.ts RunPath), by its timeline `rows` as runTimeline labels them (its end-of-run
|
|
118
99
|
* turn's rows, LEARNING_LABEL, are the learning's and left out): `workflow` when its job did only what
|
|
119
|
-
* onlyLearnedWorkflows asks of a run with nothing new
|
|
120
|
-
*
|
|
100
|
+
* onlyLearnedWorkflows asks of a run with nothing new, `handed_back` when it called a learned workflow otherwise,
|
|
101
|
+
* `agent` when it called none. */
|
|
121
102
|
export declare function runPathOf(rows: readonly TimelineEvent[]): RunPath;
|
|
122
103
|
/** The learned workflow a run's job called last by its call's `name` (callArgsOf's arguments, in the job's order: `calls`),
|
|
123
104
|
* or null when it called none by a name. */
|
|
@@ -125,6 +106,31 @@ export declare function workflowNameOf(calls: readonly {
|
|
|
125
106
|
tool: string;
|
|
126
107
|
args: Record<string, unknown>;
|
|
127
108
|
}[]): string | null;
|
|
109
|
+
/**
|
|
110
|
+
* One compile draft through the checks (the compile turn's `check`): its two files as the folder would hold them
|
|
111
|
+
* (workflow-draft.ts draftFiles: its workflow.json, and the README.md the host writes from its front matter), against
|
|
112
|
+
* `seed`, the commit the run started from (a revision of main's text, `revised`, against the commit it read that text
|
|
113
|
+
* at). In order: its example, the run's own input, refused for anything that must never be stored; the static checks
|
|
114
|
+
* (check.ts checkDraft: the DSL's validation, caps, the secret and hidden-character refusals, a file a person retired or
|
|
115
|
+
* holds for their OK); then its dry run (workflow-draft.ts draftDryRun: every model and tool answer synthesized, nothing
|
|
116
|
+
* sent, paid or run) and the checks again with it. Its errors, each naming its file; else what is committed: the files
|
|
117
|
+
* whole, the README held when a step calls an unpriced tool, the revision's base, and the workflow.json's digest. A
|
|
118
|
+
* draft that is the very text the commit holds passes nothing and keeps nothing.
|
|
119
|
+
*/
|
|
120
|
+
export declare function checkDraftOf(deps: LearningEndDeps, input: {
|
|
121
|
+
runId: string;
|
|
122
|
+
agentId: string;
|
|
123
|
+
seed: string;
|
|
124
|
+
draft: {
|
|
125
|
+
name: string;
|
|
126
|
+
text: string;
|
|
127
|
+
};
|
|
128
|
+
refuse: readonly string[];
|
|
129
|
+
revised?: {
|
|
130
|
+
readonly workflow: string;
|
|
131
|
+
readonly base: string;
|
|
132
|
+
};
|
|
133
|
+
}): Promise<DraftChecked<DraftCommit>>;
|
|
128
134
|
/** Compile once: run `runId`'s compile turn whose drafts all failed their checks is the compile's attempt, kept as a
|
|
129
135
|
* promotion record of the shape a check's stop has (runner/promotion.ts stopUnchecked): a hold with nothing checked,
|
|
130
136
|
* its reason (DRAFT_FAILED) naming the failed checks. A first compile's earns the one recompile, as a check's hold
|
|
@@ -154,20 +160,22 @@ export declare function traceFrom(timeline: readonly TimelineEvent[], refuse: re
|
|
|
154
160
|
* it, with the check's numbers and the inputs it disagreed on, once per hold (none when any run since the hold compiled
|
|
155
161
|
* it, read from the agent's kept learning; a stopped check's none); else, when the job is due (compileDue: the run
|
|
156
162
|
* completed, the agent has no learned workflow active or waiting, and it has its definition's compile_after completed
|
|
157
|
-
* agent runs), a new one, compiled once:
|
|
158
|
-
* (
|
|
159
|
-
*
|
|
160
|
-
*
|
|
161
|
-
*
|
|
162
|
-
*
|
|
163
|
-
*
|
|
164
|
-
*
|
|
165
|
-
* when the folder can't be read. */
|
|
163
|
+
* agent runs), a new one, compiled once: one more after a first compile whose drafts all failed their checks, and none
|
|
164
|
+
* after a recompile's (recordDraftFailed). A draft that passes is on main at once (a learned workflow then), so nothing
|
|
165
|
+
* waits on it. Nothing else asks one: a hand-back, a wrong grade of a served answer and the money rule's stop are single
|
|
166
|
+
* runs, which the hold reads among many. Either way the traces of the agent's last COMPILE_TRACES completed runs before
|
|
167
|
+
* this one, the tools a call node may run (draftTools) with what each takes and gives, its decision providers, the
|
|
168
|
+
* run's input (`input`, its fields for the workflow's input schema), the agent's output schema when it has one (its
|
|
169
|
+
* final output's shape) and the DSL's language with this host's addendum. An SDK run's compile, asked outside its
|
|
170
|
+
* session, also carries the owner's standing corrections it was laid with (`corrections`, its # Learned section), as an
|
|
171
|
+
* in-session compile reads them in its session. Undefined when it compiles nothing, or when the folder can't be read. */
|
|
166
172
|
export declare function compileAskOf(deps: LearningEndDeps, input: {
|
|
167
173
|
runId: string;
|
|
168
174
|
agentId: string;
|
|
169
175
|
outcome: "completed" | "failed";
|
|
170
176
|
refuse: readonly string[];
|
|
177
|
+
round?: number;
|
|
171
178
|
input?: unknown;
|
|
172
179
|
seedWorkflows?: number;
|
|
180
|
+
corrections?: string;
|
|
173
181
|
}): Promise<CompileAsk | undefined>;
|