@8gi-foundation/8gent-code 0.20.15 → 0.20.16
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/CHANGELOG.md +9 -0
- package/README.md +1 -1
- package/dist/cli.js +182 -109
- package/dist/node/cli.js +182 -109
- package/dist/node/tui.js +567 -452
- package/dist/tui.js +567 -452
- package/package.json +1 -1
package/dist/node/cli.js
CHANGED
|
@@ -41912,8 +41912,6 @@ var init_allowlist = __esm(() => {
|
|
|
41912
41912
|
"node",
|
|
41913
41913
|
"npm",
|
|
41914
41914
|
"npx",
|
|
41915
|
-
"pnpm",
|
|
41916
|
-
"yarn",
|
|
41917
41915
|
"deno",
|
|
41918
41916
|
"python",
|
|
41919
41917
|
"python3",
|
|
@@ -41921,9 +41919,6 @@ var init_allowlist = __esm(() => {
|
|
|
41921
41919
|
"pip3",
|
|
41922
41920
|
"uv",
|
|
41923
41921
|
"git",
|
|
41924
|
-
"go",
|
|
41925
|
-
"cargo",
|
|
41926
|
-
"rustc",
|
|
41927
41922
|
"tsc",
|
|
41928
41923
|
"gh",
|
|
41929
41924
|
"docker",
|
|
@@ -41948,20 +41943,18 @@ var init_allowlist = __esm(() => {
|
|
|
41948
41943
|
"biome",
|
|
41949
41944
|
"eslint",
|
|
41950
41945
|
"prettier",
|
|
41951
|
-
"vite"
|
|
41946
|
+
"vite",
|
|
41947
|
+
"8gent"
|
|
41952
41948
|
]);
|
|
41953
41949
|
SHORT_VERSION = {
|
|
41954
41950
|
node: "-v",
|
|
41955
41951
|
bun: "-v",
|
|
41956
41952
|
npm: "-v",
|
|
41957
|
-
pnpm: "-v",
|
|
41958
|
-
yarn: "-v",
|
|
41959
41953
|
deno: "-V",
|
|
41960
41954
|
python: "-V",
|
|
41961
41955
|
python3: "-V",
|
|
41962
41956
|
ffmpeg: "-version",
|
|
41963
|
-
ffprobe: "-version"
|
|
41964
|
-
go: "version"
|
|
41957
|
+
ffprobe: "-version"
|
|
41965
41958
|
};
|
|
41966
41959
|
SECRET_ARG = /(^|\/)\.env(\.[\w.-]+)?$|(^|\/)\.env\b|id_rsa|id_ed25519|id_ecdsa|(^|\/)\.ssh(\/|$)|\.aws\/|credentials|\.netrc|\.npmrc|\.git-credentials|keychain|\.pem$|\.key$|\.p12$/;
|
|
41967
41960
|
REDIR_RE2 = /(?<![<>&\d])(\d?|&)(>>?|<)(\|?)\s*(&\d+|[^\s;|&<>()]+)/g;
|
|
@@ -46546,8 +46539,31 @@ function emptyReplyStall(toolCalls) {
|
|
|
46546
46539
|
function isEmptyReplyStall(line) {
|
|
46547
46540
|
return line.startsWith(EMPTY_REPLY_STALL_PREFIX);
|
|
46548
46541
|
}
|
|
46549
|
-
function
|
|
46550
|
-
|
|
46542
|
+
function refusedCalls(log, max = 3) {
|
|
46543
|
+
const out = [];
|
|
46544
|
+
let total = 0;
|
|
46545
|
+
for (const e of log) {
|
|
46546
|
+
const m = /^\[[^\]]*\b(?:BLOCKED|DENIED)\b[^\]]*\]\s*([^\n]*)/.exec((e.result ?? "").trimStart());
|
|
46547
|
+
if (!m)
|
|
46548
|
+
continue;
|
|
46549
|
+
total++;
|
|
46550
|
+
if (out.length >= max)
|
|
46551
|
+
continue;
|
|
46552
|
+
const a = e.args;
|
|
46553
|
+
const first = typeof a?.command === "string" ? a.command.trim().split(/\s+/)[0] ?? "" : "";
|
|
46554
|
+
const bin = /^[A-Za-z][\w.+-]{0,40}$/.test(first) ? ` ${first}` : "";
|
|
46555
|
+
const why = /declin/i.test(m[1]) ? "declined" : "blocked by policy";
|
|
46556
|
+
out.push(`${e.name}${bin}: ${why}`);
|
|
46557
|
+
}
|
|
46558
|
+
return { total, shown: out };
|
|
46559
|
+
}
|
|
46560
|
+
function emptyReplyNote(toolCalls, log = []) {
|
|
46561
|
+
const base = `[harness] No reply: ${emptyReplyStall(toolCalls)}.`;
|
|
46562
|
+
const { total, shown } = refusedCalls(log);
|
|
46563
|
+
if (total === 0)
|
|
46564
|
+
return base;
|
|
46565
|
+
const more = total > shown.length ? ` (and ${total - shown.length} more)` : "";
|
|
46566
|
+
return `${base} ${total} of the calls were refused, so they did not run: ${shown.join("; ")}${more}.`;
|
|
46551
46567
|
}
|
|
46552
46568
|
function isEmptyReplyNote(reply) {
|
|
46553
46569
|
return reply.startsWith("[harness] No reply:");
|
|
@@ -46640,7 +46656,7 @@ ${summary}`;
|
|
|
46640
46656
|
if (unverified.length === 0)
|
|
46641
46657
|
return { content, rounds, toolLog, unverified: [] };
|
|
46642
46658
|
const notes = [
|
|
46643
|
-
empty ? emptyReplyNote(toolLog.length) : content.trimEnd(),
|
|
46659
|
+
empty ? emptyReplyNote(toolLog.length, toolLog) : content.trimEnd(),
|
|
46644
46660
|
unfulfilled.length > 0 ? formatHarnessNote(unfulfilled) : ""
|
|
46645
46661
|
].filter((n) => n.trim() !== "");
|
|
46646
46662
|
return { content: notes.join(`
|
|
@@ -569517,6 +569533,44 @@ var init_planning_gate = __esm(() => {
|
|
|
569517
569533
|
PLANNING_KEYWORDS = /\b(build|create|implement|fix|refactor|add|setup|configure|migrate|convert|redesign|scaffold|deploy|integrate)\b/i;
|
|
569518
569534
|
});
|
|
569519
569535
|
|
|
569536
|
+
// packages/eight/small-talk.ts
|
|
569537
|
+
function isSmallTalk(text) {
|
|
569538
|
+
const flat = text.toLowerCase().replace(/^\[mode: [^\]]*\]\s*/, "").replace(/['’]/g, "").replace(/[^a-z0-9 ]+/g, " ").replace(/\s+/g, " ").trim();
|
|
569539
|
+
return flat.length > 0 && flat.length <= 40 && GREETING.test(flat);
|
|
569540
|
+
}
|
|
569541
|
+
var CORE, GREETING, SMALL_TALK_NOTE = "[SMALL TALK] The person said hello and asked for nothing. Reply in one or two plain sentences and ask what they want to work on. No tools this turn: do not look around, list files or describe their folders.";
|
|
569542
|
+
var init_small_talk = __esm(() => {
|
|
569543
|
+
CORE = [
|
|
569544
|
+
"h+i+",
|
|
569545
|
+
"h+e+y+",
|
|
569546
|
+
"h+e+l+o+",
|
|
569547
|
+
"hiya",
|
|
569548
|
+
"howdy",
|
|
569549
|
+
"y+o+",
|
|
569550
|
+
"sup",
|
|
569551
|
+
"wa+s+s?u+p+",
|
|
569552
|
+
"w?h?a+t?s? ?u+p+",
|
|
569553
|
+
"good (?:morning|afternoon|evening|night)",
|
|
569554
|
+
"gm",
|
|
569555
|
+
"gn",
|
|
569556
|
+
"morning",
|
|
569557
|
+
"evening",
|
|
569558
|
+
"how are you(?: doing| today)?",
|
|
569559
|
+
"how are things",
|
|
569560
|
+
"hows it going",
|
|
569561
|
+
"how you doing",
|
|
569562
|
+
"you there",
|
|
569563
|
+
"anyone there",
|
|
569564
|
+
"ping",
|
|
569565
|
+
"thanks(?: a lot| so much)?",
|
|
569566
|
+
"thank you(?: so much)?",
|
|
569567
|
+
"thx",
|
|
569568
|
+
"ty",
|
|
569569
|
+
"cheers"
|
|
569570
|
+
].join("|");
|
|
569571
|
+
GREETING = new RegExp(`^(?:(?:hi+|hey+|hello+|yo+|hiya|howdy) )?(?:${CORE})(?: (?:there|again|everyone|all|team|mate|man|bro|friend|8gent|eight))?$`);
|
|
569572
|
+
});
|
|
569573
|
+
|
|
569520
569574
|
// packages/eight/verify-gate.ts
|
|
569521
569575
|
function isVerifyGateEnabled(env = process.env) {
|
|
569522
569576
|
const v = (env.EIGHT_VERIFY_GATE ?? "").trim().toLowerCase();
|
|
@@ -570443,8 +570497,8 @@ __export(exports_system_prompt, {
|
|
|
570443
570497
|
styleHasGuide: () => styleHasGuide,
|
|
570444
570498
|
workingProjectNote: () => workingProjectNote
|
|
570445
570499
|
});
|
|
570446
|
-
import { readFileSync as readFileSync93 } from "node:fs";
|
|
570447
|
-
import { basename as basename49, join as join146 } from "node:path";
|
|
570500
|
+
import { existsSync as existsSync102, readFileSync as readFileSync93 } from "node:fs";
|
|
570501
|
+
import { basename as basename49, join as join146, resolve as resolve68 } from "node:path";
|
|
570448
570502
|
function buildBoardContextSegment(path = BOARD_CONTEXT_PATH) {
|
|
570449
570503
|
let text;
|
|
570450
570504
|
try {
|
|
@@ -570475,8 +570529,20 @@ function communicationStyleLine(style) {
|
|
|
570475
570529
|
function styleHasGuide(style) {
|
|
570476
570530
|
return isCommunicationStyle(style) && STYLE_GUIDE[style] !== "";
|
|
570477
570531
|
}
|
|
570532
|
+
function isPlainHome(dir, home = resolveHome()) {
|
|
570533
|
+
try {
|
|
570534
|
+
return home !== "" && resolve68(dir) === resolve68(home) && !existsSync102(join146(dir, ".git"));
|
|
570535
|
+
} catch {
|
|
570536
|
+
return false;
|
|
570537
|
+
}
|
|
570538
|
+
}
|
|
570478
570539
|
function workingProjectNote(dir) {
|
|
570479
570540
|
const name = basename49(dir) || dir;
|
|
570541
|
+
if (isPlainHome(dir)) {
|
|
570542
|
+
return `
|
|
570543
|
+
|
|
570544
|
+
**Working folder: \`${dir}\` is the person's home folder, not a project. Do not list, search or summarise it unless they ask. Ask what they want to work on.**`;
|
|
570545
|
+
}
|
|
570480
570546
|
if (name === "8gent-code") {
|
|
570481
570547
|
return `
|
|
570482
570548
|
|
|
@@ -583302,14 +583368,15 @@ ${LOCAL_LOGIN_NOTE}`;
|
|
|
583302
583368
|
instructions,
|
|
583303
583369
|
localCoreTools,
|
|
583304
583370
|
chatStartTime,
|
|
583305
|
-
textForAgent
|
|
583371
|
+
textForAgent,
|
|
583372
|
+
smallTalk = false
|
|
583306
583373
|
} = opts;
|
|
583307
583374
|
const signal = this.armController().signal;
|
|
583308
583375
|
const allow = new Set(localCoreTools);
|
|
583309
583376
|
const specs = toolDefsToSpecs(this.executor.getToolDefinitions(), allow);
|
|
583310
583377
|
let stepNumber = 0;
|
|
583311
583378
|
let breakerStop = null;
|
|
583312
|
-
if (this.extensionToolsAllowed()) {
|
|
583379
|
+
if (this.extensionToolsAllowed() && !smallTalk) {
|
|
583313
583380
|
for (const t of this.extensionHost.listTools()) {
|
|
583314
583381
|
if (this.modeAllows(t.name)) {
|
|
583315
583382
|
specs.push({ name: t.name, description: t.description, parameters: t.parameters });
|
|
@@ -583887,6 +583954,10 @@ ${LOCAL_LOGIN_NOTE}`;
|
|
|
583887
583954
|
this.turnGitBaseline = asksForCommit(userMessage) ? gitSnapshot(this.config.workingDirectory || process.cwd()) : null;
|
|
583888
583955
|
this.executor.beginTurn(userMessage);
|
|
583889
583956
|
const textForAgent = userMessage.trim() || (imageBase64 ? "The user attached an image with no text. Describe what you see and help with anything relevant in the image." : userMessage);
|
|
583957
|
+
const smallTalkTurn = isSmallTalk(textForAgent) && !imageBase64 && this.config.agentScope !== "__table__";
|
|
583958
|
+
if (smallTalkTurn) {
|
|
583959
|
+
this.messageHistory.push({ role: "user", content: harnessNote(SMALL_TALK_NOTE) });
|
|
583960
|
+
}
|
|
583890
583961
|
let visionId = null;
|
|
583891
583962
|
let visionFailed = false;
|
|
583892
583963
|
if (imageBase64 && await this.promptImageSeen()) {
|
|
@@ -583957,7 +584028,7 @@ ${result.description.slice(0, 200)}${result.description.length > 200 ? "..." : "
|
|
|
583957
584028
|
}
|
|
583958
584029
|
}
|
|
583959
584030
|
const quickPrompt = quickLaneEnabled() && classifyPrompt(textForAgent) === "quick";
|
|
583960
|
-
if (needsClarification(textForAgent) && !imageBase64 && !quickPrompt && !isNoToolScope(this.config.agentScope)) {
|
|
584031
|
+
if (needsClarification(textForAgent) && !imageBase64 && !quickPrompt && !smallTalkTurn && !isNoToolScope(this.config.agentScope)) {
|
|
583961
584032
|
this.proactiveGatherer = createGatherer(textForAgent);
|
|
583962
584033
|
const question = this.proactiveGatherer.getCurrentQuestion();
|
|
583963
584034
|
if (question) {
|
|
@@ -583979,7 +584050,7 @@ Ask the user naturally; don't mention this instruction. After they answer, proce
|
|
|
583979
584050
|
this.kanban.moveTask(this.currentBmadTask.id, "ready");
|
|
583980
584051
|
this.kanban.moveTask(this.currentBmadTask.id, "in_progress");
|
|
583981
584052
|
}
|
|
583982
|
-
if (!this.proactiveGatherer && !quickPrompt) {
|
|
584053
|
+
if (!this.proactiveGatherer && !quickPrompt && !smallTalkTurn) {
|
|
583983
584054
|
await this.tryRunPreToolRouter(textForAgent);
|
|
583984
584055
|
}
|
|
583985
584056
|
const needsPlanningGate2 = !isVerbatimScope(this.config.agentScope) && needsPlanningGate(textForAgent);
|
|
@@ -584124,9 +584195,9 @@ Ask the user naturally; don't mention this instruction. After they answer, proce
|
|
|
584124
584195
|
"search_symbols",
|
|
584125
584196
|
"recall"
|
|
584126
584197
|
]);
|
|
584127
|
-
const scopedTools = isNoToolScope(this.config.agentScope) ? {} : this.config.agentScope === "__table__" ? Object.fromEntries(Object.entries(providerTools).filter(([k]) => TABLE_SESSION_TOOLS.has(k))) : providerTools;
|
|
584198
|
+
const scopedTools = isNoToolScope(this.config.agentScope) || smallTalkTurn ? {} : this.config.agentScope === "__table__" ? Object.fromEntries(Object.entries(providerTools).filter(([k]) => TABLE_SESSION_TOOLS.has(k))) : providerTools;
|
|
584128
584199
|
const withExtensions = { ...scopedTools };
|
|
584129
|
-
if (this.extensionToolsAllowed()) {
|
|
584200
|
+
if (this.extensionToolsAllowed() && !smallTalkTurn) {
|
|
584130
584201
|
for (const t of this.extensionHost.listTools()) {
|
|
584131
584202
|
if (t.name in withExtensions)
|
|
584132
584203
|
continue;
|
|
@@ -584138,7 +584209,7 @@ Ask the user naturally; don't mention this instruction. After they answer, proce
|
|
|
584138
584209
|
}
|
|
584139
584210
|
}
|
|
584140
584211
|
const effectiveTools = this.modeFilter(withExtensions);
|
|
584141
|
-
const textToolAllowlist = (isNoToolScope(this.config.agentScope) ? [] : this.config.agentScope === "__table__" ? [...TABLE_SESSION_TOOLS] : localCoreTools).filter((name) => getModeManager().isToolAllowed(name));
|
|
584212
|
+
const textToolAllowlist = (isNoToolScope(this.config.agentScope) || smallTalkTurn ? [] : this.config.agentScope === "__table__" ? [...TABLE_SESSION_TOOLS] : localCoreTools).filter((name) => getModeManager().isToolAllowed(name));
|
|
584142
584213
|
const harness = this.harnessProfileFor(providerConfig.model, isLocalProvider);
|
|
584143
584214
|
Object.assign(this.runtimeParams, {
|
|
584144
584215
|
voiceChatActive: getRuntimeParams().voiceChatActive,
|
|
@@ -584163,7 +584234,8 @@ Ask the user naturally; don't mention this instruction. After they answer, proce
|
|
|
584163
584234
|
`),
|
|
584164
584235
|
localCoreTools: textToolAllowlist,
|
|
584165
584236
|
chatStartTime,
|
|
584166
|
-
textForAgent
|
|
584237
|
+
textForAgent,
|
|
584238
|
+
smallTalk: smallTalkTurn
|
|
584167
584239
|
});
|
|
584168
584240
|
await this.readServerContextWindow();
|
|
584169
584241
|
await this.compactIfNeeded(providerConfig);
|
|
@@ -584848,7 +584920,7 @@ ${summary || " (no provider errors recorded)"}`);
|
|
|
584848
584920
|
};
|
|
584849
584921
|
}
|
|
584850
584922
|
const blankNative = gatedNative.content.trim() === "";
|
|
584851
|
-
const content = blankNative ? emptyReplyNote(this.turnToolLedger.length) : gatedNative.content;
|
|
584923
|
+
const content = blankNative ? emptyReplyNote(this.turnToolLedger.length, this.turnToolLedger) : gatedNative.content;
|
|
584852
584924
|
const flavor = voice.getFlavor("complete");
|
|
584853
584925
|
const flavoredContent = fixCompletedLine(gatedNative.violated || isVerbatimScope(this.config.agentScope) ? content : flavorResponse(content, flavor)).text;
|
|
584854
584926
|
this.messageHistory.push({ role: "assistant", content: flavoredContent });
|
|
@@ -585563,6 +585635,7 @@ var init_agent2 = __esm(() => {
|
|
|
585563
585635
|
init_modes();
|
|
585564
585636
|
init_planning_gate();
|
|
585565
585637
|
init_registry();
|
|
585638
|
+
init_small_talk();
|
|
585566
585639
|
init_verify_gate();
|
|
585567
585640
|
init_local_tool_scope();
|
|
585568
585641
|
init_local_turn_error();
|
|
@@ -587062,7 +587135,7 @@ var init_throughput_tracker = __esm(() => {
|
|
|
587062
587135
|
|
|
587063
587136
|
// packages/orchestration/worktree-pool-agent.ts
|
|
587064
587137
|
import { execFileSync as execFileSync10, spawn as spawn21 } from "node:child_process";
|
|
587065
|
-
import { appendFileSync as appendFileSync23, existsSync as
|
|
587138
|
+
import { appendFileSync as appendFileSync23, existsSync as existsSync107, mkdirSync as mkdirSync76, readFileSync as readFileSync99, writeFileSync as writeFileSync58 } from "node:fs";
|
|
587066
587139
|
import { join as join159 } from "node:path";
|
|
587067
587140
|
|
|
587068
587141
|
class WorktreePoolAgent {
|
|
@@ -587143,7 +587216,7 @@ class WorktreePoolAgent {
|
|
|
587143
587216
|
}
|
|
587144
587217
|
static readResult(worktreePath) {
|
|
587145
587218
|
const p = join159(worktreePath, ".8gent", "result.json");
|
|
587146
|
-
if (!
|
|
587219
|
+
if (!existsSync107(p))
|
|
587147
587220
|
return null;
|
|
587148
587221
|
try {
|
|
587149
587222
|
return JSON.parse(readFileSync99(p, "utf-8"));
|
|
@@ -587158,8 +587231,8 @@ var init_worktree_pool_agent = __esm(() => {
|
|
|
587158
587231
|
|
|
587159
587232
|
// packages/orchestration/worktree-pool.ts
|
|
587160
587233
|
import { execFileSync as execFileSync11 } from "node:child_process";
|
|
587161
|
-
import { existsSync as
|
|
587162
|
-
import { join as join160, resolve as
|
|
587234
|
+
import { existsSync as existsSync108, mkdirSync as mkdirSync77 } from "node:fs";
|
|
587235
|
+
import { join as join160, resolve as resolve69 } from "node:path";
|
|
587163
587236
|
|
|
587164
587237
|
class WorktreePool {
|
|
587165
587238
|
projectRoot;
|
|
@@ -587172,7 +587245,7 @@ class WorktreePool {
|
|
|
587172
587245
|
running = 0;
|
|
587173
587246
|
queue = [];
|
|
587174
587247
|
constructor(opts = {}) {
|
|
587175
|
-
this.projectRoot =
|
|
587248
|
+
this.projectRoot = resolve69(opts.projectRoot ?? process.cwd());
|
|
587176
587249
|
this.worktreesDir = join160(this.projectRoot, ".8gent", "worktrees");
|
|
587177
587250
|
this.maxConcurrent = opts.maxConcurrent ?? DEFAULT_MAX;
|
|
587178
587251
|
this.taskTimeoutMs = opts.taskTimeoutMs ?? DEFAULT_TIMEOUT2;
|
|
@@ -587292,7 +587365,7 @@ class WorktreePool {
|
|
|
587292
587365
|
}
|
|
587293
587366
|
}
|
|
587294
587367
|
gitWorktreeRemove(path) {
|
|
587295
|
-
if (!
|
|
587368
|
+
if (!existsSync108(path))
|
|
587296
587369
|
return;
|
|
587297
587370
|
try {
|
|
587298
587371
|
execFileSync11("git", ["worktree", "remove", path, "--force"], {
|
|
@@ -587317,7 +587390,7 @@ var init_worktree_pool = __esm(() => {
|
|
|
587317
587390
|
|
|
587318
587391
|
// packages/orchestration/worktree-messaging.ts
|
|
587319
587392
|
import {
|
|
587320
|
-
existsSync as
|
|
587393
|
+
existsSync as existsSync109,
|
|
587321
587394
|
mkdirSync as mkdirSync78,
|
|
587322
587395
|
readFileSync as readFileSync100,
|
|
587323
587396
|
readdirSync as readdirSync26,
|
|
@@ -587354,7 +587427,7 @@ class WorktreeMessaging {
|
|
|
587354
587427
|
}
|
|
587355
587428
|
readDir(agentId, remove) {
|
|
587356
587429
|
const dir = join161(this.base, agentId);
|
|
587357
|
-
if (!
|
|
587430
|
+
if (!existsSync109(dir))
|
|
587358
587431
|
return [];
|
|
587359
587432
|
const files = readdirSync26(dir).filter((f) => f.endsWith(".json")).sort();
|
|
587360
587433
|
const messages = [];
|
|
@@ -587369,7 +587442,7 @@ class WorktreeMessaging {
|
|
|
587369
587442
|
return messages;
|
|
587370
587443
|
}
|
|
587371
587444
|
listInboxes() {
|
|
587372
|
-
if (!
|
|
587445
|
+
if (!existsSync109(this.base))
|
|
587373
587446
|
return [];
|
|
587374
587447
|
return readdirSync26(this.base);
|
|
587375
587448
|
}
|
|
@@ -589497,13 +589570,13 @@ var init_adaptive_pipeline = __esm(() => {
|
|
|
589497
589570
|
|
|
589498
589571
|
// packages/orchestration/pipeline-cli.ts
|
|
589499
589572
|
import { mkdirSync as mkdirSync80, writeFileSync as writeFileSync61 } from "node:fs";
|
|
589500
|
-
import { join as join163, resolve as
|
|
589573
|
+
import { join as join163, resolve as resolve70 } from "node:path";
|
|
589501
589574
|
async function runPipelineCommand(args) {
|
|
589502
|
-
let outDir =
|
|
589575
|
+
let outDir = resolve70(process.cwd(), "pipeline-output");
|
|
589503
589576
|
const taskParts = [];
|
|
589504
589577
|
for (let i = 0;i < args.length; i++) {
|
|
589505
589578
|
if (args[i] === "--out" && args[i + 1]) {
|
|
589506
|
-
outDir =
|
|
589579
|
+
outDir = resolve70(args[++i]);
|
|
589507
589580
|
} else if (!args[i].startsWith("-")) {
|
|
589508
589581
|
taskParts.push(args[i]);
|
|
589509
589582
|
}
|
|
@@ -589820,7 +589893,7 @@ var init_classroom = __esm(() => {
|
|
|
589820
589893
|
import { randomBytes as randomBytes11 } from "node:crypto";
|
|
589821
589894
|
import {
|
|
589822
589895
|
closeSync as closeSync21,
|
|
589823
|
-
existsSync as
|
|
589896
|
+
existsSync as existsSync111,
|
|
589824
589897
|
fchmodSync as fchmodSync5,
|
|
589825
589898
|
fsyncSync as fsyncSync2,
|
|
589826
589899
|
linkSync,
|
|
@@ -589921,13 +589994,13 @@ class WorkQueue {
|
|
|
589921
589994
|
this.path = path;
|
|
589922
589995
|
this.startLimit = startLimitFor(opts.maxSessions, opts.startLimit);
|
|
589923
589996
|
const dir = dirname74(path);
|
|
589924
|
-
if (!
|
|
589997
|
+
if (!existsSync111(dir))
|
|
589925
589998
|
mkdirSync82(dir, { recursive: true, mode: 448 });
|
|
589926
589999
|
this.lockPath = `${path}.lock`;
|
|
589927
590000
|
acquireLock(this.lockPath);
|
|
589928
590001
|
let raw = "";
|
|
589929
590002
|
try {
|
|
589930
|
-
if (
|
|
590003
|
+
if (existsSync111(path))
|
|
589931
590004
|
raw = readFileSync101(path, "utf8");
|
|
589932
590005
|
this.replay(raw);
|
|
589933
590006
|
this.fd = openSync21(path, "a", 384);
|
|
@@ -592898,7 +592971,7 @@ var init_post_to_channel = __esm(() => {
|
|
|
592898
592971
|
|
|
592899
592972
|
// packages/table/huddle-voice.ts
|
|
592900
592973
|
import { spawnSync as spawnSync13 } from "node:child_process";
|
|
592901
|
-
import { existsSync as
|
|
592974
|
+
import { existsSync as existsSync113 } from "node:fs";
|
|
592902
592975
|
function voiceFor(code) {
|
|
592903
592976
|
return VOICES[code.toUpperCase()] ?? HUMAN_VOICE;
|
|
592904
592977
|
}
|
|
@@ -592913,11 +592986,11 @@ function inQuietHours(now) {
|
|
|
592913
592986
|
}
|
|
592914
592987
|
function findSupertonic() {
|
|
592915
592988
|
for (const p of SUPERTONIC_CANDIDATES)
|
|
592916
|
-
if (
|
|
592989
|
+
if (existsSync113(p))
|
|
592917
592990
|
return p;
|
|
592918
592991
|
const which = spawnSync13("which", ["supertonic"], { encoding: "utf8" });
|
|
592919
592992
|
const found = which.stdout?.trim();
|
|
592920
|
-
return found &&
|
|
592993
|
+
return found && existsSync113(found) ? found : null;
|
|
592921
592994
|
}
|
|
592922
592995
|
function speechText(text, maxChars = 480) {
|
|
592923
592996
|
const cleaned = text.replace(/\(verified:[^)]*\)/g, "").replace(/\[CLAIM STRIPPED:[^\]]*\]/g, "").replace(/`+/g, "").replace(/^[\s>*-]+/gm, "").replace(/\s+/g, " ").trim();
|
|
@@ -592950,7 +593023,7 @@ function narrateTurn(opts) {
|
|
|
592950
593023
|
if (!bin)
|
|
592951
593024
|
return { audioPath: null, durationMs: estimate, skipped: "no_tts" };
|
|
592952
593025
|
const r = spawnSync13(bin, ["tts", text, "-o", opts.outPath, "--voice", opts.voice.supertonic, "--steps", String(opts.steps ?? 8)], { encoding: "utf8", timeout: 120000 });
|
|
592953
|
-
if (r.status !== 0 || !
|
|
593026
|
+
if (r.status !== 0 || !existsSync113(opts.outPath)) {
|
|
592954
593027
|
return { audioPath: null, durationMs: estimate, skipped: "tts_failed" };
|
|
592955
593028
|
}
|
|
592956
593029
|
return { audioPath: opts.outPath, durationMs: probeDurationMs(opts.outPath) ?? estimate };
|
|
@@ -593051,7 +593124,7 @@ var init_message_speak = __esm(() => {
|
|
|
593051
593124
|
});
|
|
593052
593125
|
|
|
593053
593126
|
// packages/table/message-audio.ts
|
|
593054
|
-
import { existsSync as
|
|
593127
|
+
import { existsSync as existsSync114, mkdirSync as mkdirSync86, readFileSync as readFileSync105 } from "node:fs";
|
|
593055
593128
|
import * as os54 from "node:os";
|
|
593056
593129
|
import * as path123 from "node:path";
|
|
593057
593130
|
function messageAudioRoot() {
|
|
@@ -593067,7 +593140,7 @@ function handleTableAudioHttp(url) {
|
|
|
593067
593140
|
return null;
|
|
593068
593141
|
const [, messageId, file] = m;
|
|
593069
593142
|
const filePath = path123.join(messageAudioDir(messageId), file);
|
|
593070
|
-
if (!
|
|
593143
|
+
if (!existsSync114(filePath))
|
|
593071
593144
|
return new Response("not found", { status: 404 });
|
|
593072
593145
|
const ext = file.slice(file.lastIndexOf("."));
|
|
593073
593146
|
return new Response(readFileSync105(filePath), {
|
|
@@ -595189,7 +595262,7 @@ function fnv1a(text) {
|
|
|
595189
595262
|
function draw(seedText, axis, options) {
|
|
595190
595263
|
return options[fnv1a(`${axis}:${seedText}`) % options.length];
|
|
595191
595264
|
}
|
|
595192
|
-
function
|
|
595265
|
+
function resolve71(intent) {
|
|
595193
595266
|
const tone = intent.tone ?? "";
|
|
595194
595267
|
if (tone && !TONES[tone]) {
|
|
595195
595268
|
throw new DesignRefused("intent.tone", `unknown tone ${JSON.stringify(tone)}. Known tones: ${TONE_NAMES.join(", ")}.`);
|
|
@@ -595273,7 +595346,7 @@ function coordinateId(c) {
|
|
|
595273
595346
|
return fnv1a(canonical).toString(16).padStart(8, "0");
|
|
595274
595347
|
}
|
|
595275
595348
|
function compose(intent) {
|
|
595276
|
-
return composeAt(
|
|
595349
|
+
return composeAt(resolve71(intent), intent);
|
|
595277
595350
|
}
|
|
595278
595351
|
var TONES, TONE_NAMES, BASE_PX;
|
|
595279
595352
|
var init_compose = __esm(() => {
|
|
@@ -596062,10 +596135,10 @@ var init_slide_render = __esm(() => {
|
|
|
596062
596135
|
// packages/table/bake.ts
|
|
596063
596136
|
import { spawnSync as spawnSync14 } from "node:child_process";
|
|
596064
596137
|
import { createHash as createHash26 } from "node:crypto";
|
|
596065
|
-
import { existsSync as
|
|
596138
|
+
import { existsSync as existsSync115, mkdirSync as mkdirSync87, readdirSync as readdirSync27, readFileSync as readFileSync106, rmSync as rmSync16, writeFileSync as writeFileSync63 } from "node:fs";
|
|
596066
596139
|
import { basename as basename50, join as join171 } from "node:path";
|
|
596067
596140
|
function findChrome3() {
|
|
596068
|
-
return CHROME_CANDIDATES2.find((p) =>
|
|
596141
|
+
return CHROME_CANDIDATES2.find((p) => existsSync115(p)) ?? null;
|
|
596069
596142
|
}
|
|
596070
596143
|
function huddleDir(huddleId) {
|
|
596071
596144
|
return join171(HUDDLES_DIR, huddleId);
|
|
@@ -596087,7 +596160,7 @@ function slideToPng(htmlPath, pngPath, chrome) {
|
|
|
596087
596160
|
`--screenshot=${pngPath}`,
|
|
596088
596161
|
`file://${htmlPath}`
|
|
596089
596162
|
], { encoding: "utf8", timeout: 60000 });
|
|
596090
|
-
return r.status === 0 &&
|
|
596163
|
+
return r.status === 0 && existsSync115(pngPath);
|
|
596091
596164
|
}
|
|
596092
596165
|
function emitDeckV2V(manifest) {
|
|
596093
596166
|
const slides = manifest.turns.map((t) => {
|
|
@@ -596229,7 +596302,7 @@ function bakeHuddle(manifest, stamp) {
|
|
|
596229
596302
|
mkdirSync87(work, { recursive: true });
|
|
596230
596303
|
for (const turn of manifest.turns) {
|
|
596231
596304
|
const htmlPath = join171(dir, "slides", `slide-${turn.turnId}.html`);
|
|
596232
|
-
if (!
|
|
596305
|
+
if (!existsSync115(htmlPath)) {
|
|
596233
596306
|
const { html } = renderSlide(turn.spec, {
|
|
596234
596307
|
code: turn.code,
|
|
596235
596308
|
name: turn.name,
|
|
@@ -596253,7 +596326,7 @@ function bakeHuddle(manifest, stamp) {
|
|
|
596253
596326
|
const clip = join171(work, `clip-${String(turn.index).padStart(3, "0")}.mp4`);
|
|
596254
596327
|
const secs = (turn.durationMs / 1000).toFixed(3);
|
|
596255
596328
|
const video = ["-loop", "1", "-framerate", "30", "-t", secs, "-i", png];
|
|
596256
|
-
const audio = turn.audioPath &&
|
|
596329
|
+
const audio = turn.audioPath && existsSync115(turn.audioPath) ? ["-ss", (turn.audioOffsetMs / 1000).toFixed(3), "-t", secs, "-i", turn.audioPath] : ["-f", "lavfi", "-t", secs, "-i", "anullsrc=r=44100:cl=stereo"];
|
|
596257
596330
|
const ok = ffmpegClip([
|
|
596258
596331
|
"-y",
|
|
596259
596332
|
...video,
|
|
@@ -596283,7 +596356,7 @@ function bakeHuddle(manifest, stamp) {
|
|
|
596283
596356
|
"-shortest",
|
|
596284
596357
|
clip
|
|
596285
596358
|
]);
|
|
596286
|
-
if (!ok || !
|
|
596359
|
+
if (!ok || !existsSync115(clip)) {
|
|
596287
596360
|
result.videoError = `ffmpeg clip failed for turn ${turn.index}`;
|
|
596288
596361
|
return result;
|
|
596289
596362
|
}
|
|
@@ -596295,7 +596368,7 @@ function bakeHuddle(manifest, stamp) {
|
|
|
596295
596368
|
const outName = `huddle-${slugify4(manifest.topic)}-${stamp}.mp4`;
|
|
596296
596369
|
const outPath = join171(CREATIVE_DIR2, outName);
|
|
596297
596370
|
const ok = ffmpegClip(["-y", "-f", "concat", "-safe", "0", "-i", listPath, "-c", "copy", "-movflags", "+faststart", outPath]);
|
|
596298
|
-
if (!ok || !
|
|
596371
|
+
if (!ok || !existsSync115(outPath)) {
|
|
596299
596372
|
result.videoError = "ffmpeg concat failed";
|
|
596300
596373
|
return result;
|
|
596301
596374
|
}
|
|
@@ -597764,7 +597837,7 @@ var init_zen = __esm(() => {
|
|
|
597764
597837
|
});
|
|
597765
597838
|
|
|
597766
597839
|
// packages/daemon/huddle-stage.ts
|
|
597767
|
-
import { existsSync as
|
|
597840
|
+
import { existsSync as existsSync116, mkdirSync as mkdirSync88, readFileSync as readFileSync108, writeFileSync as writeFileSync64 } from "node:fs";
|
|
597768
597841
|
import { join as join173 } from "node:path";
|
|
597769
597842
|
function openStage(huddleId, channelId, topic) {
|
|
597770
597843
|
ensureHuddleDirs(huddleId);
|
|
@@ -597895,7 +597968,7 @@ function ingestDictation(huddleId, holder, wavPath, whisperJsonPath, broadcast)
|
|
|
597895
597968
|
const state = stages.get(huddleId);
|
|
597896
597969
|
if (!state)
|
|
597897
597970
|
return 0;
|
|
597898
|
-
if (!
|
|
597971
|
+
if (!existsSync116(whisperJsonPath))
|
|
597899
597972
|
return 0;
|
|
597900
597973
|
const segments = parseWhisperJson(readFileSync108(whisperJsonPath, "utf8"));
|
|
597901
597974
|
const slides = zenSlides(segments, Object.keys(OFFICERS));
|
|
@@ -598001,7 +598074,7 @@ function handleStageHttp(url, wsUrl) {
|
|
|
598001
598074
|
if (!file || file.includes(".."))
|
|
598002
598075
|
return new Response("not found", { status: 404 });
|
|
598003
598076
|
const path = join173(huddleDir(huddleId), kind, file);
|
|
598004
|
-
if (!
|
|
598077
|
+
if (!existsSync116(path))
|
|
598005
598078
|
return new Response("not found", { status: 404 });
|
|
598006
598079
|
const ext = file.slice(file.lastIndexOf("."));
|
|
598007
598080
|
return new Response(readFileSync108(path), {
|
|
@@ -599880,13 +599953,13 @@ var init_workspace_db = __esm(() => {
|
|
|
599880
599953
|
});
|
|
599881
599954
|
|
|
599882
599955
|
// packages/daemon/routes/store/audit.ts
|
|
599883
|
-
import { appendFileSync as appendFileSync26, existsSync as
|
|
599956
|
+
import { appendFileSync as appendFileSync26, existsSync as existsSync118, mkdirSync as mkdirSync90 } from "node:fs";
|
|
599884
599957
|
import * as path127 from "node:path";
|
|
599885
599958
|
function auditDir() {
|
|
599886
599959
|
if (_auditDir)
|
|
599887
599960
|
return _auditDir;
|
|
599888
599961
|
const dir = path127.join(getDataDir(), "audit");
|
|
599889
|
-
if (!
|
|
599962
|
+
if (!existsSync118(dir)) {
|
|
599890
599963
|
try {
|
|
599891
599964
|
mkdirSync90(dir, { recursive: true });
|
|
599892
599965
|
} catch (err) {
|
|
@@ -601226,7 +601299,7 @@ var init_session2 = __esm(() => {
|
|
|
601226
601299
|
});
|
|
601227
601300
|
|
|
601228
601301
|
// packages/daemon/routes/store/index.ts
|
|
601229
|
-
import { existsSync as
|
|
601302
|
+
import { existsSync as existsSync122, mkdirSync as mkdirSync94, readFileSync as readFileSync112, writeFileSync as writeFileSync67 } from "node:fs";
|
|
601230
601303
|
import * as crypto13 from "node:crypto";
|
|
601231
601304
|
import * as path131 from "node:path";
|
|
601232
601305
|
function ensureServerToken(tokenPath) {
|
|
@@ -601234,9 +601307,9 @@ function ensureServerToken(tokenPath) {
|
|
|
601234
601307
|
return _cachedToken;
|
|
601235
601308
|
const file = tokenPath ?? path131.join(getDataDir(), "server.token");
|
|
601236
601309
|
const dir = path131.dirname(file);
|
|
601237
|
-
if (!
|
|
601310
|
+
if (!existsSync122(dir))
|
|
601238
601311
|
mkdirSync94(dir, { recursive: true });
|
|
601239
|
-
if (
|
|
601312
|
+
if (existsSync122(file)) {
|
|
601240
601313
|
const t = readFileSync112(file, "utf-8").trim();
|
|
601241
601314
|
if (t.length >= 32) {
|
|
601242
601315
|
if (!tokenPath)
|
|
@@ -606061,7 +606134,7 @@ import { createHash as createHash31, createHmac as createHmac4, randomBytes as r
|
|
|
606061
606134
|
import {
|
|
606062
606135
|
appendFileSync as appendFileSync27,
|
|
606063
606136
|
chmodSync as chmodSync6,
|
|
606064
|
-
existsSync as
|
|
606137
|
+
existsSync as existsSync123,
|
|
606065
606138
|
mkdirSync as mkdirSync96,
|
|
606066
606139
|
readFileSync as readFileSync114,
|
|
606067
606140
|
rmSync as rmSync18,
|
|
@@ -606088,14 +606161,14 @@ class AuditLog {
|
|
|
606088
606161
|
this.path = path;
|
|
606089
606162
|
this.clock = clock;
|
|
606090
606163
|
ensurePrivateDir(dirname80(path));
|
|
606091
|
-
if (
|
|
606164
|
+
if (existsSync123(saltPath)) {
|
|
606092
606165
|
this.salt = readFileSync114(saltPath);
|
|
606093
606166
|
} else {
|
|
606094
606167
|
this.salt = randomBytes16(32);
|
|
606095
606168
|
writeFileSync69(saltPath, this.salt, { mode: 384 });
|
|
606096
606169
|
chmodSync6(saltPath, 384);
|
|
606097
606170
|
}
|
|
606098
|
-
if (
|
|
606171
|
+
if (existsSync123(path)) {
|
|
606099
606172
|
const dropped = repairTornTail(path);
|
|
606100
606173
|
if (dropped > 0)
|
|
606101
606174
|
onRepair(dropped);
|
|
@@ -606153,7 +606226,7 @@ function repairTornTail(path) {
|
|
|
606153
606226
|
return buf.length - cut;
|
|
606154
606227
|
}
|
|
606155
606228
|
function verifyAudit(path) {
|
|
606156
|
-
if (!
|
|
606229
|
+
if (!existsSync123(path))
|
|
606157
606230
|
return { ok: true, count: 0, lastHash: GENESIS };
|
|
606158
606231
|
const lines = readFileSync114(path, "utf8").split(`
|
|
606159
606232
|
`).filter(Boolean);
|
|
@@ -606187,7 +606260,7 @@ import { createCipheriv as createCipheriv2, createDecipheriv as createDecipheriv
|
|
|
606187
606260
|
import {
|
|
606188
606261
|
chmodSync as chmodSync7,
|
|
606189
606262
|
closeSync as closeSync24,
|
|
606190
|
-
existsSync as
|
|
606263
|
+
existsSync as existsSync124,
|
|
606191
606264
|
fsyncSync as fsyncSync4,
|
|
606192
606265
|
openSync as openSync24,
|
|
606193
606266
|
readFileSync as readFileSync115,
|
|
@@ -606230,7 +606303,7 @@ class MemoryVault {
|
|
|
606230
606303
|
throw new Error("vault: no encryption key available");
|
|
606231
606304
|
ensurePrivateDir(dir);
|
|
606232
606305
|
const file = join182(dir, "memory.db.enc");
|
|
606233
|
-
const db =
|
|
606306
|
+
const db = existsSync124(file) ? Database.deserialize(unseal(readFileSync115(file), key)) : new Database(":memory:");
|
|
606234
606307
|
db.exec("PRAGMA secure_delete = ON");
|
|
606235
606308
|
const vault = new MemoryVault(dir, new MemoryStore(db), key);
|
|
606236
606309
|
vault.persist();
|
|
@@ -606337,7 +606410,7 @@ function validateTenant(memory, scope) {
|
|
|
606337
606410
|
|
|
606338
606411
|
// packages/memory/telegram-memory.ts
|
|
606339
606412
|
import { randomInt, timingSafeEqual as timingSafeEqual8 } from "node:crypto";
|
|
606340
|
-
import { chmodSync as chmodSync8, existsSync as
|
|
606413
|
+
import { chmodSync as chmodSync8, existsSync as existsSync125, readFileSync as readFileSync116, statSync as statSync38, unlinkSync as unlinkSync8, writeFileSync as writeFileSync70 } from "node:fs";
|
|
606341
606414
|
import { join as join183 } from "node:path";
|
|
606342
606415
|
function parseMatrix(raw) {
|
|
606343
606416
|
try {
|
|
@@ -606413,7 +606486,7 @@ class TelegramMemory {
|
|
|
606413
606486
|
return v === "1" || v === "true" || v === "yes";
|
|
606414
606487
|
}
|
|
606415
606488
|
isDisabled() {
|
|
606416
|
-
return this.disabledByEnv() ||
|
|
606489
|
+
return this.disabledByEnv() || existsSync125(this.flagFile);
|
|
606417
606490
|
}
|
|
606418
606491
|
isOperator(fromId) {
|
|
606419
606492
|
return typeof fromId === "number" && splitIds(this.env.TELEGRAM_OPERATOR_USER_IDS).includes(String(fromId));
|
|
@@ -606602,7 +606675,7 @@ class TelegramMemory {
|
|
|
606602
606675
|
const uid = String(ctx.fromId);
|
|
606603
606676
|
const chat = String(ctx.chatId);
|
|
606604
606677
|
const listed = splitIds(this.env.TELEGRAM_MEMORY_CHAT_IDS).includes(chat);
|
|
606605
|
-
const hasState =
|
|
606678
|
+
const hasState = existsSync125(this.opts.dir);
|
|
606606
606679
|
if (!listed && !hasState) {
|
|
606607
606680
|
return "Memory is not enabled for this chat and nothing is stored, so there is nothing to change or erase.";
|
|
606608
606681
|
}
|
|
@@ -606618,7 +606691,7 @@ class TelegramMemory {
|
|
|
606618
606691
|
if (this.disabledByEnv()) {
|
|
606619
606692
|
return "Memory is disabled by TELEGRAM_MEMORY_DISABLED in the bot environment. /memon cannot override it.";
|
|
606620
606693
|
}
|
|
606621
|
-
if (
|
|
606694
|
+
if (existsSync125(this.flagFile))
|
|
606622
606695
|
unlinkSync8(this.flagFile);
|
|
606623
606696
|
this.auditEvent(uid, chat, "memon", "0", {}, "ok");
|
|
606624
606697
|
return "Memory is on.";
|
|
@@ -606626,7 +606699,7 @@ class TelegramMemory {
|
|
|
606626
606699
|
const now = this.clock();
|
|
606627
606700
|
const given = arg.trim();
|
|
606628
606701
|
if (!given) {
|
|
606629
|
-
if (!
|
|
606702
|
+
if (!existsSync125(join183(this.opts.dir, "memory.db.enc"))) {
|
|
606630
606703
|
return "Nothing is stored, so there is nothing to erase.";
|
|
606631
606704
|
}
|
|
606632
606705
|
const code = String(randomInt(1e5, 1e6));
|
|
@@ -607178,7 +607251,7 @@ function truncate2(text, max) {
|
|
|
607178
607251
|
var MAX_MOBILE_LEN = 1800, MAX_CHUNK_LEN = 3800;
|
|
607179
607252
|
|
|
607180
607253
|
// packages/telegram-bot/file-sender.ts
|
|
607181
|
-
import { existsSync as
|
|
607254
|
+
import { existsSync as existsSync126, statSync as statSync39 } from "node:fs";
|
|
607182
607255
|
import { basename as basename53 } from "node:path";
|
|
607183
607256
|
|
|
607184
607257
|
class FileSender {
|
|
@@ -607262,7 +607335,7 @@ class FileSender {
|
|
|
607262
607335
|
if (attachment.buffer)
|
|
607263
607336
|
return attachment.buffer;
|
|
607264
607337
|
if (attachment.path) {
|
|
607265
|
-
if (!
|
|
607338
|
+
if (!existsSync126(attachment.path))
|
|
607266
607339
|
return null;
|
|
607267
607340
|
return await Bun.file(attachment.path).bytes().then((b) => Buffer.from(b));
|
|
607268
607341
|
}
|
|
@@ -607291,7 +607364,7 @@ var init_file_sender = __esm(() => {
|
|
|
607291
607364
|
});
|
|
607292
607365
|
|
|
607293
607366
|
// packages/telegram-bot/session-store.ts
|
|
607294
|
-
import { existsSync as
|
|
607367
|
+
import { existsSync as existsSync127, mkdirSync as mkdirSync97, readFileSync as readFileSync117, writeFileSync as writeFileSync71 } from "node:fs";
|
|
607295
607368
|
import { dirname as dirname83 } from "node:path";
|
|
607296
607369
|
|
|
607297
607370
|
class SessionStore2 {
|
|
@@ -607385,7 +607458,7 @@ class SessionStore2 {
|
|
|
607385
607458
|
if (!this.persistPath)
|
|
607386
607459
|
return;
|
|
607387
607460
|
try {
|
|
607388
|
-
if (!
|
|
607461
|
+
if (!existsSync127(this.persistPath))
|
|
607389
607462
|
return;
|
|
607390
607463
|
const raw = readFileSync117(this.persistPath, "utf-8");
|
|
607391
607464
|
const parsed = JSON.parse(raw);
|
|
@@ -608387,11 +608460,11 @@ var init_flow_bot = __esm(() => {
|
|
|
608387
608460
|
// packages/telegram-bot/voice-mode.ts
|
|
608388
608461
|
import { spawn as spawn25 } from "node:child_process";
|
|
608389
608462
|
import { createHash as createHash32 } from "node:crypto";
|
|
608390
|
-
import { existsSync as
|
|
608463
|
+
import { existsSync as existsSync128, mkdirSync as mkdirSync98, readFileSync as readFileSync118, writeFileSync as writeFileSync72 } from "node:fs";
|
|
608391
608464
|
import { homedir as homedir94 } from "node:os";
|
|
608392
608465
|
import { dirname as dirname84, join as join188 } from "node:path";
|
|
608393
608466
|
function readVoiceState(path = VOICE_STATE_PATH) {
|
|
608394
|
-
if (!
|
|
608467
|
+
if (!existsSync128(path))
|
|
608395
608468
|
return { ...DEFAULT_STATE };
|
|
608396
608469
|
try {
|
|
608397
608470
|
const parsed = JSON.parse(readFileSync118(path, "utf-8"));
|
|
@@ -608461,7 +608534,7 @@ function decideVoice(markdown, opts) {
|
|
|
608461
608534
|
}
|
|
608462
608535
|
async function sendVoiceNote(opts) {
|
|
608463
608536
|
const bin = opts.bin ?? KITTENTTS_BIN;
|
|
608464
|
-
if (!
|
|
608537
|
+
if (!existsSync128(bin))
|
|
608465
608538
|
return { sent: false, reason: "kittentts-telegram not installed" };
|
|
608466
608539
|
const args = ["--voice", opts.voice];
|
|
608467
608540
|
if (opts.explicitChat !== undefined) {
|
|
@@ -608502,7 +608575,7 @@ async function sendVoiceNote(opts) {
|
|
|
608502
608575
|
});
|
|
608503
608576
|
}
|
|
608504
608577
|
function readConfiguredChatId(envPath = join188(homedir94(), ".claude", ".env")) {
|
|
608505
|
-
if (!
|
|
608578
|
+
if (!existsSync128(envPath))
|
|
608506
608579
|
return null;
|
|
608507
608580
|
try {
|
|
608508
608581
|
for (const line of readFileSync118(envPath, "utf-8").split(`
|
|
@@ -608559,11 +608632,11 @@ var init_types8 = __esm(() => {
|
|
|
608559
608632
|
});
|
|
608560
608633
|
|
|
608561
608634
|
// packages/voice/model-manager.ts
|
|
608562
|
-
import { existsSync as
|
|
608635
|
+
import { existsSync as existsSync129, mkdirSync as mkdirSync99, realpathSync as realpathSync37, unlinkSync as unlinkSync9 } from "node:fs";
|
|
608563
608636
|
import { homedir as homedir95 } from "node:os";
|
|
608564
608637
|
import { join as join189, sep as sep31 } from "node:path";
|
|
608565
608638
|
function resolveWhisperModel(opts = {}) {
|
|
608566
|
-
const exists = opts.exists ??
|
|
608639
|
+
const exists = opts.exists ?? existsSync129;
|
|
608567
608640
|
const dirs = [
|
|
608568
608641
|
resolveModelsPath(opts.modelsDir ?? "~/.8gent/models/whisper"),
|
|
608569
608642
|
...opts.extraDirs ?? []
|
|
@@ -608767,21 +608840,21 @@ var init_voice_ack = __esm(() => {
|
|
|
608767
608840
|
});
|
|
608768
608841
|
|
|
608769
608842
|
// packages/daemon/task-registry.ts
|
|
608770
|
-
import { existsSync as
|
|
608843
|
+
import { existsSync as existsSync130, mkdirSync as mkdirSync100, readFileSync as readFileSync119, writeFileSync as writeFileSync73 } from "node:fs";
|
|
608771
608844
|
import { join as join190 } from "node:path";
|
|
608772
608845
|
function tasksPath() {
|
|
608773
608846
|
return join190(getDataDir(), "tasks.json");
|
|
608774
608847
|
}
|
|
608775
608848
|
function ensureDir8() {
|
|
608776
608849
|
const dir = getDataDir();
|
|
608777
|
-
if (!
|
|
608850
|
+
if (!existsSync130(dir))
|
|
608778
608851
|
mkdirSync100(dir, { recursive: true });
|
|
608779
608852
|
}
|
|
608780
608853
|
function load3() {
|
|
608781
608854
|
if (loaded)
|
|
608782
608855
|
return;
|
|
608783
608856
|
try {
|
|
608784
|
-
if (
|
|
608857
|
+
if (existsSync130(tasksPath())) {
|
|
608785
608858
|
tasks = JSON.parse(readFileSync119(tasksPath(), "utf-8"));
|
|
608786
608859
|
}
|
|
608787
608860
|
} catch {
|
|
@@ -608847,7 +608920,7 @@ var init_task_registry = __esm(() => {
|
|
|
608847
608920
|
|
|
608848
608921
|
// packages/daemon/cos-router.ts
|
|
608849
608922
|
import { execSync as execSync5 } from "node:child_process";
|
|
608850
|
-
import { existsSync as
|
|
608923
|
+
import { existsSync as existsSync131, readFileSync as readFileSync120, writeFileSync as writeFileSync74 } from "node:fs";
|
|
608851
608924
|
import { join as join191 } from "node:path";
|
|
608852
608925
|
function goalsPath() {
|
|
608853
608926
|
return join191(getDataDir(), "goals.json");
|
|
@@ -608931,7 +609004,7 @@ Priority: ${priority}`);
|
|
|
608931
609004
|
const repoPath = join191(cosWorkspace(), repo);
|
|
608932
609005
|
let issueUrl = "";
|
|
608933
609006
|
let issueNumber = 0;
|
|
608934
|
-
if (
|
|
609007
|
+
if (existsSync131(repoPath)) {
|
|
608935
609008
|
try {
|
|
608936
609009
|
const result = execSync5(`cd "${repoPath}" && gh issue create --title "${description.replace(/"/g, "\\\"")}" --body "Delegated by CEO via Telegram.
|
|
608937
609010
|
|
|
@@ -609127,7 +609200,7 @@ Total: ${goals.length} objectives`);
|
|
|
609127
609200
|
}
|
|
609128
609201
|
loadGoals() {
|
|
609129
609202
|
try {
|
|
609130
|
-
if (
|
|
609203
|
+
if (existsSync131(goalsPath())) {
|
|
609131
609204
|
return JSON.parse(readFileSync120(goalsPath(), "utf-8"));
|
|
609132
609205
|
}
|
|
609133
609206
|
} catch {}
|
|
@@ -609149,7 +609222,7 @@ import { createHash as createHash33 } from "node:crypto";
|
|
|
609149
609222
|
import {
|
|
609150
609223
|
appendFileSync as appendFileSync28,
|
|
609151
609224
|
chmodSync as chmodSync9,
|
|
609152
|
-
existsSync as
|
|
609225
|
+
existsSync as existsSync132,
|
|
609153
609226
|
mkdirSync as mkdirSync101,
|
|
609154
609227
|
readFileSync as readFileSync121,
|
|
609155
609228
|
statSync as statSync40,
|
|
@@ -609173,7 +609246,7 @@ function observeUnauthorized(update) {
|
|
|
609173
609246
|
} catch {
|
|
609174
609247
|
mkdirSync101(dirname85(OBSERVED_LOG), { recursive: true, mode: 448 });
|
|
609175
609248
|
}
|
|
609176
|
-
if (!
|
|
609249
|
+
if (!existsSync132(OBSERVED_LOG))
|
|
609177
609250
|
writeFileSync75(OBSERVED_LOG, "", { mode: 384 });
|
|
609178
609251
|
chmodSync9(OBSERVED_LOG, 384);
|
|
609179
609252
|
appendFileSync28(OBSERVED_LOG, `${JSON.stringify({
|
|
@@ -609326,7 +609399,7 @@ async function transcribeVoice(token, fileId) {
|
|
|
609326
609399
|
try {
|
|
609327
609400
|
writeFileSync75(ogg, Buffer.from(audioBuffer));
|
|
609328
609401
|
const conv = await runAsync("ffmpeg", ["-y", "-i", ogg, "-ar", "16000", "-ac", "1", wav], 30000);
|
|
609329
|
-
if (conv.status !== 0 || !
|
|
609402
|
+
if (conv.status !== 0 || !existsSync132(wav)) {
|
|
609330
609403
|
console.error(subprocessFailure("ffmpeg", conv.status, conv.stderr));
|
|
609331
609404
|
return "[voice message received - could not decode the audio]";
|
|
609332
609405
|
}
|
|
@@ -609343,7 +609416,7 @@ async function transcribeVoice(token, fileId) {
|
|
|
609343
609416
|
} finally {
|
|
609344
609417
|
for (const f of [ogg, wav]) {
|
|
609345
609418
|
try {
|
|
609346
|
-
if (
|
|
609419
|
+
if (existsSync132(f))
|
|
609347
609420
|
unlinkSync10(f);
|
|
609348
609421
|
} catch {}
|
|
609349
609422
|
}
|
|
@@ -609973,7 +610046,7 @@ What do we work on next?`);
|
|
|
609973
610046
|
try {
|
|
609974
610047
|
const path = this.config.observeLogPath ?? OBSERVED_LOG;
|
|
609975
610048
|
mkdirSync101(dirname85(path), { recursive: true, mode: 448 });
|
|
609976
|
-
if (!
|
|
610049
|
+
if (!existsSync132(path))
|
|
609977
610050
|
writeFileSync75(path, "", { mode: 384 });
|
|
609978
610051
|
chmodSync9(path, 384);
|
|
609979
610052
|
appendFileSync28(path, `${JSON.stringify({
|
|
@@ -611027,7 +611100,7 @@ var init_telegram_bridge = __esm(() => {
|
|
|
611027
611100
|
});
|
|
611028
611101
|
|
|
611029
611102
|
// packages/daemon/index.ts
|
|
611030
|
-
import { appendFileSync as appendFileSync29, existsSync as
|
|
611103
|
+
import { appendFileSync as appendFileSync29, existsSync as existsSync133, mkdirSync as mkdirSync102 } from "node:fs";
|
|
611031
611104
|
async function loadConfig2() {
|
|
611032
611105
|
const defaults = {
|
|
611033
611106
|
port: PORT,
|
|
@@ -611052,7 +611125,7 @@ async function loadConfig2() {
|
|
|
611052
611125
|
}
|
|
611053
611126
|
}
|
|
611054
611127
|
function setupLogging() {
|
|
611055
|
-
if (!
|
|
611128
|
+
if (!existsSync133(DATA_DIR5)) {
|
|
611056
611129
|
mkdirSync102(DATA_DIR5, { recursive: true });
|
|
611057
611130
|
}
|
|
611058
611131
|
const events = [
|
|
@@ -611356,7 +611429,7 @@ var init_daemon = __esm(() => {
|
|
|
611356
611429
|
});
|
|
611357
611430
|
|
|
611358
611431
|
// packages/daemon/service.ts
|
|
611359
|
-
import { existsSync as
|
|
611432
|
+
import { existsSync as existsSync134, mkdirSync as mkdirSync103, rmSync as rmSync19, writeFileSync as writeFileSync76 } from "node:fs";
|
|
611360
611433
|
import * as os65 from "node:os";
|
|
611361
611434
|
import * as path139 from "node:path";
|
|
611362
611435
|
function paths(ctx) {
|
|
@@ -611515,7 +611588,7 @@ async function serviceStatus(ctx) {
|
|
|
611515
611588
|
const query = backend.statusQuery(ctx);
|
|
611516
611589
|
const res = await exec4(query.kind === "powershell" ? powershellArgv(query.script) : query.argv);
|
|
611517
611590
|
const definition = backend.definitionPath(ctx);
|
|
611518
|
-
return backend.parseStatus(res, definition !== null &&
|
|
611591
|
+
return backend.parseStatus(res, definition !== null && existsSync134(definition));
|
|
611519
611592
|
}
|
|
611520
611593
|
async function runOperation(op, ctx, log = console.log) {
|
|
611521
611594
|
if (op !== "uninstall") {
|
|
@@ -612480,9 +612553,9 @@ var init_install = __esm(() => {
|
|
|
612480
612553
|
// packages/eight/self-update.ts
|
|
612481
612554
|
import { spawn as spawn27 } from "node:child_process";
|
|
612482
612555
|
import { createHash as createHash36, createPublicKey as createPublicKey2, verify as cryptoVerify, randomBytes as randomBytes19 } from "node:crypto";
|
|
612483
|
-
import { chmodSync as chmodSync10, existsSync as
|
|
612556
|
+
import { chmodSync as chmodSync10, existsSync as existsSync138, mkdtempSync as mkdtempSync12, renameSync as renameSync19, rmSync as rmSync21, writeFileSync as writeFileSync81 } from "node:fs";
|
|
612484
612557
|
import { tmpdir as tmpdir20 } from "node:os";
|
|
612485
|
-
import { join as join196, resolve as
|
|
612558
|
+
import { join as join196, resolve as resolve77 } from "node:path";
|
|
612486
612559
|
import { fileURLToPath as fileURLToPath7 } from "node:url";
|
|
612487
612560
|
function parseVersion(v) {
|
|
612488
612561
|
const m = /^v?(\d+)\.(\d+)\.(\d+)$/.exec(v.trim());
|
|
@@ -612514,7 +612587,7 @@ function detectChannel(p) {
|
|
|
612514
612587
|
return "binary";
|
|
612515
612588
|
if (/[\\/]node_modules[\\/]/.test(p.modulePath))
|
|
612516
612589
|
return "npm";
|
|
612517
|
-
const hasGit = p.isGitCheckout ?? ((dir) =>
|
|
612590
|
+
const hasGit = p.isGitCheckout ?? ((dir) => existsSync138(`${dir}/.git`));
|
|
612518
612591
|
const parts = p.modulePath.replace(/^file:\/\//, "").split(/[\\/]/);
|
|
612519
612592
|
for (let i = parts.length - 1;i > 0; i--) {
|
|
612520
612593
|
if (hasGit(parts.slice(0, i).join("/") || "/"))
|
|
@@ -612820,13 +612893,13 @@ function swapInto(staged, target, platform) {
|
|
|
612820
612893
|
} catch {
|
|
612821
612894
|
old = `${target}.old-${randomBytes19(4).toString("hex")}`;
|
|
612822
612895
|
}
|
|
612823
|
-
const hadTarget =
|
|
612896
|
+
const hadTarget = existsSync138(target);
|
|
612824
612897
|
if (hadTarget)
|
|
612825
612898
|
renameSync19(target, old);
|
|
612826
612899
|
try {
|
|
612827
612900
|
renameSync19(staged, target);
|
|
612828
612901
|
} catch (err) {
|
|
612829
|
-
if (hadTarget && !
|
|
612902
|
+
if (hadTarget && !existsSync138(target))
|
|
612830
612903
|
renameSync19(old, target);
|
|
612831
612904
|
throw err;
|
|
612832
612905
|
}
|
|
@@ -612864,7 +612937,7 @@ async function updateNpmFromRelease(o, rel, platform) {
|
|
|
612864
612937
|
if (actual !== expected)
|
|
612865
612938
|
return `checksum mismatch for ${name} (expected ${expected}, got ${actual}); nothing changed`;
|
|
612866
612939
|
o.log(`SHA256 matches SHA256SUMS: ${actual}`);
|
|
612867
|
-
const dir = mkdtempSync12(join196(
|
|
612940
|
+
const dir = mkdtempSync12(join196(resolve77(o.tmpDir ?? tmpdir20()), "8gent-update-"));
|
|
612868
612941
|
try {
|
|
612869
612942
|
const file = join196(dir, name);
|
|
612870
612943
|
writeFileSync81(file, bytes, { flag: "wx", mode: 384 });
|
|
@@ -613024,7 +613097,7 @@ var init_changelog_view = __esm(() => {
|
|
|
613024
613097
|
|
|
613025
613098
|
// packages/eight/source-update.ts
|
|
613026
613099
|
import { execFile as execFile6 } from "node:child_process";
|
|
613027
|
-
import { existsSync as
|
|
613100
|
+
import { existsSync as existsSync139, realpathSync as realpathSync39, statSync as statSync42 } from "node:fs";
|
|
613028
613101
|
import { homedir as homedir97 } from "node:os";
|
|
613029
613102
|
import * as nodePath from "node:path";
|
|
613030
613103
|
function scrubbedEnv2(base) {
|
|
@@ -613123,7 +613196,7 @@ function modulePathToFs(modulePath) {
|
|
|
613123
613196
|
}
|
|
613124
613197
|
return s;
|
|
613125
613198
|
}
|
|
613126
|
-
function findCheckoutRoot(modulePath, platform, hasGit = (d) =>
|
|
613199
|
+
function findCheckoutRoot(modulePath, platform, hasGit = (d) => existsSync139(lib(platform).join(d, ".git"))) {
|
|
613127
613200
|
const p = lib(platform);
|
|
613128
613201
|
const fsPath = modulePathToFs(modulePath);
|
|
613129
613202
|
let dir = p.dirname(platform === "win32" ? fsPath.replace(/\//g, "\\") : fsPath);
|
|
@@ -613139,7 +613212,7 @@ function findCheckoutRoot(modulePath, platform, hasGit = (d) => existsSync138(li
|
|
|
613139
613212
|
}
|
|
613140
613213
|
function findBrowserCheckout(o) {
|
|
613141
613214
|
const p = lib(o.platform);
|
|
613142
|
-
const hasGit = o.hasGit ?? ((d) =>
|
|
613215
|
+
const hasGit = o.hasGit ?? ((d) => existsSync139(p.join(d, ".git")));
|
|
613143
613216
|
const looked = [];
|
|
613144
613217
|
let note;
|
|
613145
613218
|
const cands = [];
|
|
@@ -613442,7 +613515,7 @@ async function runSourceUpdate(deps, opts, report) {
|
|
|
613442
613515
|
git,
|
|
613443
613516
|
bun: bun ?? "bun",
|
|
613444
613517
|
platform,
|
|
613445
|
-
fileExists: deps.fileExists ?? ((f) =>
|
|
613518
|
+
fileExists: deps.fileExists ?? ((f) => existsSync139(f)),
|
|
613446
613519
|
now: deps.now ?? (() => new Date),
|
|
613447
613520
|
baseEnv: env,
|
|
613448
613521
|
forgeHost: env.EIGHT_FORGE_HOST,
|
|
@@ -617812,7 +617885,7 @@ function nodeExecPath(execPath = process.execPath, env = process.env, exists = e
|
|
|
617812
617885
|
|
|
617813
617886
|
// bin/8gent.ts
|
|
617814
617887
|
refuseIfNested();
|
|
617815
|
-
var VERSION5 = "0.20.
|
|
617888
|
+
var VERSION5 = "0.20.16";
|
|
617816
617889
|
var RELAUNCH_EXIT_CODE = 75;
|
|
617817
617890
|
var MODULE_DIR = path158.dirname(fileURLToPath8(import.meta.url));
|
|
617818
617891
|
var EXEC_DIR = path158.dirname(process.execPath);
|