podster 0.0.1-test.19 → 0.0.1-test.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -3
- package/build/core/broker.js +1 -1
- package/build/core/explain.js +14 -3
- package/build/core/lifecycle.js +100 -7
- package/build/core/policy.js +18 -6
- package/build/core/repository.js +8 -3
- package/build/core/run-interface.js +17 -2
- package/build/core/runs.js +3 -0
- package/build/core/runtime.js +1 -1
- package/build/core/setup.js +6 -2
- package/build/core/tool-policy.js +9 -5
- package/build/core/trust.js +151 -0
- package/build/node/claude-driver.js +1 -1
- package/build/node/cli.js +11 -0
- package/build/node/docker-sandbox.js +32 -5
- package/build/node/openai-driver.js +7 -5
- package/build/node/prompter.js +43 -0
- package/build/node/repo-path.js +10 -1
- package/build/node/run-command.js +2 -0
- package/build/node/toolchain-images.js +66 -4
- package/build/node/trust-command.js +43 -0
- package/build/node/trust-file.js +53 -0
- package/package.json +1 -1
- package/toolchains/java/Dockerfile +10 -2
package/README.md
CHANGED
|
@@ -41,6 +41,7 @@ Then:
|
|
|
41
41
|
```bash
|
|
42
42
|
npx --ignore-scripts podster@test status # what this Runner's record says, by IDs
|
|
43
43
|
npx --ignore-scripts podster@test why <tsk_…> # the newest failure recorded for a task on this machine
|
|
44
|
+
npx --ignore-scripts podster@test trust <ws_…> # read and accept the trust statement for a room's unattended runs
|
|
44
45
|
npx --ignore-scripts podster@test stop # stop the Runner running from this home, and any run, at once
|
|
45
46
|
npx --ignore-scripts podster@test forget # delete this Runner's keys and record; disconnect the agent in Podster yourself
|
|
46
47
|
```
|
|
@@ -91,7 +92,7 @@ Instead of writing it by hand, let Runner propose a starter from a workroom's se
|
|
|
91
92
|
npx --ignore-scripts podster@test setup --room <ws_…>
|
|
92
93
|
```
|
|
93
94
|
|
|
94
|
-
Leave out `--room` to pick from the rooms this agent is in. Runner asks Podster, as your paired agent, for its own organization (that becomes `owner_org`, never the room's) and for what it may tell this agent about the room, so nothing is copied by hand: the room's ID; its organization, when the room is your organization's or the agent sees the whole room; and its linked GitHub repository, name and numeric ID, only while the agent holds a push grant on it. Anything Podster doesn't tell is unknown. An unknown repository is written as `null`, which gives tasks none, and `run` asks you once Podster names one. It shows the policy it would save and what it allows, and saves it only when you type `y`. The starter asks before each run, holds outputs for your review, has no shell and no network, keeps the limits low (0.50 USD, 15 minutes and 30 turns a run, 2 USD a day), and leaves
|
|
95
|
+
Leave out `--room` to pick from the rooms this agent is in. Runner asks Podster, as your paired agent, for its own organization (that becomes `owner_org`, never the room's) and for what it may tell this agent about the room, so nothing is copied by hand: the room's ID; its organization, when the room is your organization's or the agent sees the whole room; and its linked GitHub repository, name and numeric ID, only while the agent holds a push grant on it. Anything Podster doesn't tell is unknown. An unknown repository is written as `null`, which gives tasks none, and `run` asks you once Podster names one. It shows the policy it would save and what it allows, and saves it only when you type `y`. The starter asks before each run, holds outputs for your review, has no shell and no network, keeps the limits low (0.50 USD, 15 minutes and 30 turns a run, 2 USD a day), and leaves the public-room warning unticked. Unattended runs stay off until you edit `mode` yourself and accept the trust statement with `trust`, below. A new policy puts task folders in `~/podster-work` unless you give `--workspace-root <folder>`.
|
|
95
96
|
|
|
96
97
|
- **Another organization's room** is shown as external. Runner refuses its tasks unless that organization is in the room's `allowed_orgs`, and asking before each run doesn't allow it by itself; setup adds it only if you say yes to exactly that. If Podster doesn't name the organization to this agent, setup can't propose it: add its `org_…` ID to `allowed_orgs` yourself.
|
|
97
98
|
- **A policy you already have is never replaced.** A room it lacks is added, with everything else kept as you wrote it and `revision` raised. A room it has is checked for a repository change, below. A file Runner can't use, or one for another organization, is left alone and Runner says what's wrong.
|
|
@@ -127,7 +128,7 @@ A complete, valid example, for one workroom. Replace the `org_…` and `ws_…`
|
|
|
127
128
|
"network": [],
|
|
128
129
|
"repository": null,
|
|
129
130
|
"allowed_orgs": [],
|
|
130
|
-
"acknowledged": { "
|
|
131
|
+
"acknowledged": { "public_room_warning": false }
|
|
131
132
|
}
|
|
132
133
|
]
|
|
133
134
|
}
|
|
@@ -159,12 +160,22 @@ A complete, valid example, for one workroom. Replace the `org_…` and `ws_…`
|
|
|
159
160
|
| `rooms[].repository` | `null` for a task that starts in an empty folder, or `{ "full_name": "owner/name", "provider_repo_id": 123456 }` for one GitHub repository. |
|
|
160
161
|
| `rooms[].roles` | What Runner does when the room invites this agent to a role opening. `"ask"`, the default, asks you at your terminal: `y` claims it as this agent, `n` turns it down, anything else leaves it for later. `"accept"` claims it with no question. Runner never turns an invite down by itself, and a room not listed here always asks. Claiming accepts no task and gives no person access. A pairing made before Runner answered invites can't: Runner logs `pair_again_for_roles` once. Tasks still run and roles already held stay, so you can leave it. Pairing again makes a new agent with a new ID, which must be added to each room and given its roles and any push or merge grants again; the old agent keeps its place until removed. |
|
|
161
162
|
| `rooms[].allowed_orgs` | Other organizations whose tasks you'll run in this room. Do not list `owner_org`: your own organization is always allowed, and Runner refuses a policy that lists it. An empty list is fine. |
|
|
162
|
-
| `rooms[].acknowledged` |
|
|
163
|
+
| `rooms[].acknowledged` | `{ "public_room_warning": false }` or `true`, required. Until it's `true`, Runner asks you at your terminal before each run in a public room. The trust statement isn't here: a file can't accept it, and Runner refuses a policy whose `acknowledged` names `trust_statement` (`trust_statement_moved`). See [The trust statement](#the-trust-statement). |
|
|
163
164
|
|
|
164
165
|
Every ID is lower case. Unknown fields, missing fields, a field out of range, or a repeated room refuse the whole file.
|
|
165
166
|
|
|
166
167
|
**Where to find the IDs.** A workroom's `ws_…` ID is in its address in the web app: `/w/ws_…/…`. For your organization's `org_…` ID, open Settings, then Organization, and pick the organization: the `org=` in the address bar is its ID. If you can't find it, ask your Podster admin.
|
|
167
168
|
|
|
169
|
+
### The trust statement
|
|
170
|
+
|
|
171
|
+
A room whose `mode` is `"unattended"` still asks you before each run (`trust_statement_not_accepted`) until you've read and accepted Runner's trust statement for that room. It says what you take on when Runner runs without asking: Runner trusts Podster to say who wrote a task, so a compromised Podster could send instructions labeled as your organization's; a listed network host can receive anything a run can read; in a room with `shell`, a listed host and a private repository, a run holds private code, can read words no one in your organization wrote, and has a way out; the model provider sees the room's content; and runs spend up to their caps without asking. Accept it at a terminal on this machine:
|
|
172
|
+
|
|
173
|
+
```bash
|
|
174
|
+
npx --ignore-scripts podster@test trust ws_…
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
Runner shows the whole statement and records your acceptance only when you type `accept`. Without a terminal it asks nothing and records nothing. It keeps, in `trust.json` in Runner's home, the room, the statement's version and SHA-256, and when you accepted. Don't write that file yourself: it's Runner's record of what you read. If a later Runner changes the statement, its version and hash change, and every unattended room asks again until you accept the new one. Accepting doesn't switch a room to unattended runs; `mode` does, and setting it back to `"ask"` stops them at the next evaluation. `run` reads `trust.json` again at every evaluation, so you can accept from another terminal while it runs.
|
|
178
|
+
|
|
168
179
|
### The experimental OpenAI adapter
|
|
169
180
|
|
|
170
181
|
*Built 2026-11-22, off by default, and not verified for support.* Runner can run tasks through OpenAI's Agents SDK instead of the Claude Agent SDK. Use it with **test content only**: room content (the task's text, the files a tool reads and the tools' output) goes to OpenAI under OpenAI's standard data retention, sent with `store: false`. Whether real room content may go to OpenAI, and checking spend against OpenAI's own usage page, are still the owner's to decide.
|
package/build/core/broker.js
CHANGED
|
@@ -625,7 +625,7 @@ export class RunBroker {
|
|
|
625
625
|
if (request.method !== "POST")
|
|
626
626
|
return refuse("method_not_allowed");
|
|
627
627
|
if (request.path !== this.profile.path)
|
|
628
|
-
return refuse("
|
|
628
|
+
return refuse("request_path_not_allowed");
|
|
629
629
|
if (request.query !== "")
|
|
630
630
|
return refuse("query_not_allowed");
|
|
631
631
|
if (request.body.byteLength > MAX_BODY_BYTES)
|
package/build/core/explain.js
CHANGED
|
@@ -19,7 +19,7 @@ const TABLE = new Map([
|
|
|
19
19
|
// The run policy and the network.
|
|
20
20
|
...group(["egress_proxy_unavailable"], "The room's policy lists network hosts, but this Runner has no egress proxy to hold them, so the run didn't start.", "Start Runner with `run`, which builds and pins its egress proxy image, or set rooms[].network to [] in policy.json."),
|
|
21
21
|
...group(["docker_engine_too_old"], "The room's policy lists network hosts, and this Docker Engine is older than 26, which could carry a task's DNS lookups past the egress proxy, so the run didn't start.", "Update Docker (Docker Desktop, or Docker Engine 26 or later), or set rooms[].network to [] in policy.json."),
|
|
22
|
-
...group(["toolchain_image_unavailable"], "The room's policy names toolchains, and Runner couldn't build, check or pin their image, so the run didn't start.", "Check that Docker is running and this machine can reach the toolchains' download sites (static.rust-lang.org for Rust, GitHub for Python and Java, builds.dotnet.microsoft.com for .NET,
|
|
22
|
+
...group(["toolchain_image_unavailable"], "The room's policy names toolchains, and Runner couldn't build, check or pin their image, so the run didn't start.", "Check that Docker is running and this machine can reach the toolchains' download sites (static.rust-lang.org for Rust, GitHub for Python and Java, builds.dotnet.microsoft.com for .NET, repo.maven.apache.org for Java's Maven); the details file says which step failed. The next offer tries again, or set rooms[].toolchains to [] in policy.json."),
|
|
23
23
|
...group(["egress_proxy_not_ready", "egress_subnet_invalid", "egress_hosts_invalid", "egress_program_invalid"], "Runner's egress proxy for the room's listed hosts couldn't be started, so the run didn't start.", "Check that Docker is running; the details file has more. Restart Runner with `run` if it keeps happening."),
|
|
24
24
|
...group(["config_invalid", "budget_invalid"], "Runner's run policy can't be read or used.", "Fix policy.json; `run` names the field it refused when it starts."),
|
|
25
25
|
...group(["clock_invalid"], "This machine's clock went back past the day Runner last counted spend.", "Set the clock right; the task waits until then."),
|
|
@@ -62,8 +62,15 @@ const TABLE = new Map([
|
|
|
62
62
|
...group(["result_summary_empty", "result_summary_too_long", "result_summary_control_char"], "The agent's result summary was empty, too long, or held a control character.", "The agent was told and may resubmit; nothing to do unless it keeps happening."),
|
|
63
63
|
...group(["result_files_not_list", "result_too_many_files", "result_file_outside_folder", "result_file_not_allowed", "result_file_duplicate"], "The agent's result named files Runner can't accept.", "The agent was told and may resubmit; nothing to do unless it keeps happening."),
|
|
64
64
|
// Tool calls and model requests Runner refused.
|
|
65
|
-
|
|
66
|
-
...group(["
|
|
65
|
+
// Each refusal in its own words (2026-11-27: path_outside_folder was explained as a missing shell).
|
|
66
|
+
...group(["shell_not_allowed"], "Runner refused one of the agent's shell commands: the room's policy gives this run no shell.", "Nothing to do unless the agent needs a shell: add \"shell\" to rooms[].tools in policy.json."),
|
|
67
|
+
...group(["tool_not_allowed"], "Runner refused one of the agent's tool calls: it named a tool the room's policy doesn't list, or one that isn't Runner's.", "Nothing to do unless the agent needs that tool: list it in rooms[].tools in policy.json."),
|
|
68
|
+
...group(["path_outside_folder"], "Runner refused one of the agent's tool calls: it named a path outside the task's folder, such as an absolute path or one with ..", "Nothing to do: the agent was told to give paths inside the task's folder, /work, and may try again. If the run then changes nothing, the agent may have worked outside that folder."),
|
|
69
|
+
...group(["path_not_allowed"], "Runner refused one of the agent's tool calls: it named Git's own folder, a name starting with -, or a name ending in a space or a dot.", "Nothing to do; the agent was told and may try again."),
|
|
70
|
+
...group(["call_invalid", "input_invalid"], "Runner refused one of the agent's tool calls: the call or its input wasn't in the tool's shape or was too large.", "Nothing to do unless it keeps happening."),
|
|
71
|
+
// From the tool check, and from the broker and its listener for a model request.
|
|
72
|
+
...group(["run_stopped"], "Runner refused a tool call or model request of the agent's because the run was stopping.", "Nothing to do."),
|
|
73
|
+
...group(["method_not_allowed", "request_path_not_allowed", "query_not_allowed", "body_too_large", "body_invalid", "body_not_allowed", "model_not_allowed", "model_unpriced", "upstream_failed"], "Runner refused or couldn't send one of the agent's model requests.", SUPPORT),
|
|
67
74
|
// The repository path.
|
|
68
75
|
...group(["task_not_linked"], "Podster said this task isn't linked to the room's repository, so Runner ran it without one: an empty folder, no repository token, and no commit, push or pull request. Its result is submitted as text.", "Nothing to do. If the task needed the repository, ask the room to check the repository in Podster and make the task again once it's ready."),
|
|
69
76
|
...group(["task_folder_unsafe"], "Runner couldn't empty the task's folder before a run without the repository: the folder or the room's folder above it is a link, or not where the run policy puts it.", "The task is released; check the folder under workspace_root in policy.json and remove any link there."),
|
|
@@ -107,6 +114,10 @@ const TABLE = new Map([
|
|
|
107
114
|
// Pairing and role invitations (#542).
|
|
108
115
|
...group(["pair_again_for_roles"], "This Runner was paired before it could answer role invitations, so room invites to this agent aren't answered from this machine. Tasks still run as before, and roles it already holds stay.", "Nothing to do unless you want invites answered from this machine; you can leave this agent as it is. Pairing again makes a new agent with a new ID, never this one: stop Runner, run `forget`, choose Add an agent in Podster, run `npx podster@test pair --agent <agt_…>` with the new agent's ID, and start it with `run`. Then add the new agent to each room and give it its roles and any push or merge grants again; this agent keeps its place until you remove it."),
|
|
109
116
|
...group(["invalid_capabilities"], "This Podster doesn't offer managed repositories, so Runner paired without repository access.", "Nothing to do; tasks in rooms without a repository run as usual."),
|
|
117
|
+
// F-2 of M7's security review: the push and the pull request held for the owner's review.
|
|
118
|
+
...group(["publish_held", "outputs_held", "repository_public", "repository_public_unreviewed"], "A run finished, and Runner holds its commit, push and pull request for your yes at this terminal: the room's outputs are held for review, or GitHub reads the repository as public, so a push would publish the work to anyone.", "Look at the work in the task's folder, then answer y to publish it or n to release the task. Nothing leaves this machine until you do."),
|
|
119
|
+
...group(["publish_declined"], "You declined a held publication, so nothing was committed, pushed or opened, and the task was released.", "Nothing to do."),
|
|
120
|
+
...group(["publish_review_expired"], "A publication held for your review had no terminal to answer it for a day, so nothing was pushed and the task was released.", "Nothing to do; answer held publications sooner, or set the room's outputs to share for a private repository."),
|
|
110
121
|
...group(["review_hold_expired"], "A result held for your review went unanswered for a day, so Runner submitted it with its fixed note only, never the agent's words.", "Nothing to do; answer held results sooner to share the agent's summary."),
|
|
111
122
|
...group(["git_not_found"], "Runner found no Git at the paths it uses (/usr/bin/git, /opt/homebrew/bin/git or /usr/local/bin/git), so tasks in rooms with a repository are refused.", "Install Git 2.25 or later at one of those paths, then restart Runner with `run`."),
|
|
112
123
|
...group(["environment_refused"], "Runner won't reach GitHub with a proxy or TLS trust taken from the environment, so tasks in rooms with a repository are refused.", "Unset NODE_USE_ENV_PROXY, NODE_TLS_REJECT_UNAUTHORIZED=0, NODE_EXTRA_CA_CERTS, SSL_CERT_FILE and the --use-env-proxy, --use-openssl-ca and --use-system-ca flags, then restart Runner with `run`."),
|
package/build/core/lifecycle.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { GatewayError, meaningOf } from "./errors.js";
|
|
2
|
+
import { acceptedRooms } from "./trust.js";
|
|
2
3
|
import { consumeRunDecision, evaluate, factsKey, issueRunDecision, outputsOf, parsePolicyConfig, pinRunBase, policyProblem, repositoryOf } from "./policy.js";
|
|
3
4
|
import { pullRequestUrl, RepoPathError } from "./repository.js";
|
|
4
5
|
import { readTaskDetail, sha256Hex } from "./prompt.js";
|
|
@@ -25,7 +26,7 @@ export const WAIT_MS = 60_000;
|
|
|
25
26
|
*/
|
|
26
27
|
export const PUBLISH_RETRY_MS = 60 * 60 * 1000;
|
|
27
28
|
/** A finished run whose stop is confirmed and whose publication is held for a retry: it runs nothing. */
|
|
28
|
-
const publicationHeld = (e) => e.phase === "held" && e.after_stop?.kind === "finish" && typeof e.publish_since === "number";
|
|
29
|
+
const publicationHeld = (e) => e.phase === "held" && e.after_stop?.kind === "finish" && (typeof e.publish_since === "number" || (!!e.publish_review && e.publish_review.run_ref === (e.run_ref ?? "")));
|
|
29
30
|
/**
|
|
30
31
|
* The one progress message Podster gets while a result waits for the owner's review: Runner's fixed status, with no word
|
|
31
32
|
* of the agent's (RUNNER.md: "fixed status generated by Runner, with no model text").
|
|
@@ -58,6 +59,9 @@ const PRIVATE = new Set([
|
|
|
58
59
|
"repo_repository_renamed",
|
|
59
60
|
"repo_path_unsafe",
|
|
60
61
|
"repo_helper_unavailable",
|
|
62
|
+
// F-2: the owner's own answer on this machine about a held push, or its absence.
|
|
63
|
+
"publish_declined",
|
|
64
|
+
"publish_review_expired",
|
|
61
65
|
]);
|
|
62
66
|
export const GENERIC_REASON = "runner_unavailable";
|
|
63
67
|
/** Events that count as a new attempt at a task: an offer or re-offer, and a change request (L6 on #458). */
|
|
@@ -104,6 +108,14 @@ function orAbort(promise, signal) {
|
|
|
104
108
|
});
|
|
105
109
|
}
|
|
106
110
|
const ABORTED = Symbol("aborted");
|
|
111
|
+
/** A report's scratch counts, only as two whole numbers; anything else is none. */
|
|
112
|
+
function scratchOf(v) {
|
|
113
|
+
if (typeof v !== "object" || v === null)
|
|
114
|
+
return null;
|
|
115
|
+
const { home_files, tmp_files } = v;
|
|
116
|
+
const count = (n) => typeof n === "number" && Number.isSafeInteger(n) && n >= 0;
|
|
117
|
+
return count(home_files) && count(tmp_files) ? { home_files, tmp_files } : null;
|
|
118
|
+
}
|
|
107
119
|
export class Lifecycle {
|
|
108
120
|
deps;
|
|
109
121
|
policy;
|
|
@@ -115,6 +127,8 @@ export class Lifecycle {
|
|
|
115
127
|
approvals = new Map();
|
|
116
128
|
/** Each finished run's structured result, by task, until it's submitted: in memory only, never stored or logged. */
|
|
117
129
|
results = new Map();
|
|
130
|
+
/** A succeeded run's counts of files left in HOME and /tmp, for the publish's `no_changes` line; in memory only. */
|
|
131
|
+
scratch = new Map();
|
|
118
132
|
/** Each repository run's task title, as its inputs had it, by task, for its pull request: in memory only, never stored or logged. */
|
|
119
133
|
titles = new Map();
|
|
120
134
|
/** The agent's own organization, checked at open: a policy reread later must still name it. */
|
|
@@ -390,6 +404,7 @@ export class Lifecycle {
|
|
|
390
404
|
task: { id: entry.task_id, workspace_id: entry.workspace_id },
|
|
391
405
|
authority_fresh: authorityFresh,
|
|
392
406
|
budget: this.budget(ownReservation),
|
|
407
|
+
trusted_rooms: acceptedRooms(this.deps.trust === undefined ? null : await readConfig(this.deps.trust), this.now()),
|
|
393
408
|
...homeOf(this.deps),
|
|
394
409
|
now: this.now(),
|
|
395
410
|
});
|
|
@@ -857,16 +872,27 @@ export class Lifecycle {
|
|
|
857
872
|
await this.giveUp(entry, "accepted", "repository_unavailable");
|
|
858
873
|
return null;
|
|
859
874
|
}
|
|
875
|
+
// F-2 (S-34; RUNNER.md lifecycle step 9): the commit, the pushed branch and the pull request are outputs under the same
|
|
876
|
+
// policy as the words. Unless the owner said yes to this run's publication, a room whose outputs aren't shared holds
|
|
877
|
+
// them here, and the path itself refuses a public repository (`repository_public_unreviewed`), so both wait for review.
|
|
878
|
+
const review = entry.publish_review && entry.publish_review.run_ref === (entry.run_ref ?? "") ? entry.publish_review : null;
|
|
879
|
+
const approved = review?.approved === true;
|
|
880
|
+
if (!approved && !(await this.sharingAllowed(entry.workspace_id, consumed)))
|
|
881
|
+
return this.reviewPublication(entry, facts, review, "outputs_held", signal);
|
|
860
882
|
try {
|
|
861
883
|
const key = keyOf(entry.workspace_id, entry.task_id);
|
|
862
884
|
const held = this.titles.get(key);
|
|
863
885
|
const kept = this.results.get(key);
|
|
864
886
|
const words = { title: held && held.run_ref === entry.run_ref ? held.title : null, change_type: kept && kept.run_ref === entry.run_ref ? (kept.result.change_type ?? null) : null };
|
|
865
|
-
|
|
887
|
+
// Only a yes given on a screen that said the repository is public lets the path push to a public one.
|
|
888
|
+
const publication = await path.publish({ workspace_id: entry.workspace_id, task_id: entry.task_id, task_folder: facts.task_folder, repository: facts.repository, base_commit: consumed.base_commit, reviewed: approved && review?.public_ok === true, ...words }, signal ?? new AbortController().signal);
|
|
866
889
|
// Published or not, the title has done its work; the result stays held for the submission.
|
|
867
890
|
this.titles.delete(key);
|
|
891
|
+
const left = this.scratch.get(key);
|
|
892
|
+
this.scratch.delete(key);
|
|
868
893
|
if (publication.kind === "no_changes") {
|
|
869
|
-
|
|
894
|
+
// Counts only (2026-11-27): files the run left where nothing is kept, so a "no changes" run can be read later.
|
|
895
|
+
this.log("lifecycle.publish", "no_changes", entry, left && left.run_ref === entry.run_ref ? left.counts : {});
|
|
870
896
|
return { published: entry.published ?? null, outcome: "no_changes" };
|
|
871
897
|
}
|
|
872
898
|
this.log("lifecycle.publish", "published", entry, { count: publication.pr_number });
|
|
@@ -877,6 +903,11 @@ export class Lifecycle {
|
|
|
877
903
|
return "wait";
|
|
878
904
|
if (!(error instanceof RepoPathError))
|
|
879
905
|
throw error;
|
|
906
|
+
if (error.code === "repository_public_unreviewed" && review?.public_ok !== true) {
|
|
907
|
+
// Public now, and no yes was given knowing it: asked afresh, saying so, within the same hold.
|
|
908
|
+
path.forget(entry.workspace_id, entry.task_id);
|
|
909
|
+
return this.reviewPublication(entry, facts, review ? { ...review, approved: false } : null, "repository_public", signal);
|
|
910
|
+
}
|
|
880
911
|
if (error.transient) {
|
|
881
912
|
// Passing: the finished work is kept and published again at a later pass, never released (ruling 5 on #462).
|
|
882
913
|
this.log("lifecycle.publish", "unavailable", entry, { code: error.code });
|
|
@@ -893,6 +924,60 @@ export class Lifecycle {
|
|
|
893
924
|
path.forget(entry.workspace_id, entry.task_id);
|
|
894
925
|
}
|
|
895
926
|
}
|
|
927
|
+
/**
|
|
928
|
+
* F-2: a publication held for the owner's review on this machine. A yes publishes this run's work, bound to its
|
|
929
|
+
* `run_ref`; a no publishes nothing and releases the task. With a terminal attached, the prompter waits for the answer
|
|
930
|
+
* (failing closed: nothing is published while nobody answers). With no terminal, the answer is `later`: asked again
|
|
931
|
+
* every `ASK_AGAIN_MS`, and released unpublished once `REVIEW_HOLD_MS` has passed. Nothing leaves the machine while it waits.
|
|
932
|
+
*/
|
|
933
|
+
async reviewPublication(entry, facts, review, reason, signal) {
|
|
934
|
+
const key = keyOf(entry.workspace_id, entry.task_id);
|
|
935
|
+
const since = review?.held_since ?? this.now();
|
|
936
|
+
const done = { ...entry, after_stop: null, publish_review: null, publish_since: null, retry_at: null };
|
|
937
|
+
if (this.now() - since >= REVIEW_HOLD_MS) {
|
|
938
|
+
this.log("lifecycle.publish", "given_up", entry, { code: "publish_review_expired" });
|
|
939
|
+
this.forgetWords(key);
|
|
940
|
+
this.deps.repository?.forget(entry.workspace_id, entry.task_id);
|
|
941
|
+
await this.giveUp(done, "accepted", "publish_review_expired");
|
|
942
|
+
return null;
|
|
943
|
+
}
|
|
944
|
+
const ask = this.deps.prompter.publication;
|
|
945
|
+
// The repository's visibility, read now, so a yes to held outputs is a yes to a public push too only when it said so.
|
|
946
|
+
let open = reason === "repository_public" ? true : null;
|
|
947
|
+
const path = this.deps.repository;
|
|
948
|
+
if (open === null && path?.isPublic) {
|
|
949
|
+
try {
|
|
950
|
+
open = await path.isPublic({ workspace_id: entry.workspace_id, task_id: entry.task_id, task_folder: facts.task_folder, repository: facts.repository }, signal ?? new AbortController().signal);
|
|
951
|
+
}
|
|
952
|
+
catch (error) {
|
|
953
|
+
if (!(error instanceof RepoPathError))
|
|
954
|
+
throw error;
|
|
955
|
+
open = null;
|
|
956
|
+
}
|
|
957
|
+
finally {
|
|
958
|
+
path.forget(entry.workspace_id, entry.task_id);
|
|
959
|
+
}
|
|
960
|
+
if (signal?.aborted)
|
|
961
|
+
return "wait";
|
|
962
|
+
}
|
|
963
|
+
const view = { workspace_id: entry.workspace_id, task_id: entry.task_id, reason, full_name: facts.repository.full_name, branch: facts.repository.branch, task_folder: facts.task_folder, repository_public: open };
|
|
964
|
+
const answer = ask ? await ask.call(this.deps.prompter, view, signal) : "later";
|
|
965
|
+
if (signal?.aborted)
|
|
966
|
+
return "wait";
|
|
967
|
+
this.log("lifecycle.publish", `review_${answer}`, entry, { code: reason });
|
|
968
|
+
if (answer === "decline") {
|
|
969
|
+
this.forgetWords(key);
|
|
970
|
+
this.deps.repository?.forget(entry.workspace_id, entry.task_id);
|
|
971
|
+
await this.giveUp(done, "accepted", "publish_declined");
|
|
972
|
+
return null;
|
|
973
|
+
}
|
|
974
|
+
const next = { run_ref: entry.run_ref ?? "", held_since: since, approved: answer === "approve", public_ok: answer === "approve" && open === true };
|
|
975
|
+
if (answer !== "approve")
|
|
976
|
+
return { held: next };
|
|
977
|
+
// Stored before anything is pushed, so a passing failure after it doesn't ask the owner again.
|
|
978
|
+
await this.put({ ...this.current(entry), publish_review: next });
|
|
979
|
+
return this.publish({ ...entry, publish_review: next }, signal);
|
|
980
|
+
}
|
|
896
981
|
/** A stop that throws counts as unconfirmed (M2 on #458). */
|
|
897
982
|
async safeStop(handle) {
|
|
898
983
|
try {
|
|
@@ -1026,6 +1111,9 @@ export class Lifecycle {
|
|
|
1026
1111
|
const parsed = report.result ? parseRunResult(report.result) : null;
|
|
1027
1112
|
if (parsed?.ok && parsed.value.status === "completed") {
|
|
1028
1113
|
this.results.set(keyOf(entry.workspace_id, entry.task_id), { run_ref: entry.run_ref, result: parsed.value });
|
|
1114
|
+
const counts = scratchOf(report.scratch);
|
|
1115
|
+
if (counts)
|
|
1116
|
+
this.scratch.set(keyOf(entry.workspace_id, entry.task_id), { run_ref: entry.run_ref, counts });
|
|
1029
1117
|
await this.stopped(entry, result, spent, "succeeded", { kind: "finish" });
|
|
1030
1118
|
}
|
|
1031
1119
|
else if (parsed?.ok && parsed.value.status === "blocked") {
|
|
@@ -1068,6 +1156,11 @@ export class Lifecycle {
|
|
|
1068
1156
|
await this.put({ ...entry, phase: "held", after_stop: after });
|
|
1069
1157
|
return;
|
|
1070
1158
|
}
|
|
1159
|
+
if (published !== null && "held" in published) {
|
|
1160
|
+
// F-2: held for the owner's review, its stop confirmed and its folder kept; asked again after a wait.
|
|
1161
|
+
await this.put({ ...entry, phase: "held", after_stop: after, outcome: "publish_held", publish_review: published.held, retry_at: this.now() + ASK_AGAIN_MS });
|
|
1162
|
+
return;
|
|
1163
|
+
}
|
|
1071
1164
|
if (published !== null && "wait" in published) {
|
|
1072
1165
|
// Held, its stop already confirmed and its folder and commit kept, and tried again after a wait, for at most
|
|
1073
1166
|
// an hour from its first failure; then released (the ruling on #462's held publications).
|
|
@@ -1075,10 +1168,10 @@ export class Lifecycle {
|
|
|
1075
1168
|
if (this.now() - since >= PUBLISH_RETRY_MS) {
|
|
1076
1169
|
this.log("lifecycle.publish", "given_up", entry, { code: "repo_publish_failed" });
|
|
1077
1170
|
this.deps.repository?.forget(entry.workspace_id, entry.task_id);
|
|
1078
|
-
await this.giveUp({ ...base, publish_since: null, retry_at: null }, "accepted", "repo_publish_failed");
|
|
1171
|
+
await this.giveUp({ ...base, publish_since: null, publish_review: null, retry_at: null }, "accepted", "repo_publish_failed");
|
|
1079
1172
|
return;
|
|
1080
1173
|
}
|
|
1081
|
-
await this.put({ ...entry, phase: "held", after_stop: after, outcome: published.wait, publish_since: since, retry_at: this.now() + WAIT_MS });
|
|
1174
|
+
await this.put({ ...entry, phase: "held", after_stop: after, outcome: published.wait, publish_since: since, publish_review: this.current(entry).publish_review ?? null, retry_at: this.now() + WAIT_MS });
|
|
1082
1175
|
return;
|
|
1083
1176
|
}
|
|
1084
1177
|
if (published === null)
|
|
@@ -1090,10 +1183,10 @@ export class Lifecycle {
|
|
|
1090
1183
|
if (consumed?.repository_id && !(pub && pub.repository_id === consumed.repository_id && (published.outcome === "published" || pub.commit === consumed.base_commit))) {
|
|
1091
1184
|
this.forgetWords(keyOf(entry.workspace_id, entry.task_id));
|
|
1092
1185
|
this.log("lifecycle.submit", "nothing_to_submit", entry, { code: "run_no_changes" });
|
|
1093
|
-
await this.giveUp({ ...base, publish_since: null, retry_at: null, published: pub }, "accepted", "run_no_changes");
|
|
1186
|
+
await this.giveUp({ ...base, publish_since: null, publish_review: null, retry_at: null, published: pub }, "accepted", "run_no_changes");
|
|
1094
1187
|
return;
|
|
1095
1188
|
}
|
|
1096
|
-
await this.put({ ...base, phase: "finished", publish_since: null, retry_at: null, ran_hash: consumed?.input_hash ?? null, published: pub, outcome: published.outcome === "succeeded" ? entry.outcome : published.outcome, submission: owedSubmission() });
|
|
1189
|
+
await this.put({ ...base, phase: "finished", publish_since: null, publish_review: null, retry_at: null, ran_hash: consumed?.input_hash ?? null, published: pub, outcome: published.outcome === "succeeded" ? entry.outcome : published.outcome, submission: owedSubmission() });
|
|
1097
1190
|
}
|
|
1098
1191
|
else if (after.kind === "release") {
|
|
1099
1192
|
this.forgetWords(keyOf(entry.workspace_id, entry.task_id));
|
package/build/core/policy.js
CHANGED
|
@@ -20,7 +20,10 @@
|
|
|
20
20
|
* can't be scoped, so it asks.
|
|
21
21
|
* - **The room split.** Every unattended room needs the owner to have accepted the trust statement for it, the residual
|
|
22
22
|
* risk RUNNER.md asks every unattended setup to disclose (L3 on #455's review). A public room also needs the
|
|
23
|
-
* public-room warning (decision 232).
|
|
23
|
+
* public-room warning (decision 232). The statement's text, version and hash live in `trust.ts`; the owner accepts it
|
|
24
|
+
* only through `podster trust` at a terminal, and the caller passes the rooms with a current acceptance as
|
|
25
|
+
* `trusted_rooms` (F-3 of the M7 security review). The policy file has no field for it: one naming `trust_statement`
|
|
26
|
+
* is refused whole, so a copied example can't switch it on.
|
|
24
27
|
* - **The prompt's inputs** must be exactly those `provenance` lists, in its order, and a change request exactly the one
|
|
25
28
|
* whose `event_id` provenance names (M2 on #455's review). Steps 8 and 9 build the prompt from those inputs only, and
|
|
26
29
|
* the change request from that event only.
|
|
@@ -139,6 +142,8 @@ export const TOOLCHAIN_UNKNOWN = "toolchain_unknown";
|
|
|
139
142
|
export const TOOLCHAIN_DUPLICATE = "toolchain_duplicate";
|
|
140
143
|
/** A room naming toolchains without the `shell` tool, which is the only way to run them. */
|
|
141
144
|
export const TOOLCHAIN_NEEDS_SHELL = "toolchain_needs_shell";
|
|
145
|
+
/** A room's `acknowledged` naming `trust_statement`, which only `podster trust` records now (F-3). */
|
|
146
|
+
export const TRUST_STATEMENT_MOVED = "trust_statement_moved";
|
|
142
147
|
/** What's wrong with a policy that failed to parse, for the owner, by where it failed. */
|
|
143
148
|
export function policyProblem(at) {
|
|
144
149
|
const host = at.match(/^rooms\[\]\.network:(network_host_invalid|network_host_duplicate):([A-Za-z0-9_-]{1,128}):(\d{1,3})$/);
|
|
@@ -155,6 +160,9 @@ export function policyProblem(at) {
|
|
|
155
160
|
const shell = at.match(/^rooms\[\]\.toolchains:toolchain_needs_shell:([A-Za-z0-9_-]{1,128})$/);
|
|
156
161
|
if (shell)
|
|
157
162
|
return `the room ${shell[1]} lists rooms[].toolchains without "shell" in rooms[].tools, and only the shell can run a toolchain (${TOOLCHAIN_NEEDS_SHELL})`;
|
|
163
|
+
if (at === `rooms[].acknowledged:${TRUST_STATEMENT_MOVED}`) {
|
|
164
|
+
return `rooms[].acknowledged names trust_statement, which a policy file can't set (${TRUST_STATEMENT_MOVED}): remove it, leaving only public_room_warning, and accept the trust statement for a room with \`podster trust <ws_…>\` at a terminal`;
|
|
165
|
+
}
|
|
158
166
|
if (at === OPENAI_OPT_IN)
|
|
159
167
|
return `adapter "openai_agents" is experimental and off by default: it needs "${OPENAI_OPT_IN}": true beside it in the policy file, and ${OPENAI_OPT_IN} must be true or false`;
|
|
160
168
|
if (at === "caps.max_tokens:openai_floor")
|
|
@@ -368,11 +376,13 @@ function parseRoom(v, ownerOrg) {
|
|
|
368
376
|
if (outputs !== "hold" && outputs !== "share")
|
|
369
377
|
return fail("rooms[].outputs");
|
|
370
378
|
const ack = own(v, "acknowledged");
|
|
371
|
-
|
|
379
|
+
// The trust statement is accepted only through `podster trust`, never by a file (F-3): a policy naming it is refused.
|
|
380
|
+
if (isObj(ack) && Object.hasOwn(ack, "trust_statement"))
|
|
381
|
+
return fail(`rooms[].acknowledged:${TRUST_STATEMENT_MOVED}`);
|
|
382
|
+
if (!isObj(ack) || !keysAre(ack, ["public_room_warning"]))
|
|
372
383
|
return fail("rooms[].acknowledged");
|
|
373
|
-
const trust = own(ack, "trust_statement");
|
|
374
384
|
const warning = own(ack, "public_room_warning");
|
|
375
|
-
if (typeof
|
|
385
|
+
if (typeof warning !== "boolean")
|
|
376
386
|
return fail("rooms[].acknowledged");
|
|
377
387
|
const given = Object.hasOwn(v, "repository") ? v.repository : null;
|
|
378
388
|
const repository = given === null ? null : parseRepoScope(given);
|
|
@@ -381,7 +391,7 @@ function parseRoom(v, ownerOrg) {
|
|
|
381
391
|
const roles = Object.hasOwn(v, "roles") ? v.roles : "ask";
|
|
382
392
|
if (roles !== "ask" && roles !== "accept")
|
|
383
393
|
return fail("rooms[].roles");
|
|
384
|
-
return { ok: true, value: { room_id: roomId, mode, allowed_orgs: allowed, tools, network, toolchains, outputs, acknowledged: {
|
|
394
|
+
return { ok: true, value: { room_id: roomId, mode, allowed_orgs: allowed, tools, network, toolchains, outputs, acknowledged: { public_room_warning: warning }, repository, roles } };
|
|
385
395
|
}
|
|
386
396
|
/**
|
|
387
397
|
* Whether a path is on a Windows drive as WSL2 mounts it by default (`/mnt/c`, `/mnt/d/…`): the Windows file system,
|
|
@@ -599,6 +609,8 @@ function decide(input) {
|
|
|
599
609
|
const authorStandings = prov.inputs.flatMap((i) => i.authors.map((a) => standing(a, config.owner_org)));
|
|
600
610
|
const allInternal = requesterStanding === "internal" && authorStandings.every((s) => s === "internal") && prov.inputs.every((i) => !i.external);
|
|
601
611
|
const isPublic = prov.room_visibility === "public";
|
|
612
|
+
const trustedRooms = own(given, "trusted_rooms");
|
|
613
|
+
const trusted = Array.isArray(trustedRooms) && trustedRooms.every(isId) && trustedRooms.includes(room.room_id);
|
|
602
614
|
const facts = {
|
|
603
615
|
adapter: config.adapter,
|
|
604
616
|
tools: [...room.tools],
|
|
@@ -635,7 +647,7 @@ function decide(input) {
|
|
|
635
647
|
// Every author reads as internal here, so only the server's own flag on an input is left: it wins too.
|
|
636
648
|
if (!allInternal)
|
|
637
649
|
return ask("author_external");
|
|
638
|
-
if (!
|
|
650
|
+
if (!trusted)
|
|
639
651
|
return ask("trust_statement_not_accepted");
|
|
640
652
|
if (isPublic && !room.acknowledged.public_room_warning)
|
|
641
653
|
return ask("public_warning_not_accepted");
|
package/build/core/repository.js
CHANGED
|
@@ -236,9 +236,14 @@ export function renewDue(access, now) {
|
|
|
236
236
|
return true;
|
|
237
237
|
return now >= access.expires_at - RENEW_BEFORE_MS;
|
|
238
238
|
}
|
|
239
|
-
/**
|
|
239
|
+
/**
|
|
240
|
+
* GitHub's own answer for the repository, held to the owner's scope by its numeric ID. Answers its default branch, and
|
|
241
|
+
* whether it is public, from GitHub's `private` field (F-2 of M7's security review): an answer without a boolean there is
|
|
242
|
+
* unreadable, so a visibility Runner can't read never counts as private. Podster's `get_repo_access` names no visibility,
|
|
243
|
+
* so this read, made with the broker's token before every publication, is where Runner learns it.
|
|
244
|
+
*/
|
|
240
245
|
export function readRepository(answer, scope, task_id) {
|
|
241
|
-
if (!isObj(answer))
|
|
246
|
+
if (!isObj(answer) || typeof answer.private !== "boolean")
|
|
242
247
|
throw new RepoPathError("repository_unreadable");
|
|
243
248
|
if (answer.id !== scope.provider_repo_id)
|
|
244
249
|
throw new RepoPathError("repository_id_mismatch");
|
|
@@ -252,7 +257,7 @@ export function readRepository(answer, scope, task_id) {
|
|
|
252
257
|
// The task branch can never be the default branch, or sit beside it under Runner's prefix.
|
|
253
258
|
if (branch === taskBranch(task_id) || branch.startsWith(BRANCH_PREFIX) || `${branch}/`.startsWith(BRANCH_PREFIX))
|
|
254
259
|
throw new RepoPathError("default_branch_invalid");
|
|
255
|
-
return { default_branch: branch };
|
|
260
|
+
return { default_branch: branch, public: !answer.private };
|
|
256
261
|
}
|
|
257
262
|
/**
|
|
258
263
|
* GitHub's rules for the default branch (`GET /repos/{repo}/rules/branches/{branch}`): every rule ADR 0009's rulesets
|
|
@@ -33,6 +33,7 @@ export const REPOSITORY_GUIDANCE = [
|
|
|
33
33
|
"Repository: the room's repository is already checked out in /work, at the task's start branch. Make your change by editing its files there.",
|
|
34
34
|
"Runner keeps Git outside your container, so this run has no .git folder, no git or gh, and no access to GitHub. That is expected and is not a reason to stop: don't run git, clone, push, open a pull request or try to reach GitHub.",
|
|
35
35
|
"After you give the structured result with status completed, Runner itself commits what changed in /work, pushes the task's branch and opens the pull request. Write the summary as the description of that change: what you changed and why, in plain words.",
|
|
36
|
+
"Runner commits only files inside /work, and never those under node_modules, .cache, .npm, .venv, /target, /.wrangler or /.tmp, or .env files. Your home folder, ~, is /work/.cache/home and /tmp is discarded, so nothing written in either is kept: make the change in the repository's own files in /work, not in a new project created under ~ or /tmp.",
|
|
36
37
|
].join("\n");
|
|
37
38
|
/** Runner's fixed words for a run without a repository: a room with none, or a task Podster says isn't linked (#539). */
|
|
38
39
|
export const NO_REPOSITORY_GUIDANCE = [
|
|
@@ -69,6 +70,11 @@ export function runFrame(facts) {
|
|
|
69
70
|
LIMITS_GUIDANCE,
|
|
70
71
|
].join("\n");
|
|
71
72
|
}
|
|
73
|
+
/**
|
|
74
|
+
* The summary's limit in words, on the schema's field as well as its bound (2026-11-27: `result_summary_too_long` twice
|
|
75
|
+
* in a row on 0.0.1-test.19, and on 2026-11-22), so a model that reads the field's description sees it where it writes.
|
|
76
|
+
*/
|
|
77
|
+
export const SUMMARY_FIELD_DESCRIPTION = `At most ${MAX_SUMMARY_CHARS} characters; a longer one is refused. No control characters but tabs and line breaks.`;
|
|
72
78
|
/** The structured result's JSON schema, for a driver to hand its SDK; Runner checks the result itself either way. */
|
|
73
79
|
export const RESULT_SCHEMA = {
|
|
74
80
|
type: "object",
|
|
@@ -76,7 +82,7 @@ export const RESULT_SCHEMA = {
|
|
|
76
82
|
required: ["status", "summary", "files"],
|
|
77
83
|
properties: {
|
|
78
84
|
status: { enum: ["completed", "blocked"] },
|
|
79
|
-
summary: { type: "string", minLength: 1, maxLength: MAX_SUMMARY_CHARS },
|
|
85
|
+
summary: { type: "string", minLength: 1, maxLength: MAX_SUMMARY_CHARS, description: SUMMARY_FIELD_DESCRIPTION },
|
|
80
86
|
files: { type: "array", maxItems: MAX_RESULT_FILES, items: { type: "string" } },
|
|
81
87
|
change_type: { enum: CHANGE_TYPES },
|
|
82
88
|
},
|
|
@@ -467,7 +473,16 @@ class LiveRun {
|
|
|
467
473
|
result = parsed.ok ? parsed.value : null;
|
|
468
474
|
}
|
|
469
475
|
this.emit("ended", code ?? status);
|
|
470
|
-
|
|
476
|
+
const report = { status, spent_micro_usd: this.broker.totals.spent_micro_usd, result, stop_reason: code, stop_detail: this.detail };
|
|
477
|
+
const sandbox = this.deps.sandbox;
|
|
478
|
+
if (status !== "succeeded" || !sandbox.scratch)
|
|
479
|
+
return this.resolveDone(report);
|
|
480
|
+
// Counted while the container is still there (it's stopped only once `done` settles), bounded; a failure counts nothing.
|
|
481
|
+
const counting = new AbortController();
|
|
482
|
+
void this.within(() => sandbox.scratch(this.run.run_ref, counting.signal)).then((counted) => {
|
|
483
|
+
counting.abort();
|
|
484
|
+
this.resolveDone(counted.ok && counted.value ? { ...report, scratch: counted.value } : report);
|
|
485
|
+
});
|
|
471
486
|
}
|
|
472
487
|
check(call) {
|
|
473
488
|
if (!this.active)
|
package/build/core/runs.js
CHANGED
|
@@ -125,6 +125,9 @@ export function checkRuns(v) {
|
|
|
125
125
|
return `${at}.published`;
|
|
126
126
|
if (e.publish_since !== undefined && !orNull(e.publish_since, isCount))
|
|
127
127
|
return `${at}.publish_since`;
|
|
128
|
+
const pr = e.publish_review;
|
|
129
|
+
if (pr !== undefined && pr !== null && (!isObj(pr) || typeof pr.run_ref !== "string" || pr.run_ref.length > 128 || !isCount(pr.held_since) || typeof pr.approved !== "boolean" || (pr.public_ok !== undefined && typeof pr.public_ok !== "boolean") || Object.keys(pr).some((k) => !["run_ref", "held_since", "approved", "public_ok"].includes(k))))
|
|
130
|
+
return `${at}.publish_review`;
|
|
128
131
|
const sub = e.submission;
|
|
129
132
|
if (sub !== undefined &&
|
|
130
133
|
sub !== null &&
|
package/build/core/runtime.js
CHANGED
|
@@ -24,7 +24,7 @@ const PREFIX_VALUE = /^(yes|no)$/;
|
|
|
24
24
|
const HOST_VALUE = /^(?=.{1,253}$)(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z](?:[a-z0-9-]{0,61}[a-z0-9])?$/;
|
|
25
25
|
const STAGE_VALUE = /^[a-z]{1,16}$/;
|
|
26
26
|
const TYPE_VALUE = /^(null|array|object|string|number|boolean|undefined|bigint|symbol|function)$/;
|
|
27
|
-
const NUMBER_FIELDS = new Set(["seq", "count", "status", "length"]);
|
|
27
|
+
const NUMBER_FIELDS = new Set(["seq", "count", "status", "length", "home_files", "tmp_files"]);
|
|
28
28
|
const ID_FIELDS = new Set(["agent", "plugin_agent", "workspace", "task", "attempt_id", "run"]);
|
|
29
29
|
/** The line a logger writes, with everything that isn't allowed dropped. */
|
|
30
30
|
export function logLine(at, outcome, fields = {}) {
|
package/build/core/setup.js
CHANGED
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
* writes is one Runner would load: no unknown or missing field, IDs in lower case, and `owner_org` never in
|
|
24
24
|
* `allowed_orgs`.
|
|
25
25
|
*/
|
|
26
|
+
import { trustPointer } from "./trust.js";
|
|
26
27
|
import { DEFAULT_TOOLS, isFullName, isPolicyId, parsePolicyConfig, policyProblem } from "./policy.js";
|
|
27
28
|
/** The starter's limits: conservative, each well under its ceiling. The same as the README's example. */
|
|
28
29
|
export const STARTER_CAPS = { spend_micro_usd: 500_000, run_time_ms: 900_000, turns: 30, output_tokens: 20_000, max_tokens: 8_000 };
|
|
@@ -83,7 +84,7 @@ export function starterRoom(facts, ownerOrg, allowRoomOrg) {
|
|
|
83
84
|
network: [],
|
|
84
85
|
repository: facts.repository === undefined ? null : { full_name: facts.repository.full_name, provider_repo_id: facts.repository.provider_repo_id },
|
|
85
86
|
allowed_orgs: facts.org_id !== undefined && isExternal(facts, ownerOrg) && allowRoomOrg ? [facts.org_id] : [],
|
|
86
|
-
acknowledged: {
|
|
87
|
+
acknowledged: { public_room_warning: false },
|
|
87
88
|
};
|
|
88
89
|
}
|
|
89
90
|
const pretty = (v) => `${JSON.stringify(v, null, 2)}\n`;
|
|
@@ -223,7 +224,10 @@ export function previewScreen(plan, facts, ownerOrg, path) {
|
|
|
223
224
|
" - holds each finished run's words for your review (outputs hold)",
|
|
224
225
|
" - read, search, write and edit in the task's folder; no shell and no network",
|
|
225
226
|
` - per run at most ${(STARTER_CAPS.spend_micro_usd / 1_000_000).toFixed(2)} USD, ${STARTER_CAPS.run_time_ms / 60_000} minutes and ${STARTER_CAPS.turns} turns; ${(STARTER_DAY_SPEND_MICRO_USD / 1_000_000).toFixed(2)} USD a day${plan.kind === "add_room" ? " (your policy's own limits stay)" : ""}`,
|
|
226
|
-
|
|
227
|
+
` - the trust statement isn't accepted: an unattended run here asks each time until you read and accept it with \`podster trust ${facts.room_id}\` at a terminal`,
|
|
228
|
+
" - the public-room warning isn't accepted: in a public room Runner also asks each time until you set it in the file",
|
|
229
|
+
"",
|
|
230
|
+
...trustPointer(facts.room_id),
|
|
227
231
|
];
|
|
228
232
|
if (external && facts.org_id === undefined) {
|
|
229
233
|
lines.push(" - this room's tasks are refused: Runner can't propose its organization for allowed_orgs, so add that organization's org_… ID to the room's allowed_orgs yourself if you want them");
|
|
@@ -108,11 +108,15 @@ export function taskPath(raw, folderAllowed = false) {
|
|
|
108
108
|
}
|
|
109
109
|
/**
|
|
110
110
|
* What a refusal tells the model: fixed text for each code, so a model that named a path its own way can name it again
|
|
111
|
-
* the folder's way. Nothing of the call's input is in it
|
|
111
|
+
* the folder's way. Nothing of the call's input is in it but, for a summary refused as too long, its length as a number
|
|
112
|
+
* (2026-11-27: the same refusal twice in a row), given the call's input, so the next try can be cut to fit.
|
|
112
113
|
*/
|
|
113
|
-
export function refusalText(reason, rule) {
|
|
114
|
-
if (reason === "result_invalid" && rule)
|
|
115
|
-
|
|
114
|
+
export function refusalText(reason, rule, input) {
|
|
115
|
+
if (reason === "result_invalid" && rule) {
|
|
116
|
+
const summary = rule === "result_summary_too_long" && isObj(input) && typeof input.summary === "string" ? input.summary : null;
|
|
117
|
+
const length = summary === null ? "" : ` Yours is ${summary.length}, so cut at least ${summary.length - MAX_SUMMARY_CHARS}.`;
|
|
118
|
+
return `Runner refused this result: ${RESULT_RULE_TEXT[rule]}${length} Fix that and give the structured result again.`;
|
|
119
|
+
}
|
|
116
120
|
switch (reason) {
|
|
117
121
|
case "path_outside_folder":
|
|
118
122
|
return `Runner refused this call: the path is outside the task's folder. Give a path relative to the task's folder, such as notes.txt or src/a.ts; the folder is also ${TASK_FOLDER_IN_CONTAINER}, your working folder.`;
|
|
@@ -129,7 +133,7 @@ export const RESULT_RULE_TEXT = {
|
|
|
129
133
|
result_unknown_field: "it has an unknown field: only status, summary, files and change_type are allowed.",
|
|
130
134
|
result_status_invalid: "status must be completed or blocked.",
|
|
131
135
|
result_summary_empty: "summary must not be empty.",
|
|
132
|
-
result_summary_too_long: `summary
|
|
136
|
+
result_summary_too_long: `summary must be at most ${MAX_SUMMARY_CHARS} characters; shorten it.`,
|
|
133
137
|
result_summary_control_char: "summary holds a control character; only tabs and line breaks are allowed.",
|
|
134
138
|
result_files_not_list: "files must be a list of paths.",
|
|
135
139
|
result_too_many_files: `files lists more than ${MAX_RESULT_FILES} paths.`,
|