shadok-ai 0.17.56 → 0.17.58

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
@@ -82,7 +82,9 @@ Enter to skip; you can add it later from the web UI).
82
82
  agent is a round avatar with a presence dot (green ready, red working, hollow
83
83
  offline). A group's icon opens the icon picker: choose from the grid, type any
84
84
  emoji, or **type a word** (`rocket`, `bug`, `money`…) to search for one; its
85
- **+** creates the new agent straight into that group. Dragging an agent onto a
85
+ **+** creates the new agent straight into that group — while it is being
86
+ born its pane shows the pumping Shadok and the real startup steps ticking off
87
+ (access to Claude, workspace, Claude Code) rather than a black screen. Dragging an agent onto a
86
88
  group files it there, dragging groups reorders them, and double-clicking a name
87
89
  renames it — a group can also be renamed by clicking its name at the top of the
88
90
  agents column. A question the agent asks shows as an *Approval requested* card. The
@@ -418,8 +420,9 @@ Enter to skip; you can add it later from the web UI).
418
420
  a brand-new instance (which is signed out at boot, so there is nothing to
419
421
  spawn yet). The condition is "no channel", which makes it idempotent: it never
420
422
  appears twice.
421
- While it is being started the central panel says so — *starting your first
422
- agent…* — instead of the *no agent open* invitation, which would ask you to
423
+ While it is being started the central panel says so — *your first agent is
424
+ waking up…*, with the real steps ticking off (access to Claude, workspace,
425
+ Claude Code) — instead of the *no agent open* invitation, which would ask you to
423
426
  create a second one while the first is being born. It is a status, not a
424
427
  screen: nothing to click, nothing to dismiss, and it ends on its own whichever
425
428
  way the spawn goes (started, refused because the instance is signed out,
@@ -1,4 +1,5 @@
1
1
  import type { Connected } from "./connect-gate.js";
2
+ import { type SpawnStep } from "./spawn-steps.js";
2
3
  /**
3
4
  * The lead agent an instance starts life with.
4
5
  *
@@ -79,6 +80,10 @@ export interface FirstAgentStatus {
79
80
  pending: boolean;
80
81
  /** Why — the plan's reason once one has been computed, before that "starting". */
81
82
  reason: FirstAgentPlan["reason"] | "starting" | "idle";
83
+ /** The spawn step the server last announced (src/spawn-steps.ts), so the
84
+ * page's "starting" panel shows the same real progress as a tab's loader.
85
+ * Null before the first one and whenever nothing is pending. */
86
+ step: SpawnStep | null;
82
87
  }
83
88
  /** A copy, so no caller can hold a handle on the state and edit it. */
84
89
  export declare function firstAgentStatus(): FirstAgentStatus;
@@ -95,6 +100,10 @@ export declare function firstAgentStatus(): FirstAgentStatus;
95
100
  * pending by definition.
96
101
  */
97
102
  export declare function announceFirstAgent(channelCount: number): void;
103
+ /** Record the step the lead's spawn has reached. Ignored once the wait is over
104
+ * (a late message must not put a step back on a settled status) and for
105
+ * anything that is not a known step. */
106
+ export declare function noteFirstAgentStep(step: unknown): void;
98
107
  /** The one way out of `pending`. Never conditional: every reason ends the wait. */
99
108
  export declare function settleFirstAgent(reason: FirstAgentPlan["reason"]): void;
100
109
  /**
@@ -2,6 +2,7 @@ import { MAIN_GROUP_ID } from "./groups.js";
2
2
  import WebSocket from "ws";
3
3
  import { loadChannels } from "./channels.js";
4
4
  import { BOSS_PROFILE_NAME } from "./profiles.js";
5
+ import { isSpawnStep } from "./spawn-steps.js";
5
6
  /**
6
7
  * The lead agent an instance starts life with.
7
8
  *
@@ -50,7 +51,7 @@ export function firstAgentPlan(input) {
50
51
  return { spawn: false, reason: "not-signed-in" };
51
52
  return { spawn: true, reason: "first-boot", name: FIRST_AGENT_NAME, profile: BOSS_PROFILE_NAME };
52
53
  }
53
- let status = { pending: false, reason: "idle" };
54
+ let status = { pending: false, reason: "idle", step: null };
54
55
  /** A copy, so no caller can hold a handle on the state and edit it. */
