@botiverse/raft-daemon 0.72.7-play.20260712141058 → 0.72.8

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.
@@ -1368,7 +1368,12 @@ var PROMOTED_IDENTITY_ATTRS = [
1368
1368
  "request_id",
1369
1369
  "operation_id",
1370
1370
  "route_pattern",
1371
- "caller_kind"
1371
+ "caller_kind",
1372
+ "db_system",
1373
+ "query_name",
1374
+ "inbox_backend",
1375
+ "inbox_route",
1376
+ "inbox_fallback_reason"
1372
1377
  ];
1373
1378
  var PROMOTED_CLOSED_ATTRS = [
1374
1379
  "router_reason",
@@ -1390,6 +1395,15 @@ var PROMOTED_CLOSED_ATTRS = [
1390
1395
  "repair_kind",
1391
1396
  "action",
1392
1397
  "error_class",
1398
+ "error_kind",
1399
+ "error_subkind",
1400
+ "rw_failure_stage",
1401
+ "sqlstate",
1402
+ "driver_code",
1403
+ "rw_breaker_state",
1404
+ "fallback_target",
1405
+ "fallback_outcome",
1406
+ "terminal_status",
1393
1407
  "status_bucket",
1394
1408
  "shadow_agent_id",
1395
1409
  "shadow_signal_site",
@@ -2019,13 +2033,20 @@ var integrationUpdateAppRegistrationOperationSchema = integrationAppDraftFieldsS
2019
2033
  unsafeDemoUrlOverride: z.boolean().optional(),
2020
2034
  draftHint: draftHintSchema
2021
2035
  });
2036
+ var integrationRecoverAppOwnerOperationSchema = z.object({
2037
+ type: z.literal("integration:recover_app_owner"),
2038
+ clientKey: z.string().trim().min(1).max(120),
2039
+ targetAgent: z.string().trim().min(1).max(120),
2040
+ draftHint: draftHintSchema
2041
+ });
2022
2042
  var actionCardActionSchema = z.discriminatedUnion("type", [
2023
2043
  channelCreateOperationSchema,
2024
2044
  agentCreateOperationSchema,
2025
2045
  channelAddMemberOperationSchema,
2026
2046
  integrationApproveAgentLoginOperationSchema,
2027
2047
  integrationRegisterAppOperationSchema,
2028
- integrationUpdateAppRegistrationOperationSchema
2048
+ integrationUpdateAppRegistrationOperationSchema,
2049
+ integrationRecoverAppOwnerOperationSchema
2029
2050
  ]);
2030
2051
 
2031
2052
  // ../shared/src/featureFlagRolloutGuardrail.ts
@@ -2299,7 +2320,11 @@ var agentApiTaskCreateBodySchema = passthroughObject({
2299
2320
  channel: z3.string().trim().min(1),
2300
2321
  tasks: z3.array(passthroughObject({
2301
2322
  title: z3.string().trim().min(1)
2302
- })).min(1)
2323
+ })).min(1),
2324
+ assignee: z3.string().trim().refine(
2325
+ (value) => value.startsWith("@") && value.slice(1).trim().length > 0,
2326
+ { message: "assignee must be an @handle" }
2327
+ ).optional()
2303
2328
  });
