@foldrun/core 0.2.0
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/LICENSE +202 -0
- package/README.md +239 -0
- package/dist/index.d.ts +32 -0
- package/dist/index.js +43 -0
- package/dist/src/agent-tools.d.ts +31 -0
- package/dist/src/agent-tools.js +99 -0
- package/dist/src/agents-md.d.ts +9 -0
- package/dist/src/agents-md.js +83 -0
- package/dist/src/api-tools.d.ts +38 -0
- package/dist/src/api-tools.js +313 -0
- package/dist/src/approvals.d.ts +39 -0
- package/dist/src/approvals.js +103 -0
- package/dist/src/arrange.d.ts +8 -0
- package/dist/src/arrange.js +40 -0
- package/dist/src/catalog.d.ts +108 -0
- package/dist/src/catalog.js +255 -0
- package/dist/src/completions.d.ts +61 -0
- package/dist/src/completions.js +578 -0
- package/dist/src/confine.d.ts +31 -0
- package/dist/src/confine.js +298 -0
- package/dist/src/container.d.ts +30 -0
- package/dist/src/container.js +172 -0
- package/dist/src/context-tools.d.ts +81 -0
- package/dist/src/context-tools.js +347 -0
- package/dist/src/deploy.d.ts +100 -0
- package/dist/src/deploy.js +377 -0
- package/dist/src/egress.d.ts +75 -0
- package/dist/src/egress.js +133 -0
- package/dist/src/evals.d.ts +150 -0
- package/dist/src/evals.js +651 -0
- package/dist/src/flow-lint.d.ts +16 -0
- package/dist/src/flow-lint.js +177 -0
- package/dist/src/git-hook.d.ts +1 -0
- package/dist/src/git-hook.js +70 -0
- package/dist/src/git.d.ts +37 -0
- package/dist/src/git.js +101 -0
- package/dist/src/gitrepo.d.ts +95 -0
- package/dist/src/gitrepo.js +355 -0
- package/dist/src/history.d.ts +82 -0
- package/dist/src/history.js +259 -0
- package/dist/src/kinds.d.ts +95 -0
- package/dist/src/kinds.js +421 -0
- package/dist/src/library.d.ts +94 -0
- package/dist/src/library.js +341 -0
- package/dist/src/linkable.d.ts +20 -0
- package/dist/src/linkable.js +113 -0
- package/dist/src/model-probe.d.ts +21 -0
- package/dist/src/model-probe.js +81 -0
- package/dist/src/notify.d.ts +61 -0
- package/dist/src/notify.js +252 -0
- package/dist/src/oauth-presets.d.ts +13 -0
- package/dist/src/oauth-presets.js +39 -0
- package/dist/src/okf.d.ts +220 -0
- package/dist/src/okf.js +656 -0
- package/dist/src/openapi.d.ts +66 -0
- package/dist/src/openapi.js +342 -0
- package/dist/src/paths.d.ts +33 -0
- package/dist/src/paths.js +78 -0
- package/dist/src/platform.d.ts +32 -0
- package/dist/src/platform.js +48 -0
- package/dist/src/providers.d.ts +47 -0
- package/dist/src/providers.js +114 -0
- package/dist/src/refs.d.ts +20 -0
- package/dist/src/refs.js +78 -0
- package/dist/src/run-container.d.ts +227 -0
- package/dist/src/run-container.js +760 -0
- package/dist/src/runner.d.ts +241 -0
- package/dist/src/runner.js +3215 -0
- package/dist/src/runtime.d.ts +41 -0
- package/dist/src/runtime.js +357 -0
- package/dist/src/script-tools.d.ts +62 -0
- package/dist/src/script-tools.js +296 -0
- package/dist/src/secret-files.d.ts +12 -0
- package/dist/src/secret-files.js +92 -0
- package/dist/src/secrets.d.ts +147 -0
- package/dist/src/secrets.js +626 -0
- package/dist/src/starter.d.ts +21 -0
- package/dist/src/starter.js +399 -0
- package/dist/src/step-exec.d.ts +136 -0
- package/dist/src/step-exec.js +391 -0
- package/dist/src/storage.d.ts +123 -0
- package/dist/src/storage.js +640 -0
- package/dist/src/store.d.ts +1052 -0
- package/dist/src/store.js +2378 -0
- package/dist/src/tar.d.ts +30 -0
- package/dist/src/tar.js +111 -0
- package/dist/src/tool-names.d.ts +39 -0
- package/dist/src/tool-names.js +79 -0
- package/dist/src/tool-programs.d.ts +18 -0
- package/dist/src/tool-programs.js +52 -0
- package/dist/src/tool-test.d.ts +19 -0
- package/dist/src/tool-test.js +335 -0
- package/dist/src/translator.d.ts +159 -0
- package/dist/src/translator.js +986 -0
- package/dist/src/triggers.d.ts +60 -0
- package/dist/src/triggers.js +270 -0
- package/dist/src/webhook.d.ts +47 -0
- package/dist/src/webhook.js +148 -0
- package/index.ts +44 -0
- package/package.json +64 -0
- package/src/agent-tools.ts +138 -0
- package/src/agents-md.ts +81 -0
- package/src/api-tools.ts +389 -0
- package/src/approvals.ts +129 -0
- package/src/arrange.ts +42 -0
- package/src/catalog.ts +321 -0
- package/src/completions.ts +652 -0
- package/src/confine.ts +350 -0
- package/src/container.ts +220 -0
- package/src/context-tools.ts +435 -0
- package/src/deploy.ts +458 -0
- package/src/egress.ts +176 -0
- package/src/evals.ts +812 -0
- package/src/flow-lint.ts +215 -0
- package/src/git-hook.ts +73 -0
- package/src/git.ts +117 -0
- package/src/gitrepo.ts +391 -0
- package/src/history.ts +329 -0
- package/src/kinds.ts +507 -0
- package/src/library.ts +419 -0
- package/src/linkable.ts +123 -0
- package/src/model-probe.ts +112 -0
- package/src/notify.ts +281 -0
- package/src/oauth-presets.ts +54 -0
- package/src/okf.ts +768 -0
- package/src/openapi.ts +383 -0
- package/src/paths.ts +79 -0
- package/src/platform.ts +87 -0
- package/src/providers.ts +147 -0
- package/src/refs.ts +83 -0
- package/src/run-container.ts +883 -0
- package/src/runner.ts +3446 -0
- package/src/runtime.ts +404 -0
- package/src/script-tools.ts +383 -0
- package/src/secret-files.ts +101 -0
- package/src/secrets.ts +799 -0
- package/src/starter.ts +415 -0
- package/src/step-exec.ts +498 -0
- package/src/storage.ts +771 -0
- package/src/store.ts +2985 -0
- package/src/tar.ts +124 -0
- package/src/tool-names.ts +91 -0
- package/src/tool-programs.ts +65 -0
- package/src/tool-test.ts +401 -0
- package/src/translator.ts +1029 -0
- package/src/triggers.ts +287 -0
- package/src/webhook.ts +183 -0
- package/templates/blog-desk/AGENTS.md +13 -0
- package/templates/blog-desk/agents/researcher/agent.md +11 -0
- package/templates/blog-desk/agents/writer/agent.md +8 -0
- package/templates/blog-desk/evals/writer-quality.md +10 -0
- package/templates/blog-desk/flows/publish.md +10 -0
- package/templates/blog-desk/knowledge/house-style.md +9 -0
- package/templates/blog-desk/knowledge/index.md +9 -0
- package/templates/hello/AGENTS.md +18 -0
- package/templates/hello/agents/curator/agent.md +32 -0
- package/templates/hello/agents/notetaker/agent.md +24 -0
- package/templates/hello/evals/house-style.md +16 -0
- package/templates/hello/flows/memory-review.md +7 -0
- package/templates/hello/flows/note.md +7 -0
- package/templates/hello/knowledge/house-style.md +15 -0
- package/templates/hello/knowledge/index.md +9 -0
- package/templates/hello/skills/plain-english/SKILL.md +11 -0
- package/templates/hello/state/publishing.md +7 -0
- package/templates/hello/tools/wordcount/run.py +13 -0
- package/templates/hello/tools/wordcount/tool.md +22 -0
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import { type Effort } from "./store.ts";
|
|
2
|
+
export type Assertion = {
|
|
3
|
+
type: "contains";
|
|
4
|
+
value: string;
|
|
5
|
+
} | {
|
|
6
|
+
type: "not-contains";
|
|
7
|
+
value: string;
|
|
8
|
+
} | {
|
|
9
|
+
type: "matches";
|
|
10
|
+
value: string;
|
|
11
|
+
} | {
|
|
12
|
+
type: "file";
|
|
13
|
+
value: string;
|
|
14
|
+
} | {
|
|
15
|
+
type: "run";
|
|
16
|
+
value: string;
|
|
17
|
+
} | {
|
|
18
|
+
type: "judge";
|
|
19
|
+
value: string;
|
|
20
|
+
};
|
|
21
|
+
export interface EvalCase {
|
|
22
|
+
name: string;
|
|
23
|
+
task: string;
|
|
24
|
+
expect: Assertion[];
|
|
25
|
+
}
|
|
26
|
+
export interface EvalInfo {
|
|
27
|
+
name: string;
|
|
28
|
+
file: string;
|
|
29
|
+
/** The agent under test, or null when a flow is. */
|
|
30
|
+
agent: string | null;
|
|
31
|
+
flow: string | null;
|
|
32
|
+
/** Model for the judge. Cases run the agent on its own model. */
|
|
33
|
+
model: string;
|
|
34
|
+
/** Effort for the judge. PASS/FAIL against one sentence is not deep work,
|
|
35
|
+
* so this is one of the few places a low default is the right one. */
|
|
36
|
+
effort: Effort | null;
|
|
37
|
+
/** When it runs. `deploy` (default): after every push, with the rest.
|
|
38
|
+
* `manual`: only when a person presses Run or the CLI asks — for a flow
|
|
39
|
+
* eval that costs a whole run and touches real systems every time. */
|
|
40
|
+
trigger: "deploy" | "manual";
|
|
41
|
+
cases: EvalCase[];
|
|
42
|
+
}
|
|
43
|
+
export declare function parseEval(file: string, raw: string): EvalInfo;
|
|
44
|
+
export declare function listEvals(tenant: string, workspace: string): EvalInfo[];
|
|
45
|
+
/**
|
|
46
|
+
* Turn a finished run into a regression case.
|
|
47
|
+
*
|
|
48
|
+
* A run that worked is the best test of the agent that did it: the task is
|
|
49
|
+
* on record, and so is the answer. This writes both into `evals/` — the task
|
|
50
|
+
* verbatim, the answer as a rubric the judge holds the next run to — so a
|
|
51
|
+
* later edit to the markdown that changes the conclusion shows up as a red
|
|
52
|
+
* case rather than as a customer noticing. Appends to the target's
|
|
53
|
+
* regressions file when there is one, so a flow collects its cases in one
|
|
54
|
+
* place instead of one file per press.
|
|
55
|
+
*/
|
|
56
|
+
export declare function promoteRunToEval(tenant: string, workspace: string, runId: string, opts?: {
|
|
57
|
+
evalName?: string;
|
|
58
|
+
caseName?: string;
|
|
59
|
+
expect?: string[];
|
|
60
|
+
by?: string;
|
|
61
|
+
}): {
|
|
62
|
+
file: string;
|
|
63
|
+
created: boolean;
|
|
64
|
+
caseName: string;
|
|
65
|
+
};
|
|
66
|
+
export interface AssertionResult {
|
|
67
|
+
assertion: Assertion;
|
|
68
|
+
passed: boolean;
|
|
69
|
+
detail: string;
|
|
70
|
+
}
|
|
71
|
+
export interface CaseResult {
|
|
72
|
+
name: string;
|
|
73
|
+
task: string;
|
|
74
|
+
runId: string | null;
|
|
75
|
+
passed: boolean;
|
|
76
|
+
/** Set when the agent itself failed, before any assertion could run. */
|
|
77
|
+
error: string | null;
|
|
78
|
+
assertions: AssertionResult[];
|
|
79
|
+
costUsd: number;
|
|
80
|
+
}
|
|
81
|
+
export interface EvalResult {
|
|
82
|
+
eval: string;
|
|
83
|
+
startedAt: string;
|
|
84
|
+
finishedAt: string;
|
|
85
|
+
passed: number;
|
|
86
|
+
failed: number;
|
|
87
|
+
costUsd: number;
|
|
88
|
+
cases: CaseResult[];
|
|
89
|
+
/** Why the eval could not run at all — a missing secret, an agent that
|
|
90
|
+
* failed to load. Set only when `cases` is empty for that reason, so a
|
|
91
|
+
* 0-of-n result says what went wrong instead of looking like n wrong
|
|
92
|
+
* answers. */
|
|
93
|
+
error?: string;
|
|
94
|
+
}
|
|
95
|
+
export declare function runEval(tenant: string, workspace: string, info: EvalInfo): Promise<EvalResult>;
|
|
96
|
+
/**
|
|
97
|
+
* The latest result, and one line of history.
|
|
98
|
+
*
|
|
99
|
+
* `<eval>.json` is the latest run, overwritten each time — what the evals
|
|
100
|
+
* page shows. `history.jsonl` is every run, one line each, stamped with the
|
|
101
|
+
* commit the workspace was running. That stamp is the whole feature: a score
|
|
102
|
+
* with no commit says quality changed; a score with one says WHICH change.
|
|
103
|
+
* Manual runs are stamped too — the commit on record is whatever deploy put
|
|
104
|
+
* there — so a button press and a post-deploy run land in the same series.
|
|
105
|
+
*/
|
|
106
|
+
export declare function writeEvalResult(tenant: string, workspace: string, result: EvalResult, commit?: string | null): void;
|
|
107
|
+
export interface EvalHistoryEntry {
|
|
108
|
+
eval: string;
|
|
109
|
+
at: string;
|
|
110
|
+
/** The commit the workspace was running. Null on an install that has
|
|
111
|
+
* never deployed from git — the series still exists, just unattributed. */
|
|
112
|
+
commit: string | null;
|
|
113
|
+
passed: number;
|
|
114
|
+
failed: number;
|
|
115
|
+
costUsd: number;
|
|
116
|
+
}
|
|
117
|
+
export declare function readEvalHistory(tenant: string, workspace: string): EvalHistoryEntry[];
|
|
118
|
+
export interface EvalTrend {
|
|
119
|
+
eval: string;
|
|
120
|
+
/** Newest first. */
|
|
121
|
+
latest: EvalHistoryEntry;
|
|
122
|
+
/** The most recent run on a DIFFERENT commit — the comparison that names a
|
|
123
|
+
* change. Null when every run so far was on the same commit. */
|
|
124
|
+
previous: EvalHistoryEntry | null;
|
|
125
|
+
/** Pass count now minus pass count on the previous commit. */
|
|
126
|
+
delta: number | null;
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Per eval: where it stands, and against which commit that is a change.
|
|
130
|
+
*
|
|
131
|
+
* Compares to the last run on a different commit rather than the last run,
|
|
132
|
+
* because two runs on one commit differ only by the model's mood — and a
|
|
133
|
+
* "regression" that is really variance would teach people to ignore the
|
|
134
|
+
* real ones.
|
|
135
|
+
*/
|
|
136
|
+
export declare function evalTrends(tenant: string, workspace: string): EvalTrend[];
|
|
137
|
+
/**
|
|
138
|
+
* Run every eval against what was just deployed, stamped with its commit.
|
|
139
|
+
*
|
|
140
|
+
* Fire-and-forget from the deploy: a deploy answers in milliseconds and an
|
|
141
|
+
* eval takes minutes and money, so the two are never in one request. Runs
|
|
142
|
+
* one at a time — evals are model calls and a deploy should not fan out
|
|
143
|
+
* into all of them at once. A second deploy while one is still evaluating
|
|
144
|
+
* waits its turn behind the lock rather than doubling the spend.
|
|
145
|
+
*/
|
|
146
|
+
export declare function evaluateDeployed(tenant: string, workspace: string, commit?: string | null): Promise<{
|
|
147
|
+
ran: number;
|
|
148
|
+
skipped: string | null;
|
|
149
|
+
}>;
|
|
150
|
+
export declare function readEvalResult(tenant: string, workspace: string, name: string): EvalResult | null;
|