@botiverse/raft-daemon 1.0.12 → 1.0.13
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-RKNTK2UF.js → chunk-O5X5Y2AC.js} +207 -28
- package/dist/core.js +1 -1
- package/dist/index.js +1 -1
- package/package.json +2 -2
|
@@ -5726,7 +5726,7 @@ async function collectFeedbackTranscriptAttachment(input) {
|
|
|
5726
5726
|
import { spawn } from "child_process";
|
|
5727
5727
|
|
|
5728
5728
|
// src/drivers/cliTransport.ts
|
|
5729
|
-
import { existsSync as existsSync2, mkdirSync, readdirSync, readFileSync, rmSync, writeFileSync } from "fs";
|
|
5729
|
+
import { existsSync as existsSync2, lstatSync, mkdirSync, readdirSync, readFileSync, renameSync, rmSync, statSync, writeFileSync } from "fs";
|
|
5730
5730
|
import { createRequire } from "module";
|
|
5731
5731
|
import path2 from "path";
|
|
5732
5732
|
|
|
@@ -8073,6 +8073,182 @@ var WORKSPACE_CLI_TRANSPORT_FILENAMES = [
|
|
|
8073
8073
|
"opencli",
|
|
8074
8074
|
"opencli.cmd"
|
|
8075
8075
|
];
|
|
8076
|
+
var SLOCK_AGENT_LAUNCH_DIR_ENV = "SLOCK_AGENT_LAUNCH_DIR";
|
|
8077
|
+
var DAEMON_GENERATED_MARKER = "slock-daemon-generated";
|
|
8078
|
+
var AGENT_CLI_TRANSPORT_WRAPPER_NAMES = [
|
|
8079
|
+
"slock",
|
|
8080
|
+
"slock.cmd",
|
|
8081
|
+
"slock.ps1",
|
|
8082
|
+
"raft",
|
|
8083
|
+
"raft.cmd",
|
|
8084
|
+
"raft.ps1"
|
|
8085
|
+
];
|
|
8086
|
+
function buildPosixLaunchForwardingGuard(ownSlockDir) {
|
|
8087
|
+
const agentRoot = path2.dirname(ownSlockDir);
|
|
8088
|
+
const ownLaunchPart = path2.basename(ownSlockDir);
|
|
8089
|
+
return [
|
|
8090
|
+
`# ${DAEMON_GENERATED_MARKER}`,
|
|
8091
|
+
`SLOCK_AGENT_ROOT=${shellSingleQuote(agentRoot)}`,
|
|
8092
|
+
`SLOCK_OWN_LAUNCH_DIR=${shellSingleQuote(ownLaunchPart)}`,
|
|
8093
|
+
'if [ -n "${SLOCK_AGENT_LAUNCH_DIR:-}" ] && [ "$SLOCK_AGENT_LAUNCH_DIR" != "$SLOCK_OWN_LAUNCH_DIR" ]; then',
|
|
8094
|
+
' if [ "$SLOCK_AGENT_LAUNCH_DIR" != "." ] && [ "$SLOCK_AGENT_LAUNCH_DIR" != ".." ] && [[ ! "$SLOCK_AGENT_LAUNCH_DIR" =~ [/\\] ]]; then',
|
|
8095
|
+
' SLOCK_FORWARD_DIR="$SLOCK_AGENT_ROOT/$SLOCK_AGENT_LAUNCH_DIR"',
|
|
8096
|
+
' if [ -d "$SLOCK_FORWARD_DIR" ] && [ ! -L "$SLOCK_FORWARD_DIR" ]; then',
|
|
8097
|
+
' SLOCK_FORWARD_WRAPPER="$SLOCK_FORWARD_DIR/$(basename "$0")"',
|
|
8098
|
+
' if [ -f "$SLOCK_FORWARD_WRAPPER" ] && [ ! -L "$SLOCK_FORWARD_WRAPPER" ]; then',
|
|
8099
|
+
' exec "$SLOCK_FORWARD_WRAPPER" "$@"',
|
|
8100
|
+
" fi",
|
|
8101
|
+
" fi",
|
|
8102
|
+
" fi",
|
|
8103
|
+
"fi"
|
|
8104
|
+
].join("\n");
|
|
8105
|
+
}
|
|
8106
|
+
function buildCmdLaunchForwardingGuard(ownSlockDir) {
|
|
8107
|
+
const agentRoot = path2.dirname(ownSlockDir);
|
|
8108
|
+
const ownLaunchPart = path2.basename(ownSlockDir);
|
|
8109
|
+
return [
|
|
8110
|
+
"@REM slock-daemon-generated",
|
|
8111
|
+
"setlocal enabledelayedexpansion",
|
|
8112
|
+
`set "SLOCK_AGENT_ROOT=${agentRoot}"`,
|
|
8113
|
+
`set "SLOCK_OWN_LAUNCH_DIR=${ownLaunchPart}"`,
|
|
8114
|
+
"if defined SLOCK_AGENT_LAUNCH_DIR (",
|
|
8115
|
+
' if /I not "!SLOCK_AGENT_LAUNCH_DIR!"=="!SLOCK_OWN_LAUNCH_DIR!" (',
|
|
8116
|
+
' set "SLOCK_SEL=!SLOCK_AGENT_LAUNCH_DIR!"',
|
|
8117
|
+
' set "SLOCK_INVALID="',
|
|
8118
|
+
' if "!SLOCK_SEL!"=="" set SLOCK_INVALID=1',
|
|
8119
|
+
' if "!SLOCK_SEL!"=="." set SLOCK_INVALID=1',
|
|
8120
|
+
' if "!SLOCK_SEL!"==".." set SLOCK_INVALID=1',
|
|
8121
|
+
' if not "!SLOCK_SEL:/=!"=="!SLOCK_SEL!" set SLOCK_INVALID=1',
|
|
8122
|
+
' if not "!SLOCK_SEL:\\=!"=="!SLOCK_SEL!" set SLOCK_INVALID=1',
|
|
8123
|
+
" if not defined SLOCK_INVALID (",
|
|
8124
|
+
' set "SLOCK_FORWARD_DIR=!SLOCK_AGENT_ROOT!\\!SLOCK_SEL!"',
|
|
8125
|
+
' if exist "!SLOCK_FORWARD_DIR!\\" (',
|
|
8126
|
+
' fsutil reparsepoint query "!SLOCK_FORWARD_DIR!" >nul 2>&1',
|
|
8127
|
+
" if errorlevel 1 (",
|
|
8128
|
+
' set "SLOCK_FORWARD_WRAPPER=!SLOCK_FORWARD_DIR!\\%~nx0"',
|
|
8129
|
+
' if exist "!SLOCK_FORWARD_WRAPPER!" if not exist "!SLOCK_FORWARD_WRAPPER!\\" (',
|
|
8130
|
+
' call "!SLOCK_FORWARD_WRAPPER!" %*',
|
|
8131
|
+
" exit /b !errorlevel!",
|
|
8132
|
+
" )",
|
|
8133
|
+
" )",
|
|
8134
|
+
" )",
|
|
8135
|
+
" )",
|
|
8136
|
+
" )",
|
|
8137
|
+
")",
|
|
8138
|
+
"endlocal"
|
|
8139
|
+
].join("\r\n");
|
|
8140
|
+
}
|
|
8141
|
+
function buildPs1LaunchForwardingGuard(ownSlockDir) {
|
|
8142
|
+
const agentRoot = path2.dirname(ownSlockDir);
|
|
8143
|
+
const ownLaunchPart = path2.basename(ownSlockDir);
|
|
8144
|
+
return [
|
|
8145
|
+
`# ${DAEMON_GENERATED_MARKER}`,
|
|
8146
|
+
`$SlockAgentRoot = ${powershellSingleQuote(agentRoot)}`,
|
|
8147
|
+
`$SlockOwnLaunchDir = ${powershellSingleQuote(ownLaunchPart)}`,
|
|
8148
|
+
"$SlockLaunchDir = $env:SLOCK_AGENT_LAUNCH_DIR",
|
|
8149
|
+
"if ($SlockLaunchDir -and ($SlockLaunchDir -ne $SlockOwnLaunchDir)) {",
|
|
8150
|
+
' $invalid = ($SlockLaunchDir -in "", ".", "..") -or ($SlockLaunchDir -match "[/\\\\]")',
|
|
8151
|
+
" if (-not $invalid) {",
|
|
8152
|
+
" $ForwardDir = Join-Path $SlockAgentRoot $SlockLaunchDir",
|
|
8153
|
+
" $dirItem = Get-Item $ForwardDir -ErrorAction SilentlyContinue",
|
|
8154
|
+
" if ($dirItem -and $dirItem.PSIsContainer -and (-not $dirItem.LinkType)) {",
|
|
8155
|
+
" $ForwardTarget = Join-Path $ForwardDir (Split-Path -Leaf $PSCommandPath)",
|
|
8156
|
+
" $item = Get-Item $ForwardTarget -ErrorAction SilentlyContinue",
|
|
8157
|
+
" if ($item -and ($item.PSIsContainer -eq $false) -and (-not $item.LinkType)) {",
|
|
8158
|
+
" & $ForwardTarget @args",
|
|
8159
|
+
" exit $LASTEXITCODE",
|
|
8160
|
+
" }",
|
|
8161
|
+
" }",
|
|
8162
|
+
" }",
|
|
8163
|
+
"}"
|
|
8164
|
+
].join("\r\n");
|
|
8165
|
+
}
|
|
8166
|
+
function isDaemonGeneratedWrapper(filePath) {
|
|
8167
|
+
try {
|
|
8168
|
+
const body = readFileSync(filePath, "utf8");
|
|
8169
|
+
if (body.includes(DAEMON_GENERATED_MARKER)) return true;
|
|
8170
|
+
return body.includes("SLOCK_AGENT_ID=") && body.includes("SLOCK_SERVER_URL=");
|
|
8171
|
+
} catch {
|
|
8172
|
+
return false;
|
|
8173
|
+
}
|
|
8174
|
+
}
|
|
8175
|
+
function upgradeWrapperWithLaunchGuard(filePath, platform) {
|
|
8176
|
+
let body;
|
|
8177
|
+
try {
|
|
8178
|
+
body = readFileSync(filePath, "utf8");
|
|
8179
|
+
} catch {
|
|
8180
|
+
return false;
|
|
8181
|
+
}
|
|
8182
|
+
if (body.includes(DAEMON_GENERATED_MARKER)) return false;
|
|
8183
|
+
if (!isDaemonGeneratedWrapper(filePath)) return false;
|
|
8184
|
+
const ownSlockDir = path2.dirname(filePath);
|
|
8185
|
+
let newBody;
|
|
8186
|
+
if (filePath.endsWith(".cmd")) {
|
|
8187
|
+
const guard = buildCmdLaunchForwardingGuard(ownSlockDir);
|
|
8188
|
+
const firstNewline = body.indexOf("\r\n");
|
|
8189
|
+
if (firstNewline !== -1 && body.slice(0, firstNewline).trim().toLowerCase() === "@echo off") {
|
|
8190
|
+
newBody = "@echo off\r\n" + guard + "\r\n" + body.slice(firstNewline + 2);
|
|
8191
|
+
} else {
|
|
8192
|
+
newBody = guard + "\r\n" + body;
|
|
8193
|
+
}
|
|
8194
|
+
} else if (filePath.endsWith(".ps1")) {
|
|
8195
|
+
newBody = buildPs1LaunchForwardingGuard(ownSlockDir) + "\r\n" + body;
|
|
8196
|
+
} else {
|
|
8197
|
+
const guard = buildPosixLaunchForwardingGuard(ownSlockDir);
|
|
8198
|
+
const firstNewline = body.indexOf("\n");
|
|
8199
|
+
if (firstNewline !== -1 && body.slice(0, firstNewline).startsWith("#!")) {
|
|
8200
|
+
newBody = body.slice(0, firstNewline) + "\n" + guard + "\n" + body.slice(firstNewline + 1);
|
|
8201
|
+
} else {
|
|
8202
|
+
newBody = guard + "\n" + body;
|
|
8203
|
+
}
|
|
8204
|
+
}
|
|
8205
|
+
const tmpPath = `${filePath}.guard-upgrade.tmp`;
|
|
8206
|
+
const mode = statSync(filePath).mode;
|
|
8207
|
+
writeFileSync(tmpPath, newBody, { mode });
|
|
8208
|
+
renameSync(tmpPath, filePath);
|
|
8209
|
+
return true;
|
|
8210
|
+
}
|
|
8211
|
+
function upgradeExistingAgentWrappers(agentRoot, currentSlockDir, platform = process.platform) {
|
|
8212
|
+
let scanned = 0;
|
|
8213
|
+
let upgraded = 0;
|
|
8214
|
+
let entries;
|
|
8215
|
+
try {
|
|
8216
|
+
entries = readdirSync(agentRoot);
|
|
8217
|
+
} catch {
|
|
8218
|
+
return { scanned, upgraded };
|
|
8219
|
+
}
|
|
8220
|
+
for (const entry of entries) {
|
|
8221
|
+
const launchDir = path2.join(agentRoot, entry);
|
|
8222
|
+
if (launchDir === currentSlockDir) continue;
|
|
8223
|
+
let launchDirStats;
|
|
8224
|
+
try {
|
|
8225
|
+
launchDirStats = lstatSync(launchDir);
|
|
8226
|
+
} catch {
|
|
8227
|
+
continue;
|
|
8228
|
+
}
|
|
8229
|
+
if (!launchDirStats.isDirectory() || launchDirStats.isSymbolicLink()) continue;
|
|
8230
|
+
let launchEntries;
|
|
8231
|
+
try {
|
|
8232
|
+
launchEntries = readdirSync(launchDir);
|
|
8233
|
+
} catch {
|
|
8234
|
+
continue;
|
|
8235
|
+
}
|
|
8236
|
+
for (const name of AGENT_CLI_TRANSPORT_WRAPPER_NAMES) {
|
|
8237
|
+
const filePath = path2.join(launchDir, name);
|
|
8238
|
+
if (!launchEntries.includes(name)) continue;
|
|
8239
|
+
let stats;
|
|
8240
|
+
try {
|
|
8241
|
+
stats = lstatSync(filePath);
|
|
8242
|
+
} catch {
|
|
8243
|
+
continue;
|
|
8244
|
+
}
|
|
8245
|
+
if (!stats.isFile() || stats.isSymbolicLink()) continue;
|
|
8246
|
+
scanned++;
|
|
8247
|
+
if (upgradeWrapperWithLaunchGuard(filePath, platform)) upgraded++;
|
|
8248
|
+
}
|
|
8249
|
+
}
|
|
8250
|
+
return { scanned, upgraded };
|
|
8251
|
+
}
|
|
8076
8252
|
function deriveCliFallbackCandidates(cliPath) {
|
|
8077
8253
|
if (!cliPath || cliPath === "__cli") return [];
|
|
8078
8254
|
const normalized = cliPath.split(path2.sep).join("/");
|
|
@@ -8313,6 +8489,7 @@ ${cliFallbackCandidates.map((candidate, i) => ` ${i === 0 ? "if" : "elif"} [ -e
|
|
|
8313
8489
|
fi
|
|
8314
8490
|
`;
|
|
8315
8491
|
const posixBody = `#!/usr/bin/env bash
|
|
8492
|
+
${buildPosixLaunchForwardingGuard(slockDir)}
|
|
8316
8493
|
${posixLoopbackNoProxyPrelude()}
|
|
8317
8494
|
SLOCK_CLI=${shellSingleQuote(cliPath)}
|
|
8318
8495
|
${posixCliFallbackBlock}${execIsElectron ? "export ELECTRON_RUN_AS_NODE=1\n" : ""}${posixCredentialPrefix}exec ${shellSingleQuote(process.execPath)} "$SLOCK_CLI" "$@"
|
|
@@ -8333,6 +8510,7 @@ set "SLOCK_AGENT_ACTIVE_CAPABILITIES=${DEFAULT_ACTIVE_CAPABILITIES}"\r
|
|
|
8333
8510
|
const cmdCliFallbackLines = cliPath === "__cli" ? [] : cliFallbackCandidates.map((candidate) => `if not exist "%SLOCK_CLI%" set "SLOCK_CLI=${candidate}"`);
|
|
8334
8511
|
const cmdBody = [
|
|
8335
8512
|
"@echo off",
|
|
8513
|
+
buildCmdLaunchForwardingGuard(slockDir),
|
|
8336
8514
|
"set PYTHONIOENCODING=utf-8",
|
|
8337
8515
|
"set PYTHONUTF8=1",
|
|
8338
8516
|
"set LANG=C.UTF-8",
|
|
@@ -8365,6 +8543,7 @@ set "SLOCK_AGENT_ACTIVE_CAPABILITIES=${DEFAULT_ACTIVE_CAPABILITIES}"\r
|
|
|
8365
8543
|
]
|
|
8366
8544
|
];
|
|
8367
8545
|
const psBody = [
|
|
8546
|
+
buildPs1LaunchForwardingGuard(slockDir),
|
|
8368
8547
|
"$ErrorActionPreference = 'Stop'",
|
|
8369
8548
|
"$utf8NoBom = [System.Text.UTF8Encoding]::new($false)",
|
|
8370
8549
|
"[Console]::OutputEncoding = $utf8NoBom",
|
|
@@ -8400,6 +8579,7 @@ set "SLOCK_AGENT_ACTIVE_CAPABILITIES=${DEFAULT_ACTIVE_CAPABILITIES}"\r
|
|
|
8400
8579
|
if (opencliBinPath) {
|
|
8401
8580
|
writeOpencliWrapper(slockDir, opencliBinPath, platform, execIsElectron);
|
|
8402
8581
|
}
|
|
8582
|
+
upgradeExistingAgentWrappers(path2.dirname(slockDir), slockDir, platform);
|
|
8403
8583
|
const wrapperPath = platform === "win32" ? path2.join(slockDir, "slock.cmd") : posixWrapper;
|
|
8404
8584
|
const launchRuntimeFields = runtimeConfigToLaunchFields(hydrateRuntimeConfig(ctx.config));
|
|
8405
8585
|
const spawnEnv = {
|
|
@@ -8414,6 +8594,7 @@ set "SLOCK_AGENT_ACTIVE_CAPABILITIES=${DEFAULT_ACTIVE_CAPABILITIES}"\r
|
|
|
8414
8594
|
...ctx.launchId ? { SLOCK_AGENT_LAUNCH_ID: ctx.launchId } : {},
|
|
8415
8595
|
...ctx.cliTransportTraceDir ? { [CLI_TRANSPORT_TRACE_DIR_ENV]: ctx.cliTransportTraceDir } : {},
|
|
8416
8596
|
SLOCK_SERVER_URL: ctx.config.serverUrl,
|
|
8597
|
+
[SLOCK_AGENT_LAUNCH_DIR_ENV]: path2.basename(slockDir),
|
|
8417
8598
|
PATH: `${slockDir}${path2.delimiter}${process.env.PATH ?? ""}`
|
|
8418
8599
|
};
|
|
8419
8600
|
delete spawnEnv.SLOCK_AGENT_TOKEN;
|
|
@@ -8427,6 +8608,7 @@ set "SLOCK_AGENT_ACTIVE_CAPABILITIES=${DEFAULT_ACTIVE_CAPABILITIES}"\r
|
|
|
8427
8608
|
delete spawnEnv.SLOCK_AGENT_TOKEN_FILE;
|
|
8428
8609
|
return {
|
|
8429
8610
|
slockDir,
|
|
8611
|
+
slockHome,
|
|
8430
8612
|
tokenFile,
|
|
8431
8613
|
agentCredentialProxyUrl: agentCredentialProxy?.proxyUrl ?? null,
|
|
8432
8614
|
wrapperPath,
|
|
@@ -12561,11 +12743,12 @@ import path11 from "path";
|
|
|
12561
12743
|
import { createRequire as createRequire2 } from "module";
|
|
12562
12744
|
import {
|
|
12563
12745
|
createKimiHarness,
|
|
12564
|
-
resolveKimiHome
|
|
12746
|
+
resolveKimiHome,
|
|
12747
|
+
LocalKaos
|
|
12565
12748
|
} from "@botiverse/kimi-code-sdk";
|
|
12566
12749
|
var requireFromHere = createRequire2(import.meta.url);
|
|
12567
12750
|
var KIMI_CODE_USER_AGENT_PRODUCT = "kimi-code-cli";
|
|
12568
|
-
var KIMI_CODE_HOST_VERSION = "0.
|
|
12751
|
+
var KIMI_CODE_HOST_VERSION = "0.28.1-botiverse.0";
|
|
12569
12752
|
function getDaemonVersion() {
|
|
12570
12753
|
try {
|
|
12571
12754
|
const pkg = requireFromHere("../../package.json");
|
|
@@ -12658,6 +12841,7 @@ function mapKimiSdkEventToParsedEvents(event, state) {
|
|
|
12658
12841
|
case "tool.progress":
|
|
12659
12842
|
case "shell.output":
|
|
12660
12843
|
case "shell.started":
|
|
12844
|
+
case "shell.completed":
|
|
12661
12845
|
case "hook.result":
|
|
12662
12846
|
// status / meta updates
|
|
12663
12847
|
case "agent.status.updated":
|
|
@@ -12722,24 +12906,8 @@ var KIMI_SDK_RUNTIME_SESSION_DESCRIPTOR = {
|
|
|
12722
12906
|
postTurn: "keep_alive"
|
|
12723
12907
|
};
|
|
12724
12908
|
function composeStandingRoleAdditional(standingPrompt, wrapperPath) {
|
|
12725
|
-
|
|
12726
|
-
|
|
12727
|
-
sections.push(standingPrompt);
|
|
12728
|
-
}
|
|
12729
|
-
if (wrapperPath) {
|
|
12730
|
-
sections.push(
|
|
12731
|
-
`## CLI invocation note (Kimi SDK in-process runtime)
|
|
12732
|
-
|
|
12733
|
-
When you run \`raft\` CLI commands from your bash tool, **use this absolute path** because PATH is not pre-injected for the in-process Kimi SDK:
|
|
12734
|
-
|
|
12735
|
-
\`\`\`
|
|
12736
|
-
${wrapperPath}
|
|
12737
|
-
\`\`\`
|
|
12738
|
-
|
|
12739
|
-
So instead of \`raft message send ...\`, run \`${wrapperPath} message send ...\` (every \`raft\` reference in the protocol above maps to this wrapper). The wrapper carries this agent's identity automatically; do not pass auth tokens explicitly.`
|
|
12740
|
-
);
|
|
12741
|
-
}
|
|
12742
|
-
return sections.join("\n\n---\n\n");
|
|
12909
|
+
void wrapperPath;
|
|
12910
|
+
return standingPrompt ?? "";
|
|
12743
12911
|
}
|
|
12744
12912
|
async function createKimiAgentSessionForContext(ctx, sessionId, deps = {}) {
|
|
12745
12913
|
const createHarnessImpl = deps.createHarness ?? createKimiHarness;
|
|
@@ -12749,6 +12917,15 @@ async function createKimiAgentSessionForContext(ctx, sessionId, deps = {}) {
|
|
|
12749
12917
|
const cliTransport = await prepareTransportImpl(ctx, { NO_COLOR: "1" });
|
|
12750
12918
|
const spawnEnv = cliTransport.spawnEnv;
|
|
12751
12919
|
const wrapperPath = cliTransport.wrapperPath;
|
|
12920
|
+
const slockDir = cliTransport.slockDir;
|
|
12921
|
+
const slockHome = cliTransport.slockHome;
|
|
12922
|
+
const localKaos = await (deps.createLocalKaos ?? LocalKaos.create)();
|
|
12923
|
+
const toolKaos = localKaos.withEnv({
|
|
12924
|
+
PATH: `${slockDir}${path11.delimiter}${process.env.PATH ?? ""}`,
|
|
12925
|
+
NO_COLOR: "1",
|
|
12926
|
+
SLOCK_HOME: slockHome,
|
|
12927
|
+
[SLOCK_AGENT_LAUNCH_DIR_ENV]: path11.basename(slockDir)
|
|
12928
|
+
});
|
|
12752
12929
|
const homeDir = resolveKimiHome(spawnEnv.KIMI_CODE_HOME);
|
|
12753
12930
|
mkdirSync2(homeDir, { recursive: true });
|
|
12754
12931
|
const harness = createHarnessImpl({
|
|
@@ -12763,6 +12940,8 @@ async function createKimiAgentSessionForContext(ctx, sessionId, deps = {}) {
|
|
|
12763
12940
|
const roleAdditional = composeStandingRoleAdditional(ctx.standingPrompt, wrapperPath);
|
|
12764
12941
|
const sessionFields = {
|
|
12765
12942
|
workDir: ctx.workingDirectory,
|
|
12943
|
+
kaos: toolKaos,
|
|
12944
|
+
persistenceKaos: localKaos,
|
|
12766
12945
|
...launchRuntimeFields.model && launchRuntimeFields.model !== "default" ? { model: launchRuntimeFields.model } : {},
|
|
12767
12946
|
...roleAdditional ? { roleAdditional } : {}
|
|
12768
12947
|
};
|
|
@@ -14684,7 +14863,7 @@ import {
|
|
|
14684
14863
|
mkdirSync as mkdirSync4,
|
|
14685
14864
|
readFileSync as readFileSync6,
|
|
14686
14865
|
readdirSync as readdirSync4,
|
|
14687
|
-
statSync,
|
|
14866
|
+
statSync as statSync2,
|
|
14688
14867
|
writeFileSync as writeFileSync4
|
|
14689
14868
|
} from "fs";
|
|
14690
14869
|
import os8 from "os";
|
|
@@ -14787,7 +14966,7 @@ function findGrokSessionTranscript(root, sessionId) {
|
|
|
14787
14966
|
for (const filename of preferredFiles) {
|
|
14788
14967
|
const candidate = path14.join(child, filename);
|
|
14789
14968
|
try {
|
|
14790
|
-
if (
|
|
14969
|
+
if (statSync2(candidate).isFile()) return candidate;
|
|
14791
14970
|
} catch {
|
|
14792
14971
|
}
|
|
14793
14972
|
}
|
|
@@ -14806,7 +14985,7 @@ function findPiSessionFile2(sessionId, workingDirectory, homeDir) {
|
|
|
14806
14985
|
const files = readdirSync4(piSessionsDir, { withFileTypes: true }).filter((entry) => entry.isFile() && entry.name.endsWith(".jsonl")).map((entry) => ({
|
|
14807
14986
|
name: entry.name,
|
|
14808
14987
|
path: path14.join(piSessionsDir, entry.name),
|
|
14809
|
-
stat:
|
|
14988
|
+
stat: statSync2(path14.join(piSessionsDir, entry.name))
|
|
14810
14989
|
})).filter((entry) => entry.stat.isFile() && entry.name.includes(sessionId)).sort((a, b) => b.stat.mtimeMs - a.stat.mtimeMs);
|
|
14811
14990
|
if (files[0]) return files[0].path;
|
|
14812
14991
|
} catch {
|
|
@@ -24302,7 +24481,7 @@ var ReminderCache = class {
|
|
|
24302
24481
|
|
|
24303
24482
|
// src/machineLock.ts
|
|
24304
24483
|
import { createHash as createHash5, randomUUID as randomUUID8 } from "crypto";
|
|
24305
|
-
import { mkdirSync as mkdirSync5, readFileSync as readFileSync8, rmSync as rmSync3, statSync as
|
|
24484
|
+
import { mkdirSync as mkdirSync5, readFileSync as readFileSync8, rmSync as rmSync3, statSync as statSync3, writeFileSync as writeFileSync5 } from "fs";
|
|
24306
24485
|
import os10 from "os";
|
|
24307
24486
|
import path17 from "path";
|
|
24308
24487
|
var INCOMPLETE_LOCK_STALE_MS = 3e4;
|
|
@@ -24337,7 +24516,7 @@ function readOwner(lockDir) {
|
|
|
24337
24516
|
}
|
|
24338
24517
|
function lockAgeMs(lockDir) {
|
|
24339
24518
|
try {
|
|
24340
|
-
return Date.now() -
|
|
24519
|
+
return Date.now() - statSync3(lockDir).mtimeMs;
|
|
24341
24520
|
} catch {
|
|
24342
24521
|
return null;
|
|
24343
24522
|
}
|
|
@@ -24417,7 +24596,7 @@ function acquireDaemonMachineLock(options) {
|
|
|
24417
24596
|
}
|
|
24418
24597
|
|
|
24419
24598
|
// ../trace-client/src/localTraceSink.ts
|
|
24420
|
-
import { appendFileSync, mkdirSync as mkdirSync6, readdirSync as readdirSync5, rmSync as rmSync4, statSync as
|
|
24599
|
+
import { appendFileSync, mkdirSync as mkdirSync6, readdirSync as readdirSync5, rmSync as rmSync4, statSync as statSync4, writeFileSync as writeFileSync6 } from "fs";
|
|
24421
24600
|
import path18 from "path";
|
|
24422
24601
|
var DEFAULT_MAX_FILE_BYTES = 5 * 1024 * 1024;
|
|
24423
24602
|
var DEFAULT_MAX_FILE_AGE_MS = 5 * 60 * 1e3;
|
|
@@ -24498,7 +24677,7 @@ var LocalRotatingTraceSink = class {
|
|
|
24498
24677
|
`daemon-trace-${safeTimestamp(nowMs)}-${process.pid}-${String(this.sequence++).padStart(4, "0")}.jsonl`
|
|
24499
24678
|
);
|
|
24500
24679
|
writeFileSync6(this.currentFile, "", { flag: "a", mode: 384 });
|
|
24501
|
-
this.currentSize =
|
|
24680
|
+
this.currentSize = statSync4(this.currentFile).size;
|
|
24502
24681
|
this.currentFileOpenedAtMs = nowMs;
|
|
24503
24682
|
this.pruneOldFiles();
|
|
24504
24683
|
}
|
package/dist/core.js
CHANGED
|
@@ -36,7 +36,7 @@ import {
|
|
|
36
36
|
stageAgentMigrationObjectStoreBundle,
|
|
37
37
|
subscribeDaemonLogs,
|
|
38
38
|
verifyAgentMigrationAdoptPlan
|
|
39
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-O5X5Y2AC.js";
|
|
40
40
|
export {
|
|
41
41
|
AGENT_MIGRATION_BUNDLE_SCHEMA_VERSION,
|
|
42
42
|
AGENT_MIGRATION_CONTROL_SEAM_ENV,
|
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@botiverse/raft-daemon",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.13",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": {
|
|
6
6
|
"raft-daemon": "dist/raft-daemon.js",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"release:alpha": "node scripts/release-runtime-sdk-preflight.mjs && npm version prerelease --preid=alpha --no-git-tag-version && cd ../.. && pnpm install --lockfile-only && git add packages/daemon/package.json packages/daemon/runtime-sdk-release-preflight.json pnpm-lock.yaml packages/shared/src/piBuiltinModels.generated.ts packages/shared/src/generated/runtimeProviderDisplayNames.ts && git commit -m \"chore: bump @botiverse/raft-daemon to v$(node -p \"require('./packages/daemon/package.json').version\")\" && git tag daemon-v$(node -p \"require('./packages/daemon/package.json').version\") && git push && git push --tags"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@botiverse/kimi-code-sdk": "0.
|
|
49
|
+
"@botiverse/kimi-code-sdk": "0.28.1-botiverse.0",
|
|
50
50
|
"@earendil-works/pi-ai": "0.80.10",
|
|
51
51
|
"@earendil-works/pi-coding-agent": "0.80.10",
|
|
52
52
|
"@jackwener/opencli": "^1.8.3",
|