@botcord/daemon 0.2.2 → 0.2.3
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/dist/gateway/runtimes/claude-code.js +6 -0
- package/dist/index.js +20 -12
- package/package.json +1 -1
- package/src/gateway/runtimes/claude-code.ts +6 -0
- package/src/index.ts +21 -12
|
@@ -76,6 +76,12 @@ export class ClaudeCodeAdapter extends NdjsonStreamAdapter {
|
|
|
76
76
|
}
|
|
77
77
|
buildArgs(opts) {
|
|
78
78
|
const args = ["-p", opts.text, "--output-format", "stream-json", "--verbose"];
|
|
79
|
+
// Headless `-p` mode does not load project `.claude/` by default, so
|
|
80
|
+
// per-agent skills seeded at `<workspace>/.claude/skills/` are invisible
|
|
81
|
+
// unless we opt in. `extraArgs` wins so operators can still override.
|
|
82
|
+
if (!opts.extraArgs?.some((a) => a.startsWith("--setting-sources"))) {
|
|
83
|
+
args.push("--setting-sources", "project");
|
|
84
|
+
}
|
|
79
85
|
if (opts.sessionId) {
|
|
80
86
|
if (!isValidClaudeSessionId(opts.sessionId))
|
|
81
87
|
throw new Error(invalidClaudeSessionIdError());
|
package/dist/index.js
CHANGED
|
@@ -34,15 +34,18 @@ Commands:
|
|
|
34
34
|
Without --agent, the daemon discovers
|
|
35
35
|
identities from ~/.botcord/credentials
|
|
36
36
|
at startup (repeat --agent to pin).
|
|
37
|
-
start [--
|
|
38
|
-
Start the daemon
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
37
|
+
start [--background|-d] [--relogin] [--hub <url>] [--label <name>]
|
|
38
|
+
Start the daemon in the foreground by
|
|
39
|
+
default. Pass --background (alias -d)
|
|
40
|
+
to detach and return to the shell.
|
|
41
|
+
Without credentials and on a TTY, runs
|
|
42
|
+
the interactive device-code login
|
|
43
|
+
first. --hub defaults to ${DEFAULT_HUB}
|
|
44
|
+
(or the URL stored in a previous
|
|
45
|
+
login). --relogin forces re-login.
|
|
46
|
+
--label is sent to the Hub on connect
|
|
47
|
+
for the dashboard device list
|
|
48
|
+
(defaults to hostname). Non-TTY
|
|
46
49
|
environments must mount a pre-existing
|
|
47
50
|
user-auth.json (plan §6.4).
|
|
48
51
|
stop Stop the running daemon (SIGTERM)
|
|
@@ -79,6 +82,8 @@ Env:
|
|
|
79
82
|
/** Known boolean flags — never consume the following token as a value. */
|
|
80
83
|
const BOOLEAN_FLAGS = new Set([
|
|
81
84
|
"foreground",
|
|
85
|
+
"background",
|
|
86
|
+
"d",
|
|
82
87
|
"f",
|
|
83
88
|
"follow",
|
|
84
89
|
"json",
|
|
@@ -285,9 +290,12 @@ async function ensureUserAuthForStart(args) {
|
|
|
285
290
|
}
|
|
286
291
|
async function cmdStart(args) {
|
|
287
292
|
const cfg = loadConfig();
|
|
288
|
-
|
|
293
|
+
// Foreground is now the default. --background (alias -d) detaches.
|
|
294
|
+
// --foreground is still accepted (no-op) for backwards compatibility and
|
|
295
|
+
// is also what the detached child re-execs itself with.
|
|
296
|
+
const background = args.flags.background === true || args.flags.d === true;
|
|
289
297
|
log.info("cmd start", {
|
|
290
|
-
|
|
298
|
+
background,
|
|
291
299
|
relogin: args.flags.relogin === true,
|
|
292
300
|
child: process.env.BOTCORD_DAEMON_CHILD === "1",
|
|
293
301
|
});
|
|
@@ -304,7 +312,7 @@ async function cmdStart(args) {
|
|
|
304
312
|
if (process.env.BOTCORD_DAEMON_CHILD !== "1") {
|
|
305
313
|
await ensureUserAuthForStart(args);
|
|
306
314
|
}
|
|
307
|
-
if (
|
|
315
|
+
if (background) {
|
|
308
316
|
// Detached child re-exec in foreground mode. The child writes the PID
|
|
309
317
|
// file once it's up; the parent only polls to confirm startup so the
|
|
310
318
|
// two never race on the same file.
|
package/package.json
CHANGED
|
@@ -96,6 +96,12 @@ export class ClaudeCodeAdapter extends NdjsonStreamAdapter {
|
|
|
96
96
|
|
|
97
97
|
protected buildArgs(opts: RuntimeRunOptions): string[] {
|
|
98
98
|
const args = ["-p", opts.text, "--output-format", "stream-json", "--verbose"];
|
|
99
|
+
// Headless `-p` mode does not load project `.claude/` by default, so
|
|
100
|
+
// per-agent skills seeded at `<workspace>/.claude/skills/` are invisible
|
|
101
|
+
// unless we opt in. `extraArgs` wins so operators can still override.
|
|
102
|
+
if (!opts.extraArgs?.some((a) => a.startsWith("--setting-sources"))) {
|
|
103
|
+
args.push("--setting-sources", "project");
|
|
104
|
+
}
|
|
99
105
|
if (opts.sessionId) {
|
|
100
106
|
if (!isValidClaudeSessionId(opts.sessionId)) throw new Error(invalidClaudeSessionIdError());
|
|
101
107
|
args.push("--resume", opts.sessionId);
|
package/src/index.ts
CHANGED
|
@@ -74,15 +74,18 @@ Commands:
|
|
|
74
74
|
Without --agent, the daemon discovers
|
|
75
75
|
identities from ~/.botcord/credentials
|
|
76
76
|
at startup (repeat --agent to pin).
|
|
77
|
-
start [--
|
|
78
|
-
Start the daemon
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
77
|
+
start [--background|-d] [--relogin] [--hub <url>] [--label <name>]
|
|
78
|
+
Start the daemon in the foreground by
|
|
79
|
+
default. Pass --background (alias -d)
|
|
80
|
+
to detach and return to the shell.
|
|
81
|
+
Without credentials and on a TTY, runs
|
|
82
|
+
the interactive device-code login
|
|
83
|
+
first. --hub defaults to ${DEFAULT_HUB}
|
|
84
|
+
(or the URL stored in a previous
|
|
85
|
+
login). --relogin forces re-login.
|
|
86
|
+
--label is sent to the Hub on connect
|
|
87
|
+
for the dashboard device list
|
|
88
|
+
(defaults to hostname). Non-TTY
|
|
86
89
|
environments must mount a pre-existing
|
|
87
90
|
user-auth.json (plan §6.4).
|
|
88
91
|
stop Stop the running daemon (SIGTERM)
|
|
@@ -128,6 +131,8 @@ interface ParsedArgs {
|
|
|
128
131
|
/** Known boolean flags — never consume the following token as a value. */
|
|
129
132
|
const BOOLEAN_FLAGS = new Set([
|
|
130
133
|
"foreground",
|
|
134
|
+
"background",
|
|
135
|
+
"d",
|
|
131
136
|
"f",
|
|
132
137
|
"follow",
|
|
133
138
|
"json",
|
|
@@ -363,9 +368,13 @@ async function ensureUserAuthForStart(args: ParsedArgs): Promise<UserAuthRecord
|
|
|
363
368
|
|
|
364
369
|
async function cmdStart(args: ParsedArgs): Promise<void> {
|
|
365
370
|
const cfg = loadConfig();
|
|
366
|
-
|
|
371
|
+
// Foreground is now the default. --background (alias -d) detaches.
|
|
372
|
+
// --foreground is still accepted (no-op) for backwards compatibility and
|
|
373
|
+
// is also what the detached child re-execs itself with.
|
|
374
|
+
const background =
|
|
375
|
+
args.flags.background === true || args.flags.d === true;
|
|
367
376
|
log.info("cmd start", {
|
|
368
|
-
|
|
377
|
+
background,
|
|
369
378
|
relogin: args.flags.relogin === true,
|
|
370
379
|
child: process.env.BOTCORD_DAEMON_CHILD === "1",
|
|
371
380
|
});
|
|
@@ -385,7 +394,7 @@ async function cmdStart(args: ParsedArgs): Promise<void> {
|
|
|
385
394
|
await ensureUserAuthForStart(args);
|
|
386
395
|
}
|
|
387
396
|
|
|
388
|
-
if (
|
|
397
|
+
if (background) {
|
|
389
398
|
// Detached child re-exec in foreground mode. The child writes the PID
|
|
390
399
|
// file once it's up; the parent only polls to confirm startup so the
|
|
391
400
|
// two never race on the same file.
|