@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
package/dist/store-reads/loop.js
CHANGED
|
@@ -40,7 +40,7 @@ export async function agentLoopOverStore(store, agentId) {
|
|
|
40
40
|
const own = named && kept16 ? promotionOf(promotions, named.workflow, kept16) : undefined;
|
|
41
41
|
const unchecked = own?.decided === "hold" && own.check?.stopped && own.check.n === 0 ? [own.reason] : [];
|
|
42
42
|
compiles.push({
|
|
43
|
-
createdAt: kept.createdAt, run_id: run.id, round: kept.round, at: new Date(kept.createdAt).toISOString(), workflow: named ? named.workflow : null,
|
|
43
|
+
createdAt: kept.createdAt, run_id: run.id, round: kept.round, at: new Date(kept.createdAt).toISOString(), workflow: named ? named.workflow : null, attempts,
|
|
44
44
|
digest: kept16, promoted: named && kept16 ? (promotedOf(promotions, named.workflow, kept16) ?? null) : null, draft_errors: [...errors, ...unchecked],
|
|
45
45
|
});
|
|
46
46
|
}
|
package/dist/store-view.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { type TimelineEvent } from "./timeline/index.js";
|
|
|
2
2
|
import { type ItemStatus } from "./learning.js";
|
|
3
3
|
import { type RunMoment, type SignInReader, type Status } from "./run-view.js";
|
|
4
4
|
import { type RunReadState } from "./store-reads/runs.js";
|
|
5
|
-
import { type Store } from "./store/store.js";
|
|
5
|
+
import { type RunListing, type Store } from "./store/store.js";
|
|
6
6
|
import type { RecordingView } from "./run-recordings.js";
|
|
7
7
|
/** What the store-backed view needs beside the store: where its console lives, every secret it never shows (read now, so
|
|
8
8
|
* one rotated is cut at once), and the agents' saved sign-ins (for the handed-pointer cut). The server passes the same it
|
|
@@ -29,6 +29,10 @@ export interface ViewDeps {
|
|
|
29
29
|
/** A settled run's v2 status from its row alone (STATUS_OF), the status its view reads (statusOf returns the outcome
|
|
30
30
|
* first); undefined for a run still going, whose status only its journal says. */
|
|
31
31
|
export declare const settledStatusOf: (state: RunReadState) => Status | undefined;
|
|
32
|
+
/** How long a run's listing waits before it is built again when its build could not read what it needed (ms): a listing
|
|
33
|
+
* that withheld the run for a sign-in it could not read back (listingOverStore), and the lister's build that failed
|
|
34
|
+
* (run-listing.ts). */
|
|
35
|
+
export declare const LISTING_RETRY_MS = 30000;
|
|
32
36
|
/** A run's whole answer as answerOfRun read it from the rows: its newest final-answer row, never the learning turn's, and
|
|
33
37
|
* never an earlier turn's: a final answer row before the person's last message belongs to the turn that message
|
|
34
38
|
* followed, so a follow-up whose own stop said nothing (no text block: a thinking-only stop) has no answer, null, not
|
|
@@ -39,6 +43,30 @@ export declare const answerOf: (timeline: readonly TimelineEvent[]) => string |
|
|
|
39
43
|
export declare function viewOverStore(store: Store, runId: string, deps: ViewDeps): Promise<Record<string, unknown> | undefined>;
|
|
40
44
|
/** The run list's answer from the store, byte-identical to runs.ts's summary: the view's subset a list shows. */
|
|
41
45
|
export declare function summaryOverStore(store: Store, runId: string, deps: ViewDeps): Promise<Record<string, unknown> | undefined>;
|
|
46
|
+
/** What a list shows of a run's view (summaryOverStore). */
|
|
47
|
+
export declare function summaryOfView(view: Record<string, unknown>): Record<string, unknown>;
|
|
48
|
+
/** A runs list's item for a run, as its listing keeps it on the run's row (store/schema.ts RUN_LISTING_COLUMNS), built from
|
|
49
|
+
* the run's view once per change and read by every list after: its list item (summaryOverStore's) with the parts a list
|
|
50
|
+
* fills in when it reads it (console_url: the origin the request reached; archived_at: the run's or its agent's archive
|
|
51
|
+
* now) kept empty; the digest of the server's secrets it was cut of (`cut`, so a list cuts it again of any saved since);
|
|
52
|
+
* its status; whether a runner held the run (its status reads otherwise once that claim runs out); when it goes stale by
|
|
53
|
+
* the clock alone (the ask it waits on expires, or LISTING_RETRY_MS after a build that withheld the run because the
|
|
54
|
+
* sign-in it was handed could not be read: that read may fail only for now, and the run reads whole once it recovers);
|
|
55
|
+
* and what outside the run it read (LISTING_HELD, LISTING_KEYED). Undefined for an unknown run. */
|
|
56
|
+
export declare function listingOverStore(store: Store, runId: string, deps: ViewDeps): Promise<RunListing | undefined>;
|
|
57
|
+
/** Whether `listing` was cut of the server's secrets as they are now. A list builds one cut of others again before it
|
|
58
|
+
* shows it (server.ts runsPage): the run's view cuts a value whole where it holds a secret (a note's name reads
|
|
59
|
+
* [redacted]), which cutting the built item again could not do. */
|
|
60
|
+
export declare function cutOfNow(listing: {
|
|
61
|
+
readonly cut: string;
|
|
62
|
+
}, serverSecrets: readonly string[]): boolean;
|
|
63
|
+
/** A listing's list item as a list serves it (listingOverStore): its console link at `origin`, its archive time now
|
|
64
|
+
* (`archivedAt`, ms, the run's or its agent's), and, when the server's secrets moved between its build and this (within
|
|
65
|
+
* one list), every string in it cut again of them (redactedOutput), so a secret saved since never shows. */
|
|
66
|
+
export declare function listedItem(listing: {
|
|
67
|
+
readonly item: Record<string, unknown>;
|
|
68
|
+
readonly cut: string;
|
|
69
|
+
}, origin: string, archivedAt: number | null, serverSecrets: readonly string[]): Record<string, unknown>;
|
|
42
70
|
/** A run's facts as its view states them, and none of its words: its kind, revision, agent, status and times, and whether
|
|
43
71
|
* its output is withheld (`unshown`). What a read that serves its own parts (the graph) needs of the run: read off the
|
|
44
72
|
* run as viewOverStore reads it, with nothing of it served, so nothing is redacted here. Undefined for an unknown run. */
|
package/dist/store-view.js
CHANGED
|
@@ -16,22 +16,26 @@ import { CONTENT_FILTER_WORDS, contentFiltered, MODERATED } from "./content-filt
|
|
|
16
16
|
import { COMPUTER_UNAVAILABLE_CODE, lostEndMessage } from "./computer-lost.js";
|
|
17
17
|
import { launchOf } from "./handed-values.js";
|
|
18
18
|
import { learningStartOf, seedFailed } from "./run-launch.js";
|
|
19
|
-
import { momentOf, pendingOf, stoppedTurn, approvalOf, asksOf, answersOf, activePauseOf, budgetOf, browserPending, computerPending, redactorOf, servedRunErrorWith, servedReviewWith, statusOf, WITHHELD_SIGN_IN, WITHHELD_TITLE, costWordsOfView, freeOf, usersOf, withAsks, withApprovalRows, } from "./run-view.js";
|
|
19
|
+
import { momentOf, pendingOf, stoppedTurn, approvalOf, asksOf, answersOf, activePauseOf, budgetOf, browserPending, computerPending, redactorOf, servedRunErrorWith, servedReviewWith, statusOf, WITHHELD_SIGN_IN, WITHHELD_TITLE, costWordsOfView, freeOf, stopAsked, usersOf, withAsks, withApprovalRows, } from "./run-view.js";
|
|
20
20
|
import { reflects } from "./reflect-range.js";
|
|
21
21
|
import { freeCeilingMessage, overCapMessage, SPEND_CAP_REACHED } from "@parcha/agentrun-kernel/kernel/cap";
|
|
22
22
|
import { bookedSpend, cliModelWorked, costWordsOf, planSpend, runCostOf } from "./runner/metrics.js";
|
|
23
23
|
import { journalRecords, recordOf } from "./runner/journal-reader.js";
|
|
24
24
|
import { capNowOf, KINDS } from "./runner/journal-kinds.js";
|
|
25
|
-
import { laidOf,
|
|
25
|
+
import { laidOf, runLearningEnd, usedOnly } from "./store-reads/learning.js";
|
|
26
|
+
import { correctionCount } from "./learn/corrections.js";
|
|
26
27
|
import { isCliRecord, runReflect, runTimeline, wholeAnswerFor, wholeAnswers, withoutFeedbackRounds } from "./store-reads/journal.js";
|
|
27
28
|
import { readRun } from "./store-reads/runs.js";
|
|
28
29
|
import { runCutValues, runErrorWordsOf, underCut } from "./run-cut.js";
|
|
29
30
|
import { Turns } from "./turns.js";
|
|
30
31
|
import { harnessOfBody } from "./harness.js";
|
|
32
|
+
import { LOGIN_HARNESS } from "./claude-login.js";
|
|
31
33
|
import { browserAsk as browserAskOf, BROWSER_HANDOVER_KIND } from "./browser-commands.js";
|
|
32
34
|
import { computerAsk as computerAskOf, COMPUTER_HANDOVER_KIND } from "./computer-commands.js";
|
|
33
35
|
import { approvalsOf } from "./approvals.js";
|
|
34
36
|
import { FINAL_STATES, stoppedByPerson } from "./store/store.js";
|
|
37
|
+
import { LISTING_HELD, LISTING_KEYED } from "./store/schema.js";
|
|
38
|
+
import { createHash } from "node:crypto";
|
|
35
39
|
/** A run that has ended reads one of these (the old RunRow state → the v2 status: an escalation is a completion with a
|
|
36
40
|
* review; a stopped run is a cancellation), as runs.ts's STATUS_OF mapped them. A running run reads its status from the
|
|
37
41
|
* journal, and so does an agentic run a person stopped, which reads running (runReadState). */
|
|
@@ -41,6 +45,10 @@ const STATUS_OF = { completed: "completed", failed: "failed", escalated: "comple
|
|
|
41
45
|
export const settledStatusOf = (state) => (state === "running" ? undefined : STATUS_OF[state]);
|
|
42
46
|
/** A run that has reached a last state (its view is its ended shape). */
|
|
43
47
|
const TERMINAL = new Set(["completed", "failed", "cancelled"]);
|
|
48
|
+
/** How long a run's listing waits before it is built again when its build could not read what it needed (ms): a listing
|
|
49
|
+
* that withheld the run for a sign-in it could not read back (listingOverStore), and the lister's build that failed
|
|
50
|
+
* (run-listing.ts). */
|
|
51
|
+
export const LISTING_RETRY_MS = 30_000;
|
|
44
52
|
const iso = (ms) => new Date(ms).toISOString();
|
|
45
53
|
/** What a view last made of a run's text, by store and slot (a run's answer, or its input): the text it read (`input`),
|
|
46
54
|
* the digest of the values it was redacted of (`key`) and what that gave (`out`), so a second view of the same text and
|
|
@@ -206,14 +214,11 @@ async function storeRunIn(store, runId, deps, cut) {
|
|
|
206
214
|
const nativeSession = records.entries.findLast(e => e.kind === "agentrun.native.session")?.data;
|
|
207
215
|
const native = launch?.native ? { runtime: launch.native.runtime, project: launch.native.project, selector: launch.native.selector, machine_id: launch.native.machine_id, fingerprint: nativeConfiguration?.fingerprint ?? launch.native.fingerprint, session_id: nativeSession?.session_id ?? null, model: nativeEvents.at(-1)?.model ?? launch.native.model, learning_revision: launch.learning?.seed ?? null, usage: { task: nativeTaskUsage, reflection: nativeEvents.filter(e => e.phase === "reflection").map(e => e.usage) }, model_requests: null } : undefined;
|
|
208
216
|
const skip = reflectRange ? (id) => reflects(reflectRange, id) : undefined;
|
|
209
|
-
// The run's learning end
|
|
210
|
-
//
|
|
211
|
-
// run that learns is seeded, then looking back once its end-of-run turn starts (main's seeded and reflecting).
|
|
217
|
+
// The run's learning end. Before its end, a run that learns is seeded, then looking back once its end-of-run turn starts
|
|
218
|
+
// (main's seeded and reflecting).
|
|
212
219
|
const started = launch ? learningStartOf(launch) : undefined;
|
|
213
|
-
const read = started?.given.length ? notesReadOf(started.given, reflectRange, await runTimeline(store, runId, context, { settled: terminal })) : [];
|
|
214
220
|
const under = !ended && started && started.use ? usedOnly(started, terminal, iso(runRow.endedAt ?? runRow.startedAt)) : !ended && started && !seedFailed(started) ? underWay(started, laidOf(records.entries), reflectRange, iso(runRow.startedAt)) : null;
|
|
215
|
-
const
|
|
216
|
-
const shownEnd = sofar && withNotes(sofar, started, read);
|
|
221
|
+
const shownEnd = ended ?? under;
|
|
217
222
|
const turns = new Turns();
|
|
218
223
|
turns.note(recordOf(records.entries), records.submissions ?? [], skip, liveRow?.updatedAt ?? deps.now?.() ?? Date.now());
|
|
219
224
|
const working = live && turns.open > 0;
|
|
@@ -223,21 +228,32 @@ async function storeRunIn(store, runId, deps, cut) {
|
|
|
223
228
|
// the answers given, which the status, pending and moment views read the same as the file path read them from the run's
|
|
224
229
|
// store entries.
|
|
225
230
|
const approvals = asksOf(records.entries);
|
|
231
|
+
// The run's command rows, read once for what needs them: a stop or a cancel asked for, a hand-over's answers, and the
|
|
232
|
+
// person's messages not yet taken.
|
|
233
|
+
let commandRows;
|
|
234
|
+
const commandsNow = async () => (commandRows ??= await store.commands(runId, 0));
|
|
235
|
+
// A person's stop of an agentic run (stoppedByPerson: its row reads running, readRun) is main's stop mark: the run is
|
|
236
|
+
// stopped while no message is newer than the stop (statusOf: input_required and idle), and a message reopens it. A stop
|
|
237
|
+
// asked for and not yet taken (stopAsked) is the mark too once nothing works: between the turn's cut and the end that
|
|
238
|
+
// takes the stop, a read would otherwise see the cut turn's input_required with nothing pending; a run waiting (on an
|
|
239
|
+
// approval, a person, a browser) reads stopped from the stop's answer on. While its turn still works it reads working:
|
|
240
|
+
// the cut is what books the request it cuts (its cost unknown), so a run read stopped before the cut would say the known
|
|
241
|
+
// sum as its cost.
|
|
242
|
+
const asked = !terminal && !working && stopAsked(row, runRow, await commandsNow());
|
|
226
243
|
// A call asked before an end in the journal reads withdrawn in that end's words; a stopped or failed run's (states no
|
|
227
|
-
// reopen leaves) whose journal holds no end, by its row (answersOf `final`)
|
|
228
|
-
|
|
244
|
+
// reopen leaves) whose journal holds no end, by its row (answersOf `final`); every call still waiting once a stop is
|
|
245
|
+
// asked (stopAsked).
|
|
246
|
+
const answers = answersOf(records.entries, { final: runRow.state === "stopped" || runRow.state === "failed" ? runRow.state : asked ? "stopped" : undefined });
|
|
229
247
|
// The rows a person reads: each call that waited for approval in order (held, your approval, what came of it), its
|
|
230
248
|
// arguments and the person's notes through the run's redactor, as the file path's withApprovals served them.
|
|
231
249
|
const rows = withApprovalRows(timeline, approvals, answers, redactorOf(values));
|
|
232
250
|
// The run's cap as it stands, through the one reader the runner's gate reads too (capNowOf): a raise taken shows in the
|
|
233
251
|
// run's cost.cap_usd and its budget card, never the old cap.
|
|
234
252
|
const capUsd = capNowOf(launch?.maxCostUsd, records.entries);
|
|
235
|
-
// A person's stop of an agentic run (stoppedByPerson: its row reads running, readRun) is main's stop mark: the run is
|
|
236
|
-
// stopped while no message is newer than the stop (statusOf: input_required and idle), and a message reopens it.
|
|
237
253
|
const meta = {
|
|
238
254
|
...(capUsd !== undefined ? { max_cost_usd: capUsd } : {}),
|
|
239
255
|
...(Object.keys(answers).length ? { approvals: answers } : {}),
|
|
240
|
-
...(stoppedByPerson(runRow, row.kind) ? { stopped_after: usersOf(rows) } : {}),
|
|
256
|
+
...(stoppedByPerson(runRow, row.kind) || asked ? { stopped_after: usersOf(rows) } : {}),
|
|
241
257
|
};
|
|
242
258
|
// The budget card the run shows while it stands parked at its cap, from its journal's agentrun.budget park (none once a
|
|
243
259
|
// raise clears it). Read over the same meta cap and rows the card's figures and time come from.
|
|
@@ -248,10 +264,7 @@ async function storeRunIn(store, runId, deps, cut) {
|
|
|
248
264
|
const paused = pausedOf(runRow, records.entries);
|
|
249
265
|
// The browser hand-over the agent waits on (E2c's reader over the run's hand-over entries and hand-back commands), read
|
|
250
266
|
// against the server's clock. Only a run with a hand-over entry fetches its commands, so a run with none reads none and
|
|
251
|
-
// makes no extra store read.
|
|
252
|
-
// The run's command rows, read once for what needs them: a hand-over's answers, and the person's messages not yet taken.
|
|
253
|
-
let commandRows;
|
|
254
|
-
const commandsNow = async () => (commandRows ??= await store.commands(runId, 0));
|
|
267
|
+
// makes no extra store read beyond the one a running run's stop and cancel already make.
|
|
255
268
|
const browserAsk = records.entries.some((e) => e.kind === BROWSER_HANDOVER_KIND)
|
|
256
269
|
? browserAskOf(records.entries, await commandsNow(), deps.now?.() ?? Date.now())
|
|
257
270
|
: undefined;
|
|
@@ -316,16 +329,16 @@ async function storeRunIn(store, runId, deps, cut) {
|
|
|
316
329
|
return { ...(sdk ? { sdk } : {}), ...(native ? { native } : {}), row, runRow, launch, rows, version, harness, learningEnd: shownEnd, shownEnd, view, unshown, values, live, updatedAtMs, lastProgressAt, budget, paused, browserAsk, computerAsk, approvalsMode, output, ...(review ? { review } : {}), structured, decisions, plan, ...(endCost ? { endCost, endSaidCost } : {}) };
|
|
317
330
|
}
|
|
318
331
|
/** A run's learning as the view shows it: its end from the store (what it held for the owner's OK as it reads now), in a
|
|
319
|
-
* person's words cut of the host's secrets now
|
|
320
|
-
function learningViewOf(learningEnd, shown
|
|
332
|
+
* person's words cut of the host's secrets now. */
|
|
333
|
+
function learningViewOf(learningEnd, shown) {
|
|
321
334
|
if (!learningEnd)
|
|
322
335
|
return null;
|
|
323
|
-
return learningView(learningEnd, shown
|
|
336
|
+
return learningView(learningEnd, shown);
|
|
324
337
|
}
|
|
325
|
-
/** A run's learning before its end: its
|
|
326
|
-
* until its end-of-run turn starts; then looking back.
|
|
338
|
+
/** A run's learning before its end: the corrections its # Learned section holds and the learned workflows its claims
|
|
339
|
+
* laid, until its end-of-run turn starts; then looking back. */
|
|
327
340
|
function underWay(started, laid, reflect, at) {
|
|
328
|
-
return reflect ? { state: "reflecting", reason: null, detail: said.reflecting, at } : { state: "seeded", reason: null, detail: said.seeded(started.
|
|
341
|
+
return reflect ? { state: "reflecting", reason: null, detail: said.reflecting, at } : { state: "seeded", reason: null, detail: said.seeded(correctionCount(started.section), laid.workflows.length), at };
|
|
329
342
|
}
|
|
330
343
|
/** The cost a run's view shows (runs.ts cost): its rows' cost, else what the store kept, and its cap. */
|
|
331
344
|
function costOfView(run) {
|
|
@@ -358,21 +371,26 @@ function costOfView(run) {
|
|
|
358
371
|
const usd = words.usd;
|
|
359
372
|
const counted = words.so_far_usd !== undefined && words.unpriced !== undefined ? { so_far_usd: words.so_far_usd, unpriced: words.unpriced } : undefined;
|
|
360
373
|
const upper = words.upper_bound ? { upper_bound: true } : undefined;
|
|
361
|
-
// A request billed to a
|
|
362
|
-
// $0, so it is in no unpriced count; what it used on the plan is said beside the figure
|
|
374
|
+
// A request billed to a person's plan costs no dollars, however it ended (the kernel's turnCostOf): every reader counts it
|
|
375
|
+
// $0, so it is in no unpriced count; what it used on the plan is said beside the figure, and which plan: a run on the
|
|
376
|
+
// login's harness was on Claude Code's login (claude-login.ts), any other on the ChatGPT sign-in.
|
|
363
377
|
const plan = run.plan;
|
|
378
|
+
const on = run.harness === LOGIN_HARNESS ? "claude_code" : "chatgpt";
|
|
364
379
|
// Beside its figure: while it is unknown, what is known so far; at $0 with every model request on a free model (and no
|
|
365
380
|
// decision of its own), that it is free.
|
|
366
381
|
const soFar = counted ?? (imported || decisions?.requests ? undefined : freeOf(run.rows, usd));
|
|
367
382
|
// The run's cap as it stands (its view's meta: the newest raise's, else the launch's).
|
|
368
383
|
const cap = run.view.meta.max_cost_usd;
|
|
369
|
-
return { usd, basis: "estimate", charge_state: null, cap_usd: cap ?? null, ...(soFar ?? {}), ...(upper ?? {}), ...(plan ? { plan: { requests: plan.requests, tokens: plan.tokens } } : {}) };
|
|
384
|
+
return { usd, basis: "estimate", charge_state: null, cap_usd: cap ?? null, ...(soFar ?? {}), ...(upper ?? {}), ...(plan ? { plan: { requests: plan.requests, tokens: plan.tokens, on } } : {}) };
|
|
370
385
|
}
|
|
371
386
|
/** GET /runs/{id}'s answer from the store, byte-identical to runs.ts's view for the same run. Undefined for an unknown run. */
|
|
372
387
|
export async function viewOverStore(store, runId, deps) {
|
|
373
388
|
const run = await storeRunOf(store, runId, deps);
|
|
374
|
-
|
|
375
|
-
|
|
389
|
+
return run && viewOfRun(store, runId, deps, run);
|
|
390
|
+
}
|
|
391
|
+
/** GET /runs/{id}'s answer for a run already read (storeRunOf). `read.withheld` is set to whether the answer withholds the
|
|
392
|
+
* run because this server could not read back the sign-in it was handed (its cut, or its error's words). */
|
|
393
|
+
async function viewOfRun(store, runId, deps, run, read) {
|
|
376
394
|
const { row, runRow, launch, view, unshown, values, output, review: kept, structured } = run;
|
|
377
395
|
const { status, state } = statusOf(view, factsOf(run));
|
|
378
396
|
const terminal = TERMINAL.has(status);
|
|
@@ -417,6 +435,8 @@ export async function viewOverStore(store, runId, deps) {
|
|
|
417
435
|
const failedReason = run.rows.findLast((r) => r.kind === "error")?.text ?? row.summary ?? null;
|
|
418
436
|
const errorWords = status === "failed" && !unshown ? await runErrorWordsOf({ ...deps, keyEnv: deps.keyEnv ?? (() => process.env) }, store, runId, { workflow: row.kind === "workflow" }) : undefined;
|
|
419
437
|
const withheld = unshown || errorWords === "unreadable";
|
|
438
|
+
if (read)
|
|
439
|
+
read.withheld = withheld;
|
|
420
440
|
const error = status === "failed" ? (withheld ? { code: "run_failed", message: WITHHELD_SIGN_IN, retryable: false } : servedRunErrorWith(errorWords ?? shownWords, errorOfRow(failedReason))) : null;
|
|
421
441
|
const review = endedAtMs === null ? null : servedReviewWith(shownWords, unshown, reviewAt(reviewOfRow(row.state, row.summary ?? null, kept), iso(endedAtMs)));
|
|
422
442
|
// The card the run shows while it waits, in the order the file-backed view (runs.ts) picks them: a tool call parked for a
|
|
@@ -473,7 +493,7 @@ export async function viewOverStore(store, runId, deps) {
|
|
|
473
493
|
// The caller's labels, as given at the start ({} when none): its own strings, never cut.
|
|
474
494
|
labels: runRow.labels,
|
|
475
495
|
// Cut by the run's one cut (the pointers it was handed among them), and none for a withheld run, as its words.
|
|
476
|
-
learning: unshown ? null : learningViewOf(run.learningEnd, secretsShown(values)
|
|
496
|
+
learning: unshown ? null : learningViewOf(run.learningEnd, secretsShown(values)),
|
|
477
497
|
// Its screen recordings (computer.record), from the files on this machine, where its read asks for them; none for a
|
|
478
498
|
// withheld run, whose files are refused. A run that left running with no end stamped (parked) ends now, each read: only
|
|
479
499
|
// a file's trailer finishes it there.
|
|
@@ -485,8 +505,10 @@ export async function viewOverStore(store, runId, deps) {
|
|
|
485
505
|
/** The run list's answer from the store, byte-identical to runs.ts's summary: the view's subset a list shows. */
|
|
486
506
|
export async function summaryOverStore(store, runId, deps) {
|
|
487
507
|
const view = await viewOverStore(store, runId, deps);
|
|
488
|
-
|
|
489
|
-
|
|
508
|
+
return view && summaryOfView(view);
|
|
509
|
+
}
|
|
510
|
+
/** What a list shows of a run's view (summaryOverStore). */
|
|
511
|
+
export function summaryOfView(view) {
|
|
490
512
|
const { run_id, agent_id, agent_version, console_url, revision, kind, sha, status, state, title, effort, created_at, ended_at, error, review, pending, cost, archived_at, imported_from, trigger, labels, learning } = view;
|
|
491
513
|
return {
|
|
492
514
|
run_id, agent_id, agent_version, console_url, revision, kind, sha, status, state, title,
|
|
@@ -497,6 +519,50 @@ export async function summaryOverStore(store, runId, deps) {
|
|
|
497
519
|
learning: learning ? shortOf(learning) : null,
|
|
498
520
|
};
|
|
499
521
|
}
|
|
522
|
+
/** A runs list's item for a run, as its listing keeps it on the run's row (store/schema.ts RUN_LISTING_COLUMNS), built from
|
|
523
|
+
* the run's view once per change and read by every list after: its list item (summaryOverStore's) with the parts a list
|
|
524
|
+
* fills in when it reads it (console_url: the origin the request reached; archived_at: the run's or its agent's archive
|
|
525
|
+
* now) kept empty; the digest of the server's secrets it was cut of (`cut`, so a list cuts it again of any saved since);
|
|
526
|
+
* its status; whether a runner held the run (its status reads otherwise once that claim runs out); when it goes stale by
|
|
527
|
+
* the clock alone (the ask it waits on expires, or LISTING_RETRY_MS after a build that withheld the run because the
|
|
528
|
+
* sign-in it was handed could not be read: that read may fail only for now, and the run reads whole once it recovers);
|
|
529
|
+
* and what outside the run it read (LISTING_HELD, LISTING_KEYED). Undefined for an unknown run. */
|
|
530
|
+
export async function listingOverStore(store, runId, deps) {
|
|
531
|
+
const cut = secretsDigest(deps.serverSecrets());
|
|
532
|
+
const run = await storeRunOf(store, runId, deps);
|
|
533
|
+
if (!run)
|
|
534
|
+
return undefined;
|
|
535
|
+
const read = { withheld: false };
|
|
536
|
+
const summary = summaryOfView(await viewOfRun(store, runId, deps, run, read));
|
|
537
|
+
const status = String(summary.status);
|
|
538
|
+
const terminal = TERMINAL.has(status);
|
|
539
|
+
const asks = terminal ? [] : [run.browserAsk?.expires_at, run.computerAsk?.expires_at].map((at) => (typeof at === "string" ? Date.parse(at) : Number.NaN)).filter((at) => Number.isFinite(at));
|
|
540
|
+
const expiries = read.withheld ? [...asks, (deps.now ?? Date.now)() + LISTING_RETRY_MS] : asks;
|
|
541
|
+
const flags = (run.shownEnd && holdsForOk(run.shownEnd) ? LISTING_HELD : 0) | (status === "failed" && run.row.kind !== "workflow" ? LISTING_KEYED : 0);
|
|
542
|
+
return {
|
|
543
|
+
item: { ...summary, console_url: null, archived_at: null },
|
|
544
|
+
cut,
|
|
545
|
+
status,
|
|
546
|
+
live: run.live,
|
|
547
|
+
until: expiries.length ? Math.min(...expiries) : null,
|
|
548
|
+
flags,
|
|
549
|
+
};
|
|
550
|
+
}
|
|
551
|
+
/** Whether `listing` was cut of the server's secrets as they are now. A list builds one cut of others again before it
|
|
552
|
+
* shows it (server.ts runsPage): the run's view cuts a value whole where it holds a secret (a note's name reads
|
|
553
|
+
* [redacted]), which cutting the built item again could not do. */
|
|
554
|
+
export function cutOfNow(listing, serverSecrets) {
|
|
555
|
+
return listing.cut === secretsDigest(serverSecrets);
|
|
556
|
+
}
|
|
557
|
+
/** A listing's list item as a list serves it (listingOverStore): its console link at `origin`, its archive time now
|
|
558
|
+
* (`archivedAt`, ms, the run's or its agent's), and, when the server's secrets moved between its build and this (within
|
|
559
|
+
* one list), every string in it cut again of them (redactedOutput), so a secret saved since never shows. */
|
|
560
|
+
export function listedItem(listing, origin, archivedAt, serverSecrets) {
|
|
561
|
+
const item = { ...listing.item, console_url: runLink(origin, String(listing.item.run_id)), archived_at: archivedAt === null ? null : iso(archivedAt) };
|
|
562
|
+
return listing.cut === secretsDigest(serverSecrets) ? item : redactedOutput(item, [...serverSecrets]);
|
|
563
|
+
}
|
|
564
|
+
/** A set of secrets' digest, the same for the same set in any order: what a listing was cut of. */
|
|
565
|
+
const secretsDigest = (values) => createHash("sha256").update([...new Set(values)].sort().join("\0")).digest("hex");
|
|
500
566
|
/** A run's facts as its view states them, and none of its words: its kind, revision, agent, status and times, and whether
|
|
501
567
|
* its output is withheld (`unshown`). What a read that serves its own parts (the graph) needs of the run: read off the
|
|
502
568
|
* run as viewOverStore reads it, with nothing of it served, so nothing is redacted here. Undefined for an unknown run. */
|
package/dist/template-eval.d.ts
CHANGED
|
@@ -110,11 +110,8 @@ export type EvalCase = {
|
|
|
110
110
|
/** How the case's runs' monid endpoints answer in place of monid (runner/monid-run.ts): `unavailable`, as monid
|
|
111
111
|
* unreachable does, never sent. The eval's own server's runner alone binds it. Absent: monid. */
|
|
112
112
|
monid?: MonidFake;
|
|
113
|
-
/** The
|
|
114
|
-
learning
|
|
115
|
-
file: string;
|
|
116
|
-
text: string;
|
|
117
|
-
}[];
|
|
113
|
+
/** The owner's corrections a run's agent starts with (its corrections.md, whole). Absent: none. */
|
|
114
|
+
learning?: string;
|
|
118
115
|
graders: Grader[];
|
|
119
116
|
/** The case's clock (`now:`, an RFC 3339 date-time with its offset, as written): each run's current date and time,
|
|
120
117
|
* which the eval's own runner alone sets, and its llm graders are told. Absent: the real clock. */
|
|
@@ -141,7 +138,7 @@ export declare class CaseError extends Error {
|
|
|
141
138
|
}
|
|
142
139
|
/** The package in `dir`, checked as the server checks it, and its eval cases (all, or those `names` lists), each read and
|
|
143
140
|
* checked whole: the prompt, case.yaml against the package (an apply's parameters and grants), each fake MCP server's
|
|
144
|
-
* fixture,
|
|
141
|
+
* fixture, its corrections as the learning API checks them, and each grader's fields. Nothing runs. PackageError or
|
|
145
142
|
* CaseError with every problem found. */
|
|
146
143
|
export declare function readCases(dir: string, names?: readonly string[]): {
|
|
147
144
|
pkg: Package;
|
package/dist/template-eval.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// Everything goes through the v2 API alone, on an in-process server over a temp data directory by default (an eval never
|
|
4
4
|
// touches the owner's server) or on one named by its address and token. Per case: a fake MCP server per `mcp` fixture,
|
|
5
5
|
// saved under its name with no credential and recording every call; the package applied with the case's parameters and
|
|
6
|
-
// grants, a fresh agent per run, its learning seeded from the case's
|
|
6
|
+
// grants, a fresh agent per run, its learning seeded from the case's corrections; one run per `runs` with the prompt's body as
|
|
7
7
|
// its input and the case's cap, on the case's clock when it sets one (`now`), waited for; then its answer, its tool calls (its timeline read with calls=whole, each
|
|
8
8
|
// call's arguments and its output's head through the run's redaction, and the fakes' own logs) and its files, graded, and held to the package's output schema when it declares one (outputVerdict,
|
|
9
9
|
// the server's own verdict). Every grader is deterministic but `llm`, which is itself a run on the same
|
|
@@ -16,8 +16,7 @@ import { tmpdir } from "node:os";
|
|
|
16
16
|
import { join } from "node:path";
|
|
17
17
|
import { parseDocument } from "yaml";
|
|
18
18
|
import { answerJson, lastJsonBlock } from "./answer-json.js";
|
|
19
|
-
import {
|
|
20
|
-
import { NOTE_FILE } from "./learn/notes.js";
|
|
19
|
+
import { correctionsProblems } from "./learn/index.js";
|
|
21
20
|
import { linkCheck } from "./link-check.js";
|
|
22
21
|
import { inputMessage } from "./run-manifest.js";
|
|
23
22
|
import { shownUrl } from "./mcp-probe.js";
|
|
@@ -272,7 +271,7 @@ function graderOfType(p, file, text, bad) {
|
|
|
272
271
|
}
|
|
273
272
|
/** The package in `dir`, checked as the server checks it, and its eval cases (all, or those `names` lists), each read and
|
|
274
273
|
* checked whole: the prompt, case.yaml against the package (an apply's parameters and grants), each fake MCP server's
|
|
275
|
-
* fixture,
|
|
274
|
+
* fixture, its corrections as the learning API checks them, and each grader's fields. Nothing runs. PackageError or
|
|
276
275
|
* CaseError with every problem found. */
|
|
277
276
|
export function readCases(dir, names) {
|
|
278
277
|
// The cases are read below, each fixture checked there in the case's own words (a CaseError), not by the package read.
|
|
@@ -471,29 +470,18 @@ export function readCases(dir, names) {
|
|
|
471
470
|
if (body || fields || f.max_cost_usd !== undefined)
|
|
472
471
|
bad(`${at}/prompt.md: a feed case's run is started by the package's trigger, on the trigger's input and cap: its prompt.md holds description and runs alone`);
|
|
473
472
|
}
|
|
474
|
-
|
|
473
|
+
let learning;
|
|
475
474
|
if (c.learning !== undefined) {
|
|
476
|
-
const
|
|
477
|
-
if (!
|
|
478
|
-
bad(`${at}/case.yaml: learning names ${JSON.stringify(c.learning)}, not a
|
|
475
|
+
const file = inside(root, c.learning, "file");
|
|
476
|
+
if (!file)
|
|
477
|
+
bad(`${at}/case.yaml: learning names ${JSON.stringify(c.learning)}, not a file in the case`);
|
|
479
478
|
else {
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
continue;
|
|
487
|
-
}
|
|
488
|
-
const bytes = readFileSync(join(root, folder, entry.name));
|
|
489
|
-
const checked = checkNote(entry.name, bytes);
|
|
490
|
-
if (!checked.note)
|
|
491
|
-
for (const problem of checked.problems)
|
|
492
|
-
bad(`${path}: ${problem.detail}`);
|
|
493
|
-
learning.push({ file: entry.name, text: bytes.toString("utf8") });
|
|
494
|
-
}
|
|
495
|
-
if (!learning.length)
|
|
496
|
-
bad(`${at}/${folder}: holds no note`);
|
|
479
|
+
// The owner's corrections as the learning API takes them (PUT .../learning/corrections): one file, within its cap.
|
|
480
|
+
learning = readFileSync(join(root, file), "utf8");
|
|
481
|
+
for (const problem of correctionsProblems(learning))
|
|
482
|
+
bad(`${at}/${file}: ${problem.detail}`);
|
|
483
|
+
if (!learning.trim())
|
|
484
|
+
bad(`${at}/${file}: holds no correction`);
|
|
497
485
|
}
|
|
498
486
|
}
|
|
499
487
|
const graders = [];
|
|
@@ -516,7 +504,7 @@ export function readCases(dir, names) {
|
|
|
516
504
|
cases.push({
|
|
517
505
|
name, description: typeof f.description === "string" ? f.description : "", runs: typeof f.runs === "number" ? f.runs : 1,
|
|
518
506
|
...(typeof f.max_cost_usd === "number" ? { maxCostUsd: f.max_cost_usd } : {}), input: body, ...(fields ? { fields } : {}),
|
|
519
|
-
parameters, grants, mcp, ...(web ? { web } : {}), ...(monid ? { monid } : {}), learning, graders, ...(typeof c.now === "string" ? { now: c.now } : {}), ...(email ? { email } : {}), ...(calendar ? { calendar } : {}), ...(feed ? { feed } : {}),
|
|
507
|
+
parameters, grants, mcp, ...(web ? { web } : {}), ...(monid ? { monid } : {}), ...(learning !== undefined ? { learning } : {}), graders, ...(typeof c.now === "string" ? { now: c.now } : {}), ...(email ? { email } : {}), ...(calendar ? { calendar } : {}), ...(feed ? { feed } : {}),
|
|
520
508
|
});
|
|
521
509
|
}
|
|
522
510
|
if (problems.length)
|
|
@@ -1034,7 +1022,7 @@ export async function evalTemplate(options) {
|
|
|
1034
1022
|
const work = await workOf(options.data).catch((error) => (removeTree(scratch), Promise.reject(error)));
|
|
1035
1023
|
if (work) {
|
|
1036
1024
|
removeTree(scratch);
|
|
1037
|
-
throw new Error(`the server on ${options.data} has work of its own: ${work}, which the eval's server and runner would take up: disable its triggers and let its runs
|
|
1025
|
+
throw new Error(`the server on ${options.data} has work of its own: ${work}, which the eval's server and runner would take up: disable its triggers and let its runs end (or stop them), then run the eval; or run it without --on-data`);
|
|
1038
1026
|
}
|
|
1039
1027
|
}
|
|
1040
1028
|
const { startServe } = await import("./server.js");
|
|
@@ -1257,18 +1245,14 @@ async function workOf(data) {
|
|
|
1257
1245
|
const store = await openStore({ dataDir: data, role: "server" });
|
|
1258
1246
|
try {
|
|
1259
1247
|
const triggers = (await store.triggers.all()).filter((one) => one.enabled && !one.disabled).length;
|
|
1260
|
-
// The runs not ended a list shows, and every run a runner would claim
|
|
1261
|
-
// (a kept learning's), which the eval's runner claims as any other.
|
|
1248
|
+
// The runs not ended a list shows, and every run a runner would claim.
|
|
1262
1249
|
const runs = new Set();
|
|
1263
1250
|
for (const state of ["queued", "running", "parked"])
|
|
1264
1251
|
for (const run of await store.runs.list({ state }))
|
|
1265
1252
|
runs.add(run.id);
|
|
1266
1253
|
for (const id of await store.runs.claimable())
|
|
1267
1254
|
runs.add(id);
|
|
1268
|
-
|
|
1269
|
-
// next rows' runs with it.
|
|
1270
|
-
const batches = (await store.settings.all()).filter(({ key, value }) => /^learning_batch\/lb_[0-9a-f]{16}$/.test(key) && isObject(value) && value.status === "running").length;
|
|
1271
|
-
const said = [triggers ? `${triggers} enabled trigger${triggers === 1 ? "" : "s"}` : "", runs.size ? `${runs.size} run${runs.size === 1 ? "" : "s"} not ended` : "", batches ? `${batches} learning batch${batches === 1 ? "" : "es"} running` : ""].filter(Boolean);
|
|
1255
|
+
const said = [triggers ? `${triggers} enabled trigger${triggers === 1 ? "" : "s"}` : "", runs.size ? `${runs.size} run${runs.size === 1 ? "" : "s"} not ended` : ""].filter(Boolean);
|
|
1272
1256
|
return said.length ? said.join(", ") : undefined;
|
|
1273
1257
|
}
|
|
1274
1258
|
finally {
|
|
@@ -1357,7 +1341,7 @@ async function triggerRun(ctx, name, agentId, triggerId, deliver, hint) {
|
|
|
1357
1341
|
await sleep(200);
|
|
1358
1342
|
}
|
|
1359
1343
|
}
|
|
1360
|
-
/** One run of a case: a fresh agent (so one run's learning never reaches the next), its
|
|
1344
|
+
/** One run of a case: a fresh agent (so one run's learning never reaches the next), its corrections, the run, its grades. An
|
|
1361
1345
|
* email case's run (`mail`) is its trigger's (triggerRun). */
|
|
1362
1346
|
async function runOnce(ctx, one, n, fakes, mail, feeds) {
|
|
1363
1347
|
const { api, pkg, options, made } = ctx;
|
|
@@ -1400,8 +1384,10 @@ async function runOnce(ctx, one, n, fakes, mail, feeds) {
|
|
|
1400
1384
|
const used = Object.fromEntries(Object.entries(isObject(applied.servers) ? applied.servers : {}).filter((entry) => typeof entry[1] === "string"));
|
|
1401
1385
|
await sameAsLocal(ctx, one, agent, used);
|
|
1402
1386
|
stopped();
|
|
1403
|
-
|
|
1404
|
-
|
|
1387
|
+
if (one.learning !== undefined) {
|
|
1388
|
+
const corrections = `/agents/${encodeURIComponent(agentId)}/learning/corrections`;
|
|
1389
|
+
const read = expectOk("reading the agent's corrections", await api("GET", corrections));
|
|
1390
|
+
expectOk("seeding the agent's corrections", await api("PUT", corrections, { text: one.learning }, { "if-match": String(read.etag) }));
|
|
1405
1391
|
}
|
|
1406
1392
|
stopped();
|
|
1407
1393
|
// The case's fakes, for this run's agent alone, before its run can be claimed.
|
package/dist/templates.d.ts
CHANGED
|
@@ -383,7 +383,7 @@ export declare class TemplateRegistry {
|
|
|
383
383
|
/** Whether an imported package of that id was there to remove. */
|
|
384
384
|
remove(id: string): boolean;
|
|
385
385
|
}
|
|
386
|
-
/** POST /v2/templates/{name}/apply's body (`{parameters, grants?, overrides?: {model?, choice?, approvals?}}`), checked
|
|
386
|
+
/** POST /v2/templates/{name}/apply's body (`{parameters, grants?, servers?, overrides?: {model?, choice?, approvals?}, agent_id?}`), checked
|
|
387
387
|
* against the package: the parameters as given (a blank one at its default), the MCP tools the owner allows (each one the
|
|
388
388
|
* package lists, by its gate name), and the model asked for in place of the package's: one of its own (`model`), or one
|
|
389
389
|
* of the package's model choices by id (`choice`), never both. 422 naming every field that is wrong. */
|
|
@@ -394,6 +394,7 @@ export declare function applyBodyOf(p: Package, body: Json): {
|
|
|
394
394
|
model?: string;
|
|
395
395
|
choice?: ModelChoice;
|
|
396
396
|
approvals?: Approvals;
|
|
397
|
+
agentId?: string;
|
|
397
398
|
};
|
|
398
399
|
/** The model a package's agent gets here, as `{model?, warning?}`: its `prefer` when this server runs it on `harness`
|
|
399
400
|
* with a key for its provider, else `refused` (preferUnrunnable): apply makes nothing, never the tier's model in its
|
package/dist/templates.js
CHANGED
|
@@ -1027,12 +1027,15 @@ export class TemplateRegistry {
|
|
|
1027
1027
|
return this.imported.delete(id);
|
|
1028
1028
|
}
|
|
1029
1029
|
}
|
|
1030
|
-
/** POST /v2/templates/{name}/apply's body (`{parameters, grants?, overrides?: {model?, choice?, approvals?}}`), checked
|
|
1030
|
+
/** POST /v2/templates/{name}/apply's body (`{parameters, grants?, servers?, overrides?: {model?, choice?, approvals?}, agent_id?}`), checked
|
|
1031
1031
|
* against the package: the parameters as given (a blank one at its default), the MCP tools the owner allows (each one the
|
|
1032
1032
|
* package lists, by its gate name), and the model asked for in place of the package's: one of its own (`model`), or one
|
|
1033
1033
|
* of the package's model choices by id (`choice`), never both. 422 naming every field that is wrong. */
|
|
1034
1034
|
export function applyBodyOf(p, body) {
|
|
1035
|
-
const issues = unknownFields(body, ["parameters", "grants", "servers", "overrides"]);
|
|
1035
|
+
const issues = unknownFields(body, ["parameters", "grants", "servers", "overrides", "agent_id"]);
|
|
1036
|
+
// The agent an update writes onto (the server checks it was made from this package): text, else a 422 with the rest.
|
|
1037
|
+
if (body.agent_id !== undefined && !(typeof body.agent_id === "string" && body.agent_id.trim()))
|
|
1038
|
+
issues.push({ field: "agent_id", reason: "wrong_type", message: `agent_id is the id of an agent the ${p.name} template made: the apply writes a new revision of it in place of making another` });
|
|
1036
1039
|
const listed = p.mcp.flatMap(({ toolkit, tools }) => tools.map((tool) => mcpToolName(toolkit, tool)));
|
|
1037
1040
|
const grants = [];
|
|
1038
1041
|
if (body.grants !== undefined && !Array.isArray(body.grants))
|
|
@@ -1088,7 +1091,7 @@ export function applyBodyOf(p, body) {
|
|
|
1088
1091
|
}
|
|
1089
1092
|
if (issues.length)
|
|
1090
1093
|
throw invalid(issues);
|
|
1091
|
-
return { parameters, grants, servers, ...(isObject(overrides) && typeof overrides.model === "string" ? { model: overrides.model } : {}), ...(choice ? { choice } : {}), ...(isObject(overrides) && (overrides.approvals === "ask" || overrides.approvals === "never") ? { approvals: overrides.approvals } : {}) };
|
|
1094
|
+
return { parameters, grants, servers, ...(typeof body.agent_id === "string" ? { agentId: body.agent_id.trim() } : {}), ...(isObject(overrides) && typeof overrides.model === "string" ? { model: overrides.model } : {}), ...(choice ? { choice } : {}), ...(isObject(overrides) && (overrides.approvals === "ask" || overrides.approvals === "never") ? { approvals: overrides.approvals } : {}) };
|
|
1092
1095
|
}
|
|
1093
1096
|
/** The model a package's agent gets here, as `{model?, warning?}`: its `prefer` when this server runs it on `harness`
|
|
1094
1097
|
* with a key for its provider, else `refused` (preferUnrunnable): apply makes nothing, never the tier's model in its
|
package/dist/timeline/index.d.ts
CHANGED
|
@@ -6,4 +6,4 @@ export { costLabel, endedUsage, PAGE_CHANGED_ROW, RUN_RESUMED, toolCallWords, TU
|
|
|
6
6
|
export { FEEDBACK_SUFFIX, isFeedbackRow, isMessageRow, isUserEntry, MESSAGE_ORIGIN, messageOrigins, NOTE_SUFFIX, originMatcher, originOf, TRIGGER_LABELS, TRIGGER_SOURCES, type MessageOrigin, type TriggerSource } from "./origin.js";
|
|
7
7
|
export { cut, scrubUrl, scrubUrls } from "./util.js";
|
|
8
8
|
export { webCut, webShownOf, webWithin, type WebShown } from "./web-calls.js";
|
|
9
|
-
export { BROWSER_CHARGE, CALL_ENDED_WITH_RUN, CALL_REFUSED, CALL_RESULT_CHARS, CAP_WRAPUP, CAPS, chargedTool, COMPUTER_NOTE, endedOnTurnEndingTool, HOST_PHASE, METRIC_NAMES, REQUEST_CONTINUED, REQUEST_COST, REQUEST_COST_LATE, REQUEST_COST_PENDING, REQUEST_ENDED, REQUEST_REFUSED, REQUEST_STARTED, runMetricsOf, runMetricsWithDecisions, timelineOf, timelineReducer, TOOL_COST, TOOL_STARTED, TOOL_UNMETERED, type AgentEventLike, type DecisionLike, type EntryLike, type RunMetrics, type SideSpend, type TimelineEvent, type TimelineKind, type TimelineOptions, type ToolMetrics, } from "./timeline.js";
|
|
9
|
+
export { answeredRequests, BROWSER_CHARGE, CALL_ENDED_WITH_RUN, CALL_REFUSED, CALL_RESULT_CHARS, CAP_WRAPUP, CAPS, chargedTool, COMPUTER_NOTE, endedOnTurnEndingTool, HOST_PHASE, METRIC_NAMES, REQUEST_CONTINUED, REQUEST_COST, REQUEST_COST_LATE, REQUEST_COST_PENDING, REQUEST_ENDED, REQUEST_REFUSED, REQUEST_STARTED, runMetricsOf, runMetricsWithDecisions, timelineOf, timelineReducer, TOOL_COST, TOOL_STARTED, TOOL_UNMETERED, type AgentEventLike, type DecisionLike, type EntryLike, type RunMetrics, type SideSpend, type TimelineEvent, type TimelineKind, type TimelineOptions, type ToolMetrics, } from "./timeline.js";
|
package/dist/timeline/index.js
CHANGED
|
@@ -6,4 +6,4 @@ export { costLabel, endedUsage, PAGE_CHANGED_ROW, RUN_RESUMED, toolCallWords, TU
|
|
|
6
6
|
export { FEEDBACK_SUFFIX, isFeedbackRow, isMessageRow, isUserEntry, MESSAGE_ORIGIN, messageOrigins, NOTE_SUFFIX, originMatcher, originOf, TRIGGER_LABELS, TRIGGER_SOURCES } from "./origin.js";
|
|
7
7
|
export { cut, scrubUrl, scrubUrls } from "./util.js";
|
|
8
8
|
export { webCut, webShownOf, webWithin } from "./web-calls.js";
|
|
9
|
-
export { BROWSER_CHARGE, CALL_ENDED_WITH_RUN, CALL_REFUSED, CALL_RESULT_CHARS, CAP_WRAPUP, CAPS, chargedTool, COMPUTER_NOTE, endedOnTurnEndingTool, HOST_PHASE, METRIC_NAMES, REQUEST_CONTINUED, REQUEST_COST, REQUEST_COST_LATE, REQUEST_COST_PENDING, REQUEST_ENDED, REQUEST_REFUSED, REQUEST_STARTED, runMetricsOf, runMetricsWithDecisions, timelineOf, timelineReducer, TOOL_COST, TOOL_STARTED, TOOL_UNMETERED, } from "./timeline.js";
|
|
9
|
+
export { answeredRequests, BROWSER_CHARGE, CALL_ENDED_WITH_RUN, CALL_REFUSED, CALL_RESULT_CHARS, CAP_WRAPUP, CAPS, chargedTool, COMPUTER_NOTE, endedOnTurnEndingTool, HOST_PHASE, METRIC_NAMES, REQUEST_CONTINUED, REQUEST_COST, REQUEST_COST_LATE, REQUEST_COST_PENDING, REQUEST_ENDED, REQUEST_REFUSED, REQUEST_STARTED, runMetricsOf, runMetricsWithDecisions, timelineOf, timelineReducer, TOOL_COST, TOOL_STARTED, TOOL_UNMETERED, } from "./timeline.js";
|
|
@@ -5,7 +5,7 @@ import type { ComputerCallRow } from "./computer.js";
|
|
|
5
5
|
export type TimelineKind = "thinking" | "text_block" | "tool_use" | "tool_result" | "phase" | "subagent_started" | "subagent_progress" | "subagent_completed" | "final_answer" | "error" | "user_message" | "waiting" | "usage"
|
|
6
6
|
/** A workflow decision: a judge's answers or a route's branch (serve's decision rows). */
|
|
7
7
|
| "decision"
|
|
8
|
-
/** Where a run's learning ended:
|
|
8
|
+
/** Where a run's learning ended: merged or dropped (serve's learning row). */
|
|
9
9
|
| "learning"
|
|
10
10
|
/** A tool call that waited for a person's approval, after its result's row (serve's tool gate). */
|
|
11
11
|
| "tool_approval_requested";
|
|
@@ -365,3 +365,7 @@ export declare function timelineReducer(options?: TimelineOptions): {
|
|
|
365
365
|
* conversation no longer holds it. */
|
|
366
366
|
isLive: (id: string) => boolean;
|
|
367
367
|
};
|
|
368
|
+
/** The run's model requests that an answer of pi's carries, in log order: each `pi.assistant` entry the usage row counts
|
|
369
|
+
* as a request (createMeter's "answer"). A request the cap or the proxy refused before it left, a continuation of the
|
|
370
|
+
* answer before it and a call the loop's record kept (`recordedCall`) are none. An entry seen twice counts once. */
|
|
371
|
+
export declare function answeredRequests(entries: readonly EntryLike[]): EntryLike[];
|
|
@@ -1467,3 +1467,19 @@ export function timelineReducer(options = {}) {
|
|
|
1467
1467
|
isLive: (id) => liveIds.has(id),
|
|
1468
1468
|
};
|
|
1469
1469
|
}
|
|
1470
|
+
/** The run's model requests that an answer of pi's carries, in log order: each `pi.assistant` entry the usage row counts
|
|
1471
|
+
* as a request (createMeter's "answer"). A request the cap or the proxy refused before it left, a continuation of the
|
|
1472
|
+
* answer before it and a call the loop's record kept (`recordedCall`) are none. An entry seen twice counts once. */
|
|
1473
|
+
export function answeredRequests(entries) {
|
|
1474
|
+
const meter = createMeter();
|
|
1475
|
+
const seen = new Set();
|
|
1476
|
+
return entries.filter((entry) => {
|
|
1477
|
+
if (entry.id !== undefined) {
|
|
1478
|
+
const key = `${entry.conversationId ?? 0}:${entry.id}`;
|
|
1479
|
+
if (seen.has(key))
|
|
1480
|
+
return false;
|
|
1481
|
+
seen.add(key);
|
|
1482
|
+
}
|
|
1483
|
+
return meter.push(entry) === "answer";
|
|
1484
|
+
});
|
|
1485
|
+
}
|
package/dist/tool-gate.d.ts
CHANGED
|
@@ -157,13 +157,6 @@ export declare const noApproverText: (tool: string, ran?: "no" | "unknown", beca
|
|
|
157
157
|
export declare const APPROVAL_ROW: "tool_approval_requested";
|
|
158
158
|
/** A call's arguments shown on its approval, at most this many bytes. */
|
|
159
159
|
export declare const ARGS_PREVIEW_BYTES = 2048;
|
|
160
|
-
/** The refusal of the end-of-run turn's write or edit under work/.learning/: its notes are kept only from its answer's
|
|
161
|
-
* note blocks (learn/reflect.ts parseReflection), which the host merges in its own store; a file there is never kept. */
|
|
162
|
-
export declare const NOTE_ONLY_TEXT = "A note is kept only from your answer: write it in a ```note block, not to a file.";
|
|
163
|
-
/** Whether `args.path`, as a file tool resolves it (a leading `@` dropped, Unicode spaces made plain, then the port's
|
|
164
|
-
* path of it, portPath), names .learning/ in the run's folder or a path under it: by the folder's path here (`work`)
|
|
165
|
-
* or a computer's name for it (COMPUTER_ROOT). */
|
|
166
|
-
export declare function underLearning(work: string, args: unknown): boolean;
|
|
167
160
|
/** One call that waits for approval, as the run's store keeps it. */
|
|
168
161
|
export type ApprovalRequest = {
|
|
169
162
|
id: string;
|