@slock-ai/daemon 0.57.3-play.20260609141516 → 0.57.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-JWPY65XL.js → chunk-EXLDUFWR.js} +162 -127
- package/dist/cli/index.js +1256 -858
- package/dist/core.js +1 -5
- package/dist/index.js +3 -5
- package/package.json +1 -1
- package/dist/drivers/piSdkRunner.js +0 -96
|
@@ -1058,6 +1058,143 @@ function shortMessageId(value) {
|
|
|
1058
1058
|
return value.slice(0, 8);
|
|
1059
1059
|
}
|
|
1060
1060
|
|
|
1061
|
+
// ../shared/src/externalAgentIntegration.ts
|
|
1062
|
+
import { z as z2 } from "zod";
|
|
1063
|
+
var EXTERNAL_AGENT_COMMS_PROTOCOL_VERSION = "agent-comms-core.v1";
|
|
1064
|
+
var EXTERNAL_AGENT_PROOF_SCHEMA_VERSION = "agent-proof.v1";
|
|
1065
|
+
var EXTERNAL_RUNTIME_INTEGRATION_MANIFEST_SCHEMA = "slock-external-runtime-integration.v1";
|
|
1066
|
+
var EXTERNAL_AGENT_WAKE_EVENT_SCHEMA = "slock-external-agent-wake-event.v1";
|
|
1067
|
+
var externalAgentCommsModeValues = ["spawn-core", "attach-core", "import-core"];
|
|
1068
|
+
var externalAgentIntegrationPatternValues = ["external-harness-plugin", "integrated-runtime"];
|
|
1069
|
+
var externalAgentIsolationValues = ["profile-scoped", "session-scoped"];
|
|
1070
|
+
var externalAgentWakeAdapterKindValues = ["claude-code-channels", "hermes-in-process"];
|
|
1071
|
+
var externalAgentWakeProofLevelValues = [
|
|
1072
|
+
"server_delivered",
|
|
1073
|
+
"harness_accepted",
|
|
1074
|
+
"wake_injected"
|
|
1075
|
+
];
|
|
1076
|
+
var externalAgentProofLevelValues = [
|
|
1077
|
+
...externalAgentWakeProofLevelValues,
|
|
1078
|
+
"model_seen"
|
|
1079
|
+
];
|
|
1080
|
+
var externalAgentCommsLifecycleStateValues = [
|
|
1081
|
+
"unbound",
|
|
1082
|
+
"bound_stopped",
|
|
1083
|
+
"starting",
|
|
1084
|
+
"connected_replaying",
|
|
1085
|
+
"listening_idle",
|
|
1086
|
+
"handoff_pending",
|
|
1087
|
+
"degraded_backoff",
|
|
1088
|
+
"stopping",
|
|
1089
|
+
"stopped",
|
|
1090
|
+
"auth_revoked"
|
|
1091
|
+
];
|
|
1092
|
+
var externalAgentLifecycleSourceValues = ["server_core", "comms_core", "wake_adapter", "server"];
|
|
1093
|
+
var externalAgentLifecycleProvenanceValues = [
|
|
1094
|
+
"slock_core",
|
|
1095
|
+
"adapter_observed",
|
|
1096
|
+
"agent_reported"
|
|
1097
|
+
];
|
|
1098
|
+
var externalAgentAdapterFailureValues = [
|
|
1099
|
+
"no_session",
|
|
1100
|
+
"busy",
|
|
1101
|
+
"injection_failed",
|
|
1102
|
+
"protocol_mismatch",
|
|
1103
|
+
"auth_revoked"
|
|
1104
|
+
];
|
|
1105
|
+
var externalAgentServerApiModeValues = ["interim-agent-api-events", "agent-inbox-protocol"];
|
|
1106
|
+
var nonEmptyStringSchema = z2.string().min(1);
|
|
1107
|
+
var isoTimestampSchema = z2.string().refine((value) => !Number.isNaN(Date.parse(value)), {
|
|
1108
|
+
message: "must be a parseable timestamp"
|
|
1109
|
+
});
|
|
1110
|
+
var externalRuntimeIntegrationManifestSchema = z2.object({
|
|
1111
|
+
schema: z2.literal(EXTERNAL_RUNTIME_INTEGRATION_MANIFEST_SCHEMA),
|
|
1112
|
+
runtimeId: nonEmptyStringSchema,
|
|
1113
|
+
integrationPattern: z2.enum(externalAgentIntegrationPatternValues),
|
|
1114
|
+
commsMode: z2.enum(externalAgentCommsModeValues),
|
|
1115
|
+
commsProtocolVersion: z2.literal(EXTERNAL_AGENT_COMMS_PROTOCOL_VERSION),
|
|
1116
|
+
proofSchemaVersion: z2.literal(EXTERNAL_AGENT_PROOF_SCHEMA_VERSION),
|
|
1117
|
+
minSlockCliVersion: nonEmptyStringSchema,
|
|
1118
|
+
multiplex: z2.boolean(),
|
|
1119
|
+
agentIsolation: z2.enum(externalAgentIsolationValues),
|
|
1120
|
+
bridgeLifecycle: z2.object({
|
|
1121
|
+
explicitStartOnly: z2.literal(true),
|
|
1122
|
+
oneShotCommandsBridgeIndependent: z2.literal(true),
|
|
1123
|
+
requiresBridgeFailureCodes: z2.array(z2.enum(["BRIDGE_NOT_RUNNING", "NO_CORE_SESSION"])).min(1),
|
|
1124
|
+
autoStartDefault: z2.literal(false)
|
|
1125
|
+
}).strict(),
|
|
1126
|
+
serverApi: z2.object({
|
|
1127
|
+
mode: z2.enum(externalAgentServerApiModeValues),
|
|
1128
|
+
deliveryOnly: z2.boolean(),
|
|
1129
|
+
cursorAuthority: z2.literal("model_seen_only")
|
|
1130
|
+
}).strict(),
|
|
1131
|
+
wakeAdapter: z2.object({
|
|
1132
|
+
kind: z2.enum(externalAgentWakeAdapterKindValues),
|
|
1133
|
+
protocol: nonEmptyStringSchema,
|
|
1134
|
+
requiresInteractiveSession: z2.boolean().optional()
|
|
1135
|
+
}).strict()
|
|
1136
|
+
}).strict().superRefine((value, ctx) => {
|
|
1137
|
+
if (!value.bridgeLifecycle.requiresBridgeFailureCodes.includes("BRIDGE_NOT_RUNNING")) {
|
|
1138
|
+
ctx.addIssue({
|
|
1139
|
+
code: "custom",
|
|
1140
|
+
path: ["bridgeLifecycle", "requiresBridgeFailureCodes"],
|
|
1141
|
+
message: "bridge-dependent surfaces must include BRIDGE_NOT_RUNNING"
|
|
1142
|
+
});
|
|
1143
|
+
}
|
|
1144
|
+
if (!value.bridgeLifecycle.requiresBridgeFailureCodes.includes("NO_CORE_SESSION")) {
|
|
1145
|
+
ctx.addIssue({
|
|
1146
|
+
code: "custom",
|
|
1147
|
+
path: ["bridgeLifecycle", "requiresBridgeFailureCodes"],
|
|
1148
|
+
message: "bridge-dependent surfaces must include NO_CORE_SESSION"
|
|
1149
|
+
});
|
|
1150
|
+
}
|
|
1151
|
+
if (value.serverApi.mode === "interim-agent-api-events" && value.serverApi.deliveryOnly !== true) {
|
|
1152
|
+
ctx.addIssue({
|
|
1153
|
+
code: "custom",
|
|
1154
|
+
path: ["serverApi", "deliveryOnly"],
|
|
1155
|
+
message: "interim agent-api events mode must be delivery-only"
|
|
1156
|
+
});
|
|
1157
|
+
}
|
|
1158
|
+
});
|
|
1159
|
+
var externalAgentWakeEventBaseSchema = z2.object({
|
|
1160
|
+
schema: z2.literal(EXTERNAL_AGENT_WAKE_EVENT_SCHEMA),
|
|
1161
|
+
eventId: nonEmptyStringSchema,
|
|
1162
|
+
attemptId: nonEmptyStringSchema,
|
|
1163
|
+
messageId: nonEmptyStringSchema,
|
|
1164
|
+
agentId: nonEmptyStringSchema,
|
|
1165
|
+
profile: nonEmptyStringSchema,
|
|
1166
|
+
coreSessionId: nonEmptyStringSchema,
|
|
1167
|
+
adapterInstance: nonEmptyStringSchema,
|
|
1168
|
+
runtimeSession: nonEmptyStringSchema.nullable(),
|
|
1169
|
+
occurredAt: isoTimestampSchema,
|
|
1170
|
+
lifecycleState: z2.enum(externalAgentCommsLifecycleStateValues),
|
|
1171
|
+
authority: z2.object({
|
|
1172
|
+
source: z2.enum(externalAgentLifecycleSourceValues),
|
|
1173
|
+
provenance: z2.enum(externalAgentLifecycleProvenanceValues)
|
|
1174
|
+
}).strict()
|
|
1175
|
+
}).strict();
|
|
1176
|
+
var externalAgentProofEventEnvelopeSchema = externalAgentWakeEventBaseSchema.extend({
|
|
1177
|
+
kind: z2.literal("proof"),
|
|
1178
|
+
proofLevel: z2.enum(externalAgentWakeProofLevelValues),
|
|
1179
|
+
outcome: z2.literal("ok"),
|
|
1180
|
+
failureMeta: z2.undefined().optional(),
|
|
1181
|
+
reason: z2.string().optional()
|
|
1182
|
+
});
|
|
1183
|
+
var externalAgentFailedWakeEventEnvelopeSchema = externalAgentWakeEventBaseSchema.extend({
|
|
1184
|
+
kind: z2.literal("wake_attempt"),
|
|
1185
|
+
proofLevel: z2.undefined().optional(),
|
|
1186
|
+
outcome: z2.literal("failed"),
|
|
1187
|
+
failureMeta: z2.object({
|
|
1188
|
+
failureClass: z2.enum(externalAgentAdapterFailureValues),
|
|
1189
|
+
retryAfterMs: z2.number().int().positive().optional()
|
|
1190
|
+
}).strict(),
|
|
1191
|
+
reason: nonEmptyStringSchema
|
|
1192
|
+
});
|
|
1193
|
+
var externalAgentWakeEventEnvelopeSchema = z2.discriminatedUnion("kind", [
|
|
1194
|
+
externalAgentProofEventEnvelopeSchema,
|
|
1195
|
+
externalAgentFailedWakeEventEnvelopeSchema
|
|
1196
|
+
]);
|
|
1197
|
+
|
|
1061
1198
|
// ../shared/src/translationLanguages.ts
|
|
1062
1199
|
var SUPPORTED_TRANSLATION_LANGUAGE_CODES = [
|
|
1063
1200
|
"en",
|
|
@@ -2081,19 +2218,6 @@ function listLegacySlockStatePaths(slockHome = resolveSlockHome(), homeDir = os.
|
|
|
2081
2218
|
return candidates.filter((candidate) => existsSync(candidate.path));
|
|
2082
2219
|
}
|
|
2083
2220
|
|
|
2084
|
-
// src/authEnv.ts
|
|
2085
|
-
var DAEMON_API_KEY_ENV = "SLOCK_MACHINE_API_KEY";
|
|
2086
|
-
var SLOCK_AGENT_TOKEN_ENV = "SLOCK_AGENT_TOKEN";
|
|
2087
|
-
function scrubDaemonAuthEnv(env) {
|
|
2088
|
-
delete env[DAEMON_API_KEY_ENV];
|
|
2089
|
-
return env;
|
|
2090
|
-
}
|
|
2091
|
-
function scrubDaemonChildEnv(env) {
|
|
2092
|
-
delete env[DAEMON_API_KEY_ENV];
|
|
2093
|
-
delete env[SLOCK_AGENT_TOKEN_ENV];
|
|
2094
|
-
return env;
|
|
2095
|
-
}
|
|
2096
|
-
|
|
2097
2221
|
// src/agentCredentialProxy.ts
|
|
2098
2222
|
import { randomBytes } from "crypto";
|
|
2099
2223
|
import http from "http";
|
|
@@ -3580,9 +3704,7 @@ var LOOPBACK_NO_PROXY = "127.0.0.1,localhost";
|
|
|
3580
3704
|
var CLI_TRANSPORT_TRACE_DIR_ENV = "SLOCK_CLI_TRANSPORT_TRACE_DIR";
|
|
3581
3705
|
var safePathPart = (value) => value.replace(/[^a-zA-Z0-9_.-]/g, "_");
|
|
3582
3706
|
var RAW_CREDENTIAL_ENV_DENYLIST = [
|
|
3583
|
-
"
|
|
3584
|
-
"SLOCK_AGENT_CREDENTIAL_KEY",
|
|
3585
|
-
"SLOCK_AGENT_CREDENTIAL_KEY_FILE"
|
|
3707
|
+
"SLOCK_AGENT_CREDENTIAL_KEY"
|
|
3586
3708
|
];
|
|
3587
3709
|
var cachedOpencliBinPath;
|
|
3588
3710
|
function resolveOpencliBinPath() {
|
|
@@ -3797,7 +3919,7 @@ exec ${shellSingleQuote(process.execPath)} ${shellSingleQuote(opencliBinPath)} "
|
|
|
3797
3919
|
...agentCredentialProxy ? {} : { SLOCK_AGENT_TOKEN_FILE: tokenFile },
|
|
3798
3920
|
PATH: `${slockDir}${path2.delimiter}${process.env.PATH ?? ""}`
|
|
3799
3921
|
};
|
|
3800
|
-
|
|
3922
|
+
delete spawnEnv.SLOCK_AGENT_TOKEN;
|
|
3801
3923
|
for (const key of RAW_CREDENTIAL_ENV_DENYLIST) {
|
|
3802
3924
|
delete spawnEnv[key];
|
|
3803
3925
|
}
|
|
@@ -4226,7 +4348,7 @@ function resolveCommandOnWindows(command, env, execFileSyncFn, existsSyncFn) {
|
|
|
4226
4348
|
}
|
|
4227
4349
|
function resolveCommandOnPath(command, deps = {}) {
|
|
4228
4350
|
const platform = deps.platform ?? process.platform;
|
|
4229
|
-
const env =
|
|
4351
|
+
const env = withWindowsUserEnvironment(deps.env ?? process.env, deps);
|
|
4230
4352
|
const execFileSyncFn = deps.execFileSyncFn ?? execFileSync;
|
|
4231
4353
|
const existsSyncFn = deps.existsSyncFn ?? existsSync2;
|
|
4232
4354
|
if (platform === "win32") {
|
|
@@ -4252,7 +4374,7 @@ function firstExistingPath(candidates, deps = {}) {
|
|
|
4252
4374
|
return null;
|
|
4253
4375
|
}
|
|
4254
4376
|
function readCommandVersion(command, args = [], deps = {}) {
|
|
4255
|
-
const env =
|
|
4377
|
+
const env = withWindowsUserEnvironment(deps.env ?? process.env, deps);
|
|
4256
4378
|
const execFileSyncFn = deps.execFileSyncFn ?? execFileSync;
|
|
4257
4379
|
try {
|
|
4258
4380
|
const output = normalizeExecOutput(execFileSyncFn(command, [...args, "--version"], {
|
|
@@ -5606,11 +5728,11 @@ function detectCursorModels(runCommand = runCursorModelsCommand) {
|
|
|
5606
5728
|
return parseCursorModelsOutput(String(result.stdout || ""));
|
|
5607
5729
|
}
|
|
5608
5730
|
function buildCursorModelProbeEnv(deps = {}) {
|
|
5609
|
-
return
|
|
5731
|
+
return withWindowsUserEnvironment({
|
|
5610
5732
|
...deps.env ?? process.env,
|
|
5611
5733
|
FORCE_COLOR: "0",
|
|
5612
5734
|
NO_COLOR: "1"
|
|
5613
|
-
}, deps)
|
|
5735
|
+
}, deps);
|
|
5614
5736
|
}
|
|
5615
5737
|
function runCursorModelsCommand() {
|
|
5616
5738
|
return spawnSync("cursor-agent", ["models"], {
|
|
@@ -5666,7 +5788,7 @@ function resolveGeminiSpawn(commandArgs, deps = {}) {
|
|
|
5666
5788
|
}
|
|
5667
5789
|
const execFileSyncFn = deps.execFileSyncFn ?? execFileSync3;
|
|
5668
5790
|
const existsSyncFn = deps.existsSyncFn ?? existsSync4;
|
|
5669
|
-
const env =
|
|
5791
|
+
const env = deps.env ?? process.env;
|
|
5670
5792
|
const winPath = path6.win32;
|
|
5671
5793
|
let geminiEntry = null;
|
|
5672
5794
|
try {
|
|
@@ -5806,15 +5928,12 @@ var GeminiDriver = class {
|
|
|
5806
5928
|
// src/drivers/kimi.ts
|
|
5807
5929
|
import { randomUUID as randomUUID2 } from "crypto";
|
|
5808
5930
|
import { spawn as spawn7 } from "child_process";
|
|
5809
|
-
import {
|
|
5931
|
+
import { existsSync as existsSync5, readFileSync as readFileSync3, writeFileSync as writeFileSync3 } from "fs";
|
|
5810
5932
|
import os3 from "os";
|
|
5811
5933
|
import path7 from "path";
|
|
5812
5934
|
var KIMI_WIRE_PROTOCOL_VERSION = "1.3";
|
|
5813
5935
|
var KIMI_SYSTEM_PROMPT_FILE = ".slock-kimi-system.md";
|
|
5814
5936
|
var KIMI_AGENT_FILE = ".slock-kimi-agent.yaml";
|
|
5815
|
-
var KIMI_GENERATED_CONFIG_FILE = ".slock-kimi-config.toml";
|
|
5816
|
-
var SLOCK_KIMI_CONFIG_CONTENT_ENV = "SLOCK_KIMI_CONFIG_CONTENT";
|
|
5817
|
-
var SLOCK_KIMI_CONFIG_FILE_ENV = "SLOCK_KIMI_CONFIG_FILE";
|
|
5818
5937
|
function parseToolArguments(raw) {
|
|
5819
5938
|
if (typeof raw !== "string") return raw;
|
|
5820
5939
|
try {
|
|
@@ -5823,73 +5942,6 @@ function parseToolArguments(raw) {
|
|
|
5823
5942
|
return raw;
|
|
5824
5943
|
}
|
|
5825
5944
|
}
|
|
5826
|
-
function readKimiConfigSource(home = os3.homedir(), env = process.env) {
|
|
5827
|
-
const inlineConfig = env[SLOCK_KIMI_CONFIG_CONTENT_ENV];
|
|
5828
|
-
if (inlineConfig && inlineConfig.trim()) {
|
|
5829
|
-
return {
|
|
5830
|
-
raw: inlineConfig,
|
|
5831
|
-
explicitPath: null,
|
|
5832
|
-
sourcePath: SLOCK_KIMI_CONFIG_CONTENT_ENV
|
|
5833
|
-
};
|
|
5834
|
-
}
|
|
5835
|
-
const explicitPath = env[SLOCK_KIMI_CONFIG_FILE_ENV];
|
|
5836
|
-
const configPath = explicitPath && explicitPath.trim() ? explicitPath : path7.join(home, ".kimi", "config.toml");
|
|
5837
|
-
try {
|
|
5838
|
-
return {
|
|
5839
|
-
raw: readFileSync3(configPath, "utf8"),
|
|
5840
|
-
explicitPath: explicitPath && explicitPath.trim() ? explicitPath : null,
|
|
5841
|
-
sourcePath: configPath
|
|
5842
|
-
};
|
|
5843
|
-
} catch {
|
|
5844
|
-
return {
|
|
5845
|
-
raw: null,
|
|
5846
|
-
explicitPath: explicitPath && explicitPath.trim() ? explicitPath : null,
|
|
5847
|
-
sourcePath: configPath
|
|
5848
|
-
};
|
|
5849
|
-
}
|
|
5850
|
-
}
|
|
5851
|
-
function buildKimiSpawnEnv(env = process.env) {
|
|
5852
|
-
const spawnEnv = { ...env, FORCE_COLOR: "0", NO_COLOR: "1" };
|
|
5853
|
-
delete spawnEnv[SLOCK_KIMI_CONFIG_CONTENT_ENV];
|
|
5854
|
-
delete spawnEnv[SLOCK_KIMI_CONFIG_FILE_ENV];
|
|
5855
|
-
return scrubDaemonChildEnv(spawnEnv);
|
|
5856
|
-
}
|
|
5857
|
-
function buildKimiEffectiveEnv(ctx, overrideEnv) {
|
|
5858
|
-
return {
|
|
5859
|
-
...process.env,
|
|
5860
|
-
...ctx.config.envVars || {},
|
|
5861
|
-
...overrideEnv || {}
|
|
5862
|
-
};
|
|
5863
|
-
}
|
|
5864
|
-
function buildKimiLaunchOptions(ctx, opts = {}) {
|
|
5865
|
-
const env = buildKimiEffectiveEnv(ctx, opts.env);
|
|
5866
|
-
const source = readKimiConfigSource(opts.home ?? os3.homedir(), env);
|
|
5867
|
-
const args = [];
|
|
5868
|
-
let configFilePath = null;
|
|
5869
|
-
let configContent = null;
|
|
5870
|
-
if (source.explicitPath) {
|
|
5871
|
-
configFilePath = source.explicitPath;
|
|
5872
|
-
} else if (source.raw !== null && source.sourcePath === SLOCK_KIMI_CONFIG_CONTENT_ENV) {
|
|
5873
|
-
configFilePath = path7.join(ctx.workingDirectory, KIMI_GENERATED_CONFIG_FILE);
|
|
5874
|
-
configContent = source.raw;
|
|
5875
|
-
if (opts.writeGeneratedConfig !== false) {
|
|
5876
|
-
writeFileSync3(configFilePath, source.raw, { encoding: "utf8", mode: 384 });
|
|
5877
|
-
chmodSync(configFilePath, 384);
|
|
5878
|
-
}
|
|
5879
|
-
}
|
|
5880
|
-
if (configFilePath) {
|
|
5881
|
-
args.push("--config-file", configFilePath);
|
|
5882
|
-
}
|
|
5883
|
-
if (ctx.config.model && ctx.config.model !== "default") {
|
|
5884
|
-
args.push("--model", ctx.config.model);
|
|
5885
|
-
}
|
|
5886
|
-
return {
|
|
5887
|
-
args,
|
|
5888
|
-
env: buildKimiSpawnEnv(env),
|
|
5889
|
-
configFilePath,
|
|
5890
|
-
configContent
|
|
5891
|
-
};
|
|
5892
|
-
}
|
|
5893
5945
|
function resolveKimiSpawn(commandArgs, deps = {}) {
|
|
5894
5946
|
return {
|
|
5895
5947
|
command: resolveCommandOnPath("kimi", deps) ?? "kimi",
|
|
@@ -5913,25 +5965,7 @@ var KimiDriver = class {
|
|
|
5913
5965
|
};
|
|
5914
5966
|
model = {
|
|
5915
5967
|
detectedModelsVerifiedAs: "launchable",
|
|
5916
|
-
toLaunchSpec: (modelId
|
|
5917
|
-
if (!ctx) return { args: ["--model", modelId] };
|
|
5918
|
-
const launchCtx = {
|
|
5919
|
-
...ctx,
|
|
5920
|
-
config: {
|
|
5921
|
-
...ctx.config,
|
|
5922
|
-
model: modelId
|
|
5923
|
-
}
|
|
5924
|
-
};
|
|
5925
|
-
const launch = buildKimiLaunchOptions(launchCtx, {
|
|
5926
|
-
home: opts?.home,
|
|
5927
|
-
writeGeneratedConfig: false
|
|
5928
|
-
});
|
|
5929
|
-
return {
|
|
5930
|
-
args: launch.args,
|
|
5931
|
-
env: launch.env,
|
|
5932
|
-
configFiles: launch.configFilePath ? [launch.configFilePath] : void 0
|
|
5933
|
-
};
|
|
5934
|
-
}
|
|
5968
|
+
toLaunchSpec: (modelId) => ({ args: ["--model", modelId] })
|
|
5935
5969
|
};
|
|
5936
5970
|
supportsStdinNotification = true;
|
|
5937
5971
|
mcpToolPrefix = "";
|
|
@@ -5957,23 +5991,21 @@ var KimiDriver = class {
|
|
|
5957
5991
|
` system_prompt_path: ./${KIMI_SYSTEM_PROMPT_FILE}`,
|
|
5958
5992
|
""
|
|
5959
5993
|
].join("\n"), "utf8");
|
|
5960
|
-
const launch = buildKimiLaunchOptions(ctx);
|
|
5961
5994
|
const args = [
|
|
5962
5995
|
"--wire",
|
|
5963
5996
|
"--yolo",
|
|
5964
5997
|
"--agent-file",
|
|
5965
5998
|
agentFilePath,
|
|
5966
5999
|
"--session",
|
|
5967
|
-
this.sessionId
|
|
5968
|
-
...launch.args
|
|
6000
|
+
this.sessionId
|
|
5969
6001
|
];
|
|
5970
6002
|
const launchRuntimeFields = runtimeConfigToLaunchFields(ctx.config);
|
|
5971
6003
|
if (launchRuntimeFields.model && launchRuntimeFields.model !== "default") {
|
|
5972
6004
|
args.push("--model", launchRuntimeFields.model);
|
|
5973
6005
|
}
|
|
5974
6006
|
const spawnEnv = (await prepareCliTransport(ctx, { NO_COLOR: "1" })).spawnEnv;
|
|
5975
|
-
const
|
|
5976
|
-
const proc = spawn7(
|
|
6007
|
+
const launch = resolveKimiSpawn(args);
|
|
6008
|
+
const proc = spawn7(launch.command, launch.args, {
|
|
5977
6009
|
cwd: ctx.workingDirectory,
|
|
5978
6010
|
stdio: ["pipe", "pipe", "pipe"],
|
|
5979
6011
|
env: spawnEnv,
|
|
@@ -5981,7 +6013,7 @@ var KimiDriver = class {
|
|
|
5981
6013
|
// and has an 8191-character command-line limit. Kimi's official
|
|
5982
6014
|
// installer/uv entrypoint is an executable, so launch it directly and
|
|
5983
6015
|
// keep prompts on stdin / files instead of routing through cmd.exe.
|
|
5984
|
-
shell:
|
|
6016
|
+
shell: launch.shell
|
|
5985
6017
|
});
|
|
5986
6018
|
proc.stdin?.write(JSON.stringify({
|
|
5987
6019
|
jsonrpc: "2.0",
|
|
@@ -6095,9 +6127,14 @@ var KimiDriver = class {
|
|
|
6095
6127
|
return detectKimiModels();
|
|
6096
6128
|
}
|
|
6097
6129
|
};
|
|
6098
|
-
function detectKimiModels(home = os3.homedir()
|
|
6099
|
-
const
|
|
6100
|
-
|
|
6130
|
+
function detectKimiModels(home = os3.homedir()) {
|
|
6131
|
+
const configPath = path7.join(home, ".kimi", "config.toml");
|
|
6132
|
+
let raw;
|
|
6133
|
+
try {
|
|
6134
|
+
raw = readFileSync3(configPath, "utf8");
|
|
6135
|
+
} catch {
|
|
6136
|
+
return null;
|
|
6137
|
+
}
|
|
6101
6138
|
const models = [];
|
|
6102
6139
|
const sectionRe = /^\s*\[models(?:\.([^\]]+)|"\.[^"]+"|\."[^"]+")\s*\]\s*$/gm;
|
|
6103
6140
|
const lineRe = /^\s*\[models\.(.+?)\s*\]\s*$/gm;
|
|
@@ -6337,7 +6374,7 @@ function runOpenCodeModelsCommand(home, deps = {}) {
|
|
|
6337
6374
|
const platform = deps.platform ?? process.platform;
|
|
6338
6375
|
const spawnSyncFn = deps.spawnSyncFn ?? spawnSync2;
|
|
6339
6376
|
const result = spawnSyncFn("opencode", ["models"], {
|
|
6340
|
-
env:
|
|
6377
|
+
env: { ...process.env, HOME: home, FORCE_COLOR: "0", NO_COLOR: "1" },
|
|
6341
6378
|
encoding: "utf8",
|
|
6342
6379
|
timeout: 5e3,
|
|
6343
6380
|
shell: platform === "win32"
|
|
@@ -14139,7 +14176,7 @@ var DAEMON_CORE_TRACE_ATTR_CONTRACTS = {
|
|
|
14139
14176
|
spanAttrs: ["running_agents_count", "idle_agents_count"]
|
|
14140
14177
|
}
|
|
14141
14178
|
};
|
|
14142
|
-
var DAEMON_CLI_USAGE =
|
|
14179
|
+
var DAEMON_CLI_USAGE = "Usage: slock-daemon --server-url <url> --api-key <key>";
|
|
14143
14180
|
var RunnerCredentialMintError2 = class extends Error {
|
|
14144
14181
|
code;
|
|
14145
14182
|
retryable;
|
|
@@ -14175,9 +14212,9 @@ function runnerCredentialErrorDetail2(error) {
|
|
|
14175
14212
|
async function waitForRunnerCredentialRetry2() {
|
|
14176
14213
|
await new Promise((resolve) => setTimeout(resolve, RUNNER_CREDENTIAL_MINT_RETRY_DELAY_MS2));
|
|
14177
14214
|
}
|
|
14178
|
-
function parseDaemonCliArgs(args
|
|
14215
|
+
function parseDaemonCliArgs(args) {
|
|
14179
14216
|
let serverUrl = "";
|
|
14180
|
-
let apiKey =
|
|
14217
|
+
let apiKey = "";
|
|
14181
14218
|
for (let i = 0; i < args.length; i++) {
|
|
14182
14219
|
if (args[i] === "--server-url" && args[i + 1]) serverUrl = args[++i];
|
|
14183
14220
|
if (args[i] === "--api-key" && args[i + 1]) apiKey = args[++i];
|
|
@@ -14958,8 +14995,6 @@ var DaemonCore = class {
|
|
|
14958
14995
|
};
|
|
14959
14996
|
|
|
14960
14997
|
export {
|
|
14961
|
-
DAEMON_API_KEY_ENV,
|
|
14962
|
-
scrubDaemonAuthEnv,
|
|
14963
14998
|
subscribeDaemonLogs,
|
|
14964
14999
|
resolveWorkspaceDirectoryPath,
|
|
14965
15000
|
scanWorkspaceDirectories,
|