podster 0.0.1-test.20 → 0.0.1-test.21

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 CHANGED
@@ -42,6 +42,7 @@ Then:
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
44
  npx --ignore-scripts podster@test trust <ws_…> # read and accept the trust statement for a room's unattended runs
45
+ npx --ignore-scripts podster@test trust <ws_…> --share # read and accept the public-sharing acknowledgement for a public room
45
46
  npx --ignore-scripts podster@test stop # stop the Runner running from this home, and any run, at once
46
47
  npx --ignore-scripts podster@test forget # delete this Runner's keys and record; disconnect the agent in Podster yourself
47
48
  ```
@@ -153,7 +154,7 @@ A complete, valid example, for one workroom. Replace the `org_…` and `ws_…`
153
154
  | `rooms` | One entry per workroom you allow. A workroom not listed here is never run. |
154
155
  | `rooms[].room_id` | The workroom's `ws_…` ID. |
155
156
  | `rooms[].mode` | `"ask"` shows each run at your terminal for you to approve. `"unattended"` runs without asking. Unattended runs are off by default: leave `mode` out or set `"ask"` until you choose otherwise. |
156
- | `rooms[].outputs` | `"hold"` keeps a finished run's result on your machine until you approve publishing it. `"share"` publishes it. Leaving it out means `"hold"`. |
157
+ | `rooms[].outputs` | `"hold"` keeps a finished run's result on your machine until you approve publishing it. `"share"` publishes it when every word of the task comes from your organization. In a public room, `"share"` counts only after you accept the public-sharing acknowledgement for that room; until then Runner still holds the result. See [Sharing in a public room](#sharing-in-a-public-room). Leaving it out means `"hold"`. |
157
158
  | `rooms[].tools` | Runner's own tools for a task. `read`, `search`, `write` and `edit` are the default. `shell` is never on unless you list it. |
158
159
  | `rooms[].network` | Host names the room's tasks may reach, such as `["registry.npmjs.org"]` so an agent can `npm install`; `[]`, the default, is no network. Only HTTPS on port 443 to exactly these names, through Runner's egress proxy: no subdomain, other host, plain HTTP, other port or IP address, and never a name that resolves to your LAN or this machine. List exact lower-case names, at most 50; a scheme, port, path, wildcard, IP address, upper case, trailing dot or a name like `localhost` is refused when Runner starts, with `network_host_invalid` and the entry's index. A listed host is fully reachable, so list only hosts you'd let the task send data to, and a host behind a shared CDN can be used to reach other sites on that CDN (domain fronting), which an allowlist of names can't stop. Needs Docker Engine 26 or later; an older one refuses the run with `docker_engine_too_old`. Runner logs each allowed or refused host when a run ends. |
159
160
  | `rooms[].toolchains` | Optional toolchains for the room's tasks: any of `"dotnet"`, `"java"`, `"python"` and `"rust"`, such as `["rust", "python"]`. `[]`, the default, runs tasks in Runner's base image (shell tools and Node 22). `rust` adds Rust 1.100.0 (cargo, rustc, rustfmt, clippy) with gcc as its linker; `python` adds Python 3.14.10 and uv 0.13.9; `dotnet` adds the .NET 10 SDK 10.0.404; `java` adds the Temurin JDK 25.0.5.1 and Maven 3.10.1 (a Gradle project uses its own wrapper). Each needs `shell` in `tools`. Runner builds the room's image from its own pinned Dockerfiles the first time a task needs it, which takes a few minutes and counts against that run's time; after that it's reused. A toolchain adds no network: to fetch packages, list the registries in `network`, `index.crates.io` and `static.crates.io` for crates, `pypi.org` and `files.pythonhosted.org` for PyPI, `api.nuget.org` for NuGet, `repo.maven.apache.org` for Maven Central, and for a Gradle wrapper `services.gradle.org` with `github.com` and `release-assets.githubusercontent.com`, where it downloads Gradle from (plus `plugins.gradle.org` for plugins). Listing `github.com` for the wrapper opens all of GitHub to the task, not only Gradle's downloads. Toolchain rooms get larger bounds a build needs: 4 GB of memory, 1,024 processes and 10 minutes per command. An unknown or repeated name is refused when Runner starts, with `toolchain_unknown` or `toolchain_duplicate` and the entry's index, and toolchains without `shell` with `toolchain_needs_shell`. |
@@ -176,6 +177,16 @@ npx --ignore-scripts podster@test trust ws_…
176
177
 
177
178
  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
179
 
180
+ ### Sharing in a public room
181
+
182
+ In a public room Runner holds the agent's words (its result note and summary), its commit, its push and its pull request for your review, even when the room's `outputs` is `"share"`, until you accept the public-sharing acknowledgement for that room (the owner's ruling of 2026-11-27). It says: Runner will send the agent's own words to Podster without asking you first; anyone who can see the room can read them; and Runner redacts secrets it recognises, but not all. Runner's ask screen, `setup`'s preview and the `public_share_not_acknowledged` log line say how to accept it:
183
+
184
+ ```bash
185
+ npx --ignore-scripts podster@test trust ws_… --share
186
+ ```
187
+
188
+ Runner shows the whole acknowledgement and records it only when you type `share` (the trust statement's `accept` doesn't count). It's offered only for a room Runner last saw public: Runner learns a room's visibility from Podster when `run` reads one of its tasks, and keeps what it saw in `room-visibility.json`. It keeps, in `public-share.json` in Runner's home, the room, the acknowledgement's version and SHA-256, that the room was public, when its current public stretch began, and when you accepted. Don't write either file yourself. The acknowledgement stops counting if the statement changes, or if Runner sees the room go private and then public again, and then Runner holds the words and asks again. A private stretch during which Runner read none of the room's tasks can't be seen. It changes nothing else: a task with any words from outside your organization is still held, a private room is as before, a push to a public repository still asks you each time, and the trust statement is still needed for unattended runs. Set `outputs` to `"hold"` to stop sharing at the next evaluation.
189
+
179
190
  ### The experimental OpenAI adapter
180
191
 
181
192
  *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.
@@ -116,6 +116,7 @@ const TABLE = new Map([
116
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
117
  // F-2 of M7's security review: the push and the pull request held for the owner's review.
118
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(["public_share_not_acknowledged"], "The room is public and its outputs are \"share\", but you haven't accepted the public-sharing acknowledgement for it while it's public, so Runner holds the agent's words and its push for your review.", "If anyone who can see the room may read what the agent writes, accept it at a terminal with `podster trust <ws_…> --share`; otherwise set the room's outputs to \"hold\". Runner asks again if it sees the room go private and then public."),
119
120
  ...group(["publish_declined"], "You declined a held publication, so nothing was committed, pushed or opened, and the task was released.", "Nothing to do."),
120
121
  ...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."),
121
122
  ...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."),
@@ -1,6 +1,6 @@
1
1
  import { GatewayError, meaningOf } from "./errors.js";
2
- import { acceptedRooms } from "./trust.js";
3
- import { consumeRunDecision, evaluate, factsKey, issueRunDecision, outputsOf, parsePolicyConfig, pinRunBase, policyProblem, repositoryOf } from "./policy.js";
2
+ import { acceptedRooms, isTrustRoomId, parseSightings, sharedPublicRooms, sighted } from "./trust.js";
3
+ import { consumeRunDecision, evaluate, factsKey, issueRunDecision, outputsOf, visibilityOf, parsePolicyConfig, pinRunBase, policyProblem, repositoryOf } from "./policy.js";
4
4
  import { pullRequestUrl, RepoPathError } from "./repository.js";
5
5
  import { readTaskDetail, sha256Hex } from "./prompt.js";
6
6
  import { cleanResult, composeBlockedNote, composeNote } from "./results.js";
@@ -124,6 +124,8 @@ export class Lifecycle {
124
124
  checkInMs;
125
125
  state;
126
126
  /** What the owner approved on an ask, by task, until it's issued: it holds only while a fresh read still matches. */
127
+ /** Public rooms set to share whose words the last evaluation held for want of the public-sharing acknowledgement. */
128
+ shareHeld = new Set();
127
129
  approvals = new Map();
128
130
  /** Each finished run's structured result, by task, until it's submitted: in memory only, never stored or logged. */
129
131
  results = new Map();
@@ -397,7 +399,7 @@ export class Lifecycle {
397
399
  const parsed = parsePolicyConfig(config, homeOf(this.deps));
398
400
  if (parsed.ok && parsed.value.owner_org !== this.ownerOrg)
399
401
  return { outcome: "refuse", reason: "config_invalid", ...ids };
400
- const decision = this.policy.evaluate({
402
+ const evaluation = {
401
403
  config,
402
404
  provenance: detail.provenance,
403
405
  prompt: detail.prompt?.shape ?? null,
@@ -405,9 +407,22 @@ export class Lifecycle {
405
407
  authority_fresh: authorityFresh,
406
408
  budget: this.budget(ownReservation),
407
409
  trusted_rooms: acceptedRooms(this.deps.trust === undefined ? null : await readConfig(this.deps.trust), this.now()),
410
+ shared_public_rooms: await this.sharedPublic(entry.workspace_id, detail.provenance),
408
411
  ...homeOf(this.deps),
409
412
  now: this.now(),
410
- });
413
+ };
414
+ const decision = this.policy.evaluate(evaluation);
415
+ // Said on the ask screen and logged once: a public room whose words are held for want of the public-sharing
416
+ // acknowledgement alone, which the same evaluation with it would share (2026-11-27). Any other hold isn't this.
417
+ const held = decision.facts?.room_visibility === "public" &&
418
+ decision.facts.outputs === "hold" &&
419
+ this.policy.evaluate({ ...evaluation, shared_public_rooms: [entry.workspace_id] }).facts?.outputs === "share";
420
+ if (held && !this.shareHeld.has(entry.workspace_id))
421
+ this.log("lifecycle.decision", "held", entry, { code: "public_share_not_acknowledged" });
422
+ if (held)
423
+ this.shareHeld.add(entry.workspace_id);
424
+ else
425
+ this.shareHeld.delete(entry.workspace_id);
411
426
  // Podster said this task has no linked repository (`task_not_linked`, the owner's ruling of 2026-11-22): it runs as a
412
427
  // task in a room without one, in an empty folder, with no token, commit, push or pull request. Only a server answer
413
428
  // sets this, never the task's words; everything else the room's policy says is unchanged.
@@ -527,7 +542,7 @@ export class Lifecycle {
527
542
  approved = !!held && held.hash === detail.prompt.hash && held.version === task.version && held.facts === factsKey(decision);
528
543
  this.approvals.delete(key);
529
544
  if (!approved)
530
- return { view: askView(entry, decision, detail), decision };
545
+ return { view: { ...askView(entry, decision, detail), ...(this.shareHeld.has(entry.workspace_id) ? { public_share_held: true } : {}) }, decision };
531
546
  }
532
547
  // The owner's repository for the room, if any; its base is pinned after the accept, against a fresh checkout.
533
548
  const repository = decision.facts.repository;
@@ -1519,7 +1534,50 @@ export class Lifecycle {
1519
1534
  if (outputsOf(consumed) !== "share")
1520
1535
  return false;
1521
1536
  const parsed = parsePolicyConfig(await readConfig(this.deps.config), homeOf(this.deps));
1522
- return parsed.ok && parsed.value.owner_org === this.ownerOrg && parsed.value.rooms.some((r) => r.room_id === workspace_id && r.outputs === "share");
1537
+ if (!(parsed.ok && parsed.value.owner_org === this.ownerOrg && parsed.value.rooms.some((r) => r.room_id === workspace_id && r.outputs === "share")))
1538
+ return false;
1539
+ // A public room's acknowledgement must still count now, not only when the run was decided (2026-11-27).
1540
+ if (visibilityOf(consumed) === "private")
1541
+ return true;
1542
+ return sharedPublicRooms(await this.readShares(), this.deps.sightings ? await readConfig(() => this.deps.sightings?.read()) : null, this.now()).includes(workspace_id);
1543
+ }
1544
+ async readShares() {
1545
+ return this.deps.publicShare === undefined ? null : readConfig(this.deps.publicShare);
1546
+ }
1547
+ /**
1548
+ * Records what this task's provenance says of its room's visibility, and answers the public rooms whose words may be
1549
+ * shared (2026-11-27). Only a visibility of exactly "public" or "private", for a room ID the record can hold, is
1550
+ * recorded. A record that isn't Runner's, or a sighting that can't be saved, counts as none, so the words are held.
1551
+ */
1552
+ async sharedPublic(workspace_id, provenance) {
1553
+ const store = this.deps.sightings;
1554
+ if (store === undefined)
1555
+ return [];
1556
+ const visibility = typeof provenance === "object" && provenance !== null && Object.hasOwn(provenance, "room_visibility") ? provenance.room_visibility : undefined;
1557
+ let raw;
1558
+ try {
1559
+ raw = await store.read();
1560
+ }
1561
+ catch {
1562
+ return [];
1563
+ }
1564
+ const record = parseSightings(raw);
1565
+ if (raw !== null && record === null)
1566
+ return [];
1567
+ let current = record;
1568
+ if ((visibility === "public" || visibility === "private") && isTrustRoomId(workspace_id)) {
1569
+ const next = sighted(record, workspace_id, visibility, this.now());
1570
+ if (next.changed) {
1571
+ try {
1572
+ await store.write(next.record);
1573
+ }
1574
+ catch {
1575
+ return [];
1576
+ }
1577
+ }
1578
+ current = next.record;
1579
+ }
1580
+ return sharedPublicRooms(await this.readShares(), current, this.now());
1523
1581
  }
1524
1582
  /** The fixed progress message for a held result, sent once, with a key stored first; a failure is tried at a later review. */
1525
1583
  async tellHeld(entry) {
@@ -24,6 +24,10 @@
24
24
  * only through `podster trust` at a terminal, and the caller passes the rooms with a current acceptance as
25
25
  * `trusted_rooms` (F-3 of the M7 security review). The policy file has no field for it: one naming `trust_statement`
26
26
  * is refused whole, so a copied example can't switch it on.
27
+ * - **Outputs** (S-34): a room's words and its push are shared without the owner's review only when the room says
28
+ * `outputs: "share"` and every author is internal. A public room also needs the owner's public-sharing acknowledgement
29
+ * for it (the owner's ruling of 2026-11-27), passed in as `shared_public_rooms` from Runner's own records, like
30
+ * `trusted_rooms`; without one its words are held, as every public room's were before.
27
31
  * - **The prompt's inputs** must be exactly those `provenance` lists, in its order, and a change request exactly the one
28
32
  * whose `event_id` provenance names (M2 on #455's review). Steps 8 and 9 build the prompt from those inputs only, and
29
33
  * the change request from that event only.
@@ -611,6 +615,9 @@ function decide(input) {
611
615
  const isPublic = prov.room_visibility === "public";
612
616
  const trustedRooms = own(given, "trusted_rooms");
613
617
  const trusted = Array.isArray(trustedRooms) && trustedRooms.every(isId) && trustedRooms.includes(room.room_id);
618
+ // S-34 as the owner narrowed it on 2026-11-27: a public room shares only with a current public-sharing acknowledgement.
619
+ const sharedRooms = own(given, "shared_public_rooms");
620
+ const publicShare = Array.isArray(sharedRooms) && sharedRooms.every(isId) && sharedRooms.includes(room.room_id);
614
621
  const facts = {
615
622
  adapter: config.adapter,
616
623
  tools: [...room.tools],
@@ -621,7 +628,7 @@ function decide(input) {
621
628
  workspace_root: config.workspace_root,
622
629
  task_folder: `${config.workspace_root}/${ids.workspace_id}/${ids.task_id}`,
623
630
  caps: { ...config.caps },
624
- outputs: room.outputs === "share" && allInternal && !isPublic ? "share" : "hold",
631
+ outputs: room.outputs === "share" && allInternal && (!isPublic || publicShare) ? "share" : "hold",
625
632
  policy_revision: config.revision,
626
633
  room_visibility: prov.room_visibility,
627
634
  prompt_inputs: prompt.inputs,
@@ -874,8 +881,8 @@ export function repositoryOf(stored) {
874
881
  }
875
882
  /**
876
883
  * The output policy a stored decision was made on (M7 step 11): `share` only when the record is whole and its facts say
877
- * so, which they do only for a room the owner set to share, every author internal and the room private. Anything else,
878
- * a record that doesn't read included, is `hold`.
884
+ * so, which they do only for a room the owner set to share, every author internal, and the room private or publicly
885
+ * acknowledged (2026-11-27). Anything else, a record that doesn't read included, is `hold`.
879
886
  */
880
887
  export function outputsOf(stored) {
881
888
  try {
@@ -889,3 +896,16 @@ export function outputsOf(stored) {
889
896
  return "hold";
890
897
  }
891
898
  }
899
+ /** The room's visibility a stored decision was made on; anything that doesn't read is `public`, the stricter. */
900
+ export function visibilityOf(stored) {
901
+ try {
902
+ const record = parseRecord(stored);
903
+ if (!record)
904
+ return "public";
905
+ const facts = copy(JSON.parse(record.facts_key));
906
+ return isObj(facts) && facts.room_visibility === "private" ? "private" : "public";
907
+ }
908
+ catch {
909
+ return "public";
910
+ }
911
+ }
@@ -226,6 +226,7 @@ export function previewScreen(plan, facts, ownerOrg, path) {
226
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)" : ""}`,
227
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
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
+ ` - in a public room, outputs "share" also needs the public-sharing acknowledgement, or Runner still holds the words: accept it with \`podster trust ${facts.room_id} --share\` at a terminal`,
229
230
  "",
