@botiverse/raft-daemon 0.64.0 → 0.65.0-play.20260629144133

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.
@@ -3805,30 +3805,32 @@ Use the \`raft\` CLI for chat / task / attachment operations (\`slock\` remains
3805
3805
  4. **\`raft channel members\`** \u2014 List the members (agents and humans) of a specific channel, DM, or thread target.
3806
3806
  5. **\`raft channel join\`** \u2014 Join a visible public channel. This only affects your own agent membership.
3807
3807
  6. **\`raft channel leave\`** \u2014 Leave a regular channel you have joined. This only affects your own agent membership.
3808
- 7. **\`raft thread unfollow\`** \u2014 Stop receiving ordinary delivery for a thread you no longer need to follow. This only affects your own agent attention state.
3809
- 8. **\`raft message read\`** \u2014 Read past messages from a channel, DM, or thread. Supports \`before\` / \`after\` anchors and \`around\` for centered context.
3810
- 9. **\`raft message search\`** \u2014 Search messages visible to you, then inspect a hit with \`raft message read\`.
3811
- 10. **\`raft message resolve\`** \u2014 Verify that a cited message id exists exactly and print its canonical message row. Use this when checking whether a referenced id is real; \`read --around\` is for context, not proof.
3812
- 11. **\`raft message react\`** \u2014 Add or remove your reaction on a message. Use sparingly: prefer acknowledgement/follow-up signals like \u{1F440}, and do not auto-react to every merge, deploy, or task completion with celebratory emoji.
3813
- 12. **\`raft task list\`** \u2014 View a channel's task board.
3814
- 13. **\`raft task create\`** \u2014 Create new task-messages in a channel (supports batch titles; equivalent to sending a new message and publishing it as a task-message, not claiming it for yourself).
3815
- 14. **\`raft task claim\`** \u2014 Claim tasks by number or message ID using repeatable flags; examples: \`raft task claim --channel "#channel" --number 1 --number 2\`, or \`raft task claim --channel "#channel" --message-id abc12345\`.
3816
- 15. **\`raft task unclaim\`** \u2014 Release your claim on a task.
3817
- 16. **\`raft task update\`** \u2014 Change a task's status (e.g. to in_review or done).
3818
- 17. **\`raft attachment upload\`** \u2014 Upload a file to attach to a message. Uses content sniffing for image previews; pass \`--mime-type\` only when you know the exact type. Returns an attachment ID to pass to \`raft message send\`.
3819
- 18. **\`raft attachment view\`** \u2014 Download an attached file by its attachment ID so you can inspect it locally.
3820
- 19. **\`raft profile show\`** \u2014 Show your own profile, or another visible profile via \`@handle\`. Mirrors the canonical Slock profile view.
3821
- 20. **\`raft profile update\`** \u2014 Update your own profile. Supports \`--avatar-file <path>\`, \`--avatar-url pixel:random:<seed>\`, \`--display-name <name>\`, and \`--description <text>\`. Use \`--avatar-url pixel:random:<seed>\` when you want a new pixel avatar but do not have a local image file. Values must be non-empty. Provide at least one flag per call; multiple flags can be combined.
3822
- 21. **\`raft integration list\`** \u2014 List built-in Slock apps, registered third-party services, and this agent's active Slock Agent Logins.
3823
- 22. **\`raft integration login\`** \u2014 Provision or reuse this agent's login for a built-in Slock app or registered third-party service.
3824
- 23. **\`raft integration env\`** \u2014 Print per-agent local CLI environment for a manifest-backed service that requires isolated HOME/XDG state.
3825
- 24. **\`raft reminder schedule\`** \u2014 Schedule a reminder for yourself later, at a specific time, or on a recurring cadence.
3826
- 25. **\`raft reminder list\`** \u2014 List your reminders, including lifecycle history for each reminder.
3827
- 26. **\`raft reminder snooze\`** \u2014 Push a reminder later without replacing it.
3828
- 27. **\`raft reminder update\`** \u2014 Change a reminder's title, schedule, or recurrence without creating a new reminder.
3829
- 28. **\`raft reminder cancel\`** \u2014 Cancel one of your reminders by ID.
3830
- 29. **\`raft reminder log\`** \u2014 Show the event log for a reminder, including fires, dismissals, and reschedules.
3831
- 30. **\`raft action prepare\`** \u2014 Prepare an action card for a human to commit (B-mode quick-commit shortcut). Posts a card the human can click to execute the action under their own identity. Pass \`--target <ch>\` and pipe the action JSON on stdin (variants: \`channel:create\`, \`agent:create\`).
3808
+ 7. **\`raft channel mute\`** \u2014 Mute ordinary Activity delivery for a regular channel for your agent. Personal @mentions, DMs, and tasks still pierce.
3809
+ 8. **\`raft channel unmute\`** \u2014 Unmute ordinary Activity delivery for a regular channel for your agent. Muted-window messages are not retroactively promoted.
3810
+ 9. **\`raft thread unfollow\`** \u2014 Stop receiving ordinary delivery for a thread you no longer need to follow. This only affects your own agent attention state.
3811
+ 10. **\`raft message read\`** \u2014 Read past messages from a channel, DM, or thread. Supports \`before\` / \`after\` anchors and \`around\` for centered context.
3812
+ 11. **\`raft message search\`** \u2014 Search messages visible to you, then inspect a hit with \`raft message read\`.
3813
+ 12. **\`raft message resolve\`** \u2014 Verify that a cited message id exists exactly and print its canonical message row. Use this when checking whether a referenced id is real; \`read --around\` is for context, not proof.
3814
+ 13. **\`raft message react\`** \u2014 Add or remove your reaction on a message. Use sparingly: prefer acknowledgement/follow-up signals like \u{1F440}, and do not auto-react to every merge, deploy, or task completion with celebratory emoji.
3815
+ 14. **\`raft task list\`** \u2014 View a channel's task board.
3816
+ 15. **\`raft task create\`** \u2014 Create new task-messages in a channel (supports batch titles; equivalent to sending a new message and publishing it as a task-message, not claiming it for yourself).
3817
+ 16. **\`raft task claim\`** \u2014 Claim tasks by number or message ID using repeatable flags; examples: \`raft task claim --channel "#channel" --number 1 --number 2\`, or \`raft task claim --channel "#channel" --message-id abc12345\`.
3818
+ 17. **\`raft task unclaim\`** \u2014 Release your claim on a task.
3819
+ 18. **\`raft task update\`** \u2014 Change a task's status (e.g. to in_review or done).
3820
+ 19. **\`raft attachment upload\`** \u2014 Upload a file to attach to a message. Uses content sniffing for image previews; pass \`--mime-type\` only when you know the exact type. Returns an attachment ID to pass to \`raft message send\`.
3821
+ 20. **\`raft attachment view\`** \u2014 Download an attached file by its attachment ID so you can inspect it locally.
3822
+ 21. **\`raft profile show\`** \u2014 Show your own profile, or another visible profile via \`@handle\`. Mirrors the canonical Slock profile view.
3823
+ 22. **\`raft profile update\`** \u2014 Update your own profile. Supports \`--avatar-file <path>\`, \`--avatar-url pixel:random:<seed>\`, \`--display-name <name>\`, and \`--description <text>\`. Use \`--avatar-url pixel:random:<seed>\` when you want a new pixel avatar but do not have a local image file. Values must be non-empty. Provide at least one flag per call; multiple flags can be combined.
3824
+ 23. **\`raft integration list\`** \u2014 List built-in Slock apps, registered third-party services, and this agent's active Slock Agent Logins.
3825
+ 24. **\`raft integration login\`** \u2014 Provision or reuse this agent's login for a built-in Slock app or registered third-party service.
3826
+ 25. **\`raft integration env\`** \u2014 Print per-agent local CLI environment for a manifest-backed service that requires isolated HOME/XDG state.
3827
+ 26. **\`raft reminder schedule\`** \u2014 Schedule a reminder for yourself later, at a specific time, or on a recurring cadence.
3828
+ 27. **\`raft reminder list\`** \u2014 List your reminders, including lifecycle history for each reminder.
3829
+ 28. **\`raft reminder snooze\`** \u2014 Push a reminder later without replacing it.
3830
+ 29. **\`raft reminder update\`** \u2014 Change a reminder's title, schedule, or recurrence without creating a new reminder.
3831
+ 30. **\`raft reminder cancel\`** \u2014 Cancel one of your reminders by ID.
3832
+ 31. **\`raft reminder log\`** \u2014 Show the event log for a reminder, including fires, dismissals, and reschedules.
3833
+ 32. **\`raft action prepare\`** \u2014 Prepare an action card for a human to commit (B-mode quick-commit shortcut). Posts a card the human can click to execute the action under their own identity. Pass \`--target <ch>\` and pipe the action JSON on stdin (variants: \`channel:create\`, \`agent:create\`).
3832
3834
 
3833
3835
  The CLI prints human-readable canonical text on success (matching the format you see in received messages and history). On failure it prints canonical labeled text to stderr:
3834
3836
  - \`Error:\` human-readable error summary
@@ -3899,7 +3901,7 @@ function buildDiscoverySection() {
3899
3901
  return `### Discovering people and channels
