@parcha/agentrun-serve 0.1.0-beta.51 → 0.1.0-beta.53
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 +160 -1
- package/README.md +306 -36
- package/dist/adapters.js +1 -1
- package/dist/agent-delete.d.ts +14 -4
- package/dist/agent-delete.js +30 -58
- package/dist/agent-package.d.ts +71 -0
- package/dist/agent-package.js +345 -0
- package/dist/agents-store.d.ts +28 -18
- package/dist/agents-store.js +48 -34
- package/dist/api-only.d.ts +30 -8
- package/dist/api-only.js +40 -16
- package/dist/archil-routes.d.ts +1 -0
- package/dist/archil-routes.js +28 -2
- package/dist/claude-login.d.ts +1 -0
- package/dist/claude-login.js +1 -1
- package/dist/cli-learning/cli.d.ts +3 -0
- package/dist/cli-learning/cli.js +17 -3
- package/dist/cli-learning/connections.js +3 -2
- package/dist/cli-learning/schema.js +2 -1
- package/dist/cli.js +70 -7
- package/dist/composio-preset.d.ts +2 -1
- package/dist/composio-preset.js +4 -3
- package/dist/composio-triggers.d.ts +4 -0
- package/dist/composio-triggers.js +4 -1
- package/dist/computer-needs.d.ts +32 -0
- package/dist/computer-needs.js +80 -0
- package/dist/computer-setting.d.ts +9 -0
- package/dist/computer-setting.js +19 -1
- package/dist/computers.d.ts +6 -2
- package/dist/computers.js +2 -2
- package/dist/console/assets/index-BFgyZzF_.js +734 -0
- package/dist/console/assets/index-DbilxljH.css +1 -0
- package/dist/console/index.html +2 -2
- package/dist/console-links.d.ts +1 -0
- package/dist/console-links.js +2 -0
- package/dist/env-switch.d.ts +14 -0
- package/dist/env-switch.js +23 -0
- package/dist/errors.d.ts +1 -0
- package/dist/errors.js +3 -0
- package/dist/eval-previous.js +4 -3
- package/dist/fal-price.d.ts +76 -0
- package/dist/fal-price.js +365 -0
- package/dist/handed-secret.d.ts +4 -0
- package/dist/handed-secret.js +10 -0
- package/dist/harness-archive.d.ts +15 -5
- package/dist/harness-archive.js +71 -34
- package/dist/harness-check.d.ts +2 -1
- package/dist/harness-check.js +36 -95
- package/dist/harness-egress.d.ts +23 -0
- package/dist/harness-egress.js +69 -0
- package/dist/harness-recipe-entry.d.ts +71 -0
- package/dist/harness-recipe-entry.js +184 -0
- package/dist/harness-recipe.d.ts +73 -6
- package/dist/harness-recipe.js +185 -31
- package/dist/harness-sign-in.d.ts +29 -0
- package/dist/harness-sign-in.js +122 -0
- package/dist/harness-table.d.ts +21 -0
- package/dist/harness-table.js +58 -3
- package/dist/harness-zip.d.ts +6 -0
- package/dist/harness-zip.js +203 -0
- package/dist/ids.d.ts +11 -0
- package/dist/ids.js +36 -0
- package/dist/learn/commit.d.ts +19 -1
- package/dist/learn/commit.js +160 -2
- package/dist/learn/compile.d.ts +13 -5
- package/dist/learn/compile.js +46 -15
- package/dist/learn/delete.d.ts +12 -6
- package/dist/learn/delete.js +17 -11
- package/dist/learn/folder.d.ts +16 -0
- package/dist/learn/folder.js +30 -4
- package/dist/learn/learning-of.d.ts +8 -0
- package/dist/learn/learning-of.js +8 -0
- package/dist/learn/learning.sh +29 -4
- package/dist/learn/promote.d.ts +51 -7
- package/dist/learn/promote.js +51 -8
- package/dist/learn/secrets.js +30 -7
- package/dist/learning-reset.d.ts +18 -0
- package/dist/learning-reset.js +115 -0
- package/dist/learning-routes.d.ts +23 -11
- package/dist/learning-routes.js +110 -20
- package/dist/learning-words.d.ts +5 -0
- package/dist/learning-words.js +5 -0
- package/dist/learning.d.ts +15 -10
- package/dist/learning.js +14 -8
- package/dist/llms.txt +1 -0
- package/dist/mcp-gateway.d.ts +39 -2
- package/dist/mcp-gateway.js +56 -12
- package/dist/mcp-pin-first.js +1 -1
- package/dist/mcp-probe.d.ts +3 -0
- package/dist/mcp-probe.js +7 -2
- package/dist/mcp-resources.d.ts +44 -0
- package/dist/mcp-resources.js +100 -0
- package/dist/mcp-servers-store.d.ts +17 -12
- package/dist/mcp-servers-store.js +2 -1
- package/dist/media-duration.d.ts +2 -0
- package/dist/media-duration.js +136 -0
- package/dist/model.d.ts +4 -4
- package/dist/model.js +6 -6
- package/dist/native/cli.js +9 -2
- package/dist/native/connection.d.ts +2 -2
- package/dist/native/connection.js +5 -2
- package/dist/native/discovery.d.ts +2 -0
- package/dist/native/discovery.js +10 -6
- package/dist/native/remote-worker-bridge.js +36 -4
- package/dist/native/remote.d.ts +18 -1
- package/dist/native/remote.js +126 -37
- package/dist/native/schema.d.ts +6 -0
- package/dist/native/schema.js +31 -6
- package/dist/native/source-account.d.ts +13 -0
- package/dist/native/source-account.js +114 -0
- package/dist/native/source-capture-hooks.d.ts +5 -0
- package/dist/native/source-capture-hooks.js +102 -0
- package/dist/native/source-mcp-selection.d.ts +13 -0
- package/dist/native/source-mcp-selection.js +72 -0
- package/dist/native/source-runtime-tools.d.ts +19 -0
- package/dist/native/source-runtime-tools.js +103 -0
- package/dist/native/source-snapshot-types.d.ts +138 -0
- package/dist/native/source-snapshot-types.js +12 -0
- package/dist/native/source-snapshot.d.ts +8 -0
- package/dist/native/source-snapshot.js +1201 -0
- package/dist/observation/learning.js +3 -2
- package/dist/openapi.js +211 -47
- package/dist/print.js +1 -1
- package/dist/provider.d.ts +8 -0
- package/dist/provider.js +14 -2
- package/dist/purged-workflow.d.ts +12 -0
- package/dist/purged-workflow.js +43 -0
- package/dist/refusal-words.d.ts +0 -3
- package/dist/refusal-words.js +0 -3
- package/dist/request-metadata.d.ts +20 -0
- package/dist/request-metadata.js +24 -0
- package/dist/run-keys.d.ts +46 -0
- package/dist/run-keys.js +109 -0
- package/dist/run-launch.d.ts +29 -5
- package/dist/run-launch.js +44 -4
- package/dist/run-learning-served.d.ts +2 -2
- package/dist/run-model-key.d.ts +2 -2
- package/dist/run-model-key.js +5 -5
- package/dist/run-secrets.d.ts +2 -0
- package/dist/run-secrets.js +7 -4
- package/dist/run-usage.d.ts +48 -4
- package/dist/run-usage.js +156 -39
- package/dist/run-view.d.ts +18 -1
- package/dist/run-view.js +28 -8
- package/dist/runner/adapter-loop.d.ts +14 -4
- package/dist/runner/adapter-loop.js +150 -31
- package/dist/runner/adapter-run-spec.d.ts +1 -1
- package/dist/runner/adapter-run-spec.js +35 -22
- package/dist/runner/audit.d.ts +10 -3
- package/dist/runner/audit.js +30 -7
- package/dist/runner/beside.js +2 -1
- package/dist/runner/claim-secrets.d.ts +31 -4
- package/dist/runner/claim-secrets.js +43 -7
- package/dist/runner/cli-run-spec.d.ts +1 -1
- package/dist/runner/cli-run-spec.js +32 -20
- package/dist/runner/conformance/harness.js +4 -2
- package/dist/runner/dispatch.js +4 -2
- package/dist/runner/harness-loops.d.ts +6 -0
- package/dist/runner/harness-loops.js +16 -3
- package/dist/runner/held.d.ts +4 -0
- package/dist/runner/journal-kinds.d.ts +5 -0
- package/dist/runner/learned-first.d.ts +2 -0
- package/dist/runner/learned-first.js +1 -1
- package/dist/runner/learning-end.d.ts +9 -3
- package/dist/runner/learning-end.js +66 -29
- package/dist/runner/learning-seed.d.ts +9 -3
- package/dist/runner/learning-seed.js +2 -2
- package/dist/runner/main.d.ts +1 -0
- package/dist/runner/main.js +20 -13
- package/dist/runner/mcp-claim.js +7 -2
- package/dist/runner/mcp-run.d.ts +12 -0
- package/dist/runner/mcp-run.js +14 -1
- package/dist/runner/model-route.js +7 -4
- package/dist/runner/monid-run.js +9 -11
- package/dist/runner/project-checkpoint.d.ts +35 -0
- package/dist/runner/project-checkpoint.js +116 -0
- package/dist/runner/project-drain.d.ts +8 -0
- package/dist/runner/project-drain.js +25 -0
- package/dist/runner/project-host.d.ts +10 -0
- package/dist/runner/project-host.js +52 -0
- package/dist/runner/promotion.d.ts +51 -24
- package/dist/runner/promotion.js +206 -78
- package/dist/runner/redact.d.ts +13 -0
- package/dist/runner/redact.js +67 -1
- package/dist/runner/run-channel.d.ts +9 -0
- package/dist/runner/run-channel.js +15 -2
- package/dist/runner/run-child-host.d.ts +8 -4
- package/dist/runner/run-child-host.js +174 -42
- package/dist/runner/run-errors.js +2 -2
- package/dist/runner/runner-check.js +5 -2
- package/dist/runner/runner.js +41 -12
- package/dist/runner/sdk-loop.d.ts +2 -2
- package/dist/runner/sdk-loop.js +3 -3
- package/dist/runner/store-port.d.ts +3 -0
- package/dist/runner/store-secrets.js +7 -3
- package/dist/runner/workflow-first.d.ts +4 -0
- package/dist/runner/workflow-first.js +13 -0
- package/dist/runner/workflow-loop.d.ts +2 -1
- package/dist/runner/workflow-loop.js +2 -1
- package/dist/runner/workflow-spec.js +4 -4
- package/dist/runs-over-store.d.ts +39 -8
- package/dist/runs-over-store.js +147 -32
- package/dist/sdk/check.d.ts +6 -5
- package/dist/sdk/check.js +17 -16
- package/dist/sdk/runs.d.ts +11 -1
- package/dist/sdk/runs.js +185 -78
- package/dist/sdk/schema.js +12 -2
- package/dist/sdk/workflows.d.ts +1 -1
- package/dist/server.d.ts +68 -32
- package/dist/server.js +678 -124
- package/dist/skills/agentrun-serve/SKILL.md +2 -1
- package/dist/source-sync/adoption.d.ts +15 -0
- package/dist/source-sync/adoption.js +36 -0
- package/dist/source-sync/auxiliary.d.ts +23 -0
- package/dist/source-sync/auxiliary.js +64 -0
- package/dist/source-sync/capture-git.d.ts +5 -0
- package/dist/source-sync/capture-git.js +272 -0
- package/dist/source-sync/capture-project.d.ts +53 -0
- package/dist/source-sync/capture-project.js +206 -0
- package/dist/source-sync/capture-refusal.d.ts +7 -0
- package/dist/source-sync/capture-refusal.js +16 -0
- package/dist/source-sync/capture.d.ts +11 -0
- package/dist/source-sync/capture.js +22 -0
- package/dist/source-sync/checkpoint-gate.d.ts +21 -0
- package/dist/source-sync/checkpoint-gate.js +52 -0
- package/dist/source-sync/checkpoints.d.ts +66 -0
- package/dist/source-sync/checkpoints.js +168 -0
- package/dist/source-sync/claim.d.ts +11 -0
- package/dist/source-sync/claim.js +48 -0
- package/dist/source-sync/destination.d.ts +47 -0
- package/dist/source-sync/destination.js +239 -0
- package/dist/source-sync/io.d.ts +15 -0
- package/dist/source-sync/io.js +52 -0
- package/dist/source-sync/local.d.ts +43 -0
- package/dist/source-sync/local.js +229 -0
- package/dist/source-sync/prepare.d.ts +59 -0
- package/dist/source-sync/prepare.js +93 -0
- package/dist/source-sync/projects.d.ts +61 -0
- package/dist/source-sync/projects.js +130 -0
- package/dist/source-sync/registry.d.ts +95 -0
- package/dist/source-sync/registry.js +226 -0
- package/dist/source-sync/service.d.ts +33 -0
- package/dist/source-sync/service.js +118 -0
- package/dist/source-sync/skill-edits.d.ts +12 -0
- package/dist/source-sync/skill-edits.js +122 -0
- package/dist/source-sync/snapshots.d.ts +48 -0
- package/dist/source-sync/snapshots.js +448 -0
- package/dist/source-sync/types.d.ts +9 -0
- package/dist/source-sync/types.js +14 -0
- package/dist/source-sync/workspace.d.ts +66 -0
- package/dist/source-sync/workspace.js +273 -0
- package/dist/store/agent-body.d.ts +8 -0
- package/dist/store/agent-body.js +20 -6
- package/dist/store/index.d.ts +2 -2
- package/dist/store/index.js +1 -1
- package/dist/store/journal/storage.d.ts +2 -0
- package/dist/store/journal/storage.js +2 -1
- package/dist/store/postgres/migrations/0025_run_attempts.sql +27 -0
- package/dist/store/postgres/migrations/0026_run_disk.sql +23 -0
- package/dist/store/schema.d.ts +15 -1
- package/dist/store/schema.js +43 -4
- package/dist/store/seal.d.ts +5 -1
- package/dist/store/seal.js +12 -3
- package/dist/store/sqlite/project-checkpoints.d.ts +11 -0
- package/dist/store/sqlite/project-checkpoints.js +70 -0
- package/dist/store/sqlite/run-launch.d.ts +14 -0
- package/dist/store/sqlite/run-launch.js +58 -7
- package/dist/store/sqlite/run-patch.d.ts +2 -1
- package/dist/store/sqlite/run-patch.js +4 -3
- package/dist/store/sqlite/store.js +319 -153
- package/dist/store/store-schema.js +2 -2
- package/dist/store/store.d.ts +173 -33
- package/dist/store/store.js +14 -1
- package/dist/store-reads/learning.d.ts +12 -8
- package/dist/store-reads/learning.js +33 -24
- package/dist/store-reads/loop.d.ts +4 -3
- package/dist/store-reads/loop.js +7 -5
- package/dist/store-view.d.ts +3 -1
- package/dist/store-view.js +17 -5
- package/dist/template-eval.js +4 -4
- package/dist/template-import.d.ts +10 -2
- package/dist/template-import.js +116 -13
- package/dist/templates.d.ts +29 -5
- package/dist/templates.js +68 -14
- package/dist/timeline/index.d.ts +1 -1
- package/dist/timeline/index.js +1 -1
- package/dist/timeline/labels.js +1 -1
- package/dist/timeline/timeline.d.ts +5 -0
- package/dist/timeline/timeline.js +8 -0
- package/dist/tool-plane.d.ts +12 -12
- package/dist/tools.d.ts +8 -8
- package/dist/tools.js +1 -1
- package/dist/trigger-launch-hook.d.ts +47 -0
- package/dist/trigger-launch-hook.js +90 -0
- package/dist/trigger-targets.d.ts +14 -1
- package/dist/trigger-targets.js +20 -0
- package/dist/triggers.d.ts +54 -5
- package/dist/triggers.js +143 -8
- package/dist/uploads-archil.js +2 -1
- package/dist/uploads.d.ts +0 -3
- package/dist/uploads.js +2 -11
- package/dist/validate.js +4 -1
- package/dist/web-save.d.ts +3 -0
- package/dist/web-save.js +17 -2
- package/dist/workspace/archil-exec.js +1 -1
- package/dist/workspace/archil.js +1 -1
- package/dist/workspace/computer-for-claim.d.ts +2 -0
- package/dist/workspace/computer-for-claim.js +43 -0
- package/dist/workspace/paths.d.ts +6 -0
- package/dist/workspace/paths.js +6 -0
- package/dist/workspace/resolve-computer.d.ts +1 -0
- package/dist/workspace/revision-skills.js +24 -11
- package/dist/workspace/run-tools.d.ts +2 -0
- package/dist/workspace/run-tools.js +8 -0
- package/dist/workspace/synced-folder.d.ts +3 -3
- package/dist/workspace/synced-folder.js +7 -6
- package/launcher/agentrun-serve +1 -1
- package/package.json +10 -10
- package/skills/agentrun-serve/SKILL.md +2 -1
- package/templates/README.md +5 -2
- package/dist/console/assets/index-Bt1B51b7.js +0 -733
- package/dist/console/assets/index-sVftE9Ht.css +0 -1
package/dist/sdk/runs.js
CHANGED
|
@@ -1,23 +1,28 @@
|
|
|
1
1
|
// Backend SDK calls remain in their application. This inbox only records their evidence and immutable completion;
|
|
2
2
|
// the ordinary fenced runner owns journals, reflection, checking and learning commits.
|
|
3
|
+
import { cliCaptureOf } from "../source-sync/capture.js";
|
|
4
|
+
import { sourceKey } from "../source-sync/registry.js";
|
|
3
5
|
import { createHash, createHmac, timingSafeEqual } from "node:crypto";
|
|
4
6
|
import { inspectWorkflow, resolveSchemaForWorkflow } from "@parcha/agentrun-dsl";
|
|
5
|
-
import { ApiError } from "../errors.js";
|
|
7
|
+
import { ApiError, invalid } from "../errors.js";
|
|
6
8
|
import { canonical, isObject, cliLearningOf, learningSettingForBody } from "../store/agent-body.js";
|
|
7
|
-
import { uuidv7 } from "../
|
|
9
|
+
import { uuidv7 } from "../ids.js";
|
|
8
10
|
import { launchBody } from "../run-launch.js";
|
|
9
11
|
import { learningStartFor } from "../runs-over-store.js";
|
|
10
|
-
import {
|
|
12
|
+
import { labelsIssues, labelsOf } from "../run-labels.js";
|
|
13
|
+
import { chooseWorkflows, learningFolderOf, seedAt, secretsShown, withAgentRepo } from "../learning.js";
|
|
11
14
|
import { INSTRUCTION_EVIDENCE_BYTES } from "../native/instructions.js";
|
|
12
15
|
import { CLI_POLICY_BYTES } from "../cli-learning/policy.js";
|
|
13
16
|
import { refuseWhileNoRunner } from "../runner/presence.js";
|
|
14
17
|
import { secretRedactor } from "../runner/redact.js";
|
|
15
18
|
import { redactedOutput } from "../key-refusal.js";
|
|
16
19
|
import { decodedStrings, draftProblems } from "../learn/workflow-draft.js";
|
|
20
|
+
import { snapshotAt } from "../learn/folder.js";
|
|
21
|
+
import { purgedRun, purgedWorkflows } from "../purged-workflow.js";
|
|
17
22
|
import { sdkWorkflowManifest, sdkDraftTools } from "./workflows.js";
|
|
18
|
-
import { promotionOf, promotionsOf } from "../learn/promote.js";
|
|
23
|
+
import { promotionOf, promotionsOf, resetAtOf } from "../learn/promote.js";
|
|
19
24
|
import { championTextOf, releaseSdkCheck, reserveSdkCheck } from "../runner/promotion.js";
|
|
20
|
-
import {
|
|
25
|
+
import { sdkTakes, workflowDigest } from "../runner/workflow-first.js";
|
|
21
26
|
import { SDK_WORKFLOW_RUNTIMES, sdkBindingOf } from "./runtimes.js";
|
|
22
27
|
export { SDK_RUNTIMES, isSdkRuntime } from "./runtimes.js";
|
|
23
28
|
/** Claude's begin snapshot is provisional; only its immutable same-window completion can establish policy. */
|
|
@@ -30,6 +35,13 @@ export function cliPolicyOf(launch, completion) {
|
|
|
30
35
|
const keyOf = (id) => `sdk-run:${id}`;
|
|
31
36
|
/** The settings key an SDK run's record is kept under (the run's delete with its agent's: agent-delete.ts). */
|
|
32
37
|
export const sdkRunKey = keyOf;
|
|
38
|
+
/** An inbox takes evidence until an hour after its start or its latest events batch, and never past a day after its start. */
|
|
39
|
+
const SDK_OPEN_MS = 3_600_000;
|
|
40
|
+
export const SDK_MAX_OPEN_MS = 86_400_000;
|
|
41
|
+
/** A start's `started_at`: at most this far ahead of the server's clock, at most this far behind it. */
|
|
42
|
+
const STARTED_SKEW_MS = 60_000, STARTED_BACK_MS = 7 * 86_400_000;
|
|
43
|
+
const TITLE_LIMIT = 200;
|
|
44
|
+
const RFC3339 = /^(\d{4})-(\d{2})-(\d{2})[Tt](\d{2}):(\d{2}):(\d{2})(\.\d+)?(?:[Zz]|([+-])(\d{2}):(\d{2}))$/;
|
|
33
45
|
const TEXT_LIMIT = 128_000, BATCH_LIMIT = 256_000, TOTAL_LIMIT = 4_000_000;
|
|
34
46
|
// Always leave enough room for bounded completion after an evidence upload reaches its limit.
|
|
35
47
|
const EVIDENCE_LIMIT = TOTAL_LIMIT - 600_000;
|
|
@@ -61,6 +73,31 @@ const usageOf = (value) => {
|
|
|
61
73
|
}
|
|
62
74
|
return result;
|
|
63
75
|
};
|
|
76
|
+
/** An RFC 3339 date-time as epoch ms, or undefined when it is not one (a field out of range included). */
|
|
77
|
+
function rfc3339(value) {
|
|
78
|
+
const m = RFC3339.exec(value);
|
|
79
|
+
if (!m)
|
|
80
|
+
return undefined;
|
|
81
|
+
const [y, mo, d, h, mi, s] = m.slice(1, 7).map(Number);
|
|
82
|
+
const day = new Date(Date.UTC(y, mo - 1, d));
|
|
83
|
+
if (day.getUTCFullYear() !== y || day.getUTCMonth() !== mo - 1 || day.getUTCDate() !== d || h > 23 || mi > 59 || s > 59)
|
|
84
|
+
return undefined;
|
|
85
|
+
if (m[8] && (Number(m[9]) > 23 || Number(m[10]) > 59))
|
|
86
|
+
return undefined;
|
|
87
|
+
const offset = m[8] ? (m[8] === "-" ? -1 : 1) * (Number(m[9]) * 60 + Number(m[10])) * 60_000 : 0;
|
|
88
|
+
return Date.UTC(y, mo - 1, d, h, mi, s, Math.floor(Number(`0${m[7] ?? ""}`) * 1000)) - offset;
|
|
89
|
+
}
|
|
90
|
+
/** A start's `started_at` as epoch ms: its form only, refused when it is not an RFC 3339 date-time. */
|
|
91
|
+
const rfc3339Of = (value) => (typeof value === "string" ? rfc3339(value) : undefined) ?? refuse("started_at must be an RFC 3339 date-time, such as 2026-01-02T03:04:05Z.");
|
|
92
|
+
/** A new start's `started_at` against the server's clock at `now`: when the backend began the task, if before this request.
|
|
93
|
+
* The run's `created_at` takes it. Never applied to a retry of a start already made (its receipt is returned first). */
|
|
94
|
+
const startedWithin = (at, now) => {
|
|
95
|
+
if (at > now + STARTED_SKEW_MS)
|
|
96
|
+
refuse("started_at must not be in the future.");
|
|
97
|
+
if (at < now - STARTED_BACK_MS)
|
|
98
|
+
refuse("started_at must be at most 7 days ago.");
|
|
99
|
+
return Math.min(at, now);
|
|
100
|
+
};
|
|
64
101
|
export const sdkOf = (body) => isObject(body) ? sdkBindingOf(body.sdk) : undefined;
|
|
65
102
|
export async function sdkInbox(store, runId) {
|
|
66
103
|
const row = await store.settings.get(keyOf(runId));
|
|
@@ -69,12 +106,15 @@ export async function sdkInbox(store, runId) {
|
|
|
69
106
|
return row;
|
|
70
107
|
}
|
|
71
108
|
/** Completion and closure compete on the same inbox. A stale runner cannot close it, and a completion that won
|
|
72
|
-
* remains available to the next claim even if this one cannot read or journal it. No external SDK call is replayed.
|
|
109
|
+
* remains available to the next claim even if this one cannot read or journal it. No external SDK call is replayed.
|
|
110
|
+
* An expiry is checked against the row it replaces: an events batch that moved the deadline keeps the inbox open. */
|
|
73
111
|
export async function closeSdkInbox(store, claim, reason) {
|
|
74
112
|
for (let retry = 0; retry < 20; retry++) {
|
|
75
113
|
const row = await sdkInbox(store, claim.runId);
|
|
76
114
|
if (row.completion || row.closed)
|
|
77
115
|
return row;
|
|
116
|
+
if (reason === "expired" && row.expires_at >= Date.now())
|
|
117
|
+
return row;
|
|
78
118
|
const next = { ...row, closed: reason };
|
|
79
119
|
if (await store.settings.replaceIf(keyOf(claim.runId), row, next, claim))
|
|
80
120
|
return next;
|
|
@@ -175,13 +215,22 @@ export class SdkRuns {
|
|
|
175
215
|
async start(entry, body, deps, origin, compile, consoleOrigin, cli) {
|
|
176
216
|
if (this.lane !== (cli ? "cli" : "sdk"))
|
|
177
217
|
refuse("The run must use its enrolled credential lane.");
|
|
178
|
-
only(body, cli ? ["runtime", "input", "instructions", "model"] : ["runtime", "platform", "input", "instructions", "model", "workflow_tools", "workflow_adapters"]);
|
|
218
|
+
only(body, cli ? ["runtime", "input", "instructions", "model"] : ["runtime", "platform", "input", "instructions", "model", "workflow_tools", "workflow_adapters", "started_at", "title", "labels"]);
|
|
179
219
|
const source = cli ? undefined : sdkBindingOf(body) ?? refuse("The SDK source needs a supported runtime; external requires a platform label of 1–80 characters without surrounding whitespace, controls or lone surrogates. Other runtimes do not take platform.");
|
|
180
220
|
if (source && !SDK_WORKFLOW_RUNTIMES.includes(source.runtime) && (body.workflow_tools !== undefined || body.workflow_adapters !== undefined))
|
|
181
221
|
refuse("External runs receive owner corrections; workflow_tools and workflow_adapters require a backend workflow bridge.");
|
|
182
222
|
const workflow = cli ? undefined : sdkWorkflowManifest(body.workflow_tools, body.workflow_adapters);
|
|
183
223
|
if (workflow && canonical(this.clean(workflow)) !== canonical(workflow))
|
|
184
224
|
refuse("The workflow manifest contains a protected value; keep credentials in the backend.");
|
|
225
|
+
const expectedCurrent = entry.agent.currentRevision;
|
|
226
|
+
const managedLearning = learningSettingForBody(entry.revision?.body);
|
|
227
|
+
const capture = cli ? await cliCaptureOf(this.store, entry) : undefined;
|
|
228
|
+
const sourceGuards = cli ? [{ key: `cli-learning-connection:${cli.connection_id}`, fields: { active: true, generation: cli.connection_generation, agent_id: entry.agent.id } }] : [];
|
|
229
|
+
if (capture) {
|
|
230
|
+
entry = { ...entry, revision: capture.revision };
|
|
231
|
+
if (capture.source)
|
|
232
|
+
sourceGuards.push({ key: sourceKey(entry.agent.id), fields: { id: capture.source.id, capture_revision: capture.source.capture_revision } });
|
|
233
|
+
}
|
|
185
234
|
const binding = sdkOf(entry.revision?.body);
|
|
186
235
|
if (cli) {
|
|
187
236
|
if (cliLearningOf(entry.revision?.body)?.connection_id !== cli.connection_id)
|
|
@@ -198,6 +247,18 @@ export class SdkRuns {
|
|
|
198
247
|
throw new ApiError("agent_archived", "This SDK agent is archived.");
|
|
199
248
|
const input = text(body.input, "input"), instructions = text(body.instructions, "instructions", cli ? CLI_POLICY_BYTES : TEXT_LIMIT);
|
|
200
249
|
const model = body.model === undefined ? undefined : text(body.model, "model", 256);
|
|
250
|
+
// Its form is checked now; its distance from the clock only for a new start, below: a retry of a start that was made
|
|
251
|
+
// (its origin and fingerprint kept) gets its receipt however late it comes.
|
|
252
|
+
const reportedAt = body.started_at === undefined ? undefined : rfc3339Of(body.started_at);
|
|
253
|
+
const title = body.title === undefined ? undefined : text(body.title, "title").trim().replace(/\s+/g, " ");
|
|
254
|
+
if (title !== undefined && ([...title].length < 1 || [...title].length > TITLE_LIMIT))
|
|
255
|
+
refuse(`title must be text of 1 to ${TITLE_LIMIT} characters.`);
|
|
256
|
+
const labelIssues = labelsIssues(body.labels);
|
|
257
|
+
if (labelIssues.length)
|
|
258
|
+
throw invalid(labelIssues);
|
|
259
|
+
const labels = labelsOf(body.labels);
|
|
260
|
+
if (labels && canonical(this.clean(labels)) !== canonical(labels))
|
|
261
|
+
refuse("A label contains a protected value; keep credentials in the backend.");
|
|
201
262
|
if (origin) {
|
|
202
263
|
const known = await this.store.runOfOrigin(origin.key);
|
|
203
264
|
if (known) {
|
|
@@ -206,6 +267,7 @@ export class SdkRuns {
|
|
|
206
267
|
return this.receipt(known.runId, consoleOrigin);
|
|
207
268
|
}
|
|
208
269
|
}
|
|
270
|
+
const startedAt = reportedAt === undefined ? undefined : startedWithin(reportedAt, Date.now());
|
|
209
271
|
const cleanedInput = this.clean({ input }).input;
|
|
210
272
|
const pinned = await deps.pinnedOf(entry, {});
|
|
211
273
|
if (!pinned)
|
|
@@ -216,7 +278,9 @@ export class SdkRuns {
|
|
|
216
278
|
// A runner keeps an SDK run's evidence and ends it: while every runner here refused to claim, the start is refused in
|
|
217
279
|
// their words, as any start is (prepareLaunch), before the caller holds a receipt it would run on.
|
|
218
280
|
await refuseWhileNoRunner(this.store.runners);
|
|
219
|
-
|
|
281
|
+
// A connected agent's run names no disk.
|
|
282
|
+
const learning = await learningStartFor(deps, entry, pinned.revision, { ...revisionBody, learning: cli ? managedLearning : learningSettingForBody(revisionBody) }, {
|
|
283
|
+
disk: null,
|
|
220
284
|
noWorkflows: !workflow,
|
|
221
285
|
...(compile.model ? { model: compile.model } : {}),
|
|
222
286
|
});
|
|
@@ -230,72 +294,80 @@ export class SdkRuns {
|
|
|
230
294
|
if (learning.seedFailed)
|
|
231
295
|
throw new ApiError("unavailable", "The learning seed could not be read. Retry after restoring the agent learning folder.");
|
|
232
296
|
}
|
|
233
|
-
const
|
|
234
|
-
const
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
catch (error) {
|
|
279
|
-
await this.store.settings.remove(keyOf(runId));
|
|
280
|
-
// The reservation comes first because the launch it is created with withholds the champion from a check's turn.
|
|
281
|
-
// No turn ran, so the check waits for the next one, the release uncounted: never a hold of a draft never compared.
|
|
282
|
-
if (check) {
|
|
283
|
-
const record = promotionOf(await promotionsOf(this.store.settings, entry.agent.id).catch(() => []), check.workflow.name, check.digest);
|
|
284
|
-
if (record?.decided === "replaying" && record.replay_id === check.id)
|
|
285
|
-
await releaseSdkCheck(checkDeps, record, "its start could not be admitted", false).catch(() => undefined);
|
|
297
|
+
const revision = entry.revision;
|
|
298
|
+
const admit = async () => {
|
|
299
|
+
// The reset deletes the agent's learning in this queue after setting its watermark (learning-reset.ts): a seed
|
|
300
|
+
// read at or before it is of learning the reset deleted, so the start is refused, to start again on a new seed.
|
|
301
|
+
const reset = learning ? await resetAtOf(this.store.settings, entry.agent.id) : undefined;
|
|
302
|
+
if (learning && reset !== undefined && !(learning.seededAt !== undefined && learning.seededAt > reset))
|
|
303
|
+
throw new ApiError("unavailable", "The agent's learning was reset while this run started: start it again.", { retry_after_ms: 1_000 });
|
|
304
|
+
const selected = learning && !learning.noWorkflows && workflow ? await this.selectedWorkflows(entry.agent.id, learning.seed, workflow) : { workflows: [], commits: {}, candidates: [] };
|
|
305
|
+
const cleaned = this.clean({ instructions, ...(model ? { model } : {}) });
|
|
306
|
+
const runId = uuidv7();
|
|
307
|
+
const redacted = cleanedInput !== input || cleaned.instructions !== instructions;
|
|
308
|
+
// A turn is a check only when it can be one's baseline: no protected value in its task or policy, and an input the
|
|
309
|
+
// draft takes (sdkTakes). A prose turn whose input the client cannot resolve is given back (releaseSdkCheck).
|
|
310
|
+
const takes = (flow) => !redacted && sdkTakes(flow, input, resolveSchemaForWorkflow);
|
|
311
|
+
const checkDeps = { store: this.store, agentId: entry.agent.id, log: () => { }, shown: async () => secretsShown(this.secrets(), { local: true }) };
|
|
312
|
+
const check = learning ? await reserveSdkCheck(checkDeps, { runId, revision: learning.seed, learning: revisionBody.learning, flows: selected.candidates, takes }) : undefined;
|
|
313
|
+
// A shadow check needs the original agent's own answer, not an answer produced by its existing champion.
|
|
314
|
+
const workflows = check ? [] : selected.workflows;
|
|
315
|
+
const launch = {
|
|
316
|
+
input: { content: cleanedInput },
|
|
317
|
+
title: title === undefined ? cleanedInput.trim().replace(/\s+/g, " ").slice(0, 80) : this.clean({ title }).title,
|
|
318
|
+
place: { mode: "runner" },
|
|
319
|
+
...(cli ? {
|
|
320
|
+
harness: "cli",
|
|
321
|
+
cli_learning: { ...cli, instructions: cleaned.instructions, policy_complete: cli.policy_complete && cleaned.instructions === instructions, ...(cleaned.model ? { model: cleaned.model } : {}) },
|
|
322
|
+
} : {
|
|
323
|
+
harness: "sdk",
|
|
324
|
+
sdk: { ...binding, ...workflow, instructions: cleaned.instructions, ...(cleaned.model ? { model: cleaned.model } : {}) },
|
|
325
|
+
}),
|
|
326
|
+
...(learning ? { learning: { ...learning, workflows: workflows.map((flow) => flow.name) } } : {}),
|
|
327
|
+
};
|
|
328
|
+
const now = Date.now();
|
|
329
|
+
try {
|
|
330
|
+
await this.store.settings.put(keyOf(runId), {
|
|
331
|
+
run_id: runId,
|
|
332
|
+
created_at: now,
|
|
333
|
+
expires_at: now + (cli ? SDK_MAX_OPEN_MS : SDK_OPEN_MS),
|
|
334
|
+
batches: [],
|
|
335
|
+
learning_workflows: workflows,
|
|
336
|
+
...(workflows.length ? { learning_commits: selected.commits } : {}),
|
|
337
|
+
...(check ? { learning_check: check } : {}),
|
|
338
|
+
...(redacted ? { check_redacted: true } : {}),
|
|
339
|
+
...(cli && cleanedInput !== input ? { evidence_incomplete: true } : {}),
|
|
340
|
+
});
|
|
341
|
+
await this.store.runs.create({ id: runId, agentId: entry.agent.id, revisionId: revision.id, ...(cli ? { expectedCurrent, settingsGuards: sourceGuards } : {}), ...(origin ? { origin } : {}), ...(labels ? { labels } : {}), ...(startedAt !== undefined ? { startedAt } : {}) }, { body: launchBody(launch) });
|
|
286
342
|
}
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
if (
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
343
|
+
catch (error) {
|
|
344
|
+
await this.store.settings.remove(keyOf(runId));
|
|
345
|
+
// The reservation comes first because the launch it is created with withholds the champion from a check's turn.
|
|
346
|
+
// No turn ran, so the check waits for the next one, the release uncounted: never a hold of a draft never compared.
|
|
347
|
+
if (check) {
|
|
348
|
+
const record = promotionOf(await promotionsOf(this.store.settings, entry.agent.id).catch(() => []), check.workflow.name, check.digest);
|
|
349
|
+
if (record?.decided === "replaying" && record.replay_id === check.id)
|
|
350
|
+
await releaseSdkCheck(checkDeps, record, "its start could not be admitted", false).catch(() => undefined);
|
|
351
|
+
}
|
|
352
|
+
// Two source hooks may admit the same immutable prompt window under different transport keys.
|
|
353
|
+
// The store's origin constraint chooses one; recover its receipt (the run it chose) without creating another run.
|
|
354
|
+
if (origin) {
|
|
355
|
+
const known = await this.store.runOfOrigin(origin.key);
|
|
356
|
+
if (known) {
|
|
357
|
+
if (known.fingerprint !== origin.fingerprint)
|
|
358
|
+
throw new ApiError("idempotency_mismatch", "The key was used with another SDK start.");
|
|
359
|
+
return known.runId;
|
|
360
|
+
}
|
|
295
361
|
}
|
|
362
|
+
throw error;
|
|
296
363
|
}
|
|
297
|
-
|
|
298
|
-
}
|
|
364
|
+
return runId;
|
|
365
|
+
};
|
|
366
|
+
// A learning start is admitted in its agent's learning queue (learning.ts withAgentRepo), the one a reset of the
|
|
367
|
+
// agent's learning deletes it in: either the reset comes first, and the seed read before it is refused above, or this
|
|
368
|
+
// run's row is made first, and the reset refuses while it goes (409 learning_busy). No check of a draft the reset
|
|
369
|
+
// deleted is reserved, and no run starts on it.
|
|
370
|
+
const runId = learning ? await withAgentRepo(this.data, entry.agent.id, admit) : await admit();
|
|
299
371
|
return this.receipt(runId, consoleOrigin);
|
|
300
372
|
}
|
|
301
373
|
async receipt(runId, consoleOrigin) {
|
|
@@ -305,6 +377,15 @@ export class SdkRuns {
|
|
|
305
377
|
const launch = (await this.store.runs.launch(runId)).body;
|
|
306
378
|
const inbox = await sdkInbox(this.store, runId);
|
|
307
379
|
const workflows = inbox.learning_workflows ?? [];
|
|
380
|
+
// A start sent again answers the receipt it pinned, never a workflow a purged run wrote: 410 purged, as its file read.
|
|
381
|
+
// Each is read at the commit it was taken from (learning_commits; the check's draft at the seed).
|
|
382
|
+
const seed = launch.learning?.seed ?? null;
|
|
383
|
+
const purged = seed === null ? undefined : await this.purgedPinned(run.agentId, [
|
|
384
|
+
...workflows.map((flow) => [flow, inbox.learning_commits?.[flow.name] ?? seed]),
|
|
385
|
+
...(inbox.learning_check ? [[inbox.learning_check.workflow, seed]] : []),
|
|
386
|
+
]);
|
|
387
|
+
if (purged)
|
|
388
|
+
throw purgedRun(purged);
|
|
308
389
|
const shown = secretsShown(this.secrets(), { local: true });
|
|
309
390
|
if (shown.holds(launch.learning?.section ?? "") ||
|
|
310
391
|
[...workflows, ...(inbox.learning_check ? [inbox.learning_check.workflow] : [])].some((flow) => {
|
|
@@ -326,10 +407,32 @@ export class SdkRuns {
|
|
|
326
407
|
},
|
|
327
408
|
};
|
|
328
409
|
}
|
|
410
|
+
/** The purged run (purged-workflow.ts) that wrote a workflow of `pinned`, each read at the learning commit a start took
|
|
411
|
+
* its text from. One read-only exec per commit. */
|
|
412
|
+
async purgedPinned(agentId, pinned) {
|
|
413
|
+
if (pinned.length === 0)
|
|
414
|
+
return undefined;
|
|
415
|
+
const folder = learningFolderOf(this.data, agentId);
|
|
416
|
+
try {
|
|
417
|
+
const reads = new Map();
|
|
418
|
+
const at = (commit) => reads.get(commit) ?? reads.set(commit, snapshotAt(folder.workspace, commit).then((snapshot) => purgedWorkflows(snapshot, this.store))).get(commit);
|
|
419
|
+
for (const [flow, commit] of pinned) {
|
|
420
|
+
const row = (await at(commit)).get(flow.name);
|
|
421
|
+
if (row)
|
|
422
|
+
return row;
|
|
423
|
+
}
|
|
424
|
+
return undefined;
|
|
425
|
+
}
|
|
426
|
+
finally {
|
|
427
|
+
await folder.end();
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
/** The workflows a start delivers and the learning commit each was read at (`commits`: the seed's, or its champion
|
|
431
|
+
* record's), and the drafts a check may take. */
|
|
329
432
|
async selectedWorkflows(agentId, revision, binding) {
|
|
330
433
|
const folder = learningFolderOf(this.data, agentId);
|
|
331
434
|
try {
|
|
332
|
-
const seed = await seedAt(folder.workspace, revision);
|
|
435
|
+
const seed = await seedAt(folder.workspace, revision, this.store);
|
|
333
436
|
const { flows } = chooseWorkflows(seed, secretsShown(this.secrets(), { local: true }));
|
|
334
437
|
const dsl = await import("@parcha/agentrun-dsl");
|
|
335
438
|
const { tools, gated, deniedBy } = sdkDraftTools(binding.workflow_tools);
|
|
@@ -342,16 +445,18 @@ export class SdkRuns {
|
|
|
342
445
|
room -= bytes;
|
|
343
446
|
return true;
|
|
344
447
|
};
|
|
345
|
-
const workflows = [], candidates = [];
|
|
346
|
-
const atCommit = async (name, commit) => chooseWorkflows(await seedAt(folder.workspace, commit), secretsShown(this.secrets(), { local: true })).flows.find((one) => one.name === name);
|
|
448
|
+
const workflows = [], candidates = [], commits = {};
|
|
449
|
+
const atCommit = async (name, commit) => chooseWorkflows(await seedAt(folder.workspace, commit, this.store), secretsShown(this.secrets(), { local: true })).flows.find((one) => one.name === name);
|
|
347
450
|
for (const flow of flows) {
|
|
348
|
-
const { text: serving } = await championTextOf(records, flow, atCommit);
|
|
349
|
-
if (serving && compatible(serving))
|
|
451
|
+
const { text: serving, champion } = await championTextOf(records, flow, atCommit);
|
|
452
|
+
if (serving && compatible(serving)) {
|
|
350
453
|
workflows.push(serving);
|
|
454
|
+
commits[serving.name] = serving === flow ? seed.sha : champion.commit;
|
|
455
|
+
}
|
|
351
456
|
if ((!serving || workflowDigest(serving) !== workflowDigest(flow)) && compatible(flow))
|
|
352
457
|
candidates.push(flow);
|
|
353
458
|
}
|
|
354
|
-
return { workflows, candidates };
|
|
459
|
+
return { workflows, commits, candidates };
|
|
355
460
|
}
|
|
356
461
|
finally {
|
|
357
462
|
await folder.end();
|
|
@@ -472,7 +577,9 @@ export class SdkRuns {
|
|
|
472
577
|
for (const check of checks)
|
|
473
578
|
if (!row.learning_check || check.id !== row.learning_check.id || check.digest !== row.learning_check.digest)
|
|
474
579
|
refuse("The workflow check must name this SDK run's reserved candidate.");
|
|
475
|
-
|
|
580
|
+
// Every accepted batch, an empty one too, keeps the inbox open another hour, up to a day after its start.
|
|
581
|
+
const expires = Math.max(row.expires_at, Math.min(Date.now() + SDK_OPEN_MS, row.created_at + SDK_MAX_OPEN_MS));
|
|
582
|
+
return { ...row, batches: [...row.batches, batch], expires_at: expires, ...(checkRedacted ? { check_redacted: true, ...(launch.cli_learning ? { evidence_incomplete: true } : {}) } : {}) };
|
|
476
583
|
}, EVIDENCE_LIMIT);
|
|
477
584
|
return { accepted: true };
|
|
478
585
|
}
|
package/dist/sdk/schema.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { LABEL_KEY, MAX_LABEL_VALUE, MAX_LABELS } from "../run-labels.js";
|
|
1
2
|
import { MCP_TOOL_KEY_PATTERN } from "../tool-names.js";
|
|
2
3
|
import { SDK_RUNTIMES, SDK_PLATFORM_MAX_LENGTH, SDK_PLATFORM_PATTERN } from "./runtimes.js";
|
|
3
4
|
const text = { type: "string" };
|
|
@@ -78,7 +79,7 @@ export const SDK_PATHS = {
|
|
|
78
79
|
...mark,
|
|
79
80
|
operationId: "startSdkRun",
|
|
80
81
|
summary: "Register a task executed by an existing backend SDK",
|
|
81
|
-
description: "Requires an SDK agent definition. Captures the actual original policy and input, pins promoted workflows and any compiled shadow-check candidate separately, and returns a credential scoped to this run. The backend retains all model/tool/auth settings. Learning requires a configured server reflection/grading model; learning Off needs no server model key.",
|
|
82
|
+
description: "Requires an SDK agent definition. Captures the actual original policy and input, pins promoted workflows and any compiled shadow-check candidate separately, and returns a credential scoped to this run. The backend retains all model/tool/auth settings. Learning requires a configured server reflection/grading model; learning Off needs no server model key. The run takes evidence until an hour after this request; each events batch moves that deadline to an hour after the batch, up to 24 hours after this request (capabilities.features.sdk_runs.max_open_s).",
|
|
82
83
|
parameters: [id("agent_id"), { ...key, required: true }],
|
|
83
84
|
requestBody: body(sdkObject({
|
|
84
85
|
input: { ...text, maxLength: 128000 },
|
|
@@ -93,6 +94,15 @@ export const SDK_PATHS = {
|
|
|
93
94
|
price_usd: { type: "number", minimum: 0 },
|
|
94
95
|
}, ["name", "description", "input_schema", "permission"]) },
|
|
95
96
|
workflow_adapters: { type: "array", maxItems: 2, uniqueItems: true, items: { enum: ["runNode", "runJudge"] }, description: "Optional backend callbacks available for workflow model and decision nodes. Default empty; requires workflow_tools." },
|
|
97
|
+
started_at: { ...text, format: "date-time", description: "When the backend began the task, as an RFC 3339 date-time: the run's created_at. At most 60 seconds ahead of the server's clock and at most 7 days behind it. Absent: now. The evidence deadline is still counted from this request." },
|
|
98
|
+
title: { ...text, minLength: 1, maxLength: 200, description: "The run's title, trimmed and with whitespace collapsed. Absent: the first 80 characters of input." },
|
|
99
|
+
labels: {
|
|
100
|
+
type: "object",
|
|
101
|
+
maxProperties: MAX_LABELS,
|
|
102
|
+
propertyNames: { pattern: LABEL_KEY.source },
|
|
103
|
+
additionalProperties: { type: "string", minLength: 1, maxLength: MAX_LABEL_VALUE },
|
|
104
|
+
description: "The caller's own labels for the run, under the same rules as RunCreate.labels: kept on the run, served on every read of it and matched by GET /runs' label. Put no secret in one: a label holding a server secret is refused.",
|
|
105
|
+
},
|
|
96
106
|
}, ["input", "instructions"])),
|
|
97
107
|
responses: {
|
|
98
108
|
201: response(object({
|
|
@@ -129,7 +139,7 @@ export const SDK_PATHS = {
|
|
|
129
139
|
...mark,
|
|
130
140
|
operationId: "sdkRunEvents",
|
|
131
141
|
summary: "Record bounded SDK execution evidence",
|
|
132
|
-
description: "Use the scoped run token. Batches are contiguous from sequence 1, at most 100 events and 256 KB each, 4 MB total per run. Exact retries are idempotent; conflicting retries and events after completion are refused. Tool start IDs are unique per run. A nested callback names an already open, pinned learned_workflow invocation in parent_tool_use_id, and its result keeps the original call name and parent. Evidence never authorizes or executes a tool.",
|
|
142
|
+
description: "Use the scoped run token. Batches are contiguous from sequence 1, at most 100 events and 256 KB each, 4 MB total per run. Each new batch, an empty one (events: []) included, moves the run's deadline to an hour after it, up to 24 hours after the start; a run past its deadline takes no more evidence or completion and ends with an unknown outcome. Exact retries are idempotent; conflicting retries and events after completion are refused. Tool start IDs are unique per run. A nested callback names an already open, pinned learned_workflow invocation in parent_tool_use_id, and its result keeps the original call name and parent. Evidence never authorizes or executes a tool.",
|
|
133
143
|
parameters: [id("run_id"), key],
|
|
134
144
|
requestBody: body(object({ sequence: { type: "integer", minimum: 1 }, events: { type: "array", maxItems: 100, items: event } })),
|
|
135
145
|
responses: { 200: response(object({ accepted: { const: true } })), ...errors },
|
package/dist/sdk/workflows.d.ts
CHANGED
|
@@ -14,7 +14,7 @@ export declare function sdkWorkflowManifest(tools: unknown, adapters: unknown):
|
|
|
14
14
|
export declare function sdkDraftTools(manifest: readonly SdkWorkflowTool[]): {
|
|
15
15
|
tools: string[];
|
|
16
16
|
gated: {
|
|
17
|
-
[k: string]: "ask" | "
|
|
17
|
+
[k: string]: "ask" | "deny" | "allow";
|
|
18
18
|
};
|
|
19
19
|
deniedBy: {
|
|
20
20
|
[k: string]: "agent";
|