230
231
  ...trustPointer(facts.room_id),
231
232
  ];
@@ -149,3 +149,170 @@ export function trustScreen(room_id) {
149
149
  "",
150
150
  ].join("\n");
151
151
  }
152
+ /*
153
+ * The public-sharing acknowledgement (the owner's ruling of 2026-11-27, a narrowing of S-34).
154
+ *
155
+ * Until it, Runner held the agent's words for the owner's review in every public room, whatever the room's `outputs`
156
+ * said. Now a room's `outputs: "share"` is honoured in a public room only when the owner has accepted this
157
+ * acknowledgement for that room, by the same machinery as the trust statement: the text, its version and the SHA-256 of
158
+ * its exact bytes live here; it's accepted only through `podster trust <ws_…> --share` at a terminal, by typing `share`;
159
+ * Runner alone writes the record (`public-share.json`); and a malformed or foreign record holds no acknowledgement. No
160
+ * policy field, flag, environment variable or example can make one.
161
+ *
162
+ * **It's bound to the room being public.** Runner learns a room's visibility only from Podster's provenance on a task,
163
+ * so `run` keeps what it last saw of each room in `room-visibility.json`: public or private, and since when it has seen
164
+ * the room public without a break (`public_since`). An acknowledgement records the room's visibility and that start when
165
+ * accepted, and `podster trust --share` refuses a room Runner hasn't last seen public. It counts only while Runner's
166
+ * sighting still says public with the same start, so a room seen private and then public again asks again, as does a
167
+ * changed statement. A flip Runner never sees, because no task of the room was read while it was private, can't be told
168
+ * apart from no flip; the docs say so.
169
+ *
170
+ * Unchanged: an input authored outside the owner's organization still holds; a private room behaves as before; the push
171
+ * to a public repository still asks (PR 622); and this isn't the trust statement, which unattended runs still need.
172
+ */
173
+ export const SHARE_STATEMENT_VERSION = 1;
174
+ /** The word the owner types to accept the acknowledgement, and only it: not the trust statement's `accept`. */
175
+ export const SHARE_WORD = "share";
176
+ /** Runner's own record of public-sharing acknowledgements, written only for `podster trust --share`. */
177
+ export const SHARE_FILE = "public-share.json";
178
+ /** What `run` last saw of each room's visibility, written only by `run`. */
179
+ export const SIGHTINGS_FILE = "room-visibility.json";
180
+ /** The acknowledgement, exactly as shown and hashed. Changing a word changes the hash, and the version must go up with it. */
181
+ export const SHARE_STATEMENT = `Podster Runner public-sharing acknowledgement, version 1
182
+
183
+ In this public room, Runner will send the agent's own words (its result note and summary)
184
+ to Podster without asking you first, while the room's "outputs" in policy.json is "share".
185
+ Anyone who can see the room can read them. Runner redacts secrets it recognises, but not all.
186
+
187
+ Runner will also commit, push the task branch and open its pull request without asking.
188
+ A push to a public repository still asks you each time.
189
+
190
+ A task with any words written outside your organization is still held for you. This
191
+ acknowledgement is for this room, while it stays public, and this version of the statement
192
+ only. If Runner sees the room go private and then public again, or the statement changes,
193
+ it holds the words and asks again. To stop, set the room's "outputs" to "hold", which
194
+ counts at Runner's next evaluation.
195
+ `;
196
+ /** SHA-256 of `SHARE_STATEMENT`'s UTF-8 bytes, lower-case hex. */
197
+ export const SHARE_STATEMENT_SHA256 = "b258e9a86cc6e1d6c0fb9327ee7d6e9ad22abf0b4383e18b6cdadedfab48c393";
198
+ /** Where Runner points the owner to it: the ask screen, setup's preview and the README. */
199
+ export function sharePointer(room_id) {
200
+ return [
201
+ `This room is public and its outputs are "share", but Runner holds the agent's words and its push for you until you`,
202
+ "accept the public-sharing acknowledgement for it: anyone who can see the room can read what's shared.",
203
+ `Read it and accept it at a terminal with: podster trust ${room_id} --share`,
204
+ ];
205
+ }
206
+ const isVisibility = (v) => v === "public" || v === "private";
207
+ function parseRooms(raw, keys, one) {
208
+ try {
209
+ if (!isObj(raw) || !keysAre(raw, ["version", "rooms"]) || raw.version !== 1)
210
+ return null;
211
+ const rooms = raw.rooms;
212
+ if (!Array.isArray(rooms) || rooms.length > MAX_RECORDED)
213
+ return null;
214
+ const out = [];
215
+ const seen = new Set();
216
+ for (const r of rooms) {
217
+ if (!isObj(r) || !keysAre(r, keys) || seen.has(r.room_id))
218
+ return null;
219
+ seen.add(r.room_id);
220
+ const item = one(r);
221
+ if (item === null)
222
+ return null;
223
+ out.push(item);
224
+ }
225
+ return out;
226
+ }
227
+ catch {
228
+ return null;
229
+ }
230
+ }
231
+ /** The acknowledgements as Runner wrote them, or null for anything else. */
232
+ export function parseShareRecord(raw) {
233
+ const rooms = parseRooms(raw, ["room_id", "statement_version", "statement_sha256", "room_visibility", "public_since", "accepted_at"], (r) => {
234
+ const { room_id, statement_version, statement_sha256, room_visibility, public_since, accepted_at } = r;
235
+ if (!isTrustRoomId(room_id) || !isCount(statement_version) || statement_version < 1)
236
+ return null;
237
+ if (typeof statement_sha256 !== "string" || !HEX64.test(statement_sha256) || !isVisibility(room_visibility))
238
+ return null;
239
+ if (!isCount(public_since) || !isCount(accepted_at) || public_since > accepted_at)
240
+ return null;
241
+ return { room_id, statement_version, statement_sha256, room_visibility, public_since, accepted_at };
242
+ });
243
+ return rooms === null ? null : { version: 1, rooms };
244
+ }
245
+ /** What `run` saw, as it wrote it, or null for anything else: public always with a start no later than the sighting, private never. */
246
+ export function parseSightings(raw) {
247
+ const rooms = parseRooms(raw, ["room_id", "visibility", "public_since", "seen_at"], (r) => {
248
+ const { room_id, visibility, public_since, seen_at } = r;
249
+ if (!isTrustRoomId(room_id) || !isVisibility(visibility) || !isCount(seen_at))
250
+ return null;
251
+ if (visibility === "private" ? public_since !== null : !isCount(public_since) || public_since > seen_at)
252
+ return null;
253
+ return { room_id, visibility, public_since: public_since, seen_at };
254
+ });
255
+ return rooms === null ? null : { version: 1, rooms };
256
+ }
257
+ /**
258
+ * The record with `room` seen at `now`: a public sighting keeps the current public stretch's start, or starts one; a
259
+ * private one ends it. `changed` says whether anything but the time moved, so the caller writes only then.
260
+ */
261
+ export function sighted(record, room_id, visibility, now) {
262
+ const before = record?.rooms.find((r) => r.room_id === room_id);
263
+ const public_since = visibility === "private" ? null : before?.visibility === "public" && before.public_since !== null ? before.public_since : now;
264
+ const changed = before === undefined || before.visibility !== visibility || before.public_since !== public_since;
265
+ const others = (record?.rooms ?? []).filter((r) => r.room_id !== room_id);
266
+ return { record: { version: 1, rooms: [...others, { room_id, visibility, public_since, seen_at: changed ? now : before.seen_at }] }, changed };
267
+ }
268
+ /**
269
+ * The rooms whose words may be shared while public: a current acknowledgement (this version, this exact text, accepted
270
+ * while public, no later than `now`) whose public stretch is the one Runner still sees. Anything else is none.
271
+ */
272
+ export function sharedPublicRooms(shareRaw, sightingsRaw, now) {
273
+ const record = parseShareRecord(shareRaw);
274
+ const sightings = parseSightings(sightingsRaw);
275
+ if (record === null || sightings === null || !isCount(now))
276
+ return [];
277
+ return record.rooms
278
+ .filter((a) => {
279
+ const s = sightings.rooms.find((r) => r.room_id === a.room_id);
280
+ return (a.statement_version === SHARE_STATEMENT_VERSION &&
281
+ a.statement_sha256 === SHARE_STATEMENT_SHA256 &&
282
+ a.room_visibility === "public" &&
283
+ a.accepted_at <= now &&
284
+ s !== undefined &&
285
+ s.visibility === "public" &&
286
+ s.public_since === a.public_since);
287
+ })
288
+ .map((a) => a.room_id)
289
+ .sort();
290
+ }
291
+ /**
292
+ * The record with this room's acknowledgement of the current statement at `now`, in place of any earlier one, or null
293
+ * when Runner's sighting of the room isn't public: an acknowledgement is never recorded for a room not seen public.
294
+ */
295
+ export function withShareAcknowledgement(record, room_id, sighting, now) {
296
+ if (sighting === undefined || sighting.room_id !== room_id || sighting.visibility !== "public" || sighting.public_since === null || sighting.public_since > now)
297
+ return null;
298
+ const others = (record?.rooms ?? []).filter((a) => a.room_id !== room_id);
299
+ return {
300
+ version: 1,
301
+ rooms: [...others, { room_id, statement_version: SHARE_STATEMENT_VERSION, statement_sha256: SHARE_STATEMENT_SHA256, room_visibility: "public", public_since: sighting.public_since, accepted_at: now }],
302
+ };
303
+ }
304
+ /** The screen `trust --share` shows before asking: the room, what Runner saw of it, the whole statement, and what's recorded. */
305
+ export function shareScreen(room_id, sighting) {
306
+ return [
307
+ "",
308
+ `Runner's public-sharing acknowledgement, for the room ${room_id}. Read all of it before you answer.`,
309
+ `Runner last saw this room public, without a break since ${new Date(sighting.public_since ?? 0).toISOString()}.`,
310
+ "",
311
+ ...SHARE_STATEMENT.trimEnd().split("\n").map((l) => (l === "" ? "" : ` ${l}`)),
312
+ "",
313
+ `Typing ${SHARE_WORD} records, in ${SHARE_FILE} on this machine only, that you accepted version ${SHARE_STATEMENT_VERSION} of this`,
314
+ `statement (SHA-256 ${SHARE_STATEMENT_SHA256}) for ${room_id} while it was public, and when. It doesn't set the`,
315
+ `room's outputs to share: that's the room's "outputs" in policy.json. Anything else records nothing.`,
316
+ "",
317
+ ].join("\n");
318
+ }
package/build/node/cli.js CHANGED
@@ -19,6 +19,8 @@
19
19
  * and save it only on the owner's typed yes. Never replaces one.
