shadok-ai 0.20.26 → 0.20.28

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
@@ -1452,17 +1452,29 @@ carries a **scope**, chosen when you invite:
1452
1452
  - **restricted** (the default) — only the agents it creates on B; it can never
1453
1453
  see, resume, drive or diff B's other agents.
1454
1454
  - **member** — the invited agent acts **like a person you invite**: it sees,
1455
- drives and measures **every** agent on B, spawns more, reads its usage. It is
1456
- not an admin (no account or peer management).
1457
- - **admin** — a member that carries the admin role: it sees every group on a
1458
- multi-tenant instance, reads what only an admin reads, and may **rewrite a
1459
- profile's system prompt** from outside (`pilotctl profile-prompt "<text>"
1460
- --name <profile> --peer B`, i.e. `PUT /profiles/prompt` under its peer token —
1461
- refused to any other scope). It may also mint a role, born with no secret.
1455
+ drives and measures every agent in the groups it belongs to, spawns more,
1456
+ reads its usage. It is not an admin (no account or peer management).
1457
+ - **admin** — a member that carries the admin role: it reads what only an admin
1458
+ reads, and may **rewrite a profile's system prompt** from outside (`pilotctl
1459
+ profile-prompt "<text>" --name <profile> --peer B`, i.e. `PUT
1460
+ /profiles/prompt` under its peer token — refused to any other scope). It may
1461
+ also mint a role, born with no secret.
1462
1462
  What it still cannot do: manage accounts, invite or change peers, or edit a
1463
1463
  profile's guardrails (deny, allow, secrets, model). Those writes are
1464
1464
  browser-only, so no machine credential reaches them whatever its role.
1465
1465
 
1466
+ **No scope is a key to a Private group.** On a multi-tenant instance an invited
1467
+ agent is judged on its NAME exactly like a person, and an admin has no override
1468
+ there, so it reaches a Private group the way a person does: a member of that
1469
+ group adds it from the group's **gear ▸ members** picker, where invited agents
1470
+ appear beside the accounts, marked `agent`. Added, it is a full member — it sees
1471
+ and drives that group's agents, starts more **under the group's own Unix user**,
1472
+ and reads *and writes* the group's secrets — but it can never change the group or
1473
+ who belongs to it (every group write is browser-only). A `restricted`-scope agent
1474
+ is not offered: it has no identity of its own on B, so a membership would grant it
1475
+ nothing. And because a roster holds bare names, an account and an invited agent
1476
+ may never share one — the second of the two is refused at creation.
1477
+
1466
1478
  The narrow scope is what you get when you say nothing — including for a peer
1467
1479
  invited before scopes existed, which stays restricted until an admin widens it.
1468
1480
  A credential already in someone else's hands never widens on its own.
package/dist/peers.d.ts CHANGED
@@ -54,15 +54,23 @@ export interface Peer {
54
54
  * - `restricted` (default) — only the agents IT created (`ownedByPeer`), and
55
55
  * only `GET /diff` over HTTP. The scope a peer gets when nobody says
56
56
  * otherwise.
57
- * - `member` — everything a web MEMBER can: see and drive EVERY agent, read
58
- * `/usage` / `/live`, spawn, the lot. Not admin (no account or peer
59
- * management). "Invite an agent like a user."
60
- * - `admin` — a member that also carries the ADMIN role: it sees every
61
- * group on a multi-tenant instance, reads what only an admin reads, and
62
- * may rewrite a profile's system prompt from outside (`PUT
63
- * /profiles/prompt`). It still cannot mint or change accounts and peers,
64
- * nor touch guardrails: those writes are browser-only, so no machine
65
- * credential reaches them whatever its role.
57
+ * - `member` — everything a web MEMBER can: see and drive EVERY agent its
58
+ * GROUPS hold, read `/usage` / `/live`, spawn, the lot. Not admin (no
59
+ * account or peer management). "Invite an agent like a user."
60
+ * - `admin` — a member that also carries the ADMIN role: it reads what only
61
+ * an admin reads and may rewrite a profile's system prompt from outside
62
+ * (`PUT /profiles/prompt`). It still cannot mint or change accounts and
63
+ * peers, nor touch guardrails: those writes are browser-only, so no
64
+ * machine credential reaches them whatever its role.
65
+ *
66
+ * NEITHER of them is a key to every group. A peer authenticates under its own
67
+ * NAME (`currentAccount`), and a group's wall is `memberOf(g, name)` — with no
68
+ * admin override (operator decision 2026-11-03). So a `member`/`admin` peer
69
+ * sees the PUBLIC groups and whatever restricted group someone put its name
70
+ * into, exactly like a person. This doc used to claim `admin` "sees every
71
+ * group", and the invitation panel said so too: it never did, and an operator
72
+ * who widened a peer to admin to reach a restricted group got nothing and no
73
+ * reason why (`peerGroupCandidates`).
66
74
  * Absent on a row from before scopes existed → `restricted`, so an upgrade
67
75
  * can never widen a credential that is already out there: a peer that was
68
76
  * boxed to its own agents stays boxed until an admin WIDENS it
@@ -102,6 +110,59 @@ export type ScopeChange = {
102
110
  * socket's reach is resolved once, at connect.
103
111
  */
104
112
  export declare function setPeerScope(peers: readonly Peer[], name: string, scope: unknown): ScopeChange;
113
+ /**
114
+ * The invited agents a group's member picker may offer — the colliding and the
115
+ * powerless ones dropped.
116
+ *
117
+ * A group's roster is a list of PRINCIPAL NAMES (`Group.members`) and
118
+ * `memberOf` compares them as plain strings, so an invited agent joins a
119
+ * restricted group exactly the way a person does: by having its name in that
120
+ * list. Nothing in `src/groups.ts` needs to know peers exist. Two kinds of row
121
+ * must still be kept out of the picker:
122
+ *
123
+ * - A `restricted`-scope peer is not a principal with an identity of its own
124
+ * (`currentAccount` returns null for it — it stays the boxed caller
125
+ * `peerName` handles), so a membership would do NOTHING for it. Offering it
126
+ * would be a switch that reads as granted and grants nothing.
127
+ * - An account and a peer SHARE that namespace. A peer whose name also names an
128
+ * account is dropped rather than offered as a second tile: one roster entry
129
+ * would grant two principals and the operator could not tell which.
130
+ * `principalClashRefusal` stops new collisions at creation; this covers the
131
+ * rows an instance already has.
132
+ *
133
+ * `roster` is what the group ALREADY holds, and it overrides the scope filter:
134
+ * an agent narrowed to `restricted` after it was added must stay VISIBLE, or
135
+ * the picker would hide a member it cannot explain and the operator could never
136
+ * take it back out. It never overrides the clash filter — an ambiguous name is
137
+ * ambiguous whoever holds it.
138
+ *
139
+ * Pending rows ARE offered: an invitation not yet redeemed is a peer an
140
+ * operator is setting up, and a second trip after it enrols buys nothing — the
141
+ * name is already reserved.
142
+ */
143
+ export declare function peerGroupCandidates(peers: readonly Peer[], accountNames: readonly string[], roster?: readonly string[]): {
144
+ name: string;
145
+ scope: PeerScope;
146
+ pending: boolean;
147
+ }[];
148
+ /**
149
+ * Why `name` may not be created: the OTHER kind of principal already holds it.
150
+ * `null` = free.
151
+ *
152
+ * Accounts and invited agents are ONE namespace, because a group's roster
153
+ * stores a bare name and `memberOf` resolves it by string equality. Letting
154
+ * both spellings exist would make a membership ambiguous for good: adding
155
+ * "support" to a group would grant the person AND the machine, and revoking one
156
+ * would not revoke the other. Compared case-insensitively — `normPeerName`
157
+ * lowercases while an account name keeps its case, so "Support" and "support"
158
+ * are two spellings of one roster entry waiting to happen.
159
+ */
160
+ export declare function principalClashRefusal(input: {
161
+ name: string;
162
+ kind: "account" | "agent";
163
+ accountNames: readonly string[];
164
+ peerNames: readonly string[];
165
+ }): string | null;
105
166
  /** How long a ticket stays redeemable. Long enough to reach an agent that is
106
167
  * mid-task, short enough that a forgotten invitation is not a standing door. */
107
168
  export declare const PEER_INVITE_TTL_MS: number;
package/dist/peers.js CHANGED
@@ -34,6 +34,67 @@ export function setPeerScope(peers, name, scope) {
34
34
  return { ok: false, error: `no peer named ${name}` };
35
35
  return { ok: true, from: peerScope(row), peers: peers.map((p) => (p.name === name ? { ...p, scope } : p)) };
36
36
  }
37
+ /**
38
+ * The invited agents a group's member picker may offer — the colliding and the
39
+ * powerless ones dropped.
40
+ *
41
+ * A group's roster is a list of PRINCIPAL NAMES (`Group.members`) and
42
+ * `memberOf` compares them as plain strings, so an invited agent joins a
43
+ * restricted group exactly the way a person does: by having its name in that
44
+ * list. Nothing in `src/groups.ts` needs to know peers exist. Two kinds of row
45
+ * must still be kept out of the picker:
46
+ *
47
+ * - A `restricted`-scope peer is not a principal with an identity of its own
48
+ * (`currentAccount` returns null for it — it stays the boxed caller
49
+ * `peerName` handles), so a membership would do NOTHING for it. Offering it
50
+ * would be a switch that reads as granted and grants nothing.
51
+ * - An account and a peer SHARE that namespace. A peer whose name also names an
52
+ * account is dropped rather than offered as a second tile: one roster entry
53
+ * would grant two principals and the operator could not tell which.
54
+ * `principalClashRefusal` stops new collisions at creation; this covers the
55
+ * rows an instance already has.
56
+ *
57
+ * `roster` is what the group ALREADY holds, and it overrides the scope filter:
58
+ * an agent narrowed to `restricted` after it was added must stay VISIBLE, or
59
+ * the picker would hide a member it cannot explain and the operator could never
60
+ * take it back out. It never overrides the clash filter — an ambiguous name is
61
+ * ambiguous whoever holds it.
62
+ *
63
+ * Pending rows ARE offered: an invitation not yet redeemed is a peer an
64
+ * operator is setting up, and a second trip after it enrols buys nothing — the
65
+ * name is already reserved.
66
+ */
67
+ export function peerGroupCandidates(peers, accountNames, roster = []) {
68
+ const taken = new Set(accountNames.map((n) => n.trim().toLowerCase()));
69
+ const held = new Set(roster);
70
+ return peers
71
+ .filter((p) => !taken.has(p.name.trim().toLowerCase()))
72
+ .filter((p) => peerScope(p) !== "restricted" || held.has(p.name))
73
+ .map((p) => ({ name: p.name, scope: peerScope(p), pending: !!p.invite }));
74
+ }
75
+ /**
76
+ * Why `name` may not be created: the OTHER kind of principal already holds it.
77
+ * `null` = free.
78
+ *
79
+ * Accounts and invited agents are ONE namespace, because a group's roster
80
+ * stores a bare name and `memberOf` resolves it by string equality. Letting
81
+ * both spellings exist would make a membership ambiguous for good: adding
82
+ * "support" to a group would grant the person AND the machine, and revoking one
83
+ * would not revoke the other. Compared case-insensitively — `normPeerName`
84
+ * lowercases while an account name keeps its case, so "Support" and "support"
85
+ * are two spellings of one roster entry waiting to happen.
86
+ */
87
+ export function principalClashRefusal(input) {
88
+ const want = input.name.trim().toLowerCase();
89
+ if (!want)
90
+ return null;
91
+ const other = input.kind === "account" ? input.peerNames : input.accountNames;
92
+ const hit = other.find((n) => n.trim().toLowerCase() === want);
93
+ if (!hit)
94
+ return null;
95
+ const what = input.kind === "account" ? "an invited agent" : "an account";
96
+ return `"${hit}" is already ${what} — a person and an agent cannot share a name, or a group's roster could not tell them apart`;
97
+ }
37
98
  /** How long a ticket stays redeemable. Long enough to reach an agent that is
38
99
  * mid-task, short enough that a forgotten invitation is not a standing door. */
