@parcha/agentrun-serve 0.1.0-beta.59 → 0.1.0-beta.60
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 +77 -0
- package/README.md +188 -106
- package/dist/agent-delete.d.ts +6 -9
- package/dist/agent-delete.js +5 -3
- package/dist/agent-package.js +11 -1
- package/dist/api-only.d.ts +2 -2
- package/dist/api-only.js +3 -3
- package/dist/archil-routes.d.ts +4 -1
- package/dist/archil-routes.js +15 -12
- package/dist/archil-settings.d.ts +18 -8
- package/dist/archil-settings.js +35 -17
- package/dist/chatgpt-plan.d.ts +4 -2
- package/dist/chatgpt-plan.js +13 -3
- package/dist/claude-login-token.d.ts +5 -0
- package/dist/claude-login-token.js +8 -0
- package/dist/claude-login.d.ts +49 -3
- package/dist/claude-login.js +140 -10
- package/dist/cli-learning/connections.js +1 -1
- package/dist/console/assets/{backend-BztxEAvb.js → backend-QnwGVBeU.js} +1 -1
- package/dist/console/assets/index-DZi-muIj.js +629 -0
- package/dist/console/assets/{share-L84tlUDW.js → share-pz61zIn9.js} +2 -2
- package/dist/console/assets/{styles-CaRKlHke.js → styles-CcceGcu2.js} +31 -31
- package/dist/console/assets/styles-fjQBFfMv.css +1 -0
- package/dist/console/index.html +3 -3
- package/dist/console/share.html +3 -3
- package/dist/decisions.d.ts +1 -1
- package/dist/decisions.js +2 -2
- package/dist/factory-activity.d.ts +68 -0
- package/dist/factory-activity.js +153 -0
- package/dist/factory-runs.d.ts +11 -0
- package/dist/factory-runs.js +52 -0
- package/dist/filed-tool.d.ts +32 -0
- package/dist/filed-tool.js +122 -0
- package/dist/harness-keys.d.ts +1 -2
- package/dist/harness-keys.js +1 -2
- package/dist/harness-table.d.ts +4 -0
- package/dist/harness-table.js +4 -0
- package/dist/harness.js +6 -2
- package/dist/import-worker.js +2 -2
- package/dist/import.d.ts +9 -0
- package/dist/import.js +11 -1
- package/dist/key-refusal.d.ts +5 -0
- package/dist/key-refusal.js +25 -15
- package/dist/learn/audit.d.ts +20 -22
- package/dist/learn/audit.js +72 -55
- package/dist/learn/check.js +1 -1
- package/dist/learn/commit.d.ts +35 -43
- package/dist/learn/commit.js +62 -270
- package/dist/learn/compile.d.ts +4 -4
- package/dist/learn/compile.js +6 -7
- package/dist/learn/corrections.js +1 -1
- package/dist/learn/delete.d.ts +5 -12
- package/dist/learn/delete.js +17 -30
- package/dist/learn/forget-run.d.ts +16 -0
- package/dist/learn/forget-run.js +53 -0
- package/dist/learn/index.js +1 -1
- package/dist/learn/learning-of.d.ts +0 -4
- package/dist/learn/learning-of.js +0 -5
- package/dist/learn/{folder.d.ts → legacy/folder.d.ts} +2 -1
- package/dist/learn/{folder.js → legacy/folder.js} +4 -7
- package/dist/learn/legacy/place.d.ts +16 -0
- package/dist/{workspace/learning-workspace.js → learn/legacy/place.js} +12 -42
- package/dist/learn/legacy/scrub.d.ts +28 -0
- package/dist/learn/legacy/scrub.js +258 -0
- package/dist/learn/promote.d.ts +40 -66
- package/dist/learn/promote.js +69 -207
- package/dist/learn/reset-ledger.d.ts +18 -0
- package/dist/learn/reset-ledger.js +14 -0
- package/dist/learn/rows.d.ts +186 -0
- package/dist/learn/rows.js +376 -0
- package/dist/learn/workflow-draft.d.ts +4 -1
- package/dist/learn/workflow-draft.js +12 -2
- package/dist/learning-reset.d.ts +1 -1
- package/dist/learning-reset.js +9 -11
- package/dist/learning-routes.d.ts +60 -81
- package/dist/learning-routes.js +187 -360
- package/dist/learning-words.d.ts +2 -0
- package/dist/learning-words.js +2 -0
- package/dist/learning.d.ts +18 -24
- package/dist/learning.js +35 -66
- package/dist/mcp-gateway.d.ts +6 -0
- package/dist/mcp-gateway.js +44 -8
- package/dist/mcp-resources.d.ts +1 -1
- package/dist/native/discovery.d.ts +6 -0
- package/dist/native/discovery.js +14 -1
- package/dist/native/remote.d.ts +5 -0
- package/dist/native/remote.js +16 -0
- package/dist/native/runtime.js +3 -2
- package/dist/observation/observer.d.ts +6 -6
- package/dist/openapi.js +89 -29
- package/dist/place-offers.d.ts +3 -0
- package/dist/place-offers.js +3 -0
- package/dist/place.d.ts +33 -11
- package/dist/place.js +61 -26
- package/dist/purged-workflow.d.ts +0 -33
- package/dist/purged-workflow.js +3 -71
- package/dist/redact/match.d.ts +19 -4
- package/dist/redact/match.js +123 -30
- package/dist/run-launch.d.ts +3 -3
- package/dist/run-learning-served.d.ts +3 -3
- package/dist/run-learning-served.js +1 -1
- package/dist/run-listing.d.ts +1 -1
- package/dist/run-timeline-served.d.ts +1 -1
- package/dist/run-timeline-served.js +6 -5
- package/dist/runnable.js +25 -8
- package/dist/runner/adapter-run-spec.js +11 -20
- package/dist/runner/audit.d.ts +2 -4
- package/dist/runner/audit.js +28 -51
- package/dist/runner/cli-run-spec.js +8 -14
- package/dist/runner/compare-end.d.ts +0 -2
- package/dist/runner/compare-end.js +6 -2
- package/dist/runner/disk-free.d.ts +15 -4
- package/dist/runner/disk-free.js +25 -7
- package/dist/runner/feedback-round.d.ts +1 -1
- package/dist/runner/feedback-round.js +2 -2
- package/dist/runner/harness-loops.js +2 -3
- package/dist/runner/held.d.ts +0 -10
- package/dist/runner/held.js +0 -25
- package/dist/runner/journal-kinds.d.ts +4 -1
- package/dist/runner/journal-kinds.js +1 -1
- package/dist/runner/learned-first.d.ts +0 -2
- package/dist/runner/learned-first.js +3 -3
- package/dist/runner/learning-end.d.ts +12 -16
- package/dist/runner/learning-end.js +41 -75
- package/dist/runner/learning-seed.d.ts +13 -16
- package/dist/runner/learning-seed.js +13 -23
- package/dist/runner/main.js +1 -1
- package/dist/runner/mcp-run.d.ts +4 -0
- package/dist/runner/mcp-run.js +2 -0
- package/dist/runner/native-loop.js +2 -3
- package/dist/runner/promotion.d.ts +19 -28
- package/dist/runner/promotion.js +50 -69
- package/dist/runner/reflect-hook.d.ts +2 -2
- package/dist/runner/reflect-hook.js +4 -1
- package/dist/runner/run-child-host.d.ts +1 -9
- package/dist/runner/run-child-host.js +11 -67
- package/dist/runner/runner.d.ts +1 -1
- package/dist/runner/sdk-loop.js +2 -4
- package/dist/sdk/check.d.ts +1 -4
- package/dist/sdk/check.js +2 -3
- package/dist/sdk/runs.d.ts +20 -7
- package/dist/sdk/runs.js +105 -68
- package/dist/secrets.d.ts +4 -0
- package/dist/secrets.js +44 -10
- package/dist/server-fs.d.ts +1 -1
- package/dist/server-fs.js +1 -1
- package/dist/server-keys.d.ts +6 -0
- package/dist/server-keys.js +12 -0
- package/dist/server.d.ts +15 -15
- package/dist/server.js +214 -164
- package/dist/source-sync/auxiliary.js +2 -2
- package/dist/store/index.d.ts +1 -1
- package/dist/store/index.js +1 -1
- package/dist/store/postgres/migrations/0032_learning_rows.sql +65 -0
- package/dist/store/schema.d.ts +28 -2
- package/dist/store/schema.js +81 -5
- package/dist/store/sqlite/learning-rows.d.ts +23 -0
- package/dist/store/sqlite/learning-rows.js +559 -0
- package/dist/store/sqlite/store.d.ts +7 -1
- package/dist/store/sqlite/store.js +84 -18
- package/dist/store/store.d.ts +219 -6
- package/dist/store/store.js +13 -0
- package/dist/store-reads/journal.d.ts +33 -3
- package/dist/store-reads/journal.js +99 -4
- package/dist/store-reads/learning.d.ts +18 -22
- package/dist/store-reads/learning.js +35 -26
- package/dist/store-reads/loop.js +1 -1
- package/dist/store-view.d.ts +24 -2
- package/dist/store-view.js +40 -11
- package/dist/templates.d.ts +10 -2
- package/dist/templates.js +31 -4
- package/dist/tool-plane.d.ts +4 -2
- package/dist/tool-plane.js +9 -2
- package/dist/web-holds.d.ts +2 -0
- package/dist/web-holds.js +5 -2
- package/dist/web-run.js +2 -1
- package/dist/workspace/archil-exec.js +1 -1
- package/dist/workspace/archil.d.ts +1 -1
- package/dist/workspace/archil.js +1 -1
- package/dist/workspace/computer-deps.js +5 -3
- package/dist/workspace/computer-providers.d.ts +11 -1
- package/dist/workspace/computer-providers.js +29 -2
- package/dist/workspace/index.d.ts +1 -2
- package/dist/workspace/index.js +1 -2
- package/dist/workspace/paths.d.ts +0 -4
- package/dist/workspace/paths.js +0 -6
- package/dist/workspace/workspace.d.ts +1 -1
- package/dist/workspace/workspace.js +1 -1
- package/package.json +13 -13
- package/templates/TOOLS.md +46 -0
- package/dist/console/assets/index-LwNL4L9q.js +0 -619
- package/dist/console/assets/styles-DQo8rzY-.css +0 -1
- package/dist/workspace/learning-workspace.d.ts +0 -24
- /package/dist/learn/{learning.sh → legacy/learning.sh} +0 -0
package/dist/learning-reset.js
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
// DELETE /v2/agents/{agent_id}/learning: an agent's learning reset, the agent kept. What it learned goes (the learning
|
|
2
|
-
// module's deleteLearning: its learning
|
|
3
|
-
// on every Archil disk its runs used, learn/learning-of.ts namedDisksOf, then its promotions and grades); the agent, its
|
|
2
|
+
// module's deleteLearning: its learning rows, every save, note, workflow, promotion record, grade and audit row); the agent, its
|
|
4
3
|
// definition, its runs and everything kept of them (their files, journals, costs, the learning each one kept) stay, so
|
|
5
4
|
// the run list, the stats and the usage read the same before and after. A served run's cost carries its share of its
|
|
6
5
|
// revision's compile and check, read from the promotion records the reset deletes: each revision they name is kept
|
|
7
6
|
// first in the agent's reset ledger (learn/promote.ts keepResetLedger: workflow, digest and K alone), so the share reads
|
|
8
7
|
// the same after.
|
|
9
8
|
//
|
|
10
|
-
// What goes with the
|
|
11
|
-
// so it is 404 after; what the run's own record keeps of its learning end stays with the run.
|
|
9
|
+
// What goes with the rows: each run's learning diff (GET /runs/{id}/learning/diff, the text it merged) is read from its
|
|
10
|
+
// save, so it is 404 after; what the run's own record keeps of its learning end stays with the run.
|
|
12
11
|
//
|
|
13
12
|
// In order, in the agent's delete turn (server.ts agentWrite: one learning write of an agent at a time, and none once
|
|
14
13
|
// its DELETE began):
|
|
@@ -18,18 +17,17 @@
|
|
|
18
17
|
// a workflow it may be served, its compile turn and look-back at its end), and the owner's job is never cancelled
|
|
19
18
|
// to reset learning. Any such run, or a learning run this server cannot end (an SDK run, an imported one) or one
|
|
20
19
|
// not final by the wait's end, is 409 learning_busy, naming them, and the agent's learning is left as it was.
|
|
21
|
-
// 2. In the agent's learning queue (learning.ts
|
|
22
|
-
// commits), the agent's runs are read again: one still going (a run started meanwhile) is 409 learning_busy, nothing
|
|
20
|
+
// 2. In the agent's learning queue (learning.ts inLearningQueue, where a run's start reads its seed), the agent's runs are read again: one still going (a run started meanwhile) is 409 learning_busy, nothing
|
|
23
21
|
// deleted. Then deleteLearning, which reads them once more itself.
|
|
24
22
|
// Idempotent: an agent that never learned, or one reset already, has nothing to delete, and is answered as done.
|
|
25
23
|
//
|
|
26
24
|
// Step 2 sets the agent's reset watermark (learn/promote.ts resetAtKey) before it deletes: from then on learning reads
|
|
27
25
|
// only runs after it (learn/compile.ts sinceReset: compile_after's count, a compile's traces, a check's inputs, an
|
|
28
|
-
// audit's draws, the money rule). A run whose start read
|
|
26
|
+
// audit's draws, the money rule). A run whose start read its seed before step 2
|
|
29
27
|
// and whose row the store wrote after it keeps what it was started with (its corrections are in its launch), but
|
|
30
28
|
// learns nothing: its seed was read before the watermark, so its learning end drops it whole at its entry
|
|
31
|
-
// (runner/learning-end.ts, reason `reset`), and the
|
|
32
|
-
// (learning
|
|
29
|
+
// (runner/learning-end.ts, reason `reset`), and the store refuses a save on a seed the agent's learning no longer holds
|
|
30
|
+
// (Store.learning save). No workflow is laid for it either: they are read at its seed's save, which is gone.
|
|
33
31
|
import { ApiError } from "./errors.js";
|
|
34
32
|
import { LearningInFlight } from "./learn/delete.js";
|
|
35
33
|
import { isShadowRun } from "./learn/audit.js";
|
|
@@ -68,7 +66,7 @@ export async function resetLearning(host, agentId) {
|
|
|
68
66
|
if (still.length)
|
|
69
67
|
throw busy(agentId, still.map((run) => run.id), still.some((run) => !run.learning) ? OWN(still.filter((run) => !run.learning).length) : "its learning work started again");
|
|
70
68
|
// What the agent's kept runs carry of their revisions' compile and check, kept before the records it is read from go.
|
|
71
|
-
await keepResetLedger(host.store.settings, agentId, await promotionsOf(host.store.
|
|
69
|
+
await keepResetLedger(host.store.settings, agentId, await promotionsOf(host.store.learning, agentId));
|
|
72
70
|
// The watermark, before anything goes: learning reads no run that started, or read its seed, at or before it (each
|
|
73
71
|
// seed is read in this queue, so one read before this moment never holds a later time). A seed read after the reset
|
|
74
72
|
// in the same millisecond counts as before it: its run learns nothing (reason reset) and an SDK start is refused, to
|
|
@@ -80,7 +78,7 @@ export async function resetLearning(host, agentId) {
|
|
|
80
78
|
const at = Date.now();
|
|
81
79
|
await keepResetAt(host.store.settings, agentId, at);
|
|
82
80
|
try {
|
|
83
|
-
await host.deleteLearning(host.store, agentId, { keepResetLedger: true
|
|
81
|
+
await host.deleteLearning(host.store, agentId, { keepResetLedger: true });
|
|
84
82
|
}
|
|
85
83
|
catch (error) {
|
|
86
84
|
if (!(error instanceof LearningInFlight))
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { IncomingMessage, ServerResponse } from "node:http";
|
|
2
2
|
import { type DraftDecisions } from "./learn/workflow-draft.js";
|
|
3
|
-
import { type
|
|
3
|
+
import { type ItemHistory, type LearningRows, type LogChange } from "./learn/rows.js";
|
|
4
4
|
import type { ServingState } from "./learn/promote.js";
|
|
5
5
|
import { type ItemStatus, type Learning, type Shown } from "./learning.js";
|
|
6
6
|
import type { Impact } from "./learning-run.js";
|
|
@@ -21,32 +21,21 @@ type Retired = {
|
|
|
21
21
|
from?: "active" | "pending";
|
|
22
22
|
why?: "unreadable";
|
|
23
23
|
};
|
|
24
|
-
type Change =
|
|
25
|
-
by: {
|
|
26
|
-
run: string;
|
|
27
|
-
} | {
|
|
28
|
-
user: true;
|
|
29
|
-
via?: string;
|
|
30
|
-
};
|
|
31
|
-
commit: string;
|
|
32
|
-
at: string;
|
|
33
|
-
reason: string;
|
|
34
|
-
files: string[];
|
|
35
|
-
};
|
|
24
|
+
type Change = LogChange;
|
|
36
25
|
export type Counts = {
|
|
37
26
|
merged: number;
|
|
38
27
|
dropped: Record<string, number>;
|
|
39
28
|
in_progress: number;
|
|
40
29
|
};
|
|
41
30
|
export { secretsShown, type Shown } from "./learning.js";
|
|
31
|
+
/** The store's learning, as these routes read and write it. */
|
|
32
|
+
type Rows = {
|
|
33
|
+
readonly learning: LearningRows;
|
|
34
|
+
};
|
|
42
35
|
export declare const etagOf: (oid: string) => string;
|
|
43
|
-
/** Run `runId`'s text taken off agent `agentId`'s learning folder's current files at its purge (learn/commit.ts
|
|
44
|
-
* forgetRunText: a workflow it changed last goes back to the version before it that no purged run of `store` wrote),
|
|
45
|
-
* in the agent's queue, as every write of the folder is. */
|
|
46
|
-
export declare function forgetRunLearning(data: string, agentId: string, runId: string, store: Pick<Store, "runs">): Promise<void>;
|
|
47
36
|
/** A workflow draft as the view lists it: its folder's name, its workflow.json with its `readme`, its description, its
|
|
48
|
-
* status, the run whose
|
|
49
|
-
*
|
|
37
|
+
* status, the run whose text it is, its size in bytes, and the ETag of its README.md (the file that says whether it
|
|
38
|
+
* waits, which an approval names); cut of the host's secrets (a name or a file holding one reads [redacted]).
|
|
50
39
|
* `status` is one word: its README.md's `pending` or `retired`, else where it stands as the promotions read says it
|
|
51
40
|
* (`stateOf`, learn/promote.ts servingStateOf): `serving`, `checking`, `held` or `stopped`. */
|
|
52
41
|
type WorkflowView = {
|
|
@@ -59,25 +48,26 @@ type WorkflowView = {
|
|
|
59
48
|
bytes: number;
|
|
60
49
|
etag: string;
|
|
61
50
|
retired?: Retired;
|
|
62
|
-
last_change?:
|
|
51
|
+
last_change?: ItemHistory["last"];
|
|
63
52
|
};
|
|
64
|
-
/** For tests: how many times
|
|
53
|
+
/** For tests: how many times an agent's statuses were read (once per save of its learning). */
|
|
65
54
|
export declare const pendingTestHooks: {
|
|
66
55
|
reads: number;
|
|
67
56
|
};
|
|
68
|
-
/** Each workflow draft's status
|
|
69
|
-
* `active`, `pending` or `retired`. Built once per
|
|
70
|
-
*
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
*
|
|
57
|
+
/** Each workflow draft's status at agent `agentId`'s newest save, by its workflow.json (as its README.md says it):
|
|
58
|
+
* `active`, `pending` or `retired`. Built once per save (a list asks for many runs): the newest save's id (of any kind,
|
|
59
|
+
* a purge's too) is read first, and the view, its items and their history, only when it moved. An agent with no save
|
|
60
|
+
* holds none; one whose learning cannot be read is undefined. */
|
|
61
|
+
export declare function statusesOf(rows: {
|
|
62
|
+
readonly learning: LearningRows & Pick<Store["learning"], "newestSave">;
|
|
63
|
+
}, agentId: string): Promise<ReadonlyMap<string, ItemStatus> | undefined>;
|
|
64
|
+
/** How many of agent `agentId`'s workflow drafts wait for its owner's OK at its newest save (statusesOf). An agent with
|
|
65
|
+
* no save has none waiting; one that cannot be read is undefined (the caller shows no count). */
|
|
66
|
+
export declare function pendingCount(rows: Parameters<typeof statusesOf>[0], agentId: string): Promise<number | undefined>;
|
|
67
|
+
/** GET /agents/{id}/learning: its newest save, its corrections.md, its workflow drafts and the first page of its log, and
|
|
68
|
+
* how the agent's runs fared and what learning changed for them (`counts`, `impact`); an agent with no save (its learning
|
|
77
69
|
* never on) has an empty one. `stateOf`: where each workflow neither pending nor retired stands, by its folder name (the
|
|
78
|
-
* promotions read's own word: learn/promote.ts servingStateOf over the agent's records).
|
|
79
|
-
* (purged-workflow.ts purgeGate, over `store`'s runs): no workflow a purged run wrote, and no purged run's merge in its
|
|
80
|
-
* log. */
|
|
70
|
+
* promotions read's own word: learn/promote.ts servingStateOf over the agent's records). */
|
|
81
71
|
type AgentView = {
|
|
82
72
|
agent: string;
|
|
83
73
|
main: string | null;
|
|
@@ -87,13 +77,13 @@ type AgentView = {
|
|
|
87
77
|
counts: Counts;
|
|
88
78
|
impact: Impact;
|
|
89
79
|
};
|
|
90
|
-
export declare function agentLearning(
|
|
91
|
-
/** GET /agents/{id}/learning/log?cursor=&limit=: a page of the
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
*
|
|
96
|
-
export declare function correctionsView(
|
|
80
|
+
export declare function agentLearning(rows: Rows, agentId: string, shown: Shown, counts: Counts, impact: Impact, stateOf: (workflow: string) => ServingState): Promise<AgentView>;
|
|
81
|
+
/** GET /agents/{id}/learning/log?cursor=&limit=: a page of the agent's log, newest first. */
|
|
82
|
+
export declare function learningLog(rows: Rows, agentId: string, query: URLSearchParams, shown: Shown): Promise<Page<Change>>;
|
|
83
|
+
/** GET /agents/{id}/learning/corrections: corrections.md at the newest save as text (empty when it holds none), its ETag
|
|
84
|
+
* (its blob 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
|
|
85
|
+
* is. */
|
|
86
|
+
export declare function correctionsView(rows: Rows, agentId: string, shown: Shown): Promise<{
|
|
97
87
|
text: string;
|
|
98
88
|
etag: string;
|
|
99
89
|
cap_bytes: number;
|
|
@@ -102,8 +92,8 @@ export declare function correctionsView(data: string, agentId: string, shown: Sh
|
|
|
102
92
|
* read (`ifMatch`: its ETag; none, or `*`, is 428; another version is 412). Refused whole, nothing written, when it holds
|
|
103
93
|
* what must never be stored (a host secret, text shaped like one, a hidden character) or passes the cap (422 with the
|
|
104
94
|
* problems, printable). A text read cut of a secret and sent back replaces the secret with the cut: a person's write never
|
|
105
|
-
* puts a secret back.
|
|
106
|
-
export declare function correctionsWrite(
|
|
95
|
+
* puts a secret back. One save. */
|
|
96
|
+
export declare function correctionsWrite(rows: Rows, agentId: string, input: {
|
|
107
97
|
text: string;
|
|
108
98
|
ifMatch?: string;
|
|
109
99
|
refuse: readonly string[];
|
|
@@ -112,8 +102,8 @@ export declare function correctionsWrite(data: string, agentId: string, input: {
|
|
|
112
102
|
etag: string;
|
|
113
103
|
cap_bytes: number;
|
|
114
104
|
}>;
|
|
115
|
-
/** One revision of a learned workflow: a
|
|
116
|
-
*
|
|
105
|
+
/** One revision of a learned workflow: a save that changed its workflow.json, with its text there (null when the save
|
|
106
|
+
* deleted it), cut of the host's secrets. */
|
|
117
107
|
type WorkflowRevision = {
|
|
118
108
|
commit: string;
|
|
119
109
|
at: string;
|
|
@@ -123,33 +113,26 @@ type WorkflowRevision = {
|
|
|
123
113
|
digest: string | null;
|
|
124
114
|
};
|
|
125
115
|
/** GET /agents/{id}/learning/workflows/{name}/revisions?limit=: the latest revisions of learned workflow `name` (the
|
|
126
|
-
*
|
|
127
|
-
*
|
|
128
|
-
*
|
|
129
|
-
* LOG_KEEP changes). A purged run's merge is no revision (purgeGate). A workflow no commit of the log changed is
|
|
116
|
+
* saves that changed `workflows/<name>/workflow.json`), oldest first, each with the workflow's text there, so a person
|
|
117
|
+
* can step through how it changed: at most `limit` of them. `total` counts every such save; `truncated` is false, the
|
|
118
|
+
* rows keep every one. A purged run's save is no revision: its rows went with it. A workflow no save changed is
|
|
130
119
|
* not_found. */
|
|
131
|
-
export declare function workflowRevisions(
|
|
120
|
+
export declare function workflowRevisions(rows: Rows, agentId: string, name: string, query: URLSearchParams, shown: Shown): Promise<{
|
|
132
121
|
name: string;
|
|
133
122
|
revisions: WorkflowRevision[];
|
|
134
123
|
total: number;
|
|
135
124
|
truncated: boolean;
|
|
136
125
|
}>;
|
|
137
126
|
/** Learned workflow `name`'s text at `digest` (a champion's, as its promotion records name it), read by that digest and
|
|
138
|
-
* never by paging the workflow's history:
|
|
139
|
-
*
|
|
140
|
-
|
|
141
|
-
* old. One read-only exec per commit tried (textsAt), and one more for the commit that holds the digest, unless
|
|
142
|
-
* it is main (snapshotAt). */
|
|
143
|
-
export declare function workflowAtDigest(data: string, agentId: string, name: string, digest: string, commits: readonly string[], store: Pick<Store, "runs">): Promise<{
|
|
127
|
+
* never by paging the workflow's history: its newest version whose workflow.json is that digest's, with the save it was
|
|
128
|
+
* written at. Undefined when none is. */
|
|
129
|
+
export declare function workflowAtDigest(rows: Rows, agentId: string, name: string, digest: string): Promise<{
|
|
144
130
|
text: string;
|
|
145
131
|
commit: string;
|
|
146
132
|
} | undefined>;
|
|
147
|
-
/** GET /agents/{id}/learning/files/{file}: a draft's file
|
|
148
|
-
* JSON). A purged run's workflow
|
|
149
|
-
|
|
150
|
-
* purge took the folder's text, until its DELETE is sent again) is 410 purged, as every route of that run is
|
|
151
|
-
* (purgeGate). */
|
|
152
|
-
export declare function readLearnedFile(data: string, agentId: string, raw: string, shown: Shown, store: Pick<Store, "runs">): Promise<{
|
|
133
|
+
/** GET /agents/{id}/learning/files/{file}: a draft's file at the newest save as text, its ETag, and its type
|
|
134
|
+
* (workflow.json is JSON). A purged run's workflow went with its rows, so its files are the 404 any missing file is. */
|
|
135
|
+
export declare function readLearnedFile(rows: Rows, agentId: string, raw: string, shown: Shown): Promise<{
|
|
153
136
|
text: string;
|
|
154
137
|
etag: string;
|
|
155
138
|
type?: string;
|
|
@@ -174,22 +157,18 @@ type DraftTools = () => Promise<{
|
|
|
174
157
|
decisions?: DraftDecisions;
|
|
175
158
|
}>;
|
|
176
159
|
/** POST /agents/{id}/learning/files/{file}/approve, .../retire or .../restore, as a person, on a draft's README.md
|
|
177
|
-
* (`file`): If-Match on the version read (none, or `*`, is 428; another is 412), then one
|
|
178
|
-
*
|
|
179
|
-
*
|
|
180
|
-
*
|
|
181
|
-
*
|
|
182
|
-
*
|
|
183
|
-
*
|
|
184
|
-
|
|
185
|
-
* `store`'s runs): no person's change gives it to a run; a retire takes it out as any other. `refuse`: the host's
|
|
186
|
-
* secrets. */
|
|
187
|
-
export declare function changeWorkflow(data: string, agentId: string, raw: string, input: {
|
|
160
|
+
* (`file`): If-Match on the version read (none, or `*`, is 428; another is 412), then one save of the agent's learning
|
|
161
|
+
* (learn/rows.ts writeLearning), its reason `<approved|retired|restored> by a person: <file>`, and an approval's said to
|
|
162
|
+
* come through the console. An approval releases a held draft (status: pending) to every later run; a retire takes it
|
|
163
|
+
* out of every later run unchecked, so a leaking one can always be revoked; a restore brings it back to the status its
|
|
164
|
+
* retire recorded, checked again as a new draft is (secrets' shapes, the host's values, hidden characters, its README's
|
|
165
|
+
* format, its workflow.json against the agent's tools and gate). A retire of a retired draft saves nothing. `refuse`:
|
|
166
|
+
* the host's secrets. */
|
|
167
|
+
export declare function changeWorkflow(rows: Rows, agentId: string, raw: string, input: {
|
|
188
168
|
action: "approve" | "retire" | "restore";
|
|
189
169
|
ifMatch?: string;
|
|
190
170
|
refuse: readonly string[];
|
|
191
171
|
draftTools?: DraftTools;
|
|
192
|
-
store: Pick<Store, "runs">;
|
|
193
172
|
}): Promise<{
|
|
194
173
|
status: 200;
|
|
195
174
|
file: string;
|
|
@@ -207,7 +186,7 @@ export declare function runLearningBody(input: {
|
|
|
207
186
|
}, shown: Shown, secrets: readonly string[]): {
|
|
208
187
|
run: string;
|
|
209
188
|
state: "dropped" | "merged" | "seeded" | "reflecting";
|
|
210
|
-
reason: "cancelled" | "reset" | "
|
|
189
|
+
reason: "cancelled" | "reset" | "seed_failed" | "no_budget" | "unknown_cost" | "crashed" | "reflect_failed" | "empty" | "checker" | "use" | "purged_since_seed" | null;
|
|
211
190
|
detail: string | null;
|
|
212
191
|
at: string;
|
|
213
192
|
workflows: import("./learning.js").LearnedFile[];
|
|
@@ -238,13 +217,13 @@ export declare function runLearningBody(input: {
|
|
|
238
217
|
};
|
|
239
218
|
};
|
|
240
219
|
/** GET /runs/{id}/learning/diff over the one store: once merged (its learning end, store-reads/learning.ts
|
|
241
|
-
* runLearningEnd), its merge
|
|
242
|
-
* its
|
|
243
|
-
*
|
|
244
|
-
*
|
|
245
|
-
*
|
|
246
|
-
export declare function runDiffOverStore(
|
|
247
|
-
base: string;
|
|
220
|
+
* runLearningEnd), its merge's save against the one before it (learn/rows.ts runDiff); a run that merged nothing
|
|
221
|
+
* against the seed its launch's learning start names. A run that does not learn (no learning start and no learning
|
|
222
|
+
* end) is not_found, as a merge its agent's learning no longer holds is. A file's patch is withheld when too large, or
|
|
223
|
+
* when it holds one of the host's secrets now (`shown`); any other is served as every learning text is (`shown.text`:
|
|
224
|
+
* a loopback address reads "a local address"). */
|
|
225
|
+
export declare function runDiffOverStore(store: Store, runId: string, shown: Shown): Promise<{
|
|
226
|
+
base: string | null;
|
|
248
227
|
head: string;
|
|
249
228
|
files: ({
|
|
250
229
|
path: string;
|