20
20
  * trust <ws_…> Show Runner's trust statement for a room and record the owner's
21
21
  * acceptance only on the typed word, at a terminal (F-3).
22
+ * trust <ws_…> --share The same for the public-sharing acknowledgement, which lets a public
23
+ * room's outputs "share" count (the owner's ruling of 2026-11-27).
22
24
  * stop Stop the Runner running from this home, and any run, at once.
23
25
  * status Show what this Runner's record says, by IDs.
24
26
  * forget Delete this Runner's keys and record. The agent stays connected in Podster.
@@ -89,6 +91,9 @@ const USAGE = `Podster Runner (M7: pairing, the inbox loop, and tasks through th
89
91
  trust <ws_…> Read Runner's trust statement for a room and accept it by typing
90
92
  the word. An unattended room asks before each run until you do.
91
93
  Only at a terminal; a file can't set it.
94
+ trust <ws_…> --share Read the public-sharing acknowledgement for a public room and
95
+ accept it by typing share. Until you do, a public room set to
96
+ outputs "share" still holds the agent's words for you.
92
97
  stop Stop the Runner running from this home at once, and any run.
93
98
  It polls nothing until you start it again.
94
99
  status Show this Runner's record, by IDs.
@@ -143,7 +148,7 @@ async function main(argv) {
143
148
  if (command === "trust") {
144
149
  // No lock: the owner may accept while `run` goes on, which reads the record afresh at its next evaluation.
145
150
  const room = args[0] !== undefined && !args[0].startsWith("--") ? args[0] : undefined;
146
- return runTrust({ home, room, terminal: processTerminal(), now: () => systemClock.now(), say });
151
+ return runTrust({ home, room, share: args.includes("--share"), terminal: processTerminal(), now: () => systemClock.now(), say });
147
152
  }
148
153
  if (command === "stop") {
149
154
  // A local stop: no call to Podster, no signal to a process ID. The running Runner sees the request at once.
@@ -1,7 +1,7 @@
1
1
  import { markHidden } from "../core/results.js";
2
2
  import { QuestionInterrupted } from "../core/roles.js";
3
3
  import { changeScreen } from "../core/setup.js";
4
- import { trustPointer } from "../core/trust.js";
4
+ import { sharePointer, trustPointer } from "../core/trust.js";
5
5
  /** The most code points of all the inputs shown together. Past this, the prompt can't be approved here. */
6
6
  export const SHOWN_CHARS = 16_000;
7
7
  /** The most fenced lines, after wrapping. */
@@ -88,6 +88,7 @@ export function askScreen(view, width = 80) {
88
88
  ` room ${view.workspace_id} (${view.room_visibility}), task ${view.task_id}`,
89
89
  ` why it asks: ${view.reason}`,
90
90
  ...(view.reason === "trust_statement_not_accepted" ? trustPointer(view.workspace_id).map((l) => ` ${l}`) : []),
91
+ ...(view.public_share_held === true ? sharePointer(view.workspace_id).map((l) => ` ${l}`) : []),
91
92
  ` requester: ${view.requester}`,
92
93
  ...view.authors.map((a) => ` ${a.input} written by: ${a.authors.join(", ")}`),
93
94
  ` tools: ${view.tools.join(", ") || "none"}; network: ${view.network.join(", ") || "none"}`,
@@ -14,7 +14,8 @@ import { Lifecycle, runWithLifecycle } from "../core/lifecycle.js";
14
14
  import { SupervisedAdapter } from "../core/run-interface.js";
15
15
  import { FileRunStore } from "./file-runs.js";
16
16
  import { policyFile, policyText } from "./policy-file.js";
17
- import { trustFile } from "./trust-file.js";
17
+ import { trustFile, writeTrustRecord } from "./trust-file.js";
18
+ import { SHARE_FILE, SIGHTINGS_FILE } from "../core/trust.js";
18
19
  import { TerminalPrompter } from "./prompter.js";
19
20
  import { appOriginFor } from "../core/pull-text.js";
20
21
  import { hostRepositoryPath } from "./repo-path.js";
@@ -49,6 +50,8 @@ export async function runInbox(deps) {
49
50
  runs: new FileRunStore(deps.home),
50
51
  config: policyFile(deps.home),
51
52
  trust: trustFile(deps.home),
53
+ publicShare: trustFile(deps.home, SHARE_FILE),
54
+ sightings: { read: trustFile(deps.home, SIGHTINGS_FILE), write: (record) => writeTrustRecord(deps.home, record, SIGHTINGS_FILE) },
52
55
  adapter,
53
56
  home: deps.home,
54
57
  ...(repository ? { repository } : {}),
@@ -5,8 +5,13 @@
5
5
  * when, in Runner's own `trust.json` (`trust-file.ts`). It doesn't switch the room to unattended runs; that stays the
6
6
  * room's `mode` in `policy.json` (decision 29, condition 1). Nothing is logged: the record holds IDs, a version, a hash
7
7
  * and a time only (condition 5).
8
+ *
9
+ * `podster trust <ws_…> --share` (the owner's ruling of 2026-11-27) does the same for the public-sharing acknowledgement,
10
+ * a separate statement accepted by typing `share`: it lets a public room's `outputs: "share"` count. It's offered only for a
11
+ * room `run` last saw public, and records that, with when the room's public stretch began, in `public-share.json`. The flag
12
+ * only picks which statement is shown; nothing but the typed word records either.
8
13
  */
9
- import { ACCEPT_WORD, isTrustRoomId, parseTrustRecord, TRUST_FILE, TRUST_STATEMENT_VERSION, trustScreen, withAcceptance } from "../core/trust.js";
14
+ import { ACCEPT_WORD, isTrustRoomId, parseShareRecord, parseSightings, parseTrustRecord, SHARE_FILE, SHARE_STATEMENT_VERSION, SHARE_WORD, shareScreen, SIGHTINGS_FILE, TRUST_FILE, TRUST_STATEMENT_VERSION, trustScreen, withAcceptance, withShareAcknowledgement, } from "../core/trust.js";
10
15
  import { trustFile, writeTrustRecord } from "./trust-file.js";
11
16
  /** 0 accepted and recorded; 1 not accepted, or a record Runner can't read; 2 not asked at all. */
12
17
  export async function runTrust(deps) {
@@ -19,6 +24,8 @@ export async function runTrust(deps) {
19
24
  say("The trust statement is accepted only at a terminal, by you typing the word. Run `podster trust` in a terminal. Nothing was recorded.");
20
25
  return 2;
21
26
  }
27
+ if (deps.share === true)
28
+ return runShare(deps, room);
22
29
  let existing;
23
30
  try {
24
31
  existing = await trustFile(deps.home)();
@@ -41,3 +48,36 @@ export async function runTrust(deps) {
41
48
  say(`Accepted version ${TRUST_STATEMENT_VERSION} of the trust statement for ${room}. Unattended runs need the room's "mode" to be "unattended" in policy.json too.`);
