@vibedeckx/linux-x64 0.3.24 → 0.3.25
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/bin.js +80 -9
- package/package.json +1 -1
package/dist/bin.js
CHANGED
|
@@ -205488,9 +205488,18 @@ var SESSION_TOOLS_MCP_SERVER_NAME = "vibedeckx";
|
|
|
205488
205488
|
var PROPOSE_SCHEDULE_TOOL = "propose_schedule";
|
|
205489
205489
|
var CANONICAL_PROPOSE_SCHEDULE_TOOL = `mcp__${SESSION_TOOLS_MCP_SERVER_NAME}__${PROPOSE_SCHEDULE_TOOL}`;
|
|
205490
205490
|
var PROPOSE_SCHEDULE_DESCRIPTION = [
|
|
205491
|
-
"Propose a recurring scheduled check to the user.
|
|
205492
|
-
"
|
|
205493
|
-
|
|
205491
|
+
"Propose a recurring scheduled check to the user. This is the only way to schedule work in this",
|
|
205492
|
+
"environment. Call it in either situation:",
|
|
205493
|
+
'- The user asks for something recurring \u2014 "every morning", "nightly", "hourly", "on a cron",',
|
|
205494
|
+
' "keep an eye on". Such a request IS this tool; it is not a programming task.',
|
|
205495
|
+
"- You are telling the user that something needs periodic follow-up observation \u2014 e.g. after a",
|
|
205496
|
+
" fix whose effect can only be confirmed over time, or a flaky failure worth watching.",
|
|
205497
|
+
"",
|
|
205498
|
+
"Never satisfy a scheduling request by writing a crontab entry, systemd timer, launchd plist, CI",
|
|
205499
|
+
"cron trigger, setInterval, or sleep loop: the platform owns execution, and anything you wire up",
|
|
205500
|
+
"by hand is invisible to the user and does not survive this session. (Adding scheduling to the",
|
|
205501
|
+
"user's OWN product \u2014 a cron block in their deployment config, a timer in their app \u2014 is still",
|
|
205502
|
+
"ordinary coding work. This tool is for scheduling YOUR follow-up runs, not their features.)",
|
|
205494
205503
|
"",
|
|
205495
205504
|
"The proposal is shown to the user as a confirmation card; it does NOT create anything by",
|
|
205496
205505
|
"itself and this call does not wait for the user. Say you have SUGGESTED a scheduled check",
|
|
@@ -205510,6 +205519,18 @@ var PROPOSE_SCHEDULE_DESCRIPTION = [
|
|
|
205510
205519
|
"",
|
|
205511
205520
|
"Project, execution target and branch are taken from this session \u2014 do not describe them here."
|
|
205512
205521
|
].join("\n");
|
|
205522
|
+
var SESSION_TOOLS_MCP_INSTRUCTIONS = [
|
|
205523
|
+
`\`${PROPOSE_SCHEDULE_TOOL}\` is the only way to schedule work in this environment.`,
|
|
205524
|
+
'When the user asks for anything recurring \u2014 nightly, hourly, every morning, on a cron, "keep',
|
|
205525
|
+
'watching" \u2014 call it instead of writing a crontab entry, systemd timer, or setInterval loop.',
|
|
205526
|
+
"Scheduling inside the user's own product remains ordinary coding work."
|
|
205527
|
+
].join("\n");
|
|
205528
|
+
var SESSION_TOOLS_SYSTEM_PROMPT_HINT = [
|
|
205529
|
+
"Scheduling: when the user asks you to run something on a schedule (nightly, hourly, every",
|
|
205530
|
+
`morning, on a cron, "keep watching"), call the \`${CANONICAL_PROPOSE_SCHEDULE_TOOL}\` tool. That`,
|
|
205531
|
+
"is the only way to schedule work here \u2014 do not hand-roll a crontab entry, systemd timer, or",
|
|
205532
|
+
"setInterval loop for it. Writing scheduling into the user's own project is still normal coding."
|
|
205533
|
+
].join(" ");
|
|
205513
205534
|
var PROPOSE_SCHEDULE_INPUT_SCHEMA = {
|
|
205514
205535
|
type: "object",
|
|
205515
205536
|
properties: {
|
|
@@ -205849,7 +205870,7 @@ function withNpxFallback(nativeBinary, args) {
|
|
|
205849
205870
|
}
|
|
205850
205871
|
return { command: "npx", args: ["-y", CLAUDE_NPM_PACKAGE, ...args] };
|
|
205851
205872
|
}
|
|
205852
|
-
function buildClaudeSessionSpawnConfig(nativeBinary, permissionMode, mcpConfigArg, model, allowedTools) {
|
|
205873
|
+
function buildClaudeSessionSpawnConfig(nativeBinary, permissionMode, mcpConfigArg, model, allowedTools, appendSystemPrompt) {
|
|
205853
205874
|
const permissionFlag = permissionMode === "plan" ? "--permission-mode=plan" : "--dangerously-skip-permissions";
|
|
205854
205875
|
const args = [
|
|
205855
205876
|
...STREAM_JSON_ARGS,
|
|
@@ -205873,6 +205894,9 @@ function buildClaudeSessionSpawnConfig(nativeBinary, permissionMode, mcpConfigAr
|
|
|
205873
205894
|
if (allowedTools?.length) {
|
|
205874
205895
|
args.push("--allowedTools", allowedTools.join(","));
|
|
205875
205896
|
}
|
|
205897
|
+
if (appendSystemPrompt?.trim()) {
|
|
205898
|
+
args.push("--append-system-prompt", appendSystemPrompt.trim());
|
|
205899
|
+
}
|
|
205876
205900
|
return withNpxFallback(nativeBinary, args);
|
|
205877
205901
|
}
|
|
205878
205902
|
function buildClaudeStreamExecutorSpawn(nativeBinary) {
|
|
@@ -207084,7 +207108,8 @@ var ClaudeCodeProvider = class {
|
|
|
207084
207108
|
permissionMode,
|
|
207085
207109
|
Object.keys(mcpServers).length > 0 ? buildClaudeMcpConfigArg(mcpServers) : void 0,
|
|
207086
207110
|
model,
|
|
207087
|
-
sessionToolsMcp ? [CANONICAL_PROPOSE_SCHEDULE_TOOL] : void 0
|
|
207111
|
+
sessionToolsMcp ? [CANONICAL_PROPOSE_SCHEDULE_TOOL] : void 0,
|
|
207112
|
+
sessionToolsMcp ? SESSION_TOOLS_SYSTEM_PROMPT_HINT : void 0
|
|
207088
207113
|
);
|
|
207089
207114
|
}
|
|
207090
207115
|
parseStdoutLine(line, _sessionId) {
|
|
@@ -233300,12 +233325,15 @@ function connectPersistentRemoteWs(sessionId, remoteInfo, cache2, reverseConnect
|
|
|
233300
233325
|
const upstreamEpoch = requestedHistory?.historyEpoch ?? cachedHead?.historyEpoch ?? void 0;
|
|
233301
233326
|
const upstreamAfter = requestedHistory?.afterEntryIndex ?? (upstreamEpoch !== void 0 ? cachedHead?.lastTurnEndEntryIndex ?? void 0 : void 0);
|
|
233302
233327
|
const upstreamParams = new URLSearchParams();
|
|
233303
|
-
if (upstreamEpoch !== void 0 && upstreamAfter !== void 0) {
|
|
233328
|
+
if (hasCachedData && upstreamEpoch !== void 0 && upstreamAfter !== void 0) {
|
|
233304
233329
|
upstreamParams.set("after", String(upstreamAfter));
|
|
233305
233330
|
upstreamParams.set("epoch", String(upstreamEpoch));
|
|
233306
233331
|
}
|
|
233307
233332
|
const usesBoundedReplay = upstreamParams.size > 0;
|
|
233308
233333
|
const wsPath = `/api/agent-sessions/${encodeURIComponent(remoteInfo.remoteSessionId)}/stream${usesBoundedReplay ? `?${upstreamParams}` : ""}`;
|
|
233334
|
+
if (!hasCachedData) {
|
|
233335
|
+
cache2.declareCoverage(sessionId, { epoch: upstreamEpoch ?? null, start: 0 });
|
|
233336
|
+
}
|
|
233309
233337
|
const adapter = new VirtualWsAdapter(
|
|
233310
233338
|
(data) => reverseConnectManager.sendChannelData(remoteInfo.remoteServerId, channelId, data),
|
|
233311
233339
|
() => reverseConnectManager.closeChannel(remoteInfo.remoteServerId, channelId)
|
|
@@ -239861,6 +239889,11 @@ function percentile(sorted, fraction) {
|
|
|
239861
239889
|
const rank = Math.ceil(fraction * sorted.length);
|
|
239862
239890
|
return sorted[Math.min(sorted.length, Math.max(1, rank)) - 1];
|
|
239863
239891
|
}
|
|
239892
|
+
function coverageAdmitsReplay(coverage, clientEpoch, afterEntryIndex) {
|
|
239893
|
+
if (!coverage) return false;
|
|
239894
|
+
if (clientEpoch !== void 0 && coverage.epoch !== null && clientEpoch !== coverage.epoch) return false;
|
|
239895
|
+
return (afterEntryIndex ?? -1) + 1 >= coverage.start;
|
|
239896
|
+
}
|
|
239864
239897
|
var RemotePatchCache = class {
|
|
239865
239898
|
cache = /* @__PURE__ */ new Map();
|
|
239866
239899
|
getOrCreate(sessionId) {
|
|
@@ -239879,6 +239912,7 @@ var RemotePatchCache = class {
|
|
|
239879
239912
|
historyEpoch: null,
|
|
239880
239913
|
latestEntryIndex: null,
|
|
239881
239914
|
lastTurnEndEntryIndex: null,
|
|
239915
|
+
coverage: null,
|
|
239882
239916
|
sessionStatus: null
|
|
239883
239917
|
};
|
|
239884
239918
|
this.cache.set(sessionId, entry);
|
|
@@ -239927,6 +239961,7 @@ var RemotePatchCache = class {
|
|
|
239927
239961
|
if (metadata.lastTurnEnd !== null) lastTurnEndEntryIndex = Math.max(lastTurnEndEntryIndex ?? -1, metadata.lastTurnEnd);
|
|
239928
239962
|
}
|
|
239929
239963
|
const sessionStatus = existing?.sessionStatus ?? null;
|
|
239964
|
+
const coverage = existing?.coverage ?? null;
|
|
239930
239965
|
this.cache.set(sessionId, {
|
|
239931
239966
|
messages,
|
|
239932
239967
|
approxBytes: messages.reduce((sum, raw) => sum + raw.length, 0),
|
|
@@ -239940,6 +239975,7 @@ var RemotePatchCache = class {
|
|
|
239940
239975
|
historyEpoch,
|
|
239941
239976
|
latestEntryIndex,
|
|
239942
239977
|
lastTurnEndEntryIndex,
|
|
239978
|
+
coverage,
|
|
239943
239979
|
sessionStatus
|
|
239944
239980
|
});
|
|
239945
239981
|
}
|
|
@@ -239981,7 +240017,19 @@ var RemotePatchCache = class {
|
|
|
239981
240017
|
}
|
|
239982
240018
|
}
|
|
239983
240019
|
setHistoryEpoch(sessionId, epoch) {
|
|
239984
|
-
this.getOrCreate(sessionId)
|
|
240020
|
+
const entry = this.getOrCreate(sessionId);
|
|
240021
|
+
entry.historyEpoch = epoch;
|
|
240022
|
+
if (!entry.coverage) return;
|
|
240023
|
+
if (entry.coverage.epoch === null) entry.coverage.epoch = epoch;
|
|
240024
|
+
else if (entry.coverage.epoch !== epoch) entry.coverage = null;
|
|
240025
|
+
}
|
|
240026
|
+
/**
|
|
240027
|
+
* Record the interval this cache was authorized to fetch. Callers pass the
|
|
240028
|
+
* lower bound they REQUESTED upstream — 0 for an unbounded replay, N+1 for
|
|
240029
|
+
* `after=N`, the window's first index for a REST seed — not what came back.
|
|
240030
|
+
*/
|
|
240031
|
+
declareCoverage(sessionId, coverage) {
|
|
240032
|
+
this.getOrCreate(sessionId).coverage = { ...coverage };
|
|
239985
240033
|
}
|
|
239986
240034
|
/** Start a fresh entry-index namespace without dropping live connections. */
|
|
239987
240035
|
resetHistory(sessionId, epoch) {
|
|
@@ -239993,6 +240041,7 @@ var RemotePatchCache = class {
|
|
|
239993
240041
|
entry.historyEpoch = epoch;
|
|
239994
240042
|
entry.latestEntryIndex = null;
|
|
239995
240043
|
entry.lastTurnEndEntryIndex = null;
|
|
240044
|
+
entry.coverage = { epoch, start: 0 };
|
|
239996
240045
|
}
|
|
239997
240046
|
setLastTurnEndEntryIndex(sessionId, index) {
|
|
239998
240047
|
this.getOrCreate(sessionId).lastTurnEndEntryIndex = index;
|
|
@@ -247674,6 +247723,10 @@ var routes11 = async (fastify2) => {
|
|
|
247674
247723
|
const patch = ConversationPatch.addEntry(entryIndex, message);
|
|
247675
247724
|
fastify2.remotePatchCache.appendMessage(localSessionId, JSON.stringify({ JsonPatch: patch }), true);
|
|
247676
247725
|
}
|
|
247726
|
+
fastify2.remotePatchCache.declareCoverage(localSessionId, {
|
|
247727
|
+
epoch: remoteData.historyWindow?.historyEpoch ?? null,
|
|
247728
|
+
start: seededEntries[0]?.entryIndex ?? 0
|
|
247729
|
+
});
|
|
247677
247730
|
if (remoteData.historyWindow) {
|
|
247678
247731
|
fastify2.remotePatchCache.setHistoryEpoch(localSessionId, remoteData.historyWindow.historyEpoch);
|
|
247679
247732
|
if (remoteData.historyWindow.lastTurnEndEntryIndex !== null) {
|
|
@@ -247942,6 +247995,9 @@ var routes11 = async (fastify2) => {
|
|
|
247942
247995
|
);
|
|
247943
247996
|
if (result.ok) {
|
|
247944
247997
|
const data = result.data;
|
|
247998
|
+
console.log(
|
|
247999
|
+
`[API] history-window ${req.params.sessionId}: latest=${String(data.latestEntryIndex)}, lastTurnEnd=${String(data.lastTurnEndEntryIndex)}, hasMore=${String(data.hasMore)}, before=${before ?? "-"}, turns=${turns}`
|
|
248000
|
+
);
|
|
247945
248001
|
return reply.code(200).send({
|
|
247946
248002
|
...data,
|
|
247947
248003
|
session: data.session ? {
|
|
@@ -247997,6 +248053,9 @@ var routes11 = async (fastify2) => {
|
|
|
247997
248053
|
if (!remoteInfo) return reply.code(404).send({ error: "Remote session not found" });
|
|
247998
248054
|
const cached2 = fastify2.remotePatchCache.get(req.params.sessionId);
|
|
247999
248055
|
if (cached2?.historyEpoch !== null && cached2?.lastTurnEndEntryIndex !== null && cached2?.sessionStatus) {
|
|
248056
|
+
console.log(
|
|
248057
|
+
`[API] history-head ${req.params.sessionId} (from cache): latest=${cached2.latestEntryIndex}, lastTurnEnd=${cached2.lastTurnEndEntryIndex}, status=${cached2.sessionStatus}`
|
|
248058
|
+
);
|
|
248000
248059
|
return reply.code(200).send({
|
|
248001
248060
|
historyEpoch: cached2.historyEpoch,
|
|
248002
248061
|
latestEntryIndex: cached2.latestEntryIndex,
|
|
@@ -248009,7 +248068,13 @@ var routes11 = async (fastify2) => {
|
|
|
248009
248068
|
"GET",
|
|
248010
248069
|
`/api/agent-sessions/${encodeURIComponent(remoteInfo.remoteSessionId)}/history-head`
|
|
248011
248070
|
);
|
|
248012
|
-
if (result.ok)
|
|
248071
|
+
if (result.ok) {
|
|
248072
|
+
const head3 = result.data;
|
|
248073
|
+
console.log(
|
|
248074
|
+
`[API] history-head ${req.params.sessionId} (from worker): latest=${String(head3.latestEntryIndex)}, lastTurnEnd=${String(head3.lastTurnEndEntryIndex)}, status=${String(head3.status)}`
|
|
248075
|
+
);
|
|
248076
|
+
return reply.code(200).send(result.data);
|
|
248077
|
+
}
|
|
248013
248078
|
if (result.status !== 404) return reply.code(proxyStatus(result)).send(result.data);
|
|
248014
248079
|
const legacy = await proxyAuto(
|
|
248015
248080
|
remoteInfo.remoteServerId,
|
|
@@ -251582,6 +251647,11 @@ var routes23 = async (fastify2) => {
|
|
|
251582
251647
|
afterEntryIndex
|
|
251583
251648
|
);
|
|
251584
251649
|
console.log(`[AgentWS] Replaying cached msgs for ${sessionId} after=${replayAfter}`);
|
|
251650
|
+
if (!coverageAdmitsReplay(cacheEntry.coverage, historyEpoch, afterEntryIndex)) {
|
|
251651
|
+
console.warn(
|
|
251652
|
+
`[AgentWS] COVERAGE GAP ${sessionId}: client needs from ${(afterEntryIndex ?? -1) + 1} (epoch=${historyEpoch ?? "-"}), cache covers from ${cacheEntry.coverage?.start ?? "unknown"} (epoch=${cacheEntry.coverage?.epoch ?? "-"}), frames=${cacheEntry.messages.length}, entriesLatest=${cacheEntry.latestEntryIndex ?? "-"} \u2014 Ready will be sent anyway`
|
|
251653
|
+
);
|
|
251654
|
+
}
|
|
251585
251655
|
try {
|
|
251586
251656
|
socket.send(JSON.stringify({
|
|
251587
251657
|
HistorySync: {
|
|
@@ -253432,7 +253502,8 @@ var routes31 = async (fastify2) => {
|
|
|
253432
253502
|
return respond({
|
|
253433
253503
|
protocolVersion: PROTOCOL_VERSION2,
|
|
253434
253504
|
capabilities: { tools: {} },
|
|
253435
|
-
serverInfo: { name: "vibedeckx-session-tools", version: "1.0.0" }
|
|
253505
|
+
serverInfo: { name: "vibedeckx-session-tools", version: "1.0.0" },
|
|
253506
|
+
instructions: SESSION_TOOLS_MCP_INSTRUCTIONS
|
|
253436
253507
|
});
|
|
253437
253508
|
case "ping":
|
|
253438
253509
|
return respond({});
|