@staff0rd/assist 0.337.2 → 0.338.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.
- package/dist/commands/sessions/web/bundle.js +93 -93
- package/dist/index.js +78 -61
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import { Command } from "commander";
|
|
|
6
6
|
// package.json
|
|
7
7
|
var package_default = {
|
|
8
8
|
name: "@staff0rd/assist",
|
|
9
|
-
version: "0.
|
|
9
|
+
version: "0.338.0",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -2825,13 +2825,13 @@ async function activity(options2) {
|
|
|
2825
2825
|
const activeDays = data.filter((d) => d.count > 0).length;
|
|
2826
2826
|
console.log(`${total} commits across ${activeDays} active days.`);
|
|
2827
2827
|
const weekly = /* @__PURE__ */ new Map();
|
|
2828
|
-
for (const { date, count:
|
|
2828
|
+
for (const { date, count: count7 } of data) {
|
|
2829
2829
|
const d = new Date(date);
|
|
2830
2830
|
d.setDate(d.getDate() - d.getDay());
|
|
2831
2831
|
const weekStart = d.toISOString().slice(0, 10);
|
|
2832
|
-
weekly.set(weekStart, (weekly.get(weekStart) ?? 0) +
|
|
2832
|
+
weekly.set(weekStart, (weekly.get(weekStart) ?? 0) + count7);
|
|
2833
2833
|
}
|
|
2834
|
-
const weeklyData = [...weekly.entries()].map(([date,
|
|
2834
|
+
const weeklyData = [...weekly.entries()].map(([date, count7]) => ({ date, count: count7 })).sort((a, b) => a.date.localeCompare(b.date));
|
|
2835
2835
|
const until = data[data.length - 1].date;
|
|
2836
2836
|
activityChart(weeklyData, { since, until });
|
|
2837
2837
|
}
|
|
@@ -6206,19 +6206,36 @@ async function listNewsItems(_req, res) {
|
|
|
6206
6206
|
}
|
|
6207
6207
|
|
|
6208
6208
|
// src/shared/db/listUsagePeaks.ts
|
|
6209
|
-
import { desc as desc2 } from "drizzle-orm";
|
|
6210
|
-
async function listUsagePeaks(db) {
|
|
6211
|
-
|
|
6209
|
+
import { count, desc as desc2 } from "drizzle-orm";
|
|
6210
|
+
async function listUsagePeaks(db, paging) {
|
|
6211
|
+
const query = db.select().from(usagePeaks).orderBy(
|
|
6212
6212
|
desc2(usagePeaks.resetsAt),
|
|
6213
6213
|
usagePeaks.window,
|
|
6214
6214
|
desc2(usagePeaks.createdAt),
|
|
6215
6215
|
desc2(usagePeaks.segment)
|
|
6216
6216
|
);
|
|
6217
|
+
if (paging) {
|
|
6218
|
+
return query.limit(paging.limit).offset(paging.offset);
|
|
6219
|
+
}
|
|
6220
|
+
return query;
|
|
6221
|
+
}
|
|
6222
|
+
async function countUsagePeaks(db) {
|
|
6223
|
+
const [row] = await db.select({ value: count() }).from(usagePeaks);
|
|
6224
|
+
return row?.value ?? 0;
|
|
6217
6225
|
}
|
|
6218
6226
|
|
|
6219
6227
|
// src/commands/sessions/web/listUsageHistory.ts
|
|
6220
|
-
|
|
6221
|
-
|
|
6228
|
+
var DEFAULT_PAGE_SIZE = 30;
|
|
6229
|
+
async function listUsageHistory(req, res) {
|
|
6230
|
+
const params = new URL(req.url ?? "/", "http://localhost").searchParams;
|
|
6231
|
+
const page = Math.max(0, Number(params.get("page")) || 0);
|
|
6232
|
+
const pageSize = Number(params.get("pageSize")) || DEFAULT_PAGE_SIZE;
|
|
6233
|
+
const db = await getDb();
|
|
6234
|
+
const [rows, total] = await Promise.all([
|
|
6235
|
+
listUsagePeaks(db, { limit: pageSize, offset: page * pageSize }),
|
|
6236
|
+
countUsagePeaks(db)
|
|
6237
|
+
]);
|
|
6238
|
+
respondJson(res, 200, { rows, total });
|
|
6222
6239
|
}
|
|
6223
6240
|
|
|
6224
6241
|
// src/commands/sessions/web/openInCode.ts
|
|
@@ -7292,7 +7309,7 @@ async function add(options2) {
|
|
|
7292
7309
|
import chalk65 from "chalk";
|
|
7293
7310
|
|
|
7294
7311
|
// src/commands/backlog/insertPhaseAt.ts
|
|
7295
|
-
import { count, eq as eq19 } from "drizzle-orm";
|
|
7312
|
+
import { count as count2, eq as eq19 } from "drizzle-orm";
|
|
7296
7313
|
|
|
7297
7314
|
// src/commands/backlog/shiftPhasesUp.ts
|
|
7298
7315
|
import { and as and5, desc as desc3, eq as eq18, gte } from "drizzle-orm";
|
|
@@ -7307,7 +7324,7 @@ async function shiftPhasesUp(db, itemId, fromIdx) {
|
|
|
7307
7324
|
// src/commands/backlog/insertPhaseAt.ts
|
|
7308
7325
|
async function insertPhaseAt(orm, itemId, phaseIdx, name, tasks, manualChecks, currentPhase) {
|
|
7309
7326
|
await orm.transaction(async (tx) => {
|
|
7310
|
-
const [row] = await tx.select({ cnt:
|
|
7327
|
+
const [row] = await tx.select({ cnt: count2() }).from(planPhases).where(eq19(planPhases.itemId, itemId));
|
|
7311
7328
|
const phaseCount = row?.cnt ?? 0;
|
|
7312
7329
|
await shiftPhasesUp(tx, itemId, phaseIdx);
|
|
7313
7330
|
await tx.insert(planPhases).values({ itemId, idx: phaseIdx, name, manualChecks });
|
|
@@ -7323,9 +7340,9 @@ async function insertPhaseAt(orm, itemId, phaseIdx, name, tasks, manualChecks, c
|
|
|
7323
7340
|
|
|
7324
7341
|
// src/commands/backlog/resolveInsertPosition.ts
|
|
7325
7342
|
import chalk64 from "chalk";
|
|
7326
|
-
import { count as
|
|
7343
|
+
import { count as count3, eq as eq20 } from "drizzle-orm";
|
|
7327
7344
|
async function resolveInsertPosition(orm, itemId, position) {
|
|
7328
|
-
const [row] = await orm.select({ cnt:
|
|
7345
|
+
const [row] = await orm.select({ cnt: count3() }).from(planPhases).where(eq20(planPhases.itemId, itemId));
|
|
7329
7346
|
const phaseCount = row?.cnt ?? 0;
|
|
7330
7347
|
if (position === void 0) return phaseCount;
|
|
7331
7348
|
const pos = Number.parseInt(position, 10);
|
|
@@ -7600,9 +7617,9 @@ async function confirmMove(cnt, oldOrigin, newOrigin) {
|
|
|
7600
7617
|
}
|
|
7601
7618
|
|
|
7602
7619
|
// src/commands/backlog/move-repo/countByOrigin.ts
|
|
7603
|
-
import { count as
|
|
7620
|
+
import { count as count4, eq as eq23 } from "drizzle-orm";
|
|
7604
7621
|
async function countByOrigin(orm, origin) {
|
|
7605
|
-
const [{ cnt }] = await orm.select({ cnt:
|
|
7622
|
+
const [{ cnt }] = await orm.select({ cnt: count4() }).from(items).where(eq23(items.origin, origin));
|
|
7606
7623
|
return cnt;
|
|
7607
7624
|
}
|
|
7608
7625
|
|
|
@@ -8038,14 +8055,14 @@ import { and as and10, eq as eq28 } from "drizzle-orm";
|
|
|
8038
8055
|
|
|
8039
8056
|
// src/commands/backlog/findPhase.ts
|
|
8040
8057
|
import chalk85 from "chalk";
|
|
8041
|
-
import { and as and8, count as
|
|
8058
|
+
import { and as and8, count as count5, eq as eq26 } from "drizzle-orm";
|
|
8042
8059
|
async function findPhase(id2, phase) {
|
|
8043
8060
|
const found = await findOneItem(id2);
|
|
8044
8061
|
if (!found) return void 0;
|
|
8045
8062
|
const { orm, item } = found;
|
|
8046
8063
|
const itemId = item.id;
|
|
8047
8064
|
const phaseIdx = Number.parseInt(phase, 10) - 1;
|
|
8048
|
-
const [row] = await orm.select({ cnt:
|
|
8065
|
+
const [row] = await orm.select({ cnt: count5() }).from(planPhases).where(and8(eq26(planPhases.itemId, itemId), eq26(planPhases.idx, phaseIdx)));
|
|
8049
8066
|
if (!row || row.cnt === 0) {
|
|
8050
8067
|
console.log(
|
|
8051
8068
|
chalk85.red(`Phase ${phaseIdx + 1} not found on item #${itemId}.`)
|
|
@@ -8057,7 +8074,7 @@ async function findPhase(id2, phase) {
|
|
|
8057
8074
|
}
|
|
8058
8075
|
|
|
8059
8076
|
// src/commands/backlog/reindexPhases.ts
|
|
8060
|
-
import { and as and9, asc as asc6, count as
|
|
8077
|
+
import { and as and9, asc as asc6, count as count6, eq as eq27 } from "drizzle-orm";
|
|
8061
8078
|
async function reindexPhases(db, itemId) {
|
|
8062
8079
|
const remaining = await db.select({ idx: planPhases.idx }).from(planPhases).where(eq27(planPhases.itemId, itemId)).orderBy(asc6(planPhases.idx));
|
|
8063
8080
|
for (let i = 0; i < remaining.length; i++) {
|
|
@@ -8076,7 +8093,7 @@ async function adjustCurrentPhase(db, item, removedIdx) {
|
|
|
8076
8093
|
return;
|
|
8077
8094
|
}
|
|
8078
8095
|
if (removedIdx !== currentIdx) return;
|
|
8079
|
-
const [row] = await db.select({ cnt:
|
|
8096
|
+
const [row] = await db.select({ cnt: count6() }).from(planPhases).where(eq27(planPhases.itemId, item.id));
|
|
8080
8097
|
const cnt = row?.cnt ?? 0;
|
|
8081
8098
|
await db.update(items).set({ currentPhase: cnt === 0 ? null : Math.min(currentPhase, cnt) }).where(eq27(items.id, item.id));
|
|
8082
8099
|
}
|
|
@@ -9878,7 +9895,7 @@ function calculateHalstead(node) {
|
|
|
9878
9895
|
// src/commands/complexity/shared/countSloc.ts
|
|
9879
9896
|
function countSloc(content) {
|
|
9880
9897
|
let inMultiLineComment = false;
|
|
9881
|
-
let
|
|
9898
|
+
let count7 = 0;
|
|
9882
9899
|
for (const line of content.split("\n")) {
|
|
9883
9900
|
const trimmed = line.trim();
|
|
9884
9901
|
if (inMultiLineComment) {
|
|
@@ -9886,7 +9903,7 @@ function countSloc(content) {
|
|
|
9886
9903
|
inMultiLineComment = false;
|
|
9887
9904
|
const afterComment = trimmed.substring(trimmed.indexOf("*/") + 2);
|
|
9888
9905
|
if (afterComment.trim().length > 0) {
|
|
9889
|
-
|
|
9906
|
+
count7++;
|
|
9890
9907
|
}
|
|
9891
9908
|
}
|
|
9892
9909
|
continue;
|
|
@@ -9898,7 +9915,7 @@ function countSloc(content) {
|
|
|
9898
9915
|
if (trimmed.includes("*/")) {
|
|
9899
9916
|
const afterComment = trimmed.substring(trimmed.indexOf("*/") + 2);
|
|
9900
9917
|
if (afterComment.trim().length > 0) {
|
|
9901
|
-
|
|
9918
|
+
count7++;
|
|
9902
9919
|
}
|
|
9903
9920
|
} else {
|
|
9904
9921
|
inMultiLineComment = true;
|
|
@@ -9906,10 +9923,10 @@ function countSloc(content) {
|
|
|
9906
9923
|
continue;
|
|
9907
9924
|
}
|
|
9908
9925
|
if (trimmed.length > 0) {
|
|
9909
|
-
|
|
9926
|
+
count7++;
|
|
9910
9927
|
}
|
|
9911
9928
|
}
|
|
9912
|
-
return
|
|
9929
|
+
return count7;
|
|
9913
9930
|
}
|
|
9914
9931
|
|
|
9915
9932
|
// src/commands/complexity/shared/index.ts
|
|
@@ -12084,9 +12101,9 @@ function resolveLoadOptions(options2) {
|
|
|
12084
12101
|
}
|
|
12085
12102
|
|
|
12086
12103
|
// src/commands/handover/load.ts
|
|
12087
|
-
function advisory(
|
|
12088
|
-
const noun =
|
|
12089
|
-
return `${
|
|
12104
|
+
function advisory(count7) {
|
|
12105
|
+
const noun = count7 === 1 ? "handover" : "handovers";
|
|
12106
|
+
return `${count7} unrecalled ${noun} for this repo. Run /recall to load.`;
|
|
12090
12107
|
}
|
|
12091
12108
|
function emit2(message) {
|
|
12092
12109
|
const json = JSON.stringify({
|
|
@@ -12103,9 +12120,9 @@ async function load2(options2 = {}) {
|
|
|
12103
12120
|
const origin = getCurrentOrigin(cwd);
|
|
12104
12121
|
const orm = options2.orm ?? await getDb();
|
|
12105
12122
|
await migrateDiskHandovers(orm, origin, cwd);
|
|
12106
|
-
const
|
|
12107
|
-
if (
|
|
12108
|
-
return emit2(advisory(
|
|
12123
|
+
const count7 = await countPendingHandovers(orm, origin);
|
|
12124
|
+
if (count7 === 0) return null;
|
|
12125
|
+
return emit2(advisory(count7));
|
|
12109
12126
|
}
|
|
12110
12127
|
|
|
12111
12128
|
// src/commands/handover/listPendingHandovers.ts
|
|
@@ -12739,14 +12756,14 @@ async function netcap(options2) {
|
|
|
12739
12756
|
const filter = options2.filter ?? "";
|
|
12740
12757
|
await mkdir3(dirname21(outPath), { recursive: true });
|
|
12741
12758
|
const extensionPath = await prepareExtensionForLoad(port, filter);
|
|
12742
|
-
let
|
|
12759
|
+
let count7 = 0;
|
|
12743
12760
|
const handler = createNetcapHandler({
|
|
12744
12761
|
outPath,
|
|
12745
12762
|
onPing: () => console.log(chalk134.dim("ping from extension")),
|
|
12746
12763
|
onCapture: (entry) => {
|
|
12747
|
-
|
|
12764
|
+
count7 += 1;
|
|
12748
12765
|
console.log(
|
|
12749
|
-
chalk134.green(`captured #${
|
|
12766
|
+
chalk134.green(`captured #${count7}`),
|
|
12750
12767
|
chalk134.dim(`${entry.method ?? "?"} ${entry.url ?? "?"}`)
|
|
12751
12768
|
);
|
|
12752
12769
|
}
|
|
@@ -12767,7 +12784,7 @@ async function netcap(options2) {
|
|
|
12767
12784
|
console.log(
|
|
12768
12785
|
chalk134.bold(
|
|
12769
12786
|
`
|
|
12770
|
-
netcap stopped \u2014 captured ${
|
|
12787
|
+
netcap stopped \u2014 captured ${count7} ${count7 === 1 ? "entry" : "entries"} to ${outPath}`
|
|
12771
12788
|
)
|
|
12772
12789
|
);
|
|
12773
12790
|
process.exit(0);
|
|
@@ -13303,11 +13320,11 @@ function printPromptsTable(rows) {
|
|
|
13303
13320
|
console.log(chalk137.dim(header));
|
|
13304
13321
|
console.log(chalk137.dim("-".repeat(header.length)));
|
|
13305
13322
|
for (const row of rows) {
|
|
13306
|
-
const
|
|
13323
|
+
const count7 = String(row.count).padStart(countWidth);
|
|
13307
13324
|
const tool = row.tool.padEnd(toolWidth);
|
|
13308
13325
|
const command = truncate(row.command, 60).padEnd(commandWidth);
|
|
13309
13326
|
console.log(
|
|
13310
|
-
`${chalk137.yellow(
|
|
13327
|
+
`${chalk137.yellow(count7)} ${tool} ${command} ${chalk137.dim(row.repos)}`
|
|
13311
13328
|
);
|
|
13312
13329
|
}
|
|
13313
13330
|
}
|
|
@@ -14034,8 +14051,8 @@ async function promptNavigation(currentPage, totalPages) {
|
|
|
14034
14051
|
});
|
|
14035
14052
|
return parseAction(action);
|
|
14036
14053
|
}
|
|
14037
|
-
function computeTotalPages(
|
|
14038
|
-
return Math.ceil(
|
|
14054
|
+
function computeTotalPages(count7) {
|
|
14055
|
+
return Math.ceil(count7 / PAGE_SIZE);
|
|
14039
14056
|
}
|
|
14040
14057
|
async function navigateAndDisplay(pullRequests, totalPages, currentPage) {
|
|
14041
14058
|
const delta = await promptNavigation(currentPage, totalPages);
|
|
@@ -14923,16 +14940,16 @@ import {
|
|
|
14923
14940
|
} from "ts-morph";
|
|
14924
14941
|
var suppressionPattern = /^\s*(\/\/|\/\*)\s*oxlint-disable\b/;
|
|
14925
14942
|
function countLeadingSuppressions(sourceFile) {
|
|
14926
|
-
let
|
|
14943
|
+
let count7 = 0;
|
|
14927
14944
|
for (const stmt of sourceFile.getStatementsWithComments()) {
|
|
14928
14945
|
const kind = stmt.getKind();
|
|
14929
14946
|
if ((kind === SyntaxKind2.SingleLineCommentTrivia || kind === SyntaxKind2.MultiLineCommentTrivia) && suppressionPattern.test(stmt.getText())) {
|
|
14930
|
-
|
|
14947
|
+
count7++;
|
|
14931
14948
|
} else {
|
|
14932
14949
|
break;
|
|
14933
14950
|
}
|
|
14934
14951
|
}
|
|
14935
|
-
return
|
|
14952
|
+
return count7;
|
|
14936
14953
|
}
|
|
14937
14954
|
function addImportPreservingSuppressions(sourceFile, structure) {
|
|
14938
14955
|
if (sourceFile.getImportDeclarations().length > 0) {
|
|
@@ -16909,9 +16926,9 @@ function warnUnlocated(unlocated) {
|
|
|
16909
16926
|
}
|
|
16910
16927
|
|
|
16911
16928
|
// src/commands/review/postReviewToPr.ts
|
|
16912
|
-
async function confirmPost(prNumber,
|
|
16929
|
+
async function confirmPost(prNumber, count7, options2) {
|
|
16913
16930
|
if (!options2.prompt) return true;
|
|
16914
|
-
return promptConfirm(`Post ${
|
|
16931
|
+
return promptConfirm(`Post ${count7} comment(s) to PR #${prNumber}?`, false);
|
|
16915
16932
|
}
|
|
16916
16933
|
async function postReviewToPr(synthesisPath, options2) {
|
|
16917
16934
|
const prInfo = fetchPrDiffInfo();
|
|
@@ -17958,9 +17975,9 @@ async function runReviewPipeline(paths, options2) {
|
|
|
17958
17975
|
}
|
|
17959
17976
|
|
|
17960
17977
|
// src/commands/review/reviewPr.ts
|
|
17961
|
-
function logPriorComments(
|
|
17962
|
-
if (
|
|
17963
|
-
console.log(`Including ${
|
|
17978
|
+
function logPriorComments(count7) {
|
|
17979
|
+
if (count7 === 0) return;
|
|
17980
|
+
console.log(`Including ${count7} prior review comment(s) in request.md.`);
|
|
17964
17981
|
}
|
|
17965
17982
|
function gatherChangedContext() {
|
|
17966
17983
|
const context = gatherContext();
|
|
@@ -18156,16 +18173,16 @@ function filterToSql(filter) {
|
|
|
18156
18173
|
}
|
|
18157
18174
|
|
|
18158
18175
|
// src/commands/seq/fetchSeqData.ts
|
|
18159
|
-
function buildDataParams(filter,
|
|
18176
|
+
function buildDataParams(filter, count7, from, to) {
|
|
18160
18177
|
const sqlFilter = filterToSql(filter);
|
|
18161
|
-
const sql6 = `select @Timestamp, @Level, @Exception, @Message from stream where ${sqlFilter} order by @Timestamp desc limit ${
|
|
18178
|
+
const sql6 = `select @Timestamp, @Level, @Exception, @Message from stream where ${sqlFilter} order by @Timestamp desc limit ${count7}`;
|
|
18162
18179
|
const params = new URLSearchParams({ q: sql6 });
|
|
18163
18180
|
if (from) params.set("rangeStartUtc", from);
|
|
18164
18181
|
if (to) params.set("rangeEndUtc", to);
|
|
18165
18182
|
return params;
|
|
18166
18183
|
}
|
|
18167
|
-
async function fetchSeqData(conn, filter,
|
|
18168
|
-
const params = buildDataParams(filter,
|
|
18184
|
+
async function fetchSeqData(conn, filter, count7, from, to) {
|
|
18185
|
+
const params = buildDataParams(filter, count7, from, to);
|
|
18169
18186
|
const response = await fetchSeq(conn, "/api/data", params);
|
|
18170
18187
|
const data = await response.json();
|
|
18171
18188
|
return mapDataToEvents(data);
|
|
@@ -18332,12 +18349,12 @@ function resolveConnection2(name) {
|
|
|
18332
18349
|
async function seqQuery(filter, options2) {
|
|
18333
18350
|
rejectTimestampFilter(filter);
|
|
18334
18351
|
const conn = resolveConnection2(options2.connection);
|
|
18335
|
-
const
|
|
18352
|
+
const count7 = Number.parseInt(options2.count ?? "1000", 10);
|
|
18336
18353
|
const from = options2.from ? parseRelativeTime(options2.from) : void 0;
|
|
18337
18354
|
const to = options2.to ? parseRelativeTime(options2.to) : void 0;
|
|
18338
|
-
const events = from || to ? await fetchSeqData(conn, filter,
|
|
18355
|
+
const events = from || to ? await fetchSeqData(conn, filter, count7, from, to) : await fetchSeqEvents(
|
|
18339
18356
|
conn,
|
|
18340
|
-
new URLSearchParams({ filter, count: String(
|
|
18357
|
+
new URLSearchParams({ filter, count: String(count7) })
|
|
18341
18358
|
);
|
|
18342
18359
|
if (events.length === 0) {
|
|
18343
18360
|
console.log(chalk171.yellow("No events found."));
|
|
@@ -18353,10 +18370,10 @@ async function seqQuery(filter, options2) {
|
|
|
18353
18370
|
}
|
|
18354
18371
|
console.log(chalk171.dim(`
|
|
18355
18372
|
${events.length} events`));
|
|
18356
|
-
if (events.length >=
|
|
18373
|
+
if (events.length >= count7) {
|
|
18357
18374
|
console.log(
|
|
18358
18375
|
chalk171.yellow(
|
|
18359
|
-
`Results limited to ${
|
|
18376
|
+
`Results limited to ${count7}. Use --count to retrieve more.`
|
|
18360
18377
|
)
|
|
18361
18378
|
);
|
|
18362
18379
|
}
|
|
@@ -19403,13 +19420,13 @@ function logs(options2) {
|
|
|
19403
19420
|
console.log("No voice log file found");
|
|
19404
19421
|
return;
|
|
19405
19422
|
}
|
|
19406
|
-
const
|
|
19423
|
+
const count7 = Number.parseInt(options2.lines ?? "150", 10);
|
|
19407
19424
|
const content = readFileSync38(voicePaths.log, "utf8").trim();
|
|
19408
19425
|
if (!content) {
|
|
19409
19426
|
console.log("Voice log is empty");
|
|
19410
19427
|
return;
|
|
19411
19428
|
}
|
|
19412
|
-
const lines = content.split("\n").slice(-
|
|
19429
|
+
const lines = content.split("\n").slice(-count7);
|
|
19413
19430
|
for (const line of lines) {
|
|
19414
19431
|
try {
|
|
19415
19432
|
const event = JSON.parse(line);
|
|
@@ -19556,10 +19573,10 @@ function isProcessAlive3(pid) {
|
|
|
19556
19573
|
return false;
|
|
19557
19574
|
}
|
|
19558
19575
|
}
|
|
19559
|
-
function readRecentLogs(
|
|
19576
|
+
function readRecentLogs(count7) {
|
|
19560
19577
|
if (!existsSync48(voicePaths.log)) return [];
|
|
19561
19578
|
const lines = readFileSync40(voicePaths.log, "utf8").trim().split("\n");
|
|
19562
|
-
return lines.slice(-
|
|
19579
|
+
return lines.slice(-count7);
|
|
19563
19580
|
}
|
|
19564
19581
|
function status() {
|
|
19565
19582
|
if (!existsSync48(voicePaths.pid)) {
|
|
@@ -20592,9 +20609,9 @@ async function drainDaemon() {
|
|
|
20592
20609
|
console.log("Sessions daemon is not running; cleared persisted sessions");
|
|
20593
20610
|
return;
|
|
20594
20611
|
}
|
|
20595
|
-
const
|
|
20612
|
+
const count7 = await requestDrain(socket);
|
|
20596
20613
|
socket.destroy();
|
|
20597
|
-
console.log(`Drained ${
|
|
20614
|
+
console.log(`Drained ${count7} session(s)`);
|
|
20598
20615
|
}
|
|
20599
20616
|
function requestDrain(socket) {
|
|
20600
20617
|
socket.write(`${JSON.stringify({ type: "drain" })}
|