42
49
  return 0;
43
50
  }
51
+ async function read(home, file) {
52
+ try {
53
+ return await trustFile(home, file)();
54
+ }
55
+ catch {
56
+ return undefined;
57
+ }
58
+ }
59
+ async function runShare(deps, room) {
60
+ const { terminal, say } = deps;
61
+ const sighting = parseSightings(await read(deps.home, SIGHTINGS_FILE))?.rooms.find((r) => r.room_id === room);
62
+ if (sighting === undefined || sighting.visibility !== "public") {
63
+ say(`Runner hasn't last seen ${room} as a public room, and this acknowledgement is only for a room that is public when you accept it. ` +
64
+ "Runner learns a room's visibility from Podster when `run` reads one of its tasks; once a public room's task has been asked about, run this again. Nothing was recorded.");
65
+ return 1;
66
+ }
67
+ const existing = await read(deps.home, SHARE_FILE);
68
+ const record = existing === null ? null : parseShareRecord(existing);
69
+ if (existing !== null && record === null) {
70
+ say(`Runner can't read ${SHARE_FILE} in its home as its own record, so it won't write over it. Move it aside, then run \`podster trust --share\` again. Nothing was recorded.`);
71
+ return 1;
72
+ }
73
+ terminal.write(shareScreen(room, sighting));
74
+ const answer = await terminal.question(`Type ${SHARE_WORD} to accept this acknowledgement for ${room}: `);
75
+ const next = answer.trim() === SHARE_WORD ? withShareAcknowledgement(record, room, sighting, deps.now()) : null;
76
+ if (next === null) {
77
+ say("Not accepted. Nothing was recorded, and Runner still holds this public room's words for you.");
78
+ return 1;
79
+ }
80
+ await writeTrustRecord(deps.home, next, SHARE_FILE);
81
+ say(`Accepted version ${SHARE_STATEMENT_VERSION} of the public-sharing acknowledgement for ${room}. It counts while the room's "outputs" is "share" in policy.json and the room stays public.`);
82
+ return 0;
83
+ }
@@ -1,6 +1,8 @@
1
1
  /**
2
2
  * Runner's record of the owner's trust-statement acceptances (`trust.json` in Runner's home; F-3 of the M7 security
3
- * review). Runner writes it only for the owner's `podster trust`, whole or not at all: a new file, mode 600, flushed and
3
+ * review), and by the same code its public-sharing acknowledgements (`public-share.json`) and what `run` last saw of each
4
+ * room's visibility (`room-visibility.json`; the owner's ruling of 2026-11-27). Runner writes the first two only for the
5
+ * owner's `podster trust`, the third only from `run`, each whole or not at all: a new file, mode 600, flushed and
4
6
  * renamed over the old one in Runner's own folder. The lifecycle reads it afresh on every evaluation, as it does the
5
7
  * policy, so an acceptance counts at the next one. A missing or unreadable file is no acceptance.
6
8
  */
