@parcha/agentrun-serve 0.1.0-beta.41 → 0.1.0-beta.42
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 +53 -0
- package/NOTICE +2 -0
- package/README.md +77 -12
- package/dist/agent-rows.d.ts +1 -1
- package/dist/agents-store.js +3 -1
- package/dist/calendar/address.d.ts +49 -0
- package/dist/calendar/address.js +153 -0
- package/dist/calendar/fetch.d.ts +24 -0
- package/dist/calendar/fetch.js +146 -0
- package/dist/calendar/ics-faux.d.ts +39 -0
- package/dist/calendar/ics-faux.js +236 -0
- package/dist/calendar/labels.d.ts +3 -0
- package/dist/calendar/labels.js +61 -0
- package/dist/calendar/names.d.ts +52 -0
- package/dist/calendar/names.js +54 -0
- package/dist/calendar/parse.d.ts +108 -0
- package/dist/calendar/parse.js +625 -0
- package/dist/calendar/routes.d.ts +17 -0
- package/dist/calendar/routes.js +81 -0
- package/dist/calendar/tools.d.ts +23 -0
- package/dist/calendar/tools.js +124 -0
- package/dist/cli.js +3 -1
- package/dist/computer-record.d.ts +55 -0
- package/dist/computer-record.js +315 -0
- package/dist/computer-setting.d.ts +1 -0
- package/dist/computer-setting.js +15 -2
- package/dist/computers.js +2 -14
- package/dist/console/assets/index-DYJ_wj27.js +711 -0
- package/dist/console/index.html +1 -1
- package/dist/eval-feed.d.ts +2 -2
- package/dist/eval-feed.js +9 -5
- package/dist/feed/parse.d.ts +3 -2
- package/dist/feed/parse.js +9 -18
- package/dist/feed/pointer.d.ts +2 -0
- package/dist/feed/pointer.js +17 -0
- package/dist/file-types.js +1 -0
- package/dist/host-command.d.ts +3 -0
- package/dist/host-command.js +18 -0
- package/dist/host.d.ts +3 -0
- package/dist/host.js +3 -0
- package/dist/learn/check.d.ts +14 -0
- package/dist/learn/check.js +194 -14
- package/dist/learn/compile.d.ts +48 -27
- package/dist/learn/compile.js +134 -101
- package/dist/learn/promote.d.ts +61 -5
- package/dist/learn/promote.js +12 -2
- package/dist/learning-setting.d.ts +23 -0
- package/dist/learning-setting.js +51 -0
- package/dist/learning-words.d.ts +3 -0
- package/dist/learning-words.js +3 -0
- package/dist/learning.d.ts +3 -2
- package/dist/learning.js +5 -3
- package/dist/mcp-oauth.d.ts +8 -0
- package/dist/mcp-oauth.js +7 -0
- package/dist/mcp-private-hosts.d.ts +13 -0
- package/dist/mcp-private-hosts.js +16 -0
- package/dist/openapi.d.ts +1 -0
- package/dist/openapi.js +105 -9
- package/dist/run-files.d.ts +6 -2
- package/dist/run-files.js +29 -7
- package/dist/run-learning-served.d.ts +1 -1
- package/dist/run-reads-over-store.d.ts +5 -1
- package/dist/run-reads-over-store.js +8 -4
- package/dist/run-recordings.d.ts +20 -0
- package/dist/run-recordings.js +133 -0
- package/dist/runner/adapter-loop.d.ts +1 -1
- package/dist/runner/adapter-loop.js +3 -6
- package/dist/runner/adapter-run-spec.d.ts +16 -1
- package/dist/runner/adapter-run-spec.js +20 -6
- package/dist/runner/beside.js +1 -1
- package/dist/runner/cli-run-spec.js +10 -7
- package/dist/runner/feedback-round.d.ts +9 -25
- package/dist/runner/feedback-round.js +22 -40
- package/dist/runner/learning-end.d.ts +17 -7
- package/dist/runner/learning-end.js +79 -53
- package/dist/runner/main.d.ts +11 -0
- package/dist/runner/main.js +29 -2
- package/dist/runner/mcp-run.d.ts +2 -2
- package/dist/runner/promotion.d.ts +36 -4
- package/dist/runner/promotion.js +280 -20
- package/dist/runner/reflect-hook.d.ts +5 -0
- package/dist/runner/reflect-hook.js +22 -14
- package/dist/runner/store-secrets.js +3 -1
- package/dist/runner/workflow-first.d.ts +0 -6
- package/dist/runner/workflow-first.js +7 -13
- package/dist/runs-over-store.d.ts +1 -1
- package/dist/sdk/runs.js +2 -1
- package/dist/secrets.js +2 -2
- package/dist/server.d.ts +4 -3
- package/dist/server.js +72 -11
- package/dist/store/agent-body.d.ts +5 -3
- package/dist/store/agent-body.js +14 -10
- package/dist/store-reads/learning.d.ts +1 -1
- package/dist/store-reads/loop.d.ts +1 -0
- package/dist/store-reads/loop.js +14 -4
- package/dist/store-view.d.ts +5 -0
- package/dist/store-view.js +4 -0
- package/dist/template-eval.d.ts +7 -0
- package/dist/template-eval.js +54 -6
- package/dist/templates.d.ts +3 -1
- package/dist/templates.js +14 -1
- package/dist/timeline/computer.js +2 -1
- package/dist/tool-list.js +1 -0
- package/dist/tools.d.ts +7 -0
- package/dist/tools.js +11 -0
- package/dist/trigger-feed.js +67 -18
- package/dist/validate.js +7 -2
- package/dist/workspace/computer-for-claim.d.ts +7 -0
- package/dist/workspace/computer-for-claim.js +12 -2
- package/dist/workspace/paths.d.ts +4 -0
- package/dist/workspace/paths.js +9 -0
- package/dist/workspace/resolve-computer.d.ts +3 -1
- package/launcher/agentrun-serve +31 -24
- package/package.json +10 -9
- package/templates/README.md +11 -2
- package/dist/console/assets/index-COGhx_2Z.js +0 -711
package/dist/learn/promote.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ export declare const REFIT_EVERY = 20;
|
|
|
15
15
|
/** How many grades, and how many promotion records, an agent keeps (newest kept). */
|
|
16
16
|
export declare const GRADES_KEPT = 500;
|
|
17
17
|
export declare const PROMOTIONS_KEPT = 200;
|
|
18
|
-
/** The most characters a grade's words (`label`) may hold, and the most of them and of
|
|
18
|
+
/** The most characters a grade's words (`label`) may hold, and the most of them and of an answer a compile ask shows. */
|
|
19
19
|
export declare const LABEL_MAX = 4000;
|
|
20
20
|
export declare const GRADE_SOURCES: readonly ["feedback", "eval"];
|
|
21
21
|
export type GradeSource = (typeof GRADE_SOURCES)[number];
|
|
@@ -86,8 +86,11 @@ export interface PromotionRecord {
|
|
|
86
86
|
readonly digest: string;
|
|
87
87
|
readonly at: string;
|
|
88
88
|
readonly decided: "promote" | "hold" | "replaying" | "queued" | "skipped";
|
|
89
|
-
readonly source: "replay" | "dry_run" | "refit" | "graded";
|
|
89
|
+
readonly source: "check" | "replay" | "dry_run" | "refit" | "graded";
|
|
90
90
|
readonly reason: string;
|
|
91
|
+
/** A compiled draft's one check (source `check`, runner/promotion.ts): its bar while it replays, its numbers once
|
|
92
|
+
* decided. */
|
|
93
|
+
readonly check?: CheckRecord;
|
|
91
94
|
readonly replay?: ReplayScore & {
|
|
92
95
|
readonly of: readonly string[];
|
|
93
96
|
readonly cost_usd?: number | null;
|
|
@@ -132,6 +135,59 @@ export interface PromotionRecord {
|
|
|
132
135
|
* is on the folder's main. */
|
|
133
136
|
readonly commit?: string;
|
|
134
137
|
}
|
|
138
|
+
/** The bar a compiled draft's check was started with: the agent definition's loop numbers then (learning-setting.ts), and
|
|
139
|
+
* which check of the compile it is (`attempt`: 1, the first draft's; 2, the one recompile's, after which it stops). */
|
|
140
|
+
export interface CheckBar {
|
|
141
|
+
readonly compile_after: number;
|
|
142
|
+
readonly agree_min: number;
|
|
143
|
+
readonly alone_min: number;
|
|
144
|
+
readonly attempt: 1 | 2;
|
|
145
|
+
}
|
|
146
|
+
/** One input a check's draft did not agree on: the agent's run (`run`) and its input, the agent's recorded answer
|
|
147
|
+
* (`agent`), and the draft's answer, or why it handed the input back (`escalated`), or that a step of it failed
|
|
148
|
+
* (`failed`). Each text cut to CHECK_TEXT_MAX: what a recompile reads as data. */
|
|
149
|
+
export interface CheckDisagreement {
|
|
150
|
+
readonly run: string;
|
|
151
|
+
readonly input: string;
|
|
152
|
+
readonly agent: string | null;
|
|
153
|
+
readonly draft?: string;
|
|
154
|
+
readonly escalated?: string;
|
|
155
|
+
readonly failed?: true;
|
|
156
|
+
}
|
|
157
|
+
/** A check's numbers, once decided: `n` inputs it ran on (a skipped write is none), `agreed` of them answered alone with
|
|
158
|
+
* the agent's recorded answer (sameAnswer), `alone` answered alone (no escalate, no failed step, no guard under its
|
|
159
|
+
* serving threshold); the inputs (`of`, the agent's runs), what its replay runs cost, their outcomes, the tools that
|
|
160
|
+
* stopped its skipped inputs, the inputs it did not agree on, and `stopped` when a recompile's check held it too
|
|
161
|
+
* (nothing compiles again). */
|
|
162
|
+
export type CheckRecord = CheckBar & {
|
|
163
|
+
readonly n?: number;
|
|
164
|
+
readonly agreed?: number;
|
|
165
|
+
readonly alone?: number;
|
|
166
|
+
readonly of?: readonly string[];
|
|
167
|
+
readonly cost_usd?: number | null;
|
|
168
|
+
readonly outcomes?: ReplayOutcomes;
|
|
169
|
+
readonly skipped_tools?: readonly SkippedTool[];
|
|
170
|
+
readonly disagreements?: readonly CheckDisagreement[];
|
|
171
|
+
readonly stopped?: true;
|
|
172
|
+
};
|
|
173
|
+
/** The most characters of an input or an answer a check's disagreement keeps. */
|
|
174
|
+
export declare const CHECK_TEXT_MAX = 1200;
|
|
175
|
+
/** A check's two shares: `agreement`, of the inputs the draft answered alone those that say what the agent said (0 when
|
|
176
|
+
* it answered none alone); `alone`, of the inputs it ran on those it answered alone (0 when none ran). */
|
|
177
|
+
export declare const checkShares: (score: {
|
|
178
|
+
readonly n: number;
|
|
179
|
+
readonly agreed: number;
|
|
180
|
+
readonly alone: number;
|
|
181
|
+
}) => {
|
|
182
|
+
agreement: number;
|
|
183
|
+
alone: number;
|
|
184
|
+
};
|
|
185
|
+
/** Whether a check promotes its draft: agreement at least the bar's agree_min, and alone at least its alone_min. */
|
|
186
|
+
export declare const checkPasses: (score: {
|
|
187
|
+
readonly n: number;
|
|
188
|
+
readonly agreed: number;
|
|
189
|
+
readonly alone: number;
|
|
190
|
+
}, bar: Pick<CheckBar, "agree_min" | "alone_min">) => boolean;
|
|
135
191
|
/** What a replay's runs are launched with (PromotionRecord.launch). */
|
|
136
192
|
export interface ReplayLaunch {
|
|
137
193
|
readonly revision: string;
|
|
@@ -147,7 +203,7 @@ export interface SkippedTool {
|
|
|
147
203
|
readonly no_read_only_hint: boolean;
|
|
148
204
|
}
|
|
149
205
|
/** The tools that stopped `rows`' skipped inputs, most inputs first (then by name). */
|
|
150
|
-
export declare function skippedToolsOf(rows: readonly ReplayRow[]): SkippedTool[];
|
|
206
|
+
export declare function skippedToolsOf(rows: readonly Pick<ReplayRow, "outcome" | "skipped">[]): SkippedTool[];
|
|
151
207
|
/** One switch a refit changed: a guard's step, its threshold before and after (`threshold` null: the guard switched off,
|
|
152
208
|
* gone from the revision), and its new fit when one was fit; or an escalate node a replay recorded (dsl softEscalates),
|
|
153
209
|
* switched off (`escalate`: gone from the revision; `was` and `threshold` null, it had none). */
|
|
@@ -183,7 +239,7 @@ export declare const promotionsOf: (settings: Pick<Settings, "get">, agentId: st
|
|
|
183
239
|
export declare const promotionOf: (records: readonly PromotionRecord[], workflow: string, digest: string) => PromotionRecord | undefined;
|
|
184
240
|
/** The champion of `workflow`: the newest record of the digest promoted last (a digest's place is its latest win's,
|
|
185
241
|
* winsOf), while that digest's newest record still says promote. A newer revision replaying or held never stops it; a
|
|
186
|
-
* wrong served grade asks for
|
|
242
|
+
* wrong served grade asks for nothing and never stops it alone; it stops when a newer revision's replay promotes that one
|
|
187
243
|
* (then the champion), or its own graded runs hold it (source graded: no champion until a revision is promoted). A held
|
|
188
244
|
* revision its owner replays (runner/promotion.ts askReplay) and the replay promotes wins again: the champion from then.
|
|
189
245
|
* The money rule stops it on its own (runner/workflow-first.ts). Undefined: none. */
|
|
@@ -312,7 +368,7 @@ export declare const gradeView: (grade: Grade) => {
|
|
|
312
368
|
path: "agent" | "workflow" | "handed_back" | "replay";
|
|
313
369
|
workflow: string | null;
|
|
314
370
|
workflow_digest: string | null;
|
|
315
|
-
feedback: "
|
|
371
|
+
feedback: "look_back" | null;
|
|
316
372
|
expected?: Readonly<Record<string, unknown>> | undefined;
|
|
317
373
|
run_id: string;
|
|
318
374
|
correct: boolean;
|
package/dist/learn/promote.js
CHANGED
|
@@ -11,7 +11,7 @@ export const REFIT_EVERY = 20;
|
|
|
11
11
|
/** How many grades, and how many promotion records, an agent keeps (newest kept). */
|
|
12
12
|
export const GRADES_KEPT = 500;
|
|
13
13
|
export const PROMOTIONS_KEPT = 200;
|
|
14
|
-
/** The most characters a grade's words (`label`) may hold, and the most of them and of
|
|
14
|
+
/** The most characters a grade's words (`label`) may hold, and the most of them and of an answer a compile ask shows. */
|
|
15
15
|
export const LABEL_MAX = 4_000;
|
|
16
16
|
export const GRADE_SOURCES = ["feedback", "eval"];
|
|
17
17
|
/** The ReplayScore fields of `x` alone (a scoreRows or refitGuards result, or a record's `replay`): the one pick of them. */
|
|
@@ -19,6 +19,16 @@ export const scoreOf = (x) => ({ n: x.n, agree: x.agree, agent_acc: x.agent_acc,
|
|
|
19
19
|
/** Whether a replay or refit answered alone on at least one of its inputs: one that hands back every input would never
|
|
20
20
|
* serve. The one spelling of it (clears, settle's hold, the compile's held line); the count is n - handed_back. */
|
|
21
21
|
export const answersAlone = (score) => score.handed_back < score.n;
|
|
22
|
+
/** The most characters of an input or an answer a check's disagreement keeps. */
|
|
23
|
+
export const CHECK_TEXT_MAX = 1_200;
|
|
24
|
+
/** A check's two shares: `agreement`, of the inputs the draft answered alone those that say what the agent said (0 when
|
|
25
|
+
* it answered none alone); `alone`, of the inputs it ran on those it answered alone (0 when none ran). */
|
|
26
|
+
export const checkShares = (score) => ({ agreement: score.alone ? score.agreed / score.alone : 0, alone: score.n ? score.alone / score.n : 0 });
|
|
27
|
+
/** Whether a check promotes its draft: agreement at least the bar's agree_min, and alone at least its alone_min. */
|
|
28
|
+
export const checkPasses = (score, bar) => {
|
|
29
|
+
const shares = checkShares(score);
|
|
30
|
+
return score.n > 0 && score.alone > 0 && shares.agreement >= bar.agree_min - 1e-9 && shares.alone >= bar.alone_min - 1e-9;
|
|
31
|
+
};
|
|
22
32
|
/** The tools that stopped `rows`' skipped inputs, most inputs first (then by name). */
|
|
23
33
|
export function skippedToolsOf(rows) {
|
|
24
34
|
const by = new Map();
|
|
@@ -85,7 +95,7 @@ export const promotionsOf = async (settings, agentId) => itemsOf(await settings.
|
|
|
85
95
|
export const promotionOf = (records, workflow, digest) => records.findLast((one) => one.workflow === workflow && one.digest === digest);
|
|
86
96
|
/** The champion of `workflow`: the newest record of the digest promoted last (a digest's place is its latest win's,
|
|
87
97
|
* winsOf), while that digest's newest record still says promote. A newer revision replaying or held never stops it; a
|
|
88
|
-
* wrong served grade asks for
|
|
98
|
+
* wrong served grade asks for nothing and never stops it alone; it stops when a newer revision's replay promotes that one
|
|
89
99
|
* (then the champion), or its own graded runs hold it (source graded: no champion until a revision is promoted). A held
|
|
90
100
|
* revision its owner replays (runner/promotion.ts askReplay) and the replay promotes wins again: the champion from then.
|
|
91
101
|
* The money rule stops it on its own (runner/workflow-first.ts). Undefined: none. */
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/** The loop's numbers as a definition may set them (each optional: its default stands in). */
|
|
2
|
+
export interface LearningLoop {
|
|
3
|
+
readonly compile_after?: number;
|
|
4
|
+
readonly agree_min?: number;
|
|
5
|
+
readonly alone_min?: number;
|
|
6
|
+
}
|
|
7
|
+
/** A definition's `learning`, as kept on an agentic revision. */
|
|
8
|
+
export type LearningSetting = boolean | "notes" | LearningLoop;
|
|
9
|
+
export declare const COMPILE_AFTER_DEFAULT = 20;
|
|
10
|
+
export declare const AGREE_MIN_DEFAULT = 0.8;
|
|
11
|
+
export declare const ALONE_MIN_DEFAULT = 0.7;
|
|
12
|
+
/** The most completed runs a compile may wait for: the newest this many of an agent's runs are what it counts and checks. */
|
|
13
|
+
export declare const COMPILE_AFTER_MAX = 200;
|
|
14
|
+
/** Whether `learning` has the agent's runs learn workflows too (true, or an object): never "notes", false or absent. */
|
|
15
|
+
export declare const learnsWorkflowsOf: (learning: unknown) => boolean;
|
|
16
|
+
/** The loop's numbers for a revision's `learning`: its object's, each one it leaves out at its default. */
|
|
17
|
+
export declare function loopOf(learning: unknown): Required<LearningLoop>;
|
|
18
|
+
/** What is wrong with a definition's `learning`, in words naming the field (`at` its path), or undefined when it is one
|
|
19
|
+
* of true, false, "notes" or an object of the loop's numbers. */
|
|
20
|
+
export declare function learningSettingIssue(value: unknown, at?: string): string | undefined;
|
|
21
|
+
/** A valid `learning` as a revision keeps it: an object's numbers in one order, so two definitions that say the same are
|
|
22
|
+
* one body. */
|
|
23
|
+
export declare function learningSettingOf(value: LearningSetting): LearningSetting;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
// An agent definition's `learning`: true, false, "notes", or an object, which is on (as true) with the loop's numbers set
|
|
2
|
+
// on it. Every number of the loop lives here, on the agent, each with a default: none is an engine constant.
|
|
3
|
+
// compile_after (N): the agent's job compiles into a workflow once it has this many completed agent runs;
|
|
4
|
+
// agree_min (A): the compiled draft is checked once on the inputs of those N runs, and promoted only when, of the inputs
|
|
5
|
+
// it answered alone, at least this share say what the agent's own recorded answer said;
|
|
6
|
+
// alone_min (S): ...and when it answered at least this share of them alone (no escalate, no failed step).
|
|
7
|
+
// learn/compile.ts compileDue reads compile_after; runner/promotion.ts's check reads all three.
|
|
8
|
+
export const COMPILE_AFTER_DEFAULT = 20;
|
|
9
|
+
export const AGREE_MIN_DEFAULT = 0.8;
|
|
10
|
+
export const ALONE_MIN_DEFAULT = 0.7;
|
|
11
|
+
/** The most completed runs a compile may wait for: the newest this many of an agent's runs are what it counts and checks. */
|
|
12
|
+
export const COMPILE_AFTER_MAX = 200;
|
|
13
|
+
const LOOP_KEYS = ["compile_after", "agree_min", "alone_min"];
|
|
14
|
+
const isLoop = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
|
|
15
|
+
/** Whether `learning` has the agent's runs learn workflows too (true, or an object): never "notes", false or absent. */
|
|
16
|
+
export const learnsWorkflowsOf = (learning) => learning === true || isLoop(learning);
|
|
17
|
+
/** The loop's numbers for a revision's `learning`: its object's, each one it leaves out at its default. */
|
|
18
|
+
export function loopOf(learning) {
|
|
19
|
+
const set = isLoop(learning) ? learning : {};
|
|
20
|
+
return {
|
|
21
|
+
compile_after: set.compile_after ?? COMPILE_AFTER_DEFAULT,
|
|
22
|
+
agree_min: set.agree_min ?? AGREE_MIN_DEFAULT,
|
|
23
|
+
alone_min: set.alone_min ?? ALONE_MIN_DEFAULT,
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
/** What is wrong with a definition's `learning`, in words naming the field (`at` its path), or undefined when it is one
|
|
27
|
+
* of true, false, "notes" or an object of the loop's numbers. */
|
|
28
|
+
export function learningSettingIssue(value, at = "learning") {
|
|
29
|
+
if (typeof value === "boolean" || value === "notes")
|
|
30
|
+
return undefined;
|
|
31
|
+
if (!isLoop(value))
|
|
32
|
+
return `${at} is true, false, "notes" or an object of the loop's numbers ({compile_after?, agree_min?, alone_min?}, on with those set)`;
|
|
33
|
+
const other = Object.keys(value).find((key) => !LOOP_KEYS.includes(key));
|
|
34
|
+
if (other !== undefined)
|
|
35
|
+
return `${at}.${other} is not one of the loop's numbers: ${LOOP_KEYS.join(", ")}`;
|
|
36
|
+
const { compile_after: after, agree_min: agree, alone_min: alone } = value;
|
|
37
|
+
if (after !== undefined && !(Number.isInteger(after) && after >= 1 && after <= COMPILE_AFTER_MAX))
|
|
38
|
+
return `${at}.compile_after is a whole number of completed runs from 1 to ${COMPILE_AFTER_MAX}`;
|
|
39
|
+
for (const [key, share] of [["agree_min", agree], ["alone_min", alone]]) {
|
|
40
|
+
if (share !== undefined && !(typeof share === "number" && Number.isFinite(share) && share >= 0 && share <= 1))
|
|
41
|
+
return `${at}.${key} is a share from 0 to 1`;
|
|
42
|
+
}
|
|
43
|
+
return undefined;
|
|
44
|
+
}
|
|
45
|
+
/** A valid `learning` as a revision keeps it: an object's numbers in one order, so two definitions that say the same are
|
|
46
|
+
* one body. */
|
|
47
|
+
export function learningSettingOf(value) {
|
|
48
|
+
if (!isLoop(value))
|
|
49
|
+
return value;
|
|
50
|
+
return Object.fromEntries(LOOP_KEYS.flatMap((key) => (value[key] !== undefined ? [[key, value[key]]] : [])));
|
|
51
|
+
}
|
package/dist/learning-words.d.ts
CHANGED
|
@@ -56,6 +56,9 @@ export declare const said: {
|
|
|
56
56
|
/** A run whose only work was its learned workflows, each answering, with nothing said after its first message: it was
|
|
57
57
|
* not asked to look back (runner/learning-end.ts onlyLearnedWorkflows). */
|
|
58
58
|
onlyWorkflow: string;
|
|
59
|
+
/** A run of an agent that learns workflows, with no feedback from its owner (no grade's words, no message after its
|
|
60
|
+
* first): it was not asked to look back (runner/learning-end.ts ownerSaid); its trace is what a compile reads. */
|
|
61
|
+
noFeedback: string;
|
|
59
62
|
/** A run started with `learning: "use"`: it read what its agent learned and kept nothing, as asked. */
|
|
60
63
|
use: string;
|
|
61
64
|
/** A merge whose every item the owner has since retired: nothing it learned is kept now. */
|
package/dist/learning-words.js
CHANGED
|
@@ -133,6 +133,9 @@ export const said = {
|
|
|
133
133
|
/** A run whose only work was its learned workflows, each answering, with nothing said after its first message: it was
|
|
134
134
|
* not asked to look back (runner/learning-end.ts onlyLearnedWorkflows). */
|
|
135
135
|
onlyWorkflow: "Nothing new: the run only ran a learned workflow.",
|
|
136
|
+
/** A run of an agent that learns workflows, with no feedback from its owner (no grade's words, no message after its
|
|
137
|
+
* first): it was not asked to look back (runner/learning-end.ts ownerSaid); its trace is what a compile reads. */
|
|
138
|
+
noFeedback: "Not looked back on: this agent learns workflows, and it looks back only on your feedback.",
|
|
136
139
|
/** A run started with `learning: "use"`: it read what its agent learned and kept nothing, as asked. */
|
|
137
140
|
use: "Used what its agent learned; this run keeps nothing.",
|
|
138
141
|
/** A merge whose every item the owner has since retired: nothing it learned is kept now. */
|
package/dist/learning.d.ts
CHANGED
|
@@ -5,8 +5,9 @@ import { type Workspace } from "./workspace/index.js";
|
|
|
5
5
|
* default: a run learns when its agent's definition says `learning: true`. `off`: no run this server starts does. */
|
|
6
6
|
export declare const LEARNING_MODES: readonly ["on", "off"];
|
|
7
7
|
export type LearningMode = (typeof LEARNING_MODES)[number];
|
|
8
|
-
/** Whether a revision's `learning` (its definition's: true, false
|
|
9
|
-
* and workflows; "notes" learns notes and skills alone, never
|
|
8
|
+
/** Whether a revision's `learning` (its definition's: true, false, "notes" or the loop's numbers, learning-setting.ts) has
|
|
9
|
+
* its runs learn: true (or an object) learns notes, skills and workflows; "notes" learns notes and skills alone, never
|
|
10
|
+
* given a learned workflow nor asked to draft one. */
|
|
10
11
|
export declare const learnsOf: (learning: unknown) => boolean;
|
|
11
12
|
export declare const LEARNING_ENV = "AGENTRUN_SERVE_LEARNING";
|
|
12
13
|
/** The switch: `given`, else AGENTRUN_SERVE_LEARNING, else on. Any other value is an error, and the server does not start. */
|
package/dist/learning.js
CHANGED
|
@@ -40,14 +40,16 @@ import { readSeed as readFolderSeed } from "./learn/seed-check.js";
|
|
|
40
40
|
import { agentFolderOf, serialBy, writeDurable } from "./files.js";
|
|
41
41
|
import { withoutLoopbackAddresses } from "./key-refusal.js";
|
|
42
42
|
import { DETAIL_MAX, LIST_DETAIL, said, short, wordsOf } from "./learning-words.js";
|
|
43
|
+
import { learnsWorkflowsOf } from "./learning-setting.js";
|
|
43
44
|
import { isObject } from "./validate.js";
|
|
44
45
|
import { isWorkspaceError, WorkspaceError, workspaceAt } from "./workspace/index.js";
|
|
45
46
|
/** The server's learning switch (`--learning`, AGENTRUN_SERVE_LEARNING; capabilities.features.learning). `on`, the
|
|
46
47
|
* default: a run learns when its agent's definition says `learning: true`. `off`: no run this server starts does. */
|
|
47
48
|
export const LEARNING_MODES = ["on", "off"];
|
|
48
|
-
/** Whether a revision's `learning` (its definition's: true, false
|
|
49
|
-
* and workflows; "notes" learns notes and skills alone, never
|
|
50
|
-
|
|
49
|
+
/** Whether a revision's `learning` (its definition's: true, false, "notes" or the loop's numbers, learning-setting.ts) has
|
|
50
|
+
* its runs learn: true (or an object) learns notes, skills and workflows; "notes" learns notes and skills alone, never
|
|
51
|
+
* given a learned workflow nor asked to draft one. */
|
|
52
|
+
export const learnsOf = (learning) => learnsWorkflowsOf(learning) || learning === "notes";
|
|
51
53
|
export const LEARNING_ENV = "AGENTRUN_SERVE_LEARNING";
|
|
52
54
|
/** The switch: `given`, else AGENTRUN_SERVE_LEARNING, else on. Any other value is an error, and the server does not start. */
|
|
53
55
|
export function learningOf(env, given) {
|
package/dist/mcp-oauth.d.ts
CHANGED
|
@@ -126,6 +126,14 @@ export declare function mcpServerAt(url: URL, signal: AbortSignal, network: OAut
|
|
|
126
126
|
} | {
|
|
127
127
|
address: string | undefined;
|
|
128
128
|
}>;
|
|
129
|
+
/** Where a read of a calendar's file at `url` may go (calendar/fetch.ts, each redirect hop): `mcpServerAt`'s rule, the
|
|
130
|
+
* server's one, in the calendar's words. Dialled with dialAt. */
|
|
131
|
+
export declare function calendarAt(url: URL, signal: AbortSignal, network: OAuthNetwork, reach?: Reach): Promise<{
|
|
132
|
+
refused: string;
|
|
133
|
+
unresolved?: true;
|
|
134
|
+
} | {
|
|
135
|
+
address: string | undefined;
|
|
136
|
+
}>;
|
|
129
137
|
/** A fetch to the MCP server `mcpServerAt` checked: dialled at `address` (the network's dial, else its fetch), or as
|
|
130
138
|
* written when there is none (a loopback URL a local install allows), through `plain`. */
|
|
131
139
|
export declare const dialAt: (network: OAuthNetwork, address: string | undefined, plain?: typeof fetch) => (input: string | URL | Request, init?: RequestInit) => Promise<Response>;
|
package/dist/mcp-oauth.js
CHANGED
|
@@ -255,6 +255,13 @@ export async function mcpServerAt(url, signal, network, reach = {}) {
|
|
|
255
255
|
return { address: undefined };
|
|
256
256
|
return checked(`the MCP server at ${url.host}`, url.href, signal, network, reach);
|
|
257
257
|
}
|
|
258
|
+
/** Where a read of a calendar's file at `url` may go (calendar/fetch.ts, each redirect hop): `mcpServerAt`'s rule, the
|
|
259
|
+
* server's one, in the calendar's words. Dialled with dialAt. */
|
|
260
|
+
export async function calendarAt(url, signal, network, reach = {}) {
|
|
261
|
+
if (reach.loopback && loopbackAllowed(url, url.href, reach.own ?? []))
|
|
262
|
+
return { address: undefined };
|
|
263
|
+
return checked(`the calendar at ${url.host}`, url.href, signal, network, reach);
|
|
264
|
+
}
|
|
258
265
|
/** A fetch to the MCP server `mcpServerAt` checked: dialled at `address` (the network's dial, else its fetch), or as
|
|
259
266
|
* written when there is none (a loopback URL a local install allows), through `plain`. */
|
|
260
267
|
export const dialAt = (network, address, plain = fetch) => (input, init = {}) => {
|
|
@@ -19,6 +19,19 @@ export declare function privateAllowed(address: string, own: readonly string[]):
|
|
|
19
19
|
export declare function privateOAuthHosts(store: {
|
|
20
20
|
settings: Pick<Settings, "get">;
|
|
21
21
|
}): Promise<string[]>;
|
|
22
|
+
/** The store.settings key a server keeps its own addresses under at each start (Serve.own: where it listens, and its
|
|
23
|
+
* public address when that is on loopback): `{ own: string[] }`. Addresses alone, never its loopback opt-in, which each
|
|
24
|
+
* process reads from its own environment: a runner in its own process with its own opt-in reads them so its runs never
|
|
25
|
+
* reach that server's ports on loopback (runner/main.ts runnerLoop), whatever port the server was started on. */
|
|
26
|
+
export declare const MCP_SERVER_OWN_KEY = "mcp.server_own";
|
|
27
|
+
/** The server's start: its own addresses, replacing the last start's. */
|
|
28
|
+
export declare function saveServerOwn(store: {
|
|
29
|
+
settings: Pick<Settings, "put">;
|
|
30
|
+
}, own: readonly string[]): Promise<void>;
|
|
31
|
+
/** The addresses the server kept at its last start (saveServerOwn), read at each use; none before a server started. */
|
|
32
|
+
export declare function serverOwn(store: {
|
|
33
|
+
settings: Pick<Settings, "get">;
|
|
34
|
+
}): Promise<string[]>;
|
|
22
35
|
/** The list replaced with `hosts` (already checked: checkPrivateHosts). */
|
|
23
36
|
export declare function savePrivateOAuthHosts(store: {
|
|
24
37
|
settings: Pick<Settings, "put">;
|
|
@@ -62,6 +62,22 @@ function hostsOf(value) {
|
|
|
62
62
|
export async function privateOAuthHosts(store) {
|
|
63
63
|
return hostsOf(await store.settings.get(MCP_PRIVATE_HOSTS_KEY));
|
|
64
64
|
}
|
|
65
|
+
/** The store.settings key a server keeps its own addresses under at each start (Serve.own: where it listens, and its
|
|
66
|
+
* public address when that is on loopback): `{ own: string[] }`. Addresses alone, never its loopback opt-in, which each
|
|
67
|
+
* process reads from its own environment: a runner in its own process with its own opt-in reads them so its runs never
|
|
68
|
+
* reach that server's ports on loopback (runner/main.ts runnerLoop), whatever port the server was started on. */
|
|
69
|
+
export const MCP_SERVER_OWN_KEY = "mcp.server_own";
|
|
70
|
+
/** The server's start: its own addresses, replacing the last start's. */
|
|
71
|
+
export async function saveServerOwn(store, own) {
|
|
72
|
+
await store.settings.put(MCP_SERVER_OWN_KEY, { own: [...own] });
|
|
73
|
+
}
|
|
74
|
+
/** The addresses the server kept at its last start (saveServerOwn), read at each use; none before a server started. */
|
|
75
|
+
export async function serverOwn(store) {
|
|
76
|
+
const value = await store.settings.get(MCP_SERVER_OWN_KEY);
|
|
77
|
+
if (typeof value !== "object" || value === null || !Array.isArray(value.own))
|
|
78
|
+
return [];
|
|
79
|
+
return (value.own).filter((one) => typeof one === "string");
|
|
80
|
+
}
|
|
65
81
|
/** The list replaced with `hosts` (already checked: checkPrivateHosts). */
|
|
66
82
|
export async function savePrivateOAuthHosts(store, hosts) {
|
|
67
83
|
await store.settings.put(MCP_PRIVATE_HOSTS_KEY, { hosts: [...hosts] });
|
package/dist/openapi.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type TriggerAdapter } from "./trigger-adapter.js";
|
|
2
2
|
import "./mcp-secret-writes.js";
|
|
3
3
|
import "./email/routes.js";
|
|
4
|
+
import "./calendar/routes.js";
|
|
4
5
|
import "./computers.js";
|
|
5
6
|
type Json = Record<string, unknown>;
|
|
6
7
|
/** Why each capability this server turns off answers 501, by the route's capability. */
|