@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/cli.js
CHANGED
|
@@ -41468,8 +41468,6 @@ var init_allowlist = __esm(() => {
|
|
|
41468
41468
|
"node",
|
|
41469
41469
|
"npm",
|
|
41470
41470
|
"npx",
|
|
41471
|
-
"pnpm",
|
|
41472
|
-
"yarn",
|
|
41473
41471
|
"deno",
|
|
41474
41472
|
"python",
|
|
41475
41473
|
"python3",
|
|
@@ -41477,9 +41475,6 @@ var init_allowlist = __esm(() => {
|
|
|
41477
41475
|
"pip3",
|
|
41478
41476
|
"uv",
|
|
41479
41477
|
"git",
|
|
41480
|
-
"go",
|
|
41481
|
-
"cargo",
|
|
41482
|
-
"rustc",
|
|
41483
41478
|
"tsc",
|
|
41484
41479
|
"gh",
|
|
41485
41480
|
"docker",
|
|
@@ -41504,20 +41499,18 @@ var init_allowlist = __esm(() => {
|
|
|
41504
41499
|
"biome",
|
|
41505
41500
|
"eslint",
|
|
41506
41501
|
"prettier",
|
|
41507
|
-
"vite"
|
|
41502
|
+
"vite",
|
|
41503
|
+
"8gent"
|
|
41508
41504
|
]);
|
|
41509
41505
|
SHORT_VERSION = {
|
|
41510
41506
|
node: "-v",
|
|
41511
41507
|
bun: "-v",
|
|
41512
41508
|
npm: "-v",
|
|
41513
|
-
pnpm: "-v",
|
|
41514
|
-
yarn: "-v",
|
|
41515
41509
|
deno: "-V",
|
|
41516
41510
|
python: "-V",
|
|
41517
41511
|
python3: "-V",
|
|
41518
41512
|
ffmpeg: "-version",
|
|
41519
|
-
ffprobe: "-version"
|
|
41520
|
-
go: "version"
|
|
41513
|
+
ffprobe: "-version"
|
|
41521
41514
|
};
|
|
41522
41515
|
SECRET_ARG = /(^|\/)\.env(\.[\w.-]+)?$|(^|\/)\.env\b|id_rsa|id_ed25519|id_ecdsa|(^|\/)\.ssh(\/|$)|\.aws\/|credentials|\.netrc|\.npmrc|\.git-credentials|keychain|\.pem$|\.key$|\.p12$/;
|
|
41523
41516
|
REDIR_RE2 = /(?<![<>&\d])(\d?|&)(>>?|<)(\|?)\s*(&\d+|[^\s;|&<>()]+)/g;
|
|
@@ -46102,8 +46095,31 @@ function emptyReplyStall(toolCalls) {
|
|
|
46102
46095
|
function isEmptyReplyStall(line) {
|
|
46103
46096
|
return line.startsWith(EMPTY_REPLY_STALL_PREFIX);
|
|
46104
46097
|
}
|
|
46105
|
-
function
|
|
46106
|
-
|
|
46098
|
+
function refusedCalls(log, max = 3) {
|
|
46099
|
+
const out = [];
|
|
46100
|
+
let total = 0;
|
|
46101
|
+
for (const e of log) {
|
|
46102
|
+
const m = /^\[[^\]]*\b(?:BLOCKED|DENIED)\b[^\]]*\]\s*([^\n]*)/.exec((e.result ?? "").trimStart());
|
|
46103
|
+
if (!m)
|
|
46104
|
+
continue;
|
|
46105
|
+
total++;
|
|
46106
|
+
if (out.length >= max)
|
|
46107
|
+
continue;
|
|
46108
|
+
const a = e.args;
|
|
46109
|
+
const first = typeof a?.command === "string" ? a.command.trim().split(/\s+/)[0] ?? "" : "";
|
|
46110
|
+
const bin = /^[A-Za-z][\w.+-]{0,40}$/.test(first) ? ` ${first}` : "";
|
|
46111
|
+
const why = /declin/i.test(m[1]) ? "declined" : "blocked by policy";
|
|
46112
|
+
out.push(`${e.name}${bin}: ${why}`);
|
|
46113
|
+
}
|
|
46114
|
+
return { total, shown: out };
|
|
46115
|
+
}
|
|
46116
|
+
function emptyReplyNote(toolCalls, log = []) {
|
|
46117
|
+
const base = `[harness] No reply: ${emptyReplyStall(toolCalls)}.`;
|
|
46118
|
+
const { total, shown } = refusedCalls(log);
|
|
46119
|
+
if (total === 0)
|
|
46120
|
+
return base;
|
|
46121
|
+
const more = total > shown.length ? ` (and ${total - shown.length} more)` : "";
|
|
46122
|
+
return `${base} ${total} of the calls were refused, so they did not run: ${shown.join("; ")}${more}.`;
|
|
46107
46123
|
}
|
|
46108
46124
|
function isEmptyReplyNote(reply) {
|
|
46109
46125
|
return reply.startsWith("[harness] No reply:");
|
|
@@ -46196,7 +46212,7 @@ ${summary}`;
|
|
|
46196
46212
|
if (unverified.length === 0)
|
|
46197
46213
|
return { content, rounds, toolLog, unverified: [] };
|
|
46198
46214
|
const notes = [
|
|
46199
|
-
empty ? emptyReplyNote(toolLog.length) : content.trimEnd(),
|
|
46215
|
+
empty ? emptyReplyNote(toolLog.length, toolLog) : content.trimEnd(),
|
|
46200
46216
|
unfulfilled.length > 0 ? formatHarnessNote(unfulfilled) : ""
|
|
46201
46217
|
].filter((n) => n.trim() !== "");
|
|
46202
46218
|
return { content: notes.join(`
|
|
@@ -549347,6 +549363,44 @@ var init_planning_gate = __esm(() => {
|
|
|
549347
549363
|
PLANNING_KEYWORDS = /\b(build|create|implement|fix|refactor|add|setup|configure|migrate|convert|redesign|scaffold|deploy|integrate)\b/i;
|
|
549348
549364
|
});
|
|
549349
549365
|
|
|
549366
|
+
// packages/eight/small-talk.ts
|
|
549367
|
+
function isSmallTalk(text) {
|
|
549368
|
+
const flat = text.toLowerCase().replace(/^\[mode: [^\]]*\]\s*/, "").replace(/['\u2019]/g, "").replace(/[^a-z0-9 ]+/g, " ").replace(/\s+/g, " ").trim();
|
|
549369
|
+
return flat.length > 0 && flat.length <= 40 && GREETING.test(flat);
|
|
549370
|
+
}
|
|
549371
|
+
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.";
|
|
549372
|
+
var init_small_talk = __esm(() => {
|
|
549373
|
+
CORE = [
|
|
549374
|
+
"h+i+",
|
|
549375
|
+
"h+e+y+",
|
|
549376
|
+
"h+e+l+o+",
|
|
549377
|
+
"hiya",
|
|
549378
|
+
"howdy",
|
|
549379
|
+
"y+o+",
|
|
549380
|
+
"sup",
|
|
549381
|
+
"wa+s+s?u+p+",
|
|
549382
|
+
"w?h?a+t?s? ?u+p+",
|
|
549383
|
+
"good (?:morning|afternoon|evening|night)",
|
|
549384
|
+
"gm",
|
|
549385
|
+
"gn",
|
|
549386
|
+
"morning",
|
|
549387
|
+
"evening",
|
|
549388
|
+
"how are you(?: doing| today)?",
|
|
549389
|
+
"how are things",
|
|
549390
|
+
"hows it going",
|
|
549391
|
+
"how you doing",
|
|
549392
|
+
"you there",
|
|
549393
|
+
"anyone there",
|
|
549394
|
+
"ping",
|
|
549395
|
+
"thanks(?: a lot| so much)?",
|
|
549396
|
+
"thank you(?: so much)?",
|
|
549397
|
+
"thx",
|
|
549398
|
+
"ty",
|
|
549399
|
+
"cheers"
|
|
549400
|
+
].join("|");
|
|
549401
|
+
GREETING = new RegExp(`^(?:(?:hi+|hey+|hello+|yo+|hiya|howdy) )?(?:${CORE})(?: (?:there|again|everyone|all|team|mate|man|bro|friend|8gent|eight))?$`);
|
|
549402
|
+
});
|
|
549403
|
+
|
|
549350
549404
|
// packages/eight/verify-gate.ts
|
|
549351
549405
|
function isVerifyGateEnabled(env = process.env) {
|
|
549352
549406
|
const v = (env.EIGHT_VERIFY_GATE ?? "").trim().toLowerCase();
|
|
@@ -550273,8 +550327,8 @@ __export(exports_system_prompt, {
|
|
|
550273
550327
|
styleHasGuide: () => styleHasGuide,
|
|
550274
550328
|
workingProjectNote: () => workingProjectNote
|
|
550275
550329
|
});
|
|
550276
|
-
import { readFileSync as readFileSync92 } from "fs";
|
|
550277
|
-
import { basename as basename49, join as join145 } from "path";
|
|
550330
|
+
import { existsSync as existsSync101, readFileSync as readFileSync92 } from "fs";
|
|
550331
|
+
import { basename as basename49, join as join145, resolve as resolve68 } from "path";
|
|
550278
550332
|
function buildBoardContextSegment(path = BOARD_CONTEXT_PATH) {
|
|
550279
550333
|
let text;
|
|
550280
550334
|
try {
|
|
@@ -550305,8 +550359,20 @@ function communicationStyleLine(style) {
|
|
|
550305
550359
|
function styleHasGuide(style) {
|
|
550306
550360
|
return isCommunicationStyle(style) && STYLE_GUIDE[style] !== "";
|
|
550307
550361
|
}
|
|
550362
|
+
function isPlainHome(dir, home = resolveHome()) {
|
|
550363
|
+
try {
|
|
550364
|
+
return home !== "" && resolve68(dir) === resolve68(home) && !existsSync101(join145(dir, ".git"));
|
|
550365
|
+
} catch {
|
|
550366
|
+
return false;
|
|
550367
|
+
}
|
|
550368
|
+
}
|
|
550308
550369
|
function workingProjectNote(dir) {
|
|
550309
550370
|
const name = basename49(dir) || dir;
|
|
550371
|
+
if (isPlainHome(dir)) {
|
|
550372
|
+
return `
|
|
550373
|
+
|
|
550374
|
+
**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.**`;
|
|
550375
|
+
}
|
|
550310
550376
|
if (name === "8gent-code") {
|
|
550311
550377
|
return `
|
|
550312
550378
|
|
|
@@ -563132,14 +563198,15 @@ ${LOCAL_LOGIN_NOTE}`;
|
|
|
563132
563198
|
instructions,
|
|
563133
563199
|
localCoreTools,
|
|
563134
563200
|
chatStartTime,
|
|
563135
|
-
textForAgent
|
|
563201
|
+
textForAgent,
|
|
563202
|
+
smallTalk = false
|
|
563136
563203
|
} = opts;
|
|
563137
563204
|
const signal = this.armController().signal;
|
|
563138
563205
|
const allow = new Set(localCoreTools);
|
|
563139
563206
|
const specs = toolDefsToSpecs(this.executor.getToolDefinitions(), allow);
|
|
563140
563207
|
let stepNumber = 0;
|
|
563141
563208
|
let breakerStop = null;
|
|
563142
|
-
if (this.extensionToolsAllowed()) {
|
|
563209
|
+
if (this.extensionToolsAllowed() && !smallTalk) {
|
|
563143
563210
|
for (const t of this.extensionHost.listTools()) {
|
|
563144
563211
|
if (this.modeAllows(t.name)) {
|
|
563145
563212
|
specs.push({ name: t.name, description: t.description, parameters: t.parameters });
|
|
@@ -563717,6 +563784,10 @@ ${LOCAL_LOGIN_NOTE}`;
|
|
|
563717
563784
|
this.turnGitBaseline = asksForCommit(userMessage) ? gitSnapshot(this.config.workingDirectory || process.cwd()) : null;
|
|
563718
563785
|
this.executor.beginTurn(userMessage);
|
|
563719
563786
|
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);
|
|
563787
|
+
const smallTalkTurn = isSmallTalk(textForAgent) && !imageBase64 && this.config.agentScope !== "__table__";
|
|
563788
|
+
if (smallTalkTurn) {
|
|
563789
|
+
this.messageHistory.push({ role: "user", content: harnessNote(SMALL_TALK_NOTE) });
|
|
563790
|
+
}
|
|
563720
563791
|
let visionId = null;
|
|
563721
563792
|
let visionFailed = false;
|
|
563722
563793
|
if (imageBase64 && await this.promptImageSeen()) {
|
|
@@ -563787,7 +563858,7 @@ ${result.description.slice(0, 200)}${result.description.length > 200 ? "..." : "
|
|
|
563787
563858
|
}
|
|
563788
563859
|
}
|
|
563789
563860
|
const quickPrompt = quickLaneEnabled() && classifyPrompt(textForAgent) === "quick";
|
|
563790
|
-
if (needsClarification(textForAgent) && !imageBase64 && !quickPrompt && !isNoToolScope(this.config.agentScope)) {
|
|
563861
|
+
if (needsClarification(textForAgent) && !imageBase64 && !quickPrompt && !smallTalkTurn && !isNoToolScope(this.config.agentScope)) {
|
|
563791
563862
|
this.proactiveGatherer = createGatherer(textForAgent);
|
|
563792
563863
|
const question = this.proactiveGatherer.getCurrentQuestion();
|
|
563793
563864
|
if (question) {
|
|
@@ -563809,7 +563880,7 @@ Ask the user naturally; don't mention this instruction. After they answer, proce
|
|
|
563809
563880
|
this.kanban.moveTask(this.currentBmadTask.id, "ready");
|
|
563810
563881
|
this.kanban.moveTask(this.currentBmadTask.id, "in_progress");
|
|
563811
563882
|
}
|
|
563812
|
-
if (!this.proactiveGatherer && !quickPrompt) {
|
|
563883
|
+
if (!this.proactiveGatherer && !quickPrompt && !smallTalkTurn) {
|
|
563813
563884
|
await this.tryRunPreToolRouter(textForAgent);
|
|
563814
563885
|
}
|
|
563815
563886
|
const needsPlanningGate2 = !isVerbatimScope(this.config.agentScope) && needsPlanningGate(textForAgent);
|
|
@@ -563954,9 +564025,9 @@ Ask the user naturally; don't mention this instruction. After they answer, proce
|
|
|
563954
564025
|
"search_symbols",
|
|
563955
564026
|
"recall"
|
|
563956
564027
|
]);
|
|
563957
|
-
const scopedTools = isNoToolScope(this.config.agentScope) ? {} : this.config.agentScope === "__table__" ? Object.fromEntries(Object.entries(providerTools).filter(([k]) => TABLE_SESSION_TOOLS.has(k))) : providerTools;
|
|
564028
|
+
const scopedTools = isNoToolScope(this.config.agentScope) || smallTalkTurn ? {} : this.config.agentScope === "__table__" ? Object.fromEntries(Object.entries(providerTools).filter(([k]) => TABLE_SESSION_TOOLS.has(k))) : providerTools;
|
|
563958
564029
|
const withExtensions = { ...scopedTools };
|
|
563959
|
-
if (this.extensionToolsAllowed()) {
|
|
564030
|
+
if (this.extensionToolsAllowed() && !smallTalkTurn) {
|
|
563960
564031
|
for (const t of this.extensionHost.listTools()) {
|
|
563961
564032
|
if (t.name in withExtensions)
|
|
563962
564033
|
continue;
|
|
@@ -563968,7 +564039,7 @@ Ask the user naturally; don't mention this instruction. After they answer, proce
|
|
|
563968
564039
|
}
|
|
563969
564040
|
}
|
|
563970
564041
|
const effectiveTools = this.modeFilter(withExtensions);
|
|
563971
|
-
const textToolAllowlist = (isNoToolScope(this.config.agentScope) ? [] : this.config.agentScope === "__table__" ? [...TABLE_SESSION_TOOLS] : localCoreTools).filter((name) => getModeManager().isToolAllowed(name));
|
|
564042
|
+
const textToolAllowlist = (isNoToolScope(this.config.agentScope) || smallTalkTurn ? [] : this.config.agentScope === "__table__" ? [...TABLE_SESSION_TOOLS] : localCoreTools).filter((name) => getModeManager().isToolAllowed(name));
|
|
563972
564043
|
const harness = this.harnessProfileFor(providerConfig.model, isLocalProvider);
|
|
563973
564044
|
Object.assign(this.runtimeParams, {
|
|
563974
564045
|
voiceChatActive: getRuntimeParams().voiceChatActive,
|
|
@@ -563993,7 +564064,8 @@ Ask the user naturally; don't mention this instruction. After they answer, proce
|
|
|
563993
564064
|
`),
|
|
563994
564065
|
localCoreTools: textToolAllowlist,
|
|
563995
564066
|
chatStartTime,
|
|
563996
|
-
textForAgent
|
|
564067
|
+
textForAgent,
|
|
564068
|
+
smallTalk: smallTalkTurn
|
|
563997
564069
|
});
|
|
563998
564070
|
await this.readServerContextWindow();
|
|
563999
564071
|
await this.compactIfNeeded(providerConfig);
|
|
@@ -564678,7 +564750,7 @@ ${summary || " (no provider errors recorded)"}`);
|
|
|
564678
564750
|
};
|
|
564679
564751
|
}
|
|
564680
564752
|
const blankNative = gatedNative.content.trim() === "";
|
|
564681
|
-
const content = blankNative ? emptyReplyNote(this.turnToolLedger.length) : gatedNative.content;
|
|
564753
|
+
const content = blankNative ? emptyReplyNote(this.turnToolLedger.length, this.turnToolLedger) : gatedNative.content;
|
|
564682
564754
|
const flavor = voice.getFlavor("complete");
|
|
564683
564755
|
const flavoredContent = fixCompletedLine(gatedNative.violated || isVerbatimScope(this.config.agentScope) ? content : flavorResponse(content, flavor)).text;
|
|
564684
564756
|
this.messageHistory.push({ role: "assistant", content: flavoredContent });
|
|
@@ -565393,6 +565465,7 @@ var init_agent2 = __esm(() => {
|
|
|
565393
565465
|
init_modes();
|
|
565394
565466
|
init_planning_gate();
|
|
565395
565467
|
init_registry();
|
|
565468
|
+
init_small_talk();
|
|
565396
565469
|
init_verify_gate();
|
|
565397
565470
|
init_local_tool_scope();
|
|
565398
565471
|
init_local_turn_error();
|
|
@@ -566892,7 +566965,7 @@ var init_throughput_tracker = __esm(() => {
|
|
|
566892
566965
|
|
|
566893
566966
|
// packages/orchestration/worktree-pool-agent.ts
|
|
566894
566967
|
import { execFileSync as execFileSync10, spawn as spawn23 } from "child_process";
|
|
566895
|
-
import { appendFileSync as appendFileSync23, existsSync as
|
|
566968
|
+
import { appendFileSync as appendFileSync23, existsSync as existsSync106, mkdirSync as mkdirSync76, readFileSync as readFileSync98, writeFileSync as writeFileSync58 } from "fs";
|
|
566896
566969
|
import { join as join158 } from "path";
|
|
566897
566970
|
|
|
566898
566971
|
class WorktreePoolAgent {
|
|
@@ -566973,7 +567046,7 @@ class WorktreePoolAgent {
|
|
|
566973
567046
|
}
|
|
566974
567047
|
static readResult(worktreePath) {
|
|
566975
567048
|
const p = join158(worktreePath, ".8gent", "result.json");
|
|
566976
|
-
if (!
|
|
567049
|
+
if (!existsSync106(p))
|
|
566977
567050
|
return null;
|
|
566978
567051
|
try {
|
|
566979
567052
|
return JSON.parse(readFileSync98(p, "utf-8"));
|
|
@@ -566988,8 +567061,8 @@ var init_worktree_pool_agent = __esm(() => {
|
|
|
566988
567061
|
|
|
566989
567062
|
// packages/orchestration/worktree-pool.ts
|
|
566990
567063
|
import { execFileSync as execFileSync11 } from "child_process";
|
|
566991
|
-
import { existsSync as
|
|
566992
|
-
import { join as join159, resolve as
|
|
567064
|
+
import { existsSync as existsSync107, mkdirSync as mkdirSync77 } from "fs";
|
|
567065
|
+
import { join as join159, resolve as resolve69 } from "path";
|
|
566993
567066
|
|
|
566994
567067
|
class WorktreePool {
|
|
566995
567068
|
projectRoot;
|
|
@@ -567002,7 +567075,7 @@ class WorktreePool {
|
|
|
567002
567075
|
running = 0;
|
|
567003
567076
|
queue = [];
|
|
567004
567077
|
constructor(opts = {}) {
|
|
567005
|
-
this.projectRoot =
|
|
567078
|
+
this.projectRoot = resolve69(opts.projectRoot ?? process.cwd());
|
|
567006
567079
|
this.worktreesDir = join159(this.projectRoot, ".8gent", "worktrees");
|
|
567007
567080
|
this.maxConcurrent = opts.maxConcurrent ?? DEFAULT_MAX;
|
|
567008
567081
|
this.taskTimeoutMs = opts.taskTimeoutMs ?? DEFAULT_TIMEOUT2;
|
|
@@ -567122,7 +567195,7 @@ class WorktreePool {
|
|
|
567122
567195
|
}
|
|
567123
567196
|
}
|
|
567124
567197
|
gitWorktreeRemove(path) {
|
|
567125
|
-
if (!
|
|
567198
|
+
if (!existsSync107(path))
|
|
567126
567199
|
return;
|
|
567127
567200
|
try {
|
|
567128
567201
|
execFileSync11("git", ["worktree", "remove", path, "--force"], {
|
|
@@ -567147,7 +567220,7 @@ var init_worktree_pool = __esm(() => {
|
|
|
567147
567220
|
|
|
567148
567221
|
// packages/orchestration/worktree-messaging.ts
|
|
567149
567222
|
import {
|
|
567150
|
-
existsSync as
|
|
567223
|
+
existsSync as existsSync108,
|
|
567151
567224
|
mkdirSync as mkdirSync78,
|
|
567152
567225
|
readFileSync as readFileSync99,
|
|
567153
567226
|
readdirSync as readdirSync26,
|
|
@@ -567184,7 +567257,7 @@ class WorktreeMessaging {
|
|
|
567184
567257
|
}
|
|
567185
567258
|
readDir(agentId, remove) {
|
|
567186
567259
|
const dir = join160(this.base, agentId);
|
|
567187
|
-
if (!
|
|
567260
|
+
if (!existsSync108(dir))
|
|
567188
567261
|
return [];
|
|
567189
567262
|
const files = readdirSync26(dir).filter((f) => f.endsWith(".json")).sort();
|
|
567190
567263
|
const messages = [];
|
|
@@ -567199,7 +567272,7 @@ class WorktreeMessaging {
|
|
|
567199
567272
|
return messages;
|
|
567200
567273
|
}
|
|
567201
567274
|
listInboxes() {
|
|
567202
|
-
if (!
|
|
567275
|
+
if (!existsSync108(this.base))
|
|
567203
567276
|
return [];
|
|
567204
567277
|
return readdirSync26(this.base);
|
|
567205
567278
|
}
|
|
@@ -569327,13 +569400,13 @@ var init_adaptive_pipeline = __esm(() => {
|
|
|
569327
569400
|
|
|
569328
569401
|
// packages/orchestration/pipeline-cli.ts
|
|
569329
569402
|
import { mkdirSync as mkdirSync80, writeFileSync as writeFileSync61 } from "fs";
|
|
569330
|
-
import { join as join162, resolve as
|
|
569403
|
+
import { join as join162, resolve as resolve70 } from "path";
|
|
569331
569404
|
async function runPipelineCommand(args) {
|
|
569332
|
-
let outDir =
|
|
569405
|
+
let outDir = resolve70(process.cwd(), "pipeline-output");
|
|
569333
569406
|
const taskParts = [];
|
|
569334
569407
|
for (let i = 0;i < args.length; i++) {
|
|
569335
569408
|
if (args[i] === "--out" && args[i + 1]) {
|
|
569336
|
-
outDir =
|
|
569409
|
+
outDir = resolve70(args[++i]);
|
|
569337
569410
|
} else if (!args[i].startsWith("-")) {
|
|
569338
569411
|
taskParts.push(args[i]);
|
|
569339
569412
|
}
|
|
@@ -569650,7 +569723,7 @@ var init_classroom = __esm(() => {
|
|
|
569650
569723
|
import { randomBytes as randomBytes10 } from "crypto";
|
|
569651
569724
|
import {
|
|
569652
569725
|
closeSync as closeSync21,
|
|
569653
|
-
existsSync as
|
|
569726
|
+
existsSync as existsSync110,
|
|
569654
569727
|
fchmodSync as fchmodSync5,
|
|
569655
569728
|
fsyncSync as fsyncSync2,
|
|
569656
569729
|
linkSync,
|
|
@@ -569751,13 +569824,13 @@ class WorkQueue {
|
|
|
569751
569824
|
this.path = path;
|
|
569752
569825
|
this.startLimit = startLimitFor(opts.maxSessions, opts.startLimit);
|
|
569753
569826
|
const dir = dirname73(path);
|
|
569754
|
-
if (!
|
|
569827
|
+
if (!existsSync110(dir))
|
|
569755
569828
|
mkdirSync82(dir, { recursive: true, mode: 448 });
|
|
569756
569829
|
this.lockPath = `${path}.lock`;
|
|
569757
569830
|
acquireLock(this.lockPath);
|
|
569758
569831
|
let raw = "";
|
|
569759
569832
|
try {
|
|
569760
|
-
if (
|
|
569833
|
+
if (existsSync110(path))
|
|
569761
569834
|
raw = readFileSync100(path, "utf8");
|
|
569762
569835
|
this.replay(raw);
|
|
569763
569836
|
this.fd = openSync21(path, "a", 384);
|
|
@@ -572728,7 +572801,7 @@ var init_post_to_channel = __esm(() => {
|
|
|
572728
572801
|
|
|
572729
572802
|
// packages/table/huddle-voice.ts
|
|
572730
572803
|
import { spawnSync as spawnSync12 } from "child_process";
|
|
572731
|
-
import { existsSync as
|
|
572804
|
+
import { existsSync as existsSync112 } from "fs";
|
|
572732
572805
|
function voiceFor(code) {
|
|
572733
572806
|
return VOICES[code.toUpperCase()] ?? HUMAN_VOICE;
|
|
572734
572807
|
}
|
|
@@ -572743,11 +572816,11 @@ function inQuietHours(now) {
|
|
|
572743
572816
|
}
|
|
572744
572817
|
function findSupertonic() {
|
|
572745
572818
|
for (const p of SUPERTONIC_CANDIDATES)
|
|
572746
|
-
if (
|
|
572819
|
+
if (existsSync112(p))
|
|
572747
572820
|
return p;
|
|
572748
572821
|
const which = spawnSync12("which", ["supertonic"], { encoding: "utf8" });
|
|
572749
572822
|
const found = which.stdout?.trim();
|
|
572750
|
-
return found &&
|
|
572823
|
+
return found && existsSync112(found) ? found : null;
|
|
572751
572824
|
}
|
|
572752
572825
|
function speechText(text, maxChars = 480) {
|
|
572753
572826
|
const cleaned = text.replace(/\(verified:[^)]*\)/g, "").replace(/\[CLAIM STRIPPED:[^\]]*\]/g, "").replace(/`+/g, "").replace(/^[\s>*-]+/gm, "").replace(/\s+/g, " ").trim();
|
|
@@ -572780,7 +572853,7 @@ function narrateTurn(opts) {
|
|
|
572780
572853
|
if (!bin)
|
|
572781
572854
|
return { audioPath: null, durationMs: estimate, skipped: "no_tts" };
|
|
572782
572855
|
const r = spawnSync12(bin, ["tts", text, "-o", opts.outPath, "--voice", opts.voice.supertonic, "--steps", String(opts.steps ?? 8)], { encoding: "utf8", timeout: 120000 });
|
|
572783
|
-
if (r.status !== 0 || !
|
|
572856
|
+
if (r.status !== 0 || !existsSync112(opts.outPath)) {
|
|
572784
572857
|
return { audioPath: null, durationMs: estimate, skipped: "tts_failed" };
|
|
572785
572858
|
}
|
|
572786
572859
|
return { audioPath: opts.outPath, durationMs: probeDurationMs(opts.outPath) ?? estimate };
|
|
@@ -572881,7 +572954,7 @@ var init_message_speak = __esm(() => {
|
|
|
572881
572954
|
});
|
|
572882
572955
|
|
|
572883
572956
|
// packages/table/message-audio.ts
|
|
572884
|
-
import { existsSync as
|
|
572957
|
+
import { existsSync as existsSync113, mkdirSync as mkdirSync86, readFileSync as readFileSync104 } from "fs";
|
|
572885
572958
|
import * as os54 from "os";
|
|
572886
572959
|
import * as path123 from "path";
|
|
572887
572960
|
function messageAudioRoot() {
|
|
@@ -572897,7 +572970,7 @@ function handleTableAudioHttp(url) {
|
|
|
572897
572970
|
return null;
|
|
572898
572971
|
const [, messageId, file] = m;
|
|
572899
572972
|
const filePath = path123.join(messageAudioDir(messageId), file);
|
|
572900
|
-
if (!
|
|
572973
|
+
if (!existsSync113(filePath))
|
|
572901
572974
|
return new Response("not found", { status: 404 });
|
|
572902
572975
|
const ext = file.slice(file.lastIndexOf("."));
|
|
572903
572976
|
return new Response(readFileSync104(filePath), {
|
|
@@ -575019,7 +575092,7 @@ function fnv1a(text) {
|
|
|
575019
575092
|
function draw(seedText, axis, options) {
|
|
575020
575093
|
return options[fnv1a(`${axis}:${seedText}`) % options.length];
|
|
575021
575094
|
}
|
|
575022
|
-
function
|
|
575095
|
+
function resolve71(intent) {
|
|
575023
575096
|
const tone = intent.tone ?? "";
|
|
575024
575097
|
if (tone && !TONES[tone]) {
|
|
575025
575098
|
throw new DesignRefused("intent.tone", `unknown tone ${JSON.stringify(tone)}. Known tones: ${TONE_NAMES.join(", ")}.`);
|
|
@@ -575103,7 +575176,7 @@ function coordinateId(c) {
|
|
|
575103
575176
|
return fnv1a(canonical).toString(16).padStart(8, "0");
|
|
575104
575177
|
}
|
|
575105
575178
|
function compose(intent) {
|
|
575106
|
-
return composeAt(
|
|
575179
|
+
return composeAt(resolve71(intent), intent);
|
|
575107
575180
|
}
|
|
575108
575181
|
var TONES, TONE_NAMES, BASE_PX;
|
|
575109
575182
|
var init_compose = __esm(() => {
|
|
@@ -575892,10 +575965,10 @@ var init_slide_render = __esm(() => {
|
|
|
575892
575965
|
// packages/table/bake.ts
|
|
575893
575966
|
import { spawnSync as spawnSync13 } from "child_process";
|
|
575894
575967
|
import { createHash as createHash26 } from "crypto";
|
|
575895
|
-
import { existsSync as
|
|
575968
|
+
import { existsSync as existsSync114, mkdirSync as mkdirSync87, readdirSync as readdirSync27, readFileSync as readFileSync105, rmSync as rmSync16, writeFileSync as writeFileSync63 } from "fs";
|
|
575896
575969
|
import { basename as basename50, join as join170 } from "path";
|
|
575897
575970
|
function findChrome3() {
|
|
575898
|
-
return CHROME_CANDIDATES2.find((p) =>
|
|
575971
|
+
return CHROME_CANDIDATES2.find((p) => existsSync114(p)) ?? null;
|
|
575899
575972
|
}
|
|
575900
575973
|
function huddleDir(huddleId) {
|
|
575901
575974
|
return join170(HUDDLES_DIR, huddleId);
|
|
@@ -575917,7 +575990,7 @@ function slideToPng(htmlPath, pngPath, chrome) {
|
|
|
575917
575990
|
`--screenshot=${pngPath}`,
|
|
575918
575991
|
`file://${htmlPath}`
|
|
575919
575992
|
], { encoding: "utf8", timeout: 60000 });
|
|
575920
|
-
return r.status === 0 &&
|
|
575993
|
+
return r.status === 0 && existsSync114(pngPath);
|
|
575921
575994
|
}
|
|
575922
575995
|
function emitDeckV2V(manifest) {
|
|
575923
575996
|
const slides = manifest.turns.map((t) => {
|
|
@@ -576059,7 +576132,7 @@ function bakeHuddle(manifest, stamp) {
|
|
|
576059
576132
|
mkdirSync87(work, { recursive: true });
|
|
576060
576133
|
for (const turn of manifest.turns) {
|
|
576061
576134
|
const htmlPath = join170(dir, "slides", `slide-${turn.turnId}.html`);
|
|
576062
|
-
if (!
|
|
576135
|
+
if (!existsSync114(htmlPath)) {
|
|
576063
576136
|
const { html } = renderSlide(turn.spec, {
|
|
576064
576137
|
code: turn.code,
|
|
576065
576138
|
name: turn.name,
|
|
@@ -576083,7 +576156,7 @@ function bakeHuddle(manifest, stamp) {
|
|
|
576083
576156
|
const clip = join170(work, `clip-${String(turn.index).padStart(3, "0")}.mp4`);
|
|
576084
576157
|
const secs = (turn.durationMs / 1000).toFixed(3);
|
|
576085
576158
|
const video = ["-loop", "1", "-framerate", "30", "-t", secs, "-i", png];
|
|
576086
|
-
const audio = turn.audioPath &&
|
|
576159
|
+
const audio = turn.audioPath && existsSync114(turn.audioPath) ? ["-ss", (turn.audioOffsetMs / 1000).toFixed(3), "-t", secs, "-i", turn.audioPath] : ["-f", "lavfi", "-t", secs, "-i", "anullsrc=r=44100:cl=stereo"];
|
|
576087
576160
|
const ok = ffmpegClip([
|
|
576088
576161
|
"-y",
|
|
576089
576162
|
...video,
|
|
@@ -576113,7 +576186,7 @@ function bakeHuddle(manifest, stamp) {
|
|
|
576113
576186
|
"-shortest",
|
|
576114
576187
|
clip
|
|
576115
576188
|
]);
|
|
576116
|
-
if (!ok || !
|
|
576189
|
+
if (!ok || !existsSync114(clip)) {
|
|
576117
576190
|
result.videoError = `ffmpeg clip failed for turn ${turn.index}`;
|
|
576118
576191
|
return result;
|
|
576119
576192
|
}
|
|
@@ -576125,7 +576198,7 @@ function bakeHuddle(manifest, stamp) {
|
|
|
576125
576198
|
const outName = `huddle-${slugify4(manifest.topic)}-${stamp}.mp4`;
|
|
576126
576199
|
const outPath = join170(CREATIVE_DIR2, outName);
|
|
576127
576200
|
const ok = ffmpegClip(["-y", "-f", "concat", "-safe", "0", "-i", listPath, "-c", "copy", "-movflags", "+faststart", outPath]);
|
|
576128
|
-
if (!ok || !
|
|
576201
|
+
if (!ok || !existsSync114(outPath)) {
|
|
576129
576202
|
result.videoError = "ffmpeg concat failed";
|
|
576130
576203
|
return result;
|
|
576131
576204
|
}
|
|
@@ -577594,7 +577667,7 @@ var init_zen = __esm(() => {
|
|
|
577594
577667
|
});
|
|
577595
577668
|
|
|
577596
577669
|
// packages/daemon/huddle-stage.ts
|
|
577597
|
-
import { existsSync as
|
|
577670
|
+
import { existsSync as existsSync115, mkdirSync as mkdirSync88, readFileSync as readFileSync107, writeFileSync as writeFileSync64 } from "fs";
|
|
577598
577671
|
import { join as join172 } from "path";
|
|
577599
577672
|
function openStage(huddleId, channelId, topic) {
|
|
577600
577673
|
ensureHuddleDirs(huddleId);
|
|
@@ -577725,7 +577798,7 @@ function ingestDictation(huddleId, holder, wavPath, whisperJsonPath, broadcast)
|
|
|
577725
577798
|
const state = stages.get(huddleId);
|
|
577726
577799
|
if (!state)
|
|
577727
577800
|
return 0;
|
|
577728
|
-
if (!
|
|
577801
|
+
if (!existsSync115(whisperJsonPath))
|
|
577729
577802
|
return 0;
|
|
577730
577803
|
const segments = parseWhisperJson(readFileSync107(whisperJsonPath, "utf8"));
|
|
577731
577804
|
const slides = zenSlides(segments, Object.keys(OFFICERS));
|
|
@@ -577831,7 +577904,7 @@ function handleStageHttp(url, wsUrl) {
|
|
|
577831
577904
|
if (!file || file.includes(".."))
|
|
577832
577905
|
return new Response("not found", { status: 404 });
|
|
577833
577906
|
const path = join172(huddleDir(huddleId), kind, file);
|
|
577834
|
-
if (!
|
|
577907
|
+
if (!existsSync115(path))
|
|
577835
577908
|
return new Response("not found", { status: 404 });
|
|
577836
577909
|
const ext = file.slice(file.lastIndexOf("."));
|
|
577837
577910
|
return new Response(readFileSync107(path), {
|
|
@@ -579710,13 +579783,13 @@ var init_workspace_db = __esm(() => {
|
|
|
579710
579783
|
});
|
|
579711
579784
|
|
|
579712
579785
|
// packages/daemon/routes/store/audit.ts
|
|
579713
|
-
import { appendFileSync as appendFileSync26, existsSync as
|
|
579786
|
+
import { appendFileSync as appendFileSync26, existsSync as existsSync117, mkdirSync as mkdirSync90 } from "fs";
|
|
579714
579787
|
import * as path127 from "path";
|
|
579715
579788
|
function auditDir() {
|
|
579716
579789
|
if (_auditDir)
|
|
579717
579790
|
return _auditDir;
|
|
579718
579791
|
const dir = path127.join(getDataDir(), "audit");
|
|
579719
|
-
if (!
|
|
579792
|
+
if (!existsSync117(dir)) {
|
|
579720
579793
|
try {
|
|
579721
579794
|
mkdirSync90(dir, { recursive: true });
|
|
579722
579795
|
} catch (err) {
|
|
@@ -581056,7 +581129,7 @@ var init_session2 = __esm(() => {
|
|
|
581056
581129
|
});
|
|
581057
581130
|
|
|
581058
581131
|
// packages/daemon/routes/store/index.ts
|
|
581059
|
-
import { existsSync as
|
|
581132
|
+
import { existsSync as existsSync121, mkdirSync as mkdirSync94, readFileSync as readFileSync111, writeFileSync as writeFileSync67 } from "fs";
|
|
581060
581133
|
import * as crypto13 from "crypto";
|
|
581061
581134
|
import * as path131 from "path";
|
|
581062
581135
|
function ensureServerToken(tokenPath) {
|
|
@@ -581064,9 +581137,9 @@ function ensureServerToken(tokenPath) {
|
|
|
581064
581137
|
return _cachedToken;
|
|
581065
581138
|
const file = tokenPath ?? path131.join(getDataDir(), "server.token");
|
|
581066
581139
|
const dir = path131.dirname(file);
|
|
581067
|
-
if (!
|
|
581140
|
+
if (!existsSync121(dir))
|
|
581068
581141
|
mkdirSync94(dir, { recursive: true });
|
|
581069
|
-
if (
|
|
581142
|
+
if (existsSync121(file)) {
|
|
581070
581143
|
const t = readFileSync111(file, "utf-8").trim();
|
|
581071
581144
|
if (t.length >= 32) {
|
|
581072
581145
|
if (!tokenPath)
|
|
@@ -585891,7 +585964,7 @@ import { createHash as createHash31, createHmac as createHmac4, randomBytes as r
|
|
|
585891
585964
|
import {
|
|
585892
585965
|
appendFileSync as appendFileSync27,
|
|
585893
585966
|
chmodSync as chmodSync6,
|
|
585894
|
-
existsSync as
|
|
585967
|
+
existsSync as existsSync122,
|
|
585895
585968
|
mkdirSync as mkdirSync96,
|
|
585896
585969
|
readFileSync as readFileSync113,
|
|
585897
585970
|
rmSync as rmSync18,
|
|
@@ -585918,14 +585991,14 @@ class AuditLog {
|
|
|
585918
585991
|
this.path = path;
|
|
585919
585992
|
this.clock = clock;
|
|
585920
585993
|
ensurePrivateDir(dirname79(path));
|
|
585921
|
-
if (
|
|
585994
|
+
if (existsSync122(saltPath)) {
|
|
585922
585995
|
this.salt = readFileSync113(saltPath);
|
|
585923
585996
|
} else {
|
|
585924
585997
|
this.salt = randomBytes15(32);
|
|
585925
585998
|
writeFileSync69(saltPath, this.salt, { mode: 384 });
|
|
585926
585999
|
chmodSync6(saltPath, 384);
|
|
585927
586000
|
}
|
|
585928
|
-
if (
|
|
586001
|
+
if (existsSync122(path)) {
|
|
585929
586002
|
const dropped = repairTornTail(path);
|
|
585930
586003
|
if (dropped > 0)
|
|
585931
586004
|
onRepair(dropped);
|
|
@@ -585983,7 +586056,7 @@ function repairTornTail(path) {
|
|
|
585983
586056
|
return buf.length - cut;
|
|
585984
586057
|
}
|
|
585985
586058
|
function verifyAudit(path) {
|
|
585986
|
-
if (!
|
|
586059
|
+
if (!existsSync122(path))
|
|
585987
586060
|
return { ok: true, count: 0, lastHash: GENESIS };
|
|
585988
586061
|
const lines = readFileSync113(path, "utf8").split(`
|
|
585989
586062
|
`).filter(Boolean);
|
|
@@ -586018,7 +586091,7 @@ import { createCipheriv as createCipheriv2, createDecipheriv as createDecipheriv
|
|
|
586018
586091
|
import {
|
|
586019
586092
|
chmodSync as chmodSync7,
|
|
586020
586093
|
closeSync as closeSync24,
|
|
586021
|
-
existsSync as
|
|
586094
|
+
existsSync as existsSync123,
|
|
586022
586095
|
fsyncSync as fsyncSync4,
|
|
586023
586096
|
openSync as openSync24,
|
|
586024
586097
|
readFileSync as readFileSync114,
|
|
@@ -586061,7 +586134,7 @@ class MemoryVault {
|
|
|
586061
586134
|
throw new Error("vault: no encryption key available");
|
|
586062
586135
|
ensurePrivateDir(dir);
|
|
586063
586136
|
const file = join181(dir, "memory.db.enc");
|
|
586064
|
-
const db =
|
|
586137
|
+
const db = existsSync123(file) ? Database11.deserialize(unseal(readFileSync114(file), key)) : new Database11(":memory:");
|
|
586065
586138
|
db.exec("PRAGMA secure_delete = ON");
|
|
586066
586139
|
const vault = new MemoryVault(dir, new MemoryStore(db), key);
|
|
586067
586140
|
vault.persist();
|
|
@@ -586167,7 +586240,7 @@ function validateTenant(memory, scope) {
|
|
|
586167
586240
|
|
|
586168
586241
|
// packages/memory/telegram-memory.ts
|
|
586169
586242
|
import { randomInt, timingSafeEqual as timingSafeEqual8 } from "crypto";
|
|
586170
|
-
import { chmodSync as chmodSync8, existsSync as
|
|
586243
|
+
import { chmodSync as chmodSync8, existsSync as existsSync124, readFileSync as readFileSync115, statSync as statSync37, unlinkSync as unlinkSync8, writeFileSync as writeFileSync70 } from "fs";
|
|
586171
586244
|
import { join as join182 } from "path";
|
|
586172
586245
|
function parseMatrix(raw) {
|
|
586173
586246
|
try {
|
|
@@ -586243,7 +586316,7 @@ class TelegramMemory {
|
|
|
586243
586316
|
return v === "1" || v === "true" || v === "yes";
|
|
586244
586317
|
}
|
|
586245
586318
|
isDisabled() {
|
|
586246
|
-
return this.disabledByEnv() ||
|
|
586319
|
+
return this.disabledByEnv() || existsSync124(this.flagFile);
|
|
586247
586320
|
}
|
|
586248
586321
|
isOperator(fromId) {
|
|
586249
586322
|
return typeof fromId === "number" && splitIds(this.env.TELEGRAM_OPERATOR_USER_IDS).includes(String(fromId));
|
|
@@ -586432,7 +586505,7 @@ class TelegramMemory {
|
|
|
586432
586505
|
const uid = String(ctx.fromId);
|
|
586433
586506
|
const chat = String(ctx.chatId);
|
|
586434
586507
|
const listed = splitIds(this.env.TELEGRAM_MEMORY_CHAT_IDS).includes(chat);
|
|
586435
|
-
const hasState =
|
|
586508
|
+
const hasState = existsSync124(this.opts.dir);
|
|
586436
586509
|
if (!listed && !hasState) {
|
|
586437
586510
|
return "Memory is not enabled for this chat and nothing is stored, so there is nothing to change or erase.";
|
|
586438
586511
|
}
|
|
@@ -586448,7 +586521,7 @@ class TelegramMemory {
|
|
|
586448
586521
|
if (this.disabledByEnv()) {
|
|
586449
586522
|
return "Memory is disabled by TELEGRAM_MEMORY_DISABLED in the bot environment. /memon cannot override it.";
|
|
586450
586523
|
}
|
|
586451
|
-
if (
|
|
586524
|
+
if (existsSync124(this.flagFile))
|
|
586452
586525
|
unlinkSync8(this.flagFile);
|
|
586453
586526
|
this.auditEvent(uid, chat, "memon", "0", {}, "ok");
|
|
586454
586527
|
return "Memory is on.";
|
|
@@ -586456,7 +586529,7 @@ class TelegramMemory {
|
|
|
586456
586529
|
const now = this.clock();
|
|
586457
586530
|
const given = arg.trim();
|
|
586458
586531
|
if (!given) {
|
|
586459
|
-
if (!
|
|
586532
|
+
if (!existsSync124(join182(this.opts.dir, "memory.db.enc"))) {
|
|
586460
586533
|
return "Nothing is stored, so there is nothing to erase.";
|
|
586461
586534
|
}
|
|
586462
586535
|
const code = String(randomInt(1e5, 1e6));
|
|
@@ -587008,7 +587081,7 @@ function truncate2(text, max) {
|
|
|
587008
587081
|
var MAX_MOBILE_LEN = 1800, MAX_CHUNK_LEN = 3800;
|
|
587009
587082
|
|
|
587010
587083
|
// packages/telegram-bot/file-sender.ts
|
|
587011
|
-
import { existsSync as
|
|
587084
|
+
import { existsSync as existsSync125, statSync as statSync38 } from "fs";
|
|
587012
587085
|
import { basename as basename53 } from "path";
|
|
587013
587086
|
|
|
587014
587087
|
class FileSender {
|
|
@@ -587092,7 +587165,7 @@ class FileSender {
|
|
|
587092
587165
|
if (attachment.buffer)
|
|
587093
587166
|
return attachment.buffer;
|
|
587094
587167
|
if (attachment.path) {
|
|
587095
|
-
if (!
|
|
587168
|
+
if (!existsSync125(attachment.path))
|
|
587096
587169
|
return null;
|
|
587097
587170
|
return await Bun.file(attachment.path).bytes().then((b) => Buffer.from(b));
|
|
587098
587171
|
}
|
|
@@ -587121,7 +587194,7 @@ var init_file_sender = __esm(() => {
|
|
|
587121
587194
|
});
|
|
587122
587195
|
|
|
587123
587196
|
// packages/telegram-bot/session-store.ts
|
|
587124
|
-
import { existsSync as
|
|
587197
|
+
import { existsSync as existsSync126, mkdirSync as mkdirSync97, readFileSync as readFileSync116, writeFileSync as writeFileSync71 } from "fs";
|
|
587125
587198
|
import { dirname as dirname82 } from "path";
|
|
587126
587199
|
|
|
587127
587200
|
class SessionStore2 {
|
|
@@ -587215,7 +587288,7 @@ class SessionStore2 {
|
|
|
587215
587288
|
if (!this.persistPath)
|
|
587216
587289
|
return;
|
|
587217
587290
|
try {
|
|
587218
|
-
if (!
|
|
587291
|
+
if (!existsSync126(this.persistPath))
|
|
587219
587292
|
return;
|
|
587220
587293
|
const raw = readFileSync116(this.persistPath, "utf-8");
|
|
587221
587294
|
const parsed = JSON.parse(raw);
|
|
@@ -588217,11 +588290,11 @@ var init_flow_bot = __esm(() => {
|
|
|
588217
588290
|
// packages/telegram-bot/voice-mode.ts
|
|
588218
588291
|
import { spawn as spawn27 } from "child_process";
|
|
588219
588292
|
import { createHash as createHash32 } from "crypto";
|
|
588220
|
-
import { existsSync as
|
|
588293
|
+
import { existsSync as existsSync127, mkdirSync as mkdirSync98, readFileSync as readFileSync117, writeFileSync as writeFileSync72 } from "fs";
|
|
588221
588294
|
import { homedir as homedir94 } from "os";
|
|
588222
588295
|
import { dirname as dirname83, join as join187 } from "path";
|
|
588223
588296
|
function readVoiceState(path = VOICE_STATE_PATH) {
|
|
588224
|
-
if (!
|
|
588297
|
+
if (!existsSync127(path))
|
|
588225
588298
|
return { ...DEFAULT_STATE };
|
|
588226
588299
|
try {
|
|
588227
588300
|
const parsed = JSON.parse(readFileSync117(path, "utf-8"));
|
|
@@ -588291,7 +588364,7 @@ function decideVoice(markdown, opts) {
|
|
|
588291
588364
|
}
|
|
588292
588365
|
async function sendVoiceNote(opts) {
|
|
588293
588366
|
const bin = opts.bin ?? KITTENTTS_BIN;
|
|
588294
|
-
if (!
|
|
588367
|
+
if (!existsSync127(bin))
|
|
588295
588368
|
return { sent: false, reason: "kittentts-telegram not installed" };
|
|
588296
588369
|
const args = ["--voice", opts.voice];
|
|
588297
588370
|
if (opts.explicitChat !== undefined) {
|
|
@@ -588332,7 +588405,7 @@ async function sendVoiceNote(opts) {
|
|
|
588332
588405
|
});
|
|
588333
588406
|
}
|
|
588334
588407
|
function readConfiguredChatId(envPath = join187(homedir94(), ".claude", ".env")) {
|
|
588335
|
-
if (!
|
|
588408
|
+
if (!existsSync127(envPath))
|
|
588336
588409
|
return null;
|
|
588337
588410
|
try {
|
|
588338
588411
|
for (const line of readFileSync117(envPath, "utf-8").split(`
|
|
@@ -588389,11 +588462,11 @@ var init_types9 = __esm(() => {
|
|
|
588389
588462
|
});
|
|
588390
588463
|
|
|
588391
588464
|
// packages/voice/model-manager.ts
|
|
588392
|
-
import { existsSync as
|
|
588465
|
+
import { existsSync as existsSync128, mkdirSync as mkdirSync99, realpathSync as realpathSync37, unlinkSync as unlinkSync9 } from "fs";
|
|
588393
588466
|
import { homedir as homedir95 } from "os";
|
|
588394
588467
|
import { join as join188, sep as sep31 } from "path";
|
|
588395
588468
|
function resolveWhisperModel(opts = {}) {
|
|
588396
|
-
const exists = opts.exists ??
|
|
588469
|
+
const exists = opts.exists ?? existsSync128;
|
|
588397
588470
|
const dirs = [
|
|
588398
588471
|
resolveModelsPath(opts.modelsDir ?? "~/.8gent/models/whisper"),
|
|
588399
588472
|
...opts.extraDirs ?? []
|
|
@@ -588597,21 +588670,21 @@ var init_voice_ack = __esm(() => {
|
|
|
588597
588670
|
});
|
|
588598
588671
|
|
|
588599
588672
|
// packages/daemon/task-registry.ts
|
|
588600
|
-
import { existsSync as
|
|
588673
|
+
import { existsSync as existsSync129, mkdirSync as mkdirSync100, readFileSync as readFileSync118, writeFileSync as writeFileSync73 } from "fs";
|
|
588601
588674
|
import { join as join189 } from "path";
|
|
588602
588675
|
function tasksPath() {
|
|
588603
588676
|
return join189(getDataDir(), "tasks.json");
|
|
588604
588677
|
}
|
|
588605
588678
|
function ensureDir8() {
|
|
588606
588679
|
const dir = getDataDir();
|
|
588607
|
-
if (!
|
|
588680
|
+
if (!existsSync129(dir))
|
|
588608
588681
|
mkdirSync100(dir, { recursive: true });
|
|
588609
588682
|
}
|
|
588610
588683
|
function load3() {
|
|
588611
588684
|
if (loaded)
|
|
588612
588685
|
return;
|
|
588613
588686
|
try {
|
|
588614
|
-
if (
|
|
588687
|
+
if (existsSync129(tasksPath())) {
|
|
588615
588688
|
tasks = JSON.parse(readFileSync118(tasksPath(), "utf-8"));
|
|
588616
588689
|
}
|
|
588617
588690
|
} catch {
|
|
@@ -588677,7 +588750,7 @@ var init_task_registry = __esm(() => {
|
|
|
588677
588750
|
|
|
588678
588751
|
// packages/daemon/cos-router.ts
|
|
588679
588752
|
import { execSync as execSync5 } from "child_process";
|
|
588680
|
-
import { existsSync as
|
|
588753
|
+
import { existsSync as existsSync130, readFileSync as readFileSync119, writeFileSync as writeFileSync74 } from "fs";
|
|
588681
588754
|
import { join as join190 } from "path";
|
|
588682
588755
|
function goalsPath() {
|
|
588683
588756
|
return join190(getDataDir(), "goals.json");
|
|
@@ -588761,7 +588834,7 @@ Priority: ${priority}`);
|
|
|
588761
588834
|
const repoPath = join190(cosWorkspace(), repo);
|
|
588762
588835
|
let issueUrl = "";
|
|
588763
588836
|
let issueNumber = 0;
|
|
588764
|
-
if (
|
|
588837
|
+
if (existsSync130(repoPath)) {
|
|
588765
588838
|
try {
|
|
588766
588839
|
const result = execSync5(`cd "${repoPath}" && gh issue create --title "${description.replace(/"/g, "\\\"")}" --body "Delegated by CEO via Telegram.
|
|
588767
588840
|
|
|
@@ -588957,7 +589030,7 @@ Total: ${goals.length} objectives`);
|
|
|
588957
589030
|
}
|
|
588958
589031
|
loadGoals() {
|
|
588959
589032
|
try {
|
|
588960
|
-
if (
|
|
589033
|
+
if (existsSync130(goalsPath())) {
|
|
588961
589034
|
return JSON.parse(readFileSync119(goalsPath(), "utf-8"));
|
|
588962
589035
|
}
|
|
588963
589036
|
} catch {}
|
|
@@ -588979,7 +589052,7 @@ import { createHash as createHash33 } from "crypto";
|
|
|
588979
589052
|
import {
|
|
588980
589053
|
appendFileSync as appendFileSync28,
|
|
588981
589054
|
chmodSync as chmodSync9,
|
|
588982
|
-
existsSync as
|
|
589055
|
+
existsSync as existsSync131,
|
|
588983
589056
|
mkdirSync as mkdirSync101,
|
|
588984
589057
|
readFileSync as readFileSync120,
|
|
588985
589058
|
statSync as statSync39,
|
|
@@ -589003,7 +589076,7 @@ function observeUnauthorized(update) {
|
|
|
589003
589076
|
} catch {
|
|
589004
589077
|
mkdirSync101(dirname84(OBSERVED_LOG), { recursive: true, mode: 448 });
|
|
589005
589078
|
}
|
|
589006
|
-
if (!
|
|
589079
|
+
if (!existsSync131(OBSERVED_LOG))
|
|
589007
589080
|
writeFileSync75(OBSERVED_LOG, "", { mode: 384 });
|
|
589008
589081
|
chmodSync9(OBSERVED_LOG, 384);
|
|
589009
589082
|
appendFileSync28(OBSERVED_LOG, `${JSON.stringify({
|
|
@@ -589156,7 +589229,7 @@ async function transcribeVoice(token, fileId) {
|
|
|
589156
589229
|
try {
|
|
589157
589230
|
writeFileSync75(ogg, Buffer.from(audioBuffer));
|
|
589158
589231
|
const conv = await runAsync("ffmpeg", ["-y", "-i", ogg, "-ar", "16000", "-ac", "1", wav], 30000);
|
|
589159
|
-
if (conv.status !== 0 || !
|
|
589232
|
+
if (conv.status !== 0 || !existsSync131(wav)) {
|
|
589160
589233
|
console.error(subprocessFailure("ffmpeg", conv.status, conv.stderr));
|
|
589161
589234
|
return "[voice message received - could not decode the audio]";
|
|
589162
589235
|
}
|
|
@@ -589173,7 +589246,7 @@ async function transcribeVoice(token, fileId) {
|
|
|
589173
589246
|
} finally {
|
|
589174
589247
|
for (const f of [ogg, wav]) {
|
|
589175
589248
|
try {
|
|
589176
|
-
if (
|
|
589249
|
+
if (existsSync131(f))
|
|
589177
589250
|
unlinkSync10(f);
|
|
589178
589251
|
} catch {}
|
|
589179
589252
|
}
|
|
@@ -589803,7 +589876,7 @@ What do we work on next?`);
|
|
|
589803
589876
|
try {
|
|
589804
589877
|
const path = this.config.observeLogPath ?? OBSERVED_LOG;
|
|
589805
589878
|
mkdirSync101(dirname84(path), { recursive: true, mode: 448 });
|
|
589806
|
-
if (!
|
|
589879
|
+
if (!existsSync131(path))
|
|
589807
589880
|
writeFileSync75(path, "", { mode: 384 });
|
|
589808
589881
|
chmodSync9(path, 384);
|
|
589809
589882
|
appendFileSync28(path, `${JSON.stringify({
|
|
@@ -590857,7 +590930,7 @@ var init_telegram_bridge = __esm(() => {
|
|
|
590857
590930
|
});
|
|
590858
590931
|
|
|
590859
590932
|
// packages/daemon/index.ts
|
|
590860
|
-
import { appendFileSync as appendFileSync29, existsSync as
|
|
590933
|
+
import { appendFileSync as appendFileSync29, existsSync as existsSync132, mkdirSync as mkdirSync102 } from "fs";
|
|
590861
590934
|
async function loadConfig2() {
|
|
590862
590935
|
const defaults = {
|
|
590863
590936
|
port: PORT,
|
|
@@ -590882,7 +590955,7 @@ async function loadConfig2() {
|
|
|
590882
590955
|
}
|
|
590883
590956
|
}
|
|
590884
590957
|
function setupLogging() {
|
|
590885
|
-
if (!
|
|
590958
|
+
if (!existsSync132(DATA_DIR5)) {
|
|
590886
590959
|
mkdirSync102(DATA_DIR5, { recursive: true });
|
|
590887
590960
|
}
|
|
590888
590961
|
const events = [
|
|
@@ -591186,7 +591259,7 @@ var init_daemon = __esm(() => {
|
|
|
591186
591259
|
});
|
|
591187
591260
|
|
|
591188
591261
|
// packages/daemon/service.ts
|
|
591189
|
-
import { existsSync as
|
|
591262
|
+
import { existsSync as existsSync133, mkdirSync as mkdirSync103, rmSync as rmSync19, writeFileSync as writeFileSync76 } from "fs";
|
|
591190
591263
|
import * as os65 from "os";
|
|
591191
591264
|
import * as path139 from "path";
|
|
591192
591265
|
function paths(ctx) {
|
|
@@ -591345,7 +591418,7 @@ async function serviceStatus(ctx) {
|
|
|
591345
591418
|
const query = backend.statusQuery(ctx);
|
|
591346
591419
|
const res = await exec4(query.kind === "powershell" ? powershellArgv(query.script) : query.argv);
|
|
591347
591420
|
const definition = backend.definitionPath(ctx);
|
|
591348
|
-
return backend.parseStatus(res, definition !== null &&
|
|
591421
|
+
return backend.parseStatus(res, definition !== null && existsSync133(definition));
|
|
591349
591422
|
}
|
|
591350
591423
|
async function runOperation(op, ctx, log = console.log) {
|
|
591351
591424
|
if (op !== "uninstall") {
|
|
@@ -592310,9 +592383,9 @@ var init_install = __esm(() => {
|
|
|
592310
592383
|
// packages/eight/self-update.ts
|
|
592311
592384
|
import { spawn as spawn29 } from "child_process";
|
|
592312
592385
|
import { createHash as createHash36, createPublicKey as createPublicKey2, verify as cryptoVerify, randomBytes as randomBytes18 } from "crypto";
|
|
592313
|
-
import { chmodSync as chmodSync10, existsSync as
|
|
592386
|
+
import { chmodSync as chmodSync10, existsSync as existsSync137, mkdtempSync as mkdtempSync12, renameSync as renameSync19, rmSync as rmSync21, writeFileSync as writeFileSync81 } from "fs";
|
|
592314
592387
|
import { tmpdir as tmpdir20 } from "os";
|
|
592315
|
-
import { join as join195, resolve as
|
|
592388
|
+
import { join as join195, resolve as resolve77 } from "path";
|
|
592316
592389
|
import { fileURLToPath as fileURLToPath6 } from "url";
|
|
592317
592390
|
function parseVersion(v) {
|
|
592318
592391
|
const m = /^v?(\d+)\.(\d+)\.(\d+)$/.exec(v.trim());
|
|
@@ -592344,7 +592417,7 @@ function detectChannel(p) {
|
|
|
592344
592417
|
return "binary";
|
|
592345
592418
|
if (/[\\/]node_modules[\\/]/.test(p.modulePath))
|
|
592346
592419
|
return "npm";
|
|
592347
|
-
const hasGit = p.isGitCheckout ?? ((dir) =>
|
|
592420
|
+
const hasGit = p.isGitCheckout ?? ((dir) => existsSync137(`${dir}/.git`));
|
|
592348
592421
|
const parts = p.modulePath.replace(/^file:\/\//, "").split(/[\\/]/);
|
|
592349
592422
|
for (let i = parts.length - 1;i > 0; i--) {
|
|
592350
592423
|
if (hasGit(parts.slice(0, i).join("/") || "/"))
|
|
@@ -592650,13 +592723,13 @@ function swapInto(staged, target, platform) {
|
|
|
592650
592723
|
} catch {
|
|
592651
592724
|
old = `${target}.old-${randomBytes18(4).toString("hex")}`;
|
|
592652
592725
|
}
|
|
592653
|
-
const hadTarget =
|
|
592726
|
+
const hadTarget = existsSync137(target);
|
|
592654
592727
|
if (hadTarget)
|
|
592655
592728
|
renameSync19(target, old);
|
|
592656
592729
|
try {
|
|
592657
592730
|
renameSync19(staged, target);
|
|
592658
592731
|
} catch (err) {
|
|
592659
|
-
if (hadTarget && !
|
|
592732
|
+
if (hadTarget && !existsSync137(target))
|
|
592660
592733
|
renameSync19(old, target);
|
|
592661
592734
|
throw err;
|
|
592662
592735
|
}
|
|
@@ -592694,7 +592767,7 @@ async function updateNpmFromRelease(o, rel, platform) {
|
|
|
592694
592767
|
if (actual !== expected)
|
|
592695
592768
|
return `checksum mismatch for ${name} (expected ${expected}, got ${actual}); nothing changed`;
|
|
592696
592769
|
o.log(`SHA256 matches SHA256SUMS: ${actual}`);
|
|
592697
|
-
const dir = mkdtempSync12(join195(
|
|
592770
|
+
const dir = mkdtempSync12(join195(resolve77(o.tmpDir ?? tmpdir20()), "8gent-update-"));
|
|
592698
592771
|
try {
|
|
592699
592772
|
const file = join195(dir, name);
|
|
592700
592773
|
writeFileSync81(file, bytes, { flag: "wx", mode: 384 });
|
|
@@ -592854,7 +592927,7 @@ var init_changelog_view = __esm(() => {
|
|
|
592854
592927
|
|
|
592855
592928
|
// packages/eight/source-update.ts
|
|
592856
592929
|
import { execFile as execFile6 } from "child_process";
|
|
592857
|
-
import { existsSync as
|
|
592930
|
+
import { existsSync as existsSync138, realpathSync as realpathSync39, statSync as statSync41 } from "fs";
|
|
592858
592931
|
import { homedir as homedir97 } from "os";
|
|
592859
592932
|
import * as nodePath from "path";
|
|
592860
592933
|
function scrubbedEnv2(base) {
|
|
@@ -592953,7 +593026,7 @@ function modulePathToFs(modulePath) {
|
|
|
592953
593026
|
}
|
|
592954
593027
|
return s;
|
|
592955
593028
|
}
|
|
592956
|
-
function findCheckoutRoot(modulePath, platform, hasGit = (d) =>
|
|
593029
|
+
function findCheckoutRoot(modulePath, platform, hasGit = (d) => existsSync138(lib(platform).join(d, ".git"))) {
|
|
592957
593030
|
const p = lib(platform);
|
|
592958
593031
|
const fsPath = modulePathToFs(modulePath);
|
|
592959
593032
|
let dir = p.dirname(platform === "win32" ? fsPath.replace(/\//g, "\\") : fsPath);
|
|
@@ -592969,7 +593042,7 @@ function findCheckoutRoot(modulePath, platform, hasGit = (d) => existsSync137(li
|
|
|
592969
593042
|
}
|
|
592970
593043
|
function findBrowserCheckout(o) {
|
|
592971
593044
|
const p = lib(o.platform);
|
|
592972
|
-
const hasGit = o.hasGit ?? ((d) =>
|
|
593045
|
+
const hasGit = o.hasGit ?? ((d) => existsSync138(p.join(d, ".git")));
|
|
592973
593046
|
const looked = [];
|
|
592974
593047
|
let note;
|
|
592975
593048
|
const cands = [];
|
|
@@ -593272,7 +593345,7 @@ async function runSourceUpdate(deps, opts, report) {
|
|
|
593272
593345
|
git,
|
|
593273
593346
|
bun: bun ?? "bun",
|
|
593274
593347
|
platform,
|
|
593275
|
-
fileExists: deps.fileExists ?? ((f) =>
|
|
593348
|
+
fileExists: deps.fileExists ?? ((f) => existsSync138(f)),
|
|
593276
593349
|
now: deps.now ?? (() => new Date),
|
|
593277
593350
|
baseEnv: env,
|
|
593278
593351
|
forgeHost: env.EIGHT_FORGE_HOST,
|
|
@@ -597636,7 +597709,7 @@ function nodeExecPath(execPath = process.execPath, env = process.env, exists = e
|
|
|
597636
597709
|
|
|
597637
597710
|
// bin/8gent.ts
|
|
597638
597711
|
refuseIfNested();
|
|
597639
|
-
var VERSION5 = "0.20.
|
|
597712
|
+
var VERSION5 = "0.20.16";
|
|
597640
597713
|
var RELAUNCH_EXIT_CODE = 75;
|
|
597641
597714
|
var MODULE_DIR = path158.dirname(fileURLToPath7(import.meta.url));
|
|
597642
597715
|
var EXEC_DIR = path158.dirname(process.execPath);
|