3900
3902
 
3901
3903
  Call \`raft server info\` to see all channels in this server, which ones you have joined, other agents, and humans.
3902
- Visible public channels may appear even when \`joined=false\`. In that state you can still inspect them with \`raft message read\` and \`raft channel members\`, but you cannot send messages there or receive ordinary channel delivery until you join with \`raft channel join --target "#channel-name"\`. Private channels require a human with access to add you. To leave a regular channel you have joined, use \`raft channel leave --target "#channel-name"\`. To stop following a thread without leaving its parent channel, use \`raft thread unfollow --target "#channel-name:shortid"\`.
3904
+ Visible public channels may appear even when \`joined=false\`. In that state you can still inspect them with \`raft message read\` and \`raft channel members\`, but you cannot send messages there or receive ordinary channel delivery until you join with \`raft channel join --target "#channel-name"\`. Private channels require a human with access to add you. To leave a regular channel you have joined, use \`raft channel leave --target "#channel-name"\`. To mute ordinary Activity delivery without leaving a regular channel, use \`raft channel mute "#channel-name"\`; personal @mentions, DMs, and tasks still pierce, and thread following is separate. To reverse that setting, use \`raft channel unmute "#channel-name"\`. To stop following a thread without leaving its parent channel, use \`raft thread unfollow --target "#channel-name:shortid"\`.
3903
3905
  Private channels are membership-gated. If \`raft server info\` shows a channel as private, treat its name, members, and content as private to that channel; do not disclose that information in other channels, DMs, summaries, or task reports unless a human explicitly asks within an authorized context. In \`raft channel members\`, human role labels such as owner/admin show server-level authority; no role label means ordinary member.`;
3904
3906
  }
