@botiverse/raft-daemon 0.61.1-play.20260618164849 → 0.62.0

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.
@@ -2582,19 +2582,6 @@ function listLegacySlockStatePaths(slockHome = resolveSlockHome(), homeDir = os.
2582
2582
  return candidates.filter((candidate) => existsSync(candidate.path));
2583
2583
  }
2584
2584
 
2585
- // src/authEnv.ts
2586
- var DAEMON_API_KEY_ENV = "SLOCK_MACHINE_API_KEY";
2587
- var SLOCK_AGENT_TOKEN_ENV = "SLOCK_AGENT_TOKEN";
2588
- function scrubDaemonAuthEnv(env) {
2589
- delete env[DAEMON_API_KEY_ENV];
2590
- return env;
2591
- }
2592
- function scrubDaemonChildEnv(env) {
2593
- delete env[DAEMON_API_KEY_ENV];
2594
- delete env[SLOCK_AGENT_TOKEN_ENV];
2595
- return env;
2596
- }
2597
-
2598
2585
  // src/agentCredentialProxy.ts
2599
2586
  import { randomBytes } from "crypto";
2600
2587
  import http from "http";
@@ -2881,6 +2868,17 @@ function reduceApmStartupTimeoutTermination(state, input) {
2881
2868
  blockedReason: null
2882
2869
  };
2883
2870
  }