55
56
  export function firstAgentStatus() {
56
57
  return { ...status };
@@ -70,12 +71,20 @@ export function firstAgentStatus() {
70
71
  export function announceFirstAgent(channelCount) {
71
72
  status =
72
73
  channelCount > 0
73
- ? { pending: false, reason: "channels-exist" }
74
- : { pending: true, reason: "starting" };
74
+ ? { pending: false, reason: "channels-exist", step: null }
75
+ : { pending: true, reason: "starting", step: null };
76
+ }
77
+ /** Record the step the lead's spawn has reached. Ignored once the wait is over
78
+ * (a late message must not put a step back on a settled status) and for
79
+ * anything that is not a known step. */
80
+ export function noteFirstAgentStep(step) {
81
+ if (!status.pending || !isSpawnStep(step))
82
+ return;
83
+ status = { ...status, step };
75
84
  }
76
85
  /** The one way out of `pending`. Never conditional: every reason ends the wait. */
77
86
  export function settleFirstAgent(reason) {
78
- status = { pending: false, reason };
87
+ status = { pending: false, reason, step: null };
79
88
  }
80
89
  /** Guards the two callers (boot, sign-in) against firing at the same moment. */
81
90
  let inFlight = false;
@@ -136,7 +145,10 @@ export async function ensureFirstAgent(deps) {
136
145
  catch {
137
146
  return;
138
147
  }
139
- if (m.type === "ready" && m.sessionId) {
148
+ if (m.type === "starting") {
149
+ noteFirstAgentStep(m.step);
150
+ }
151
+ else if (m.type === "ready" && m.sessionId) {
140
152
  deps.onReady(m.sessionId, plan.name);
141
153
  finish();
142
154
  }
@@ -1 +1 @@
1
- {"version":3,"file":"first-agent.js","sourceRoot":"","sources":["../src/first-agent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,SAAS,MAAM,IAAI,CAAC;AAC3B,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAE7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAElD;;;;;;;;;;;GAWG;AAEH,uDAAuD;AACvD;oFACoF;AACpF,MAAM,UAAU,iBAAiB,CAAC,QAAkD;IAClF,OAAO,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,IAAI,IAAI,IAAI,CAAC,CAAC,KAAK,KAAK,aAAa,CAAC,CAAC,MAAM,CAAC;AACrF,CAAC;AAED,MAAM,CAAC,MAAM,gBAAgB,GAAG,SAAS,CAAC;AAE1C;;;;;;;GAOG;AACH,MAAM,UAAU,sBAAsB,CAAC,GAAW,EAAE,OAA2B;IAC7E,OAAO,EAAE,IAAI,EAAE,OAAgB,EAAE,GAAG,EAAE,OAAO,EAA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AAC;oBACrD,MAAM,EAAE,CAAC;gBACX,CAAC;YACH,CAAC,CAAC,CAAC;YACH,EAAE,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;YACvB,EAAE,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QACzB,CAAC,CAAC,CAAC;IACL,CAAC;YAAS,CAAC;QACT,QAAQ,GAAG,KAAK,CAAC;QACjB,0EAA0E;QAC1E,0EAA0E;QAC1E,4EAA4E;QAC5E,4EAA4E;QAC5E,gBAAgB,CAAC,YAAY,CAAC,CAAC;IACjC,CAAC;IACD,OAAO,YAAY,CAAC;AACtB,CAAC"}
@@ -0,0 +1,59 @@
1
+ import { type ExecFileSyncOptionsWithStringEncoding } from "node:child_process";
2
+ /**
3
+ * Running git from the SERVER on a repository someone else owns.
4
+ *
5
+ * Under multi-tenant the server is root and the checkouts it manages belong to
6
+ * the drop users: the Tweak self-clone is chowned to `main`, an agent's worktree
7
+ * to its group user. git (≥ 2.35.2) refuses to operate in a repository owned by
8
+ * another user — "detected dubious ownership" — so the second click on *Tweak
9
+ * Shadok-AI* failed on the refresh of a clone the first click had created, and
10
+ * `isGitRepo` quietly answered `false` for the same directory (no worktree).
11
+ *
12
+ * The tempting fix is `-c safe.directory=<dir>`, and it is the wrong one. That
13
+ * check exists precisely so root never runs configuration planted by another
14
+ * user: a repo's `.git/config` can name `core.fsmonitor`, `core.sshCommand`, a
15
+ * checkout filter or a hook, each of which git EXECUTES. The directory is
16
+ * writable by an agent, so whitelisting it would hand any agent (or a prompt
17
+ * injection driving one) a command run as root — across the very wall the
18
+ * isolation builds. Instead the command is re-run AS THE REPO'S OWNER, which is
19
+ * what git's refusal is asking for: it then executes nothing its owner could not
20
+ * already execute.
21
+ *
22
+ * It is a FALLBACK on that one refusal, never the first attempt, so every
23
+ * invocation that works today — mono-tenant, a root-owned repo, a non-root
24
+ * server, an image that whitelists its workspace — runs exactly as before.
25
+ */
26
+ /** Pure: is this a git "dubious ownership" refusal? */
27
+ export declare function isDubiousOwnership(e: unknown): boolean;
28
+ export interface Owner {
29
+ uid: number;
30
+ gid: number;
31
+ name: string | null;
32
+ home: string | null;
33
+ }
34
+ /** Pure: the passwd row for `uid` (name + home), or nulls when absent. */
35
+ export declare function passwdEntry(passwd: string, uid: number): {
36
+ name: string | null;
37
+ home: string | null;
38
+ };
39
+ /**
40
+ * Pure: the `setpriv` argv + env that run `git -C cwd …args` as `owner`. Numeric
41
+ * ids so a uid with no passwd row still works; `--init-groups` only when there is
42
+ * a name to read the groups of, else `--clear-groups` (never root's groups).
43
+ * HOME is the owner's: git reads `$HOME/.gitconfig`, and root's 0700 home is
44
+ * unreadable to them. With no home known, HOME points at the repo itself rather
45
+ * than staying `/root`.
46
+ */
47
+ export declare function ownerGitCommand(owner: Owner, cwd: string, args: readonly string[]): {
48
+ cmd: string;
49
+ argv: string[];
50
+ env: Record<string, string>;
51
+ };
52
+ /** Who owns `dir`, when the server is root and that is someone else; else null. */
53
+ export declare function foreignOwner(dir: string): Owner | null;
54
+ /**
55
+ * `git -C cwd …args`, retried as the repository's owner when git refuses it for
56
+ * dubious ownership (see above). Same return and throw contract as the plain
57
+ * `execFileSync` it replaces.
58
+ */
59
+ export declare function gitIn(cwd: string, args: readonly string[], opts?: Omit<ExecFileSyncOptionsWithStringEncoding, "encoding">): string;
@@ -0,0 +1,101 @@
1
+ import { execFileSync } from "node:child_process";
2
+ import fs from "node:fs";
3
+ /**
4
+ * Running git from the SERVER on a repository someone else owns.
5
+ *
6
+ * Under multi-tenant the server is root and the checkouts it manages belong to
7
+ * the drop users: the Tweak self-clone is chowned to `main`, an agent's worktree
8
+ * to its group user. git (≥ 2.35.2) refuses to operate in a repository owned by
9
+ * another user — "detected dubious ownership" — so the second click on *Tweak
10
+ * Shadok-AI* failed on the refresh of a clone the first click had created, and
11
+ * `isGitRepo` quietly answered `false` for the same directory (no worktree).
12
+ *
13
+ * The tempting fix is `-c safe.directory=<dir>`, and it is the wrong one. That
14
+ * check exists precisely so root never runs configuration planted by another
15
+ * user: a repo's `.git/config` can name `core.fsmonitor`, `core.sshCommand`, a
16
+ * checkout filter or a hook, each of which git EXECUTES. The directory is
17
+ * writable by an agent, so whitelisting it would hand any agent (or a prompt
18
+ * injection driving one) a command run as root — across the very wall the
19
+ * isolation builds. Instead the command is re-run AS THE REPO'S OWNER, which is
20
+ * what git's refusal is asking for: it then executes nothing its owner could not
21
+ * already execute.
22
+ *
23
+ * It is a FALLBACK on that one refusal, never the first attempt, so every
24
+ * invocation that works today — mono-tenant, a root-owned repo, a non-root
25
+ * server, an image that whitelists its workspace — runs exactly as before.
26
+ */
27
+ /** Pure: is this a git "dubious ownership" refusal? */
28
+ export function isDubiousOwnership(e) {
29
+ const err = e;
30
+ return /detected dubious ownership/i.test(String(err?.stderr ?? ""));
31
+ }
32
+ /** Pure: the passwd row for `uid` (name + home), or nulls when absent. */
33
+ export function passwdEntry(passwd, uid) {
34
+ for (const line of passwd.split("\n")) {
35
+ const f = line.split(":");
36
+ if (f.length >= 6 && Number(f[2]) === uid && f[2] !== "")
37
+ return { name: f[0] || null, home: f[5] || null };
38
+ }
39
+ return { name: null, home: null };
40
+ }
41
+ /**
42
+ * Pure: the `setpriv` argv + env that run `git -C cwd …args` as `owner`. Numeric
43
+ * ids so a uid with no passwd row still works; `--init-groups` only when there is
44
+ * a name to read the groups of, else `--clear-groups` (never root's groups).
45
+ * HOME is the owner's: git reads `$HOME/.gitconfig`, and root's 0700 home is
46
+ * unreadable to them. With no home known, HOME points at the repo itself rather
47
+ * than staying `/root`.
48
+ */
49
+ export function ownerGitCommand(owner, cwd, args) {
50
+ const groups = owner.name ? ["--init-groups"] : ["--clear-groups"];
51
+ const env = { HOME: owner.home ?? cwd };
52
+ if (owner.name)
53
+ Object.assign(env, { USER: owner.name, LOGNAME: owner.name });
54
+ return {
55
+ cmd: "setpriv",
56
+ argv: ["--reuid", String(owner.uid), "--regid", String(owner.gid), ...groups, "--", "git", "-C", cwd, ...args],
57
+ env,
58
+ };
59
+ }
60
+ /** Who owns `dir`, when the server is root and that is someone else; else null. */
61
+ export function foreignOwner(dir) {
62
+ if (typeof process.getuid !== "function" || process.getuid() !== 0)
63
+ return null;
64
+ let st;
65
+ try {
66
+ st = fs.statSync(dir);
67
+ }
68
+ catch {
69
+ return null;
70
+ }
71
+ if (st.uid === 0)
72
+ return null;
73
+ let passwd = "";
74
+ try {
75
+ passwd = fs.readFileSync("/etc/passwd", "utf8");
76
+ }
77
+ catch {
78
+ /* no passwd: numeric ids only */
79
+ }
80
+ return { uid: st.uid, gid: st.gid, ...passwdEntry(passwd, st.uid) };
81
+ }
82
+ /**
83
+ * `git -C cwd …args`, retried as the repository's owner when git refuses it for
84
+ * dubious ownership (see above). Same return and throw contract as the plain
85
+ * `execFileSync` it replaces.
86
+ */
87
+ export function gitIn(cwd, args, opts = {}) {
88
+ try {
89
+ return execFileSync("git", ["-C", cwd, ...args], { ...opts, encoding: "utf8" });
90
+ }
91
+ catch (e) {
92
+ if (!isDubiousOwnership(e))
93
+ throw e;
94
+ const owner = foreignOwner(cwd);
95
+ if (!owner)
96
+ throw e;
97
+ const run = ownerGitCommand(owner, cwd, args);
98
+ return execFileSync(run.cmd, run.argv, { ...opts, encoding: "utf8", env: { ...process.env, ...run.env } });
99
+ }
100
+ }
101
+ //# sourceMappingURL=git-exec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"git-exec.js","sourceRoot":"","sources":["../src/git-exec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAA8C,MAAM,oBAAoB,CAAC;AAC9F,OAAO,EAAE,MAAM,SAAS,CAAC;AAEzB;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,uDAAuD;AACvD,MAAM,UAAU,kBAAkB,CAAC,CAAU;IAC3C,MAAM,GAAG,GAAG,CAAwC,CAAC;IACrD,OAAO,6BAA6B,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,EAAE,MAAM,IAAI,EAAE,C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AAM,KAAK,GAAG,YAAY,CAAC,GAAG,CAAC,CAAC;QAChC,IAAI,CAAC,KAAK;YAAE,MAAM,CAAC,CAAC;QACpB,MAAM,GAAG,GAAG,eAAe,CAAC,KAAK,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC;QAC9C,OAAO,YAAY,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,IAAI,EAAE,EAAE,GAAG,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,EAAE,GAAG,OAAO,CAAC,GAAG,EAAE,GAAG,GAAG,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;IAC7G,CAAC;AACH,CAAC"}
package/dist/selfrepo.js CHANGED
@@ -2,6 +2,7 @@ import { execFileSync } from "node:child_process";
2
2
  import fs from "node:fs";
3
3
  import os from "node:os";
4
4
  import path from "node:path";
5
+ import { gitIn } from "./git-exec.js";
5
6
  /**
6
7
  * A working copy of shadok-ai's own source, so a user who installed the cockpit
7
8
  * with `npx shadok-ai` — no clone, no rights on the repo — can still have an
@@ -43,12 +44,20 @@ export function gitFailReason(e) {
43
44
  return line ? line.slice(0, 120) : "git failed";
44
45
  }
45
46
  function git(args, cwd) {
46
- execFileSync("git", cwd ? ["-C", cwd, ...args] : args, {
47
- encoding: "utf8",
47
+ const opts = {
48
48
  // A cold clone over a slow link is minutes, not seconds.
49
49
  timeout: 180_000,
50
50
  stdio: ["ignore", "pipe", "pipe"],
51
- });
51
+ };
52
+ // An existing clone is chowned to the commons drop user under multi-tenant, so
53
+ // the refresh goes through `gitIn`, which re-runs it as that owner when git
54
+ // refuses root for "dubious ownership" (src/git-exec.ts) — never by
55
+ // whitelisting the directory, which would let an agent's `.git/config` run
56
+ // commands as root.
57
+ if (cwd)
58
+ gitIn(cwd, args, opts);
59
+ else
60
+ execFileSync("git", args, { ...opts, encoding: "utf8" });
52
61
  }
53
62
  /**
54
63
  * Makes sure the source checkout exists and its `main` matches the remote, so a
@@ -1 +1 @@
1
- {"version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,EAAE,GAAG,CAAC,CAAC;YACzC,GAAG,CAAC,CAAC,UAAU,EAAE,MAAM,CAAC,EAAE,GAAG,CAAC,CAAC;YAC/B,wEAAwE;YACxE,6DAA6D;YAC7D,GAAG,CAAC,CAAC,OAAO,EAAE,QAAQ,EAAE,aAAa,CAAC,EAAE,GAAG,CAAC,CAAC;QAC/C,CAAC;aAAM,CAAC;YACN,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;YACrD,GAAG,CAAC,CAAC,OAAO,EAAE,aAAa,EAAE,GAAG,CAAC,CAAC,CAAC;QACrC,CAAC;QACD,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC;IACtB,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,OAAO,EAAE,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC,EAAE,CAAC;IACrC,CAAC;AACH,CAAC"}
package/dist/server.js CHANGED
@@ -7936,6 +7936,16 @@ wss.on("connection", (ws, req) => {
7936
7936
  // Install the `claude` CLI first if it's missing: otherwise the auth
7937
7937
  // probe below (it runs `claude auth status`) can't run and reads as
7938
7938
  // "unknown", and the spawn itself would throw "posix_spawnp failed".
7939
+ // A FRESH spawn tells its client where it is (public/spawn-steps.js
7940
+ // draws the loader from it), each step just BEFORE the work it names.
7941
+ // A resume shows its history instead, so it announces nothing.
7942
+ const freshSpawn = !msg.resume && !msg.continue;
7943
+ const announceStep = (step) => {
7944
+ if (!freshSpawn)
7945
+ return;
7946
+ send({ type: "starting", step });
7947
+ };
7948
+ announceStep("connect");
7939
7949
  const claude = await ensureClaudeOnce();
7940
7950
  if (!claude.ok)
7941
7951
  return fail(claude.error);
@@ -8088,6 +8098,7 @@ wss.on("connection", (ws, req) => {
8088
8098
  if (early)
8089
8099
  return fail(early.message, early.code, early.user);
8090
8100
  }
8101
+ announceStep("workspace");
8091
8102
  if (msg.worktree && !resumed && isGitRepo(cwd)) {
8092
8103
  try {
8093
8104
  // Create the checkout under the DROP USER's own home (not the
@@ -8310,6 +8321,7 @@ wss.on("connection", (ws, req) => {
8310
8321
  // assigned, else the one the client created it in.
8311
8322
  pendingCtx.set(id, { group: agentGroupId ?? requestedGroupId, createdBy: initialCreatedBy ?? null });
8312
8323
  }
8324
+ announceStep("claude");
8313
8325
  session = await createSession(id, effectiveCwd, args, worktree, profile, model, effort, spawnActor({ account: me?.name, origin, peer: callerPeer, parent: parentAtStart, agent: callerAgent?.name }), dropUser, agentGroupId);
8314
8326
  // One Live per agent (shared-ledger [5d8d]). We only reach here when
8315
8327
  // there was no live session to attach to — but `existing` may be a