chat-recall 0.7.29 → 0.7.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +3217 -2914
- package/dist/cli.js.map +1 -1
- package/dist/install-hooks.d.ts.map +1 -1
- package/dist/install-hooks.js +17 -0
- package/dist/install-hooks.js.map +1 -1
- package/dist/mcp-relay.js +1 -1
- package/dist/mcp.js +415 -135
- package/dist/message-hook.js +1 -1
- package/dist/watch.js +5 -5
- package/package.json +1 -1
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 = `
|
|
@@ -13501,11 +13501,11 @@ async function archiveRawSession(store2, sessionId) {
|
|
|
13501
13501
|
return await store2.putRawSession(sessionId, exp.tool, Math.floor(exp.mtime), gz, size);
|
|
13502
13502
|
}
|
|
13503
13503
|
function detectForkPredecessor(sessionPath) {
|
|
13504
|
-
const { readFileSync:
|
|
13505
|
-
const { dirname: dirname22, join:
|
|
13504
|
+
const { readFileSync: readFileSync55, readdirSync: readdirSync37 } = requireFs();
|
|
13505
|
+
const { dirname: dirname22, join: join65, basename: basename26 } = requirePath();
|
|
13506
13506
|
let text;
|
|
13507
13507
|
try {
|
|
13508
|
-
text =
|
|
13508
|
+
text = readFileSync55(sessionPath, "utf-8");
|
|
13509
13509
|
} catch {
|
|
13510
13510
|
return null;
|
|
13511
13511
|
}
|
|
@@ -13539,7 +13539,7 @@ function detectForkPredecessor(sessionPath) {
|
|
|
13539
13539
|
if (!f.endsWith(".jsonl") || f === self || f === "sessions-index.json")
|
|
13540
13540
|
continue;
|
|
13541
13541
|
try {
|
|
13542
|
-
if (
|
|
13542
|
+
if (readFileSync55(join65(dir, f), "utf-8").includes(`"uuid":"${headParent}"`)) {
|
|
13543
13543
|
return basename26(f, ".jsonl");
|
|
13544
13544
|
}
|
|
13545
13545
|
} catch {
|
|
@@ -14079,10 +14079,10 @@ var init_types = __esm({
|
|
|
14079
14079
|
|
|
14080
14080
|
// ../engine/dist/transcript/opencode.js
|
|
14081
14081
|
async function parseOpenCodeSubagents(parentSessionId) {
|
|
14082
|
-
const { existsSync:
|
|
14082
|
+
const { existsSync: existsSync53 } = await import("fs");
|
|
14083
14083
|
const { opencodeBackend: opencodeBackend2 } = await Promise.resolve().then(() => (init_opencode(), opencode_exports));
|
|
14084
14084
|
const dbPath = opencodeBackend2.dbPath();
|
|
14085
|
-
if (!
|
|
14085
|
+
if (!existsSync53(dbPath))
|
|
14086
14086
|
return [];
|
|
14087
14087
|
const realParent = parentSessionId.replace("opencode_", "");
|
|
14088
14088
|
const db = openOpencodeDbOrThrow(dbPath);
|
|
@@ -14123,10 +14123,10 @@ async function parseOpenCodeSubagents(parentSessionId) {
|
|
|
14123
14123
|
}
|
|
14124
14124
|
}
|
|
14125
14125
|
async function parseOpenCodeTranscript(sessionId) {
|
|
14126
|
-
const { existsSync:
|
|
14126
|
+
const { existsSync: existsSync53 } = await import("fs");
|
|
14127
14127
|
const { opencodeBackend: opencodeBackend2 } = await Promise.resolve().then(() => (init_opencode(), opencode_exports));
|
|
14128
14128
|
const dbPath = opencodeBackend2.dbPath();
|
|
14129
|
-
if (!
|
|
14129
|
+
if (!existsSync53(dbPath))
|
|
14130
14130
|
return [];
|
|
14131
14131
|
const realId = sessionId.replace("opencode_", "");
|
|
14132
14132
|
const db = openOpencodeDbOrThrow(dbPath);
|
|
@@ -24186,10 +24186,10 @@ var require_resolve_block_map = __commonJS({
|
|
|
24186
24186
|
let offset = bm.offset;
|
|
24187
24187
|
let commentEnd = null;
|
|
24188
24188
|
for (const collItem of bm.items) {
|
|
24189
|
-
const { start, key: key2, sep:
|
|
24189
|
+
const { start, key: key2, sep: sep5, value } = collItem;
|
|
24190
24190
|
const keyProps = resolveProps.resolveProps(start, {
|
|
24191
24191
|
indicator: "explicit-key-ind",
|
|
24192
|
-
next: key2 ??
|
|
24192
|
+
next: key2 ?? sep5?.[0],
|
|
24193
24193
|
offset,
|
|
24194
24194
|
onError,
|
|
24195
24195
|
parentIndent: bm.indent,
|
|
@@ -24203,7 +24203,7 @@ var require_resolve_block_map = __commonJS({
|
|
|
24203
24203
|
else if ("indent" in key2 && key2.indent !== bm.indent)
|
|
24204
24204
|
onError(offset, "BAD_INDENT", startColMsg);
|
|
24205
24205
|
}
|
|
24206
|
-
if (!keyProps.anchor && !keyProps.tag && !
|
|
24206
|
+
if (!keyProps.anchor && !keyProps.tag && !sep5) {
|
|
24207
24207
|
commentEnd = keyProps.end;
|
|
24208
24208
|
if (keyProps.comment) {
|
|
24209
24209
|
if (map.comment)
|
|
@@ -24227,7 +24227,7 @@ var require_resolve_block_map = __commonJS({
|
|
|
24227
24227
|
ctx.atKey = false;
|
|
24228
24228
|
if (utilMapIncludes.mapIncludes(ctx, map.items, keyNode))
|
|
24229
24229
|
onError(keyStart, "DUPLICATE_KEY", "Map keys must be unique");
|
|
24230
|
-
const valueProps = resolveProps.resolveProps(
|
|
24230
|
+
const valueProps = resolveProps.resolveProps(sep5 ?? [], {
|
|
24231
24231
|
indicator: "map-value-ind",
|
|
24232
24232
|
next: value,
|
|
24233
24233
|
offset: keyNode.range[2],
|
|
@@ -24243,7 +24243,7 @@ var require_resolve_block_map = __commonJS({
|
|
|
24243
24243
|
if (ctx.options.strict && keyProps.start < valueProps.found.offset - 1024)
|
|
24244
24244
|
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
24245
|
}
|
|
24246
|
-
const valueNode = value ? composeNode(ctx, value, valueProps, onError) : composeEmptyNode(ctx, offset,
|
|
24246
|
+
const valueNode = value ? composeNode(ctx, value, valueProps, onError) : composeEmptyNode(ctx, offset, sep5, null, valueProps, onError);
|
|
24247
24247
|
if (ctx.schema.compat)
|
|
24248
24248
|
utilFlowIndentCheck.flowIndentCheck(bm.indent, value, onError);
|
|
24249
24249
|
offset = valueNode.range[2];
|
|
@@ -24334,7 +24334,7 @@ var require_resolve_end = __commonJS({
|
|
|
24334
24334
|
let comment = "";
|
|
24335
24335
|
if (end) {
|
|
24336
24336
|
let hasSpace = false;
|
|
24337
|
-
let
|
|
24337
|
+
let sep5 = "";
|
|
24338
24338
|
for (const token of end) {
|
|
24339
24339
|
const { source, type } = token;
|
|
24340
24340
|
switch (type) {
|
|
@@ -24348,13 +24348,13 @@ var require_resolve_end = __commonJS({
|
|
|
24348
24348
|
if (!comment)
|
|
24349
24349
|
comment = cb;
|
|
24350
24350
|
else
|
|
24351
|
-
comment +=
|
|
24352
|
-
|
|
24351
|
+
comment += sep5 + cb;
|
|
24352
|
+
sep5 = "";
|
|
24353
24353
|
break;
|
|
24354
24354
|
}
|
|
24355
24355
|
case "newline":
|
|
24356
24356
|
if (comment)
|
|
24357
|
-
|
|
24357
|
+
sep5 += source;
|
|
24358
24358
|
hasSpace = true;
|
|
24359
24359
|
break;
|
|
24360
24360
|
default:
|
|
@@ -24397,18 +24397,18 @@ var require_resolve_flow_collection = __commonJS({
|
|
|
24397
24397
|
let offset = fc.offset + fc.start.source.length;
|
|
24398
24398
|
for (let i = 0; i < fc.items.length; ++i) {
|
|
24399
24399
|
const collItem = fc.items[i];
|
|
24400
|
-
const { start, key: key2, sep:
|
|
24400
|
+
const { start, key: key2, sep: sep5, value } = collItem;
|
|
24401
24401
|
const props = resolveProps.resolveProps(start, {
|
|
24402
24402
|
flow: fcName,
|
|
24403
24403
|
indicator: "explicit-key-ind",
|
|
24404
|
-
next: key2 ??
|
|
24404
|
+
next: key2 ?? sep5?.[0],
|
|
24405
24405
|
offset,
|
|
24406
24406
|
onError,
|
|
24407
24407
|
parentIndent: fc.indent,
|
|
24408
24408
|
startOnNewline: false
|
|
24409
24409
|
});
|
|
24410
24410
|
if (!props.found) {
|
|
24411
|
-
if (!props.anchor && !props.tag && !
|
|
24411
|
+
if (!props.anchor && !props.tag && !sep5 && !value) {
|
|
24412
24412
|
if (i === 0 && props.comma)
|
|
24413
24413
|
onError(props.comma, "UNEXPECTED_TOKEN", `Unexpected , in ${fcName}`);
|
|
24414
24414
|
else if (i < fc.items.length - 1)
|
|
@@ -24462,8 +24462,8 @@ var require_resolve_flow_collection = __commonJS({
|
|
|
24462
24462
|
}
|
|
24463
24463
|
}
|
|
24464
24464
|
}
|
|
24465
|
-
if (!isMap2 && !
|
|
24466
|
-
const valueNode = value ? composeNode(ctx, value, props, onError) : composeEmptyNode(ctx, props.end,
|
|
24465
|
+
if (!isMap2 && !sep5 && !props.found) {
|
|
24466
|
+
const valueNode = value ? composeNode(ctx, value, props, onError) : composeEmptyNode(ctx, props.end, sep5, null, props, onError);
|
|
24467
24467
|
coll.items.push(valueNode);
|
|
24468
24468
|
offset = valueNode.range[2];
|
|
24469
24469
|
if (isBlock(value))
|
|
@@ -24475,7 +24475,7 @@ var require_resolve_flow_collection = __commonJS({
|
|
|
24475
24475
|
if (isBlock(key2))
|
|
24476
24476
|
onError(keyNode.range, "BLOCK_IN_FLOW", blockMsg);
|
|
24477
24477
|
ctx.atKey = false;
|
|
24478
|
-
const valueProps = resolveProps.resolveProps(
|
|
24478
|
+
const valueProps = resolveProps.resolveProps(sep5 ?? [], {
|
|
24479
24479
|
flow: fcName,
|
|
24480
24480
|
indicator: "map-value-ind",
|
|
24481
24481
|
next: value,
|
|
@@ -24486,8 +24486,8 @@ var require_resolve_flow_collection = __commonJS({
|
|
|
24486
24486
|
});
|
|
24487
24487
|
if (valueProps.found) {
|
|
24488
24488
|
if (!isMap2 && !props.found && ctx.options.strict) {
|
|
24489
|
-
if (
|
|
24490
|
-
for (const st of
|
|
24489
|
+
if (sep5)
|
|
24490
|
+
for (const st of sep5) {
|
|
24491
24491
|
if (st === valueProps.found)
|
|
24492
24492
|
break;
|
|
24493
24493
|
if (st.type === "newline") {
|
|
@@ -24504,7 +24504,7 @@ var require_resolve_flow_collection = __commonJS({
|
|
|
24504
24504
|
else
|
|
24505
24505
|
onError(valueProps.start, "MISSING_CHAR", `Missing , or : between ${fcName} items`);
|
|
24506
24506
|
}
|
|
24507
|
-
const valueNode = value ? composeNode(ctx, value, valueProps, onError) : valueProps.found ? composeEmptyNode(ctx, valueProps.end,
|
|
24507
|
+
const valueNode = value ? composeNode(ctx, value, valueProps, onError) : valueProps.found ? composeEmptyNode(ctx, valueProps.end, sep5, null, valueProps, onError) : null;
|
|
24508
24508
|
if (valueNode) {
|
|
24509
24509
|
if (isBlock(value))
|
|
24510
24510
|
onError(valueNode.range, "BLOCK_IN_FLOW", blockMsg);
|
|
@@ -24684,7 +24684,7 @@ var require_resolve_block_scalar = __commonJS({
|
|
|
24684
24684
|
chompStart = i + 1;
|
|
24685
24685
|
}
|
|
24686
24686
|
let value = "";
|
|
24687
|
-
let
|
|
24687
|
+
let sep5 = "";
|
|
24688
24688
|
let prevMoreIndented = false;
|
|
24689
24689
|
for (let i = 0; i < contentStart; ++i)
|
|
24690
24690
|
value += lines[i][0].slice(trimIndent) + "\n";
|
|
@@ -24701,24 +24701,24 @@ var require_resolve_block_scalar = __commonJS({
|
|
|
24701
24701
|
indent2 = "";
|
|
24702
24702
|
}
|
|
24703
24703
|
if (type === Scalar.Scalar.BLOCK_LITERAL) {
|
|
24704
|
-
value +=
|
|
24705
|
-
|
|
24704
|
+
value += sep5 + indent2.slice(trimIndent) + content;
|
|
24705
|
+
sep5 = "\n";
|
|
24706
24706
|
} else if (indent2.length > trimIndent || content[0] === " ") {
|
|
24707
|
-
if (
|
|
24708
|
-
|
|
24709
|
-
else if (!prevMoreIndented &&
|
|
24710
|
-
|
|
24711
|
-
value +=
|
|
24712
|
-
|
|
24707
|
+
if (sep5 === " ")
|
|
24708
|
+
sep5 = "\n";
|
|
24709
|
+
else if (!prevMoreIndented && sep5 === "\n")
|
|
24710
|
+
sep5 = "\n\n";
|
|
24711
|
+
value += sep5 + indent2.slice(trimIndent) + content;
|
|
24712
|
+
sep5 = "\n";
|
|
24713
24713
|
prevMoreIndented = true;
|
|
24714
24714
|
} else if (content === "") {
|
|
24715
|
-
if (
|
|
24715
|
+
if (sep5 === "\n")
|
|
24716
24716
|
value += "\n";
|
|
24717
24717
|
else
|
|
24718
|
-
|
|
24718
|
+
sep5 = "\n";
|
|
24719
24719
|
} else {
|
|
24720
|
-
value +=
|
|
24721
|
-
|
|
24720
|
+
value += sep5 + content;
|
|
24721
|
+
sep5 = " ";
|
|
24722
24722
|
prevMoreIndented = false;
|
|
24723
24723
|
}
|
|
24724
24724
|
}
|
|
@@ -24901,25 +24901,25 @@ var require_resolve_flow_scalar = __commonJS({
|
|
|
24901
24901
|
trimBoth = /^[ \t]+|[ \t]+$/g;
|
|
24902
24902
|
}
|
|
24903
24903
|
let res = match[1].replace(trimEnd, "");
|
|
24904
|
-
let
|
|
24904
|
+
let sep5 = " ";
|
|
24905
24905
|
let pos = line.lastIndex;
|
|
24906
24906
|
while (match = line.exec(source)) {
|
|
24907
24907
|
const lm = match[1].replace(trimBoth, "");
|
|
24908
24908
|
if (lm === "") {
|
|
24909
|
-
if (
|
|
24910
|
-
res +=
|
|
24909
|
+
if (sep5 === "\n")
|
|
24910
|
+
res += sep5;
|
|
24911
24911
|
else
|
|
24912
|
-
|
|
24912
|
+
sep5 = "\n";
|
|
24913
24913
|
} else {
|
|
24914
|
-
res +=
|
|
24915
|
-
|
|
24914
|
+
res += sep5 + lm;
|
|
24915
|
+
sep5 = " ";
|
|
24916
24916
|
}
|
|
24917
24917
|
pos = line.lastIndex;
|
|
24918
24918
|
}
|
|
24919
24919
|
const last = /[ \t]*(.*)/sy;
|
|
24920
24920
|
last.lastIndex = pos;
|
|
24921
24921
|
match = last.exec(source);
|
|
24922
|
-
return res +
|
|
24922
|
+
return res + sep5 + (match?.[1] ?? "");
|
|
24923
24923
|
}
|
|
24924
24924
|
function doubleQuotedValue(source, onError) {
|
|
24925
24925
|
let res = "";
|
|
@@ -25729,14 +25729,14 @@ var require_cst_stringify = __commonJS({
|
|
|
25729
25729
|
}
|
|
25730
25730
|
}
|
|
25731
25731
|
}
|
|
25732
|
-
function stringifyItem({ start, key: key2, sep:
|
|
25732
|
+
function stringifyItem({ start, key: key2, sep: sep5, value }) {
|
|
25733
25733
|
let res = "";
|
|
25734
25734
|
for (const st of start)
|
|
25735
25735
|
res += st.source;
|
|
25736
25736
|
if (key2)
|
|
25737
25737
|
res += stringifyToken(key2);
|
|
25738
|
-
if (
|
|
25739
|
-
for (const st of
|
|
25738
|
+
if (sep5)
|
|
25739
|
+
for (const st of sep5)
|
|
25740
25740
|
res += st.source;
|
|
25741
25741
|
if (value)
|
|
25742
25742
|
res += stringifyToken(value);
|
|
@@ -26627,7 +26627,7 @@ var require_parser = __commonJS({
|
|
|
26627
26627
|
}
|
|
26628
26628
|
}
|
|
26629
26629
|
}
|
|
26630
|
-
var
|
|
26630
|
+
var Parser2 = class {
|
|
26631
26631
|
/**
|
|
26632
26632
|
* @param onNewLine - If defined, called separately with the start position of
|
|
26633
26633
|
* each new line (in `parse()`, including the start of input).
|
|
@@ -26903,18 +26903,18 @@ var require_parser = __commonJS({
|
|
|
26903
26903
|
if (this.type === "map-value-ind") {
|
|
26904
26904
|
const prev = getPrevProps(this.peek(2));
|
|
26905
26905
|
const start = getFirstKeyStartProps(prev);
|
|
26906
|
-
let
|
|
26906
|
+
let sep5;
|
|
26907
26907
|
if (scalar.end) {
|
|
26908
|
-
|
|
26909
|
-
|
|
26908
|
+
sep5 = scalar.end;
|
|
26909
|
+
sep5.push(this.sourceToken);
|
|
26910
26910
|
delete scalar.end;
|
|
26911
26911
|
} else
|
|
26912
|
-
|
|
26912
|
+
sep5 = [this.sourceToken];
|
|
26913
26913
|
const map = {
|
|
26914
26914
|
type: "block-map",
|
|
26915
26915
|
offset: scalar.offset,
|
|
26916
26916
|
indent: scalar.indent,
|
|
26917
|
-
items: [{ start, key: scalar, sep:
|
|
26917
|
+
items: [{ start, key: scalar, sep: sep5 }]
|
|
26918
26918
|
};
|
|
26919
26919
|
this.onKeyLine = true;
|
|
26920
26920
|
this.stack[this.stack.length - 1] = map;
|
|
@@ -27067,15 +27067,15 @@ var require_parser = __commonJS({
|
|
|
27067
27067
|
} else if (isFlowToken(it.key) && !includesToken(it.sep, "newline")) {
|
|
27068
27068
|
const start2 = getFirstKeyStartProps(it.start);
|
|
27069
27069
|
const key2 = it.key;
|
|
27070
|
-
const
|
|
27071
|
-
|
|
27070
|
+
const sep5 = it.sep;
|
|
27071
|
+
sep5.push(this.sourceToken);
|
|
27072
27072
|
delete it.key;
|
|
27073
27073
|
delete it.sep;
|
|
27074
27074
|
this.stack.push({
|
|
27075
27075
|
type: "block-map",
|
|
27076
27076
|
offset: this.offset,
|
|
27077
27077
|
indent: this.indent,
|
|
27078
|
-
items: [{ start: start2, key: key2, sep:
|
|
27078
|
+
items: [{ start: start2, key: key2, sep: sep5 }]
|
|
27079
27079
|
});
|
|
27080
27080
|
} else if (start.length > 0) {
|
|
27081
27081
|
it.sep = it.sep.concat(start, this.sourceToken);
|
|
@@ -27269,13 +27269,13 @@ var require_parser = __commonJS({
|
|
|
27269
27269
|
const prev = getPrevProps(parent);
|
|
27270
27270
|
const start = getFirstKeyStartProps(prev);
|
|
27271
27271
|
fixFlowSeqItems(fc);
|
|
27272
|
-
const
|
|
27273
|
-
|
|
27272
|
+
const sep5 = fc.end.splice(1, fc.end.length);
|
|
27273
|
+
sep5.push(this.sourceToken);
|
|
27274
27274
|
const map = {
|
|
27275
27275
|
type: "block-map",
|
|
27276
27276
|
offset: fc.offset,
|
|
27277
27277
|
indent: fc.indent,
|
|
27278
|
-
items: [{ start, key: fc, sep:
|
|
27278
|
+
items: [{ start, key: fc, sep: sep5 }]
|
|
27279
27279
|
};
|
|
27280
27280
|
this.onKeyLine = true;
|
|
27281
27281
|
this.stack[this.stack.length - 1] = map;
|
|
@@ -27400,7 +27400,7 @@ var require_parser = __commonJS({
|
|
|
27400
27400
|
}
|
|
27401
27401
|
}
|
|
27402
27402
|
};
|
|
27403
|
-
exports.Parser =
|
|
27403
|
+
exports.Parser = Parser2;
|
|
27404
27404
|
}
|
|
27405
27405
|
});
|
|
27406
27406
|
|
|
@@ -29093,7 +29093,7 @@ var init_http = __esm({
|
|
|
29093
29093
|
CLI_VERSION = JSON.parse(readFileSync42(new URL("../package.json", import.meta.url), "utf-8")).version || CLI_VERSION;
|
|
29094
29094
|
} catch {
|
|
29095
29095
|
try {
|
|
29096
|
-
if (true) CLI_VERSION = "0.7.
|
|
29096
|
+
if (true) CLI_VERSION = "0.7.30";
|
|
29097
29097
|
} catch {
|
|
29098
29098
|
}
|
|
29099
29099
|
}
|
|
@@ -29591,7 +29591,7 @@ var init_telemetry = __esm({
|
|
|
29591
29591
|
init_sync_client();
|
|
29592
29592
|
cliVersion2 = () => {
|
|
29593
29593
|
try {
|
|
29594
|
-
return true ? "0.7.
|
|
29594
|
+
return true ? "0.7.30" : "dev";
|
|
29595
29595
|
} catch {
|
|
29596
29596
|
return "dev";
|
|
29597
29597
|
}
|
|
@@ -31986,7 +31986,7 @@ var init_sync_client = __esm({
|
|
|
31986
31986
|
ownVersion = JSON.parse(readFileSync45(join55(dir, "../package.json"), "utf-8")).version || ownVersion;
|
|
31987
31987
|
} catch {
|
|
31988
31988
|
try {
|
|
31989
|
-
if (true) ownVersion = "0.7.
|
|
31989
|
+
if (true) ownVersion = "0.7.30";
|
|
31990
31990
|
} catch {
|
|
31991
31991
|
}
|
|
31992
31992
|
}
|
|
@@ -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, {
|
|
@@ -33743,8 +34011,8 @@ __export(install_hooks_exports, {
|
|
|
33743
34011
|
removeOurEntries: () => removeOurEntries,
|
|
33744
34012
|
uninstallHooks: () => uninstallHooks
|
|
33745
34013
|
});
|
|
33746
|
-
import { chmodSync as chmodSync7, copyFileSync as copyFileSync3, existsSync as
|
|
33747
|
-
import { dirname as dirname21, join as
|
|
34014
|
+
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";
|
|
34015
|
+
import { dirname as dirname21, join as join64 } from "node:path";
|
|
33748
34016
|
function isOurEntry(entry) {
|
|
33749
34017
|
const cmd = entry?.hooks?.[0]?.command;
|
|
33750
34018
|
if (typeof cmd !== "string") return false;
|
|
@@ -33754,8 +34022,8 @@ function claudeSettingsFiles() {
|
|
|
33754
34022
|
const out = [];
|
|
33755
34023
|
const seen = /* @__PURE__ */ new Set();
|
|
33756
34024
|
for (const home of claudeHomeDirs()) {
|
|
33757
|
-
if (!
|
|
33758
|
-
const file =
|
|
34025
|
+
if (!existsSync52(join64(home, "projects"))) continue;
|
|
34026
|
+
const file = join64(home, "settings.json");
|
|
33759
34027
|
let key2;
|
|
33760
34028
|
try {
|
|
33761
34029
|
key2 = realpathSync6(file);
|
|
@@ -33771,10 +34039,10 @@ function claudeSettingsFiles() {
|
|
|
33771
34039
|
}
|
|
33772
34040
|
function findScript(distDir, name) {
|
|
33773
34041
|
return [
|
|
33774
|
-
|
|
33775
|
-
|
|
33776
|
-
|
|
33777
|
-
].find((p) =>
|
|
34042
|
+
join64(distDir, "..", "hooks", name),
|
|
34043
|
+
join64(distDir, "..", "..", "hooks", name),
|
|
34044
|
+
join64(distDir, "..", "..", "..", "hooks", name)
|
|
34045
|
+
].find((p) => existsSync52(p));
|
|
33778
34046
|
}
|
|
33779
34047
|
function hookEntries(sel, paths) {
|
|
33780
34048
|
const cmd = (command, extra = {}) => [{ type: "command", command, ...extra }];
|
|
@@ -33818,9 +34086,9 @@ function removeOurEntries(config2) {
|
|
|
33818
34086
|
return removed;
|
|
33819
34087
|
}
|
|
33820
34088
|
function readJson4(file) {
|
|
33821
|
-
if (!
|
|
34089
|
+
if (!existsSync52(file)) return {};
|
|
33822
34090
|
try {
|
|
33823
|
-
const v = JSON.parse(
|
|
34091
|
+
const v = JSON.parse(readFileSync53(file, "utf-8"));
|
|
33824
34092
|
return v && typeof v === "object" && !Array.isArray(v) ? v : null;
|
|
33825
34093
|
} catch {
|
|
33826
34094
|
return null;
|
|
@@ -33834,15 +34102,15 @@ function writeJsonAtomic(file, value) {
|
|
|
33834
34102
|
}
|
|
33835
34103
|
mkdirSync17(dirname21(target), { recursive: true });
|
|
33836
34104
|
const tmp = `${target}.chat-recall-${process.pid}.tmp`;
|
|
33837
|
-
|
|
33838
|
-
|
|
34105
|
+
writeFileSync16(tmp, JSON.stringify(value, null, 2) + "\n");
|
|
34106
|
+
renameSync7(tmp, target);
|
|
33839
34107
|
}
|
|
33840
34108
|
function statePath() {
|
|
33841
|
-
return
|
|
34109
|
+
return join64(getHooksDir(), "install.json");
|
|
33842
34110
|
}
|
|
33843
34111
|
function readState() {
|
|
33844
34112
|
try {
|
|
33845
|
-
return JSON.parse(
|
|
34113
|
+
return JSON.parse(readFileSync53(statePath(), "utf-8"));
|
|
33846
34114
|
} catch {
|
|
33847
34115
|
return null;
|
|
33848
34116
|
}
|
|
@@ -33856,7 +34124,7 @@ async function installHooks(distDir, sel = ALL_HOOKS) {
|
|
|
33856
34124
|
if (!sel[key2]) continue;
|
|
33857
34125
|
const source = findScript(distDir, SCRIPTS[key2]);
|
|
33858
34126
|
if (!source) continue;
|
|
33859
|
-
const target =
|
|
34127
|
+
const target = join64(scriptsDir, SCRIPTS[key2]);
|
|
33860
34128
|
copyFileSync3(source, target);
|
|
33861
34129
|
chmodSync7(target, 493);
|
|
33862
34130
|
scripts[key2] = target;
|
|
@@ -33887,17 +34155,18 @@ async function installHooks(distDir, sel = ALL_HOOKS) {
|
|
|
33887
34155
|
mergeOurEntries(config2, entries);
|
|
33888
34156
|
writeJsonAtomic(settingsFile, config2);
|
|
33889
34157
|
report.written.push(settingsFile);
|
|
33890
|
-
report.migrated += migrateHooksJson(
|
|
34158
|
+
report.migrated += migrateHooksJson(join64(dirname21(settingsFile), "hooks.json"));
|
|
33891
34159
|
}
|
|
33892
34160
|
if (sel.guard && scripts.guard) report.guardTargets = await addGuardToOtherTools(scriptsDir, scripts.guard);
|
|
33893
34161
|
if (sel.messages && !shellSkipped) {
|
|
33894
34162
|
report.messageTargets = await addMessagesToOtherTools(scriptsDir, process.execPath, resolveMessageHookEntry(distDir));
|
|
33895
34163
|
}
|
|
34164
|
+
if (!sel.messages) unregisterTuiPlugin();
|
|
33896
34165
|
writeJsonAtomic(statePath(), { version: cliVersion(), selection: sel });
|
|
33897
34166
|
return report;
|
|
33898
34167
|
}
|
|
33899
34168
|
function migrateHooksJson(file) {
|
|
33900
|
-
if (!
|
|
34169
|
+
if (!existsSync52(file)) return 0;
|
|
33901
34170
|
const config2 = readJson4(file);
|
|
33902
34171
|
if (!config2) return 0;
|
|
33903
34172
|
const removed = removeOurEntries(config2);
|
|
@@ -33909,8 +34178,8 @@ function migrateHooksJson(file) {
|
|
|
33909
34178
|
async function uninstallHooks() {
|
|
33910
34179
|
const report = { removed: 0, files: [], guardRemoved: [], messagesRemoved: [] };
|
|
33911
34180
|
for (const settingsFile of claudeSettingsFiles()) {
|
|
33912
|
-
for (const file of [settingsFile,
|
|
33913
|
-
if (!
|
|
34181
|
+
for (const file of [settingsFile, join64(dirname21(settingsFile), "hooks.json")]) {
|
|
34182
|
+
if (!existsSync52(file)) continue;
|
|
33914
34183
|
const config2 = readJson4(file);
|
|
33915
34184
|
if (!config2) continue;
|
|
33916
34185
|
const removed = removeOurEntries(config2);
|
|
@@ -33947,13 +34216,13 @@ async function addGuardToOtherTools(scriptsDir, guardScript) {
|
|
|
33947
34216
|
const out = [];
|
|
33948
34217
|
removeLegacyAgyGuard(reg);
|
|
33949
34218
|
for (const target of reg.guardTargets()) {
|
|
33950
|
-
if (!
|
|
33951
|
-
const wrapper =
|
|
33952
|
-
|
|
34219
|
+
if (!existsSync52(target.homeDir)) continue;
|
|
34220
|
+
const wrapper = join64(scriptsDir, reg.guardWrapperName(target.tool));
|
|
34221
|
+
writeFileSync16(wrapper, reg.guardWrapperSource(target.tool, guardScript));
|
|
33953
34222
|
chmodSync7(wrapper, 493);
|
|
33954
34223
|
mkdirSync17(dirname21(target.configPath), { recursive: true });
|
|
33955
34224
|
if (target.tool === "opencode") {
|
|
33956
|
-
|
|
34225
|
+
writeFileSync16(target.configPath, reg.opencodePluginSource(wrapper));
|
|
33957
34226
|
} else {
|
|
33958
34227
|
const merged = reg.registerGuard(target.tool, readJson4(target.configPath) ?? {}, reg.guardCommand(wrapper));
|
|
33959
34228
|
writeJsonAtomic(target.configPath, merged);
|
|
@@ -33967,9 +34236,9 @@ async function removeGuardFromOtherTools() {
|
|
|
33967
34236
|
const out = [];
|
|
33968
34237
|
removeLegacyAgyGuard(reg);
|
|
33969
34238
|
for (const target of reg.guardTargets()) {
|
|
33970
|
-
if (!
|
|
34239
|
+
if (!existsSync52(target.configPath)) continue;
|
|
33971
34240
|
if (target.tool === "opencode") {
|
|
33972
|
-
if (!
|
|
34241
|
+
if (!readFileSync53(target.configPath, "utf-8").includes("chat-recall install-hooks")) continue;
|
|
33973
34242
|
unlinkSync5(target.configPath);
|
|
33974
34243
|
} else {
|
|
33975
34244
|
const r = reg.unregisterGuard(target.tool, readJson4(target.configPath) ?? {});
|
|
@@ -33982,7 +34251,7 @@ async function removeGuardFromOtherTools() {
|
|
|
33982
34251
|
}
|
|
33983
34252
|
function removeLegacyAgyGuard(reg) {
|
|
33984
34253
|
const file = reg.legacyAgyHooksFile();
|
|
33985
|
-
if (!
|
|
34254
|
+
if (!existsSync52(file)) return;
|
|
33986
34255
|
const r = reg.unregisterGuard("agy", readJson4(file) ?? {});
|
|
33987
34256
|
if (r.removed) writeJsonAtomic(file, r.config);
|
|
33988
34257
|
}
|
|
@@ -33990,18 +34259,26 @@ async function addMessagesToOtherTools(scriptsDir, nodePath, hookEntry) {
|
|
|
33990
34259
|
const reg = await Promise.resolve().then(() => (init_message_registration(), message_registration_exports));
|
|
33991
34260
|
const out = [];
|
|
33992
34261
|
for (const target of reg.messageTargets()) {
|
|
33993
|
-
if (!
|
|
33994
|
-
const wrapper =
|
|
33995
|
-
|
|
34262
|
+
if (!existsSync52(target.homeDir)) continue;
|
|
34263
|
+
const wrapper = join64(scriptsDir, reg.messageWrapperName(target.tool));
|
|
34264
|
+
writeFileSync16(wrapper, reg.messageWrapperSource(target.tool, nodePath, hookEntry));
|
|
33996
34265
|
chmodSync7(wrapper, 493);
|
|
33997
34266
|
mkdirSync17(dirname21(target.configPath), { recursive: true });
|
|
33998
34267
|
if (target.tool === "opencode") {
|
|
33999
|
-
|
|
34000
|
-
const dir =
|
|
34268
|
+
writeFileSync16(target.configPath, reg.opencodeMessagesSource(wrapper));
|
|
34269
|
+
const dir = join64(dirname21(target.configPath), reg.OPENCODE_TUI_PACKAGE);
|
|
34001
34270
|
mkdirSync17(dir, { recursive: true });
|
|
34002
|
-
for (const file of reg.opencodeTuiFiles(wrapper))
|
|
34271
|
+
for (const file of reg.opencodeTuiFiles(wrapper)) writeFileSync16(join64(dir, file.name), file.source);
|
|
34272
|
+
const tui = registerTuiPlugin();
|
|
34273
|
+
if (tui.status === "unparseable") {
|
|
34274
|
+
out.push({
|
|
34275
|
+
label: "OpenCode TUI",
|
|
34276
|
+
configPath: tui.path,
|
|
34277
|
+
note: `Not added: ${tui.reason}. Add "${tuiPluginEntry()}" to its plugin list by hand.`
|
|
34278
|
+
});
|
|
34279
|
+
}
|
|
34003
34280
|
} else if (target.tool === "pi") {
|
|
34004
|
-
|
|
34281
|
+
writeFileSync16(target.configPath, reg.piMessagesSource(wrapper));
|
|
34005
34282
|
} else {
|
|
34006
34283
|
const config2 = readJson4(target.configPath);
|
|
34007
34284
|
if (!config2) continue;
|
|
@@ -34014,15 +34291,17 @@ async function addMessagesToOtherTools(scriptsDir, nodePath, hookEntry) {
|
|
|
34014
34291
|
async function removeMessagesFromOtherTools() {
|
|
34015
34292
|
const reg = await Promise.resolve().then(() => (init_message_registration(), message_registration_exports));
|
|
34016
34293
|
const out = [];
|
|
34294
|
+
const tui = unregisterTuiPlugin();
|
|
34295
|
+
if (tui.removed) out.push({ label: "OpenCode TUI", configPath: tui.path });
|
|
34017
34296
|
for (const target of reg.messageTargets()) {
|
|
34018
|
-
if (!
|
|
34297
|
+
if (!existsSync52(target.configPath)) continue;
|
|
34019
34298
|
if (target.tool === "opencode" || target.tool === "pi") {
|
|
34020
|
-
if (!reg.isOurPluginSource(
|
|
34299
|
+
if (!reg.isOurPluginSource(readFileSync53(target.configPath, "utf-8"))) continue;
|
|
34021
34300
|
unlinkSync5(target.configPath);
|
|
34022
34301
|
if (target.tool === "opencode") {
|
|
34023
|
-
const dir =
|
|
34024
|
-
const
|
|
34025
|
-
if (
|
|
34302
|
+
const dir = join64(dirname21(target.configPath), reg.OPENCODE_TUI_PACKAGE);
|
|
34303
|
+
const tui2 = join64(dir, "tui.js");
|
|
34304
|
+
if (existsSync52(tui2) && reg.isOurTuiSource(readFileSync53(tui2, "utf-8"))) rmSync10(dir, { recursive: true, force: true });
|
|
34026
34305
|
}
|
|
34027
34306
|
} else {
|
|
34028
34307
|
const config2 = readJson4(target.configPath);
|
|
@@ -34044,6 +34323,7 @@ var init_install_hooks = __esm({
|
|
|
34044
34323
|
init_tool_paths();
|
|
34045
34324
|
init_board_hooks();
|
|
34046
34325
|
init_http();
|
|
34326
|
+
init_opencode_tui_config();
|
|
34047
34327
|
ALL_HOOKS = {
|
|
34048
34328
|
save: true,
|
|
34049
34329
|
resume: true,
|
|
@@ -40632,7 +40912,7 @@ function openBrowser(url) {
|
|
|
40632
40912
|
// src/mcp.ts
|
|
40633
40913
|
init_client_events();
|
|
40634
40914
|
init_update_notice();
|
|
40635
|
-
import { readFileSync as
|
|
40915
|
+
import { readFileSync as readFileSync54 } from "node:fs";
|
|
40636
40916
|
|
|
40637
40917
|
// src/channel.ts
|
|
40638
40918
|
init_session_messages();
|
|
@@ -40892,7 +41172,7 @@ async function runChannel(deps) {
|
|
|
40892
41172
|
|
|
40893
41173
|
// src/mcp.ts
|
|
40894
41174
|
setServerVersion(JSON.parse(
|
|
40895
|
-
|
|
41175
|
+
readFileSync54(new URL("../package.json", import.meta.url), "utf-8")
|
|
40896
41176
|
).version);
|
|
40897
41177
|
setEventReporter(reportClientEvent2);
|
|
40898
41178
|
setIndexRunner(runIndexChild2);
|
|
@@ -41065,7 +41345,7 @@ function installCrashGuards() {
|
|
|
41065
41345
|
reportClientEvent2("mcp_crash", { message: err.stack || err.message });
|
|
41066
41346
|
});
|
|
41067
41347
|
}
|
|
41068
|
-
var RELAY_VERSION = true ? "0.7.
|
|
41348
|
+
var RELAY_VERSION = true ? "0.7.30" : "0.0.0";
|
|
41069
41349
|
function daemonIdleSecs() {
|
|
41070
41350
|
const raw = process.env.CHAT_RECALL_DAEMON_IDLE_SECS;
|
|
41071
41351
|
if (raw === void 0) return 900;
|
|
@@ -41174,7 +41454,7 @@ async function runDaemon() {
|
|
|
41174
41454
|
}
|
|
41175
41455
|
function installedVersion2() {
|
|
41176
41456
|
try {
|
|
41177
|
-
const pkg = JSON.parse(
|
|
41457
|
+
const pkg = JSON.parse(readFileSync54(new URL("../package.json", import.meta.url), "utf-8"));
|
|
41178
41458
|
return typeof pkg.version === "string" ? pkg.version : null;
|
|
41179
41459
|
} catch {
|
|
41180
41460
|
return null;
|