2871
+ function reduceApmStartupRequestErrorTermination(state) {
2872
+ return {
2873
+ nextState: {
2874
+ ...state,
2875
+ isIdle: false,
2876
+ expectedTerminationReason: "startup_request_error",
2877
+ phase: "error"
2878
+ },
2879
+ shouldTerminate: true
2880
+ };
2881
+ }
2884
2882
  function reduceApmGatedFlush(state, input) {
2885
2883
  return {
2886
2884
  nextState: {
@@ -4150,9 +4148,7 @@ var LOOPBACK_NO_PROXY = "127.0.0.1,localhost";
4150
4148
  var CLI_TRANSPORT_TRACE_DIR_ENV = "SLOCK_CLI_TRANSPORT_TRACE_DIR";
4151
4149
  var safePathPart = (value) => value.replace(/[^a-zA-Z0-9_.-]/g, "_");
4152
4150
  var RAW_CREDENTIAL_ENV_DENYLIST = [
4153
- "SLOCK_AGENT_TOKEN",
4154
- "SLOCK_AGENT_CREDENTIAL_KEY",
4155
- "SLOCK_AGENT_CREDENTIAL_KEY_FILE"
4151
+ "SLOCK_AGENT_CREDENTIAL_KEY"
4156
4152
  ];
4157
4153
  function deriveCliFallbackCandidates(cliPath) {
4158
4154
  if (!cliPath || cliPath === "__cli") return [];
@@ -4481,7 +4477,7 @@ set "SLOCK_AGENT_ACTIVE_CAPABILITIES=${DEFAULT_ACTIVE_CAPABILITIES}"\r
4481
4477
  ...agentCredentialProxy ? {} : { SLOCK_AGENT_TOKEN_FILE: tokenFile },
4482
4478
  PATH: `${slockDir}${path2.delimiter}${process.env.PATH ?? ""}`
4483
4479
  };
4484
- scrubDaemonChildEnv(spawnEnv);
4480
+ delete spawnEnv.SLOCK_AGENT_TOKEN;
4485
4481
  for (const key of RAW_CREDENTIAL_ENV_DENYLIST) {
4486
4482
  delete spawnEnv[key];
4487
4483
  }
@@ -4916,7 +4912,7 @@ function requiresWindowsShell(command, platform = process.platform) {
4916
4912
  }
4917
4913
  function resolveCommandOnPath(command, deps = {}) {
4918
4914
  const platform = deps.platform ?? process.platform;
4919
- const env = scrubDaemonChildEnv({ ...withWindowsUserEnvironment(deps.env ?? process.env, deps) });
4915
+ const env = withWindowsUserEnvironment(deps.env ?? process.env, deps);
4920
4916
  const execFileSyncFn = deps.execFileSyncFn ?? execFileSync;
4921
4917
  const existsSyncFn = deps.existsSyncFn ?? existsSync3;
4922
4918
  if (platform === "win32") {
@@ -4942,7 +4938,7 @@ function firstExistingPath(candidates, deps = {}) {
4942
4938
  return null;
4943
4939
  }
4944
4940
  function readCommandVersion(command, args = [], deps = {}) {
4945
- const env = scrubDaemonChildEnv({ ...withWindowsUserEnvironment(deps.env ?? process.env, deps) });
4941
+ const env = withWindowsUserEnvironment(deps.env ?? process.env, deps);
4946
4942
  const execFileSyncFn = deps.execFileSyncFn ?? execFileSync;
4947
4943
  try {
4948
4944
  const output = normalizeExecOutput(execFileSyncFn(command, [...args, "--version"], {
@@ -5187,6 +5183,7 @@ import path6 from "path";
5187
5183
  // src/runtimeTurnState.ts
5188
5184
  var RuntimeTurnState = class {
5189
5185
  currentTurnId = null;
5186
+ pendingTurnId = null;
5190
5187
  /**
5191
5188
  * Post-tool window where the app-server may not yet accept stdin steering.
5192
5189
  * Gate busy-mode delivery until turn/completed or next progress.
@@ -5194,22 +5191,25 @@ var RuntimeTurnState = class {
5194
5191
  steeringGateActive = false;
5195
5192
  reset() {
5196
5193
  this.currentTurnId = null;
5194
+ this.pendingTurnId = null;
5197
5195
  this.steeringGateActive = false;
5198
5196
  }
5199
5197
  get activeTurnId() {
5200
5198
  return this.currentTurnId;
5201
5199
  }
5202
5200
  get canSteerBusy() {
5203
- return Boolean(this.currentTurnId && !this.steeringGateActive);
5201
+ return Boolean(this.currentTurnId && !this.pendingTurnId && !this.steeringGateActive);
5204
5202
  }
5205
5203
  markTurnStarted(turnId) {
5206
- if (turnId !== void 0 && turnId !== null) {
5207
- this.currentTurnId = turnId;
5204
+ const startedTurnId = turnId ?? this.pendingTurnId;
5205
+ if (startedTurnId) {
5206
+ this.currentTurnId = startedTurnId;
5208
5207
  }
5208
+ this.pendingTurnId = null;
5209
5209
  this.steeringGateActive = false;
5210
5210
  }
5211
- adoptTurnId(turnId) {
5212
- this.currentTurnId = turnId;
5211
+ noteTurnAccepted(turnId) {
5212
+ this.pendingTurnId = turnId;
5213
5213
  }
5214
5214
  markProgress() {
5215
5215
  this.steeringGateActive = false;
@@ -5219,6 +5219,7 @@ var RuntimeTurnState = class {
5219
5219
  }
5220
5220
  markTurnCompleted() {
5221
5221
  this.currentTurnId = null;
5222
+ this.pendingTurnId = null;
5222
5223
  this.steeringGateActive = false;
5223
5224
  }
5224
5225
  };
@@ -5328,6 +5329,50 @@ function codexNotificationProgressEvent(itemType, payload) {
5328
5329
  payloadBytes: payload === void 0 ? void 0 : payloadBytes(payload)
5329
5330
  };
5330
5331
  }
5332
+ function boundedString(value, limit = 1e3) {
5333
+ if (typeof value !== "string") return void 0;
5334
+ const trimmed = value.trim();
5335
+ if (!trimmed) return void 0;
5336
+ if (trimmed.length <= limit) return trimmed;
5337
+ return `${trimmed.slice(0, limit - 1)}\u2026`;
5338
+ }
5339
+ function codexNotificationDiagnosticEvent(message) {
5340
+ const params = message.params ?? {};
5341
+ let diagnosticMessage;
5342
+ let details;
5343
+ switch (message.method) {
5344
+ case "configWarning":
5345
+ diagnosticMessage = boundedString(params.summary) ?? boundedString(params.details) ?? "Codex configuration warning";
5346
+ details = boundedString(params.details);
5347
+ break;
5348
+ case "warning":
5349
+ diagnosticMessage = boundedString(params.message) ?? "Codex warning";
5350
+ break;
5351
+ case "guardianWarning":
5352
+ diagnosticMessage = boundedString(params.message) ?? "Codex guardian warning";
5353
+ break;
5354
+ case "deprecationNotice":
5355
+ diagnosticMessage = boundedString(params.summary) ?? boundedString(params.details) ?? "Codex deprecation notice";
5356
+ details = boundedString(params.details);
5357
+ break;
5358
+ default:
5359
+ return null;
5360
+ }
5361
+ const sessionId = codexMessageThreadId(message);
5362
+ const path18 = boundedString(params.path);
5363
+ return {
5364
+ kind: "runtime_diagnostic",
5365
+ severity: "warning",
5366
+ source: "codex_app_server_notification",
5367
+ itemType: message.method,
5368
+ message: diagnosticMessage,
5369
+ ...details ? { details } : {},
5370
+ ...path18 ? { path: path18 } : {},
5371
+ ...params.range !== void 0 ? { range: params.range } : {},
5372
+ payloadBytes: payloadBytes(params),
5373
+ ...sessionId ? { sessionId } : {}
5374
+ };
5375
+ }
5331
5376
  function joinReasoningSummaryText(item) {
5332
5377
  const summary = Array.isArray(item.summary) ? item.summary.filter((entry) => typeof entry === "string") : [];
5333
5378
  return summary.join("\n").trim();
@@ -5391,11 +5436,11 @@ var CodexEventNormalizer = class {
5391
5436
  }
5392
5437
  const turn = message.result.turn;
5393
5438
  if (turn && typeof turn.id === "string") {
5394
- this.turnState.adoptTurnId(turn.id);
5439
+ this.turnState.noteTurnAccepted(turn.id);
5395
5440
  return { events };
5396
5441
  }
5397
5442
  if (typeof message.result.turnId === "string") {
5398
- this.turnState.adoptTurnId(message.result.turnId);
5443
+ this.turnState.noteTurnAccepted(message.result.turnId);
5399
5444
  return { events };
5400
5445
  }
5401
5446
  }
@@ -5439,7 +5484,7 @@ var CodexEventNormalizer = class {
5439
5484
  const turnId = message.params?.turn?.id;
5440
5485
  this.turnState.markTurnStarted(typeof turnId === "string" ? turnId : null);
5441
5486
  events.push({ kind: "thinking", text: "" });
5442
- break;
5487
+ return { events, turnStarted: true };
5443
5488
  }
5444
5489
  case "item/agentMessage/delta": {
5445
5490
  const delta = message.params?.delta;
@@ -5494,7 +5539,10 @@ var CodexEventNormalizer = class {
5494
5539
  case "warning":
5495
5540
  case "guardianWarning":
5496
5541
  case "deprecationNotice": {
5497
- events.push(codexNotificationProgressEvent(message.method, message.params));
5542
+ const diagnostic = codexNotificationDiagnosticEvent(message);
5543
+ if (diagnostic) {
5544
+ events.push(diagnostic);
5545
+ }
5498
5546
  break;
5499
5547
  }
5500
5548
  case "item/started":
@@ -5820,6 +5868,8 @@ var CodexDriver = class {
5820
5868
  detectedModelsVerifiedAs: "launchable",
5821
5869
  toLaunchSpec: (modelId) => ({ params: { model: modelId } })
5822
5870
  };
5871
+ startupReadiness = "initial_turn";
5872
+ requiresSessionInitForDelivery = true;
5823
5873
  supportsStdinNotification = true;
5824
5874
  busyDeliveryMode = "direct";
5825
5875
  supportsNativeStandingPrompt = true;
@@ -5869,6 +5919,7 @@ var CodexDriver = class {
5869
5919
  pendingThreadRequestId = null;
5870
5920
  pendingThreadRequestMethod = null;
5871
5921
  pendingResumeFallbackParams = null;
5922
+ pendingInitialTurnRequestId = null;
5872
5923
  initialTurnStarted = false;
5873
5924
  normalizer = new CodexEventNormalizer();
5874
5925
  async spawn(ctx) {
@@ -5881,8 +5932,9 @@ var CodexDriver = class {
5881
5932
  this.pendingThreadRequestId = null;
5882
5933
  this.pendingThreadRequestMethod = null;
5883
5934
  this.pendingResumeFallbackParams = null;
5935
+ this.pendingInitialTurnRequestId = null;
5884
5936
  this.initialTurnStarted = false;
5885
- this.normalizer.reset({ threadId: ctx.config.sessionId || null });
5937
+ this.normalizer.reset();
5886
5938
  const args = ["app-server", "--listen", "stdio://"];
5887
5939
  const { command, args: spawnArgs, shell } = resolveCodexSpawn(args);
5888
5940
  const proc = spawn2(command, spawnArgs, {
@@ -5932,13 +5984,18 @@ var CodexDriver = class {
5932
5984
  this.pendingThreadRequestId = null;
5933
5985
  this.pendingThreadRequestMethod = null;
5934
5986
  this.pendingResumeFallbackParams = null;
5935
- events.push({ kind: "error", message: message.error?.message || "Codex app-server request failed" });
5987
+ events.push({
5988
+ kind: "error",
5989
+ message: message.error?.message || "Codex app-server request failed",
5990
+ startupRequestMethod: "initialize"
5991
+ });
5936
5992
  return events;
5937
5993
  }
5938
5994
  if (isResponse && message.id === this.pendingThreadRequestId) {
5939
5995
  if (hasJsonRpcField(message, "error")) {
5940
5996
  const errorMessage = message.error?.message || "Codex app-server request failed";
5941
- const resumeErrorClassification = this.pendingThreadRequestMethod === "thread/resume" ? classifyCodexResumeError(errorMessage) : null;
5997
+ const requestMethod = this.pendingThreadRequestMethod;
5998
+ const resumeErrorClassification = requestMethod === "thread/resume" ? classifyCodexResumeError(errorMessage) : null;
5942
5999
  if (this.pendingResumeFallbackParams && resumeErrorClassification?.kind === "missing_rollout") {
5943
6000
  events.push(resumeErrorClassification.telemetry);
5944
6001
  this.sendThreadRequest("thread/start", this.pendingResumeFallbackParams);
@@ -5948,14 +6005,31 @@ var CodexDriver = class {
5948
6005
  this.pendingThreadRequestId = null;
5949
6006
  this.pendingThreadRequestMethod = null;
5950
6007
  this.pendingResumeFallbackParams = null;
5951
- events.push({ kind: "error", message: errorMessage });
6008
+ events.push(requestMethod ? { kind: "error", message: errorMessage, startupRequestMethod: requestMethod } : { kind: "error", message: errorMessage });
5952
6009
  return events;
5953
6010
  }
5954
6011
  this.pendingThreadRequestId = null;
5955
6012
  this.pendingThreadRequestMethod = null;
5956
6013
  this.pendingResumeFallbackParams = null;
5957
6014
  }
6015
+ if (isResponse && message.id === this.pendingInitialTurnRequestId) {
6016
+ this.pendingInitialTurnRequestId = null;
6017
+ if (hasJsonRpcField(message, "error")) {
6018
+ events.push({
6019
+ kind: "error",
6020
+ message: message.error?.message || "Codex app-server request failed",
6021
+ startupRequestMethod: "turn/start"
6022
+ });
6023
+ } else {
6024
+ this.pendingInitialPrompt = null;
6025
+ }
6026
+ return events;
6027
+ }
5958
6028
  const result = this.normalizer.normalizeMessage(message);
6029
+ if (result.turnStarted) {
6030
+ this.pendingInitialTurnRequestId = null;
6031
+ this.pendingInitialPrompt = null;
6032
+ }
5959
6033
  if (result.threadReady) {
5960
6034
  this.startInitialTurn();
5961
6035
  }
@@ -5964,10 +6038,7 @@ var CodexDriver = class {
5964
6038
  get currentSessionId() {
5965
6039
  return this.normalizer.threadId;
5966
6040
  }
5967
- encodeStdinMessage(text, sessionId, opts) {
5968
- if (!this.normalizer.threadId && sessionId) {
5969
- this.normalizer.adoptThreadId(sessionId);
5970
- }
6041
+ encodeStdinMessage(text, _sessionId, opts) {
5971
6042
  if (!this.normalizer.threadId) return null;
5972
6043
  const mode = opts?.mode || "busy";
5973
6044
  if (mode === "busy") {
@@ -6008,11 +6079,10 @@ var CodexDriver = class {
6008
6079
  return this.requestId;
6009
6080
  }
6010
6081
  startInitialTurn() {
6011
- if (this.initialTurnStarted || !this.pendingInitialPrompt || !this.normalizer.threadId) return;
6082
+ if (this.initialTurnStarted || this.pendingInitialTurnRequestId !== null || !this.pendingInitialPrompt || !this.normalizer.threadId) return;
6012
6083
  this.initialTurnStarted = true;
6013
6084
  const prompt = this.pendingInitialPrompt;
6014
- this.pendingInitialPrompt = null;
6015
- this.sendRequest("turn/start", {
6085
+ this.pendingInitialTurnRequestId = this.sendRequest("turn/start", {
6016
6086
  threadId: this.normalizer.threadId,
6017
6087
  input: [{ type: "text", text: prompt }]
6018
6088
  });
@@ -6514,11 +6584,11 @@ function detectCursorModels(runCommand = runCursorModelsCommand) {
6514
6584
  return parseCursorModelsOutput(String(result.stdout || ""));
6515
6585
  }
6516
6586
  function buildCursorModelProbeEnv(deps = {}) {
6517
- return scrubDaemonChildEnv(withWindowsUserEnvironment({
6587
+ return withWindowsUserEnvironment({
6518
6588
  ...deps.env ?? process.env,
6519
6589
  FORCE_COLOR: "0",
6520
6590
  NO_COLOR: "1"
6521
- }, deps));
6591
+ }, deps);
6522
6592
  }
6523
6593
  function runCursorModelsCommand() {
6524
6594
  return spawnSync("cursor-agent", ["models"], {
@@ -6574,7 +6644,7 @@ function resolveGeminiSpawn(commandArgs, deps = {}) {
6574
6644
  }
6575
6645
  const execFileSyncFn = deps.execFileSyncFn ?? execFileSync3;
6576
6646
  const existsSyncFn = deps.existsSyncFn ?? existsSync6;
6577
- const env = scrubDaemonChildEnv({ ...deps.env ?? process.env });
6647
+ const env = deps.env ?? process.env;
6578
6648
  const winPath = path7.win32;
6579
6649
  let geminiEntry = null;
6580
6650
  try {
@@ -6711,15 +6781,12 @@ var GeminiDriver = class {
6711
6781
  // src/drivers/kimi.ts
6712
6782
  import { randomUUID as randomUUID2 } from "crypto";
6713
6783
  import { spawn as spawn7 } from "child_process";
6714
- import { chmodSync, existsSync as existsSync7, readFileSync as readFileSync3, writeFileSync as writeFileSync3 } from "fs";
6784
+ import { existsSync as existsSync7, readFileSync as readFileSync3, writeFileSync as writeFileSync3 } from "fs";
6715
6785
  import os4 from "os";
6716
6786
  import path8 from "path";
6717
6787
  var KIMI_WIRE_PROTOCOL_VERSION = "1.3";
6718
6788
  var KIMI_SYSTEM_PROMPT_FILE = ".slock-kimi-system.md";
6719
6789
  var KIMI_AGENT_FILE = ".slock-kimi-agent.yaml";
6720
- var KIMI_GENERATED_CONFIG_FILE = ".slock-kimi-config.toml";
6721
- var SLOCK_KIMI_CONFIG_CONTENT_ENV = "SLOCK_KIMI_CONFIG_CONTENT";
6722
- var SLOCK_KIMI_CONFIG_FILE_ENV = "SLOCK_KIMI_CONFIG_FILE";
6723
6790
  function parseToolArguments(raw) {
6724
6791
  if (typeof raw !== "string") return raw;
6725
6792
  try {
@@ -6728,73 +6795,6 @@ function parseToolArguments(raw) {
6728
6795
  return raw;
6729
6796
  }
6730
6797
  }
6731
- function readKimiConfigSource(home = os4.homedir(), env = process.env) {
6732
- const inlineConfig = env[SLOCK_KIMI_CONFIG_CONTENT_ENV];
6733
- if (inlineConfig && inlineConfig.trim()) {
6734
- return {
6735
- raw: inlineConfig,
6736
- explicitPath: null,
6737
- sourcePath: SLOCK_KIMI_CONFIG_CONTENT_ENV
6738
- };
6739
- }
6740
- const explicitPath = env[SLOCK_KIMI_CONFIG_FILE_ENV];
6741
- const configPath = explicitPath && explicitPath.trim() ? explicitPath : path8.join(home, ".kimi", "config.toml");
6742
- try {
6743
- return {
6744
- raw: readFileSync3(configPath, "utf8"),
6745
- explicitPath: explicitPath && explicitPath.trim() ? explicitPath : null,
6746
- sourcePath: configPath
6747
- };
6748
- } catch {
6749
- return {
6750
- raw: null,
6751
- explicitPath: explicitPath && explicitPath.trim() ? explicitPath : null,
6752
- sourcePath: configPath
6753
- };
6754
- }
6755
- }
6756
- function buildKimiSpawnEnv(env = process.env) {
6757
- const spawnEnv = { ...env, FORCE_COLOR: "0", NO_COLOR: "1" };
6758
- delete spawnEnv[SLOCK_KIMI_CONFIG_CONTENT_ENV];
6759
- delete spawnEnv[SLOCK_KIMI_CONFIG_FILE_ENV];
6760
- return scrubDaemonChildEnv(spawnEnv);
6761
- }
6762
- function buildKimiEffectiveEnv(ctx, overrideEnv) {
6763
- return {
6764
- ...process.env,
6765
- ...ctx.config.envVars || {},
6766
- ...overrideEnv || {}
6767
- };
6768
- }
6769
- function buildKimiLaunchOptions(ctx, opts = {}) {
6770
- const env = buildKimiEffectiveEnv(ctx, opts.env);
6771
- const source = readKimiConfigSource(opts.home ?? os4.homedir(), env);
6772
- const args = [];
6773
- let configFilePath = null;
6774
- let configContent = null;
6775
- if (source.explicitPath) {
6776
- configFilePath = source.explicitPath;
6777
- } else if (source.raw !== null && source.sourcePath === SLOCK_KIMI_CONFIG_CONTENT_ENV) {
6778
- configFilePath = path8.join(ctx.workingDirectory, KIMI_GENERATED_CONFIG_FILE);
6779
- configContent = source.raw;
6780
- if (opts.writeGeneratedConfig !== false) {
6781
- writeFileSync3(configFilePath, source.raw, { encoding: "utf8", mode: 384 });
6782
- chmodSync(configFilePath, 384);
6783
- }
6784
- }
6785
- if (configFilePath) {
6786
- args.push("--config-file", configFilePath);
6787
- }
6788
- if (ctx.config.model && ctx.config.model !== "default") {
6789
- args.push("--model", ctx.config.model);
6790
- }
6791
- return {
6792
- args,
6793
- env: buildKimiSpawnEnv(env),
6794
- configFilePath,
6795
- configContent
6796
- };
6797
- }
6798
6798
  function resolveKimiSpawn(commandArgs, deps = {}) {
6799
6799
  return {
6800
6800
  command: resolveCommandOnPath("kimi", deps) ?? "kimi",
@@ -6818,25 +6818,7 @@ var KimiDriver = class {
6818
6818
  };
6819
6819
  model = {
6820
6820
  detectedModelsVerifiedAs: "launchable",
6821
- toLaunchSpec: (modelId, ctx, opts) => {
6822
- if (!ctx) return { args: ["--model", modelId] };
6823
- const launchCtx = {
6824
- ...ctx,
6825
- config: {
6826
- ...ctx.config,
6827
- model: modelId
6828
- }
6829
- };
6830
- const launch = buildKimiLaunchOptions(launchCtx, {
6831
- home: opts?.home,
6832
- writeGeneratedConfig: false
6833
- });
6834
- return {
6835
- args: launch.args,
6836
- env: launch.env,
6837
- configFiles: launch.configFilePath ? [launch.configFilePath] : void 0
6838
- };
6839
- }
6821
+ toLaunchSpec: (modelId) => ({ args: ["--model", modelId] })
6840
6822
  };
6841
6823
  supportsStdinNotification = true;
6842
6824
  busyDeliveryMode = "direct";
@@ -6860,23 +6842,21 @@ var KimiDriver = class {
6860
6842
  ` system_prompt_path: ./${KIMI_SYSTEM_PROMPT_FILE}`,
6861
6843
  ""
6862
6844
  ].join("\n"), "utf8");
6863
- const launch = buildKimiLaunchOptions(ctx);
6864
6845
  const args = [
6865
6846
  "--wire",
6866
6847
  "--yolo",
6867
6848
  "--agent-file",
6868
6849
  agentFilePath,
6869
6850
  "--session",
6870
- this.sessionId,
6871
- ...launch.args
6851
+ this.sessionId
6872
6852
  ];
6873
6853
  const launchRuntimeFields = runtimeConfigToLaunchFields(ctx.config);
6874
6854
  if (launchRuntimeFields.model && launchRuntimeFields.model !== "default") {
6875
6855
  args.push("--model", launchRuntimeFields.model);
6876
6856
  }
6877
6857
  const spawnEnv = (await prepareCliTransport(ctx, { NO_COLOR: "1" })).spawnEnv;
6878
- const spawnTarget = resolveKimiSpawn(args);
6879
- const proc = spawn7(spawnTarget.command, spawnTarget.args, {
6858
+ const launch = resolveKimiSpawn(args);
6859
+ const proc = spawn7(launch.command, launch.args, {
6880
6860
  cwd: ctx.workingDirectory,
6881
6861
  stdio: ["pipe", "pipe", "pipe"],
6882
6862
  env: spawnEnv,
@@ -6884,7 +6864,7 @@ var KimiDriver = class {
6884
6864
  // and has an 8191-character command-line limit. Kimi's official
6885
6865
  // installer/uv entrypoint is an executable, so launch it directly and
6886
6866
  // keep prompts on stdin / files instead of routing through cmd.exe.
6887
- shell: spawnTarget.shell
6867
+ shell: launch.shell
6888
6868
  });
6889
6869
  proc.stdin?.write(JSON.stringify({
6890
6870
  jsonrpc: "2.0",
@@ -6997,9 +6977,14 @@ var KimiDriver = class {
6997
6977
  return detectKimiModels();
6998
6978
  }
6999
6979
  };
7000
- function detectKimiModels(home = os4.homedir(), opts = {}) {
7001
- const raw = readKimiConfigSource(home, opts.env).raw;
7002
- if (raw === null) return null;
6980
+ function detectKimiModels(home = os4.homedir()) {
6981
+ const configPath = path8.join(home, ".kimi", "config.toml");
6982
+ let raw;
6983
+ try {
6984
+ raw = readFileSync3(configPath, "utf8");
6985
+ } catch {
6986
+ return null;
6987
+ }
7003
6988
  const models = [];
7004
6989
  const sectionRe = /^\s*\[models(?:\.([^\]]+)|"\.[^"]+"|\."[^"]+")\s*\]\s*$/gm;
7005
6990
  const lineRe = /^\s*\[models\.(.+?)\s*\]\s*$/gm;
@@ -7723,7 +7708,7 @@ function runOpenCodeModelsCommand(home, deps = {}) {
7723
7708
  const platform = deps.platform ?? process.platform;
7724
7709
  const spawnSyncFn = deps.spawnSyncFn ?? spawnSync2;
7725
7710
  const result = spawnSyncFn("opencode", ["models"], {
7726
- env: scrubDaemonChildEnv({ ...process.env, HOME: home, FORCE_COLOR: "0", NO_COLOR: "1" }),
7711
+ env: { ...process.env, HOME: home, FORCE_COLOR: "0", NO_COLOR: "1" },
7727
7712
  encoding: "utf8",
7728
7713
  timeout: 5e3,
7729
7714
  shell: platform === "win32"
@@ -10270,6 +10255,63 @@ function closeSatisfiedTurnBoundary(ap, expectedTermination) {
10270
10255
  if (ap.runtime.descriptor.turnBoundary === "process_exit") return true;
10271
10256
  return !ap.runtimeTraceSpan;
10272
10257
  }
10258
+ function isStartupRequestErrorEvent(event) {
10259
+ return event.kind === "error" && !!event.startupRequestMethod;
10260
+ }
10261
+ function runtimeDiagnosticTitle(event) {
10262
+ switch (event.itemType) {
10263
+ case "configWarning":
10264
+ return "Codex config warning";
10265
+ case "guardianWarning":
10266
+ return "Codex guardian warning";
10267
+ case "deprecationNotice":
10268
+ return "Codex deprecation notice";
10269
+ default:
10270
+ return "Codex warning";
10271
+ }
10272
+ }
10273
+ function summarizeDiagnosticRange(range) {
10274
+ if (range === void 0 || range === null) return null;
10275
+ try {
10276
+ const json = JSON.stringify(range);
10277
+ if (!json) return null;
10278
+ return json.length <= 300 ? json : `${json.slice(0, 299)}\u2026`;
10279
+ } catch {
10280
+ return null;
10281
+ }
10282
+ }
10283
+ function runtimeDiagnosticTrajectoryEntry(event) {
10284
+ const lines = [event.message];
10285
+ if (event.details && event.details !== event.message) {
10286
+ lines.push(event.details);
10287
+ }
10288
+ if (event.path) {
10289
+ lines.push(`Path: ${event.path}`);
10290
+ }
10291
+ const range = summarizeDiagnosticRange(event.range);
10292
+ if (range) {
10293
+ lines.push(`Range: ${range}`);
10294
+ }
10295
+ return {
10296
+ kind: "system",
10297
+ title: runtimeDiagnosticTitle(event),
10298
+ text: lines.join("\n")
10299
+ };
10300
+ }
10301
+ function runtimeDiagnosticTraceAttrs(event) {
10302
+ return {
10303
+ kind: event.kind,
10304
+ severity: event.severity,
10305
+ source: event.source,
10306
+ itemType: event.itemType,
10307
+ payloadBytes: event.payloadBytes,
10308
+ message_present: Boolean(event.message),
10309
+ details_present: Boolean(event.details),
10310
+ path_present: Boolean(event.path),
10311
+ range_present: event.range !== void 0,
10312
+ session_id_present: Boolean(event.sessionId)
10313
+ };
10314
+ }
10273
10315
  function currentErrorCandidates(ap) {
10274
10316
  return [
10275
10317
  ap.runtimeErrorSinceProgress ? ap.lastRuntimeError : null,
@@ -11193,6 +11235,23 @@ var AgentProcessManager = class _AgentProcessManager {
11193
11235
  clientSeq: ap ? this.nextActivityClientSeq(agentId) : void 0
11194
11236
  });
11195
11237
  }
11238
+ recordRuntimeDiagnosticActivity(agentId, ap, event) {
11239
+ this.sendToServer({
11240
+ type: "agent:activity",
11241
+ agentId,
11242
+ activity: ap.lastActivity || "online",
11243
+ detail: ap.lastActivityDetail || "",
11244
+ entries: [runtimeDiagnosticTrajectoryEntry(event)],
11245
+ launchId: ap.launchId || void 0,
11246
+ clientSeq: this.nextActivityClientSeq(agentId)
11247
+ });
11248
+ this.recordDaemonTrace("daemon.runtime.diagnostic", {
11249
+ agentId,
11250
+ launchId: ap.launchId || void 0,
11251
+ runtime: ap.config.runtime,
11252
+ ...runtimeDiagnosticTraceAttrs(event)
11253
+ });
11254
+ }
11196
11255
  recordDaemonTrace(name, attrs, status = "ok", parentTraceparent) {
11197
11256
  const span = this.tracer.startSpan(name, {
11198
11257
  parent: parseTraceparent(parentTraceparent),
@@ -11258,6 +11317,13 @@ var AgentProcessManager = class _AgentProcessManager {
11258
11317
  session_id_present: Boolean(sessionId)
11259
11318
  });
11260
11319
  }
11320
+ initialAgentProcessSessionId(driver, config) {
11321
+ if (driver.requiresSessionInitForDelivery) return null;
11322
+ return config.sessionId || null;
11323
+ }
11324
+ restartSafeSessionId(ap) {
11325
+ return ap.sessionId || (ap.driver.requiresSessionInitForDelivery ? ap.config.sessionId || null : null);
11326
+ }
11261
11327
  sameWakeMessage(left, right) {
11262
11328
  if (!left || !right) return left === right;
11263
11329
  if (left.message_id && right.message_id) return left.message_id === right.message_id;
@@ -11302,16 +11368,18 @@ var AgentProcessManager = class _AgentProcessManager {
11302
11368
  }
11303
11369
  const previousLaunchId = ap.launchId;
11304
11370
  const nextLaunchId = start.launchId || ap.launchId || null;
11305
- const nextSessionId = ap.sessionId || start.config.sessionId || null;
11371
+ const requiresSessionInit = ap.driver.requiresSessionInitForDelivery === true;
11372
+ const nextSessionId = ap.sessionId || (requiresSessionInit ? null : start.config.sessionId || null);
11373
+ const nextConfigSessionId = nextSessionId || (requiresSessionInit ? start.config.sessionId || null : ap.config.sessionId || start.config.sessionId || null);
11306
11374
  ap.launchId = nextLaunchId;
11307
11375
  ap.sessionId = nextSessionId;
11308
11376
  ap.config = {
11309
11377
  ...start.config,
11310
- sessionId: nextSessionId
11378
+ sessionId: nextConfigSessionId
11311
11379
  };
11312
11380
  this.idleAgentConfigs.set(agentId, {
11313
- config: this.buildRestartSafeConfig(ap.config, nextSessionId),
11314
- sessionId: nextSessionId,
11381
+ config: this.buildRestartSafeConfig(ap.config, nextConfigSessionId),
11382
+ sessionId: nextConfigSessionId,
11315
11383
  launchId: nextLaunchId
11316
11384
  });
11317
11385
  this.recordStartRebind(agentId, start, reason, previousLaunchId, nextLaunchId, nextSessionId);
@@ -11706,12 +11774,14 @@ Use ${communicationCommand("read_history")} to catch up on the channels listed a
11706
11774
  agentCredentialKey: effectiveConfig.agentCredentialKey,
11707
11775
  agentCredentialId: effectiveConfig.agentCredentialId
11708
11776
  };
11777
+ const initialSessionId = this.initialAgentProcessSessionId(driver, liveProcessConfig);
11778
+ const restartSessionId = initialSessionId || (driver.requiresSessionInitForDelivery ? liveProcessConfig.sessionId || null : null);
11709
11779
  agentProcess = {
11710
11780
  runtime,
11711
11781
  driver,
11712
11782
  inbox: wakeMessageDeliveredAsInboxUpdate && wakeMessage ? [wakeMessage, ...startingInboxMessages] : startingInboxMessages,
11713
11783
  config: liveProcessConfig,
11714
- sessionId: liveProcessConfig.sessionId || null,
11784
+ sessionId: initialSessionId,
11715
11785
  launchId: effectiveLaunchId,
11716
11786
  startupWakeMessage: wakeMessage,
11717
11787
  startupUnreadSummary: unreadSummary,
@@ -11719,6 +11789,7 @@ Use ${communicationCommand("read_history")} to catch up on the channels listed a
11719
11789
  notifications: new RuntimeNotificationState(),
11720
11790
  activityHeartbeat: null,
11721
11791
  startupTimeoutTimer: null,
11792
+ startupReadinessSatisfied: false,
11722
11793
  compactionWatchdog: null,
11723
11794
  compactionStartedAt: null,
11724
11795
  runtimeProgress: new RuntimeProgressState(Date.now()),
@@ -11744,8 +11815,8 @@ Use ${communicationCommand("read_history")} to catch up on the channels listed a
11744
11815
  this.startingInboxes.delete(agentId);
11745
11816
  this.agents.set(agentId, agentProcess);
11746
11817
  this.idleAgentConfigs.set(agentId, {
11747
- config: this.buildRestartSafeConfig(runtimeConfig, runtimeConfig.sessionId || null),
11748
- sessionId: runtimeConfig.sessionId || null,
11818
+ config: this.buildRestartSafeConfig(runtimeConfig, restartSessionId),
11819
+ sessionId: restartSessionId,
11749
11820
  launchId: effectiveLaunchId
11750
11821
  });
11751
11822
  if (pendingStartRebind) {
@@ -11853,11 +11924,12 @@ Use ${communicationCommand("read_history")} to catch up on the channels listed a
11853
11924
  const finalSignal = ap.exitSignal ?? signal;
11854
11925
  const expectedTerminationReason = ap.gatedSteering.expectedTerminationReason;
11855
11926
  const startupTimeoutTermination = expectedTerminationReason === "startup_timeout";
11927
+ const startupRequestErrorTermination = expectedTerminationReason === "startup_request_error";
11856
11928
  const expectedTermination = Boolean(expectedTerminationReason);
11857
11929
  const stickyTerminalFailureDetail = classifyStickyTerminalFailure(ap);
11858
11930
  const turnBoundarySatisfied = closeSatisfiedTurnBoundary(ap, expectedTermination);
11859
11931
  const closeBeforeTurnBoundary = !turnBoundarySatisfied;
11860
- const processEndedCleanly = !stickyTerminalFailureDetail && !startupTimeoutTermination && (finalCode === 0 && turnBoundarySatisfied || expectedTermination && !ap.lastRuntimeError);
11932
+ const processEndedCleanly = !stickyTerminalFailureDetail && !startupTimeoutTermination && !startupRequestErrorTermination && (finalCode === 0 && turnBoundarySatisfied || expectedTermination && !ap.lastRuntimeError);
11861
11933
  const terminalFailureDetail = processEndedCleanly ? null : stickyTerminalFailureDetail ?? classifyTerminalFailure(ap);
11862
11934
  const resumeRecoveryReason = resumeSessionRecoveryReason(ap);
11863
11935
  const shouldColdStartResumeSession = resumeRecoveryReason !== null;
@@ -11966,13 +12038,16 @@ Use ${communicationCommand("read_history")} to catch up on the channels listed a
11966
12038
  } else if (startupTimeoutTermination) {
11967
12039
  this.cacheStartupTimeoutRetryConfig(agentId, ap);
11968
12040
  logger.warn(`[Agent ${agentId}] Startup timeout cleanup completed (${reason})`);
12041
+ } else if (startupRequestErrorTermination) {
12042
+ this.idleAgentConfigs.delete(agentId);
12043
+ logger.warn(`[Agent ${agentId}] Startup request failure cleanup completed (${reason})`);
11969
12044
  } else {
11970
12045
  this.idleAgentConfigs.delete(agentId);
11971
12046
  logger.error(`[Agent ${agentId}] Process crashed (${reason}) \u2014 marking inactive`);
11972
12047
  this.sendAgentStatus(agentId, "inactive", ap.launchId);
11973
12048
  }
11974
12049
  if (terminalFailureDetail) {
11975
- if (!startupTimeoutTermination) {
12050
+ if (!startupTimeoutTermination && !startupRequestErrorTermination) {
11976
12051
  this.broadcastActivity(
11977
12052
  agentId,
11978
12053
  "error",
@@ -11981,7 +12056,7 @@ Use ${communicationCommand("read_history")} to catch up on the channels listed a
11981
12056
  ap.launchId
11982
12057
  );
11983
12058
  }
11984
- } else {
12059
+ } else if (!startupRequestErrorTermination) {
11985
12060
  this.broadcastActivity(agentId, "offline", `Crashed (${summary})`, [], ap.launchId);
11986
12061
  }
11987
12062
  }
@@ -12100,10 +12175,11 @@ Use ${communicationCommand("read_history")} to catch up on the channels listed a
12100
12175
  });
12101
12176
  }
12102
12177
  cacheStartupTimeoutRetryConfig(agentId, ap) {
12103
- const retryConfig = this.buildRestartSafeConfig(ap.config, ap.sessionId);
12178
+ const retrySessionId = this.restartSafeSessionId(ap);
12179
+ const retryConfig = this.buildRestartSafeConfig(ap.config, retrySessionId);
12104
12180
  this.idleAgentConfigs.set(agentId, {
12105
12181
  config: retryConfig,
12106
- sessionId: ap.sessionId,
12182
+ sessionId: retrySessionId,
12107
12183
  launchId: ap.launchId
12108
12184
  });
12109
12185
  this.recordDaemonTrace("daemon.agent.startup_timeout.retry_config_cached", {
@@ -14090,11 +14166,17 @@ Use ${communicationCommand("read_history")} to catch up on the channels listed a
14090
14166
  clearTimeout(ap.startupTimeoutTimer);
14091
14167
  ap.startupTimeoutTimer = null;
14092
14168
  }
14169
+ runtimeStartupReadinessSatisfiedByEvent(ap, event) {
14170
+ if ((ap.driver.startupReadiness ?? "first_event") !== "initial_turn") {
14171
+ return true;
14172
+ }
14173
+ return event.kind !== "session_init" && event.kind !== "internal_progress" && event.kind !== "runtime_diagnostic";
14174
+ }
14093
14175
  handleRuntimeStartupTimeout(agentId, ap, timeoutMs) {
14094
14176
  const current = this.agents.get(agentId);
14095
14177
  if (current !== ap) return;
14096
14178
  const reduction = reduceApmStartupTimeoutTermination(ap.gatedSteering, {
14097
- hasRuntimeProgressEvent: Boolean(ap.runtimeProgress.lastEventKind)
14179
+ hasRuntimeProgressEvent: ap.startupReadinessSatisfied
14098
14180
  });
14099
14181
  if (!reduction.shouldTerminate) {
14100
14182
  this.clearRuntimeStartupTimeout(ap);
@@ -14122,7 +14204,7 @@ Use ${communicationCommand("read_history")} to catch up on the channels listed a
14122
14204
  ...runtimeTraceCounterAttrs(ap),
14123
14205
  ...this.finalizeRuntimeProfileTurnControl(agentId, ap, "runtime_stalled")
14124
14206
  });
14125
- logger.warn(`[Agent ${agentId}] ${ap.driver.id} did not emit a startup runtime event within ${timeoutMs}ms; terminating process`);
14207
+ logger.warn(`[Agent ${agentId}] ${ap.driver.id} did not reach startup readiness within ${timeoutMs}ms; terminating process`);
14126
14208
  this.broadcastActivity(agentId, "error", detail, [{ kind: "text", text: `Error: ${detail}` }], ap.launchId);
14127
14209
  this.sendAgentStatus(agentId, "inactive", ap.launchId);
14128
14210
  this.cacheStartupTimeoutRetryConfig(agentId, ap);
@@ -14134,6 +14216,63 @@ Use ${communicationCommand("read_history")} to catch up on the channels listed a
14134
14216
  logger.warn(`[Agent ${agentId}] Failed to terminate startup-timed-out ${ap.driver.id} process: ${reason}`);
14135
14217
  }
14136
14218
  }
14219
+ handleRuntimeStartupRequestError(agentId, ap, event) {
14220
+ const current = this.agents.get(agentId);
14221
+ if (current !== ap) return;
14222
+ this.clearRuntimeStartupTimeout(ap);
14223
+ this.interruptCompactionIfActive(agentId);
14224
+ this.interruptReviewIfActive(agentId);
14225
+ this.flushPendingTrajectory(agentId);
14226
+ const reduction = reduceApmStartupRequestErrorTermination(ap.gatedSteering);
14227
+ this.commitGatedSteeringDecisionState(agentId, ap, reduction.nextState, { event: "startup_request_error" });
14228
+ ap.lastRuntimeError = event.message;
14229
+ ap.runtimeErrorSinceProgress = true;
14230
+ ap.runtimeProgress.markStale();
14231
+ ap.notifications.clearPending();
14232
+ ap.notifications.clearTimer();
14233
+ const diagnostics = buildRuntimeErrorDiagnosticEnvelope(event.message);
14234
+ const visibleErrorMessage = diagnostics.spanAttrs.runtime_error_action_required === true ? formatRuntimeLoginRequiredMessage(ap.driver.id) : event.message;
14235
+ const failureAttrs = {
14236
+ turn_outcome: "failed",
14237
+ turn_subtype: "runtime_start_failed",
14238
+ turn_reason: "startup_request_error",
14239
+ runtime_start_failure_kind: "startup_request_error",
14240
+ startup_request_method: event.startupRequestMethod,
14241
+ ...diagnostics.eventAttrs
14242
+ };
14243
+ this.noteRuntimeTraceCounter(ap, event);
14244
+ this.recordRuntimeTraceEvent(agentId, ap, "runtime.event.received", {
14245
+ kind: event.kind,
14246
+ startup_request_method: event.startupRequestMethod
14247
+ });
14248
+ this.recordRuntimeTraceEvent(agentId, ap, "runtime.start.request_failed", failureAttrs);
14249
+ this.endRuntimeTrace(ap, "error", {
14250
+ ...failureAttrs,
14251
+ ...diagnostics.spanAttrs,
14252
+ ...runtimeTraceCounterAttrs(ap),
14253
+ ...this.finalizeRuntimeProfileTurnControl(agentId, ap, "runtime_error")
14254
+ });
14255
+ logger.warn(
14256
+ `[Agent ${agentId}] ${ap.driver.id} startup request ${event.startupRequestMethod} failed; terminating unusable runtime process`
14257
+ );
14258
+ this.broadcastActivity(agentId, "error", visibleErrorMessage, [
14259
+ { kind: "text", text: `Error: ${visibleErrorMessage}` }
14260
+ ], ap.launchId);
14261
+ this.sendAgentStatus(agentId, "inactive", ap.launchId);
14262
+ this.idleAgentConfigs.delete(agentId);
14263
+ try {
14264
+ this.runtimeExitTraceAttrs.set(ap.runtime, {
14265
+ stop_source: "startup_request_error",
14266
+ expectedTerminationReason: "startup_request_error",
14267
+ startup_request_method: event.startupRequestMethod,
14268
+ runtime_error_class: diagnostics.spanAttrs.runtime_error_class
14269
+ });
14270
+ void ap.runtime.stop({ signal: "SIGTERM", reason: "startup_request_error" });
14271
+ } catch (err) {
14272
+ const reason = err instanceof Error ? err.message : String(err);
14273
+ logger.warn(`[Agent ${agentId}] Failed to terminate startup-failed ${ap.driver.id} process: ${reason}`);
14274
+ }
14275
+ }
14137
14276
  isThinkingBlockMutationError(message) {
14138
14277
  return /thinking.*redacted_thinking|redacted_thinking.*thinking/i.test(message) && /cannot be modified/i.test(message) || /messages\.\d+\.content\.\d+\.text\.start_timestamp:\s*Extra inputs are not permitted/i.test(message);
14139
14278
  }
@@ -14227,16 +14366,23 @@ Use ${communicationCommand("read_history")} to catch up on the channels listed a
14227
14366
  if (ap) this.recordRuntimeTelemetry(agentId, ap, event);
14228
14367
  return;
14229
14368
  }
14369
+ if (ap && isStartupRequestErrorEvent(event)) {
14370
+ this.handleRuntimeStartupRequestError(agentId, ap, event);
14371
+ return;
14372
+ }
14230
14373
  if (ap) {
14231
14374
  const wasStalled = ap.runtimeProgress.isStale;
14232
- this.clearRuntimeStartupTimeout(ap);
14375
+ if (this.runtimeStartupReadinessSatisfiedByEvent(ap, event)) {
14376
+ ap.startupReadinessSatisfied = true;
14377
+ this.clearRuntimeStartupTimeout(ap);
14378
+ }
14233
14379
  this.noteRuntimeTraceCounter(ap, event);
14234
14380
  const eventAttrs = event.kind === "internal_progress" ? {
14235
14381
  kind: event.kind,
14236
14382
  source: event.source,
14237
14383
  itemType: event.itemType,
14238
14384
  payloadBytes: event.payloadBytes
14239
- } : { kind: event.kind };
14385
+ } : event.kind === "runtime_diagnostic" ? runtimeDiagnosticTraceAttrs(event) : { kind: event.kind };
14240
14386
  this.recordRuntimeTraceEvent(agentId, ap, "runtime.event.received", eventAttrs);
14241
14387
  if (wasStalled) {
14242
14388
  this.recordRuntimeTraceEvent(agentId, ap, "runtime.progress.observed", { afterStall: true });
@@ -14257,6 +14403,12 @@ Use ${communicationCommand("read_history")} to catch up on the channels listed a
14257
14403
  });
14258
14404
  return;
14259
14405
  }
14406
+ if (event.kind === "runtime_diagnostic") {
14407
+ this.noteRuntimeProgress(ap, event.kind);
14408
+ this.clearRuntimeErrorDeliveryBackoffAfterProgress(agentId, ap, event.kind);
14409
+ this.recordRuntimeDiagnosticActivity(agentId, ap, event);
14410
+ return;
14411
+ }
14260
14412
  this.noteRuntimeProgress(ap, event.kind);
14261
14413
  } else if (event.kind !== "internal_progress") {
14262
14414
  this.recordDaemonTrace("daemon.agent.event.received_without_process", {
@@ -15973,7 +16125,7 @@ var DAEMON_CORE_TRACE_ATTR_CONTRACTS = {
15973
16125
  spanAttrs: ["agentId", "event_kind", "runtime"]
15974
16126
  }
15975
16127
  };
15976
- var DAEMON_CLI_USAGE = `Usage: slock-daemon --server-url <url> (--api-key <key> or ${DAEMON_API_KEY_ENV}=<key>)`;
16128
+ var DAEMON_CLI_USAGE = "Usage: slock-daemon --server-url <url> --api-key <key>";
15977
16129
  var RunnerCredentialMintError2 = class extends Error {
15978
16130
  code;
15979
16131
  retryable;
@@ -16009,9 +16161,9 @@ function runnerCredentialErrorDetail2(error) {
16009
16161
  async function waitForRunnerCredentialRetry2() {
16010
16162
  await new Promise((resolve) => setTimeout(resolve, RUNNER_CREDENTIAL_MINT_RETRY_DELAY_MS2));
16011
16163
  }
16012
- function parseDaemonCliArgs(args, env = {}) {
16164
+ function parseDaemonCliArgs(args) {
16013
16165
  let serverUrl = "";
16014
- let apiKey = env[DAEMON_API_KEY_ENV] ?? "";
16166
+ let apiKey = "";
16015
16167
  for (let i = 0; i < args.length; i++) {
16016
16168
  if (args[i] === "--server-url" && args[i + 1]) serverUrl = args[++i];
16017
16169
  if (args[i] === "--api-key" && args[i + 1]) apiKey = args[++i];
@@ -16048,7 +16200,7 @@ function resolveSlockCliPathOrEmpty(moduleUrl = import.meta.url) {
16048
16200
  }
16049
16201
  async function runBundledSlockCli(argv) {
16050
16202
  process.argv = [process.execPath, "slock", ...argv];
16051
- await import("./dist-MX4RLAAQ.js");
16203
+ await import("./dist-DSRBN3VD.js");
16052
16204
  }
16053
16205
  function detectRuntimes(tracer = noopTracer) {
16054
16206
  const ids = [];
@@ -16925,8 +17077,6 @@ var DaemonCore = class {
16925
17077
 
16926
17078
  export {
16927
17079
  subscribeDaemonLogs,
16928
- DAEMON_API_KEY_ENV,
16929
- scrubDaemonAuthEnv,
16930
17080
  resolveWorkspaceDirectoryPath,
16931
17081
  scanWorkspaceDirectories,
16932
17082
  deleteWorkspaceDirectory,
package/dist/cli/index.js CHANGED
@@ -19688,6 +19688,7 @@ function formatAgentProfile(profile) {
19688
19688
  `- Display Name: ${profile.displayName ?? "(none)"}`,
19689
19689
  `- Description: ${profile.description ?? "(none)"}`,
19690
19690
  `- Status: ${profile.status}`,
19691
+ `- Role: ${profile.serverRole}`,
19691
19692
  `- Runtime: ${getRuntimeDisplayName(profile.runtime)}`,
19692
19693
  `- Model: ${profile.model}`,
19693
19694
  `- Reasoning: ${profile.reasoningEffort ?? "medium"}`
package/dist/core.js CHANGED
@@ -1,5 +1,4 @@
1
1
  import {
2
- DAEMON_API_KEY_ENV,
3
2
  DAEMON_CLI_USAGE,
4
3
  DaemonCore,
5
4
  deleteWorkspaceDirectory,
@@ -11,11 +10,9 @@ import {
11
10
  resolveWorkspaceDirectoryPath,
12
11
  runBundledSlockCli,
13
12
  scanWorkspaceDirectories,
14
- scrubDaemonAuthEnv,
15
13
  subscribeDaemonLogs
16
- } from "./chunk-NPNWIWXT.js";
14
+ } from "./chunk-H3G23UPM.js";
17
15
  export {
18
- DAEMON_API_KEY_ENV,
19
16
  DAEMON_CLI_USAGE,
20
17
  DaemonCore,
21
18
  deleteWorkspaceDirectory,
@@ -27,6 +24,5 @@ export {
27
24
  resolveWorkspaceDirectoryPath,
28
25
  runBundledSlockCli,
29
26
  scanWorkspaceDirectories,
30
- scrubDaemonAuthEnv,
31
27
  subscribeDaemonLogs
32
28
  };
@@ -19409,6 +19409,7 @@ function formatAgentProfile(profile) {
19409
19409
  `- Display Name: ${profile.displayName ?? "(none)"}`,
19410
19410
  `- Description: ${profile.description ?? "(none)"}`,
19411
19411
  `- Status: ${profile.status}`,
19412
+ `- Role: ${profile.serverRole}`,
19412
19413
  `- Runtime: ${getRuntimeDisplayName(profile.runtime)}`,
19413
19414
  `- Model: ${profile.model}`,
19414
19415
  `- Reasoning: ${profile.reasoningEffort ?? "medium"}`
package/dist/index.js CHANGED
@@ -2,13 +2,11 @@
2
2
  import {
3
3
  DAEMON_CLI_USAGE,
4
4
  DaemonCore,
5
- parseDaemonCliArgs,
6
- scrubDaemonAuthEnv
7
- } from "./chunk-NPNWIWXT.js";
5
+ parseDaemonCliArgs
6
+ } from "./chunk-H3G23UPM.js";
8
7
 
9
8
  // src/index.ts
10
- var parsedArgs = parseDaemonCliArgs(process.argv.slice(2), process.env);
11
- scrubDaemonAuthEnv(process.env);
9
+ var parsedArgs = parseDaemonCliArgs(process.argv.slice(2));
12
10
  if (!parsedArgs) {
13
11
  console.error(DAEMON_CLI_USAGE);
14
12
  process.exit(1);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@botiverse/raft-daemon",
3
- "version": "0.61.1-play.20260618164849",
3
+ "version": "0.62.0",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "raft-daemon": "dist/raft-daemon.js",