@parcha/agentrun-serve 0.1.0-beta.60 → 0.1.0-beta.61
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 +58 -0
- package/README.md +42 -14
- package/dist/acp-package.d.ts +4 -0
- package/dist/api-only.d.ts +19 -1
- package/dist/api-only.js +38 -3
- package/dist/browser-person.d.ts +1 -1
- package/dist/browser-person.js +1 -1
- package/dist/calendar/tools.js +1 -1
- package/dist/cli.js +42 -10
- package/dist/console/assets/{backend-QnwGVBeU.js → backend-C9ffXUR5.js} +1 -1
- package/dist/console/assets/index-BnZV3lvW.js +639 -0
- package/dist/console/assets/{share-pz61zIn9.js → share-B1o5mJ56.js} +2 -2
- package/dist/console/assets/{styles-CcceGcu2.js → styles-D_znYrHR.js} +2 -2
- package/dist/console/index.html +2 -2
- package/dist/console/share.html +2 -2
- package/dist/errors.d.ts +1 -0
- package/dist/errors.js +2 -0
- package/dist/harness-check.js +2 -1
- package/dist/harness-recipe.d.ts +13 -2
- package/dist/harness-recipe.js +30 -7
- package/dist/harness-sign-in.js +2 -1
- package/dist/harness-table.d.ts +5 -3
- package/dist/harness-table.js +7 -5
- package/dist/key-refusal.js +6 -4
- package/dist/learn/secrets.d.ts +2 -1
- package/dist/learn/secrets.js +2 -2
- package/dist/learned-nodes.d.ts +36 -0
- package/dist/learned-nodes.js +23 -0
- package/dist/local-model.d.ts +144 -0
- package/dist/local-model.js +214 -0
- package/dist/mcp-probe.d.ts +7 -0
- package/dist/mcp-probe.js +7 -0
- package/dist/ollama-provider.d.ts +35 -0
- package/dist/ollama-provider.js +108 -2
- package/dist/openapi.js +59 -7
- package/dist/place.d.ts +7 -6
- package/dist/place.js +13 -10
- package/dist/print.js +1 -1
- package/dist/redact/match.d.ts +17 -4
- package/dist/redact/match.js +57 -15
- package/dist/run-export.js +4 -2
- package/dist/run-usage.js +3 -2
- package/dist/runner/adapter-loop.d.ts +8 -1
- package/dist/runner/adapter-loop.js +100 -20
- package/dist/runner/adapter-run-spec.d.ts +3 -5
- package/dist/runner/adapter-run-spec.js +26 -43
- package/dist/runner/adapters/pi.d.ts +3 -2
- package/dist/runner/adapters/pi.js +3 -1
- package/dist/runner/audit.d.ts +1 -1
- package/dist/runner/cli-run-spec.js +13 -10
- package/dist/runner/compare-end.d.ts +1 -1
- package/dist/runner/dispatch.js +2 -2
- package/dist/runner/harness-loops.d.ts +9 -0
- package/dist/runner/harness-loops.js +47 -4
- package/dist/runner/held.d.ts +4 -1
- package/dist/runner/live-ticker.js +3 -4
- package/dist/runner/mcp-claim.js +3 -2
- package/dist/runner/mcp-run.d.ts +19 -4
- package/dist/runner/mcp-run.js +29 -2
- package/dist/runner/metrics.d.ts +4 -0
- package/dist/runner/metrics.js +9 -3
- package/dist/runner/monid-run.js +3 -1
- package/dist/runner/native-loop.js +1 -1
- package/dist/runner/redact.d.ts +3 -0
- package/dist/runner/redact.js +7 -0
- package/dist/runner/run-child-host.js +1 -1
- package/dist/runner/sdk-loop.js +5 -3
- package/dist/runner/workflow-calls.d.ts +4 -1
- package/dist/runner/workflow-calls.js +35 -18
- package/dist/runner/workflow-loop.d.ts +1 -1
- package/dist/runner/workflow-loop.js +3 -1
- package/dist/runner/workflow-spec.d.ts +4 -0
- package/dist/runner/workflow-spec.js +18 -13
- package/dist/runs-over-store.d.ts +2 -2
- package/dist/runs-over-store.js +1 -1
- package/dist/secret-cut.js +7 -4
- package/dist/secret-rules.js +97 -83
- package/dist/server.d.ts +7 -0
- package/dist/server.js +97 -34
- package/dist/slack.js +2 -1
- package/dist/store/postgres/migrate.js +3 -1
- package/dist/store-reads/learning.d.ts +5 -4
- package/dist/store-reads/learning.js +7 -4
- package/dist/tool-plane.d.ts +23 -1
- package/dist/tool-plane.js +70 -2
- package/dist/tools.d.ts +12 -2
- package/dist/tools.js +42 -7
- package/dist/trigger-launch-hook.d.ts +2 -2
- package/dist/trigger-launch-hook.js +1 -1
- package/dist/triggers.d.ts +7 -4
- package/dist/triggers.js +4 -4
- package/package.json +12 -12
- package/dist/console/assets/index-DZi-muIj.js +0 -629
package/dist/tools.js
CHANGED
|
@@ -15,7 +15,7 @@ import { mcpNameOf } from "./tool-names.js";
|
|
|
15
15
|
import { appendFileSync } from "node:fs";
|
|
16
16
|
import { pathToFileURL } from "node:url";
|
|
17
17
|
import { defineExtension, defineTool, ROOT_CONVERSATION_ID } from "@earendil-works/pi-durable";
|
|
18
|
-
import { registerTurnEnding } from "./timeline/index.js";
|
|
18
|
+
import { registerTurnEnding, webCut } from "./timeline/index.js";
|
|
19
19
|
import { BACKGROUND_LOG_BYTES, BACKGROUND_MAX, BACKGROUND_PAGE_BYTES } from "./background.js";
|
|
20
20
|
import { isWorkspaceError, localWorkspace } from "./workspace/index.js";
|
|
21
21
|
import { HTML_READ_CHARS, TEXT_CAP } from "@parcha/agentrun-web";
|
|
@@ -41,7 +41,7 @@ import { fauxFetch, PARALLEL_KEY_ENV } from "./decisions.js";
|
|
|
41
41
|
import { keyNeeded } from "./key-words.js";
|
|
42
42
|
import { unattachable } from "./attach-images.js";
|
|
43
43
|
import { handedSignIn } from "./secrets.js";
|
|
44
|
-
import { redactedAnswer } from "./key-refusal.js";
|
|
44
|
+
import { redactedAnswer, withheldWhole } from "./key-refusal.js";
|
|
45
45
|
import { SIGN_IN_KEY, vendorsOver } from "./sign-ins.js";
|
|
46
46
|
import { answerIn, answerOnce } from "./runner/hand-back.js";
|
|
47
47
|
import { waitingAsk } from "./browser-commands.js";
|
|
@@ -229,14 +229,49 @@ export function cutAnswer(value, cut) {
|
|
|
229
229
|
}
|
|
230
230
|
return value;
|
|
231
231
|
}
|
|
232
|
+
/** One call's web answer cut by `cut` (timeline/web-calls.ts webCut): each of its JSON's strings cut once, and the whole
|
|
233
|
+
* "[redacted]" when its strings, read joined, hold a held value no cut in place takes (a value split across two of
|
|
234
|
+
* them). The join is read against the values `cut` holds (key-refusal.ts withheldWhole), or through `cut` itself when
|
|
235
|
+
* it does not know them (joinCut). Undefined for an answer that is not a web call's JSON. Make one per call. */
|
|
236
|
+
export function webAnswerCut(cut) {
|
|
237
|
+
const seen = new Map();
|
|
238
|
+
const once = (text) => {
|
|
239
|
+
let out = seen.get(text);
|
|
240
|
+
if (out === undefined)
|
|
241
|
+
seen.set(text, (out = cut(text)));
|
|
242
|
+
return out;
|
|
243
|
+
};
|
|
244
|
+
const holds = (joined, parts) => {
|
|
245
|
+
const values = cut.heldValues?.();
|
|
246
|
+
return values ? withheldWhole(joined, values) : joinCut(joined, parts, once);
|
|
247
|
+
};
|
|
248
|
+
return (tool, text) => webCut(tool, text, once, holds);
|
|
249
|
+
}
|
|
250
|
+
/** Whether `cut`, a redactor that does not know its values, takes from `joined` (`parts` joined by line breaks) what it
|
|
251
|
+
* does not take from the parts each read alone: a held value split across two parts. Its cut of the join whole being
|
|
252
|
+
* "[redacted]" is not enough: it reads a text longer than a piece in pieces of 8,192 characters (key-refusal.ts
|
|
253
|
+
* redactedAnswer), and a value split inside one piece withholds only that piece, the rest of the join served. It misses
|
|
254
|
+
* nothing: no value split across parts is in a part to cut, so the join's cut and the parts' differ wherever the join
|
|
255
|
+
* holds one; where nothing spans two parts they are the same, as every piece ends at whitespace or inside a run longer
|
|
256
|
+
* than a piece, and a line break ends each part. */
|
|
257
|
+
function joinCut(joined, parts, cut) {
|
|
258
|
+
const whole = cut(joined);
|
|
259
|
+
return whole === "[redacted]" || whole !== parts.map(cut).join("\n");
|
|
260
|
+
}
|
|
232
261
|
/** `tool` whose answer, and a throw's message, pass `cut` inside its execute: before pi stores the result or the model
|
|
233
|
-
* reads it.
|
|
234
|
-
|
|
262
|
+
* reads it. A web call's JSON is cut as the agentic specs' answersCut cuts it (webAnswerCut), so it still parses and
|
|
263
|
+
* keeps its links, and a held value split across its strings withholds it whole. */
|
|
264
|
+
export function answersCutInside(tool, cut) {
|
|
265
|
+
// Fail closed and loud: a host with no redactor would only throw inside each call, an error a model may read past.
|
|
266
|
+
if (typeof cut !== "function")
|
|
267
|
+
throw new TypeError(`${tool.name}: the run's redactor (host.redact) is required to cut its answers`);
|
|
235
268
|
return {
|
|
236
269
|
...tool,
|
|
237
270
|
execute: (async (...args) => {
|
|
238
271
|
try {
|
|
239
|
-
|
|
272
|
+
const web = webAnswerCut(cut);
|
|
273
|
+
const textCut = (text) => web(tool.name, text) ?? cut(text);
|
|
274
|
+
return cutAnswer(await tool.execute(...args), textCut);
|
|
240
275
|
}
|
|
241
276
|
catch (error) {
|
|
242
277
|
if (error instanceof Error) {
|
|
@@ -383,7 +418,7 @@ const browserTool = {
|
|
|
383
418
|
// The model's words for the person, with every value this run holds cut, whole, before they are cut to their bound:
|
|
384
419
|
// the run's own cut on the runner (host.redact: the claim's keys too, every tool's, in every form), and the secrets
|
|
385
420
|
// its env holds (runnerSecrets: hostSecrets and every launcher name's value) with its sign-in's pointer.
|
|
386
|
-
redact: (text) => redactedAnswer(host.redact
|
|
421
|
+
redact: (text) => redactedAnswer(host.redact(text), [...runnerSecrets(host.env), ...(kept ? [kept.ref] : [])]),
|
|
387
422
|
// The Screen tab's ended state, one settings row the server reads per poll (browser-wait-ended.ts); cleared as a
|
|
388
423
|
// session opens (onSessions, below).
|
|
389
424
|
waitEnded: (at, why) => {
|
|
@@ -493,7 +528,7 @@ const browserTool = {
|
|
|
493
528
|
const browser = createBrowserExtension({ provider, driver: parts.driver, evidence: evidenceIn(work), ...files, gates, handoff: hands.handoff, onSession: onSessions, signIns: kept !== undefined, beforeCreate: spend.opening, redact: { values: () => [...runnerSecrets(host.env), ...(kept ? [kept.ref] : [])] }, prices: { sessionUsdPerHour: price.usdPerHour, sessionMinimumS: price.minimumS }, onCharge: spend.onCharge });
|
|
494
529
|
// On the runner, every answer the browser's tools give passes the run's one redactor inside the call, so what pi stores
|
|
495
530
|
// (its result record) and what the model reads hold no value the runner or the claim holds.
|
|
496
|
-
const tools = browser.tools.map(spend.capped).map((tool) =>
|
|
531
|
+
const tools = browser.tools.map(spend.capped).map((tool) => answersCutInside(tool, host.redact));
|
|
497
532
|
const extension = { ...browser.extension, tools };
|
|
498
533
|
host.install(extension);
|
|
499
534
|
host.onConversation(async (tx, conversationId) => {
|
|
@@ -8,8 +8,8 @@ export declare const LAUNCH_HOOK_TIMEOUT_MS = 10000;
|
|
|
8
8
|
* trigger's max_active_runs, or one a stop cut short and the next start handed again reaches the host late, and its
|
|
9
9
|
* host gets the same 10 minutes as any. */
|
|
10
10
|
export declare const LAUNCH_HOOK_LATE_START_MS: number;
|
|
11
|
-
/** The hook a server hands its firings to: where, and the secret it signs with. `bound`: a test's seam,
|
|
12
|
-
* POST
|
|
11
|
+
/** The hook a server hands its firings to: where, and the secret it signs with. `bound`: a test's seam, a signal that can
|
|
12
|
+
* cut a POST before LAUNCH_HOOK_TIMEOUT_MS, never after: the 10 s bound is always set as well. */
|
|
13
13
|
export type LaunchHook = {
|
|
14
14
|
readonly url: string;
|
|
15
15
|
readonly secret: string;
|
|
@@ -79,7 +79,7 @@ export async function handToHost(hook, firing, stop, now = Date.now) {
|
|
|
79
79
|
const body = JSON.stringify(firing);
|
|
80
80
|
const timestamp = String(Math.floor(now() / 1000));
|
|
81
81
|
const headers = signedRequest(hook.secret, firing.firing_id, timestamp, body, "agentrun-serve-launch-hook/1");
|
|
82
|
-
const signal = AbortSignal.any([hook.bound ? hook.bound(LAUNCH_HOOK_TIMEOUT_MS) :
|
|
82
|
+
const signal = AbortSignal.any([AbortSignal.timeout(LAUNCH_HOOK_TIMEOUT_MS), ...(hook.bound ? [hook.bound(LAUNCH_HOOK_TIMEOUT_MS)] : []), stop]);
|
|
83
83
|
let res;
|
|
84
84
|
try {
|
|
85
85
|
res = await undiciFetch(hook.url, { method: "POST", redirect: "manual", signal, headers, body });
|
package/dist/triggers.d.ts
CHANGED
|
@@ -434,13 +434,16 @@ export declare class Triggers {
|
|
|
434
434
|
id: string;
|
|
435
435
|
name: string;
|
|
436
436
|
}[]>;
|
|
437
|
-
/** Agent `agentId` unarchived: none of its triggers turns on again, but those its archive turned off
|
|
438
|
-
*
|
|
439
|
-
*
|
|
437
|
+
/** Agent `agentId` unarchived: none of its triggers turns on again, but those its archive turned off that `turnOn`
|
|
438
|
+
* takes (by source and target), each turned on as a PATCH with enabled true does (an API-only server's with the launch
|
|
439
|
+
* hook: api-only.ts apiOnlyTurnsOn). The triggers its archive turned off that are off still, by name: each is
|
|
440
440
|
* turned on by a PATCH. One `turnOn` takes that can't be on (a schedule with no time left), or that its first check
|
|
441
441
|
* turns off again, is named: what is off is read from the store after the turn-ons, never taken from whether one
|
|
442
442
|
* resolved. */
|
|
443
|
-
agentUnarchived(agentId: string, turnOn?: (
|
|
443
|
+
agentUnarchived(agentId: string, turnOn?: (trigger: {
|
|
444
|
+
source: Source;
|
|
445
|
+
target: Target;
|
|
446
|
+
}) => boolean): Promise<{
|
|
444
447
|
id: string;
|
|
445
448
|
name: string;
|
|
446
449
|
}[]>;
|
package/dist/triggers.js
CHANGED
|
@@ -458,9 +458,9 @@ export class Triggers {
|
|
|
458
458
|
await this.offThere((await Promise.all(off.map((t) => this.find(t.id)))).filter((t) => t !== undefined));
|
|
459
459
|
return off;
|
|
460
460
|
}
|
|
461
|
-
/** Agent `agentId` unarchived: none of its triggers turns on again, but those its archive turned off
|
|
462
|
-
*
|
|
463
|
-
*
|
|
461
|
+
/** Agent `agentId` unarchived: none of its triggers turns on again, but those its archive turned off that `turnOn`
|
|
462
|
+
* takes (by source and target), each turned on as a PATCH with enabled true does (an API-only server's with the launch
|
|
463
|
+
* hook: api-only.ts apiOnlyTurnsOn). The triggers its archive turned off that are off still, by name: each is
|
|
464
464
|
* turned on by a PATCH. One `turnOn` takes that can't be on (a schedule with no time left), or that its first check
|
|
465
465
|
* turns off again, is named: what is off is read from the store after the turn-ons, never taken from whether one
|
|
466
466
|
* resolved. */
|
|
@@ -468,7 +468,7 @@ export class Triggers {
|
|
|
468
468
|
await this.store.agents.archive(agentId, false);
|
|
469
469
|
const off = (await this.store.triggers.list(agentId)).map(asTrigger).filter((t) => !t.enabled && reasonOf(t.disabled) === "agent_archived");
|
|
470
470
|
for (const t of off)
|
|
471
|
-
if (turnOn(t
|
|
471
|
+
if (turnOn(t))
|
|
472
472
|
await this.update(t.id, { enabled: true }, { onAgent: agentId }).catch(() => undefined);
|
|
473
473
|
const ids = new Set(off.map((t) => t.id));
|
|
474
474
|
return (await this.store.triggers.list(agentId)).filter((t) => ids.has(t.id) && !t.enabled).map((t) => ({ id: t.id, name: t.name }));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@parcha/agentrun-serve",
|
|
3
|
-
"version": "0.1.0-beta.
|
|
3
|
+
"version": "0.1.0-beta.61",
|
|
4
4
|
"description": "The AgentRun server: the /v2 API and console over one store, with runners that run your agents; the deployable process of the AgentRun platform.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"agentrun",
|
|
@@ -70,17 +70,17 @@
|
|
|
70
70
|
"@opentelemetry/exporter-trace-otlp-http": "0.301.2",
|
|
71
71
|
"@opentelemetry/resources": "3.1.1",
|
|
72
72
|
"@opentelemetry/sdk-trace": "3.1.1",
|
|
73
|
-
"@parcha/agentrun-computer": "0.1.0-beta.
|
|
74
|
-
"@parcha/agentrun-decisions": "0.1.0-beta.
|
|
75
|
-
"@parcha/agentrun-dsl": "0.1.0-beta.
|
|
76
|
-
"@parcha/agentrun-harness-acp": "0.1.0-beta.
|
|
77
|
-
"@parcha/agentrun-harness-claude": "0.1.0-beta.
|
|
78
|
-
"@parcha/agentrun-harness-codex": "0.1.0-beta.
|
|
79
|
-
"@parcha/agentrun-import": "0.1.0-beta.
|
|
80
|
-
"@parcha/agentrun-jev": "0.1.0-beta.
|
|
81
|
-
"@parcha/agentrun-kernel": "0.1.0-beta.
|
|
82
|
-
"@parcha/agentrun-web": "0.1.0-beta.
|
|
83
|
-
"@parcha/pi-browser": "0.1.0-beta.
|
|
73
|
+
"@parcha/agentrun-computer": "0.1.0-beta.61",
|
|
74
|
+
"@parcha/agentrun-decisions": "0.1.0-beta.61",
|
|
75
|
+
"@parcha/agentrun-dsl": "0.1.0-beta.61",
|
|
76
|
+
"@parcha/agentrun-harness-acp": "0.1.0-beta.61",
|
|
77
|
+
"@parcha/agentrun-harness-claude": "0.1.0-beta.61",
|
|
78
|
+
"@parcha/agentrun-harness-codex": "0.1.0-beta.61",
|
|
79
|
+
"@parcha/agentrun-import": "0.1.0-beta.61",
|
|
80
|
+
"@parcha/agentrun-jev": "0.1.0-beta.61",
|
|
81
|
+
"@parcha/agentrun-kernel": "0.1.0-beta.61",
|
|
82
|
+
"@parcha/agentrun-web": "0.1.0-beta.61",
|
|
83
|
+
"@parcha/pi-browser": "0.1.0-beta.61",
|
|
84
84
|
"@secretlint/core": "14.1.0",
|
|
85
85
|
"@secretlint/profiler": "14.1.0",
|
|
86
86
|
"croner": "11.0.0",
|