3905
3907
  function buildChannelAwarenessSection() {
@@ -4363,6 +4365,19 @@ function listLegacySlockStatePaths(slockHome = resolveSlockHome(), homeDir = os.
4363
4365
  return candidates.filter((candidate) => existsSync(candidate.path));
4364
4366
  }
4365
4367
 
4368
+ // src/authEnv.ts
4369
+ var DAEMON_API_KEY_ENV = "SLOCK_MACHINE_API_KEY";
4370
+ var SLOCK_AGENT_TOKEN_ENV = "SLOCK_AGENT_TOKEN";
4371
+ function scrubDaemonAuthEnv(env) {
4372
+ delete env[DAEMON_API_KEY_ENV];
4373
+ return env;
4374
+ }
4375
+ function scrubDaemonChildEnv(env) {
4376
+ delete env[DAEMON_API_KEY_ENV];
4377
+ delete env[SLOCK_AGENT_TOKEN_ENV];
4378
+ return env;
4379
+ }
4380
+
4366
4381
  // src/agentCredentialProxy.ts
4367
4382
  import { randomBytes } from "crypto";
4368
4383
  import http from "http";
@@ -5931,7 +5946,9 @@ var LOOPBACK_NO_PROXY = "127.0.0.1,localhost";
5931
5946
  var CLI_TRANSPORT_TRACE_DIR_ENV = "SLOCK_CLI_TRANSPORT_TRACE_DIR";
5932
5947
  var safePathPart = (value) => value.replace(/[^a-zA-Z0-9_.-]/g, "_");
5933
5948
  var RAW_CREDENTIAL_ENV_DENYLIST = [
5934
- "SLOCK_AGENT_CREDENTIAL_KEY"
5949
+ "SLOCK_AGENT_TOKEN",
5950
+ "SLOCK_AGENT_CREDENTIAL_KEY",
5951
+ "SLOCK_AGENT_CREDENTIAL_KEY_FILE"
5935
5952
  ];
5936
5953
  var WORKSPACE_CLI_TRANSPORT_FILENAMES = [
5937
5954
  "agent-token",
@@ -6286,7 +6303,7 @@ set "SLOCK_AGENT_ACTIVE_CAPABILITIES=${DEFAULT_ACTIVE_CAPABILITIES}"\r
6286
6303
  SLOCK_SERVER_URL: ctx.config.serverUrl,
6287
6304
  PATH: `${slockDir}${path2.delimiter}${process.env.PATH ?? ""}`
6288
6305
  };
6289
- delete spawnEnv.SLOCK_AGENT_TOKEN;
6306
+ scrubDaemonChildEnv(spawnEnv);
6290
6307
  for (const key of RAW_CREDENTIAL_ENV_DENYLIST) {
6291
6308
  delete spawnEnv[key];
6292
6309
  }
@@ -6808,7 +6825,7 @@ function requiresWindowsShell(command, platform = process.platform) {
6808
6825
  }
6809
6826
  function resolveCommandOnPath(command, deps = {}) {
6810
6827
  const platform = deps.platform ?? process.platform;
6811
- const env = withWindowsUserEnvironment(deps.env ?? process.env, deps);
6828
+ const env = scrubDaemonChildEnv({ ...withWindowsUserEnvironment(deps.env ?? process.env, deps) });
6812
6829
  const execFileSyncFn = deps.execFileSyncFn ?? execFileSync;
6813
6830
  const existsSyncFn = deps.existsSyncFn ?? existsSync3;
6814
6831
  if (platform === "win32") {
@@ -6834,7 +6851,7 @@ function firstExistingPath(candidates, deps = {}) {
6834
6851
  return null;
6835
6852
  }
6836
6853
  function readCommandVersion(command, args = [], deps = {}) {
6837
- const env = withWindowsUserEnvironment(deps.env ?? process.env, deps);
6854
+ const env = scrubDaemonChildEnv({ ...withWindowsUserEnvironment(deps.env ?? process.env, deps) });
6838
6855
  const execFileSyncFn = deps.execFileSyncFn ?? execFileSync;
6839
6856
  try {
6840
6857
  const output = normalizeExecOutput(execFileSyncFn(command, [...args, "--version"], {
@@ -8918,11 +8935,11 @@ function detectCursorModels(runCommand = runCursorModelsCommand) {
8918
8935
  return parseCursorModelsOutput(String(result.stdout || ""));
8919
8936
  }
8920
8937
  function buildCursorModelProbeEnv(deps = {}) {
8921
- return withWindowsUserEnvironment({
8938
+ return scrubDaemonChildEnv(withWindowsUserEnvironment({
8922
8939
  ...deps.env ?? process.env,
8923
8940
  FORCE_COLOR: "0",
8924
8941
  NO_COLOR: "1"
8925
- }, deps);
8942
+ }, deps));
8926
8943
  }
8927
8944
  function runCursorModelsCommand() {
8928
8945
  return spawnSync("cursor-agent", ["models"], {
@@ -8978,7 +8995,7 @@ function resolveGeminiSpawn(commandArgs, deps = {}) {
8978
8995
  }
8979
8996
  const execFileSyncFn = deps.execFileSyncFn ?? execFileSync3;
8980
8997
  const existsSyncFn = deps.existsSyncFn ?? existsSync5;
8981
- const env = deps.env ?? process.env;
8998
+ const env = scrubDaemonChildEnv({ ...deps.env ?? process.env });
8982
8999
  const winPath = path8.win32;
8983
9000
  let geminiEntry = null;
8984
9001
  try {
@@ -9115,12 +9132,15 @@ var GeminiDriver = class {
9115
9132
  // src/drivers/kimi.ts
9116
9133
  import { randomUUID as randomUUID2 } from "crypto";
9117
9134
  import { spawn as spawn7 } from "child_process";
9118
- import { existsSync as existsSync6, readFileSync as readFileSync3, writeFileSync as writeFileSync3 } from "fs";
9135
+ import { chmodSync, existsSync as existsSync6, readFileSync as readFileSync3, writeFileSync as writeFileSync3 } from "fs";
9119
9136
  import os4 from "os";
9120
9137
  import path9 from "path";
9121
9138
  var KIMI_WIRE_PROTOCOL_VERSION = "1.3";
9122
9139
  var KIMI_SYSTEM_PROMPT_FILE = ".slock-kimi-system.md";
9123
9140
  var KIMI_AGENT_FILE = ".slock-kimi-agent.yaml";
9141
+ var KIMI_GENERATED_CONFIG_FILE = ".slock-kimi-config.toml";
9142
+ var SLOCK_KIMI_CONFIG_CONTENT_ENV = "SLOCK_KIMI_CONFIG_CONTENT";
9143
+ var SLOCK_KIMI_CONFIG_FILE_ENV = "SLOCK_KIMI_CONFIG_FILE";
9124
9144
  function parseToolArguments(raw) {
9125
9145
  if (typeof raw !== "string") return raw;
9126
9146
  try {
@@ -9129,6 +9149,73 @@ function parseToolArguments(raw) {
9129
9149
  return raw;
9130
9150
  }
9131
9151
  }
9152
+ function readKimiConfigSource(home = os4.homedir(), env = process.env) {
9153
+ const inlineConfig = env[SLOCK_KIMI_CONFIG_CONTENT_ENV];
9154
+ if (inlineConfig && inlineConfig.trim()) {
9155
+ return {
9156
+ raw: inlineConfig,
9157
+ explicitPath: null,
9158
+ sourcePath: SLOCK_KIMI_CONFIG_CONTENT_ENV
9159
+ };
9160
+ }
9161
+ const explicitPath = env[SLOCK_KIMI_CONFIG_FILE_ENV];
9162
+ const configPath = explicitPath && explicitPath.trim() ? explicitPath : path9.join(home, ".kimi", "config.toml");
9163
+ try {
9164
+ return {
9165
+ raw: readFileSync3(configPath, "utf8"),
9166
+ explicitPath: explicitPath && explicitPath.trim() ? explicitPath : null,
9167
+ sourcePath: configPath
9168
+ };
9169
+ } catch {
9170
+ return {
9171
+ raw: null,
9172
+ explicitPath: explicitPath && explicitPath.trim() ? explicitPath : null,
9173
+ sourcePath: configPath
9174
+ };
9175
+ }
9176
+ }
9177
+ function buildKimiSpawnEnv(env = process.env) {
9178
+ const spawnEnv = { ...env, FORCE_COLOR: "0", NO_COLOR: "1" };
9179
+ delete spawnEnv[SLOCK_KIMI_CONFIG_CONTENT_ENV];
9180
+ delete spawnEnv[SLOCK_KIMI_CONFIG_FILE_ENV];
9181
+ return scrubDaemonChildEnv(spawnEnv);
9182
+ }
9183
+ function buildKimiEffectiveEnv(ctx, overrideEnv) {
9184
+ return {
9185
+ ...process.env,
9186
+ ...ctx.config.envVars || {},
9187
+ ...overrideEnv || {}
9188
+ };
9189
+ }
9190
+ function buildKimiLaunchOptions(ctx, opts = {}) {
9191
+ const env = buildKimiEffectiveEnv(ctx, opts.env);
9192
+ const source = readKimiConfigSource(opts.home ?? os4.homedir(), env);
9193
+ const args = [];
9194
+ let configFilePath = null;
9195
+ let configContent = null;
9196
+ if (source.explicitPath) {
9197
+ configFilePath = source.explicitPath;
9198
+ } else if (source.raw !== null && source.sourcePath === SLOCK_KIMI_CONFIG_CONTENT_ENV) {
9199
+ configFilePath = path9.join(ctx.workingDirectory, KIMI_GENERATED_CONFIG_FILE);
9200
+ configContent = source.raw;
9201
+ if (opts.writeGeneratedConfig !== false) {
9202
+ writeFileSync3(configFilePath, source.raw, { encoding: "utf8", mode: 384 });
9203
+ chmodSync(configFilePath, 384);
9204
+ }
9205
+ }
9206
+ if (configFilePath) {
9207
+ args.push("--config-file", configFilePath);
9208
+ }
9209
+ if (ctx.config.model && ctx.config.model !== "default") {
9210
+ args.push("--model", ctx.config.model);
9211
+ }
9212
+ return {
9213
+ args,
9214
+ env: buildKimiSpawnEnv(env),
9215
+ configFilePath,
9216
+ configContent
9217
+ };
9218
+ }
9132
9219
  function resolveKimiSpawn(commandArgs, deps = {}) {
9133
9220
  return {
9134
9221
  command: resolveCommandOnPath("kimi", deps) ?? "kimi",
@@ -9152,7 +9239,25 @@ var KimiDriver = class {
9152
9239
  };
9153
9240
  model = {
9154
9241
  detectedModelsVerifiedAs: "launchable",
9155
- toLaunchSpec: (modelId) => ({ args: ["--model", modelId] })
9242
+ toLaunchSpec: (modelId, ctx, opts) => {
9243
+ if (!ctx) return { args: ["--model", modelId] };
9244
+ const launchCtx = {
9245
+ ...ctx,
9246
+ config: {
9247
+ ...ctx.config,
9248
+ model: modelId
9249
+ }
9250
+ };
9251
+ const launch = buildKimiLaunchOptions(launchCtx, {
9252
+ home: opts?.home,
9253
+ writeGeneratedConfig: false
9254
+ });
9255
+ return {
9256
+ args: launch.args,
9257
+ env: launch.env,
9258
+ configFiles: launch.configFilePath ? [launch.configFilePath] : void 0
9259
+ };
9260
+ }
9156
9261
  };
9157
9262
  supportsStdinNotification = true;
9158
9263
  busyDeliveryMode = "direct";
@@ -9176,21 +9281,23 @@ var KimiDriver = class {
9176
9281
  ` system_prompt_path: ./${KIMI_SYSTEM_PROMPT_FILE}`,
9177
9282
  ""
9178
9283
  ].join("\n"), "utf8");
9284
+ const launch = buildKimiLaunchOptions(ctx);
9179
9285
  const args = [
9180
9286
  "--wire",
9181
9287
  "--yolo",
9182
9288
  "--agent-file",
9183
9289
  agentFilePath,
9184
9290
  "--session",
9185
- this.sessionId
9291
+ this.sessionId,
9292
+ ...launch.args
9186
9293
  ];
9187
9294
  const launchRuntimeFields = runtimeConfigToLaunchFields(hydrateRuntimeConfig(ctx.config));
9188
9295
  if (launchRuntimeFields.model && launchRuntimeFields.model !== "default") {
9189
9296
  args.push("--model", launchRuntimeFields.model);
9190
9297
  }
9191
9298
  const spawnEnv = (await prepareCliTransport(ctx, { NO_COLOR: "1" })).spawnEnv;
9192
- const launch = resolveKimiSpawn(args);
9193
- const proc = spawn7(launch.command, launch.args, {
9299
+ const spawnTarget = resolveKimiSpawn(args);
9300
+ const proc = spawn7(spawnTarget.command, spawnTarget.args, {
9194
9301
  cwd: ctx.workingDirectory,
9195
9302
  stdio: ["pipe", "pipe", "pipe"],
9196
9303
  env: spawnEnv,
@@ -9198,7 +9305,7 @@ var KimiDriver = class {
9198
9305
  // and has an 8191-character command-line limit. Kimi's official
9199
9306
  // installer/uv entrypoint is an executable, so launch it directly and
9200
9307
  // keep prompts on stdin / files instead of routing through cmd.exe.
9201
- shell: launch.shell
9308
+ shell: spawnTarget.shell
9202
9309
  });
9203
9310
  proc.stdin?.write(JSON.stringify({
9204
9311
  jsonrpc: "2.0",
@@ -9311,14 +9418,9 @@ var KimiDriver = class {
9311
9418
  return detectKimiModels();
9312
9419
  }
9313
9420
  };
9314
- function detectKimiModels(home = os4.homedir()) {
9315
- const configPath = path9.join(home, ".kimi", "config.toml");
9316
- let raw;
9317
- try {
9318
- raw = readFileSync3(configPath, "utf8");
9319
- } catch {
9320
- return null;
9321
- }
9421
+ function detectKimiModels(home = os4.homedir(), opts = {}) {
9422
+ const raw = readKimiConfigSource(home, opts.env).raw;
9423
+ if (raw === null) return null;
9322
9424
  const models = [];
9323
9425
  const sectionRe = /^\s*\[models(?:\.([^\]]+)|"\.[^"]+"|\."[^"]+")\s*\]\s*$/gm;
9324
9426
  const lineRe = /^\s*\[models\.(.+?)\s*\]\s*$/gm;
@@ -9984,7 +10086,7 @@ function runOpenCodeModelsCommand(home, deps = {}) {
9984
10086
  const platform = deps.platform ?? process.platform;
9985
10087
  const spawnSyncFn = deps.spawnSyncFn ?? spawnSync2;
9986
10088
  const result = spawnSyncFn("opencode", ["models"], {
9987
- env: { ...process.env, HOME: home, FORCE_COLOR: "0", NO_COLOR: "1" },
10089
+ env: scrubDaemonChildEnv({ ...process.env, HOME: home, FORCE_COLOR: "0", NO_COLOR: "1" }),
9988
10090
  encoding: "utf8",
9989
10091
  timeout: 5e3,
9990
10092
  shell: platform === "win32"
@@ -19638,7 +19740,7 @@ var DAEMON_CORE_TRACE_ATTR_CONTRACTS = {
19638
19740
  spanAttrs: ["agentId", "event_kind", "runtime"]
19639
19741
  }
19640
19742
  };
19641
- var DAEMON_CLI_USAGE = "Usage: slock-daemon --server-url <url> --api-key <key>";
19743
+ var DAEMON_CLI_USAGE = `Usage: slock-daemon --server-url <url> (--api-key <key> or ${DAEMON_API_KEY_ENV}=<key>)`;
19642
19744
  var RunnerCredentialMintError2 = class extends Error {
19643
19745
  code;
19644
19746
  retryable;
@@ -19674,9 +19776,9 @@ function runnerCredentialErrorDetail2(error) {
19674
19776
  async function waitForRunnerCredentialRetry2() {
19675
19777
  await new Promise((resolve) => setTimeout(resolve, RUNNER_CREDENTIAL_MINT_RETRY_DELAY_MS2));
19676
19778
  }
19677
- function parseDaemonCliArgs(args) {
19779
+ function parseDaemonCliArgs(args, env = {}) {
19678
19780
  let serverUrl = "";
19679
- let apiKey = "";
19781
+ let apiKey = env[DAEMON_API_KEY_ENV] ?? "";
19680
19782
  for (let i = 0; i < args.length; i++) {
19681
19783
  if (args[i] === "--server-url" && args[i + 1]) serverUrl = args[++i];
19682
19784
  if (args[i] === "--api-key" && args[i + 1]) apiKey = args[++i];
@@ -19713,7 +19815,7 @@ function resolveSlockCliPathOrEmpty(moduleUrl = import.meta.url) {
19713
19815
  }
19714
19816
  async function runBundledSlockCli(argv) {
19715
19817
  process.argv = [process.execPath, "slock", ...argv];
19716
- await import("./dist-TPCGG5OS.js");
19818
+ await import("./dist-NONOBGMT.js");
19717
19819
  }
19718
19820
  function detectRuntimes(tracer = noopTracer) {
19719
19821
  const ids = [];
@@ -20650,6 +20752,8 @@ var DaemonCore = class {
20650
20752
 
20651
20753
  export {
20652
20754
  subscribeDaemonLogs,
20755
+ DAEMON_API_KEY_ENV,
20756
+ scrubDaemonAuthEnv,
20653
20757
  resolveWorkspaceDirectoryPath,
20654
20758
  scanWorkspaceDirectories,
20655
20759
  deleteWorkspaceDirectory,
package/dist/cli/index.js CHANGED
@@ -44181,6 +44181,9 @@ init_esm_shims();
44181
44181
  // ../shared/src/agentScopes.ts
44182
44182
  init_esm_shims();
44183
44183
 
44184
+ // ../shared/src/docs/crossPageInvariants.ts
44185
+ init_esm_shims();
44186
+
44184
44187
  // ../shared/src/testing/failpoints.ts
44185
44188
  init_esm_shims();
44186
44189
  var NoopFailpointRegistry = class {
@@ -44950,7 +44953,7 @@ var ApiClient = class {
44950
44953
  if (reaction) {
44951
44954
  return `/internal/agent-api/messages/${reaction[1]}/reactions`;
44952
44955
  }
44953
- const channelMembership = /^\/channels\/([^/]+)\/(join|leave)$/.exec(suffix);
44956
+ const channelMembership = /^\/channels\/([^/]+)\/(join|leave|mute|unmute)$/.exec(suffix);
44954
44957
  if (channelMembership) {
44955
44958
  return `/internal/agent-api/channels/${channelMembership[1]}/${channelMembership[2]}`;
44956
44959
  }
@@ -47835,6 +47838,86 @@ function registerChannelJoinCommand(parent, runtimeOptions) {
47835
47838
  registerCliCommand(parent, channelJoinCommand, runtimeOptions);
47836
47839
  }
47837
47840
 
47841
+ // src/commands/channel/mute.ts
47842
+ init_esm_shims();
47843
+ function formatSeq(value) {
47844
+ return value == null ? "none" : String(value);
47845
+ }
47846
+ function formatChannelMuteResult(target, result2) {
47847
+ const lines = [
47848
+ `${result2.activityMuted ? "Muted" : "Unmuted"} ${target}.`,
47849
+ `Activity muted: ${result2.activityMuted ? "yes" : "no"}`,
47850
+ `Mute from seq: ${formatSeq(result2.muteFromSeq)}`
47851
+ ];
47852
+ if (result2.attention?.ordinaryActivity) lines.push(result2.attention.ordinaryActivity);
47853
+ if (result2.attention?.stillArrives?.length) {
47854
+ lines.push("Still arrives:");
47855
+ for (const item of result2.attention.stillArrives) lines.push(`- ${item}`);
47856
+ }
47857
+ if (result2.attention?.threadBoundary) lines.push(result2.attention.threadBoundary);
47858
+ if (result2.attention?.catchUp) lines.push(result2.attention.catchUp);
47859
+ if (result2.attention?.unmuteCommand) lines.push(`To unmute: ${result2.attention.unmuteCommand}`);
47860
+ if (result2.attention?.unmuteApi) lines.push(`Agent API: ${result2.attention.unmuteApi}`);
47861
+ if (result2.attention?.muteCommand) lines.push(`To mute: ${result2.attention.muteCommand}`);
47862
+ if (result2.attention?.muteApi) lines.push(`Agent API: ${result2.attention.muteApi}`);
47863
+ return lines.join("\n");
47864
+ }
47865
+ function makeChannelMuteCommand(action) {
47866
+ return defineCommand(
47867
+ {
47868
+ name: action,
47869
+ description: action === "mute" ? "Mute ordinary Activity delivery for a regular channel" : "Unmute ordinary Activity delivery for a regular channel",
47870
+ arguments: ["<target>"]
47871
+ },
47872
+ async (ctx, targetArg) => {
47873
+ const target = String(targetArg ?? "");
47874
+ const channelName = parseRegularChannelTarget(target);
47875
+ if (!channelName) {
47876
+ throw new CliError({
47877
+ code: "INVALID_TARGET",
47878
+ message: "Target must be a regular channel in the form '#channel-name'. DMs and thread targets are not supported."
47879
+ });
47880
+ }
47881
+ const agentContext = ctx.loadAgentContext();
47882
+ const client = ctx.createApiClient(agentContext);
47883
+ const infoRes = await createAgentApiClient2(client, agentContext.agentId).server.info();
47884
+ if (!infoRes.ok) {
47885
+ throw new CliError({
47886
+ code: infoRes.status >= 500 ? "SERVER_5XX" : "INFO_FAILED",
47887
+ message: infoRes.error ?? `HTTP ${infoRes.status}`
47888
+ });
47889
+ }
47890
+ const channel = (infoRes.data?.channels ?? []).find((candidate) => candidate.name === channelName);
47891
+ if (!channel) {
47892
+ throw new CliError({
47893
+ code: "NOT_FOUND",
47894
+ message: `Channel not found: ${target}`
47895
+ });
47896
+ }
47897
+ const res = await client.request(
47898
+ "POST",
47899
+ `/internal/agent/${encodeURIComponent(agentContext.agentId)}/channels/${encodeURIComponent(channel.id)}/${action}`
47900
+ );
47901
+ if (!res.ok) {
47902
+ throw new CliError({
47903
+ code: res.status >= 500 ? "SERVER_5XX" : action === "mute" ? "MUTE_FAILED" : "UNMUTE_FAILED",
47904
+ message: res.error ?? `HTTP ${res.status}`,
47905
+ suggestedNextAction: res.suggestedNextAction ?? void 0
47906
+ });
47907
+ }
47908
+ writeText(ctx.io, formatChannelMuteResult(target, res.data ?? {}) + "\n");
47909
+ }
47910
+ );
47911
+ }
47912
+ var channelMuteCommand = makeChannelMuteCommand("mute");
47913
+ var channelUnmuteCommand = makeChannelMuteCommand("unmute");
47914
+ function registerChannelMuteCommand(parent, runtimeOptions) {
47915
+ registerCliCommand(parent, channelMuteCommand, runtimeOptions);
47916
+ }
47917
+ function registerChannelUnmuteCommand(parent, runtimeOptions) {
47918
+ registerCliCommand(parent, channelUnmuteCommand, runtimeOptions);
47919
+ }
47920
+
47838
47921
  // src/commands/server/info.ts
47839
47922
  init_esm_shims();
47840
47923
  var serverInfoCommand = defineCommand(
@@ -51384,10 +51467,12 @@ var agentCmd = program2.command("agent").description("External agent onboarding
51384
51467
  registerAgentLoginCommand(agentCmd);
51385
51468
  registerAgentListCommand(agentCmd);
51386
51469
  registerAgentBridgeCommand(agentCmd);
51387
- var channelCmd = program2.command("channel").description("Channel membership operations");
51470
+ var channelCmd = program2.command("channel").description("Channel membership and attention operations");
51388
51471
  registerChannelMembersCommand(channelCmd);
51389
51472
  registerChannelJoinCommand(channelCmd);
51390
51473
  registerChannelLeaveCommand(channelCmd);
51474
+ registerChannelMuteCommand(channelCmd);
51475
+ registerChannelUnmuteCommand(channelCmd);
51391
51476
  var threadCmd = program2.command("thread").description("Thread attention operations");
51392
51477
  registerThreadUnfollowCommand(threadCmd);
51393
51478
  var serverCmd = program2.command("server").description("Server / workspace introspection");
package/dist/core.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import {
2
+ DAEMON_API_KEY_ENV,
2
3
  DAEMON_CLI_USAGE,
3
4
  DAEMON_CORE_TRACE_ATTR_CONTRACTS,
4
5
  DaemonCore,
@@ -11,9 +12,11 @@ import {
11
12
  resolveWorkspaceDirectoryPath,
12
13
  runBundledSlockCli,
13
14
  scanWorkspaceDirectories,
15
+ scrubDaemonAuthEnv,
14
16
  subscribeDaemonLogs
15
- } from "./chunk-ILFE5NTJ.js";
17
+ } from "./chunk-YHGUM6IF.js";
16
18
  export {
19
+ DAEMON_API_KEY_ENV,
17
20
  DAEMON_CLI_USAGE,
18
21
  DAEMON_CORE_TRACE_ATTR_CONTRACTS,
19
22
  DaemonCore,
@@ -26,5 +29,6 @@ export {
26
29
  resolveWorkspaceDirectoryPath,
27
30
  runBundledSlockCli,
28
31
  scanWorkspaceDirectories,
32
+ scrubDaemonAuthEnv,
29
33
  subscribeDaemonLogs
30
34
  };
@@ -43721,6 +43721,7 @@ init_esm_shims();
43721
43721
  init_esm_shims();
43722
43722
  init_esm_shims();
43723
43723
  init_esm_shims();
43724
+ init_esm_shims();
43724
43725
  var NoopFailpointRegistry = class {
43725
43726
  get enabled() {
43726
43727
  return false;
@@ -44473,7 +44474,7 @@ var ApiClient = class {
44473
44474
  if (reaction) {
44474
44475
  return `/internal/agent-api/messages/${reaction[1]}/reactions`;
44475
44476
  }
44476
- const channelMembership = /^\/channels\/([^/]+)\/(join|leave)$/.exec(suffix);
44477
+ const channelMembership = /^\/channels\/([^/]+)\/(join|leave|mute|unmute)$/.exec(suffix);
44477
44478
  if (channelMembership) {
44478
44479
  return `/internal/agent-api/channels/${channelMembership[1]}/${channelMembership[2]}`;
44479
44480
  }
@@ -47305,6 +47306,84 @@ function registerChannelJoinCommand(parent, runtimeOptions) {
47305
47306
  registerCliCommand(parent, channelJoinCommand, runtimeOptions);
47306
47307
  }
47307
47308
  init_esm_shims();
47309
+ function formatSeq(value) {
47310
+ return value == null ? "none" : String(value);
47311
+ }
47312
+ function formatChannelMuteResult(target, result2) {
47313
+ const lines = [
47314
+ `${result2.activityMuted ? "Muted" : "Unmuted"} ${target}.`,
47315
+ `Activity muted: ${result2.activityMuted ? "yes" : "no"}`,
47316
+ `Mute from seq: ${formatSeq(result2.muteFromSeq)}`
47317
+ ];
47318
+ if (result2.attention?.ordinaryActivity) lines.push(result2.attention.ordinaryActivity);
47319
+ if (result2.attention?.stillArrives?.length) {
47320
+ lines.push("Still arrives:");
47321
+ for (const item of result2.attention.stillArrives) lines.push(`- ${item}`);
47322
+ }
47323
+ if (result2.attention?.threadBoundary) lines.push(result2.attention.threadBoundary);
47324
+ if (result2.attention?.catchUp) lines.push(result2.attention.catchUp);
47325
+ if (result2.attention?.unmuteCommand) lines.push(`To unmute: ${result2.attention.unmuteCommand}`);
47326
+ if (result2.attention?.unmuteApi) lines.push(`Agent API: ${result2.attention.unmuteApi}`);
47327
+ if (result2.attention?.muteCommand) lines.push(`To mute: ${result2.attention.muteCommand}`);
47328
+ if (result2.attention?.muteApi) lines.push(`Agent API: ${result2.attention.muteApi}`);
47329
+ return lines.join("\n");
47330
+ }
47331
+ function makeChannelMuteCommand(action) {
47332
+ return defineCommand(
47333
+ {
47334
+ name: action,
47335
+ description: action === "mute" ? "Mute ordinary Activity delivery for a regular channel" : "Unmute ordinary Activity delivery for a regular channel",
47336
+ arguments: ["<target>"]
47337
+ },
47338
+ async (ctx, targetArg) => {
47339
+ const target = String(targetArg ?? "");
47340
+ const channelName = parseRegularChannelTarget(target);
47341
+ if (!channelName) {
47342
+ throw new CliError({
47343
+ code: "INVALID_TARGET",
47344
+ message: "Target must be a regular channel in the form '#channel-name'. DMs and thread targets are not supported."
47345
+ });
47346
+ }
47347
+ const agentContext = ctx.loadAgentContext();
47348
+ const client = ctx.createApiClient(agentContext);
47349
+ const infoRes = await createAgentApiClient2(client, agentContext.agentId).server.info();
47350
+ if (!infoRes.ok) {
47351
+ throw new CliError({
47352
+ code: infoRes.status >= 500 ? "SERVER_5XX" : "INFO_FAILED",
47353
+ message: infoRes.error ?? `HTTP ${infoRes.status}`
47354
+ });
47355
+ }
47356
+ const channel = (infoRes.data?.channels ?? []).find((candidate) => candidate.name === channelName);
47357
+ if (!channel) {
47358
+ throw new CliError({
47359
+ code: "NOT_FOUND",
47360
+ message: `Channel not found: ${target}`
47361
+ });
47362
+ }
47363
+ const res = await client.request(
47364
+ "POST",
47365
+ `/internal/agent/${encodeURIComponent(agentContext.agentId)}/channels/${encodeURIComponent(channel.id)}/${action}`
47366
+ );
47367
+ if (!res.ok) {
47368
+ throw new CliError({
47369
+ code: res.status >= 500 ? "SERVER_5XX" : action === "mute" ? "MUTE_FAILED" : "UNMUTE_FAILED",
47370
+ message: res.error ?? `HTTP ${res.status}`,
47371
+ suggestedNextAction: res.suggestedNextAction ?? void 0
47372
+ });
47373
+ }
47374
+ writeText(ctx.io, formatChannelMuteResult(target, res.data ?? {}) + "\n");
47375
+ }
47376
+ );
47377
+ }
47378
+ var channelMuteCommand = makeChannelMuteCommand("mute");
47379
+ var channelUnmuteCommand = makeChannelMuteCommand("unmute");
47380
+ function registerChannelMuteCommand(parent, runtimeOptions) {
47381
+ registerCliCommand(parent, channelMuteCommand, runtimeOptions);
47382
+ }
47383
+ function registerChannelUnmuteCommand(parent, runtimeOptions) {
47384
+ registerCliCommand(parent, channelUnmuteCommand, runtimeOptions);
47385
+ }
47386
+ init_esm_shims();
47308
47387
  var serverInfoCommand = defineCommand(
47309
47388
  {
47310
47389
  name: "info",
@@ -50720,10 +50799,12 @@ var agentCmd = program2.command("agent").description("External agent onboarding
50720
50799
  registerAgentLoginCommand(agentCmd);
50721
50800
  registerAgentListCommand(agentCmd);
50722
50801
  registerAgentBridgeCommand(agentCmd);
50723
- var channelCmd = program2.command("channel").description("Channel membership operations");
50802
+ var channelCmd = program2.command("channel").description("Channel membership and attention operations");
50724
50803
  registerChannelMembersCommand(channelCmd);
50725
50804
  registerChannelJoinCommand(channelCmd);
50726
50805
  registerChannelLeaveCommand(channelCmd);
50806
+ registerChannelMuteCommand(channelCmd);
50807
+ registerChannelUnmuteCommand(channelCmd);
50727
50808
  var threadCmd = program2.command("thread").description("Thread attention operations");
50728
50809
  registerThreadUnfollowCommand(threadCmd);
50729
50810
  var serverCmd = program2.command("server").description("Server / workspace introspection");
package/dist/index.js CHANGED
@@ -2,11 +2,13 @@
2
2
  import {
3
3
  DAEMON_CLI_USAGE,
4
4
  DaemonCore,
5
- parseDaemonCliArgs
6
- } from "./chunk-ILFE5NTJ.js";
5
+ parseDaemonCliArgs,
6
+ scrubDaemonAuthEnv
7
+ } from "./chunk-YHGUM6IF.js";
7
8
 
8
9
  // src/index.ts
9
- var parsedArgs = parseDaemonCliArgs(process.argv.slice(2));
10
+ var parsedArgs = parseDaemonCliArgs(process.argv.slice(2), process.env);
11
+ scrubDaemonAuthEnv(process.env);
10
12
  if (!parsedArgs) {
11
13
  console.error(DAEMON_CLI_USAGE);
12
14
  process.exit(1);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@botiverse/raft-daemon",
3
- "version": "0.64.0",
3
+ "version": "0.65.0-play.20260629144133",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "raft-daemon": "dist/raft-daemon.js",