@@ -8,8 +10,8 @@ import { chmod, lstat, mkdir, open, readFile, rename, rm } from "node:fs/promise
8
10
  import { join } from "node:path";
9
11
  import { TRUST_FILE } from "../core/trust.js";
10
12
  /** A reader for the lifecycle's `trust`: each call reads the file again; a missing one reads as null. */
11
- export function trustFile(home) {
12
- const path = join(home, TRUST_FILE);
13
+ export function trustFile(home, file = TRUST_FILE) {
14
+ const path = join(home, file);
13
15
  return async () => {
14
16
  try {
15
17
  return JSON.parse(await readFile(path, "utf8"));
@@ -22,11 +24,11 @@ export function trustFile(home) {
22
24
  };
23
25
  }
24
26
  /** Writes the record whole. Refuses to write through a link or anything but a plain file. */
25
- export async function writeTrustRecord(home, record) {
26
- const path = join(home, TRUST_FILE);
27
+ export async function writeTrustRecord(home, record, name = TRUST_FILE) {
28
+ const path = join(home, name);
27
29
  const stat = await lstat(path).catch(() => null);
28
30
  if (stat !== null && !stat.isFile())
29
- throw new Error(`${TRUST_FILE} isn't a plain file, so Runner won't write it.`);
31
+ throw new Error(`${name} isn't a plain file, so Runner won't write it.`);
30
32
  await mkdir(home, { recursive: true, mode: 0o700 });
31
33
  await chmod(home, 0o700);
32
34
  const temporary = `${path}.${process.pid}.tmp`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "podster",
3
- "version": "0.0.1-test.20",
3
+ "version": "0.0.1-test.21",
4
4
  "description": "Podster Runner, test pre-release for Podster staging only. Not supported. Not security-reviewed.",
5
5
  "license": "MIT",
6
6
  "repository": {