@parcha/agentrun-serve 0.1.0-beta.32 → 0.1.0-beta.34
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 +270 -0
- package/README.md +343 -246
- package/dist/adapters.d.ts +0 -7
- package/dist/adapters.js +11 -22
- package/dist/agent-rows.d.ts +98 -0
- package/dist/agent-rows.js +1 -0
- package/dist/agents-store.d.ts +6 -2
- package/dist/agents-store.js +60 -25
- package/dist/agents.d.ts +9 -125
- package/dist/agents.js +15 -305
- package/dist/answer-json.d.ts +23 -0
- package/dist/answer-json.js +58 -0
- package/dist/api-only.d.ts +14 -0
- package/dist/api-only.js +33 -0
- package/dist/archil-routes.d.ts +1 -1
- package/dist/bash-read-only.d.ts +22 -0
- package/dist/bash-read-only.js +701 -0
- package/dist/box-egress-vm.d.ts +0 -8
- package/dist/box-egress-vm.js +0 -10
- package/dist/box-egress.d.ts +0 -4
- package/dist/box-egress.js +1 -16
- package/dist/box-paths.d.ts +25 -2
- package/dist/box-paths.js +79 -11
- package/dist/box-relay.d.ts +0 -11
- package/dist/box-relay.js +0 -20
- package/dist/box-settings.d.ts +26 -0
- package/dist/box-settings.js +63 -0
- package/dist/boxes.d.ts +21 -1
- package/dist/boxes.js +27 -20
- package/dist/browser-commands.d.ts +5 -2
- package/dist/browser-commands.js +4 -4
- package/dist/browser-computer.d.ts +5 -0
- package/dist/browser-computer.js +21 -0
- package/dist/browser-cost.d.ts +9 -6
- package/dist/browser-cost.js +94 -51
- package/dist/browser-live.d.ts +7 -20
- package/dist/browser-live.js +15 -93
- package/dist/browser-person.d.ts +18 -53
- package/dist/browser-person.js +94 -279
- package/dist/budget.d.ts +0 -4
- package/dist/budget.js +0 -7
- package/dist/cap.d.ts +8 -12
- package/dist/cap.js +12 -27
- package/dist/cli.js +61 -20
- package/dist/closed-pipes.d.ts +2 -0
- package/dist/closed-pipes.js +13 -0
- package/dist/computer-commands.d.ts +2 -0
- package/dist/computer-commands.js +2 -0
- package/dist/computer-keys.js +5 -2
- package/dist/computer-setting.d.ts +20 -4
- package/dist/computer-setting.js +25 -5
- package/dist/computers.d.ts +31 -3
- package/dist/computers.js +70 -11
- package/dist/confine.d.ts +120 -0
- package/dist/confine.js +436 -0
- package/dist/console/assets/index-RPHGlXmM.js +540 -0
- package/dist/console/assets/index-opTN5Naq.css +1 -0
- package/dist/console/index.html +2 -2
- package/dist/daytona-api.d.ts +0 -11
- package/dist/daytona-api.js +1 -82
- package/dist/decision-rows.d.ts +1 -1
- package/dist/decision-rows.js +1 -1
- package/dist/docker-daemon.d.ts +31 -0
- package/dist/docker-daemon.js +56 -0
- package/dist/docker-host-addresses.d.ts +37 -0
- package/dist/docker-host-addresses.js +110 -0
- package/dist/effort-guidance.js +4 -3
- package/dist/environment.d.ts +0 -3
- package/dist/environment.js +3 -5
- package/dist/errors.d.ts +0 -2
- package/dist/errors.js +6 -9
- package/dist/filed-answer.d.ts +32 -0
- package/dist/filed-answer.js +160 -0
- package/dist/files.d.ts +1 -11
- package/dist/files.js +2 -21
- package/dist/github-connection.d.ts +2 -2
- package/dist/github-connection.js +1 -1
- package/dist/graph-view.d.ts +3 -5
- package/dist/graph-view.js +4 -14
- package/dist/handed-values.d.ts +9 -0
- package/dist/handed-values.js +26 -0
- package/dist/harness-install.d.ts +22 -5
- package/dist/harness-install.js +98 -20
- package/dist/harness-opencode/adapter.d.ts +7 -0
- package/dist/harness-opencode/adapter.js +23 -6
- package/dist/harness-opencode/index.d.ts +1 -1
- package/dist/harness-opencode/index.js +1 -1
- package/dist/harness-opencode/verify.d.ts +17 -0
- package/dist/harness-opencode/verify.js +30 -10
- package/dist/harness-table.js +6 -1
- package/dist/harness.d.ts +4 -3
- package/dist/harness.js +16 -1
- package/dist/heard.js +1 -1
- package/dist/held-fd.d.ts +5 -0
- package/dist/held-fd.js +14 -0
- package/dist/host-calls.d.ts +20 -0
- package/dist/host-calls.js +12 -0
- package/dist/host-tools.d.ts +4 -21
- package/dist/host-tools.js +4 -61
- package/dist/host.d.ts +2 -4
- package/dist/host.js +2 -7
- package/dist/import-summary.d.ts +1 -5
- package/dist/import-summary.js +0 -21
- package/dist/import.d.ts +6 -6
- package/dist/import.js +62 -24
- package/dist/key-refusal.d.ts +5 -1
- package/dist/key-refusal.js +19 -4
- package/dist/learn/check.d.ts +6 -2
- package/dist/learn/check.js +83 -29
- package/dist/learn/folder.d.ts +5 -1
- package/dist/learn/folder.js +10 -3
- package/dist/learn/grade.d.ts +14 -0
- package/dist/learn/grade.js +68 -12
- package/dist/learn/index.d.ts +4 -4
- package/dist/learn/index.js +4 -4
- package/dist/learn/reflect.d.ts +31 -2
- package/dist/learn/reflect.js +79 -4
- package/dist/learn/relevance.d.ts +24 -0
- package/dist/learn/relevance.js +91 -0
- package/dist/learn/secrets.d.ts +8 -1
- package/dist/learn/secrets.js +95 -15
- package/dist/learn/skills.d.ts +112 -14
- package/dist/learn/skills.js +556 -52
- package/dist/learned-workflow.d.ts +37 -5
- package/dist/learned-workflow.js +106 -12
- package/dist/learning-routes.d.ts +16 -49
- package/dist/learning-routes.js +46 -36
- package/dist/learning-run.d.ts +6 -250
- package/dist/learning-run.js +11 -665
- package/dist/learning-words.d.ts +12 -5
- package/dist/learning-words.js +18 -9
- package/dist/learning.d.ts +93 -77
- package/dist/learning.js +176 -304
- package/dist/live/stream.js +1 -1
- package/dist/live/translate.js +13 -3
- package/dist/local-models.d.ts +11 -5
- package/dist/local-models.js +13 -8
- package/dist/mcp-gateway.d.ts +11 -52
- package/dist/mcp-gateway.js +44 -148
- package/dist/mcp-oauth.d.ts +10 -14
- package/dist/mcp-oauth.js +14 -32
- package/dist/mcp-probe.d.ts +0 -7
- package/dist/mcp-probe.js +4 -10
- package/dist/mcp-servers-store.d.ts +6 -6
- package/dist/mcp-servers-store.js +13 -15
- package/dist/mcp-store.js +3 -4
- package/dist/mcp.js +4 -3
- package/dist/model.d.ts +6 -7
- package/dist/model.js +43 -27
- package/dist/monid.d.ts +0 -2
- package/dist/monid.js +3 -6
- package/dist/openapi.d.ts +8 -1
- package/dist/openapi.js +124 -50
- package/dist/page.d.ts +1 -3
- package/dist/page.js +9 -19
- package/dist/paid-calls.d.ts +21 -27
- package/dist/paid-calls.js +28 -62
- package/dist/pause.d.ts +0 -2
- package/dist/pause.js +1 -8
- package/dist/place.d.ts +0 -5
- package/dist/place.js +0 -10
- package/dist/print.d.ts +2 -1
- package/dist/print.js +4 -2
- package/dist/propose.js +83 -39
- package/dist/push-handler.d.ts +1 -1
- package/dist/reflect-range.d.ts +25 -0
- package/dist/reflect-range.js +30 -0
- package/dist/refusal-words.d.ts +5 -1
- package/dist/refusal-words.js +5 -1
- package/dist/rows.d.ts +1 -1
- package/dist/run-cut.d.ts +0 -6
- package/dist/run-cut.js +0 -6
- package/dist/run-db.d.ts +2 -13
- package/dist/run-db.js +2 -41
- package/dist/run-launch.d.ts +19 -2
- package/dist/run-launch.js +13 -5
- package/dist/run-learning-served.d.ts +46 -2
- package/dist/run-learning-served.js +26 -7
- package/dist/run-reads-over-store.d.ts +1 -1
- package/dist/run-reads-over-store.js +15 -6
- package/dist/run-secrets.d.ts +33 -0
- package/dist/run-secrets.js +53 -0
- package/dist/run-timeline-served.d.ts +5 -1
- package/dist/run-timeline-served.js +19 -5
- package/dist/run-view.d.ts +12 -17
- package/dist/run-view.js +29 -28
- package/dist/runnable.d.ts +18 -10
- package/dist/runnable.js +21 -10
- package/dist/runner/adapter-loop.d.ts +14 -3
- package/dist/runner/adapter-loop.js +464 -62
- package/dist/runner/adapter-run-spec.d.ts +29 -8
- package/dist/runner/adapter-run-spec.js +96 -37
- package/dist/runner/adapters/index.js +11 -1
- package/dist/runner/adapters/pi.d.ts +15 -1
- package/dist/runner/adapters/pi.js +19 -5
- package/dist/runner/beside.d.ts +30 -3
- package/dist/runner/beside.js +54 -12
- package/dist/runner/claim-secrets.d.ts +10 -1
- package/dist/runner/claim-secrets.js +49 -15
- package/dist/runner/cli-run-spec.d.ts +2 -0
- package/dist/runner/cli-run-spec.js +60 -17
- package/dist/runner/commands.js +1 -1
- package/dist/runner/computer-journal.d.ts +15 -2
- package/dist/runner/computer-journal.js +41 -5
- package/dist/runner/conformance/harness.js +118 -8
- package/dist/runner/conformance/subject.d.ts +4 -1
- package/dist/runner/dispatch.d.ts +8 -1
- package/dist/runner/dispatch.js +81 -7
- package/dist/runner/end-of-run.d.ts +8 -2
- package/dist/runner/end-of-run.js +10 -4
- package/dist/runner/github-app.js +1 -1
- package/dist/runner/harness-loops.d.ts +9 -1
- package/dist/runner/harness-loops.js +15 -2
- package/dist/runner/journal-kinds.d.ts +30 -6
- package/dist/runner/journal-kinds.js +20 -5
- package/dist/runner/journal-reader.d.ts +1 -1
- package/dist/runner/journal-reader.js +2 -2
- package/dist/runner/learning-ask.d.ts +4 -0
- package/dist/runner/learning-ask.js +15 -1
- package/dist/runner/learning-end.d.ts +18 -3
- package/dist/runner/learning-end.js +113 -11
- package/dist/runner/learning-loop.d.ts +5 -0
- package/dist/runner/learning-loop.js +26 -6
- package/dist/runner/live-ticker.d.ts +1 -1
- package/dist/runner/live-ticker.js +28 -4
- package/dist/runner/loop-contract.d.ts +3 -2
- package/dist/runner/main.d.ts +64 -10
- package/dist/runner/main.js +165 -27
- package/dist/runner/mcp-claim.d.ts +1 -1
- package/dist/runner/mcp-claim.js +2 -3
- package/dist/runner/mcp-run.d.ts +2 -0
- package/dist/runner/mcp-run.js +15 -5
- package/dist/runner/memory-claim.d.ts +9 -0
- package/dist/runner/memory-claim.js +25 -0
- package/dist/runner/metrics.d.ts +33 -1
- package/dist/runner/metrics.js +85 -1
- package/dist/runner/model-route.d.ts +13 -0
- package/dist/runner/model-route.js +154 -11
- package/dist/runner/redact.d.ts +8 -2
- package/dist/runner/redact.js +11 -2
- package/dist/runner/reflect-hook.d.ts +12 -1
- package/dist/runner/reflect-hook.js +33 -3
- package/dist/runner/runner.d.ts +20 -0
- package/dist/runner/runner.js +56 -10
- package/dist/runner/store-port.d.ts +1 -1
- package/dist/runner/store-secrets.d.ts +3 -3
- package/dist/runner/store-secrets.js +8 -12
- package/dist/runner/text-tools.d.ts +44 -0
- package/dist/runner/text-tools.js +237 -0
- package/dist/runner/workflow-loop.d.ts +6 -0
- package/dist/runner/workflow-loop.js +6 -4
- package/dist/runner/workflow-spec.d.ts +18 -0
- package/dist/runner/workflow-spec.js +68 -26
- package/dist/runs-over-store.d.ts +8 -3
- package/dist/runs-over-store.js +76 -19
- package/dist/seal-key.d.ts +54 -15
- package/dist/seal-key.js +232 -82
- package/dist/sealed-settings-store.d.ts +19 -4
- package/dist/sealed-settings-store.js +9 -9
- package/dist/sealing.d.ts +4 -0
- package/dist/sealing.js +20 -0
- package/dist/secret-cut.d.ts +1 -1
- package/dist/secret-cut.js +1 -1
- package/dist/secret-name.d.ts +9 -0
- package/dist/secret-name.js +15 -0
- package/dist/secret-writes.d.ts +0 -1
- package/dist/secret-writes.js +0 -1
- package/dist/secrets.d.ts +2 -10
- package/dist/secrets.js +21 -17
- package/dist/server-fs.d.ts +4 -0
- package/dist/server-fs.js +8 -2
- package/dist/server-lock.d.ts +0 -24
- package/dist/server-lock.js +1 -80
- package/dist/server-secrets-store.d.ts +4 -4
- package/dist/server-secrets-store.js +10 -32
- package/dist/server-secrets.d.ts +4 -9
- package/dist/server-secrets.js +12 -33
- package/dist/server.d.ts +26 -44
- package/dist/server.js +229 -142
- package/dist/sign-ins-store.d.ts +34 -36
- package/dist/sign-ins-store.js +27 -38
- package/dist/sign-ins.d.ts +2 -119
- package/dist/sign-ins.js +5 -311
- package/dist/standard-webhooks.d.ts +1 -1
- package/dist/standard-webhooks.js +1 -1
- package/dist/stats.d.ts +3 -2
- package/dist/stats.js +1 -1
- package/dist/store/agent-body.d.ts +8 -2
- package/dist/store/agent-body.js +16 -4
- package/dist/store/index.d.ts +3 -3
- package/dist/store/index.js +3 -3
- package/dist/store/open.d.ts +18 -5
- package/dist/store/open.js +23 -3
- package/dist/store/postgres/connection.d.ts +18 -2
- package/dist/store/postgres/connection.js +156 -32
- package/dist/store/postgres/migrate.d.ts +4 -0
- package/dist/store/postgres/migrate.js +27 -3
- package/dist/store/postgres/migrations/0003_commands_one_answer.check.sql +19 -0
- package/dist/store/postgres/migrations/0003_commands_one_answer.sql +13 -0
- package/dist/store/postgres/store.d.ts +9 -2
- package/dist/store/postgres/store.js +9 -0
- package/dist/store/schema.js +1 -1
- package/dist/store/seal.js +2 -2
- package/dist/store/sqlite/connection.js +49 -5
- package/dist/store/sqlite/run-patch.d.ts +3 -0
- package/dist/store/sqlite/run-patch.js +3 -0
- package/dist/store/sqlite/store.js +64 -20
- package/dist/store/store.d.ts +38 -6
- package/dist/store/store.js +12 -2
- package/dist/store-reads/cap.d.ts +1 -1
- package/dist/store-reads/cap.js +22 -4
- package/dist/store-reads/journal.d.ts +25 -6
- package/dist/store-reads/journal.js +173 -21
- package/dist/store-reads/learning.d.ts +26 -8
- package/dist/store-reads/learning.js +12 -4
- package/dist/store-reads/workflow.d.ts +1 -1
- package/dist/store-reads/workflow.js +1 -1
- package/dist/store-view.d.ts +5 -1
- package/dist/store-view.js +91 -23
- package/dist/template-eval.d.ts +60 -4
- package/dist/template-eval.js +120 -54
- package/dist/templates.d.ts +24 -10
- package/dist/templates.js +69 -38
- package/dist/timeline/group.d.ts +33 -0
- package/dist/timeline/group.js +77 -0
- package/dist/timeline/index.d.ts +7 -0
- package/dist/timeline/index.js +7 -0
- package/dist/timeline/labels.d.ts +79 -0
- package/dist/timeline/labels.js +150 -0
- package/dist/timeline/origin.d.ts +56 -0
- package/dist/timeline/origin.js +92 -0
- package/dist/timeline/render-text.d.ts +11 -0
- package/dist/timeline/render-text.js +62 -0
- package/dist/timeline/timeline.d.ts +274 -0
- package/dist/timeline/timeline.js +1308 -0
- package/dist/timeline/util.d.ts +17 -0
- package/dist/timeline/util.js +49 -0
- package/dist/tool-gate.d.ts +41 -216
- package/dist/tool-gate.js +79 -540
- package/dist/tool-keys-store.d.ts +11 -12
- package/dist/tool-keys-store.js +24 -31
- package/dist/tool-keys.d.ts +9 -104
- package/dist/tool-keys.js +15 -271
- package/dist/tool-plane.d.ts +14 -42
- package/dist/tool-plane.js +23 -81
- package/dist/tool-settings-store.d.ts +1 -2
- package/dist/tool-settings-store.js +5 -8
- package/dist/tools.d.ts +31 -19
- package/dist/tools.js +101 -108
- package/dist/trigger-adapter.d.ts +2 -2
- package/dist/trigger-schedule.js +2 -1
- package/dist/trigger-secrets-shown.js +5 -1
- package/dist/trigger-targets.d.ts +13 -1
- package/dist/trigger-targets.js +31 -1
- package/dist/triggers.d.ts +2 -2
- package/dist/triggers.js +3 -3
- package/dist/turn-end.d.ts +1 -1
- package/dist/turn-end.js +1 -1
- package/dist/turns.d.ts +0 -6
- package/dist/turns.js +0 -19
- package/dist/uploads.js +1 -1
- package/dist/usage.d.ts +0 -2
- package/dist/usage.js +0 -2
- package/dist/validate.d.ts +2 -0
- package/dist/validate.js +23 -14
- package/dist/webhooks.d.ts +102 -76
- package/dist/webhooks.js +266 -233
- package/dist/workflow-run.d.ts +114 -0
- package/dist/workflow-run.js +144 -0
- package/dist/workspace/beneath.d.ts +19 -0
- package/dist/workspace/beneath.js +106 -0
- package/dist/workspace/computer-deps.d.ts +52 -5
- package/dist/workspace/computer-deps.js +154 -19
- package/dist/workspace/computer-for-claim.d.ts +19 -14
- package/dist/workspace/computer-for-claim.js +77 -16
- package/dist/workspace/computer-hold.d.ts +6 -1
- package/dist/workspace/computer-hold.js +6 -1
- package/dist/workspace/computer-janitor.d.ts +47 -0
- package/dist/workspace/computer-janitor.js +182 -0
- package/dist/workspace/computer-providers.d.ts +6 -2
- package/dist/workspace/computer-providers.js +1 -1
- package/dist/workspace/grep-worker.d.ts +5 -0
- package/dist/workspace/grep-worker.js +9 -6
- package/dist/workspace/index.d.ts +4 -3
- package/dist/workspace/index.js +4 -4
- package/dist/workspace/local.d.ts +11 -2
- package/dist/workspace/local.js +161 -43
- package/dist/workspace/resolve-computer.d.ts +50 -10
- package/dist/workspace/resolve-computer.js +46 -11
- package/dist/workspace/run-tools.d.ts +13 -31
- package/dist/workspace/run-tools.js +10 -27
- package/dist/workspace-paths.d.ts +0 -17
- package/dist/workspace-paths.js +1 -41
- package/dist/workspace.d.ts +0 -17
- package/dist/workspace.js +3 -99
- package/launcher/agentrun-serve +6 -33
- package/package.json +14 -14
- package/templates/README.md +9 -3
- package/templates/inbound-lead/agent.md +1 -1
- package/templates/kyb/agent.md +1 -1
- package/templates/market-monitor/agent.md +2 -2
- package/templates/market-monitor/skills/monitor/SKILL.md +6 -4
- package/dist/app.d.ts +0 -5
- package/dist/app.js +0 -514
- package/dist/bound-files.d.ts +0 -4
- package/dist/bound-files.js +0 -164
- package/dist/bounds.d.ts +0 -26
- package/dist/bounds.js +0 -137
- package/dist/coding-tools.d.ts +0 -47
- package/dist/coding-tools.js +0 -189
- package/dist/computer-adb.d.ts +0 -12
- package/dist/computer-adb.js +0 -14
- package/dist/console/assets/index-35-7aeIZ.js +0 -519
- package/dist/console/assets/index-Cejbov-Y.css +0 -1
- package/dist/content-filter.d.ts +0 -7
- package/dist/content-filter.js +0 -23
- package/dist/disk.d.ts +0 -33
- package/dist/disk.js +0 -85
- package/dist/door-line.d.ts +0 -23
- package/dist/door-line.js +0 -83
- package/dist/grade.d.ts +0 -63
- package/dist/grade.js +0 -150
- package/dist/harness-app.d.ts +0 -69
- package/dist/harness-app.js +0 -1162
- package/dist/mcp-servers.d.ts +0 -269
- package/dist/mcp-servers.js +0 -456
- package/dist/packs.d.ts +0 -71
- package/dist/packs.js +0 -180
- package/dist/request-start.d.ts +0 -27
- package/dist/request-start.js +0 -381
- package/dist/run-box.d.ts +0 -205
- package/dist/run-box.js +0 -661
- package/dist/run-holder.d.ts +0 -52
- package/dist/run-holder.js +0 -139
- package/dist/runs.d.ts +0 -1200
- package/dist/runs.js +0 -4103
- package/dist/sealed-settings.d.ts +0 -60
- package/dist/sealed-settings.js +0 -178
- package/dist/served-only.d.ts +0 -5
- package/dist/served-only.js +0 -12
- package/dist/sessions.d.ts +0 -6
- package/dist/sessions.js +0 -109
- package/dist/workspace/computer-serves.d.ts +0 -12
- package/dist/workspace/computer-serves.js +0 -15
package/dist/learn/secrets.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
/** The kinds of secret-shaped text in `text`. */
|
|
2
2
|
export declare const secretShapes: (text: string) => string[];
|
|
3
|
+
/** The kinds of text in `text` learning never keeps: every secret shape, and a bank's numbers beside their words. */
|
|
4
|
+
export declare const learnedSecretShapes: (text: string) => string[];
|
|
3
5
|
/** The longest field `redactSecrets` reads, in UTF-8 bytes, unless its caller names another bound. A longer one is printed
|
|
4
6
|
* whole as "[redacted]", never scanned: no field the checker prints is that long in good faith, and a crafted one (a
|
|
5
7
|
* long path) costs no scan. */
|
|
@@ -7,7 +9,8 @@ export declare const PRINT_MAX = 4096;
|
|
|
7
9
|
/** `text` with each of `values` (as written, as JSON writes it, and in each form the matcher finds as it stands: hex in
|
|
8
10
|
* any case, base64, a hex identifier in it folded) and each secret-shaped run replaced by "[redacted]": what the
|
|
9
11
|
* checker prints never holds a secret, wherever it was found, a file's name included, each value as a path names it too
|
|
10
|
-
* (
|
|
12
|
+
* (pathSpellings) and as a URL's path writes it (percentForms). Every form is found in `text` as given, and overlapping
|
|
13
|
+
* finds are redacted as one, so
|
|
11
14
|
* one value never hides part of another from the search. A text
|
|
12
15
|
* that still holds a value or a shape after that (a form not found as it stands: percent encoded, split by whitespace,
|
|
13
16
|
* an NFKC variant), or that is over `max` bytes (PRINT_MAX unless the caller names more), is redacted whole, never in
|
|
@@ -15,6 +18,10 @@ export declare const PRINT_MAX = 4096;
|
|
|
15
18
|
* a line break is still seen whole, never hidden by its hex part cut alone), and the fold-aware one always after, on
|
|
16
19
|
* what is left (a folded value split by whitespace or percent-encoded is found there, never handed back). */
|
|
17
20
|
export declare function redactSecrets(text: string, values: readonly string[], max?: number): string;
|
|
21
|
+
/** `text` as redactSecrets cuts it, and of a bank's numbers beside their words too (MONEY_SHAPES): what learning prints
|
|
22
|
+
* and serves of what it learned or refused (a problem's path and detail, a note read), never a run's own view, which
|
|
23
|
+
* may show its user an account number. */
|
|
24
|
+
export declare function redactLearned(text: string, values: readonly string[], max?: number): string;
|
|
18
25
|
/** A value shorter than this matches too much text by chance to be refused. */
|
|
19
26
|
export declare const MIN_SECRET = 8;
|
|
20
27
|
/** A matcher for `values` in a text: plain, split by whitespace, as JSON writes it, percent or form encoded, base64 or
|
package/dist/learn/secrets.js
CHANGED
|
@@ -1,9 +1,22 @@
|
|
|
1
|
+
import { posix } from "node:path";
|
|
1
2
|
const SK_KEY = /(?<![A-Za-z0-9])sk-[A-Za-z0-9_-]{20,}/;
|
|
2
3
|
const SLACK_TOKEN = /xox[abposre]-[A-Za-z0-9-]{10,}|xapp-[A-Za-z0-9-]{10,}/;
|
|
3
4
|
const GITHUB_TOKEN = /gh[pousr]_[A-Za-z0-9]{30,}|github_pat_[A-Za-z0-9_]{20,}/;
|
|
4
5
|
const JWT = /eyJ[A-Za-z0-9_-]{8,}\.eyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}/;
|
|
5
6
|
/** A Standard Webhooks signing secret: `whsec_` and base64, this server's or any other's. */
|
|
6
7
|
const WEBHOOK_SECRET = /whsec_[A-Za-z0-9+/]{24,}={0,2}/;
|
|
8
|
+
/** A bank account number beside its word: "account", "acct", "a/c" or "bank account", maybe "number", "no.", "#", ":"
|
|
9
|
+
* or "is" after it, then six digits or more, single dashes or spaces between them. A count before the word ("4
|
|
10
|
+
* accounts"), a date (YYYY-MM-DD), a year or a card's last four is none: the word must come first, the digits right
|
|
11
|
+
* after it, and there must be six. Every gap is at most three whitespace characters, so the reading stays linear on a
|
|
12
|
+
* text of long blank runs. */
|
|
13
|
+
const ACCOUNT_NUMBER = /\b(?:bank\s{1,3})?(?:account|acct|a\/c)(?:\s{1,3}(?:number|no\.?|num))?\s{0,3}(?:#|:|\bis\b)?\s{0,3}(?!\d{4}-\d{2}-\d{2}\b)\d(?:[ -]?\d){5,}/i;
|
|
14
|
+
/** An IBAN beside its word: two letters, two check digits, then ten to thirty letters or digits, spaces between. */
|
|
15
|
+
const IBAN = /\bIBAN\s{0,3}(?:#|:|\bis\b)?\s{0,3}[A-Z]{2}\d{2}(?:\s?[A-Z0-9]){10,30}/i;
|
|
16
|
+
/** A US routing (ABA) number beside its word: nine digits. */
|
|
17
|
+
const ROUTING_NUMBER = /\b(?:routing|ABA)(?:\s{1,3}(?:number|no\.?|num))?\s{0,3}(?:#|:|\bis\b)?\s{0,3}\d{9}\b/i;
|
|
18
|
+
/** A UK sort code beside its word: three pairs of digits. */
|
|
19
|
+
const SORT_CODE = /\bsort\s{1,3}code\s{0,3}(?:#|:|\bis\b)?\s{0,3}\d{2}[- ]?\d{2}[- ]?\d{2}\b/i;
|
|
7
20
|
/** Text shaped like a secret, by kind. The same shapes the Pi learning loop's guard refuses. */
|
|
8
21
|
const SHAPES = [
|
|
9
22
|
["AWS access key id", /(?:AKIA|ASIA)[0-9A-Z]{16}/],
|
|
@@ -18,6 +31,18 @@ const SHAPES = [
|
|
|
18
31
|
];
|
|
19
32
|
/** The kinds of secret-shaped text in `text`. */
|
|
20
33
|
export const secretShapes = (text) => SHAPES.filter(([, pattern]) => pattern.test(text)).map(([kind]) => kind);
|
|
34
|
+
/** A bank's numbers beside their words, which learning never keeps: an account, IBAN, routing or sort-code number. Not
|
|
35
|
+
* one of SHAPES: a run may show its user an account number (a finance job's answer), and SHAPES cut every run's view;
|
|
36
|
+
* only what learning keeps refuses them (LS-09: graders held "send refunds to account 4471-0098" for the owner's OK,
|
|
37
|
+
* which would have served it). */
|
|
38
|
+
const MONEY_SHAPES = [
|
|
39
|
+
["bank account number", ACCOUNT_NUMBER],
|
|
40
|
+
["IBAN", IBAN],
|
|
41
|
+
["routing number", ROUTING_NUMBER],
|
|
42
|
+
["sort code", SORT_CODE],
|
|
43
|
+
];
|
|
44
|
+
/** The kinds of text in `text` learning never keeps: every secret shape, and a bank's numbers beside their words. */
|
|
45
|
+
export const learnedSecretShapes = (text) => [...secretShapes(text), ...MONEY_SHAPES.filter(([, pattern]) => pattern.test(text)).map(([kind]) => kind)];
|
|
21
46
|
/** Every place `pattern` matches in `text`, overlapping places included. */
|
|
22
47
|
function spans(text, pattern) {
|
|
23
48
|
const re = new RegExp(pattern.source, `${pattern.flags.replace("g", "")}g`);
|
|
@@ -61,7 +86,8 @@ export const PRINT_MAX = 4096;
|
|
|
61
86
|
/** `text` with each of `values` (as written, as JSON writes it, and in each form the matcher finds as it stands: hex in
|
|
62
87
|
* any case, base64, a hex identifier in it folded) and each secret-shaped run replaced by "[redacted]": what the
|
|
63
88
|
* checker prints never holds a secret, wherever it was found, a file's name included, each value as a path names it too
|
|
64
|
-
* (
|
|
89
|
+
* (pathSpellings) and as a URL's path writes it (percentForms). Every form is found in `text` as given, and overlapping
|
|
90
|
+
* finds are redacted as one, so
|
|
65
91
|
* one value never hides part of another from the search. A text
|
|
66
92
|
* that still holds a value or a shape after that (a form not found as it stands: percent encoded, split by whitespace,
|
|
67
93
|
* an NFKC variant), or that is over `max` bytes (PRINT_MAX unless the caller names more), is redacted whole, never in
|
|
@@ -69,23 +95,34 @@ export const PRINT_MAX = 4096;
|
|
|
69
95
|
* a line break is still seen whole, never hidden by its hex part cut alone), and the fold-aware one always after, on
|
|
70
96
|
* what is left (a folded value split by whitespace or percent-encoded is found there, never handed back). */
|
|
71
97
|
export function redactSecrets(text, values, max = PRINT_MAX) {
|
|
98
|
+
return redactWith(text, values, max, SHAPES, secretShapes);
|
|
99
|
+
}
|
|
100
|
+
/** `text` as redactSecrets cuts it, and of a bank's numbers beside their words too (MONEY_SHAPES): what learning prints
|
|
101
|
+
* and serves of what it learned or refused (a problem's path and detail, a note read), never a run's own view, which
|
|
102
|
+
* may show its user an account number. */
|
|
103
|
+
export function redactLearned(text, values, max = PRINT_MAX) {
|
|
104
|
+
return redactWith(text, values, max, [...SHAPES, ...MONEY_SHAPES], learnedSecretShapes);
|
|
105
|
+
}
|
|
106
|
+
/** redactSecrets over `shapes`, each found in place, and `shapesOf` read of what is left (a shape still there cuts the
|
|
107
|
+
* text whole). */
|
|
108
|
+
function redactWith(text, values, max, shapes, shapesOf) {
|
|
72
109
|
if (Buffer.byteLength(text) > max)
|
|
73
110
|
return "[redacted]";
|
|
74
111
|
const given = withPathSpellings(values.filter((v) => v.length > 0));
|
|
75
|
-
const forms = new Set(given.flatMap((v) => [v, asJson(v), ...(longEnough(v) ? needlesOf(v).plain : [])]).filter((form) => form.length > 0));
|
|
112
|
+
const forms = new Set(given.flatMap((v) => [v, asJson(v), ...(longEnough(v) ? [...needlesOf(v).plain, ...percentForms(v)] : [])]).filter((form) => form.length > 0));
|
|
76
113
|
const found = [
|
|
77
114
|
...[...forms].flatMap((form) => places(text, form)),
|
|
78
115
|
...given.filter(longEnough).flatMap((v) => spans(text, new RegExp(needlesOf(v).hex, "i"))),
|
|
79
|
-
...
|
|
116
|
+
...shapes.flatMap(([, pattern]) => spans(text, pattern)),
|
|
80
117
|
];
|
|
81
118
|
const unfolded = cutAt(text, found);
|
|
82
|
-
if (
|
|
119
|
+
if (spelledMatcher(given, false)(unfolded) || shapesOf(unfolded).length > 0)
|
|
83
120
|
return "[redacted]";
|
|
84
121
|
// Then the folded finds cut in place, and the fold-aware check over what is left, always: a folded value split by
|
|
85
122
|
// whitespace or percent-encoded has no span here, but the matcher's squeezed and decoded views still see it.
|
|
86
123
|
const folds = given.filter(longEnough).flatMap((v) => needlesOf(v).folded.flatMap((needle) => spans(text, foldedPattern(needle))));
|
|
87
124
|
const out = folds.length ? cutAt(text, [...found, ...folds]) : unfolded;
|
|
88
|
-
return
|
|
125
|
+
return spelledMatcher(given)(out) || shapesOf(out).length > 0 ? "[redacted]" : out;
|
|
89
126
|
}
|
|
90
127
|
/** `text` with each of `found` replaced by "[redacted]", overlapping ones as one. */
|
|
91
128
|
function cutAt(text, found) {
|
|
@@ -124,16 +161,55 @@ function percentDecode(text, plusIsSpace) {
|
|
|
124
161
|
return (plusIsSpace ? text.replaceAll("+", " ") : text).replace(/(?:%[0-9a-fA-F]{2})+/g, (run) => Buffer.from(run.replaceAll("%", ""), "hex").toString("utf8"));
|
|
125
162
|
}
|
|
126
163
|
const asJson = (value) => JSON.stringify(value).slice(1, -1);
|
|
127
|
-
/**
|
|
128
|
-
*
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
164
|
+
/** A path with each run of "/" collapsed to one, each "." segment dropped ("/./", a leading "./") and a leading and a
|
|
165
|
+
* trailing "/" dropped, as a resolver writes it. */
|
|
166
|
+
const tidied = (value) => {
|
|
167
|
+
let path = value;
|
|
168
|
+
for (let before = ""; before !== path;) {
|
|
169
|
+
before = path;
|
|
170
|
+
path = path.replace(/\/{2,}/g, "/").replace(/\/\.(?=\/|$)/g, "").replace(/^\.\//, "").replace(/^\//, "").replace(/\/$/, "");
|
|
171
|
+
}
|
|
172
|
+
return path;
|
|
173
|
+
};
|
|
174
|
+
/** `value` as a path names it, each spelling that differs from it and is still long enough to be a secret. A tool that
|
|
175
|
+
* resolves a path the model wrote (pi's read) names the path it resolved in its error, so a held value comes back as
|
|
176
|
+
* the resolver writes it:
|
|
177
|
+
* - tidied: each run of "/" collapsed to one, each "." segment dropped, a leading and a trailing "/" dropped (a random
|
|
178
|
+
* base64 key holds "//" now and then);
|
|
179
|
+
* - its ".." segments resolved as posix.normalize resolves them ("a/x/../b" is "a/b": what is left is still the
|
|
180
|
+
* value's own text, and a piece of a secret is a secret);
|
|
181
|
+
* - each leading ".." consumed, one at a time: the path the model wrote may hold a folder before the value
|
|
182
|
+
* ("notes/../<value>"), which the leading ".." takes, so "../K" comes back as "K", and "../../K" as "../K" or "K". */
|
|
183
|
+
const pathSpellings = (value) => {
|
|
184
|
+
const tidy = tidied(value);
|
|
185
|
+
const out = new Set([tidy]);
|
|
186
|
+
for (let resolved = tidied(posix.normalize(tidy));;) {
|
|
187
|
+
out.add(resolved);
|
|
188
|
+
const next = tidied(resolved.replace(/^\.\.(?:\/|$)/, ""));
|
|
189
|
+
if (next === resolved)
|
|
190
|
+
break;
|
|
191
|
+
resolved = next;
|
|
192
|
+
}
|
|
193
|
+
out.delete(value);
|
|
194
|
+
return [...out].filter(longEnough);
|
|
134
195
|
};
|
|
135
|
-
/**
|
|
136
|
-
|
|
196
|
+
/** `value` as a URL's path writes it, percent-encoded, when that differs: as encodeURIComponent writes it, its hex in
|
|
197
|
+
* upper case and in lower case as some encoders do, and as encodeURI writes it (it keeps "/", "+" and "="). Cut in
|
|
198
|
+
* place where found as it stands; any other encoding is still found by the matcher's decoded views, and the text is
|
|
199
|
+
* then cut whole. A text neither can encode (a lone surrogate) has no such form. */
|
|
200
|
+
const percentForms = (value) => {
|
|
201
|
+
let forms;
|
|
202
|
+
try {
|
|
203
|
+
const upper = encodeURIComponent(value);
|
|
204
|
+
forms = [upper, upper.replace(/%[0-9A-F]{2}/g, (byte) => byte.toLowerCase()), encodeURI(value)];
|
|
205
|
+
}
|
|
206
|
+
catch {
|
|
207
|
+
return [];
|
|
208
|
+
}
|
|
209
|
+
return [...new Set(forms)].filter((form) => form !== value);
|
|
210
|
+
};
|
|
211
|
+
/** Each held value, then its path spellings: every form a cut or the guard derives, derived of each. */
|
|
212
|
+
const withPathSpellings = (values) => [...new Set(values.flatMap((value) => [value, ...pathSpellings(value)]))];
|
|
137
213
|
/** The separators a hex identifier is written with: a UUID's dashes, and the underscores, colons and dots of others. */
|
|
138
214
|
const SEPARATORS = /[-_:.]/g;
|
|
139
215
|
/** The fewest hex digits a run of a value must hold to be matched folded: a UUID's 32 and a Kernel profile's 20 do; a
|
|
@@ -169,7 +245,11 @@ const longEnough = (value) => [...value].length >= MIN_SECRET;
|
|
|
169
245
|
* shorter than MIN_SECRET are left out. `fold: false`, the matcher without the folded needles (redactSecrets' first
|
|
170
246
|
* whole-text check). */
|
|
171
247
|
export function valueMatcher(values, { fold = true } = {}) {
|
|
172
|
-
|
|
248
|
+
return spelledMatcher(withPathSpellings(values), fold);
|
|
249
|
+
}
|
|
250
|
+
/** valueMatcher over values already given with their path spellings (redactSecrets'), each spelled once. */
|
|
251
|
+
function spelledMatcher(spelled, fold = true) {
|
|
252
|
+
const needles = spelled.filter(longEnough).map(needlesOf).map((n) => (fold ? n : { ...n, folded: [] }));
|
|
173
253
|
if (!needles.length)
|
|
174
254
|
return () => false;
|
|
175
255
|
return (text) => {
|
package/dist/learn/skills.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { assertWorkflowCapabilities, desugarWorkflow, inspectWorkflow, validateWorkflow } from "@parcha/agentrun-dsl";
|
|
1
|
+
import type { assertWorkflowCapabilities, desugarWorkflow, dryRunWorkflow, inspectWorkflow, resolveSchemaForWorkflow, validateWorkflow } from "@parcha/agentrun-dsl";
|
|
2
2
|
/** Where a skill and a workflow draft live in the folder. */
|
|
3
3
|
export declare const SKILLS_DIR = "skills";
|
|
4
4
|
export declare const WORKFLOWS_DIR = "workflows";
|
|
@@ -16,32 +16,65 @@ export type LearnedPlace = {
|
|
|
16
16
|
export declare function learnedPlace(path: string): LearnedPlace | undefined;
|
|
17
17
|
/** Whether `name` is a good name for a folder of `kind`. */
|
|
18
18
|
export declare const learnedName: (kind: LearnedPlace["kind"], name: string) => boolean;
|
|
19
|
-
/**
|
|
20
|
-
|
|
19
|
+
/** Why a front matter does not read one way, by frontMatter: the words a refusal says. */
|
|
20
|
+
export declare const UNCLEAR_FRONT = "its front matter does not read one way: each line a `key: value` at its left edge, a comment, or a line of the value above it";
|
|
21
|
+
/** A SKILL.md's or a draft README's front matter, read one way, as the one reader of what it says of itself (its keys,
|
|
22
|
+
* its name, its description, its status): each key to its value in order, or undefined when it does not read one way,
|
|
23
|
+
* since another reader (a harness's YAML) could then read a key, a status among them, this one does not. It reads one
|
|
24
|
+
* way when it starts the text (`---`), closes on a `---` line (the last line or not), and each line between is blank,
|
|
25
|
+
* a comment at its left edge, `key: value` at its left edge (a key set once), or a line of the value above it: any
|
|
26
|
+
* indented line under a `key:` with nothing after it (its nested value, a mapping or a list among them), an indented
|
|
27
|
+
* line of a `>` or `|` block, or of a plain value that wraps (one that reads as no key of its own), an indented comment
|
|
28
|
+
* under a plain value being no part of it. A quoted value is read as YAML reads it (unquote: its escapes decoded); a
|
|
29
|
+
* nested, block or wrapped value's lines are joined by one space. Anything else (an indented first line, an indented
|
|
30
|
+
* `key:` under a value, a list at the left edge, a key set twice, a YAML explicit key `? key`, which every writer here
|
|
31
|
+
* would have to edit in its own form) reads no way. */
|
|
32
|
+
export declare function frontMatter(text: string): ReadonlyMap<string, string> | undefined;
|
|
33
|
+
/** Every value a SKILL.md's or a draft README's front matter holds, as YAML reads it (frontMatter: escapes decoded):
|
|
34
|
+
* what a check for secrets reads beside the text as stored, since the decoded value is the one a harness is served
|
|
35
|
+
* (servedSkill). None for a text whose front matter does not read one way. */
|
|
36
|
+
export declare function frontValues(text: string): string[];
|
|
37
|
+
/** The keys a SKILL.md's or a draft README's front matter sets, in order (frontMatter's); undefined for a text whose
|
|
38
|
+
* front matter does not read one way. */
|
|
21
39
|
export declare function frontKeys(text: string): string[] | undefined;
|
|
22
40
|
/** The front matter keys a learned skill or draft README may hold: what a skill is (its name and when to use it). Claude
|
|
23
41
|
* Code reads directives from more (hooks, allowed-tools, context, agent, model, ...): a hook is a shell command its CLI
|
|
24
42
|
* runs. `status` is the host's (a held one). */
|
|
25
43
|
export declare const LEARNED_KEYS: readonly string[];
|
|
26
|
-
/** `text`, a learned skill's SKILL.md, as a run is given it: front matter with its name and its description alone,
|
|
27
|
-
*
|
|
28
|
-
*
|
|
44
|
+
/** `text`, a learned skill's SKILL.md, as a run is given it: front matter with its name and its description alone, as
|
|
45
|
+
* the one reader reads them (frontMatter), each quoted as JSON writes it, which every YAML reads back as that very
|
|
46
|
+
* string (never null, a boolean, a number or a date), written again whatever else its file holds (servedSkill is the
|
|
47
|
+
* one door a learned skill reaches a harness by), then its body as it is. A text with no front matter, or one whose front
|
|
48
|
+
* matter reads no way, is as it is: never served with its fields emptied. A learned one of those is never active, so
|
|
49
|
+
* never given; a revision's own is the harness's to check, as its author wrote it. */
|
|
29
50
|
export declare function servedSkill(text: string): string;
|
|
51
|
+
/** Skills as a harness that loads them through servedSkill is handed them (OpenCode, adapters.ts opencodeOf): each
|
|
52
|
+
* SKILL.md as servedSkill writes it, its other files as they are. Its table entry's check and the learned skills' room
|
|
53
|
+
* (learning.ts chooseSkills) read this same form, so a set the check takes is never one that grew past its limit after. */
|
|
54
|
+
export declare const servedSkills: <T extends {
|
|
55
|
+
files: Record<string, string>;
|
|
56
|
+
}>(skills: readonly T[]) => T[];
|
|
30
57
|
/** Why a `SKILL.md` for the skill `name`, or a draft's `README.md` for the workflow `name`, is out of shape; empty when
|
|
31
58
|
* it is not. Its front matter names the folder's name and a description. */
|
|
32
59
|
export declare function skillProblems(text: string, name: string): string[];
|
|
33
|
-
/** A SKILL.md's or a draft README's front matter as a reader shows it: its name, description and status,
|
|
34
|
-
* when it is not there; undefined for a text
|
|
60
|
+
/** A SKILL.md's or a draft README's front matter as a reader shows it (frontMatter): its name, description and status,
|
|
61
|
+
* each absent when it is not there; undefined for a text whose front matter does not read one way. */
|
|
35
62
|
export declare function learnedFront(text: string): {
|
|
36
63
|
name?: string;
|
|
37
64
|
description?: string;
|
|
38
65
|
status?: string;
|
|
39
66
|
} | undefined;
|
|
40
|
-
/** Whether a SKILL.md or a draft's README.md sets `status`, which only the host does (`held`). */
|
|
67
|
+
/** Whether a SKILL.md or a draft's README.md sets `status`, which only the host does (`held`) (frontMatter). */
|
|
41
68
|
export declare const setsStatus: (text: string) => boolean;
|
|
42
69
|
/** A skill or a draft the grader held for its owner's OK: its SKILL.md, or its draft's README.md, says `status:
|
|
43
|
-
* pending
|
|
70
|
+
* pending` (learnedStatus). No run is given a held skill or workflow until a person approves it. */
|
|
44
71
|
export declare const isHeld: (text: string) => boolean;
|
|
72
|
+
/** Whether `text`'s status, when it sets one, is one plain line, `status: <value>` with nothing of it on the lines after
|
|
73
|
+
* (no quoted value that runs on, no block, no wrapped line): the only status the host's writers (released,
|
|
74
|
+
* retiredLearned), which take the `status:` line out whole, can edit. One set any other way reads unclear (learnedStatus:
|
|
75
|
+
* retired), never held or active, and no writer edits it, so a write never leaves part of it behind. The host writes
|
|
76
|
+
* only one-line statuses (held, retiredLearned). */
|
|
77
|
+
export declare function statusOnOneLine(text: string): boolean;
|
|
45
78
|
/** `text`, a SKILL.md or a draft's README.md, as the host merges one the grader held for its owner's OK: `status:
|
|
46
79
|
* pending` last in its front matter, with LF line ends. Throws on a text with no front matter, which the checker never
|
|
47
80
|
* passes. */
|
|
@@ -49,8 +82,11 @@ export declare function held(text: string): string;
|
|
|
49
82
|
/** `text`, a held SKILL.md or draft README.md, as the host leaves it when its owner approves it: its front matter with
|
|
50
83
|
* no `status` line, so it is given to every later run. Throws on a text with no front matter. */
|
|
51
84
|
export declare function released(text: string): string;
|
|
52
|
-
/** What a SKILL.md or a draft's README.md says of itself
|
|
53
|
-
*
|
|
85
|
+
/** What a SKILL.md or a draft's README.md says of itself, the one reader of it (frontMatter), the server's and, through
|
|
86
|
+
* the folder's snapshot, the console's: `pending` while it waits for its owner's OK, `retired` once a person retired
|
|
87
|
+
* it, `active` when it sets no status or `active`. A front matter that does not read one way, or a status that is none
|
|
88
|
+
* of these, is `retired`: never active, since another reader could read it as held or retired; no run is given it, and
|
|
89
|
+
* a restore refuses it until it reads one way. A run is given only an active one. */
|
|
54
90
|
export declare function learnedStatus(text: string): "active" | "pending" | "retired";
|
|
55
91
|
/** `text`, a SKILL.md or a draft's README.md, as a person's retire leaves it: `status: retired` last in its front matter
|
|
56
92
|
* (any status line before it dropped), so no later run is given it. Throws on a text with no front matter. */
|
|
@@ -59,11 +95,65 @@ export declare function retiredLearned(text: string): string;
|
|
|
59
95
|
export declare const readmeOf: (name: string, description: string) => string;
|
|
60
96
|
/** A workflow block's two files: its `description:` front matter written as the draft's README.md (readmeOf), and the
|
|
61
97
|
* JSON after it as its workflow.json. A block with no front matter, or none that says what the draft is for, gives a
|
|
62
|
-
* README with no description, which the checker refuses; what the JSON holds is the checker's to judge.
|
|
98
|
+
* README with no description, which the checker refuses; what the JSON holds is the checker's to judge. `example`, its
|
|
99
|
+
* `example:` front matter line as written (the run's own input to the workflow, one JSON object): what its dry run runs
|
|
100
|
+
* on (draftDryRun), and never a file's: the README holds its name and description alone, so the run's input, which can
|
|
101
|
+
* be a customer's data, is never kept in the learning folder. */
|
|
63
102
|
export declare function draftFiles(name: string, block: string): {
|
|
64
103
|
json: string;
|
|
65
104
|
readme: string;
|
|
105
|
+
example?: string;
|
|
66
106
|
};
|
|
107
|
+
/** How a draft's dry run went (draftDryRun): `passed`, the path its one input took ran on synthetic values (not every
|
|
108
|
+
* branch or body); `not_run`, a check could not run (`detail` says which), so it is no proof; `failed`, `detail` says
|
|
109
|
+
* where. */
|
|
110
|
+
export type DraftDryRun = {
|
|
111
|
+
readonly status: "passed" | "not_run" | "failed";
|
|
112
|
+
readonly detail?: string;
|
|
113
|
+
};
|
|
114
|
+
/** The words a draft that failed its dry run is left out with, before why: a re-ask reads them (reflect-hook.ts). */
|
|
115
|
+
export declare const DRY_RUN_FAILED = "its dry run failed";
|
|
116
|
+
/** The most of a value a draft's dry run may synthesize from one of its schemas (the DSL's synthesizeInstance builds
|
|
117
|
+
* each in the host, before any step it counts): an array's minItems and a string's minLength each, and the values and
|
|
118
|
+
* string characters the schema's whole synthesized instance holds. Past any of them the draft is refused statically
|
|
119
|
+
* (draftProblems), and a dry run handed one anyway stands down as not run before anything is built (draftDryRun). */
|
|
120
|
+
export declare const SYNTH_MIN_ITEMS = 100;
|
|
121
|
+
export declare const SYNTH_MIN_LENGTH = 1000;
|
|
122
|
+
export declare const SYNTH_VALUES = 2000;
|
|
123
|
+
export declare const SYNTH_CHARS = 64000;
|
|
124
|
+
type Synthesized = {
|
|
125
|
+
values: number;
|
|
126
|
+
chars: number;
|
|
127
|
+
};
|
|
128
|
+
/** What the DSL's synthesizeInstance would build of `schema` over `definitions`, counted without building it. */
|
|
129
|
+
export declare const synthesizedSize: (schema: unknown, definitions?: Readonly<Record<string, unknown>>) => Synthesized;
|
|
130
|
+
/** The most iterations one loop of a learned draft may run (its maxIters), and the most nested loops may run together
|
|
131
|
+
* (their maxIters multiplied, outermost to innermost). A loop's iterations are work the dry run does in the host whether
|
|
132
|
+
* or not its body asks a model (an empty map, a predicate), so they are bounded here, not only by the dry run's steps. */
|
|
133
|
+
export declare const LEARNED_MAX_ITERS = 50;
|
|
134
|
+
export declare const LEARNED_LOOP_ITERS = 1000;
|
|
135
|
+
/** Why `doc`'s loops could run too long: a loop whose maxIters is past LEARNED_MAX_ITERS, or nested loops whose maxIters
|
|
136
|
+
* multiply past LEARNED_LOOP_ITERS, a composed workflow node's child's included. Read from the JSON alone, at node
|
|
137
|
+
* positions only (eachWorkflow): a literal shaped like a loop is data. */
|
|
138
|
+
export declare function loopProblems(doc: unknown): string[];
|
|
139
|
+
/** How the dry run resolves a schema before it synthesizes it (the DSL's resolveSchemaForWorkflow): its `$ref`s to the
|
|
140
|
+
* workflow's other schemas filled into its definitions, whatever definitions it gives of its own. */
|
|
141
|
+
export type SchemaResolver = {
|
|
142
|
+
readonly resolveSchemaForWorkflow: typeof resolveSchemaForWorkflow;
|
|
143
|
+
};
|
|
144
|
+
/** Why a dry run of `doc` would build too much in the host: a schema whose minItems or minLength is past its cap, or
|
|
145
|
+
* whose synthesized instance holds more values or characters than SYNTH_VALUES or SYNTH_CHARS. Empty when none. Each
|
|
146
|
+
* schema is counted as the dry run reads it, after the same resolution (`dsl.resolveSchemaForWorkflow`), so a `$ref` a
|
|
147
|
+
* schema's own (even empty) definitions would hide is counted as the dry run fills it in. Building nothing. */
|
|
148
|
+
export declare function synthesisProblems(doc: unknown, dsl: SchemaResolver): string[];
|
|
149
|
+
/** A draft's workflow.json `json` dry-run by the workflow DSL (dryRunWorkflow) on `example` (its block's `example:`
|
|
150
|
+
* line, one JSON object), else on an input synthesized from its input schema. Every model, Jev and tool-call answer is
|
|
151
|
+
* synthesized from the node's output schema: no request is sent, nothing is paid, no tool runs, and no code it holds
|
|
152
|
+
* runs in this process (refuseCode). Only a draft the static checks pass is dry-run (propose.ts). It checks the wiring
|
|
153
|
+
* at run time (the state each step reads, its output's path and schema), never the answers. */
|
|
154
|
+
export declare function draftDryRun(dsl: {
|
|
155
|
+
readonly dryRunWorkflow: typeof dryRunWorkflow;
|
|
156
|
+
} & SchemaResolver, json: string, example?: string): Promise<DraftDryRun>;
|
|
67
157
|
/** The refusal for a draft that names a tool when the host gave no tool list: the check fails closed. */
|
|
68
158
|
export declare const NO_TOOL_LIST = "no tool list was given, so a draft that names a tool is refused";
|
|
69
159
|
export type DraftProblem = {
|
|
@@ -72,7 +162,7 @@ export type DraftProblem = {
|
|
|
72
162
|
};
|
|
73
163
|
/** What a draft is read with: the workflow DSL's own validation and inspection. The caller loads the DSL (`await
|
|
74
164
|
* import("@parcha/agentrun-dsl")`), which the server only ever loads when it needs it, and hands it here. */
|
|
75
|
-
export type DraftReader = {
|
|
165
|
+
export type DraftReader = SchemaResolver & {
|
|
76
166
|
readonly validateWorkflow: typeof validateWorkflow;
|
|
77
167
|
readonly inspectWorkflow: typeof inspectWorkflow;
|
|
78
168
|
readonly desugarWorkflow: typeof desugarWorkflow;
|
|
@@ -90,6 +180,14 @@ export declare const LEARNED_NODES = "a learned workflow runs model and tool-cal
|
|
|
90
180
|
/** Where a deny was set (tool-gate.ts SettingFrom), and its words (tool-gate.ts denyPlace), kept here so the learn
|
|
91
181
|
* module needs no import of the gate. */
|
|
92
182
|
type SettingFrom = "agent" | "server" | "default";
|
|
183
|
+
/** Every string a learned workflow's workflow.json decodes to, each object's keys too, as JSON.parse reads them (its
|
|
184
|
+
* escapes decoded: what draftProblems and a learned call's run read, and a model node is given). Text a scan of the
|
|
185
|
+
* stored JSON misses, spelled in \u escapes, is there as it will be read. None for a text that does not parse (the
|
|
186
|
+
* checks refuse it as no workflow). */
|
|
187
|
+
export declare function decodedStrings(json: string): string[] | "too_deep";
|
|
188
|
+
/** How deep a learned workflow's JSON may nest (decodedStrings): far past any workflow the DSL writes, a node's schemas
|
|
189
|
+
* included, and short of what a walk of it could not bound. */
|
|
190
|
+
export declare const DECODED_DEPTH = 100;
|
|
93
191
|
/** The most turns a learned workflow's model node runs (learned-workflow.ts hands its runner this cap): an agent node
|
|
94
192
|
* that asks for more is refused at learn time and before a call, never when it comes up after earlier nodes spent. */
|
|
95
193
|
export declare const LEARNED_MAX_TURNS = 8;
|