@parcha/agentrun-serve 0.1.0-beta.43 → 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 +231 -0
- package/README.md +580 -320
- 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 +92 -22
- package/dist/composio-preset.d.ts +4 -3
- package/dist/composio-preset.js +81 -11
- package/dist/composio-triggers.d.ts +34 -2
- package/dist/composio-triggers.js +261 -31
- 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/computer-lost.d.ts +11 -0
- package/dist/computer-lost.js +19 -0
- package/dist/computer-record.d.ts +10 -2
- package/dist/computer-record.js +50 -18
- package/dist/computer-setting.d.ts +1 -0
- package/dist/computer-setting.js +2 -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 +4 -1
- package/dist/errors.js +10 -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 +59 -3
- package/dist/harness-table.js +119 -14
- package/dist/harness.d.ts +17 -1
- package/dist/harness.js +22 -11
- package/dist/host.d.ts +12 -10
- package/dist/host.js +19 -16
- package/dist/import-worker.d.ts +3 -0
- package/dist/import-worker.js +7 -5
- package/dist/import.d.ts +22 -1
- package/dist/import.js +141 -28
- 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 +26 -89
- package/dist/learn/check.js +58 -336
- 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 +88 -103
- package/dist/learn/corrections.d.ts +13 -0
- package/dist/learn/corrections.js +23 -0
- package/dist/learn/delete.d.ts +17 -0
- package/dist/learn/delete.js +42 -0
- 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 +20 -2
- package/dist/learn/promote.js +17 -4
- package/dist/learn/{skills.d.ts → workflow-draft.d.ts} +34 -38
- package/dist/learn/{skills.js → workflow-draft.js} +65 -59
- package/dist/learn/workflow-nodes.d.ts +22 -1
- package/dist/learn/workflow-nodes.js +29 -10
- package/dist/learned-workflow.js +2 -2
- package/dist/learning-cost.d.ts +127 -13
- package/dist/learning-cost.js +142 -10
- package/dist/learning-routes.d.ts +99 -170
- package/dist/learning-routes.js +199 -420
- 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 +62 -393
- package/dist/learning.js +101 -651
- package/dist/listen-first.d.ts +30 -0
- package/dist/listen-first.js +115 -0
- package/dist/live-reach.d.ts +25 -2
- package/dist/live-reach.js +46 -4
- package/dist/llms.txt +2 -1
- package/dist/local-models.d.ts +3 -11
- package/dist/local-models.js +5 -6
- package/dist/mcp-servers-store.d.ts +16 -16
- package/dist/model-form.js +6 -5
- package/dist/model.d.ts +12 -4
- package/dist/model.js +41 -16
- 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 +375 -347
- package/dist/owner.d.ts +8 -0
- package/dist/owner.js +11 -0
- package/dist/paid-calls.d.ts +14 -0
- package/dist/paid-calls.js +31 -1
- package/dist/particle-provider.d.ts +11 -0
- package/dist/particle-provider.js +135 -0
- package/dist/place.d.ts +8 -3
- package/dist/place.js +13 -9
- 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 +30 -2
- 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 +16 -90
- package/dist/run-listing.d.ts +34 -0
- package/dist/run-listing.js +128 -0
- package/dist/run-model-key.d.ts +64 -0
- package/dist/run-model-key.js +147 -0
- 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 +14 -6
- package/dist/runner/adapter-loop.js +25 -14
- package/dist/runner/adapter-run-spec.d.ts +22 -7
- package/dist/runner/adapter-run-spec.js +130 -77
- package/dist/runner/adapters/index.d.ts +4 -2
- package/dist/runner/adapters/index.js +35 -4
- package/dist/runner/adapters/pi.d.ts +4 -12
- package/dist/runner/adapters/pi.js +2 -2
- package/dist/runner/audit.d.ts +5 -1
- package/dist/runner/audit.js +31 -12
- package/dist/runner/beside.d.ts +7 -2
- package/dist/runner/beside.js +41 -9
- package/dist/runner/claim-secrets.d.ts +66 -1
- package/dist/runner/claim-secrets.js +136 -3
- package/dist/runner/cli-run-spec.d.ts +2 -1
- package/dist/runner/cli-run-spec.js +82 -59
- package/dist/runner/commands.d.ts +3 -6
- 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 +5 -4
- package/dist/runner/feedback-round.js +14 -10
- package/dist/runner/github-app.js +3 -1
- package/dist/runner/harness-loops.d.ts +0 -8
- package/dist/runner/harness-loops.js +30 -56
- package/dist/runner/held.d.ts +170 -0
- package/dist/runner/held.js +57 -0
- package/dist/runner/journal-kinds.d.ts +7 -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 -66
- package/dist/runner/learning-end.js +250 -299
- package/dist/runner/learning-seed.d.ts +15 -33
- package/dist/runner/learning-seed.js +24 -45
- package/dist/runner/loop-contract.d.ts +8 -3
- package/dist/runner/loop-contract.js +4 -0
- package/dist/runner/loop.js +6 -2
- package/dist/runner/main.d.ts +18 -9
- package/dist/runner/main.js +82 -22
- package/dist/runner/mcp-run.d.ts +11 -0
- package/dist/runner/mcp-run.js +67 -0
- package/dist/runner/memory-claim.d.ts +14 -6
- package/dist/runner/memory-claim.js +18 -9
- 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 +13 -6
- package/dist/runner/promotion.js +63 -17
- package/dist/runner/reflect-hook.d.ts +64 -91
- package/dist/runner/reflect-hook.js +112 -206
- 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 +58 -9
- 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 +14 -6
- package/dist/runner/workflow-first.d.ts +5 -0
- package/dist/runner/workflow-first.js +4 -0
- package/dist/runner/workflow-spec.js +17 -4
- package/dist/runs-over-store.d.ts +21 -32
- package/dist/runs-over-store.js +44 -41
- package/dist/sdk/runs.d.ts +6 -11
- package/dist/sdk/runs.js +20 -41
- package/dist/sdk/schema.js +3 -4
- package/dist/sdk/workflows.d.ts +1 -1
- 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 +119 -83
- package/dist/server.js +1121 -419
- 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 +3 -3
- package/dist/store/index.js +2 -2
- 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/seal.d.ts +20 -2
- package/dist/store/seal.js +24 -8
- package/dist/store/sqlite/connection.d.ts +2 -0
- package/dist/store/sqlite/connection.js +3 -1
- package/dist/store/sqlite/run-launch.d.ts +4 -1
- package/dist/store/sqlite/run-launch.js +12 -0
- package/dist/store/sqlite/run-patch.d.ts +0 -17
- package/dist/store/sqlite/run-patch.js +4 -33
- package/dist/store/sqlite/store.d.ts +3 -2
- package/dist/store/sqlite/store.js +360 -75
- package/dist/store/sqlite/worker.js +25 -0
- package/dist/store/store.d.ts +231 -39
- package/dist/store/store.js +25 -3
- package/dist/store-reads/analytics.js +11 -1
- package/dist/store-reads/learning.d.ts +131 -194
- package/dist/store-reads/learning.js +292 -301
- package/dist/store-reads/loop.d.ts +0 -1
- package/dist/store-reads/loop.js +1 -1
- package/dist/store-reads/stats.js +13 -3
- package/dist/store-view.d.ts +34 -2
- package/dist/store-view.js +108 -41
- package/dist/telemetry.d.ts +59 -0
- package/dist/telemetry.js +153 -0
- 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/tool-plane.d.ts +12 -12
- package/dist/tools.d.ts +13 -13
- package/dist/tools.js +29 -9
- package/dist/trigger-adapter.d.ts +3 -0
- package/dist/trigger-adapters.d.ts +4 -0
- package/dist/trigger-adapters.js +13 -0
- package/dist/trigger-composio.d.ts +58 -1
- package/dist/trigger-composio.js +160 -6
- package/dist/triggers.d.ts +64 -5
- package/dist/triggers.js +141 -17
- package/dist/validate.d.ts +11 -7
- package/dist/validate.js +9 -8
- 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 +22 -8
- package/dist/workspace/computer-for-claim.js +339 -46
- 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 +41 -21
- 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 -9
- 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-BrcDSBD8.css +0 -1
- package/dist/console/assets/index-Bz6IWncl.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 -33
- package/dist/learning-evals.js +0 -98
- 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,6 +1,8 @@
|
|
|
1
1
|
import type { IncomingMessage, ServerResponse } from "node:http";
|
|
2
|
-
import type
|
|
3
|
-
import { type
|
|
2
|
+
import { type DraftDecisions } from "./learn/workflow-draft.js";
|
|
3
|
+
import { type SnapHistory } from "./learn/folder.js";
|
|
4
|
+
import type { ServingState } from "./learn/promote.js";
|
|
5
|
+
import { type ItemStatus, type Learning, type Shown } from "./learning.js";
|
|
4
6
|
import type { Impact } from "./learning-run.js";
|
|
5
7
|
import { type LearnedUse } from "./store-reads/learning.js";
|
|
6
8
|
import type { Store } from "./store/store.js";
|
|
@@ -9,41 +11,16 @@ type Page<T> = {
|
|
|
9
11
|
total: number;
|
|
10
12
|
next_cursor: string | null;
|
|
11
13
|
};
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
type: string;
|
|
17
|
-
status: string;
|
|
18
|
-
origin: string;
|
|
19
|
-
superseded_by: string | null;
|
|
20
|
-
text: string;
|
|
21
|
-
etag: string;
|
|
22
|
-
retired?: Retired;
|
|
23
|
-
last_change?: LastChange;
|
|
24
|
-
runs: {
|
|
25
|
-
given: number;
|
|
26
|
-
read: number;
|
|
27
|
-
};
|
|
28
|
-
};
|
|
29
|
-
/** When a retired note, skill or draft was retired, and by whom: a person (its retire's commit), else a run. */
|
|
30
|
-
/** Who retired a retired item, and when, and `from`, the status its restore gives back; or, for a skill or draft that
|
|
31
|
-
* reads retired only because its file can't be read (its front matter reads no way: unclearFront, read from its file as
|
|
32
|
-
* the view is made), that no one did: the host could not read it (`why`), with no `from`, since its restore waits for
|
|
33
|
-
* the file to be fixed. One closed shape. */
|
|
14
|
+
/** Who retired a retired draft, and when, and `from`, the status its restore gives back; or, for one that reads retired
|
|
15
|
+
* only because its README.md can't be read (its front matter reads no way: unclearFront, read from its file as the view
|
|
16
|
+
* is made), that no one did: the host could not read it (`why`), with no `from`, since its restore waits for the file to
|
|
17
|
+
* be fixed. One closed shape. */
|
|
34
18
|
type Retired = {
|
|
35
19
|
at: string;
|
|
36
20
|
by: "person" | "run" | "host";
|
|
37
21
|
from?: "active" | "pending";
|
|
38
22
|
why?: "unreadable";
|
|
39
23
|
};
|
|
40
|
-
/** The newest change to a note, skill or draft (its file: the note, a SKILL.md, a draft's README.md): what it was, by
|
|
41
|
-
* whom and when. A person's is named by its commit (`learning: <kind> by a person: <file>`); a run's merge is `learned`. */
|
|
42
|
-
type LastChange = {
|
|
43
|
-
kind: "approved" | "edited" | "created" | "retired" | "restored" | "learned" | "superseded";
|
|
44
|
-
by: "person" | "run";
|
|
45
|
-
at: string;
|
|
46
|
-
};
|
|
47
24
|
type Change = {
|
|
48
25
|
by: {
|
|
49
26
|
run: string;
|
|
@@ -63,55 +40,71 @@ export type Counts = {
|
|
|
63
40
|
};
|
|
64
41
|
export { secretsShown, type Shown } from "./learning.js";
|
|
65
42
|
export declare const etagOf: (oid: string) => string;
|
|
66
|
-
/** A
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
|
|
43
|
+
/** A workflow draft as the view lists it: its folder's name, its workflow.json with its `readme`, its description, its
|
|
44
|
+
* status, the run whose merge last changed it, its size in bytes, and the ETag of its README.md (the file that says
|
|
45
|
+
* whether it waits, which an approval names); cut of the host's secrets (a name or a file holding one reads [redacted]).
|
|
46
|
+
* `status` is one word: its README.md's `pending` or `retired`, else where it stands as the promotions read says it
|
|
47
|
+
* (`stateOf`, learn/promote.ts servingStateOf): `serving`, `checking`, `held` or `stopped`. */
|
|
48
|
+
type WorkflowView = {
|
|
71
49
|
name: string;
|
|
72
50
|
file: string;
|
|
73
|
-
readme
|
|
51
|
+
readme: string;
|
|
74
52
|
description: string;
|
|
75
|
-
status: "
|
|
53
|
+
status: "pending" | "retired" | ServingState;
|
|
76
54
|
run: string | null;
|
|
77
55
|
bytes: number;
|
|
78
56
|
etag: string;
|
|
79
57
|
retired?: Retired;
|
|
80
|
-
last_change?:
|
|
58
|
+
last_change?: SnapHistory["last"];
|
|
81
59
|
};
|
|
82
60
|
/** For tests: how many times a folder's statuses were read (once per commit of its main). */
|
|
83
61
|
export declare const pendingTestHooks: {
|
|
84
62
|
reads: number;
|
|
85
63
|
};
|
|
86
|
-
/** Each
|
|
87
|
-
*
|
|
88
|
-
*
|
|
89
|
-
* holds none; one whose snapshot cannot be read is undefined. */
|
|
64
|
+
/** Each workflow draft's status on agent `agentId`'s folder's main, by its workflow.json (as its README.md says it):
|
|
65
|
+
* `active`, `pending` or `retired`. Built once per main (a list asks for many runs). A folder never made, or with no
|
|
66
|
+
* main, holds none; one whose snapshot cannot be read is undefined. */
|
|
90
67
|
export declare function statusesOf(data: string, agentId: string): Promise<ReadonlyMap<string, ItemStatus> | undefined>;
|
|
91
|
-
/** How many of agent `agentId`'s
|
|
92
|
-
*
|
|
93
|
-
* undefined (the caller shows no count). */
|
|
68
|
+
/** How many of agent `agentId`'s workflow drafts wait for its owner's OK on its folder's main (statusesOf). A folder
|
|
69
|
+
* never made has none waiting; one that cannot be read is undefined (the caller shows no count). */
|
|
94
70
|
export declare function pendingCount(data: string, agentId: string): Promise<number | undefined>;
|
|
95
|
-
/** GET /agents/{id}/learning: main, its
|
|
96
|
-
* fared and what learning changed for them (`counts`, `impact
|
|
97
|
-
*
|
|
71
|
+
/** GET /agents/{id}/learning: main, its corrections.md, its workflow drafts and the first page of its log, and how the
|
|
72
|
+
* agent's runs fared and what learning changed for them (`counts`, `impact`); an agent with no folder (its learning
|
|
73
|
+
* never on) has an empty one. `stateOf`: where each workflow neither pending nor retired stands, by its folder name (the
|
|
74
|
+
* promotions read's own word: learn/promote.ts servingStateOf over the agent's records). */
|
|
98
75
|
type AgentView = {
|
|
99
76
|
agent: string;
|
|
100
77
|
main: string | null;
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
skills: LearnedView[];
|
|
104
|
-
workflows: LearnedView[];
|
|
78
|
+
corrections: string;
|
|
79
|
+
workflows: WorkflowView[];
|
|
105
80
|
log: Page<Change>;
|
|
106
81
|
counts: Counts;
|
|
107
82
|
impact: Impact;
|
|
108
83
|
};
|
|
109
|
-
export declare function agentLearning(data: string, agentId: string, shown: Shown, counts: Counts, impact: Impact,
|
|
110
|
-
/** GET /agents/{id}/learning/notes?cursor=&limit=&status=: a page of the notes, ordered as the view's. A page at an
|
|
111
|
-
* older main whose notes this server cannot read as they were any more is the first page of main now. */
|
|
112
|
-
export declare function learningNotes(data: string, agentId: string, query: URLSearchParams, shown: Shown, runs?: NoteRuns): Promise<Page<NoteView>>;
|
|
84
|
+
export declare function agentLearning(data: string, agentId: string, shown: Shown, counts: Counts, impact: Impact, stateOf: (workflow: string) => ServingState): Promise<AgentView>;
|
|
113
85
|
/** GET /agents/{id}/learning/log?cursor=&limit=: a page of the changes on main, newest first. */
|
|
114
86
|
export declare function learningLog(data: string, agentId: string, query: URLSearchParams, shown: Shown): Promise<Page<Change>>;
|
|
87
|
+
/** GET /agents/{id}/learning/corrections: corrections.md on main as text (empty when main holds none), its ETag (its blob
|
|
88
|
+
* id; an empty file's when there is none) and the cap a PUT keeps to, cut of the host's secrets as every read is. */
|
|
89
|
+
export declare function correctionsView(data: string, agentId: string, shown: Shown): Promise<{
|
|
90
|
+
text: string;
|
|
91
|
+
etag: string;
|
|
92
|
+
cap_bytes: number;
|
|
93
|
+
}>;
|
|
94
|
+
/** PUT /agents/{id}/learning/corrections: corrections.md replaced whole by a person (`text`), only over the version they
|
|
95
|
+
* read (`ifMatch`: its ETag; none, or `*`, is 428; another version is 412). Refused whole, nothing written, when it holds
|
|
96
|
+
* what must never be stored (a host secret, text shaped like one, a hidden character) or passes the cap (422 with the
|
|
97
|
+
* problems, printable). A text read cut of a secret and sent back replaces the secret with the cut: a person's write never
|
|
98
|
+
* puts a secret back. In the agent's queue, one commit on main. */
|
|
99
|
+
export declare function correctionsWrite(data: string, agentId: string, input: {
|
|
100
|
+
text: string;
|
|
101
|
+
ifMatch?: string;
|
|
102
|
+
refuse: readonly string[];
|
|
103
|
+
}): Promise<{
|
|
104
|
+
text: string;
|
|
105
|
+
etag: string;
|
|
106
|
+
cap_bytes: number;
|
|
107
|
+
}>;
|
|
115
108
|
/** One revision of a learned workflow: a commit on main that changed its workflow.json, with that commit's text (null
|
|
116
109
|
* when the commit holds no such file: it was deleted there), cut of the host's secrets. */
|
|
117
110
|
type WorkflowRevision = {
|
|
@@ -133,80 +126,61 @@ export declare function workflowRevisions(data: string, agentId: string, name: s
|
|
|
133
126
|
total: number;
|
|
134
127
|
truncated: boolean;
|
|
135
128
|
}>;
|
|
136
|
-
/**
|
|
129
|
+
/** Learned workflow `name`'s text at `digest` (a champion's, as its promotion records name it), read by that digest and
|
|
130
|
+
* never by paging the workflow's history: at `commits` (the records' learning commits, newest first), then at main, the
|
|
131
|
+
* first commit whose workflow.json is that digest's text, with the commit it was read at. Undefined when none is (no
|
|
132
|
+
* main yet, or no commit read holds it). One read-only exec per commit tried (textsAt). */
|
|
133
|
+
export declare function workflowAtDigest(data: string, agentId: string, name: string, digest: string, commits: readonly string[]): Promise<{
|
|
134
|
+
text: string;
|
|
135
|
+
commit: string;
|
|
136
|
+
} | undefined>;
|
|
137
|
+
/** GET /agents/{id}/learning/files/{file}: a draft's file on main as text, its ETag, and its type (workflow.json is
|
|
137
138
|
* JSON). */
|
|
138
|
-
export declare function
|
|
139
|
+
export declare function readLearnedFile(data: string, agentId: string, raw: string, shown: Shown): Promise<{
|
|
139
140
|
text: string;
|
|
140
141
|
etag: string;
|
|
141
142
|
type?: string;
|
|
142
143
|
}>;
|
|
143
|
-
/** A
|
|
144
|
-
*
|
|
145
|
-
export declare function
|
|
144
|
+
/** A learning file as a text answer: its ETag, an explicit type (markdown unless it names one), nosniff, and a sandbox on
|
|
145
|
+
* whatever opens it. */
|
|
146
|
+
export declare function sendText(res: ServerResponse, status: number, file: {
|
|
146
147
|
text: string;
|
|
147
148
|
etag: string;
|
|
148
149
|
type?: string;
|
|
149
150
|
}, headers?: Record<string, string>): void;
|
|
150
|
-
/** A PUT's body, read to its end (over `max` bytes is 413): the
|
|
151
|
-
* as `application/json` `{text}`, the one form the console's page may send under its session (page.ts: a write from
|
|
152
|
-
*
|
|
153
|
-
*
|
|
154
|
-
export declare function
|
|
155
|
-
/**
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
151
|
+
/** A PUT's body, read to its end (over `max` bytes is 413): the file's whole text, as `text/markdown` or `text/plain`, or
|
|
152
|
+
* as `application/json` `{text}`, the one form the console's page may send under its session (page.ts: a write from the
|
|
153
|
+
* page is JSON from its own origin). A JSON body that is not an object is 400; one whose `text` is missing or not text,
|
|
154
|
+
* or with another field, is 422 by field, as every JSON body here. A body that is not UTF-8 is 422. */
|
|
155
|
+
export declare function textBody(req: IncomingMessage, max: number): Promise<string>;
|
|
156
|
+
/** The tools and gate a draft's workflow.json is checked against (learning-end.ts checkDraftOf's own). */
|
|
157
|
+
type DraftTools = () => Promise<{
|
|
158
|
+
tools: string[];
|
|
159
|
+
gated: Record<string, string>;
|
|
160
|
+
deniedBy?: Record<string, "agent" | "server" | "default">;
|
|
161
|
+
decisions?: DraftDecisions;
|
|
162
|
+
}>;
|
|
163
|
+
/** POST /agents/{id}/learning/files/{file}/approve, .../retire or .../restore, as a person, on a draft's README.md
|
|
164
|
+
* (`file`): If-Match on the version read (none, or `*`, is 428; another is 412), then one commit on main by the learning
|
|
165
|
+
* script (learn/folder.ts writeLearning), in the agent's queue, its message `learning: <approved|retired|restored> by a
|
|
166
|
+
* person: <file>` with a `Changed-By: user` trailer (and `Approved-Via: console` on an approval). An approval releases a
|
|
167
|
+
* held draft (status: pending) to every later run; a retire takes it out of every later run unchecked, so a leaking one
|
|
168
|
+
* can always be revoked; a restore brings it back to the status its retire recorded, checked again as a new draft is
|
|
169
|
+
* (secrets' shapes, the host's values, hidden characters, its README's format, its workflow.json against the agent's
|
|
170
|
+
* tools and gate). A retire of a retired draft commits nothing. `refuse`: the host's secrets. */
|
|
171
|
+
export declare function changeWorkflow(data: string, agentId: string, raw: string, input: {
|
|
172
|
+
action: "approve" | "retire" | "restore";
|
|
164
173
|
ifMatch?: string;
|
|
165
|
-
ifNoneMatch?: string;
|
|
166
|
-
body?: Buffer;
|
|
167
174
|
refuse: readonly string[];
|
|
168
|
-
|
|
169
|
-
restore?: boolean;
|
|
170
|
-
draftTools?: () => Promise<{
|
|
171
|
-
tools: string[];
|
|
172
|
-
gated: Record<string, string>;
|
|
173
|
-
deniedBy?: Record<string, "agent" | "server" | "default">;
|
|
174
|
-
decisions?: DraftDecisions;
|
|
175
|
-
}>;
|
|
175
|
+
draftTools?: DraftTools;
|
|
176
176
|
}): Promise<{
|
|
177
|
-
status: 200
|
|
177
|
+
status: 200;
|
|
178
178
|
file: string;
|
|
179
179
|
text: string;
|
|
180
180
|
etag: string;
|
|
181
181
|
}>;
|
|
182
|
-
/** A learned workflow as a promotion makes it into an agent of its own: its folder's name, its README's description,
|
|
183
|
-
* its workflow.json parsed, and the tools its call nodes call. */
|
|
184
|
-
export type Promotable = {
|
|
185
|
-
name: string;
|
|
186
|
-
description: string;
|
|
187
|
-
workflow: Record<string, unknown>;
|
|
188
|
-
calls: string[];
|
|
189
|
-
};
|
|
190
|
-
/** POST /agents/{id}/learning/workflows/{name}/promote's read of the learned workflow `raw` (percent-encoded) on agent
|
|
191
|
-
* `agentId`'s main: an active one alone, as every later run is given it. One that waits for its owner's OK, or that a
|
|
192
|
-
* person retired, is 409 learned_not_active: a promotion never runs what the owner has not let every run use. Each of
|
|
193
|
-
* its files is checked again as a restore checks it (unstorable: a secret's shape, the host's values as they are now,
|
|
194
|
-
* a hidden character), and its workflow.json as the learning checker checks a run's draft against the agent's tools and
|
|
195
|
-
* its gate (draftProblems: the DSL's validation with no code run, no code node, no shell or executor call, no call node
|
|
196
|
-
* on a tool the agent does not have or the gate holds to ask or deny). Any of those is 400 with `problems`, printable.
|
|
197
|
-
* Reads only: the folder is never written. */
|
|
198
|
-
export declare function promotable(data: string, agentId: string, raw: string, input: {
|
|
199
|
-
refuse: readonly string[];
|
|
200
|
-
draftTools: () => Promise<{
|
|
201
|
-
tools: string[];
|
|
202
|
-
gated: Record<string, string>;
|
|
203
|
-
deniedBy?: Record<string, "agent" | "server" | "default">;
|
|
204
|
-
decisions?: DraftDecisions;
|
|
205
|
-
}>;
|
|
206
|
-
}): Promise<Promotable>;
|
|
207
182
|
/** GET /runs/{id}/learning's body, from the run's learning as it reads now, the seed it started from and whether it
|
|
208
|
-
* settled: the one shape, read from the one store (store-reads/learning.ts
|
|
209
|
-
* runLearningOverStore). */
|
|
183
|
+
* settled: the one shape, read from the one store (store-reads/learning.ts runLearningOverStore). */
|
|
210
184
|
export declare function runLearningBody(input: {
|
|
211
185
|
readonly id: string;
|
|
212
186
|
readonly learning: Learning;
|
|
@@ -214,24 +188,15 @@ export declare function runLearningBody(input: {
|
|
|
214
188
|
readonly settled: boolean;
|
|
215
189
|
readonly used?: LearnedUse;
|
|
216
190
|
}, shown: Shown, secrets: readonly string[]): {
|
|
191
|
+
run: string;
|
|
192
|
+
state: "dropped" | "merged" | "seeded" | "reflecting";
|
|
193
|
+
reason: "cancelled" | "use" | "empty" | "crashed" | "reflect_failed" | "no_budget" | "checker" | "unknown_cost" | "seed_failed" | null;
|
|
194
|
+
detail: string | null;
|
|
195
|
+
at: string;
|
|
196
|
+
workflows: import("./learning.js").LearnedFile[];
|
|
197
|
+
corrections: number;
|
|
217
198
|
seed: string | null;
|
|
218
199
|
merged: string | null;
|
|
219
|
-
pending: {
|
|
220
|
-
file: string;
|
|
221
|
-
name: string;
|
|
222
|
-
}[];
|
|
223
|
-
verdict: {
|
|
224
|
-
merge: boolean;
|
|
225
|
-
reason: string;
|
|
226
|
-
items: {
|
|
227
|
-
why: string;
|
|
228
|
-
question?: string | undefined;
|
|
229
|
-
origin?: "run" | "you" | undefined;
|
|
230
|
-
pending?: boolean | undefined;
|
|
231
|
-
file: string;
|
|
232
|
-
keep: boolean;
|
|
233
|
-
}[];
|
|
234
|
-
} | null;
|
|
235
200
|
problems: {
|
|
236
201
|
detail: string;
|
|
237
202
|
path?: string | undefined;
|
|
@@ -239,7 +204,6 @@ export declare function runLearningBody(input: {
|
|
|
239
204
|
}[];
|
|
240
205
|
compiled: {
|
|
241
206
|
workflow: string;
|
|
242
|
-
from_notes: string[];
|
|
243
207
|
attempts: {
|
|
244
208
|
ok: boolean;
|
|
245
209
|
errors: string[];
|
|
@@ -248,41 +212,20 @@ export declare function runLearningBody(input: {
|
|
|
248
212
|
promoted: boolean | null;
|
|
249
213
|
} | null;
|
|
250
214
|
draft_errors: string[];
|
|
251
|
-
cost_usd: {
|
|
252
|
-
grade: number | null;
|
|
253
|
-
};
|
|
254
|
-
tokens: {
|
|
255
|
-
grade: import("./learning.js").Tokens | null;
|
|
256
|
-
};
|
|
257
215
|
used: {
|
|
258
|
-
skills: {
|
|
259
|
-
name: string;
|
|
260
|
-
read: boolean;
|
|
261
|
-
}[];
|
|
262
216
|
workflows: {
|
|
263
217
|
name: string;
|
|
264
218
|
calls: number;
|
|
265
219
|
failed: number;
|
|
266
220
|
}[];
|
|
267
221
|
};
|
|
268
|
-
given?: import("./learning.js").NoteUsed[];
|
|
269
|
-
read?: import("./learning.js").NoteUsed[];
|
|
270
|
-
learned?: import("./learning.js").NoteLearned[];
|
|
271
|
-
skills?: import("./learning.js").LearnedFile[];
|
|
272
|
-
workflows?: import("./learning.js").LearnedFile[];
|
|
273
|
-
run: string;
|
|
274
|
-
state: "dropped" | "proposed" | "merged" | "seeded" | "reflecting";
|
|
275
|
-
reason: "cancelled" | "use" | "empty" | "unparsed" | "seed_failed" | "no_budget" | "unknown_cost" | "crashed" | "reflect_timeout" | "reflect_failed" | "propose_failed" | "checker" | "grader" | "grade_failed" | null;
|
|
276
|
-
detail: string | null;
|
|
277
|
-
at: string;
|
|
278
222
|
};
|
|
279
223
|
/** GET /runs/{id}/learning/diff over the one store: once merged (its learning end, store-reads/learning.ts
|
|
280
224
|
* runLearningEnd), its merge commit against its parent, as its merge's script wrote it (`.agentrun/diffs/<run>.json` in
|
|
281
|
-
* its agent's learning folder);
|
|
282
|
-
*
|
|
283
|
-
*
|
|
284
|
-
*
|
|
285
|
-
* (`shown.text`: a loopback address reads "a local address"). */
|
|
225
|
+
* its agent's learning folder); a run that merged nothing, no file, against the seed its launch's learning start names. A
|
|
226
|
+
* run that does not learn (no learning start and no learning end) is not_found. A file's patch is withheld when too large
|
|
227
|
+
* (as the script wrote it), or when it holds one of the host's secrets now (`shown`); any other is served as every
|
|
228
|
+
* learning text is (`shown.text`: a loopback address reads "a local address"). */
|
|
286
229
|
export declare function runDiffOverStore(data: string, store: Store, runId: string, shown: Shown): Promise<{
|
|
287
230
|
base: string;
|
|
288
231
|
head: string;
|
|
@@ -297,20 +240,6 @@ export declare function runDiffOverStore(data: string, store: Store, runId: stri
|
|
|
297
240
|
patch: string;
|
|
298
241
|
withheld?: undefined;
|
|
299
242
|
})[];
|
|
300
|
-
} | {
|
|
301
|
-
base: string;
|
|
302
|
-
head: null;
|
|
303
|
-
files: ({
|
|
304
|
-
path: string;
|
|
305
|
-
status: string;
|
|
306
|
-
withheld: string;
|
|
307
|
-
patch?: undefined;
|
|
308
|
-
} | {
|
|
309
|
-
path: string;
|
|
310
|
-
status: string;
|
|
311
|
-
patch: string;
|
|
312
|
-
withheld?: undefined;
|
|
313
|
-
})[];
|
|
314
243
|
} | {
|
|
315
244
|
base: string | null;
|
|
316
245
|
head: null;
|