@foldrun/core 0.3.0 → 0.5.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/README.md +27 -10
- package/dist/index.d.ts +3 -0
- package/dist/index.js +3 -0
- package/dist/src/account.d.ts +45 -0
- package/dist/src/account.js +130 -0
- package/dist/src/api-tools.d.ts +8 -0
- package/dist/src/api-tools.js +22 -4
- package/dist/src/approvals.d.ts +104 -1
- package/dist/src/approvals.js +192 -2
- package/dist/src/browser-pod.d.ts +129 -0
- package/dist/src/browser-pod.js +284 -0
- package/dist/src/budget.d.ts +32 -0
- package/dist/src/budget.js +177 -0
- package/dist/src/catalog.js +3 -1
- package/dist/src/clock.d.ts +49 -0
- package/dist/src/clock.js +121 -0
- package/dist/src/completions.js +17 -8
- package/dist/src/confine.d.ts +22 -0
- package/dist/src/confine.js +224 -4
- package/dist/src/deploy.d.ts +33 -0
- package/dist/src/deploy.js +145 -6
- package/dist/src/egress.d.ts +26 -2
- package/dist/src/egress.js +8 -1
- package/dist/src/eol.d.ts +2 -0
- package/dist/src/eol.js +7 -0
- package/dist/src/evals.d.ts +9 -0
- package/dist/src/evals.js +26 -13
- package/dist/src/flow-lint.d.ts +12 -0
- package/dist/src/flow-lint.js +331 -1
- package/dist/src/flow-patterns.d.ts +141 -0
- package/dist/src/flow-patterns.js +568 -0
- package/dist/src/gitrepo.d.ts +18 -0
- package/dist/src/gitrepo.js +49 -0
- package/dist/src/host-env.d.ts +8 -0
- package/dist/src/host-env.js +48 -0
- package/dist/src/json-schema.d.ts +12 -0
- package/dist/src/json-schema.js +202 -0
- package/dist/src/kinds.js +1 -1
- package/dist/src/language.d.ts +17 -0
- package/dist/src/language.js +55 -0
- package/dist/src/layout.d.ts +69 -0
- package/dist/src/layout.js +200 -0
- package/dist/src/library.d.ts +9 -0
- package/dist/src/library.js +43 -4
- package/dist/src/limits.d.ts +84 -0
- package/dist/src/limits.js +287 -0
- package/dist/src/locale.d.ts +47 -0
- package/dist/src/locale.js +177 -0
- package/dist/src/mail.d.ts +88 -0
- package/dist/src/mail.js +245 -0
- package/dist/src/model-probe.d.ts +3 -0
- package/dist/src/model-probe.js +1 -0
- package/dist/src/notify.d.ts +132 -8
- package/dist/src/notify.js +360 -58
- package/dist/src/openapi.js +5 -3
- package/dist/src/operator.d.ts +201 -0
- package/dist/src/operator.js +251 -0
- package/dist/src/paths.d.ts +33 -0
- package/dist/src/paths.js +87 -0
- package/dist/src/platform.d.ts +144 -4
- package/dist/src/platform.js +27 -3
- package/dist/src/provider-health.d.ts +55 -0
- package/dist/src/provider-health.js +233 -0
- package/dist/src/providers.d.ts +481 -0
- package/dist/src/providers.js +1105 -6
- package/dist/src/refusal.d.ts +83 -0
- package/dist/src/refusal.js +281 -0
- package/dist/src/run-container.d.ts +206 -17
- package/dist/src/run-container.js +547 -80
- package/dist/src/runner.d.ts +179 -10
- package/dist/src/runner.js +1423 -169
- package/dist/src/runtime.d.ts +52 -0
- package/dist/src/runtime.js +493 -58
- package/dist/src/script-tools.d.ts +15 -2
- package/dist/src/script-tools.js +44 -4
- package/dist/src/secret-files.d.ts +6 -5
- package/dist/src/secret-files.js +24 -11
- package/dist/src/secret-health.d.ts +83 -0
- package/dist/src/secret-health.js +177 -0
- package/dist/src/secrets.d.ts +38 -1
- package/dist/src/secrets.js +197 -96
- package/dist/src/starter.d.ts +9 -0
- package/dist/src/starter.js +95 -11
- package/dist/src/step-exec.d.ts +106 -1
- package/dist/src/step-exec.js +558 -85
- package/dist/src/step-removal.d.ts +15 -0
- package/dist/src/step-removal.js +49 -0
- package/dist/src/storage.d.ts +23 -4
- package/dist/src/storage.js +125 -23
- package/dist/src/store.d.ts +492 -38
- package/dist/src/store.js +882 -69
- package/dist/src/subagents.d.ts +75 -0
- package/dist/src/subagents.js +149 -0
- package/dist/src/tar.js +2 -1
- package/dist/src/test-mode.d.ts +111 -0
- package/dist/src/test-mode.js +285 -0
- package/dist/src/tool-names.d.ts +13 -1
- package/dist/src/tool-names.js +38 -11
- package/dist/src/tool-programs.d.ts +26 -0
- package/dist/src/tool-programs.js +172 -0
- package/dist/src/tool-test.js +152 -33
- package/dist/src/translator.d.ts +8 -2
- package/dist/src/translator.js +71 -24
- package/dist/src/trigger-log.d.ts +43 -0
- package/dist/src/trigger-log.js +122 -0
- package/dist/src/triggers.d.ts +23 -0
- package/dist/src/triggers.js +101 -12
- package/dist/src/untrusted-fetch.d.ts +11 -0
- package/dist/src/untrusted-fetch.js +77 -0
- package/dist/src/web-actions.d.ts +91 -0
- package/dist/src/web-actions.js +199 -0
- package/dist/src/webhook.d.ts +19 -3
- package/dist/src/webhook.js +50 -11
- package/index.ts +3 -0
- package/package.json +5 -5
- package/src/account.ts +149 -0
- package/src/api-tools.ts +32 -4
- package/src/approvals.ts +253 -2
- package/src/browser-pod.ts +313 -0
- package/src/budget.ts +178 -0
- package/src/catalog.ts +3 -1
- package/src/clock.ts +149 -0
- package/src/completions.ts +17 -8
- package/src/confine.ts +224 -4
- package/src/deploy.ts +137 -6
- package/src/egress.ts +32 -4
- package/src/eol.ts +7 -0
- package/src/evals.ts +36 -11
- package/src/flow-lint.ts +371 -1
- package/src/flow-patterns.ts +597 -0
- package/src/gitrepo.ts +48 -0
- package/src/host-env.ts +51 -0
- package/src/json-schema.ts +184 -0
- package/src/kinds.ts +1 -1
- package/src/language.ts +62 -0
- package/src/layout.ts +228 -0
- package/src/library.ts +50 -4
- package/src/limits.ts +290 -0
- package/src/locale.ts +217 -0
- package/src/mail.ts +316 -0
- package/src/model-probe.ts +4 -0
- package/src/notify.ts +391 -44
- package/src/openapi.ts +5 -3
- package/src/operator.ts +300 -0
- package/src/paths.ts +83 -0
- package/src/platform.ts +158 -5
- package/src/provider-health.ts +275 -0
- package/src/providers.ts +1368 -6
- package/src/refusal.ts +320 -0
- package/src/run-container.ts +611 -76
- package/src/runner.ts +1463 -165
- package/src/runtime.ts +487 -55
- package/src/script-tools.ts +55 -6
- package/src/secret-files.ts +22 -10
- package/src/secret-health.ts +230 -0
- package/src/secrets.ts +191 -95
- package/src/starter.ts +96 -11
- package/src/step-exec.ts +548 -41
- package/src/step-removal.ts +59 -0
- package/src/storage.ts +149 -24
- package/src/store.ts +1227 -74
- package/src/subagents.ts +189 -0
- package/src/tar.ts +2 -1
- package/src/test-mode.ts +311 -0
- package/src/tool-names.ts +40 -11
- package/src/tool-programs.ts +179 -0
- package/src/tool-test.ts +159 -32
- package/src/translator.ts +74 -23
- package/src/trigger-log.ts +160 -0
- package/src/triggers.ts +102 -12
- package/src/untrusted-fetch.ts +88 -0
- package/src/web-actions.ts +237 -0
- package/src/webhook.ts +58 -11
- package/templates/hello/agents/curator/agent.md +1 -1
- package/templates/hello/agents/notetaker/agent.md +1 -1
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import { type FlowStep } from "./store.ts";
|
|
2
|
+
import { type Groups } from "./arrange.ts";
|
|
3
|
+
import { type RemovalImpact } from "./step-removal.ts";
|
|
4
|
+
/** A flow's steps as groups of indices into its parsed steps — what
|
|
5
|
+
* reorderFlowSteps and the arrange helpers take. */
|
|
6
|
+
export declare function flowGroups(steps: FlowStep[]): Groups;
|
|
7
|
+
/** The step options a pattern writes. Everything else in a step stays the
|
|
8
|
+
* author's (and updateFlowStep's) business. */
|
|
9
|
+
export declare const PATTERN_OPTION_KEYS: readonly ["ask", "wait", "on-fail", "each", "max", "loop", "until", "verify", "case", "else", "when", "retry", "approve"];
|
|
10
|
+
export type PatternOptionKey = (typeof PATTERN_OPTION_KEYS)[number];
|
|
11
|
+
export type PatternOptions = Partial<Record<PatternOptionKey, string | null>>;
|
|
12
|
+
export type PatternEdit =
|
|
13
|
+
/** Chain (at.rail: its own group there) or Parallel (at.column: join
|
|
14
|
+
* the group in that column). Rail 0 is before every group. */
|
|
15
|
+
{
|
|
16
|
+
op: "insert";
|
|
17
|
+
target: string;
|
|
18
|
+
subflow?: boolean;
|
|
19
|
+
instruction?: string;
|
|
20
|
+
at: {
|
|
21
|
+
rail: number;
|
|
22
|
+
} | {
|
|
23
|
+
column: number;
|
|
24
|
+
};
|
|
25
|
+
options?: PatternOptions;
|
|
26
|
+
}
|
|
27
|
+
/** Router: a triage step, then one group of case:/else: branches. */
|
|
28
|
+
| {
|
|
29
|
+
op: "router";
|
|
30
|
+
router: string;
|
|
31
|
+
instruction?: string;
|
|
32
|
+
rail: number;
|
|
33
|
+
cases: {
|
|
34
|
+
value: string;
|
|
35
|
+
target: string;
|
|
36
|
+
}[];
|
|
37
|
+
else?: string;
|
|
38
|
+
}
|
|
39
|
+
/** Fan-out, evaluator loop, ask, wait, rescue: options on one step. */
|
|
40
|
+
| {
|
|
41
|
+
op: "options";
|
|
42
|
+
step: number;
|
|
43
|
+
set: PatternOptions;
|
|
44
|
+
}
|
|
45
|
+
/** Approval gate: the `!` marker. */
|
|
46
|
+
| {
|
|
47
|
+
op: "approve";
|
|
48
|
+
step: number;
|
|
49
|
+
on: boolean;
|
|
50
|
+
}
|
|
51
|
+
/** Delete one step (removeStep). */
|
|
52
|
+
| {
|
|
53
|
+
op: "remove";
|
|
54
|
+
step: number;
|
|
55
|
+
}
|
|
56
|
+
/** Copy one step beside itself (duplicateStep). */
|
|
57
|
+
| {
|
|
58
|
+
op: "duplicate";
|
|
59
|
+
step: number;
|
|
60
|
+
}
|
|
61
|
+
/** Copied step markdown, placed (pasteSteps). */
|
|
62
|
+
| {
|
|
63
|
+
op: "paste";
|
|
64
|
+
text: string;
|
|
65
|
+
at: {
|
|
66
|
+
rail: number;
|
|
67
|
+
} | {
|
|
68
|
+
column: number;
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
/** A new step, placed; the file, the new step's index and its column. */
|
|
72
|
+
declare function insertFlowStepLF(raw: string, o: {
|
|
73
|
+
target: string;
|
|
74
|
+
subflow?: boolean;
|
|
75
|
+
instruction?: string;
|
|
76
|
+
at: {
|
|
77
|
+
rail: number;
|
|
78
|
+
} | {
|
|
79
|
+
column: number;
|
|
80
|
+
};
|
|
81
|
+
options?: PatternOptions;
|
|
82
|
+
}): {
|
|
83
|
+
text: string;
|
|
84
|
+
index: number;
|
|
85
|
+
column: number;
|
|
86
|
+
};
|
|
87
|
+
/**
|
|
88
|
+
* Paste copied steps (stepSource output, one block or several) into a flow.
|
|
89
|
+
* Steps copied with the same group number stay parallel with each other.
|
|
90
|
+
* `{ rail }` places the pasted groups as their own consecutive groups there
|
|
91
|
+
* (0 is before every group); `{ column }` puts every pasted step in that
|
|
92
|
+
* existing group. Groups renumber; prose stays where it was. Returns the
|
|
93
|
+
* file and the pasted steps' indices in it. Refused when the paste does not
|
|
94
|
+
* parse as those steps, or when `check` would gain an error.
|
|
95
|
+
*/
|
|
96
|
+
declare function pasteStepsLF(raw: string, text: string, at: {
|
|
97
|
+
rail: number;
|
|
98
|
+
} | {
|
|
99
|
+
column: number;
|
|
100
|
+
}): {
|
|
101
|
+
text: string;
|
|
102
|
+
indices: number[];
|
|
103
|
+
};
|
|
104
|
+
export declare const setStepOptions: (raw: string, index: number, set: PatternOptions) => string;
|
|
105
|
+
export declare const setStepApprove: (raw: string, index: number, on: boolean) => string;
|
|
106
|
+
export declare function insertFlowStep(...[raw, o]: Parameters<typeof insertFlowStepLF>): ReturnType<typeof insertFlowStepLF>;
|
|
107
|
+
export declare const removeStepImpact: (raw: string, index: number) => RemovalImpact;
|
|
108
|
+
export declare const removeStep: (raw: string, index: number) => string;
|
|
109
|
+
export declare const stepSource: (raw: string, index: number) => string;
|
|
110
|
+
export declare const duplicateStep: (raw: string, index: number) => string;
|
|
111
|
+
export declare function pasteSteps(...[raw, text, at]: Parameters<typeof pasteStepsLF>): ReturnType<typeof pasteStepsLF>;
|
|
112
|
+
export declare const applyPatternEdit: (raw: string, edit: PatternEdit) => string;
|
|
113
|
+
/** The frontmatter list fields an agent's team lives in: whom it delegates
|
|
114
|
+
* to, whom it consults, and what it may do (`ask` among them). */
|
|
115
|
+
export declare const TEAM_LIST_KEYS: readonly ["subagents", "agents", "tools"];
|
|
116
|
+
export type TeamListKey = (typeof TEAM_LIST_KEYS)[number];
|
|
117
|
+
/** The names a frontmatter list holds, read the way the file says them. */
|
|
118
|
+
export declare function frontmatterList(raw: string, key: string): string[];
|
|
119
|
+
/**
|
|
120
|
+
* Add `name` to, or remove it from, the list under `key`, touching only the
|
|
121
|
+
* lines that list is on. Flow style (`key: [a, b]`) stays flow style, block
|
|
122
|
+
* style stays block style, a trailing `# comment` stays put, and the other
|
|
123
|
+
* items keep their spelling. A list emptied by a removal is written
|
|
124
|
+
* `key: []` rather than deleted: the file still says "none", which for
|
|
125
|
+
* `tools:` is not the same as saying nothing.
|
|
126
|
+
*/
|
|
127
|
+
export declare function editFrontmatterList(raw: string, key: string, name: string, action: "add" | "remove"): string;
|
|
128
|
+
/** A YAML scalar for a one-line value: plain when plain reads back as the
|
|
129
|
+
* same string, double-quoted (JSON is valid YAML) when it would not. */
|
|
130
|
+
export declare function yamlScalar(value: string): string;
|
|
131
|
+
/** Set one scalar key — `description:`, `model:`. Replaces its line (and the
|
|
132
|
+
* indented lines of a `>`/`|` block under it); absent, it goes right after
|
|
133
|
+
* `name:`, or last. */
|
|
134
|
+
export declare function setFrontmatterScalar(raw: string, key: string, value: string): string;
|
|
135
|
+
/** A new agent file: the template with the answers to "what is it for"
|
|
136
|
+
* and "which model" written into it, the rest as the template wrote it. */
|
|
137
|
+
export declare function newAgentFile(template: string, o: {
|
|
138
|
+
description?: string;
|
|
139
|
+
model?: string;
|
|
140
|
+
}): string;
|
|
141
|
+
export {};
|