39
100
  export const PEER_INVITE_TTL_MS = 7 * 24 * 60 * 60_000;
@@ -259,16 +320,21 @@ export function agentInvitePrompt(opts) {
259
320
  const brief = (opts.brief ?? "").trim();
260
321
  const scope = peerScope({ scope: opts.scope });
261
322
  const member = scope !== "restricted";
323
+ // What a scope reaches stops at the GROUP wall, and neither scope crosses it:
324
+ // a cockpit's groups are reached by having your name in one, never by being
325
+ // admin (`peerGroupCandidates`). Saying "every agent, in every group" sent an
326
+ // invited agent looking for work it could not see.
327
+ const groupLine = "every agent in the groups you belong to (the cockpit's public ones, plus any Private group a member added you to)";
262
328
  const accessLine = scope === "admin"
263
- ? "You act as an ADMIN of that cockpit: you can see, drive and measure EVERY agent on it, in every group, spawn more, read its usage, and rewrite a profile's system prompt. (Accounts, peers and a profile's guardrails — deny, allow, secrets, model — are changed by a person in its web UI, never by you.)"
329
+ ? `You act as an ADMIN of that cockpit: you can see, drive and measure ${groupLine}, spawn more, read its usage, and rewrite a profile's system prompt. (Accounts, peers, group membership and a profile's guardrails — deny, allow, secrets, model — are changed by a person in its web UI, never by you.)`
264
330
  : member
265
- ? "You act as a full member of that cockpit: you can see, drive and measure EVERY agent on it, spawn more, and read its usage — everything a person you invite could. (You cannot manage its accounts or its peers — that stays with an admin.)"
331
+ ? `You act as a full member of that cockpit: you can see, drive and measure ${groupLine}, spawn more, and read its usage — everything a person you invite could. (You cannot manage its accounts, its peers or who belongs to a group — that stays with a person.)`
266
332
  : "You can only see and drive the agents you spawn there — nothing else on that cockpit.";
267
333
  const promptHint = scope === "admin"
268
334
  ? [' pilotctl profile-prompt "<text>" --name <profile> --peer host # rewrite a profile\'s system prompt']
269
335
  : [];
270
336
  const listHint = member
271
- ? " pilotctl list --peer host # every agent on the cockpit"
337
+ ? " pilotctl list --peer host # every agent you can see"
272
338
  : " # (you only see the agents you spawn; track their ids)";
273
339
  return [
274
340
  "You've been invited to collaborate with a shadok-ai cockpit as a peer agent.",
package/dist/peers.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"peers.js","sourceRoot":"","sources":["../src/peers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACvE,OAAO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GACb,mHAAmH,CAAC;IACtH,MAAM,UAAU,GACd,KAAK,KAAK,OAAO;QACf,CAAC,CAAC,uEAAuE,SAAS,0NAA0N;QAC5S,CAAC,CAAC,MAAM;YACN,CAAC,CAAC,4EAA4E,SAAS,4KAA4K;YACnQ,CAAC,CAAC,uFAAuF,CAAC;IAChG,MAAM,UAAU,GACd,KAAK,KAAK,OAAO;QACf,CAAC,CAAC,CAAC,wGAAwG,CAAC;QAC5G,CAAC,CAAC,EAAE,CAAC;IACT,MAAM,QAAQ,GAAG,MAAM;QACrB,CAAC,CAAC,6EAA6E;QAC/E,CAAC,CAAC,0DAA0D,CAAC;IAC/D,OAAO;QACL,8EAA8E;QAC9E,EAAE;QACF,YAAY,GAAG,EAAE;QACjB,2BAA2B,IAAI,CAAC,MAAM,EAAE;QACxC,+EAA+E;QAC/E,+EAA+E;QAC/E,oDAAoD;QACpD,EAAE;QACF,qDAAqD;QACrD,4BAA4B,GAAG,IAAI,IAAI,CAAC,MAAM,EAAE;QAChD,oFAAoF;QACpF,+DAA+D;QAC/D,2EAA2E;QAC3E,QAAQ;QACR,GAAG,UAAU;QACb,EAAE;QACF,UAAU;QACV,EAAE;QACF,KAAK,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,2EAA2E;QACnG,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QAC7B,EAAE;QACF,mFAAmF;KACpF,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC"}
package/dist/server.js CHANGED
@@ -82,7 +82,7 @@ import { runPrivileged, TREE_OP_TIMEOUT_MS } from "./privileged.js";
82
82
  import { HOME_SKILLS_BASE, missingHomeSkillLinks, rewriteSkillsBase } from "./skill-paths.js";
83
83
  import { instanceKey } from "./paths.js";
84
84
  import { prefsFor, savePrefsFor } from "./user-prefs.js";
85
- import { peerFileFor, loadPeers, savePeers, peerFromToken, signPeerToken, newPeer, withSalts, redeemVerdict, redeemPeer, normPeerName, removePeer, ownedByPeer, peersOutFileFor, tierPeersOutSeed, agentInvitePrompt, peerScope, setPeerScope, } from "./peers.js";
85
+ import { peerFileFor, loadPeers, savePeers, peerFromToken, signPeerToken, newPeer, withSalts, redeemVerdict, redeemPeer, normPeerName, removePeer, ownedByPeer, peersOutFileFor, tierPeersOutSeed, agentInvitePrompt, peerScope, setPeerScope, peerGroupCandidates, principalClashRefusal, } from "./peers.js";
86
86
  import { loadCrons, saveCrons, upsertCron, removeCron, resolveCronId, nextRunFor, nextRunAfterFailure, isTransient, CRON_MAX_RETRIES, markCronPrompt, isCronPrompt, normalizeSchedule, parseDays, onceAt, stateAfterFire, scheduleLabel, cronTimeZone, defaultTimeZone, systemTimeZone, isValidTimeZone, } from "./crons.js";
87
87
  import { loadWebhooks, saveWebhooks, upsertWebhook, removeWebhook, recordWebhookRun, publicWebhook, newWebhookToken, hashWebhookToken, presentedToken, callVerdict, payloadText, webhookPrompt, isWebhookPrompt, } from "./webhooks.js";
88
88
  import { splitBySession, triggerCount, triggerSummary } from "./channel-triggers.js";
@@ -6364,14 +6364,47 @@ app.get("/users", (req, res) => {
6364
6364
  // The roster a member-picker needs: NAMES ONLY. `GET /users` is admin-only and
6365
6365
  // carries role/pending/passkeys; a group's members must be choosable by anyone
6366
6366
  // who can see the group, so this exposes the one field that is not sensitive.
6367
- app.get("/accounts", (req, res) => {
6368
- if (!currentAccount(req))
6369
- return res.status(401).json({ error: "sign in first" });
6367
+ /** The account names a member picker offers: the stored rows, plus the
6368
+ * bootstrap admin, which is the password itself rather than a row. ONE helper
6369
+ * so the picker's two halves (`/accounts` and `/peers/names`) judge the same
6370
+ * namespace — an invited agent is hidden from the picker exactly when an
6371
+ * account holds its name (`peerGroupCandidates`). */
6372
+ function pickerAccountNames() {
6370
6373
  const names = loadAccounts().map((a) => a.name);
6371
- // The bootstrap admin is the password itself, not a stored account.
6372
6374
  if (GUI_PASSWORD && !names.includes(BOOTSTRAP_ADMIN))
6373
6375
  names.unshift(BOOTSTRAP_ADMIN);
6374
- res.json(names);
6376
+ return names;
6377
+ }
6378
+ app.get("/accounts", (req, res) => {
6379
+ if (!currentAccount(req))
6380
+ return res.status(401).json({ error: "sign in first" });
6381
+ res.json(pickerAccountNames());
6382
+ });
6383
+ /**
6384
+ * The INVITED AGENTS a group's member picker may offer (`peerGroupCandidates`)
6385
+ * — name, scope, and whether the invitation is still pending.
6386
+ *
6387
+ * A group's roster is a list of principal NAMES, and an invited agent joins a
6388
+ * restricted group by being in it, exactly like a person; this is the other half
6389
+ * of the picker's list. Same gate as `/accounts`, deliberately: managing a
6390
+ * roster is member-only, not admin-only (operator decision 2026-11-03), so
6391
+ * gating this on `admin` would show the people half and hide the agent half
6392
+ * from precisely the members who do the managing. It carries no ticket, no
6393
+ * token and no note — only names, which `/accounts` already exposes for people.
6394
+ *
6395
+ * `?group=<id>` names the roster being edited, so an agent the group ALREADY
6396
+ * holds stays listed even if its scope was narrowed afterwards. The roster is
6397
+ * read from the SERVER's group list, never from the client — a caller that
6398
+ * could name its own roster could make a hidden row appear.
6399
+ */
6400
+ app.get("/peers/names", (req, res) => {
6401
+ const viewer = viewerFor(currentAccount(req));
6402
+ if (!viewer)
6403
+ return res.status(401).json({ error: "sign in first" });
6404
+ const wanted = String(req.query.group ?? "").trim();
6405
+ const g = wanted ? loadGroups().find((x) => x.id === wanted) : null;
6406
+ const roster = g && canSeeGroup(g, viewer) ? g.members : [];
6407
+ res.json(peerGroupCandidates(loadPeers(peerFileFor()), pickerAccountNames(), roster));
6375
6408
  });
6376
6409
  // Create AND issue the invitation in one step: an account with no way in is a
6377
6410
  // dead row, and two calls would let one succeed without the other.
@@ -6390,6 +6423,17 @@ app.post("/users", async (req, res) => {
6390
6423
  });
6391
6424
  if (!v.ok)
6392
6425
  return res.status(me?.role === "admin" ? 400 : 403).json({ error: v.error });
6426
+ // Accounts and invited agents are ONE namespace: a group's roster stores a
6427
+ // bare name (`principalClashRefusal`). Refused before the invitation is
6428
+ // minted, so a clash never leaves a half-created account behind.
6429
+ const clash = principalClashRefusal({
6430
+ name,
6431
+ kind: "account",
6432
+ accountNames: list.map((a) => a.name),
6433
+ peerNames: loadPeers(peerFileFor()).map((p) => p.name),
6434
+ });
6435
+ if (clash)
6436
+ return res.status(409).json({ error: clash });
6393
6437
  if (!(await stepUpIfTwoFactor(req, res, me)))
6394
6438
  return;
6395
6439
  const invite = newInvite(Date.now());
@@ -6996,6 +7040,17 @@ app.post("/peers", (req, res) => {
6996
7040
  // `admin` follows the same rule: the exact string, or nothing.
6997
7041
  const scope = peerScope({ scope: req.body?.scope });
6998
7042
  const file = peerFileFor();
7043
+ // The other half of the shared namespace (`principalClashRefusal`). Only an
7044
+ // ACCOUNT's name is a clash: re-inviting an existing peer name is the
7045
+ // supersede-and-rotate path, which `addPeer` handles on purpose.
7046
+ const clash = principalClashRefusal({
7047
+ name,
7048
+ kind: "agent",
7049
+ accountNames: pickerAccountNames(),
7050
+ peerNames: loadPeers(file).map((p) => p.name),
7051
+ });
7052
+ if (clash)
7053
+ return res.status(409).json({ error: clash });
6999
7054
  const { peers, ticket } = newPeer(loadPeers(file), name, Date.now(), note, scope);
7000
7055
  savePeers(file, peers);
7001
7056
  console.log(`peers: ${me.name} invited peer ${name} (${scope})`);