chat-recall 0.7.29 → 0.7.31
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/README.md +0 -2
- package/dist/board-hooks.d.ts +7 -0
- package/dist/board-hooks.d.ts.map +1 -1
- package/dist/board-hooks.js +9 -3
- package/dist/board-hooks.js.map +1 -1
- package/dist/cli.js +3231 -2928
- package/dist/cli.js.map +1 -1
- package/dist/install-hooks.d.ts +3 -3
- package/dist/install-hooks.d.ts.map +1 -1
- package/dist/install-hooks.js +40 -14
- package/dist/install-hooks.js.map +1 -1
- package/dist/mcp-relay.js +1 -1
- package/dist/mcp.js +430 -149
- package/dist/message-hook.js +1 -1
- package/dist/watch.js +5 -6
- package/package.json +1 -1
- package/hooks/chat_recall_save_hook.sh +0 -260
package/dist/mcp.js
CHANGED
|
@@ -2034,7 +2034,7 @@ var require_thread_stream = __commonJS({
|
|
|
2034
2034
|
var { version: version2 } = require_package();
|
|
2035
2035
|
var { EventEmitter } = __require("events");
|
|
2036
2036
|
var { Worker: Worker2 } = __require("worker_threads");
|
|
2037
|
-
var { join:
|
|
2037
|
+
var { join: join65 } = __require("path");
|
|
2038
2038
|
var { pathToFileURL } = __require("url");
|
|
2039
2039
|
var { wait } = require_wait();
|
|
2040
2040
|
var {
|
|
@@ -2077,7 +2077,7 @@ var require_thread_stream = __commonJS({
|
|
|
2077
2077
|
function createWorker(stream, opts) {
|
|
2078
2078
|
const { filename, workerData } = opts;
|
|
2079
2079
|
const bundlerOverrides = "__bundlerPathsOverrides" in globalThis ? globalThis.__bundlerPathsOverrides : {};
|
|
2080
|
-
const toExecute = bundlerOverrides["thread-stream-worker"] ||
|
|
2080
|
+
const toExecute = bundlerOverrides["thread-stream-worker"] || join65(__dirname, "lib", "worker.js");
|
|
2081
2081
|
const worker = new Worker2(toExecute, {
|
|
2082
2082
|
...opts.workerOpts,
|
|
2083
2083
|
trackUnmanagedFds: false,
|
|
@@ -2480,7 +2480,7 @@ var require_transport = __commonJS({
|
|
|
2480
2480
|
"use strict";
|
|
2481
2481
|
var { createRequire: createRequire3 } = __require("module");
|
|
2482
2482
|
var getCallers = require_caller();
|
|
2483
|
-
var { join:
|
|
2483
|
+
var { join: join65, isAbsolute: isAbsolute4, sep: sep5 } = __require("node:path");
|
|
2484
2484
|
var sleep = require_atomic_sleep();
|
|
2485
2485
|
var onExit = require_on_exit_leak_free();
|
|
2486
2486
|
var ThreadStream = require_thread_stream();
|
|
@@ -2543,7 +2543,7 @@ var require_transport = __commonJS({
|
|
|
2543
2543
|
throw new Error("only one of target or targets can be specified");
|
|
2544
2544
|
}
|
|
2545
2545
|
if (targets) {
|
|
2546
|
-
target = bundlerOverrides["pino-worker"] ||
|
|
2546
|
+
target = bundlerOverrides["pino-worker"] || join65(__dirname, "worker.js");
|
|
2547
2547
|
options.targets = targets.filter((dest) => dest.target).map((dest) => {
|
|
2548
2548
|
return {
|
|
2549
2549
|
...dest,
|
|
@@ -2561,7 +2561,7 @@ var require_transport = __commonJS({
|
|
|
2561
2561
|
});
|
|
2562
2562
|
});
|
|
2563
2563
|
} else if (pipeline) {
|
|
2564
|
-
target = bundlerOverrides["pino-worker"] ||
|
|
2564
|
+
target = bundlerOverrides["pino-worker"] || join65(__dirname, "worker.js");
|
|
2565
2565
|
options.pipelines = [pipeline.map((dest) => {
|
|
2566
2566
|
return {
|
|
2567
2567
|
...dest,
|
|
@@ -2583,12 +2583,12 @@ var require_transport = __commonJS({
|
|
|
2583
2583
|
return origin;
|
|
2584
2584
|
}
|
|
2585
2585
|
if (origin === "pino/file") {
|
|
2586
|
-
return
|
|
2586
|
+
return join65(__dirname, "..", "file.js");
|
|
2587
2587
|
}
|
|
2588
2588
|
let fixTarget2;
|
|
2589
2589
|
for (const filePath of callers) {
|
|
2590
2590
|
try {
|
|
2591
|
-
const context = filePath === "node:repl" ? process.cwd() +
|
|
2591
|
+
const context = filePath === "node:repl" ? process.cwd() + sep5 : filePath;
|
|
2592
2592
|
fixTarget2 = createRequire3(context).resolve(origin);
|
|
2593
2593
|
break;
|
|
2594
2594
|
} catch (err) {
|
|
@@ -3572,7 +3572,7 @@ var require_safe_stable_stringify = __commonJS({
|
|
|
3572
3572
|
return circularValue;
|
|
3573
3573
|
}
|
|
3574
3574
|
let res = "";
|
|
3575
|
-
let
|
|
3575
|
+
let join65 = ",";
|
|
3576
3576
|
const originalIndentation = indentation;
|
|
3577
3577
|
if (Array.isArray(value)) {
|
|
3578
3578
|
if (value.length === 0) {
|
|
@@ -3586,7 +3586,7 @@ var require_safe_stable_stringify = __commonJS({
|
|
|
3586
3586
|
indentation += spacer;
|
|
3587
3587
|
res += `
|
|
3588
3588
|
${indentation}`;
|
|
3589
|
-
|
|
3589
|
+
join65 = `,
|
|
3590
3590
|
${indentation}`;
|
|
3591
3591
|
}
|
|
3592
3592
|
const maximumValuesToStringify = Math.min(value.length, maximumBreadth);
|
|
@@ -3594,13 +3594,13 @@ ${indentation}`;
|
|
|
3594
3594
|
for (; i < maximumValuesToStringify - 1; i++) {
|
|
3595
3595
|
const tmp2 = stringifyFnReplacer(String(i), value, stack, replacer, spacer, indentation);
|
|
3596
3596
|
res += tmp2 !== void 0 ? tmp2 : "null";
|
|
3597
|
-
res +=
|
|
3597
|
+
res += join65;
|
|
3598
3598
|
}
|
|
3599
3599
|
const tmp = stringifyFnReplacer(String(i), value, stack, replacer, spacer, indentation);
|
|
3600
3600
|
res += tmp !== void 0 ? tmp : "null";
|
|
3601
3601
|
if (value.length - 1 > maximumBreadth) {
|
|
3602
3602
|
const removedKeys = value.length - maximumBreadth - 1;
|
|
3603
|
-
res += `${
|
|
3603
|
+
res += `${join65}"... ${getItemCount(removedKeys)} not stringified"`;
|
|
3604
3604
|
}
|
|
3605
3605
|
if (spacer !== "") {
|
|
3606
3606
|
res += `
|
|
@@ -3621,7 +3621,7 @@ ${originalIndentation}`;
|
|
|
3621
3621
|
let separator = "";
|
|
3622
3622
|
if (spacer !== "") {
|
|
3623
3623
|
indentation += spacer;
|
|
3624
|
-
|
|
3624
|
+
join65 = `,
|
|
3625
3625
|
${indentation}`;
|
|
3626
3626
|
whitespace = " ";
|
|
3627
3627
|
}
|
|
@@ -3635,13 +3635,13 @@ ${indentation}`;
|
|
|
3635
3635
|
const tmp = stringifyFnReplacer(key3, value, stack, replacer, spacer, indentation);
|
|
3636
3636
|
if (tmp !== void 0) {
|
|
3637
3637
|
res += `${separator}${strEscape(key3)}:${whitespace}${tmp}`;
|
|
3638
|
-
separator =
|
|
3638
|
+
separator = join65;
|
|
3639
3639
|
}
|
|
3640
3640
|
}
|
|
3641
3641
|
if (keyLength > maximumBreadth) {
|
|
3642
3642
|
const removedKeys = keyLength - maximumBreadth;
|
|
3643
3643
|
res += `${separator}"...":${whitespace}"${getItemCount(removedKeys)} not stringified"`;
|
|
3644
|
-
separator =
|
|
3644
|
+
separator = join65;
|
|
3645
3645
|
}
|
|
3646
3646
|
if (spacer !== "" && separator.length > 1) {
|
|
3647
3647
|
res = `
|
|
@@ -3682,7 +3682,7 @@ ${originalIndentation}`;
|
|
|
3682
3682
|
}
|
|
3683
3683
|
const originalIndentation = indentation;
|
|
3684
3684
|
let res = "";
|
|
3685
|
-
let
|
|
3685
|
+
let join65 = ",";
|
|
3686
3686
|
if (Array.isArray(value)) {
|
|
3687
3687
|
if (value.length === 0) {
|
|
3688
3688
|
return "[]";
|
|
@@ -3695,7 +3695,7 @@ ${originalIndentation}`;
|
|
|
3695
3695
|
indentation += spacer;
|
|
3696
3696
|
res += `
|
|
3697
3697
|
${indentation}`;
|
|
3698
|
-
|
|
3698
|
+
join65 = `,
|
|
3699
3699
|
${indentation}`;
|
|
3700
3700
|
}
|
|
3701
3701
|
const maximumValuesToStringify = Math.min(value.length, maximumBreadth);
|
|
@@ -3703,13 +3703,13 @@ ${indentation}`;
|
|
|
3703
3703
|
for (; i < maximumValuesToStringify - 1; i++) {
|
|
3704
3704
|
const tmp2 = stringifyArrayReplacer(String(i), value[i], stack, replacer, spacer, indentation);
|
|
3705
3705
|
res += tmp2 !== void 0 ? tmp2 : "null";
|
|
3706
|
-
res +=
|
|
3706
|
+
res += join65;
|
|
3707
3707
|
}
|
|
3708
3708
|
const tmp = stringifyArrayReplacer(String(i), value[i], stack, replacer, spacer, indentation);
|
|
3709
3709
|
res += tmp !== void 0 ? tmp : "null";
|
|
3710
3710
|
if (value.length - 1 > maximumBreadth) {
|
|
3711
3711
|
const removedKeys = value.length - maximumBreadth - 1;
|
|
3712
|
-
res += `${
|
|
3712
|
+
res += `${join65}"... ${getItemCount(removedKeys)} not stringified"`;
|
|
3713
3713
|
}
|
|
3714
3714
|
if (spacer !== "") {
|
|
3715
3715
|
res += `
|
|
@@ -3722,7 +3722,7 @@ ${originalIndentation}`;
|
|
|
3722
3722
|
let whitespace = "";
|
|
3723
3723
|
if (spacer !== "") {
|
|
3724
3724
|
indentation += spacer;
|
|
3725
|
-
|
|
3725
|
+
join65 = `,
|
|
3726
3726
|
${indentation}`;
|
|
3727
3727
|
whitespace = " ";
|
|
3728
3728
|
}
|
|
@@ -3731,7 +3731,7 @@ ${indentation}`;
|
|
|
3731
3731
|
const tmp = stringifyArrayReplacer(key3, value[key3], stack, replacer, spacer, indentation);
|
|
3732
3732
|
if (tmp !== void 0) {
|
|
3733
3733
|
res += `${separator}${strEscape(key3)}:${whitespace}${tmp}`;
|
|
3734
|
-
separator =
|
|
3734
|
+
separator = join65;
|
|
3735
3735
|
}
|
|
3736
3736
|
}
|
|
3737
3737
|
if (spacer !== "" && separator.length > 1) {
|
|
@@ -3789,20 +3789,20 @@ ${originalIndentation}`;
|
|
|
3789
3789
|
indentation += spacer;
|
|
3790
3790
|
let res2 = `
|
|
3791
3791
|
${indentation}`;
|
|
3792
|
-
const
|
|
3792
|
+
const join66 = `,
|
|
3793
3793
|
${indentation}`;
|
|
3794
3794
|
const maximumValuesToStringify = Math.min(value.length, maximumBreadth);
|
|
3795
3795
|
let i = 0;
|
|
3796
3796
|
for (; i < maximumValuesToStringify - 1; i++) {
|
|
3797
3797
|
const tmp2 = stringifyIndent(String(i), value[i], stack, spacer, indentation);
|
|
3798
3798
|
res2 += tmp2 !== void 0 ? tmp2 : "null";
|
|
3799
|
-
res2 +=
|
|
3799
|
+
res2 += join66;
|
|
3800
3800
|
}
|
|
3801
3801
|
const tmp = stringifyIndent(String(i), value[i], stack, spacer, indentation);
|
|
3802
3802
|
res2 += tmp !== void 0 ? tmp : "null";
|
|
3803
3803
|
if (value.length - 1 > maximumBreadth) {
|
|
3804
3804
|
const removedKeys = value.length - maximumBreadth - 1;
|
|
3805
|
-
res2 += `${
|
|
3805
|
+
res2 += `${join66}"... ${getItemCount(removedKeys)} not stringified"`;
|
|
3806
3806
|
}
|
|
3807
3807
|
res2 += `
|
|
3808
3808
|
${originalIndentation}`;
|
|
@@ -3818,16 +3818,16 @@ ${originalIndentation}`;
|
|
|
3818
3818
|
return '"[Object]"';
|
|
3819
3819
|
}
|
|
3820
3820
|
indentation += spacer;
|
|
3821
|
-
const
|
|
3821
|
+
const join65 = `,
|
|
3822
3822
|
${indentation}`;
|
|
3823
3823
|
let res = "";
|
|
3824
3824
|
let separator = "";
|
|
3825
3825
|
let maximumPropertiesToStringify = Math.min(keyLength, maximumBreadth);
|
|
3826
3826
|
if (isTypedArrayWithEntries(value)) {
|
|
3827
|
-
res += stringifyTypedArray(value,
|
|
3827
|
+
res += stringifyTypedArray(value, join65, maximumBreadth);
|
|
3828
3828
|
keys = keys.slice(value.length);
|
|
3829
3829
|
maximumPropertiesToStringify -= value.length;
|
|
3830
|
-
separator =
|
|
3830
|
+
separator = join65;
|
|
3831
3831
|
}
|
|
3832
3832
|
if (deterministic) {
|
|
3833
3833
|
keys = sort(keys, comparator);
|
|
@@ -3838,13 +3838,13 @@ ${indentation}`;
|
|
|
3838
3838
|
const tmp = stringifyIndent(key3, value[key3], stack, spacer, indentation);
|
|
3839
3839
|
if (tmp !== void 0) {
|
|
3840
3840
|
res += `${separator}${strEscape(key3)}: ${tmp}`;
|
|
3841
|
-
separator =
|
|
3841
|
+
separator = join65;
|
|
3842
3842
|
}
|
|
3843
3843
|
}
|
|
3844
3844
|
if (keyLength > maximumBreadth) {
|
|
3845
3845
|
const removedKeys = keyLength - maximumBreadth;
|
|
3846
3846
|
res += `${separator}"...": "${getItemCount(removedKeys)} not stringified"`;
|
|
3847
|
-
separator =
|
|
3847
|
+
separator = join65;
|
|
3848
3848
|
}
|
|
3849
3849
|
if (separator !== "") {
|
|
3850
3850
|
res = `
|
|
@@ -4489,7 +4489,6 @@ function legacyMappings() {
|
|
|
4489
4489
|
return [
|
|
4490
4490
|
{ legacyPath: join4(root, "chat-recall-cache.db"), newPath: join4(newRoot, "cache.db"), isDir: false },
|
|
4491
4491
|
{ legacyPath: join4(root, "chat-recall-index"), newPath: join4(newRoot, "index"), isDir: true },
|
|
4492
|
-
{ legacyPath: join4(root, "chat-recall-memory"), newPath: join4(newRoot, "memory"), isDir: true },
|
|
4493
4492
|
{ legacyPath: join4(root, "chat-recall-identity.txt"), newPath: join4(newRoot, "identity.txt"), isDir: false },
|
|
4494
4493
|
{ legacyPath: join4(root, "chat-recall-hooks"), newPath: join4(newRoot, "hooks"), isDir: true },
|
|
4495
4494
|
// The legacy settings directory was named just "chat-recall" (no
|
|
@@ -13501,11 +13500,11 @@ async function archiveRawSession(store2, sessionId) {
|
|
|
13501
13500
|
return await store2.putRawSession(sessionId, exp.tool, Math.floor(exp.mtime), gz, size);
|
|
13502
13501
|
}
|
|
13503
13502
|
function detectForkPredecessor(sessionPath) {
|
|
13504
|
-
const { readFileSync:
|
|
13505
|
-
const { dirname: dirname22, join:
|
|
13503
|
+
const { readFileSync: readFileSync55, readdirSync: readdirSync37 } = requireFs();
|
|
13504
|
+
const { dirname: dirname22, join: join65, basename: basename26 } = requirePath();
|
|
13506
13505
|
let text;
|
|
13507
13506
|
try {
|
|
13508
|
-
text =
|
|
13507
|
+
text = readFileSync55(sessionPath, "utf-8");
|
|
13509
13508
|
} catch {
|
|
13510
13509
|
return null;
|
|
13511
13510
|
}
|
|
@@ -13539,7 +13538,7 @@ function detectForkPredecessor(sessionPath) {
|
|
|
13539
13538
|
if (!f.endsWith(".jsonl") || f === self || f === "sessions-index.json")
|
|
13540
13539
|
continue;
|
|
13541
13540
|
try {
|
|
13542
|
-
if (
|
|
13541
|
+
if (readFileSync55(join65(dir, f), "utf-8").includes(`"uuid":"${headParent}"`)) {
|
|
13543
13542
|
return basename26(f, ".jsonl");
|
|
13544
13543
|
}
|
|
13545
13544
|
} catch {
|
|
@@ -14079,10 +14078,10 @@ var init_types = __esm({
|
|
|
14079
14078
|
|
|
14080
14079
|
// ../engine/dist/transcript/opencode.js
|
|
14081
14080
|
async function parseOpenCodeSubagents(parentSessionId) {
|
|
14082
|
-
const { existsSync:
|
|
14081
|
+
const { existsSync: existsSync53 } = await import("fs");
|
|
14083
14082
|
const { opencodeBackend: opencodeBackend2 } = await Promise.resolve().then(() => (init_opencode(), opencode_exports));
|
|
14084
14083
|
const dbPath = opencodeBackend2.dbPath();
|
|
14085
|
-
if (!
|
|
14084
|
+
if (!existsSync53(dbPath))
|
|
14086
14085
|
return [];
|
|
14087
14086
|
const realParent = parentSessionId.replace("opencode_", "");
|
|
14088
14087
|
const db = openOpencodeDbOrThrow(dbPath);
|
|
@@ -14123,10 +14122,10 @@ async function parseOpenCodeSubagents(parentSessionId) {
|
|
|
14123
14122
|
}
|
|
14124
14123
|
}
|
|
14125
14124
|
async function parseOpenCodeTranscript(sessionId) {
|
|
14126
|
-
const { existsSync:
|
|
14125
|
+
const { existsSync: existsSync53 } = await import("fs");
|
|
14127
14126
|
const { opencodeBackend: opencodeBackend2 } = await Promise.resolve().then(() => (init_opencode(), opencode_exports));
|
|
14128
14127
|
const dbPath = opencodeBackend2.dbPath();
|
|
14129
|
-
if (!
|
|
14128
|
+
if (!existsSync53(dbPath))
|
|
14130
14129
|
return [];
|
|
14131
14130
|
const realId = sessionId.replace("opencode_", "");
|
|
14132
14131
|
const db = openOpencodeDbOrThrow(dbPath);
|
|
@@ -24186,10 +24185,10 @@ var require_resolve_block_map = __commonJS({
|
|
|
24186
24185
|
let offset = bm.offset;
|
|
24187
24186
|
let commentEnd = null;
|
|
24188
24187
|
for (const collItem of bm.items) {
|
|
24189
|
-
const { start, key: key2, sep:
|
|
24188
|
+
const { start, key: key2, sep: sep5, value } = collItem;
|
|
24190
24189
|
const keyProps = resolveProps.resolveProps(start, {
|
|
24191
24190
|
indicator: "explicit-key-ind",
|
|
24192
|
-
next: key2 ??
|
|
24191
|
+
next: key2 ?? sep5?.[0],
|
|
24193
24192
|
offset,
|
|
24194
24193
|
onError,
|
|
24195
24194
|
parentIndent: bm.indent,
|
|
@@ -24203,7 +24202,7 @@ var require_resolve_block_map = __commonJS({
|
|
|
24203
24202
|
else if ("indent" in key2 && key2.indent !== bm.indent)
|
|
24204
24203
|
onError(offset, "BAD_INDENT", startColMsg);
|
|
24205
24204
|
}
|
|
24206
|
-
if (!keyProps.anchor && !keyProps.tag && !
|
|
24205
|
+
if (!keyProps.anchor && !keyProps.tag && !sep5) {
|
|
24207
24206
|
commentEnd = keyProps.end;
|
|
24208
24207
|
if (keyProps.comment) {
|
|
24209
24208
|
if (map.comment)
|
|
@@ -24227,7 +24226,7 @@ var require_resolve_block_map = __commonJS({
|
|
|
24227
24226
|
ctx.atKey = false;
|
|
24228
24227
|
if (utilMapIncludes.mapIncludes(ctx, map.items, keyNode))
|
|
24229
24228
|
onError(keyStart, "DUPLICATE_KEY", "Map keys must be unique");
|
|
24230
|
-
const valueProps = resolveProps.resolveProps(
|
|
24229
|
+
const valueProps = resolveProps.resolveProps(sep5 ?? [], {
|
|
24231
24230
|
indicator: "map-value-ind",
|
|
24232
24231
|
next: value,
|
|
24233
24232
|
offset: keyNode.range[2],
|
|
@@ -24243,7 +24242,7 @@ var require_resolve_block_map = __commonJS({
|
|
|
24243
24242
|
if (ctx.options.strict && keyProps.start < valueProps.found.offset - 1024)
|
|
24244
24243
|
onError(keyNode.range, "KEY_OVER_1024_CHARS", "The : indicator must be at most 1024 chars after the start of an implicit block mapping key");
|
|
24245
24244
|
}
|
|
24246
|
-
const valueNode = value ? composeNode(ctx, value, valueProps, onError) : composeEmptyNode(ctx, offset,
|
|
24245
|
+
const valueNode = value ? composeNode(ctx, value, valueProps, onError) : composeEmptyNode(ctx, offset, sep5, null, valueProps, onError);
|
|
24247
24246
|
if (ctx.schema.compat)
|
|
24248
24247
|
utilFlowIndentCheck.flowIndentCheck(bm.indent, value, onError);
|
|
24249
24248
|
offset = valueNode.range[2];
|
|
@@ -24334,7 +24333,7 @@ var require_resolve_end = __commonJS({
|
|
|
24334
24333
|
let comment = "";
|
|
24335
24334
|
if (end) {
|
|
24336
24335
|
let hasSpace = false;
|
|
24337
|
-
let
|
|
24336
|
+
let sep5 = "";
|
|
24338
24337
|
for (const token of end) {
|
|
24339
24338
|
const { source, type } = token;
|
|
24340
24339
|
switch (type) {
|
|
@@ -24348,13 +24347,13 @@ var require_resolve_end = __commonJS({
|
|
|
24348
24347
|
if (!comment)
|
|
24349
24348
|
comment = cb;
|
|
24350
24349
|
else
|
|
24351
|
-
comment +=
|
|
24352
|
-
|
|
24350
|
+
comment += sep5 + cb;
|
|
24351
|
+
sep5 = "";
|
|
24353
24352
|
break;
|
|
24354
24353
|
}
|
|
24355
24354
|
case "newline":
|
|
24356
24355
|
if (comment)
|
|
24357
|
-
|
|
24356
|
+
sep5 += source;
|
|
24358
24357
|
hasSpace = true;
|
|
24359
24358
|
break;
|
|
24360
24359
|
default:
|
|
@@ -24397,18 +24396,18 @@ var require_resolve_flow_collection = __commonJS({
|
|
|
24397
24396
|
let offset = fc.offset + fc.start.source.length;
|
|
24398
24397
|
for (let i = 0; i < fc.items.length; ++i) {
|
|
24399
24398
|
const collItem = fc.items[i];
|
|
24400
|
-
const { start, key: key2, sep:
|
|
24399
|
+
const { start, key: key2, sep: sep5, value } = collItem;
|
|
24401
24400
|
const props = resolveProps.resolveProps(start, {
|
|
24402
24401
|
flow: fcName,
|
|
24403
24402
|
indicator: "explicit-key-ind",
|
|
24404
|
-
next: key2 ??
|
|
24403
|
+
next: key2 ?? sep5?.[0],
|
|
24405
24404
|
offset,
|
|
24406
24405
|
onError,
|
|
24407
24406
|
parentIndent: fc.indent,
|
|
24408
24407
|
startOnNewline: false
|
|
24409
24408
|
});
|
|
24410
24409
|
if (!props.found) {
|
|
24411
|
-
if (!props.anchor && !props.tag && !
|
|
24410
|
+
if (!props.anchor && !props.tag && !sep5 && !value) {
|
|
24412
24411
|
if (i === 0 && props.comma)
|
|
24413
24412
|
onError(props.comma, "UNEXPECTED_TOKEN", `Unexpected , in ${fcName}`);
|
|
24414
24413
|
else if (i < fc.items.length - 1)
|
|
@@ -24462,8 +24461,8 @@ var require_resolve_flow_collection = __commonJS({
|
|
|
24462
24461
|
}
|
|
24463
24462
|
}
|
|
24464
24463
|
}
|
|
24465
|
-
if (!isMap2 && !
|
|
24466
|
-
const valueNode = value ? composeNode(ctx, value, props, onError) : composeEmptyNode(ctx, props.end,
|
|
24464
|
+
if (!isMap2 && !sep5 && !props.found) {
|
|
24465
|
+
const valueNode = value ? composeNode(ctx, value, props, onError) : composeEmptyNode(ctx, props.end, sep5, null, props, onError);
|
|
24467
24466
|
coll.items.push(valueNode);
|
|
24468
24467
|
offset = valueNode.range[2];
|
|
24469
24468
|
if (isBlock(value))
|
|
@@ -24475,7 +24474,7 @@ var require_resolve_flow_collection = __commonJS({
|
|
|
24475
24474
|
if (isBlock(key2))
|
|
24476
24475
|
onError(keyNode.range, "BLOCK_IN_FLOW", blockMsg);
|
|
24477
24476
|
ctx.atKey = false;
|
|
24478
|
-
const valueProps = resolveProps.resolveProps(
|
|
24477
|
+
const valueProps = resolveProps.resolveProps(sep5 ?? [], {
|
|
24479
24478
|
flow: fcName,
|
|
24480
24479
|
indicator: "map-value-ind",
|
|
24481
24480
|
next: value,
|
|
@@ -24486,8 +24485,8 @@ var require_resolve_flow_collection = __commonJS({
|
|
|
24486
24485
|
});
|
|
24487
24486
|
if (valueProps.found) {
|
|
24488
24487
|
if (!isMap2 && !props.found && ctx.options.strict) {
|
|
24489
|
-
if (
|
|
24490
|
-
for (const st of
|
|
24488
|
+
if (sep5)
|
|
24489
|
+
for (const st of sep5) {
|
|
24491
24490
|
if (st === valueProps.found)
|
|
24492
24491
|
break;
|
|
24493
24492
|
if (st.type === "newline") {
|
|
@@ -24504,7 +24503,7 @@ var require_resolve_flow_collection = __commonJS({
|
|
|
24504
24503
|
else
|
|
24505
24504
|
onError(valueProps.start, "MISSING_CHAR", `Missing , or : between ${fcName} items`);
|
|
24506
24505
|
}
|
|
24507
|
-
const valueNode = value ? composeNode(ctx, value, valueProps, onError) : valueProps.found ? composeEmptyNode(ctx, valueProps.end,
|
|
24506
|
+
const valueNode = value ? composeNode(ctx, value, valueProps, onError) : valueProps.found ? composeEmptyNode(ctx, valueProps.end, sep5, null, valueProps, onError) : null;
|
|
24508
24507
|
if (valueNode) {
|
|
24509
24508
|
if (isBlock(value))
|
|
24510
24509
|
onError(valueNode.range, "BLOCK_IN_FLOW", blockMsg);
|
|
@@ -24684,7 +24683,7 @@ var require_resolve_block_scalar = __commonJS({
|
|
|
24684
24683
|
chompStart = i + 1;
|
|
24685
24684
|
}
|
|
24686
24685
|
let value = "";
|
|
24687
|
-
let
|
|
24686
|
+
let sep5 = "";
|
|
24688
24687
|
let prevMoreIndented = false;
|
|
24689
24688
|
for (let i = 0; i < contentStart; ++i)
|
|
24690
24689
|
value += lines[i][0].slice(trimIndent) + "\n";
|
|
@@ -24701,24 +24700,24 @@ var require_resolve_block_scalar = __commonJS({
|
|
|
24701
24700
|
indent2 = "";
|
|
24702
24701
|
}
|
|
24703
24702
|
if (type === Scalar.Scalar.BLOCK_LITERAL) {
|
|
24704
|
-
value +=
|
|
24705
|
-
|
|
24703
|
+
value += sep5 + indent2.slice(trimIndent) + content;
|
|
24704
|
+
sep5 = "\n";
|
|
24706
24705
|
} else if (indent2.length > trimIndent || content[0] === " ") {
|
|
24707
|
-
if (
|
|
24708
|
-
|
|
24709
|
-
else if (!prevMoreIndented &&
|
|
24710
|
-
|
|
24711
|
-
value +=
|
|
24712
|
-
|
|
24706
|
+
if (sep5 === " ")
|
|
24707
|
+
sep5 = "\n";
|
|
24708
|
+
else if (!prevMoreIndented && sep5 === "\n")
|
|
24709
|
+
sep5 = "\n\n";
|
|
24710
|
+
value += sep5 + indent2.slice(trimIndent) + content;
|
|
24711
|
+
sep5 = "\n";
|
|
24713
24712
|
prevMoreIndented = true;
|
|
24714
24713
|
} else if (content === "") {
|
|
24715
|
-
if (
|
|
24714
|
+
if (sep5 === "\n")
|
|
24716
24715
|
value += "\n";
|
|
24717
24716
|
else
|
|
24718
|
-
|
|
24717
|
+
sep5 = "\n";
|
|
24719
24718
|
} else {
|
|
24720
|
-
value +=
|
|
24721
|
-
|
|
24719
|
+
value += sep5 + content;
|
|
24720
|
+
sep5 = " ";
|
|
24722
24721
|
prevMoreIndented = false;
|
|
24723
24722
|
}
|
|
24724
24723
|
}
|
|
@@ -24901,25 +24900,25 @@ var require_resolve_flow_scalar = __commonJS({
|
|
|
24901
24900
|
trimBoth = /^[ \t]+|[ \t]+$/g;
|
|
24902
24901
|
}
|
|
24903
24902
|
let res = match[1].replace(trimEnd, "");
|
|
24904
|
-
let
|
|
24903
|
+
let sep5 = " ";
|
|
24905
24904
|
let pos = line.lastIndex;
|
|
24906
24905
|
while (match = line.exec(source)) {
|
|
24907
24906
|
const lm = match[1].replace(trimBoth, "");
|
|
24908
24907
|
if (lm === "") {
|
|
24909
|
-
if (
|
|
24910
|
-
res +=
|
|
24908
|
+
if (sep5 === "\n")
|
|
24909
|
+
res += sep5;
|
|
24911
24910
|
else
|
|
24912
|
-
|
|
24911
|
+
sep5 = "\n";
|
|
24913
24912
|
} else {
|
|
24914
|
-
res +=
|
|
24915
|
-
|
|
24913
|
+
res += sep5 + lm;
|
|
24914
|
+
sep5 = " ";
|
|
24916
24915
|
}
|
|
24917
24916
|
pos = line.lastIndex;
|
|
24918
24917
|
}
|
|
24919
24918
|
const last = /[ \t]*(.*)/sy;
|
|
24920
24919
|
last.lastIndex = pos;
|
|
24921
24920
|
match = last.exec(source);
|
|
24922
|
-
return res +
|
|
24921
|
+
return res + sep5 + (match?.[1] ?? "");
|
|
24923
24922
|
}
|
|
24924
24923
|
function doubleQuotedValue(source, onError) {
|
|
24925
24924
|
let res = "";
|
|
@@ -25729,14 +25728,14 @@ var require_cst_stringify = __commonJS({
|
|
|
25729
25728
|
}
|
|
25730
25729
|
}
|
|
25731
25730
|
}
|
|
25732
|
-
function stringifyItem({ start, key: key2, sep:
|
|
25731
|
+
function stringifyItem({ start, key: key2, sep: sep5, value }) {
|
|
25733
25732
|
let res = "";
|
|
25734
25733
|
for (const st of start)
|
|
25735
25734
|
res += st.source;
|
|
25736
25735
|
if (key2)
|
|
25737
25736
|
res += stringifyToken(key2);
|
|
25738
|
-
if (
|
|
25739
|
-
for (const st of
|
|
25737
|
+
if (sep5)
|
|
25738
|
+
for (const st of sep5)
|
|
25740
25739
|
res += st.source;
|
|
25741
25740
|
if (value)
|
|
25742
25741
|
res += stringifyToken(value);
|
|
@@ -26627,7 +26626,7 @@ var require_parser = __commonJS({
|
|
|
26627
26626
|
}
|
|
26628
26627
|
}
|
|
26629
26628
|
}
|
|
26630
|
-
var
|
|
26629
|
+
var Parser2 = class {
|
|
26631
26630
|
/**
|
|
26632
26631
|
* @param onNewLine - If defined, called separately with the start position of
|
|
26633
26632
|
* each new line (in `parse()`, including the start of input).
|
|
@@ -26903,18 +26902,18 @@ var require_parser = __commonJS({
|
|
|
26903
26902
|
if (this.type === "map-value-ind") {
|
|
26904
26903
|
const prev = getPrevProps(this.peek(2));
|
|
26905
26904
|
const start = getFirstKeyStartProps(prev);
|
|
26906
|
-
let
|
|
26905
|
+
let sep5;
|
|
26907
26906
|
if (scalar.end) {
|
|
26908
|
-
|
|
26909
|
-
|
|
26907
|
+
sep5 = scalar.end;
|
|
26908
|
+
sep5.push(this.sourceToken);
|
|
26910
26909
|
delete scalar.end;
|
|
26911
26910
|
} else
|
|
26912
|
-
|
|
26911
|
+
sep5 = [this.sourceToken];
|
|
26913
26912
|
const map = {
|
|
26914
26913
|
type: "block-map",
|
|
26915
26914
|
offset: scalar.offset,
|
|
26916
26915
|
indent: scalar.indent,
|
|
26917
|
-
items: [{ start, key: scalar, sep:
|
|
26916
|
+
items: [{ start, key: scalar, sep: sep5 }]
|
|
26918
26917
|
};
|
|
26919
26918
|
this.onKeyLine = true;
|
|
26920
26919
|
this.stack[this.stack.length - 1] = map;
|
|
@@ -27067,15 +27066,15 @@ var require_parser = __commonJS({
|
|
|
27067
27066
|
} else if (isFlowToken(it.key) && !includesToken(it.sep, "newline")) {
|
|
27068
27067
|
const start2 = getFirstKeyStartProps(it.start);
|
|
27069
27068
|
const key2 = it.key;
|
|
27070
|
-
const
|
|
27071
|
-
|
|
27069
|
+
const sep5 = it.sep;
|
|
27070
|
+
sep5.push(this.sourceToken);
|
|
27072
27071
|
delete it.key;
|
|
27073
27072
|
delete it.sep;
|
|
27074
27073
|
this.stack.push({
|
|
27075
27074
|
type: "block-map",
|
|
27076
27075
|
offset: this.offset,
|
|
27077
27076
|
indent: this.indent,
|
|
27078
|
-
items: [{ start: start2, key: key2, sep:
|
|
27077
|
+
items: [{ start: start2, key: key2, sep: sep5 }]
|
|
27079
27078
|
});
|
|
27080
27079
|
} else if (start.length > 0) {
|
|
27081
27080
|
it.sep = it.sep.concat(start, this.sourceToken);
|
|
@@ -27269,13 +27268,13 @@ var require_parser = __commonJS({
|
|
|
27269
27268
|
const prev = getPrevProps(parent);
|
|
27270
27269
|
const start = getFirstKeyStartProps(prev);
|
|
27271
27270
|
fixFlowSeqItems(fc);
|
|
27272
|
-
const
|
|
27273
|
-
|
|
27271
|
+
const sep5 = fc.end.splice(1, fc.end.length);
|
|
27272
|
+
sep5.push(this.sourceToken);
|
|
27274
27273
|
const map = {
|
|
27275
27274
|
type: "block-map",
|
|
27276
27275
|
offset: fc.offset,
|
|
27277
27276
|
indent: fc.indent,
|
|
27278
|
-
items: [{ start, key: fc, sep:
|
|
27277
|
+
items: [{ start, key: fc, sep: sep5 }]
|
|
27279
27278
|
};
|
|
27280
27279
|
this.onKeyLine = true;
|
|
27281
27280
|
this.stack[this.stack.length - 1] = map;
|
|
@@ -27400,7 +27399,7 @@ var require_parser = __commonJS({
|
|
|
27400
27399
|
}
|
|
27401
27400
|
}
|
|
27402
27401
|
};
|
|
27403
|
-
exports.Parser =
|
|
27402
|
+
exports.Parser = Parser2;
|
|
27404
27403
|
}
|
|
27405
27404
|
});
|
|
27406
27405
|
|
|
@@ -29093,7 +29092,7 @@ var init_http = __esm({
|
|
|
29093
29092
|
CLI_VERSION = JSON.parse(readFileSync42(new URL("../package.json", import.meta.url), "utf-8")).version || CLI_VERSION;
|
|
29094
29093
|
} catch {
|
|
29095
29094
|
try {
|
|
29096
|
-
if (true) CLI_VERSION = "0.7.
|
|
29095
|
+
if (true) CLI_VERSION = "0.7.31";
|
|
29097
29096
|
} catch {
|
|
29098
29097
|
}
|
|
29099
29098
|
}
|
|
@@ -29591,7 +29590,7 @@ var init_telemetry = __esm({
|
|
|
29591
29590
|
init_sync_client();
|
|
29592
29591
|
cliVersion2 = () => {
|
|
29593
29592
|
try {
|
|
29594
|
-
return true ? "0.7.
|
|
29593
|
+
return true ? "0.7.31" : "dev";
|
|
29595
29594
|
} catch {
|
|
29596
29595
|
return "dev";
|
|
29597
29596
|
}
|
|
@@ -31986,7 +31985,7 @@ var init_sync_client = __esm({
|
|
|
31986
31985
|
ownVersion = JSON.parse(readFileSync45(join55(dir, "../package.json"), "utf-8")).version || ownVersion;
|
|
31987
31986
|
} catch {
|
|
31988
31987
|
try {
|
|
31989
|
-
if (true) ownVersion = "0.7.
|
|
31988
|
+
if (true) ownVersion = "0.7.31";
|
|
31990
31989
|
} catch {
|
|
31991
31990
|
}
|
|
31992
31991
|
}
|
|
@@ -32758,7 +32757,7 @@ function isBoardHookEntry(entry) {
|
|
|
32758
32757
|
function boardHookEntries(execPath, cliEntry) {
|
|
32759
32758
|
return BOARD_HOOKS.map(({ event, mode }) => [
|
|
32760
32759
|
event,
|
|
32761
|
-
{ matcher: "", hooks: [{ type: "command", command: boardHookCommand(execPath, cliEntry, mode) }] }
|
|
32760
|
+
{ matcher: "", hooks: [{ type: "command", command: boardHookCommand(execPath, cliEntry, mode), timeout: HOOK_TIMEOUT_SECONDS }] }
|
|
32762
32761
|
]);
|
|
32763
32762
|
}
|
|
32764
32763
|
function messageHookCommand(execPath, hookEntry, waiter = false) {
|
|
@@ -32779,7 +32778,7 @@ function messageHookEntries(execPath, hookEntry) {
|
|
|
32779
32778
|
const turn = messageHookCommand(execPath, hookEntry);
|
|
32780
32779
|
const waiter = messageHookCommand(execPath, hookEntry, true);
|
|
32781
32780
|
return [
|
|
32782
|
-
...MESSAGE_HOOK_EVENTS.map((event) => [event, { matcher: "", hooks: [{ type: "command", command: turn }] }]),
|
|
32781
|
+
...MESSAGE_HOOK_EVENTS.map((event) => [event, { matcher: "", hooks: [{ type: "command", command: turn, timeout: HOOK_TIMEOUT_SECONDS }] }]),
|
|
32783
32782
|
...MESSAGE_WAITER_EVENTS.map((event) => [event, {
|
|
32784
32783
|
matcher: "",
|
|
32785
32784
|
hooks: [{ type: "command", command: waiter, asyncRewake: true, timeout: MESSAGE_WAITER_TIMEOUT_SECONDS }]
|
|
@@ -32794,10 +32793,11 @@ function resolveMessageHookEntry(distDir) {
|
|
|
32794
32793
|
const bundled = join60(distDir, "message-hook.js");
|
|
32795
32794
|
return existsSync50(bundled) ? bundled : join60(distDir, "message-hook.ts");
|
|
32796
32795
|
}
|
|
32797
|
-
var BOARD_HOOKS, MESSAGE_HOOK_EVENTS, MESSAGE_WAITER_EVENTS, MESSAGE_WAITER_TIMEOUT_SECONDS;
|
|
32796
|
+
var HOOK_TIMEOUT_SECONDS, BOARD_HOOKS, MESSAGE_HOOK_EVENTS, MESSAGE_WAITER_EVENTS, MESSAGE_WAITER_TIMEOUT_SECONDS;
|
|
32798
32797
|
var init_board_hooks = __esm({
|
|
32799
32798
|
"src/board-hooks.ts"() {
|
|
32800
32799
|
"use strict";
|
|
32800
|
+
HOOK_TIMEOUT_SECONDS = 60;
|
|
32801
32801
|
BOARD_HOOKS = [
|
|
32802
32802
|
{ event: "UserPromptSubmit", mode: "claim" },
|
|
32803
32803
|
{ event: "SessionEnd", mode: "close" }
|
|
@@ -33729,6 +33729,274 @@ var init_message_registration = __esm({
|
|
|
33729
33729
|
}
|
|
33730
33730
|
});
|
|
33731
33731
|
|
|
33732
|
+
// ../engine/dist/core/opencode-tui-config.js
|
|
33733
|
+
import { existsSync as existsSync51, readFileSync as readFileSync52, renameSync as renameSync6, writeFileSync as writeFileSync15 } from "node:fs";
|
|
33734
|
+
import { join as join63, relative as relative2, sep as sep4 } from "node:path";
|
|
33735
|
+
function tuiConfigPath(configDir = opencodeConfigDir()) {
|
|
33736
|
+
const jsonc = join63(configDir, "tui.jsonc");
|
|
33737
|
+
if (existsSync51(jsonc))
|
|
33738
|
+
return jsonc;
|
|
33739
|
+
return join63(configDir, "tui.json");
|
|
33740
|
+
}
|
|
33741
|
+
function tuiPluginEntry(configDir = opencodeConfigDir()) {
|
|
33742
|
+
const file = join63(opencodePluginDir(), OPENCODE_TUI_PACKAGE, "tui.js");
|
|
33743
|
+
return `./${relative2(configDir, file).split(sep4).join("/")}`;
|
|
33744
|
+
}
|
|
33745
|
+
function tokenize(src) {
|
|
33746
|
+
const out = [];
|
|
33747
|
+
let i = 0;
|
|
33748
|
+
while (i < src.length) {
|
|
33749
|
+
const c = src[i];
|
|
33750
|
+
if (c === " " || c === " " || c === "\n" || c === "\r" || c === "\uFEFF") {
|
|
33751
|
+
i += 1;
|
|
33752
|
+
continue;
|
|
33753
|
+
}
|
|
33754
|
+
if (c === "/" && src[i + 1] === "/") {
|
|
33755
|
+
const e = src.indexOf("\n", i);
|
|
33756
|
+
i = e < 0 ? src.length : e + 1;
|
|
33757
|
+
continue;
|
|
33758
|
+
}
|
|
33759
|
+
if (c === "/" && src[i + 1] === "*") {
|
|
33760
|
+
const e = src.indexOf("*/", i + 2);
|
|
33761
|
+
if (e < 0)
|
|
33762
|
+
throw new SyntaxError(`unterminated comment at ${i}`);
|
|
33763
|
+
i = e + 2;
|
|
33764
|
+
continue;
|
|
33765
|
+
}
|
|
33766
|
+
if (c === "{" || c === "}" || c === "[" || c === "]" || c === ":" || c === ",") {
|
|
33767
|
+
out.push({ t: "p", v: c, start: i, end: i + 1 });
|
|
33768
|
+
i += 1;
|
|
33769
|
+
continue;
|
|
33770
|
+
}
|
|
33771
|
+
if (c === '"') {
|
|
33772
|
+
let j3 = i + 1;
|
|
33773
|
+
while (j3 < src.length && src[j3] !== '"') {
|
|
33774
|
+
if (src[j3] === "\\")
|
|
33775
|
+
j3 += 1;
|
|
33776
|
+
j3 += 1;
|
|
33777
|
+
}
|
|
33778
|
+
if (j3 >= src.length)
|
|
33779
|
+
throw new SyntaxError(`unterminated string at ${i}`);
|
|
33780
|
+
out.push({ t: "s", v: JSON.parse(src.slice(i, j3 + 1)), start: i, end: j3 + 1 });
|
|
33781
|
+
i = j3 + 1;
|
|
33782
|
+
continue;
|
|
33783
|
+
}
|
|
33784
|
+
let j2 = i;
|
|
33785
|
+
while (j2 < src.length && !/[\s,:{}[\]"/]/.test(src[j2]))
|
|
33786
|
+
j2 += 1;
|
|
33787
|
+
if (j2 === i)
|
|
33788
|
+
throw new SyntaxError(`unexpected character at ${i}`);
|
|
33789
|
+
out.push({ t: "a", v: src.slice(i, j2), start: i, end: j2 });
|
|
33790
|
+
i = j2;
|
|
33791
|
+
}
|
|
33792
|
+
return out;
|
|
33793
|
+
}
|
|
33794
|
+
function parseRoot(src) {
|
|
33795
|
+
const toks = tokenize(src);
|
|
33796
|
+
if (toks.length === 0)
|
|
33797
|
+
return null;
|
|
33798
|
+
const p = new Parser(toks);
|
|
33799
|
+
const root = p.value();
|
|
33800
|
+
if (root.k !== "obj")
|
|
33801
|
+
throw new SyntaxError("the top level is not an object");
|
|
33802
|
+
const rest = toks.findIndex((t) => t.start >= root.end);
|
|
33803
|
+
if (rest !== -1)
|
|
33804
|
+
throw new SyntaxError(`unexpected "${toks[rest].v}" after the top-level object`);
|
|
33805
|
+
return root;
|
|
33806
|
+
}
|
|
33807
|
+
function pluginArray(root) {
|
|
33808
|
+
if (!root || root.k !== "obj")
|
|
33809
|
+
return {};
|
|
33810
|
+
const prop = root.props.find((p) => p.key === "plugin");
|
|
33811
|
+
if (!prop)
|
|
33812
|
+
return {};
|
|
33813
|
+
if (prop.value.k !== "arr")
|
|
33814
|
+
return { error: '"plugin" is not a list' };
|
|
33815
|
+
return { arr: prop.value };
|
|
33816
|
+
}
|
|
33817
|
+
function splice(src, from, to, insert) {
|
|
33818
|
+
return src.slice(0, from) + insert + src.slice(to);
|
|
33819
|
+
}
|
|
33820
|
+
function addTuiPluginEntry(src, entry) {
|
|
33821
|
+
let root;
|
|
33822
|
+
try {
|
|
33823
|
+
root = parseRoot(src);
|
|
33824
|
+
} catch (e) {
|
|
33825
|
+
return { ok: false, reason: `not valid JSONC: ${e.message}` };
|
|
33826
|
+
}
|
|
33827
|
+
const literal = JSON.stringify(entry);
|
|
33828
|
+
if (!root) {
|
|
33829
|
+
return { ok: true, changed: true, text: `{
|
|
33830
|
+
"plugin": [${literal}]
|
|
33831
|
+
}
|
|
33832
|
+
` };
|
|
33833
|
+
}
|
|
33834
|
+
const { arr, error } = pluginArray(root);
|
|
33835
|
+
if (error)
|
|
33836
|
+
return { ok: false, reason: error };
|
|
33837
|
+
if (arr) {
|
|
33838
|
+
if (arr.items.some((it) => it.k === "str" && it.v === entry))
|
|
33839
|
+
return { ok: true, changed: false, text: src };
|
|
33840
|
+
const last = arr.items[arr.items.length - 1];
|
|
33841
|
+
const text = last ? splice(src, last.end, last.end, `, ${literal}`) : splice(src, arr.closeStart, arr.closeStart, literal);
|
|
33842
|
+
return { ok: true, changed: true, text };
|
|
33843
|
+
}
|
|
33844
|
+
const props = root.props;
|
|
33845
|
+
if (props.length === 0) {
|
|
33846
|
+
return { ok: true, changed: true, text: splice(src, root.start + 1, root.start + 1, `
|
|
33847
|
+
"plugin": [${literal}]
|
|
33848
|
+
`) };
|
|
33849
|
+
}
|
|
33850
|
+
const lastValue = props[props.length - 1].value;
|
|
33851
|
+
return { ok: true, changed: true, text: splice(src, lastValue.end, lastValue.end, `,
|
|
33852
|
+
"plugin": [${literal}]`) };
|
|
33853
|
+
}
|
|
33854
|
+
function removeTuiPluginEntry(src, entry) {
|
|
33855
|
+
let text = src;
|
|
33856
|
+
let changed = false;
|
|
33857
|
+
for (; ; ) {
|
|
33858
|
+
let root;
|
|
33859
|
+
try {
|
|
33860
|
+
root = parseRoot(text);
|
|
33861
|
+
} catch (e) {
|
|
33862
|
+
return { ok: false, reason: `not valid JSONC: ${e.message}` };
|
|
33863
|
+
}
|
|
33864
|
+
const { arr, error } = pluginArray(root);
|
|
33865
|
+
if (error)
|
|
33866
|
+
return { ok: false, reason: error };
|
|
33867
|
+
if (!arr)
|
|
33868
|
+
break;
|
|
33869
|
+
const i = arr.items.findIndex((it) => it.k === "str" && it.v === entry);
|
|
33870
|
+
if (i === -1)
|
|
33871
|
+
break;
|
|
33872
|
+
const item = arr.items[i];
|
|
33873
|
+
const comma = arr.commas[i];
|
|
33874
|
+
if (comma !== null) {
|
|
33875
|
+
text = splice(text, item.start, comma + 1, "");
|
|
33876
|
+
} else if (i > 0 && arr.commas[i - 1] !== null) {
|
|
33877
|
+
text = splice(text, arr.commas[i - 1], item.end, "");
|
|
33878
|
+
} else {
|
|
33879
|
+
text = splice(text, item.start, item.end, "");
|
|
33880
|
+
}
|
|
33881
|
+
changed = true;
|
|
33882
|
+
}
|
|
33883
|
+
return { ok: true, changed, text };
|
|
33884
|
+
}
|
|
33885
|
+
function writeTextAtomic(path2, text) {
|
|
33886
|
+
const tmp = `${path2}.${process.pid}.tmp`;
|
|
33887
|
+
writeFileSync15(tmp, text);
|
|
33888
|
+
renameSync6(tmp, path2);
|
|
33889
|
+
}
|
|
33890
|
+
function registerTuiPlugin(path2 = tuiConfigPath(), entry = tuiPluginEntry()) {
|
|
33891
|
+
const current = existsSync51(path2) ? readFileSync52(path2, "utf-8") : "";
|
|
33892
|
+
const edit = addTuiPluginEntry(current, entry);
|
|
33893
|
+
if (!edit.ok)
|
|
33894
|
+
return { status: "unparseable", path: path2, reason: edit.reason };
|
|
33895
|
+
if (!edit.changed)
|
|
33896
|
+
return { status: "present", path: path2 };
|
|
33897
|
+
writeTextAtomic(path2, edit.text);
|
|
33898
|
+
return { status: "added", path: path2 };
|
|
33899
|
+
}
|
|
33900
|
+
function unregisterTuiPlugin(path2 = tuiConfigPath(), entry = tuiPluginEntry()) {
|
|
33901
|
+
if (!existsSync51(path2))
|
|
33902
|
+
return { removed: false, path: path2 };
|
|
33903
|
+
const edit = removeTuiPluginEntry(readFileSync52(path2, "utf-8"), entry);
|
|
33904
|
+
if (!edit.ok || !edit.changed)
|
|
33905
|
+
return { removed: false, path: path2 };
|
|
33906
|
+
writeTextAtomic(path2, edit.text);
|
|
33907
|
+
return { removed: true, path: path2 };
|
|
33908
|
+
}
|
|
33909
|
+
var ATOM, Parser;
|
|
33910
|
+
var init_opencode_tui_config = __esm({
|
|
33911
|
+
"../engine/dist/core/opencode-tui-config.js"() {
|
|
33912
|
+
"use strict";
|
|
33913
|
+
init_guard_registration();
|
|
33914
|
+
init_message_registration();
|
|
33915
|
+
ATOM = /^(true|false|null|-?(0|[1-9]\d*)(\.\d+)?([eE][+-]?\d+)?)$/;
|
|
33916
|
+
Parser = class {
|
|
33917
|
+
toks;
|
|
33918
|
+
i = 0;
|
|
33919
|
+
constructor(toks) {
|
|
33920
|
+
this.toks = toks;
|
|
33921
|
+
}
|
|
33922
|
+
at() {
|
|
33923
|
+
return this.toks[this.i];
|
|
33924
|
+
}
|
|
33925
|
+
isP(t, v) {
|
|
33926
|
+
return !!t && t.t === "p" && t.v === v;
|
|
33927
|
+
}
|
|
33928
|
+
value() {
|
|
33929
|
+
const t = this.at();
|
|
33930
|
+
if (!t)
|
|
33931
|
+
throw new SyntaxError("unexpected end of file");
|
|
33932
|
+
if (t.t === "s") {
|
|
33933
|
+
this.i += 1;
|
|
33934
|
+
return { k: "str", start: t.start, end: t.end, v: t.v };
|
|
33935
|
+
}
|
|
33936
|
+
if (t.t === "a") {
|
|
33937
|
+
if (!ATOM.test(t.v))
|
|
33938
|
+
throw new SyntaxError(`unknown word "${t.v}" at ${t.start}`);
|
|
33939
|
+
this.i += 1;
|
|
33940
|
+
return { k: "atom", start: t.start, end: t.end, v: t.v };
|
|
33941
|
+
}
|
|
33942
|
+
if (this.isP(t, "{"))
|
|
33943
|
+
return this.object(t);
|
|
33944
|
+
if (this.isP(t, "["))
|
|
33945
|
+
return this.array(t);
|
|
33946
|
+
throw new SyntaxError(`unexpected "${t.v}" at ${t.start}`);
|
|
33947
|
+
}
|
|
33948
|
+
object(open3) {
|
|
33949
|
+
this.i += 1;
|
|
33950
|
+
const props = [];
|
|
33951
|
+
for (; ; ) {
|
|
33952
|
+
const k = this.at();
|
|
33953
|
+
if (this.isP(k, "}")) {
|
|
33954
|
+
this.i += 1;
|
|
33955
|
+
return { k: "obj", start: open3.start, end: k.end, closeStart: k.start, props };
|
|
33956
|
+
}
|
|
33957
|
+
if (!k || k.t !== "s")
|
|
33958
|
+
throw new SyntaxError(`expected a key at ${k ? k.start : "end"}`);
|
|
33959
|
+
this.i += 1;
|
|
33960
|
+
if (!this.isP(this.at(), ":"))
|
|
33961
|
+
throw new SyntaxError(`expected ":" after key at ${k.start}`);
|
|
33962
|
+
this.i += 1;
|
|
33963
|
+
props.push({ key: k.v, value: this.value() });
|
|
33964
|
+
const n = this.at();
|
|
33965
|
+
if (this.isP(n, ",")) {
|
|
33966
|
+
this.i += 1;
|
|
33967
|
+
continue;
|
|
33968
|
+
}
|
|
33969
|
+
if (this.isP(n, "}"))
|
|
33970
|
+
continue;
|
|
33971
|
+
throw new SyntaxError(`expected "," or "}" at ${n ? n.start : "end"}`);
|
|
33972
|
+
}
|
|
33973
|
+
}
|
|
33974
|
+
array(open3) {
|
|
33975
|
+
this.i += 1;
|
|
33976
|
+
const items = [];
|
|
33977
|
+
const commas = [];
|
|
33978
|
+
for (; ; ) {
|
|
33979
|
+
const n = this.at();
|
|
33980
|
+
if (this.isP(n, "]")) {
|
|
33981
|
+
this.i += 1;
|
|
33982
|
+
return { k: "arr", start: open3.start, end: n.end, closeStart: n.start, items, commas };
|
|
33983
|
+
}
|
|
33984
|
+
items.push(this.value());
|
|
33985
|
+
const c = this.at();
|
|
33986
|
+
if (this.isP(c, ",")) {
|
|
33987
|
+
commas.push(c.start);
|
|
33988
|
+
this.i += 1;
|
|
33989
|
+
continue;
|
|
33990
|
+
}
|
|
33991
|
+
commas.push(null);
|
|
33992
|
+
if (!this.isP(this.at(), "]"))
|
|
33993
|
+
throw new SyntaxError(`expected "," or "]" at ${c ? c.start : "end"}`);
|
|
33994
|
+
}
|
|
33995
|
+
}
|
|
33996
|
+
};
|
|
33997
|
+
}
|
|
33998
|
+
});
|
|
33999
|
+
|
|
33732
34000
|
// src/install-hooks.ts
|
|
33733
34001
|
var install_hooks_exports = {};
|
|
33734
34002
|
__export(install_hooks_exports, {
|
|
@@ -33738,24 +34006,29 @@ __export(install_hooks_exports, {
|
|
|
33738
34006
|
ensureHooks: () => ensureHooks,
|
|
33739
34007
|
hookEntries: () => hookEntries,
|
|
33740
34008
|
installHooks: () => installHooks,
|
|
34009
|
+
isLegacyEntry: () => isLegacyEntry,
|
|
33741
34010
|
isOurEntry: () => isOurEntry,
|
|
33742
34011
|
mergeOurEntries: () => mergeOurEntries,
|
|
33743
34012
|
removeOurEntries: () => removeOurEntries,
|
|
33744
34013
|
uninstallHooks: () => uninstallHooks
|
|
33745
34014
|
});
|
|
33746
|
-
import { chmodSync as chmodSync7, copyFileSync as copyFileSync3, existsSync as
|
|
33747
|
-
import { dirname as dirname21, join as
|
|
34015
|
+
import { chmodSync as chmodSync7, copyFileSync as copyFileSync3, existsSync as existsSync52, mkdirSync as mkdirSync17, readFileSync as readFileSync53, realpathSync as realpathSync6, renameSync as renameSync7, rmSync as rmSync10, unlinkSync as unlinkSync5, writeFileSync as writeFileSync16 } from "node:fs";
|
|
34016
|
+
import { dirname as dirname21, join as join64 } from "node:path";
|
|
33748
34017
|
function isOurEntry(entry) {
|
|
33749
34018
|
const cmd = entry?.hooks?.[0]?.command;
|
|
33750
34019
|
if (typeof cmd !== "string") return false;
|
|
33751
|
-
return Object.values(SCRIPTS).some((s) => cmd.includes(s)) || isBoardHookEntry(entry) || isMessageHookEntry(entry);
|
|
34020
|
+
return Object.values(SCRIPTS).some((s) => cmd.includes(s)) || isLegacyEntry(entry) || isBoardHookEntry(entry) || isMessageHookEntry(entry);
|
|
34021
|
+
}
|
|
34022
|
+
function isLegacyEntry(entry) {
|
|
34023
|
+
const cmd = entry?.hooks?.[0]?.command;
|
|
34024
|
+
return typeof cmd === "string" && LEGACY_SCRIPTS.some((s) => cmd.includes(s));
|
|
33752
34025
|
}
|
|
33753
34026
|
function claudeSettingsFiles() {
|
|
33754
34027
|
const out = [];
|
|
33755
34028
|
const seen = /* @__PURE__ */ new Set();
|
|
33756
34029
|
for (const home of claudeHomeDirs()) {
|
|
33757
|
-
if (!
|
|
33758
|
-
const file =
|
|
34030
|
+
if (!existsSync52(join64(home, "projects"))) continue;
|
|
34031
|
+
const file = join64(home, "settings.json");
|
|
33759
34032
|
let key2;
|
|
33760
34033
|
try {
|
|
33761
34034
|
key2 = realpathSync6(file);
|
|
@@ -33771,20 +34044,16 @@ function claudeSettingsFiles() {
|
|
|
33771
34044
|
}
|
|
33772
34045
|
function findScript(distDir, name) {
|
|
33773
34046
|
return [
|
|
33774
|
-
|
|
33775
|
-
|
|
33776
|
-
|
|
33777
|
-
].find((p) =>
|
|
34047
|
+
join64(distDir, "..", "hooks", name),
|
|
34048
|
+
join64(distDir, "..", "..", "hooks", name),
|
|
34049
|
+
join64(distDir, "..", "..", "..", "hooks", name)
|
|
34050
|
+
].find((p) => existsSync52(p));
|
|
33778
34051
|
}
|
|
33779
34052
|
function hookEntries(sel, paths) {
|
|
33780
|
-
const cmd = (command, extra = {}) => [{ type: "command", command, ...extra }];
|
|
34053
|
+
const cmd = (command, extra = {}) => [{ type: "command", command, timeout: HOOK_TIMEOUT_SECONDS, ...extra }];
|
|
33781
34054
|
const q = (p) => `"${p}"`;
|
|
33782
34055
|
const out = [];
|
|
33783
34056
|
const s = paths.scripts;
|
|
33784
|
-
if (sel.save && s.save) {
|
|
33785
|
-
out.push(["Stop", { matcher: "", hooks: cmd(q(s.save)) }]);
|
|
33786
|
-
out.push(["PreCompact", { matcher: "", hooks: cmd(`${q(s.save)} --precompact`) }]);
|
|
33787
|
-
}
|
|
33788
34057
|
if (sel.resume && s.resume) out.push(["UserPromptSubmit", { matcher: "", hooks: cmd(q(s.resume)) }]);
|
|
33789
34058
|
if (sel.escalate && s.escalate) out.push(["SessionEnd", { matcher: "", hooks: cmd(q(s.escalate)) }]);
|
|
33790
34059
|
if (sel.wakeup && s.wakeup) out.push(["SessionStart", { matcher: "startup|clear", hooks: cmd(q(s.wakeup)) }]);
|
|
@@ -33818,9 +34087,9 @@ function removeOurEntries(config2) {
|
|
|
33818
34087
|
return removed;
|
|
33819
34088
|
}
|
|
33820
34089
|
function readJson4(file) {
|
|
33821
|
-
if (!
|
|
34090
|
+
if (!existsSync52(file)) return {};
|
|
33822
34091
|
try {
|
|
33823
|
-
const v = JSON.parse(
|
|
34092
|
+
const v = JSON.parse(readFileSync53(file, "utf-8"));
|
|
33824
34093
|
return v && typeof v === "object" && !Array.isArray(v) ? v : null;
|
|
33825
34094
|
} catch {
|
|
33826
34095
|
return null;
|
|
@@ -33834,15 +34103,15 @@ function writeJsonAtomic(file, value) {
|
|
|
33834
34103
|
}
|
|
33835
34104
|
mkdirSync17(dirname21(target), { recursive: true });
|
|
33836
34105
|
const tmp = `${target}.chat-recall-${process.pid}.tmp`;
|
|
33837
|
-
|
|
33838
|
-
|
|
34106
|
+
writeFileSync16(tmp, JSON.stringify(value, null, 2) + "\n");
|
|
34107
|
+
renameSync7(tmp, target);
|
|
33839
34108
|
}
|
|
33840
34109
|
function statePath() {
|
|
33841
|
-
return
|
|
34110
|
+
return join64(getHooksDir(), "install.json");
|
|
33842
34111
|
}
|
|
33843
34112
|
function readState() {
|
|
33844
34113
|
try {
|
|
33845
|
-
return JSON.parse(
|
|
34114
|
+
return JSON.parse(readFileSync53(statePath(), "utf-8"));
|
|
33846
34115
|
} catch {
|
|
33847
34116
|
return null;
|
|
33848
34117
|
}
|
|
@@ -33850,13 +34119,14 @@ function readState() {
|
|
|
33850
34119
|
async function installHooks(distDir, sel = ALL_HOOKS) {
|
|
33851
34120
|
const shellSkipped = process.platform === "win32";
|
|
33852
34121
|
const scriptsDir = getHooksDir();
|
|
34122
|
+
for (const name of LEGACY_SCRIPTS) rmSync10(join64(scriptsDir, name), { force: true });
|
|
33853
34123
|
const scripts = {};
|
|
33854
34124
|
if (!shellSkipped) {
|
|
33855
34125
|
for (const key2 of Object.keys(SCRIPTS)) {
|
|
33856
34126
|
if (!sel[key2]) continue;
|
|
33857
34127
|
const source = findScript(distDir, SCRIPTS[key2]);
|
|
33858
34128
|
if (!source) continue;
|
|
33859
|
-
const target =
|
|
34129
|
+
const target = join64(scriptsDir, SCRIPTS[key2]);
|
|
33860
34130
|
copyFileSync3(source, target);
|
|
33861
34131
|
chmodSync7(target, 493);
|
|
33862
34132
|
scripts[key2] = target;
|
|
@@ -33887,17 +34157,18 @@ async function installHooks(distDir, sel = ALL_HOOKS) {
|
|
|
33887
34157
|
mergeOurEntries(config2, entries);
|
|
33888
34158
|
writeJsonAtomic(settingsFile, config2);
|
|
33889
34159
|
report.written.push(settingsFile);
|
|
33890
|
-
report.migrated += migrateHooksJson(
|
|
34160
|
+
report.migrated += migrateHooksJson(join64(dirname21(settingsFile), "hooks.json"));
|
|
33891
34161
|
}
|
|
33892
34162
|
if (sel.guard && scripts.guard) report.guardTargets = await addGuardToOtherTools(scriptsDir, scripts.guard);
|
|
33893
34163
|
if (sel.messages && !shellSkipped) {
|
|
33894
34164
|
report.messageTargets = await addMessagesToOtherTools(scriptsDir, process.execPath, resolveMessageHookEntry(distDir));
|
|
33895
34165
|
}
|
|
34166
|
+
if (!sel.messages) unregisterTuiPlugin();
|
|
33896
34167
|
writeJsonAtomic(statePath(), { version: cliVersion(), selection: sel });
|
|
33897
34168
|
return report;
|
|
33898
34169
|
}
|
|
33899
34170
|
function migrateHooksJson(file) {
|
|
33900
|
-
if (!
|
|
34171
|
+
if (!existsSync52(file)) return 0;
|
|
33901
34172
|
const config2 = readJson4(file);
|
|
33902
34173
|
if (!config2) return 0;
|
|
33903
34174
|
const removed = removeOurEntries(config2);
|
|
@@ -33909,8 +34180,8 @@ function migrateHooksJson(file) {
|
|
|
33909
34180
|
async function uninstallHooks() {
|
|
33910
34181
|
const report = { removed: 0, files: [], guardRemoved: [], messagesRemoved: [] };
|
|
33911
34182
|
for (const settingsFile of claudeSettingsFiles()) {
|
|
33912
|
-
for (const file of [settingsFile,
|
|
33913
|
-
if (!
|
|
34183
|
+
for (const file of [settingsFile, join64(dirname21(settingsFile), "hooks.json")]) {
|
|
34184
|
+
if (!existsSync52(file)) continue;
|
|
33914
34185
|
const config2 = readJson4(file);
|
|
33915
34186
|
if (!config2) continue;
|
|
33916
34187
|
const removed = removeOurEntries(config2);
|
|
@@ -33931,7 +34202,7 @@ function profileMissingHooks(settingsFile, sel) {
|
|
|
33931
34202
|
const has = (event, test) => (Array.isArray(config2.hooks?.[event]) ? config2.hooks[event] : []).some(test);
|
|
33932
34203
|
if (sel.messages && !(has("Stop", isCurrentMessageWaiterEntry) && has("SessionStart", isMessageHookEntry))) return true;
|
|
33933
34204
|
if (sel.taskBoard && !has("UserPromptSubmit", isBoardHookEntry)) return true;
|
|
33934
|
-
if (
|
|
34205
|
+
if (Object.values(config2.hooks ?? {}).some((list) => Array.isArray(list) && list.some(isLegacyEntry))) return true;
|
|
33935
34206
|
return false;
|
|
33936
34207
|
}
|
|
33937
34208
|
async function ensureHooks(distDir) {
|
|
@@ -33947,13 +34218,13 @@ async function addGuardToOtherTools(scriptsDir, guardScript) {
|
|
|
33947
34218
|
const out = [];
|
|
33948
34219
|
removeLegacyAgyGuard(reg);
|
|
33949
34220
|
for (const target of reg.guardTargets()) {
|
|
33950
|
-
if (!
|
|
33951
|
-
const wrapper =
|
|
33952
|
-
|
|
34221
|
+
if (!existsSync52(target.homeDir)) continue;
|
|
34222
|
+
const wrapper = join64(scriptsDir, reg.guardWrapperName(target.tool));
|
|
34223
|
+
writeFileSync16(wrapper, reg.guardWrapperSource(target.tool, guardScript));
|
|
33953
34224
|
chmodSync7(wrapper, 493);
|
|
33954
34225
|
mkdirSync17(dirname21(target.configPath), { recursive: true });
|
|
33955
34226
|
if (target.tool === "opencode") {
|
|
33956
|
-
|
|
34227
|
+
writeFileSync16(target.configPath, reg.opencodePluginSource(wrapper));
|
|
33957
34228
|
} else {
|
|
33958
34229
|
const merged = reg.registerGuard(target.tool, readJson4(target.configPath) ?? {}, reg.guardCommand(wrapper));
|
|
33959
34230
|
writeJsonAtomic(target.configPath, merged);
|
|
@@ -33967,9 +34238,9 @@ async function removeGuardFromOtherTools() {
|
|
|
33967
34238
|
const out = [];
|
|
33968
34239
|
removeLegacyAgyGuard(reg);
|
|
33969
34240
|
for (const target of reg.guardTargets()) {
|
|
33970
|
-
if (!
|
|
34241
|
+
if (!existsSync52(target.configPath)) continue;
|
|
33971
34242
|
if (target.tool === "opencode") {
|
|
33972
|
-
if (!
|
|
34243
|
+
if (!readFileSync53(target.configPath, "utf-8").includes("chat-recall install-hooks")) continue;
|
|
33973
34244
|
unlinkSync5(target.configPath);
|
|
33974
34245
|
} else {
|
|
33975
34246
|
const r = reg.unregisterGuard(target.tool, readJson4(target.configPath) ?? {});
|
|
@@ -33982,7 +34253,7 @@ async function removeGuardFromOtherTools() {
|
|
|
33982
34253
|
}
|
|
33983
34254
|
function removeLegacyAgyGuard(reg) {
|
|
33984
34255
|
const file = reg.legacyAgyHooksFile();
|
|
33985
|
-
if (!
|
|
34256
|
+
if (!existsSync52(file)) return;
|
|
33986
34257
|
const r = reg.unregisterGuard("agy", readJson4(file) ?? {});
|
|
33987
34258
|
if (r.removed) writeJsonAtomic(file, r.config);
|
|
33988
34259
|
}
|
|
@@ -33990,18 +34261,26 @@ async function addMessagesToOtherTools(scriptsDir, nodePath, hookEntry) {
|
|
|
33990
34261
|
const reg = await Promise.resolve().then(() => (init_message_registration(), message_registration_exports));
|
|
33991
34262
|
const out = [];
|
|
33992
34263
|
for (const target of reg.messageTargets()) {
|
|
33993
|
-
if (!
|
|
33994
|
-
const wrapper =
|
|
33995
|
-
|
|
34264
|
+
if (!existsSync52(target.homeDir)) continue;
|
|
34265
|
+
const wrapper = join64(scriptsDir, reg.messageWrapperName(target.tool));
|
|
34266
|
+
writeFileSync16(wrapper, reg.messageWrapperSource(target.tool, nodePath, hookEntry));
|
|
33996
34267
|
chmodSync7(wrapper, 493);
|
|
33997
34268
|
mkdirSync17(dirname21(target.configPath), { recursive: true });
|
|
33998
34269
|
if (target.tool === "opencode") {
|
|
33999
|
-
|
|
34000
|
-
const dir =
|
|
34270
|
+
writeFileSync16(target.configPath, reg.opencodeMessagesSource(wrapper));
|
|
34271
|
+
const dir = join64(dirname21(target.configPath), reg.OPENCODE_TUI_PACKAGE);
|
|
34001
34272
|
mkdirSync17(dir, { recursive: true });
|
|
34002
|
-
for (const file of reg.opencodeTuiFiles(wrapper))
|
|
34273
|
+
for (const file of reg.opencodeTuiFiles(wrapper)) writeFileSync16(join64(dir, file.name), file.source);
|
|
34274
|
+
const tui = registerTuiPlugin();
|
|
34275
|
+
if (tui.status === "unparseable") {
|
|
34276
|
+
out.push({
|
|
34277
|
+
label: "OpenCode TUI",
|
|
34278
|
+
configPath: tui.path,
|
|
34279
|
+
note: `Not added: ${tui.reason}. Add "${tuiPluginEntry()}" to its plugin list by hand.`
|
|
34280
|
+
});
|
|
34281
|
+
}
|
|
34003
34282
|
} else if (target.tool === "pi") {
|
|
34004
|
-
|
|
34283
|
+
writeFileSync16(target.configPath, reg.piMessagesSource(wrapper));
|
|
34005
34284
|
} else {
|
|
34006
34285
|
const config2 = readJson4(target.configPath);
|
|
34007
34286
|
if (!config2) continue;
|
|
@@ -34014,15 +34293,17 @@ async function addMessagesToOtherTools(scriptsDir, nodePath, hookEntry) {
|
|
|
34014
34293
|
async function removeMessagesFromOtherTools() {
|
|
34015
34294
|
const reg = await Promise.resolve().then(() => (init_message_registration(), message_registration_exports));
|
|
34016
34295
|
const out = [];
|
|
34296
|
+
const tui = unregisterTuiPlugin();
|
|
34297
|
+
if (tui.removed) out.push({ label: "OpenCode TUI", configPath: tui.path });
|
|
34017
34298
|
for (const target of reg.messageTargets()) {
|
|
34018
|
-
if (!
|
|
34299
|
+
if (!existsSync52(target.configPath)) continue;
|
|
34019
34300
|
if (target.tool === "opencode" || target.tool === "pi") {
|
|
34020
|
-
if (!reg.isOurPluginSource(
|
|
34301
|
+
if (!reg.isOurPluginSource(readFileSync53(target.configPath, "utf-8"))) continue;
|
|
34021
34302
|
unlinkSync5(target.configPath);
|
|
34022
34303
|
if (target.tool === "opencode") {
|
|
34023
|
-
const dir =
|
|
34024
|
-
const
|
|
34025
|
-
if (
|
|
34304
|
+
const dir = join64(dirname21(target.configPath), reg.OPENCODE_TUI_PACKAGE);
|
|
34305
|
+
const tui2 = join64(dir, "tui.js");
|
|
34306
|
+
if (existsSync52(tui2) && reg.isOurTuiSource(readFileSync53(tui2, "utf-8"))) rmSync10(dir, { recursive: true, force: true });
|
|
34026
34307
|
}
|
|
34027
34308
|
} else {
|
|
34028
34309
|
const config2 = readJson4(target.configPath);
|
|
@@ -34035,7 +34316,7 @@ async function removeMessagesFromOtherTools() {
|
|
|
34035
34316
|
}
|
|
34036
34317
|
return out;
|
|
34037
34318
|
}
|
|
34038
|
-
var ALL_HOOKS, SCRIPTS, HOOK_EVENTS;
|
|
34319
|
+
var ALL_HOOKS, SCRIPTS, LEGACY_SCRIPTS, HOOK_EVENTS;
|
|
34039
34320
|
var init_install_hooks = __esm({
|
|
34040
34321
|
"src/install-hooks.ts"() {
|
|
34041
34322
|
"use strict";
|
|
@@ -34044,8 +34325,8 @@ var init_install_hooks = __esm({
|
|
|
34044
34325
|
init_tool_paths();
|
|
34045
34326
|
init_board_hooks();
|
|
34046
34327
|
init_http();
|
|
34328
|
+
init_opencode_tui_config();
|
|
34047
34329
|
ALL_HOOKS = {
|
|
34048
|
-
save: true,
|
|
34049
34330
|
resume: true,
|
|
34050
34331
|
escalate: true,
|
|
34051
34332
|
wakeup: true,
|
|
@@ -34054,12 +34335,12 @@ var init_install_hooks = __esm({
|
|
|
34054
34335
|
messages: true
|
|
34055
34336
|
};
|
|
34056
34337
|
SCRIPTS = {
|
|
34057
|
-
save: "chat_recall_save_hook.sh",
|
|
34058
34338
|
resume: "chat_recall_resume_hook.sh",
|
|
34059
34339
|
escalate: "chat_recall_escalate_hook.sh",
|
|
34060
34340
|
wakeup: "chat_recall_wakeup_hook.sh",
|
|
34061
34341
|
guard: "chat_recall_guard_hook.sh"
|
|
34062
34342
|
};
|
|
34343
|
+
LEGACY_SCRIPTS = ["chat_recall_save_hook.sh"];
|
|
34063
34344
|
HOOK_EVENTS = ["Stop", "PreCompact", "UserPromptSubmit", "SessionEnd", "SessionStart", "PreToolUse", "PostToolUse"];
|
|
34064
34345
|
}
|
|
34065
34346
|
});
|
|
@@ -40632,7 +40913,7 @@ function openBrowser(url) {
|
|
|
40632
40913
|
// src/mcp.ts
|
|
40633
40914
|
init_client_events();
|
|
40634
40915
|
init_update_notice();
|
|
40635
|
-
import { readFileSync as
|
|
40916
|
+
import { readFileSync as readFileSync54 } from "node:fs";
|
|
40636
40917
|
|
|
40637
40918
|
// src/channel.ts
|
|
40638
40919
|
init_session_messages();
|
|
@@ -40892,7 +41173,7 @@ async function runChannel(deps) {
|
|
|
40892
41173
|
|
|
40893
41174
|
// src/mcp.ts
|
|
40894
41175
|
setServerVersion(JSON.parse(
|
|
40895
|
-
|
|
41176
|
+
readFileSync54(new URL("../package.json", import.meta.url), "utf-8")
|
|
40896
41177
|
).version);
|
|
40897
41178
|
setEventReporter(reportClientEvent2);
|
|
40898
41179
|
setIndexRunner(runIndexChild2);
|
|
@@ -41065,7 +41346,7 @@ function installCrashGuards() {
|
|
|
41065
41346
|
reportClientEvent2("mcp_crash", { message: err.stack || err.message });
|
|
41066
41347
|
});
|
|
41067
41348
|
}
|
|
41068
|
-
var RELAY_VERSION = true ? "0.7.
|
|
41349
|
+
var RELAY_VERSION = true ? "0.7.31" : "0.0.0";
|
|
41069
41350
|
function daemonIdleSecs() {
|
|
41070
41351
|
const raw = process.env.CHAT_RECALL_DAEMON_IDLE_SECS;
|
|
41071
41352
|
if (raw === void 0) return 900;
|
|
@@ -41174,7 +41455,7 @@ async function runDaemon() {
|
|
|
41174
41455
|
}
|
|
41175
41456
|
function installedVersion2() {
|
|
41176
41457
|
try {
|
|
41177
|
-
const pkg = JSON.parse(
|
|
41458
|
+
const pkg = JSON.parse(readFileSync54(new URL("../package.json", import.meta.url), "utf-8"));
|
|
41178
41459
|
return typeof pkg.version === "string" ? pkg.version : null;
|
|
41179
41460
|
} catch {
|
|
41180
41461
|
return null;
|