@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
package/dist/learning-words.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
// What a person reads of a run's learning: every `detail` of Run.learning, which the run's learning row in its timeline
|
|
2
|
-
// shows as its summary too, in one place and in a user's words, a
|
|
3
|
-
// machine's: no "main", "merged into"
|
|
4
|
-
//
|
|
2
|
+
// shows as its summary too, in one place and in a user's words, a workflow that waits for the owner's OK included. Never
|
|
3
|
+
// the machine's: no "main", "merged into" or "end-of-run turn". The reason codes (learning.ts LEARNING_REASONS) stay as
|
|
4
|
+
// they are for machines; only these sentences are for people.
|
|
5
5
|
//
|
|
6
|
-
// Text a model wrote (a
|
|
7
|
-
//
|
|
8
|
-
//
|
|
9
|
-
//
|
|
10
|
-
import { CAPS,
|
|
11
|
-
/** `n` of `one`, said as a person says it: "1
|
|
6
|
+
// Text a model wrote (a workflow's name) is never shortened where it is said: a value that becomes a secret later is
|
|
7
|
+
// found only whole, so a part of it kept would show for good. A run's learning keeps the parts its words are made of
|
|
8
|
+
// (`workflows`, `corrections`, `problems`), and each read says them again (wordsOf): every part cut of the host's secrets
|
|
9
|
+
// as they are then, and only then the words cut short (DETAIL_MAX for a run, LIST_DETAIL for a list's row).
|
|
10
|
+
import { CAPS, CORRECTIONS_FILE } from "./learn/index.js";
|
|
11
|
+
/** `n` of `one`, said as a person says it: "1 correction", "2 corrections". */
|
|
12
12
|
const count = (n, one) => `${n} ${one}${n === 1 ? "" : "s"}`;
|
|
13
13
|
/** `parts` as a person lists them: "a", "a and b", "a, b and c". */
|
|
14
14
|
const listed = (parts) => (parts.length < 2 ? parts.join("") : `${parts.slice(0, -1).join(", ")} and ${parts.at(-1)}`);
|
|
@@ -25,198 +25,100 @@ export function short(text, max) {
|
|
|
25
25
|
* cut of the host's secrets), and the most a run list's row says. */
|
|
26
26
|
export const DETAIL_MAX = 300;
|
|
27
27
|
export const LIST_DETAIL = 140;
|
|
28
|
-
const SENTENCES = new Intl.Segmenter("en", { granularity: "sentence" });
|
|
29
|
-
/** The first sentence of `text`, by Unicode's sentence rules (so "e.g." or a URL's dot does not end it), read as one
|
|
30
|
-
* line (a model's line break is no sentence's end), whole; empty for an empty text. */
|
|
31
|
-
export function firstSentence(text) {
|
|
32
|
-
return (SENTENCES.segment(text.replace(/\s+/g, " ").trim())[Symbol.iterator]().next().value?.segment ?? "").trim();
|
|
33
|
-
}
|
|
34
28
|
/** A checker's rule, in words. Every rule learn/check.ts' checker has; one it adds later reads as its code. */
|
|
35
29
|
const RULE_WORDS = {
|
|
36
30
|
secret_value: "one of this server's secrets",
|
|
37
31
|
secret_shape: "text that looks like a key or a password",
|
|
38
32
|
invisible_unicode: "a character a reader can't see",
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
file_mode: "a link or a folder where a note goes",
|
|
33
|
+
outside: "a file that is not a workflow's",
|
|
34
|
+
file_name: "a workflow name that can't be used",
|
|
35
|
+
file_mode: "a link or a folder where a workflow goes",
|
|
43
36
|
encoding: "text that is not UTF-8",
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
exists: "a note under a name already taken",
|
|
47
|
-
duplicate: "a note that says what another one says",
|
|
48
|
-
too_large: `a note over ${CAPS.note / 1024} KB`,
|
|
49
|
-
too_many_notes: `more than ${CAPS.newNotes} new notes`,
|
|
50
|
-
note: "a note whose header is not in shape",
|
|
51
|
-
status: "a note status that only the server sets",
|
|
52
|
-
supersedes: "a replaced note that isn't there to replace",
|
|
53
|
-
index_full: "too many notes (retire one first)",
|
|
54
|
-
skill: "a skill whose header is not in shape",
|
|
55
|
-
skill_outcome: "a skill from a run that didn't finish its job",
|
|
56
|
-
too_many_skills: `more than ${CAPS.skills} skill at once`,
|
|
37
|
+
deleted: "a deleted workflow",
|
|
38
|
+
too_large: `a workflow over ${CAPS.file / 1024} KB`,
|
|
57
39
|
workflow: "a workflow that can't run here",
|
|
58
|
-
too_many_workflows: `more than ${CAPS.workflows} workflow at once`,
|
|
59
40
|
no_tool_list: "a workflow whose tools couldn't be checked",
|
|
60
41
|
executable_node: "a workflow that runs code or commands",
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
};
|
|
64
|
-
/** The rules whose words name a note, said of a skill's or a workflow's file instead. */
|
|
65
|
-
const LEARNED_WORDS = {
|
|
66
|
-
file_name: "a skill or workflow name that can't be used",
|
|
67
|
-
file_mode: "a link or a folder where a skill or workflow goes",
|
|
68
|
-
deleted: "a deleted skill or workflow",
|
|
69
|
-
too_large: `a skill or workflow over ${CAPS.file / 1024} KB`,
|
|
70
|
-
status: "a skill status that only the server sets",
|
|
42
|
+
front_matter: "a workflow whose header sets more than its name and description",
|
|
43
|
+
kept: "a change to a workflow a person retired or hasn't approved yet",
|
|
71
44
|
};
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
const wordOf = (problem) => (isLearned(problem) ? LEARNED_WORDS[problem.rule] : undefined) ?? RULE_WORDS[problem.rule] ?? problem.rule;
|
|
75
|
-
/** What a person must not see stored in a note at all: a secret, or what hides text. */
|
|
45
|
+
const wordOf = (problem) => RULE_WORDS[problem.rule] ?? problem.rule;
|
|
46
|
+
/** What a person must not see stored at all: a secret, or what hides text. */
|
|
76
47
|
const MUST_NOT_STORE = new Set(["secret_value", "secret_shape", "invisible_unicode"]);
|
|
77
48
|
const rulesIn = (problems) => [...new Set(problems.map(wordOf))].join("; ");
|
|
49
|
+
/** The problem that says corrections.md had no room for the owner's correction (learn/corrections.ts' cap), if any: the
|
|
50
|
+
* one `too_large` that is not a workflow's. */
|
|
51
|
+
export const correctionsCapOf = (problems) => problems.find((problem) => problem.rule === "too_large" && problem.path === CORRECTIONS_FILE && typeof problem.detail === "string");
|
|
78
52
|
/** Why learning stopped, said plainly: the cause inside "Not kept: learning stopped (...)". */
|
|
79
53
|
export const STOPPED = {
|
|
80
|
-
unreadable: "the agent
|
|
81
|
-
notCopied: "the agent
|
|
82
|
-
noSeed: "the run started without the agent
|
|
83
|
-
serverStopped: "the server stopped while it set up the run's notes, so the run started without them",
|
|
54
|
+
unreadable: "what the agent learned could not be read, so the run started without it",
|
|
55
|
+
notCopied: "what the agent learned could not be handed to the run, so the run started without it",
|
|
56
|
+
noSeed: "the run started without what the agent learned",
|
|
84
57
|
cancelled: "the run was cancelled",
|
|
85
|
-
cancelledLooking: "the run was cancelled while it
|
|
86
|
-
crashed: "the run's process ended before it could
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
notChecked: "
|
|
58
|
+
cancelledLooking: "the run was cancelled while it wrote what it learned",
|
|
59
|
+
crashed: "the run's process ended before it could keep what it learned",
|
|
60
|
+
failed: "writing what it learned ended on an error",
|
|
61
|
+
unanswered: "the turn that writes its workflow ended before it answered",
|
|
62
|
+
notChecked: "what it learned could not be checked",
|
|
90
63
|
refuseUnread: "what the run must never learn (its agent's browser sign-in, the server's secrets) could not be read back, so nothing it learned is kept",
|
|
91
|
-
noReview: "the review of the new notes gave no answer",
|
|
92
|
-
unread: "the review of the new notes gave an answer that could not be read",
|
|
93
|
-
contradicted: "the review of the new notes contradicted itself: it kept them and said not to",
|
|
94
|
-
contradictedTwice: "the review of the new notes contradicted itself twice: it kept them and said not to",
|
|
95
64
|
};
|
|
96
65
|
/** A run's learning, in words, by where it stands. */
|
|
97
66
|
export const said = {
|
|
98
|
-
seeded: (
|
|
99
|
-
const items = [...(
|
|
67
|
+
seeded: (corrections, workflows = 0) => {
|
|
68
|
+
const items = [...(corrections ? [count(corrections, "correction")] : []), ...(workflows ? [count(workflows, "workflow")] : [])];
|
|
100
69
|
return items.length ? `Started from ${listed(items)}.` : "Started with nothing learned yet.";
|
|
101
70
|
},
|
|
102
|
-
reflecting: "
|
|
103
|
-
/**
|
|
104
|
-
asked: "
|
|
105
|
-
/** The end-of-run turn asked again because a workflow draft failed its dry run (learn/reflect.ts reflectDryRun), as a
|
|
106
|
-
* person reads it in the timeline: never the ask, which holds the check's words. */
|
|
107
|
-
askedDryRun: "Looking back again: a workflow draft did not pass its dry run.",
|
|
71
|
+
reflecting: "Keeping what this run learned…",
|
|
72
|
+
/** A message of the end-of-run turn, as a person reads it in the timeline: never the prompt the model is sent. */
|
|
73
|
+
asked: "Learning from this run.",
|
|
108
74
|
/** The compile turn's ask (learn/compile.ts askedForCompile): the job written as a workflow, or a revision of one, or
|
|
109
75
|
* an attempt the checks sent back. */
|
|
110
76
|
askedCompile: "Writing this job as a learned workflow.",
|
|
111
77
|
askedCompileAgain: "Writing the workflow again: the checks sent back what they refused.",
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
* word on the first it dropped. A merge that only holds things for the OK says that alone. */
|
|
116
|
-
merged: (learned, pending = [], files = [], left = [], checked = []) => {
|
|
78
|
+
/** What it learned: its workflow by name and the corrections it added; then what waits for the owner's OK, by name;
|
|
79
|
+
* then what the checks refused beside it. A merge that only holds things for the OK says that alone. */
|
|
80
|
+
merged: (files = [], corrections = 0, checked = []) => {
|
|
117
81
|
const flat = (name) => name.replace(/\s+/g, " ").trim();
|
|
118
|
-
const
|
|
119
|
-
const held = [...pending.map((note) => flat(note.name)), ...files.filter((file) => file.pending).map(kind)];
|
|
82
|
+
const held = files.filter((file) => file.pending).map((file) => `workflow ${flat(file.name)}`);
|
|
120
83
|
const waiting = held.length ? `Waiting for your OK: ${held.join("; ")}.` : "";
|
|
121
|
-
const made = files.filter((file) => !file.pending).map(
|
|
122
|
-
const
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
const
|
|
126
|
-
const
|
|
127
|
-
const
|
|
128
|
-
const
|
|
129
|
-
|
|
130
|
-
return dropped ? `${base}${base.endsWith(".") ? "" : "."} ${dropped}` : base;
|
|
84
|
+
const made = files.filter((file) => !file.pending).map((file) => `the workflow ${flat(file.name)}`);
|
|
85
|
+
const added = corrections ? (corrections === 1 ? "your correction" : `${corrections} of your corrections`) : "";
|
|
86
|
+
const kept = [made.length ? `Learned ${listed(made)}` : "", added ? `Kept ${added}` : ""].filter(Boolean).join(". ");
|
|
87
|
+
// A correction corrections.md had no room for is said in the cap's words, never as a workflow over its cap.
|
|
88
|
+
const cap = correctionsCapOf(checked);
|
|
89
|
+
const rest = checked.filter((problem) => problem !== cap);
|
|
90
|
+
const refused = [cap ? said.correctionsFull(cap.detail) : "", rest.length ? said.checker(rest) : ""].filter(Boolean).join(" ");
|
|
91
|
+
const base = [kept ? `${kept}.` : "", waiting].filter(Boolean).join(" ");
|
|
92
|
+
return [base, refused].filter(Boolean).join(" ");
|
|
131
93
|
},
|
|
132
|
-
empty: "Nothing new to
|
|
133
|
-
/** A run whose only work was its learned workflows, each answering, with nothing said after its first message:
|
|
134
|
-
*
|
|
94
|
+
empty: "Nothing new to keep from this run.",
|
|
95
|
+
/** A run whose only work was its learned workflows, each answering, with nothing said after its first message: nothing
|
|
96
|
+
* to compile (runner/learning-end.ts onlyLearnedWorkflows). */
|
|
135
97
|
onlyWorkflow: "Nothing new: the run only ran a learned workflow.",
|
|
136
|
-
/** A run of an agent that learns workflows, with no feedback from its owner (no grade's words, no message after its
|
|
137
|
-
* first): it was not asked to look back (runner/learning-end.ts ownerSaid); its trace is what a compile reads. */
|
|
138
|
-
noFeedback: "Not looked back on: this agent learns workflows, and it looks back only on your feedback.",
|
|
139
98
|
/** A run started with `learning: "use"`: it read what its agent learned and kept nothing, as asked. */
|
|
140
99
|
use: "Used what its agent learned; this run keeps nothing.",
|
|
141
100
|
/** A merge whose every item the owner has since retired: nothing it learned is kept now. */
|
|
142
101
|
retiredSince: "What it learned was retired since.",
|
|
143
|
-
/** The
|
|
144
|
-
unparsed: "Not kept: its notes weren't in the expected format.",
|
|
145
|
-
/** The grader's word on why it kept nothing (a dropped note's why, or its reason), its first sentence. */
|
|
146
|
-
grader: (reason) => `Not kept: ${firstSentence(reason) || "it was not judged worth remembering."}`,
|
|
147
|
-
/** The checks refused what the run wrote, at its end: its notes, or what it learned when a skill or a workflow is
|
|
148
|
-
* among what was refused. */
|
|
102
|
+
/** The checks refused what the run wrote, at its end. */
|
|
149
103
|
checker: (problems) => problems.some((problem) => MUST_NOT_STORE.has(problem.rule))
|
|
150
104
|
? `Not kept: it held something that must not be stored (${rulesIn(problems.filter((problem) => MUST_NOT_STORE.has(problem.rule)))}).`
|
|
151
|
-
: `Not kept: it didn't pass the checks
|
|
152
|
-
/** The
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
? "Not kept: a note it would replace is gone or was changed since."
|
|
157
|
-
: `Not kept: the agent's notes changed while this run ran (${rulesIn(problems)}).`,
|
|
158
|
-
noBudget: "Skipped: no budget left in this run to look back.",
|
|
159
|
-
/** The run's grade did not fit what its cap left (its learning run's cap): not run, so nothing it learned is kept. */
|
|
160
|
-
noRoomToGrade: "Not graded: no room under the cap.",
|
|
161
|
-
/** A grade under a cap whose cost can't be kept within it (its spend or the grade model's price unknown). */
|
|
162
|
-
gradeUncapped: "Not graded: the grade's cost can't be kept under the cap.",
|
|
163
|
-
unknownCost: "Skipped: this run's spend is unknown, so its budget can't cover looking back.",
|
|
164
|
-
/** A capped run whose spend under its cap is unknown once it looked back: its grade is not run (none could be kept
|
|
165
|
-
* within the cap), so nothing it learned is kept. */
|
|
166
|
-
gradeUnknownSpend: "Not graded: this run's spend is unknown, so its budget can't cover the grade.",
|
|
105
|
+
: `Not kept: it didn't pass the checks (${rulesIn(problems)}).`,
|
|
106
|
+
/** The owner's correction would take corrections.md past its cap (learn/corrections.ts): `why`, the cap's words. */
|
|
107
|
+
correctionsFull: (why) => `Not kept: ${why.replace(/\.$/, "")}.`,
|
|
108
|
+
noBudget: "Skipped: no budget left in this run to write what it learned.",
|
|
109
|
+
unknownCost: "Skipped: this run's spend is unknown, so its budget can't cover writing what it learned.",
|
|
167
110
|
stopped: (cause) => `Not kept: learning stopped (${cause}).`,
|
|
168
111
|
};
|
|
169
|
-
/**
|
|
170
|
-
*
|
|
171
|
-
*
|
|
172
|
-
|
|
173
|
-
/** The skill or the workflow draft at `file` as a person names it ("the skill X", "the workflow Y"), or undefined for a
|
|
174
|
-
* note's file or a draft's README.md. */
|
|
175
|
-
const learnedWords = (file) => {
|
|
176
|
-
const place = /^(skills)\/([^/]+)\/SKILL\.md$|^(workflows)\/([^/]+)\/workflow\.json$/.exec(file);
|
|
177
|
-
return place ? (place[1] ? `the skill ${place[2]}` : `the workflow ${place[4]}`) : undefined;
|
|
178
|
-
};
|
|
179
|
-
/** Why a verdict kept nothing, in a person's words: the grader's word on the first note it did not keep, since its
|
|
180
|
-
* reason may open on a note it kept; when it dropped none, or gave one no word, its own reason, unless that is
|
|
181
|
-
* parseVerdict's own; an answer that held neither is said as such. Nothing merged, so the skill and the workflow draft
|
|
182
|
-
* the run proposed (`lost`, from its proposal: a verdict the host refused has no items) are lost with it: named before
|
|
183
|
-
* the why, so a long why cut short never cuts them off; the one the why speaks of as its subject ("Not kept, the
|
|
184
|
-
* skill X: …"), any other as lost with it ("Not kept, with the skill X: …"). The caller cuts the line of the host's
|
|
185
|
-
* secrets: a name is the run's to choose. */
|
|
186
|
-
export function notKept(verdict, lost = []) {
|
|
187
|
-
const dropped = verdict.items.find((item) => !item.keep);
|
|
188
|
-
// A grade that contradicted itself (it kept every item and said no merge: once, or again when asked again) is said as
|
|
189
|
-
// such: never its own reason, which may say the items can be kept.
|
|
190
|
-
const said_ = dropped?.why ? said.grader(dropped.why) : verdict.reason === CONTRADICTED_TWICE_REASON ? said.stopped(STOPPED.contradictedTwice) : verdict.reason === CONTRADICTED_REASON ? said.stopped(STOPPED.contradicted) : OWN_REASONS.has(verdict.reason) ? said.stopped(STOPPED.unread) : said.grader(verdict.reason);
|
|
191
|
-
const subject = dropped?.why ? learnedWords(dropped.file) : undefined;
|
|
192
|
-
const others = [...new Set(lost.flatMap(({ file }) => learnedWords(file) ?? []))].filter((words) => words !== subject);
|
|
193
|
-
if (!subject && !others.length)
|
|
194
|
-
return said_;
|
|
195
|
-
const named = [subject, others.length ? `with ${listed(others)}` : ""].filter(Boolean).join(" ");
|
|
196
|
-
return said_.replace(/^Not kept: /, `Not kept, ${named}: `);
|
|
197
|
-
}
|
|
198
|
-
/** The why of a note main already holds the same (a run's new note, or a skill re-filed as one: runner/learning-loop.ts
|
|
199
|
-
* takenOnMain): no change, so no words of a run's learning say it, the merge's own or a read's rebuilt from its verdict. */
|
|
200
|
-
export const SAME_NOTE = "The same rule is already one of the agent's notes.";
|
|
201
|
-
/** A run's learning in words as a read says them, whole: what it learned and what waits for the owner's OK, or why the
|
|
202
|
-
* grader kept nothing, said again from its parts (`learned`, `pending`, `verdict`) each cut by `cut` first (the host's
|
|
203
|
-
* secrets as they are now), and the whole line cut again, as notKept's is: a skill's or a workflow's file names it in
|
|
204
|
-
* the words, uncut until then; any other detail, the server's own sentence, cut as well. The caller cuts the words
|
|
205
|
-
* short after. */
|
|
112
|
+
/** A run's learning in words as a read says them, whole: what it learned and what waits for the owner's OK, said again
|
|
113
|
+
* from its parts (`workflows`, `corrections`, `problems`), each name cut by `cut` first (the host's secrets as they are
|
|
114
|
+
* now), and the whole line cut again; any other detail, the server's own sentence, cut as well. The caller cuts the
|
|
115
|
+
* words short after. */
|
|
206
116
|
export function wordsOf(learning, cut) {
|
|
207
|
-
const { learned, pending, verdict } = learning;
|
|
208
117
|
if (learning.state === "merged") {
|
|
209
|
-
const
|
|
210
|
-
const
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
return cut(said.merged(kept.map((note) => ({ name: cut(note.name), supersedes: note.supersedes })), waiting.map((note) => ({ name: cut(note.name) })), files.map((file) => ({ file: file.file, name: cut(file.name), ...(file.pending ? { pending: true } : {}) })), (verdict?.items ?? []).filter((item) => !item.keep && typeof item.why === "string" && item.why !== SAME_NOTE).map((item) => ({ why: cut(item.why) })), Array.isArray(learning.problems) ? learning.problems : []));
|
|
214
|
-
}
|
|
215
|
-
if (learning.state === "dropped" && learning.reason === "grader" && verdict) {
|
|
216
|
-
// the stored `lost` is read as untrusted: an entry out of shape is left out. The whole line is cut again, the names
|
|
217
|
-
// in it included.
|
|
218
|
-
const lost = Array.isArray(learning.lost) ? learning.lost.filter((file) => typeof file?.file === "string") : [];
|
|
219
|
-
return cut(notKept({ reason: cut(verdict.reason), items: (verdict.items ?? []).map((item) => ({ ...item, why: cut(item.why) })) }, lost));
|
|
118
|
+
const files = (Array.isArray(learning.workflows) ? learning.workflows : []).filter((file) => typeof file?.file === "string" && typeof file.name === "string");
|
|
119
|
+
const corrections = typeof learning.corrections === "number" && learning.corrections > 0 ? learning.corrections : 0;
|
|
120
|
+
if (files.length || corrections)
|
|
121
|
+
return cut(said.merged(files.map((file) => ({ name: cut(file.name), ...(file.pending ? { pending: true } : {}) })), corrections, Array.isArray(learning.problems) ? learning.problems : []));
|
|
220
122
|
}
|
|
221
123
|
return learning.detail === null ? null : cut(learning.detail);
|
|
222
124
|
}
|