2304
2329
  var agentApiTaskUnclaimBodySchema = passthroughObject({
2305
2330
  channel: z3.string().trim().min(1),
@@ -2431,6 +2456,20 @@ var agentApiIntegrationAppPrepareBodySchema = passthroughObject({
2431
2456
  var agentApiIntegrationAppRotateSecretBodySchema = passthroughObject({
2432
2457
  clientKey: z3.string().trim().min(1)
2433
2458
  });
2459
+ var agentApiIntegrationAppTransferOwnerBodySchema = passthroughObject({
2460
+ clientKey: z3.string().trim().min(1),
2461
+ targetAgent: z3.string().trim().min(1)
2462
+ });
2463
+ var agentApiIntegrationAppUpdateBodySchema = passthroughObject({
2464
+ clientKey: z3.string().trim().min(1),
2465
+ name: optionalStringSchema,
2466
+ description: optionalStringSchema,
2467
+ homepageUrl: optionalStringSchema,
2468
+ returnUrl: optionalStringSchema,
2469
+ agentManifestUrl: optionalStringSchema,
2470
+ scopes: optionalStringArraySchema,
2471
+ unsafeDemoUrlOverride: optionalBooleanSchema
2472
+ });
2434
2473
  var agentApiActionPrepareBodySchema = passthroughObject({
2435
2474
  target: z3.string().trim().min(1),
2436
2475
  action: actionCardActionSchema
@@ -2572,6 +2611,19 @@ var agentApiIntegrationAppRotateSecretResponseSchema = passthroughObject({
2572
2611
  clientName: z3.string(),
2573
2612
  clientSecret: z3.string()
2574
2613
  });
2614
+ var agentApiIntegrationAppTransferOwnerResponseSchema = passthroughObject({
2615
+ clientId: z3.string(),
2616
+ clientKey: z3.string(),
2617
+ clientName: z3.string(),
2618
+ ownerAgentId: z3.string(),
2619
+ ownerAgentName: z3.string()
2620
+ });
2621
+ var agentApiIntegrationAppUpdateResponseSchema = passthroughObject({
2622
+ clientId: z3.string(),
2623
+ clientKey: z3.string(),
2624
+ clientName: z3.string(),
2625
+ updatedFields: z3.array(z3.string())
2626
+ });
2575
2627
  var agentApiAttachmentEnvelopeSchema = passthroughObject({
2576
2628
  id: z3.string(),
2577
2629
  filename: z3.string()
@@ -2789,10 +2841,21 @@ var agentApiTaskListResponseSchema = passthroughObject({
2789
2841
  var agentApiCreatedTaskEnvelopeSchema = passthroughObject({
2790
2842
  taskNumber: z3.number().int().positive(),
2791
2843
  messageId: z3.string(),
2792
- title: z3.string()
2844
+ title: z3.string(),
2845
+ status: taskStatusSchema,
2846
+ claimedByType: z3.enum(["user", "agent"]).nullable(),
2847
+ claimedById: z3.string().nullable(),
2848
+ claimedAt: z3.string().datetime().nullable()
2849
+ });
2850
+ var agentApiTaskAssignmentReceiptSchema = passthroughObject({
2851
+ messageId: z3.string(),
2852
+ content: z3.string(),
2853
+ assignee: z3.string().startsWith("@"),
2854
+ state: z3.enum(["started", "assigned"])
2793
2855
  });
2794
2856
  var agentApiTaskCreateResponseSchema = passthroughObject({
2795
- tasks: z3.array(agentApiCreatedTaskEnvelopeSchema)
2857
+ tasks: z3.array(agentApiCreatedTaskEnvelopeSchema),
2858
+ assignmentReceipt: agentApiTaskAssignmentReceiptSchema.optional()
2796
2859
  });
2797
2860
  var agentApiTaskUnclaimResponseSchema = passthroughObject({
2798
2861
  ok: z3.literal(true)
@@ -3334,6 +3397,26 @@ var agentApiContract = {
3334
3397
  request: { body: agentApiIntegrationAppRotateSecretBodySchema },
3335
3398
  response: { body: agentApiIntegrationAppRotateSecretResponseSchema }
3336
3399
  }),
3400
+ integrationAppTransferOwner: route({
3401
+ key: "integrationAppTransferOwner",
3402
+ method: "POST",
3403
+ path: "/integrations/app/transfer-owner",
3404
+ client: { resource: "integrations", method: "transferAppOwner" },
3405
+ capability: "read",
3406
+ description: "Transfer a server-local integration app to another same-server agent. Only the current app owner may transfer it.",
3407
+ request: { body: agentApiIntegrationAppTransferOwnerBodySchema },
3408
+ response: { body: agentApiIntegrationAppTransferOwnerResponseSchema }
3409
+ }),
3410
+ integrationAppUpdate: route({
3411
+ key: "integrationAppUpdate",
3412
+ method: "POST",
3413
+ path: "/integrations/app/update",
3414
+ client: { resource: "integrations", method: "updateApp" },
3415
+ capability: "read",
3416
+ description: "Update a server-local integration app. Only the current app owner may update it.",
3417
+ request: { body: agentApiIntegrationAppUpdateBodySchema },
3418
+ response: { body: agentApiIntegrationAppUpdateResponseSchema }
3419
+ }),
3337
3420
  actionPrepare: route({
3338
3421
  key: "actionPrepare",
3339
3422
  method: "POST",
@@ -4027,20 +4110,20 @@ var EXTERNAL_AGENT_RUNTIME_ID = "external";
4027
4110
  var EXTERNAL_AGENT_RUNTIME_MODEL = "external";
4028
4111
  var EXTERNAL_AGENT_RUNTIME_DISPLAY_NAME = "External agent";
4029
4112
  var RUNTIMES = [
4030
- { id: "claude", displayName: "Claude Code", binary: "claude", supported: true },
4031
- { id: "codex", displayName: "Codex CLI", binary: "codex", supported: true },
4032
- { id: "builtin", displayName: "Built-in Pi", binary: "", supported: true },
4033
- { id: "antigravity", displayName: "Antigravity CLI", binary: "agy", supported: true },
4113
+ { id: "claude", displayName: "Claude Code", abbreviation: "CC", binary: "claude", supported: true },
4114
+ { id: "codex", displayName: "Codex CLI", abbreviation: "CX", binary: "codex", supported: true },
4115
+ { id: "builtin", displayName: "Built-in Pi", abbreviation: "BP", binary: "", supported: true },
4116
+ { id: "antigravity", displayName: "Antigravity CLI", abbreviation: "AG", binary: "agy", supported: true },
4034
4117
  // Kimi: prefer the in-process SDK (`kimi-sdk` → "Kimi Code") for new agents.
4035
4118
  // The legacy `kimi` (kimi-cli child-process) entry stays for backward compat
4036
4119
  // with existing `runtime=kimi` agents but is labelled deprecated.
4037
- { id: "kimi-sdk", displayName: "Kimi Code", binary: "", supported: true },
4038
- { id: "kimi", displayName: "Kimi CLI (deprecated)", binary: "kimi", supported: true },
4039
- { id: "copilot", displayName: "Copilot CLI", binary: "copilot", supported: true },
4040
- { id: "cursor", displayName: "Cursor CLI", binary: "cursor-agent", supported: true },
4041
- { id: "gemini", displayName: "Gemini CLI", binary: "gemini", supported: true },
4042
- { id: "opencode", displayName: "OpenCode", binary: "opencode", supported: true },
4043
- { id: "pi", displayName: "Pi", binary: "pi", supported: true }
4120
+ { id: "kimi-sdk", displayName: "Kimi Code", abbreviation: "KC", binary: "", supported: true },
4121
+ { id: "kimi", displayName: "Kimi CLI (deprecated)", abbreviation: "KL", binary: "kimi", supported: true },
4122
+ { id: "copilot", displayName: "Copilot CLI", abbreviation: "CP", binary: "copilot", supported: true },
4123
+ { id: "cursor", displayName: "Cursor CLI", abbreviation: "CU", binary: "cursor-agent", supported: true },
4124
+ { id: "gemini", displayName: "Gemini CLI", abbreviation: "GM", binary: "gemini", supported: true },
4125
+ { id: "opencode", displayName: "OpenCode", abbreviation: "OC", binary: "opencode", supported: true },
4126
+ { id: "pi", displayName: "Pi", abbreviation: "PI", binary: "pi", supported: true }
4044
4127
  ];
4045
4128
  var RUNTIME_MODELS = {
4046
4129
  [EXTERNAL_AGENT_RUNTIME_ID]: [
@@ -5029,7 +5112,7 @@ Only top-level channel / DM messages can become tasks. Messages inside threads a
5029
5112
  **What \`raft task create\` really means:**
5030
5113
  - Tasks live in the same chat flow as messages. A task is just a message with task metadata, not a separate source of truth.
5031
5114
  - \`raft task create\` is a convenience helper for a specific sequence: create a brand-new message, then publish that new message as a task-message.
5032
- - \`raft task create\` only creates the task \u2014 to own it, call \`raft task claim\` afterward.
5115
+ - \`raft task create\` creates an unassigned \`todo\` task by default. \`--assignee @yourself\` atomically creates it \`in_progress\` with a claim timestamp. A server owner/admin may use \`--assignee @someone-else\` to reserve a \`todo\` task for that actor; the assignee must still claim it to start. Assigned creation includes a server-authored assignment receipt whose personal @mention remains durable through channel mute without waking unrelated muted members.
5033
5116
  - Typical uses for \`raft task create\` are breaking down a larger task into parallel subtasks, or batch-creating genuinely new work for others to claim.
5034
5117
  - If someone already sent the work item as a message, just claim that existing message/task instead of creating a new one.
5035
5118
  - If the work already exists as a message, reuse it via \`raft task claim --target "#channel" --message-id abc12345\`.
@@ -5439,15 +5522,6 @@ function listLegacySlockStatePaths(slockHome = resolveSlockHome(), homeDir = os.
5439
5522
  return candidates.filter((candidate) => existsSync(candidate.path));
5440
5523
  }
5441
5524
 
5442
- // src/authEnv.ts
5443
- var DAEMON_API_KEY_ENV = "SLOCK_MACHINE_API_KEY";
5444
- var SLOCK_AGENT_TOKEN_ENV = "SLOCK_AGENT_TOKEN";
5445
- function scrubDaemonChildEnv(env) {
5446
- delete env[DAEMON_API_KEY_ENV];
5447
- delete env[SLOCK_AGENT_TOKEN_ENV];
5448
- return env;
5449
- }
5450
-
5451
5525
  // src/agentCredentialProxy.ts
5452
5526
  import { randomBytes } from "crypto";
5453
5527
  import http from "http";
@@ -7066,9 +7140,7 @@ var LOOPBACK_NO_PROXY = "127.0.0.1,localhost";
7066
7140
  var CLI_TRANSPORT_TRACE_DIR_ENV = "SLOCK_CLI_TRANSPORT_TRACE_DIR";
7067
7141
  var safePathPart = (value) => value.replace(/[^a-zA-Z0-9_.-]/g, "_");
7068
7142
  var RAW_CREDENTIAL_ENV_DENYLIST = [
7069
- "SLOCK_AGENT_TOKEN",
7070
- "SLOCK_AGENT_CREDENTIAL_KEY",
7071
- "SLOCK_AGENT_CREDENTIAL_KEY_FILE"
7143
+ "SLOCK_AGENT_CREDENTIAL_KEY"
7072
7144
  ];
7073
7145
  var WORKSPACE_CLI_TRANSPORT_FILENAMES = [
7074
7146
  "agent-token",
@@ -7423,7 +7495,7 @@ set "SLOCK_AGENT_ACTIVE_CAPABILITIES=${DEFAULT_ACTIVE_CAPABILITIES}"\r
7423
7495
  SLOCK_SERVER_URL: ctx.config.serverUrl,
7424
7496
  PATH: `${slockDir}${path2.delimiter}${process.env.PATH ?? ""}`
7425
7497
  };
7426
- scrubDaemonChildEnv(spawnEnv);
7498
+ delete spawnEnv.SLOCK_AGENT_TOKEN;
7427
7499
  for (const key of RAW_CREDENTIAL_ENV_DENYLIST) {
7428
7500
  delete spawnEnv[key];
7429
7501
  }
@@ -8031,7 +8103,7 @@ function requiresWindowsShell(command, platform = process.platform) {
8031
8103
  }
8032
8104
  function resolveCommandOnPath(command, deps = {}) {
8033
8105
  const platform = deps.platform ?? process.platform;
8034
- const env = scrubDaemonChildEnv({ ...withWindowsUserEnvironment(deps.env ?? process.env, deps) });
8106
+ const env = withWindowsUserEnvironment(deps.env ?? process.env, deps);
8035
8107
  const execFileSyncFn = deps.execFileSyncFn ?? execFileSync;
8036
8108
  const existsSyncFn = deps.existsSyncFn ?? existsSync3;
8037
8109
  if (platform === "win32") {
@@ -8057,7 +8129,7 @@ function firstExistingPath(candidates, deps = {}) {
8057
8129
  return null;
8058
8130
  }
8059
8131
  function readCommandVersion(command, args = [], deps = {}) {
8060
- const env = scrubDaemonChildEnv({ ...withWindowsUserEnvironment(deps.env ?? process.env, deps) });
8132
+ const env = withWindowsUserEnvironment(deps.env ?? process.env, deps);
8061
8133
  const execFileSyncFn = deps.execFileSyncFn ?? execFileSync;
8062
8134
  try {
8063
8135
  const output = normalizeExecOutput(execFileSyncFn(command, [...args, "--version"], {
@@ -10261,11 +10333,11 @@ function detectCursorModels(runCommand = runCursorModelsCommand) {
10261
10333
  return parseCursorModelsOutput(String(result.stdout || ""));
10262
10334
  }
10263
10335
  function buildCursorModelProbeEnv(deps = {}) {
10264
- return scrubDaemonChildEnv(withWindowsUserEnvironment({
10336
+ return withWindowsUserEnvironment({
10265
10337
  ...deps.env ?? process.env,
10266
10338
  FORCE_COLOR: "0",
10267
10339
  NO_COLOR: "1"
10268
- }, deps));
10340
+ }, deps);
10269
10341
  }
10270
10342
  function runCursorModelsCommand() {
10271
10343
  return spawnSync("cursor-agent", ["models"], {
@@ -10321,7 +10393,7 @@ function resolveGeminiSpawn(commandArgs, deps = {}) {
10321
10393
  }
10322
10394
  const execFileSyncFn = deps.execFileSyncFn ?? execFileSync3;
10323
10395
  const existsSyncFn = deps.existsSyncFn ?? existsSync5;
10324
- const env = scrubDaemonChildEnv({ ...deps.env ?? process.env });
10396
+ const env = deps.env ?? process.env;
10325
10397
  const winPath = path8.win32;
10326
10398
  let geminiEntry = null;
10327
10399
  try {
@@ -10458,15 +10530,12 @@ var GeminiDriver = class {
10458
10530
  // src/drivers/kimi.ts
10459
10531
  import { randomUUID as randomUUID2 } from "crypto";
10460
10532
  import { spawn as spawn7 } from "child_process";
10461
- import { chmodSync, existsSync as existsSync6, readFileSync as readFileSync3, writeFileSync as writeFileSync3 } from "fs";
10533
+ import { existsSync as existsSync6, readFileSync as readFileSync3, writeFileSync as writeFileSync3 } from "fs";
10462
10534
  import os4 from "os";
10463
10535
  import path9 from "path";
10464
10536
  var KIMI_WIRE_PROTOCOL_VERSION = "1.3";
10465
10537
  var KIMI_SYSTEM_PROMPT_FILE = ".slock-kimi-system.md";
10466
10538
  var KIMI_AGENT_FILE = ".slock-kimi-agent.yaml";
10467
- var KIMI_GENERATED_CONFIG_FILE = ".slock-kimi-config.toml";
10468
- var SLOCK_KIMI_CONFIG_CONTENT_ENV = "SLOCK_KIMI_CONFIG_CONTENT";
10469
- var SLOCK_KIMI_CONFIG_FILE_ENV = "SLOCK_KIMI_CONFIG_FILE";
10470
10539
  function parseToolArguments(raw) {
10471
10540
  if (typeof raw !== "string") return raw;
10472
10541
  try {
@@ -10475,73 +10544,6 @@ function parseToolArguments(raw) {
10475
10544
  return raw;
10476
10545
  }
10477
10546
  }
10478
- function readKimiConfigSource(home = os4.homedir(), env = process.env) {
10479
- const inlineConfig = env[SLOCK_KIMI_CONFIG_CONTENT_ENV];
10480
- if (inlineConfig && inlineConfig.trim()) {
10481
- return {
10482
- raw: inlineConfig,
10483
- explicitPath: null,
10484
- sourcePath: SLOCK_KIMI_CONFIG_CONTENT_ENV
10485
- };
10486
- }
10487
- const explicitPath = env[SLOCK_KIMI_CONFIG_FILE_ENV];
10488
- const configPath = explicitPath && explicitPath.trim() ? explicitPath : path9.join(home, ".kimi", "config.toml");
10489
- try {
10490
- return {
10491
- raw: readFileSync3(configPath, "utf8"),
10492
- explicitPath: explicitPath && explicitPath.trim() ? explicitPath : null,
10493
- sourcePath: configPath
10494
- };
10495
- } catch {
10496
- return {
10497
- raw: null,
10498
- explicitPath: explicitPath && explicitPath.trim() ? explicitPath : null,
10499
- sourcePath: configPath
10500
- };
10501
- }
10502
- }
10503
- function buildKimiSpawnEnv(env = process.env) {
10504
- const spawnEnv = { ...env, FORCE_COLOR: "0", NO_COLOR: "1" };
10505
- delete spawnEnv[SLOCK_KIMI_CONFIG_CONTENT_ENV];
10506
- delete spawnEnv[SLOCK_KIMI_CONFIG_FILE_ENV];
10507
- return scrubDaemonChildEnv(spawnEnv);
10508
- }
10509
- function buildKimiEffectiveEnv(ctx, overrideEnv) {
10510
- return {
10511
- ...process.env,
10512
- ...ctx.config.envVars || {},
10513
- ...overrideEnv || {}
10514
- };
10515
- }
10516
- function buildKimiLaunchOptions(ctx, opts = {}) {
10517
- const env = buildKimiEffectiveEnv(ctx, opts.env);
10518
- const source = readKimiConfigSource(opts.home ?? os4.homedir(), env);
10519
- const args = [];
10520
- let configFilePath = null;
10521
- let configContent = null;
10522
- if (source.explicitPath) {
10523
- configFilePath = source.explicitPath;
10524
- } else if (source.raw !== null && source.sourcePath === SLOCK_KIMI_CONFIG_CONTENT_ENV) {
10525
- configFilePath = path9.join(ctx.workingDirectory, KIMI_GENERATED_CONFIG_FILE);
10526
- configContent = source.raw;
10527
- if (opts.writeGeneratedConfig !== false) {
10528
- writeFileSync3(configFilePath, source.raw, { encoding: "utf8", mode: 384 });
10529
- chmodSync(configFilePath, 384);
10530
- }
10531
- }
10532
- if (configFilePath) {
10533
- args.push("--config-file", configFilePath);
10534
- }
10535
- if (ctx.config.model && ctx.config.model !== "default") {
10536
- args.push("--model", ctx.config.model);
10537
- }
10538
- return {
10539
- args,
10540
- env: buildKimiSpawnEnv(env),
10541
- configFilePath,
10542
- configContent
10543
- };
10544
- }
10545
10547
  function resolveKimiSpawn(commandArgs, deps = {}) {
10546
10548
  return {
10547
10549
  command: resolveCommandOnPath("kimi", deps) ?? "kimi",
@@ -10565,25 +10567,7 @@ var KimiDriver = class {
10565
10567
  };
10566
10568
  model = {
10567
10569
  detectedModelsVerifiedAs: "launchable",
10568
- toLaunchSpec: (modelId, ctx, opts) => {
10569
- if (!ctx) return { args: ["--model", modelId] };
10570
- const launchCtx = {
10571
- ...ctx,
10572
- config: {
10573
- ...ctx.config,
10574
- model: modelId
10575
- }
10576
- };
10577
- const launch = buildKimiLaunchOptions(launchCtx, {
10578
- home: opts?.home,
10579
- writeGeneratedConfig: false
10580
- });
10581
- return {
10582
- args: launch.args,
10583
- env: launch.env,
10584
- configFiles: launch.configFilePath ? [launch.configFilePath] : void 0
10585
- };
10586
- }
10570
+ toLaunchSpec: (modelId) => ({ args: ["--model", modelId] })
10587
10571
  };
10588
10572
  supportsStdinNotification = true;
10589
10573
  busyDeliveryMode = "direct";
@@ -10607,23 +10591,21 @@ var KimiDriver = class {
10607
10591
  ` system_prompt_path: ./${KIMI_SYSTEM_PROMPT_FILE}`,
10608
10592
  ""
10609
10593
  ].join("\n"), "utf8");
10610
- const launch = buildKimiLaunchOptions(ctx);
10611
10594
  const args = [
10612
10595
  "--wire",
10613
10596
  "--yolo",
10614
10597
  "--agent-file",
10615
10598
  agentFilePath,
10616
10599
  "--session",
10617
- this.sessionId,
10618
- ...launch.args
10600
+ this.sessionId
10619
10601
  ];
10620
10602
  const launchRuntimeFields = runtimeConfigToLaunchFields(hydrateRuntimeConfig(ctx.config));
10621
10603
  if (launchRuntimeFields.model && launchRuntimeFields.model !== "default") {
10622
10604
  args.push("--model", launchRuntimeFields.model);
10623
10605
  }
10624
10606
  const spawnEnv = (await prepareCliTransport(ctx, { NO_COLOR: "1" })).spawnEnv;
10625
- const spawnTarget = resolveKimiSpawn(args);
10626
- const proc = spawn7(spawnTarget.command, spawnTarget.args, {
10607
+ const launch = resolveKimiSpawn(args);
10608
+ const proc = spawn7(launch.command, launch.args, {
10627
10609
  cwd: ctx.workingDirectory,
10628
10610
  stdio: ["pipe", "pipe", "pipe"],
10629
10611
  env: spawnEnv,
@@ -10631,7 +10613,7 @@ var KimiDriver = class {
10631
10613
  // and has an 8191-character command-line limit. Kimi's official
10632
10614
  // installer/uv entrypoint is an executable, so launch it directly and
10633
10615
  // keep prompts on stdin / files instead of routing through cmd.exe.
10634
- shell: spawnTarget.shell
10616
+ shell: launch.shell
10635
10617
  });
10636
10618
  proc.stdin?.write(JSON.stringify({
10637
10619
  jsonrpc: "2.0",
@@ -10744,9 +10726,14 @@ var KimiDriver = class {
10744
10726
  return detectKimiModels();
10745
10727
  }
10746
10728
  };
10747
- function detectKimiModels(home = os4.homedir(), opts = {}) {
10748
- const raw = readKimiConfigSource(home, opts.env).raw;
10749
- if (raw === null) return null;
10729
+ function detectKimiModels(home = os4.homedir()) {
10730
+ const configPath = path9.join(home, ".kimi", "config.toml");
10731
+ let raw;
10732
+ try {
10733
+ raw = readFileSync3(configPath, "utf8");
10734
+ } catch {
10735
+ return null;
10736
+ }
10750
10737
  const models = [];
10751
10738
  const sectionRe = /^\s*\[models(?:\.([^\]]+)|"\.[^"]+"|\."[^"]+")\s*\]\s*$/gm;
10752
10739
  const lineRe = /^\s*\[models\.(.+?)\s*\]\s*$/gm;
@@ -11431,7 +11418,7 @@ function runOpenCodeModelsCommand(home, deps = {}) {
11431
11418
  const platform = deps.platform ?? process.platform;
11432
11419
  const spawnSyncFn = deps.spawnSyncFn ?? spawnSync2;
11433
11420
  const result = spawnSyncFn("opencode", ["models"], {
11434
- env: scrubDaemonChildEnv({ ...process.env, HOME: home, FORCE_COLOR: "0", NO_COLOR: "1" }),
11421
+ env: { ...process.env, HOME: home, FORCE_COLOR: "0", NO_COLOR: "1" },
11435
11422
  encoding: "utf8",
11436
11423
  timeout: 5e3,
11437
11424
  shell: platform === "win32"
@@ -23918,11 +23905,14 @@ var AGENT_MIGRATION_OBJECT_STORE_CONTENT_TYPE = "application/vnd.raft.agent-migr
23918
23905
  var ARCHIVE_MANIFEST_PATH = "manifest.json";
23919
23906
  var ARCHIVE_WORKSPACE_PREFIX = "workspace/";
23920
23907
  var MAX_ARCHIVE_MANIFEST_BYTES = 64 * 1024 * 1024;
23908
+ var MAX_BUNDLE_TOO_LARGE_ACCOUNTING_ENTRIES = 3;
23909
+ var MAX_ENCODED_ACCOUNTING_PATH_LENGTH = 96;
23921
23910
  var AgentMigrationObjectStoreBundleTooLargeError = class extends Error {
23922
- constructor(actualBytes, maxBytes) {
23923
- super(`MIGRATION_OBJECT_STORE_BUNDLE_TOO_LARGE:actualBytes=${actualBytes}:maxBytes=${maxBytes}`);
23911
+ constructor(actualBytes, maxBytes, largestEntries = []) {
23912
+ super(bundleTooLargeWireMessage(actualBytes, maxBytes, largestEntries));
23924
23913
  this.actualBytes = actualBytes;
23925
23914
  this.maxBytes = maxBytes;
23915
+ this.largestEntries = largestEntries;
23926
23916
  this.name = "AgentMigrationObjectStoreBundleTooLargeError";
23927
23917
  }
23928
23918
  code = "MIGRATION_OBJECT_STORE_BUNDLE_TOO_LARGE";
@@ -23991,7 +23981,11 @@ async function stageAgentMigrationObjectStoreBundle(input) {
23991
23981
  addContentBytes: (value) => {
23992
23982
  contentBytes += value;
23993
23983
  if (contentBytes > input.maxBytes) {
23994
- throw new AgentMigrationObjectStoreBundleTooLargeError(contentBytes, input.maxBytes);
23984
+ throw new AgentMigrationObjectStoreBundleTooLargeError(
23985
+ contentBytes,
23986
+ input.maxBytes,
23987
+ archiveManifest ? largestWorkspaceEntries(archiveManifest.manifest) : []
23988
+ );
23995
23989
  }
23996
23990
  }
23997
23991
  }).then(() => next(), next);
@@ -24159,10 +24153,45 @@ function assertAgentMigrationObjectStoreBundleSize(manifest, maxBytes) {
24159
24153
  if (!Number.isSafeInteger(total)) throw new Error("MIGRATION_OBJECT_STORE_FILE_SIZE_INVALID");
24160
24154
  }
24161
24155
  if (total > maxBytes) {
24162
- throw new AgentMigrationObjectStoreBundleTooLargeError(total, maxBytes);
24156
+ throw new AgentMigrationObjectStoreBundleTooLargeError(
24157
+ total,
24158
+ maxBytes,
24159
+ largestWorkspaceEntries(manifest)
24160
+ );
24163
24161
  }
24164
24162
  return total;
24165
24163
  }
24164
+ function largestWorkspaceEntries(manifest, limit = MAX_BUNDLE_TOO_LARGE_ACCOUNTING_ENTRIES) {
24165
+ if (!Number.isSafeInteger(limit) || limit <= 0) return [];
24166
+ const sizeByTopLevelPath = /* @__PURE__ */ new Map();
24167
+ for (const entry of manifest.files) {
24168
+ if (entry.source !== "workspace" || entry.kind !== "file" || !entry.workspaceRelativePath || !Number.isSafeInteger(entry.sizeBytes) || (entry.sizeBytes ?? -1) < 0) {
24169
+ continue;
24170
+ }
24171
+ const relativePath = normalizeWorkspaceRelativePath(entry.workspaceRelativePath);
24172
+ const slashIndex = relativePath.indexOf("/");
24173
+ const accountingPath = slashIndex === -1 ? relativePath : `${relativePath.slice(0, slashIndex)}/`;
24174
+ sizeByTopLevelPath.set(
24175
+ accountingPath,
24176
+ (sizeByTopLevelPath.get(accountingPath) ?? 0) + (entry.sizeBytes ?? 0)
24177
+ );
24178
+ }
24179
+ return [...sizeByTopLevelPath].map(([accountingPath, sizeBytes]) => ({ path: accountingPath, sizeBytes })).sort((left, right) => right.sizeBytes - left.sizeBytes || left.path.localeCompare(right.path)).slice(0, limit);
24180
+ }
24181
+ function bundleTooLargeWireMessage(actualBytes, maxBytes, largestEntries) {
24182
+ const prefix = `MIGRATION_OBJECT_STORE_BUNDLE_TOO_LARGE:actualBytes=${actualBytes}:maxBytes=${maxBytes}`;
24183
+ const encodedEntries = largestEntries.slice(0, MAX_BUNDLE_TOO_LARGE_ACCOUNTING_ENTRIES).map((entry) => `${encodeAccountingPath(entry.path)},${entry.sizeBytes}`).filter((entry) => entry.length > 0);
24184
+ return encodedEntries.length > 0 ? `${prefix}:topEntries=${encodedEntries.join(";")}` : prefix;
24185
+ }
24186
+ function encodeAccountingPath(value) {
24187
+ let encoded = "";
24188
+ for (const character of value) {
24189
+ const next = encodeURIComponent(character);
24190
+ if (encoded.length + next.length > MAX_ENCODED_ACCOUNTING_PATH_LENGTH) break;
24191
+ encoded += next;
24192
+ }
24193
+ return encoded;
24194
+ }
24166
24195
  function normalizeWorkspaceRelativePath(relativePath) {
24167
24196
  const normalized = path20.posix.normalize(relativePath.replaceAll("\\", "/"));
24168
24197
  if (normalized === "." || normalized.startsWith("../") || normalized === ".." || path20.isAbsolute(normalized)) {
@@ -24457,7 +24486,7 @@ function sanitizePathSegment2(value) {
24457
24486
  }
24458
24487
 
24459
24488
  // src/secretFile.ts
24460
- import { chmodSync as chmodSync2, mkdirSync as mkdirSync7, readFileSync as readFileSync10, writeFileSync as writeFileSync7 } from "fs";
24489
+ import { chmodSync, mkdirSync as mkdirSync7, readFileSync as readFileSync10, writeFileSync as writeFileSync7 } from "fs";
24461
24490
  import path22 from "path";
24462
24491
  function readSecretFileSync(filePath) {
24463
24492
  return readFileSync10(filePath, "utf8").trim();
@@ -24751,7 +24780,7 @@ function resolveSlockCliPathOrEmpty(moduleUrl = import.meta.url) {
24751
24780
  }
24752
24781
  async function runBundledSlockCli(argv) {
24753
24782
  process.argv = [process.execPath, "slock", ...argv];
24754
- await import("./dist-SCXCWA6D.js");
24783
+ await import("./dist-54TOXXOV.js");
24755
24784
  }
24756
24785
  function detectRuntimes(tracer = noopTracer) {
24757
24786
  const ids = [];
@@ -24883,6 +24912,8 @@ function summarizeIncomingMessage(msg) {
24883
24912
  return `(directory=${msg.directoryName})`;
24884
24913
  case "machine:runtime_models:detect":
24885
24914
  return `(runtime=${msg.runtime}, req=${msg.requestId})`;
24915
+ case "machine:runtimes:rescan":
24916
+ return "(rescan runtimes)";
24886
24917
  case "machine:migration_transport:lease":
24887
24918
  return `(agent=${msg.agentId}, migration=${msg.migrationId}, session=${msg.sessionId}, provider=${msg.provider}, role=${msg.role}, kind=${msg.transferKind}, url=${msg.url ? "set" : "missing"})`;
24888
24919
  case "reminder.upsert":
@@ -25977,6 +26008,13 @@ var DaemonCore = class {
25977
26008
  this.connection.send({ type: "machine:workspace:delete_result", directoryName: msg.directoryName, success });
25978
26009
  });
25979
26010
  break;
26011
+ // Re-detect installed runtimes on demand. `emitReady` already re-runs the
26012
+ // detector and pushes the fresh capabilities, and the server fans those out
26013
+ // as `machine:capabilities` — so re-emitting IS the answer, no bespoke
26014
+ // result message needed.
26015
+ case "machine:runtimes:rescan":
26016
+ this.emitReadyIfConnected();
26017
+ break;
25980
26018
  case "machine:runtime_models:detect": {
25981
26019
  const driver = getDriver(msg.runtime);
25982
26020
  const span = this.tracer.startSpan("daemon.runtime_models.detect", {
@@ -26275,6 +26313,7 @@ export {
26275
26313
  buildAgentMigrationObjectStoreBundle,
26276
26314
  stageAgentMigrationObjectStoreBundle,
26277
26315
  assertAgentMigrationObjectStoreBundleSize,
26316
+ largestWorkspaceEntries,
26278
26317
  buildAgentMigrationAdoptPlan,
26279
26318
  verifyAgentMigrationAdoptPlan,
26280
26319
  executeAgentMigrationAdoptPlan,